def main(idata,status,case): stat2check = [2,5] mustexist = [] tocreate = [] #-------------------------------------------------------# # Read Pilgrim input files, check file/folder status # # and expand tuple 'case' # #-------------------------------------------------------# # expand data (dctc,dimasses), ltemp, dpath, (dtesLL,dtesHL), dchem, tkmc, ddlevel = idata # status ok? fstatus = status_check(status,stat2check) if fstatus == -1: exit() # existency of folders fstatus = ffchecking(mustexist,tocreate) if fstatus == -1: exit() # expand case (dof,hlf,plotfile),dlevel,software = case #-------------------------------------------------------# # read dofs dall, ltemp = RW.read_alldata(dof) # get saved reactions print_string(PS.skies_summary(dchem,dall),5) # Ask user which reactions count = 0 while True: # Ask user for reactions bool_end,bool_cont,reaction1,reaction2 = ask_for_reactions(dchem) print("") print("") if bool_end : break if bool_cont: continue kies_from_pair_of_reactions(reaction1,reaction2,ltemp,dchem,dctc,dall)
if fstatus == -1: exit() # existency of folders fstatus = ffchecking(mustexist, tocreate) if fstatus == -1: exit() # expand case (dof, hlf, plotfile), dlevel, software = case #-------------------------------------------------------# # no specific target selected if "*" in targets or len(targets) == 0: targets = dchem.keys() # clean targets targets = sorted([target for target in targets if target in dchem.keys()]) # read dof dall = RW.read_alldata(dof, ltemp)[0] #--------------------------------# # Calculations for each reaction # #--------------------------------# print(" " * NINIT + "Analytic expressions:") print("") print(" " * NINIT + "(1) k = A exp(-B/T) ") print(" " * NINIT + "(2) k = A*T^n*exp(-B/T) ") print(" " * NINIT + "(3) k = A*(T/Tr)^n*exp(-B/T) ") print(" " * NINIT + "(4) k = A*(T/Tr)^n*exp(-B*(T+T0)/(T^2+T0^2))") print(" " * NINIT + "(5) k = A*((T+T0)/Tr)^n*exp(-B*(T+T0)/(T^2+T0^2))") print("") LINES, plotdata = {}, {} ml = max(len(rcname) for rcname in targets) + 3
def get_reaction_energies(TS, dchem, dof): ''' * checks the reactions which involved the target transition state (TS) in order to extract V0 and V1 for reactants and products ''' # initialize variables reaction = None Eref = None V0R = None V0P = None V1R = None V1P = None GibbsR = None # select reaction ctc, itc = PN.name2data(TS) for rname in dchem.keys(): Rs, ts, Ps = dchem[rname] ctc2, itc2 = PN.name2data(ts) if ctc == ctc2: reaction = rname if itc == itc2: break # no reaction? if reaction is None: return reaction, V0R, V0P, V1R, V1P, GibbsR # read dof dall = RW.read_alldata(dof)[0] # get energy from reaction Rs = dchem[reaction][0] Ps = dchem[reaction][2] # reactants if len(Rs) != 0: V0R, V1R = 0.0, 0.0 for R in Rs: ctc, itc = PN.name2data(R) if itc is None: key = PN.struckey(ctc, "msho") else: key = R data = dall["pfn"].get(key, None) if data is None: V0R, V1R = None, None break V0, V1, pfns = data V0R += V0 V1R += V1 # Gibbs energy if key in dall["gibbs1cm3"].keys(): gibbs = dall["gibbs1cm3"][key] if GibbsR is None: GibbsR = gibbs else: GibbsR = [gi + gj for gi, gj in zip(GibbsR, gibbs)] # products if len(Ps) != 0: V0P, V1P = 0.0, 0.0 for P in Ps: ctc, itc = PN.name2data(P) if itc is None: key = PN.struckey(ctc, "msho") else: key = P data = dall["pfn"].get(key, None) if data is None: V0P, V1P = None, None break V0, V1, pfns = data V0P += V0 V1P += V1 # Output return reaction, V0R, V0P, V1R, V1P, GibbsR