def ls_struc(dctc): ''' extra option to show what's in .ctc file to show: ls ctc ''' ib = " " htable = [ "struc name", "m.form.", "num.ifreqs.", "ch", "mtp", "num.confs." ] # some numbers and list for nice formatting ml1 = max([len(ctc) for ctc in dctc.keys()] + [len(htable[0])]) ml2 = max([len(CTC._mformu) for CTC in dctc.values()] + [len(htable[1])]) ll = [ml1, ml2, len(htable[2]), 3, 3, len(htable[5])] # fill strings in htable htable = [fill_string(string, ml) for ml, string in zip(ll, htable)] # start loop htable = " " + " | ".join(htable) + " " divis = "-" * len(htable) stable = "\n" stable += ib + divis + "\n" stable += ib + htable + "\n" stable += ib + divis + "\n" # separate minima from saddle point and from other (xx) ctc_min = sorted([ctc for ctc in dctc.keys() if dctc[ctc]._type == 0]) ctc_ts = sorted([ctc for ctc in dctc.keys() if dctc[ctc]._type == 1]) ctc_xx = sorted( [ctc for ctc in dctc.keys() if dctc[ctc]._type not in [0, 1]]) for ctcs in [ctc_min, ctc_ts, ctc_xx]: if ctcs == []: continue for ctc in ctcs: mformu = dctc[ctc]._mformu itcs = dctc[ctc]._itcs ch = dctc[ctc]._ch mtp = dctc[ctc]._mtp sptype = dctc[ctc]._type # variable to string ncnfs = "%i" % int(sum([weight for itc, weight in itcs])) ch = "%i" % ch mtp = "%i" % mtp nif = "%i" % sptype # fill strings ltable = [ctc, mformu, nif, ch, mtp, ncnfs] ltable = [ fill_string(string, ml) for ml, string in zip(ll, ltable) ] # add to table ltable = " " + " | ".join(ltable) + " " stable += ib + ltable + "\n" stable += ib + divis + "\n" print stable
# Analyze point by point wrongconn = [] repeated = [] outofdomain = [] norestr = [] wimag = [] iii = len(str(len(dataconfs))) jjj = max(len(str(vec0)),len("angles")) kkk = max(inpvars._ntorsions*2+2,len("conf")) if inpvars._ts: lengths = (iii,jjj,kkk,6,7,7,7,7,8) head = ("","angles","conf","weight","E","E+ZPE","Gibbs","X","ifreq") else: lengths = (iii,jjj,kkk,6,7,7,7,7) head = ("","angles","conf","weight","E","E+ZPE","Gibbs","X") table_head = " "+" | ".join(fncs.fill_string(col,length) for col,length in zip(head,lengths))+" " print(IBS2+"-"*len(table_head)) print(IBS2+table_head) print(IBS2+"-"*len(table_head)) nomenclatures = [] QMSHO = np.array([0.0 for temp in inpvars._temps]) QMSHO_pre = np.array([0.0 for temp in inpvars._temps]) QMSHO_sto = np.array([0.0 for temp in inpvars._temps]) count_pre = 0 count_sto = 0 # calculate quotient of Xj xj_quo = 0.0 beta = 1.0/pc.KB/inpvars._temp for idx_j,conftuple_j in enumerate(dataconfs): vec_j,V0_j,V1_j,Gj,weight_j,Qrv_j,ifreq_j,lzmat_j,zmatvals_j,log_j = conftuple_j xj_quo += weight_j*np.exp(-(Gj-minG)*beta)
def ls_struc(dctc): ''' extra option to show what's in .ctc file to show: ls ctc ''' ib = " " htable = [ "species name", "m.form.", "num.ifreqs.", "ch", "mtp", "num.confs.", "iso.mod." ] # some numbers and list for nice formatting ml1 = max([len(ctc) for ctc in dctc.keys()] + [len(htable[0])]) ml2 = max([len(CTC._mformu) for CTC in dctc.values()] + [len(htable[1])]) ll = [ml1, ml2, len(htable[2]), 3, 3, len(htable[5]), len(htable[6])] # fill strings in htable htable = [fill_string(string, ml) for ml, string in zip(ll, htable)] # start loop htable = " " + " | ".join(htable) + " " divis = "-" * len(htable) stable = "\n" stable += ib + divis + "\n" stable += ib + htable + "\n" stable += ib + divis + "\n" # separate minima from saddle point and from other (xx) ctc_root_min = sorted([ ctc for ctc in dctc.keys() if dctc[ctc]._type == 0 and dctc[ctc]._diso == {} ]) ctc_root_ts = sorted([ ctc for ctc in dctc.keys() if dctc[ctc]._type == 1 and dctc[ctc]._diso == {} ]) ctc_isoX_min = sorted([ ctc for ctc in dctc.keys() if dctc[ctc]._type == 0 and dctc[ctc]._diso != {} ]) ctc_isoX_ts = sorted([ ctc for ctc in dctc.keys() if dctc[ctc]._type == 1 and dctc[ctc]._diso != {} ]) ctc_xx = sorted( [ctc for ctc in dctc.keys() if dctc[ctc]._type not in [0, 1]]) numSP0, numSP0all = 0, 0 numSP1, numSP1all = 0, 0 numSPX, numSPXall = 0, 0 for idx, ctcs in enumerate( [ctc_root_min + ctc_isoX_min, ctc_root_ts + ctc_isoX_ts, ctc_xx]): if ctcs == []: continue for ctc in ctcs: mformu = dctc[ctc]._mformu itcs = dctc[ctc]._itcs ch = dctc[ctc]._ch mtp = dctc[ctc]._mtp sptype = dctc[ctc]._type diso = dctc[ctc]._diso if diso == {}: isostr = "none" else: try: isostr = " ".join(diso["*"]) except: isostr = "yes" # count conformers num1 = len(itcs) num2 = int(sum([weight for itc, weight in itcs])) # variable to string ncnfs = "%i (%i)" % (num2, num1) ch = "%i" % ch mtp = "%i" % mtp nif = "%i" % sptype # fill strings ltable = [ "%%-%is" % ml1 % ctc, "%%-%is" % ml2 % mformu, nif, ch, mtp, ncnfs, isostr ] ltable = [ fill_string(string, ml) for ml, string in zip(ll, ltable) ] # add to table ltable = " " + " | ".join(ltable) + " " stable += ib + ltable + "\n" if sptype == 0: numSP0 += num1 numSP0all += num2 elif sptype == 1: numSP1 += num1 numSP1all += num2 else: numSPX += num1 numSPXall += num2 stable += ib + divis + "\n" stable += ib + " * num(minimum) = %i (%i)\n" % (numSP0all, numSP0) stable += ib + " * num(saddle ) = %i (%i)\n" % (numSP1all, numSP1) print(stable)