def reaction_fs(run_prefix, save_prefix, rxn_info): """ Build reaction filesystem for a big list """ rxn_run_fs = autofile.fs.reaction(run_prefix) rxn_save_fs = autofile.fs.reaction(save_prefix) rxn_run_path = rxn_run_fs[-1].path(rinfo.sort(rxn_info)) rxn_save_path = rxn_save_fs[-1].path(rinfo.sort(rxn_info)) return (rxn_run_fs, rxn_save_fs, rxn_run_path, rxn_save_path)
def reactions(rxn_info, ini_thy_info, zma_locs, save_prefix): """ Check if reaction exists in the filesystem and has been identified """ zrxns, zmas = (), () sort_rxn_info = rinfo.sort(rxn_info, scheme='autofile') ts_info = rinfo.ts_info(rxn_info) mod_ini_thy_info = tinfo.modify_orb_label(ini_thy_info, ts_info) rxn_fs = autofile.fs.reaction(save_prefix) if rxn_fs[-1].exists(sort_rxn_info): _, ts_save_fs = build_fs(save_prefix, save_prefix, 'TRANSITION STATE', rxn_locs=sort_rxn_info, thy_locs=mod_ini_thy_info[1:]) for ts_locs in ts_save_fs[-1].existing(): zrxn, zma = reaction(rxn_info, ini_thy_info, zma_locs, save_prefix, ts_locs=ts_locs) if zrxn is not None: zrxns += (zrxn, ) zmas += (zma, ) if not zrxns: zrxns, zmas = None, None return zrxns, zmas
def create_reaction_filesystems(prefix, rxn_info, mod_thy_info, ts_locs=None, locs=None): # species filesystem print('rxn_info', rxn_info) rxn_fs = autofile.fs.reaction(prefix) sort_rxn_info = rinfo.sort(rxn_info, scheme='autofile') rxn_fs[-1].create(sort_rxn_info) rxn_prefix = rxn_fs[-1].path(sort_rxn_info) # theory filesystem thy_fs = autofile.fs.theory(rxn_prefix) thy_fs[-1].create(mod_thy_info[1:]) thy_prefix = thy_fs[-1].path(mod_thy_info[1:]) if ts_locs is None: ts_locs = (0, ) ts_fs = autofile.fs.transition_state(thy_prefix) ts_fs[-1].create(ts_locs) ts_prefix = ts_fs[-1].path(ts_locs) # conformer cnf_fs = autofile.fs.conformer(ts_prefix) if locs is not None: cnf_fs[-1].create(locs) cnf_prefix = cnf_fs[-1].path(locs) else: cnf_prefix = None return ((rxn_fs, thy_fs, ts_fs, cnf_fs), (rxn_prefix, thy_prefix, ts_prefix, cnf_prefix))
def create_ts_spc(ref, spc_dct, mult, run_prefix, save_prefix, rxnclass): """ add a ts species to the species dictionary """ spec = {} spec['reacs'] = list(ref[0]) spec['prods'] = list(ref[1]) spec['charge'] = 0 spec['inchi'] = '' spec['class'] = rxnclass spec['mult'] = mult rxn_ichs = [[], []] ioprinter.info_message('spec in build spc', spec) for rct_ich in spec['reacs']: if rct_ich: rxn_ichs[0].append(automol.inchi.add_stereo(rct_ich)) for prd_ich in spec['prods']: if prd_ich: rxn_ichs[1].append(automol.inchi.add_stereo(prd_ich)) rct_muls = [] prd_muls = [] rct_chgs = [] prd_chgs = [] for rct in spec['reacs']: found = False for name in spc_dct: if 'inchi' in spc_dct[name]: if spc_dct[name]['inchi'] == rct: rct_muls.append(spc_dct[name]['mult']) rct_chgs.append(spc_dct[name]['charge']) found = True break if not found: new_spc = create_spec(rct) rct_muls.append(new_spc['mult']) rct_chgs.append(new_spc['charge']) for rct in spec['prods']: found = False for name in spc_dct: if 'inchi' in spc_dct[name]: if spc_dct[name]['inchi'] == rct: prd_muls.append(spc_dct[name]['mult']) prd_chgs.append(spc_dct[name]['charge']) found = True break if not found: new_spc = create_spec(rct) prd_muls.append(new_spc['mult']) prd_chgs.append(new_spc['charge']) rxn_muls = [rct_muls, prd_muls] rxn_chgs = [rct_chgs, prd_chgs] rxn_info = rinfo.sort((rxn_ichs, rxn_chgs, rxn_muls, mult)) spec['rxn_info'] = rxn_info spec['ts_locs'] = (0, ) rxn_run_fs, rxn_save_fs = build_fs(run_prefix, save_prefix, 'REACTION') rxn_run_path = rxn_run_fs[-1].path(rxn_info) rxn_save_path = rxn_save_fs[-1].path(rxn_info) spec['rxn_fs'] = [rxn_run_fs, rxn_save_fs, rxn_run_path, rxn_save_path] return spec
def root_locs(spc_dct_i, saddle=False, name=None): """ Set the root locatores for the species and TS """ if not saddle: spc_info = sinfo.from_dct(spc_dct_i) rxn_info = None ts_info = None else: spc_info = None rxn_info = rinfo.sort(spc_dct_i['rxn_info']) ts_num = int(name.split('_')[-1]) ts_info = (ts_num, ) return {'spc_locs': spc_info, 'rxn_locs': rxn_info, 'ts_locs': ts_info}
def reaction(rxn_info, ini_thy_info, zma_locs, save_prefix, ts_locs=(0, ), hbond_cutoffs=None): """ Check if reaction exists in the filesystem and has been identified """ zrxn, zma = None, None sort_rxn_info = rinfo.sort(rxn_info, scheme='autofile') ts_info = rinfo.ts_info(rxn_info) mod_ini_thy_info = tinfo.modify_orb_label(ini_thy_info, ts_info) rxn_fs = autofile.fs.reaction(save_prefix) if rxn_fs[-1].exists(sort_rxn_info): _, cnf_save_fs = build_fs(save_prefix, save_prefix, 'CONFORMER', rxn_locs=sort_rxn_info, thy_locs=mod_ini_thy_info[1:], ts_locs=ts_locs) _, ini_min_cnf_path = min_energy_conformer_locators( cnf_save_fs, mod_ini_thy_info, hbond_cutoffs=hbond_cutoffs) if ini_min_cnf_path: zma_fs = autofile.fs.zmatrix(ini_min_cnf_path) if zma_fs[-1].file.reaction.exists(zma_locs): zrxn = zma_fs[-1].file.reaction.read(zma_locs) zma = zma_fs[-1].file.zmatrix.read(zma_locs) # For barrierless reactions with no conformer if zrxn is None: _, zma_fs = build_fs(save_prefix, save_prefix, 'ZMATRIX', rxn_locs=sort_rxn_info, ts_locs=ts_locs, thy_locs=mod_ini_thy_info[1:]) if zma_fs[-1].file.reaction.exists(zma_locs): zrxn = zma_fs[-1].file.reaction.read(zma_locs) zma = zma_fs[-1].file.zmatrix.read(zma_locs) return zrxn, zma
def _read_from_filesys(rxn_info, ini_thy_info, zma_locs, save_prefix): """ Check if reaction exists in the filesystem and has been identified """ zrxn, zma = None, None sort_rxn_info = rinfo.sort(rxn_info, scheme='autofile') ts_info = rinfo.ts_info(rxn_info) mod_ini_thy_info = tinfo.modify_orb_label(ini_thy_info, ts_info) rxn_fs = autofile.fs.reaction(save_prefix) if rxn_fs[-1].exists(sort_rxn_info): _, cnf_save_fs = build_fs( save_prefix, save_prefix, 'CONFORMER', rxn_locs=sort_rxn_info, thy_locs=mod_ini_thy_info[1:], # this needs to be fixed for any case with more than one TS ts_locs=(0, )) _, ini_min_cnf_path = filesys.mincnf.min_energy_conformer_locators( cnf_save_fs, mod_ini_thy_info) if ini_min_cnf_path: zma_fs = autofile.fs.zmatrix(ini_min_cnf_path) if zma_fs[-1].file.reaction.exists(zma_locs): zrxn = zma_fs[-1].file.reaction.read(zma_locs) zma = zma_fs[-1].file.zmatrix.read(zma_locs) ts_locs = (0, ) if zrxn is None: _, zma_fs = build_fs('', save_prefix, 'ZMATRIX', rxn_locs=sort_rxn_info, ts_locs=ts_locs, thy_locs=mod_ini_thy_info[1:]) if zma_fs[-1].file.reaction.exists(zma_locs): zrxn = zma_fs[-1].file.reaction.read(zma_locs) zma = zma_fs[-1].file.zmatrix.read(zma_locs) return zrxn, zma
def root_locs(spc_dct_i, saddle=False, name=None): """ Set the root locatores for the species and TS """ if not saddle: spc_info = sinfo.from_dct(spc_dct_i) rxn_info = None ts_info = None else: spc_info = None rxn_info = rinfo.sort(spc_dct_i['rxn_info']) ts_num = int(name.split('_')[-1]) ts_info = (ts_num, ) # if 'ts_locs' in spc_dct_i: # ts_info = spc_dct_i['ts_locs'] # else: # ts_num = int(name.split('_')[-1]) # ts_info = (ts_num,) # print('TEST ts locs:', ts_info) # ts_info = (0,) # may be more complicated # ts_info = () return {'spc_locs': spc_info, 'rxn_locs': rxn_info, 'ts_locs': ts_info}
def _set_thy_inf_dcts(tsname, ts_dct, thy_dct, es_keyword_dct, run_prefix, save_prefix, zma_locs=(0, )): """ set the theory """ rxn_info = ts_dct['rxn_info'] ts_info = rinfo.ts_info(rxn_info) rct_info = rinfo.rgt_info(rxn_info, 'reacs') rxn_info = rinfo.sort(rxn_info) ts_locs = (int(tsname.split('_')[-1]), ) high_mult = rinfo.ts_mult(rxn_info, rxn_mul='high') # Set the hs info hs_info = (ts_info[0], ts_info[1], high_mult) # Initialize the theory objects ini_thy_info, mod_ini_thy_info = None, None thy_info, mod_thy_info = None, None vscnlvl_thy_info, mod_vscnlvl_thy_info = None, None vsp1lvl_thy_info, mod_vsp1lvl_thy_info = None, None vsp2lvl_thy_info, mod_vsp2lvl_thy_info = None, None hs_vscnlvl_thy_info = None hs_vsp1lvl_thy_info = None hs_vsp2lvl_thy_info = None hs_thy_info = None # Initialize the necessary run filesystem runlvl_ts_run_fs = None runlvl_scn_run_fs = None runlvl_cscn_run_fs = None vscnlvl_ts_run_fs = None vscnlvl_scn_run_fs = None vscnlvl_cscn_run_fs = None vrctst_run_fs = None # Initialize the necessary save filesystem ini_zma_save_fs = None runlvl_ts_save_fs = None runlvl_scn_save_fs = None # above cnf filesys, for search scans runlvl_cscn_save_fs = None # above cnf filesys, for search scans runlvl_cnf_save_fs = None vscnlvl_thy_save_fs = None vscnlvl_ts_save_fs = None vscnlvl_scn_save_fs = None vscnlvl_cscn_save_fs = None vrctst_save_fs = None runlvl_ts_zma_fs = None if es_keyword_dct.get('inplvl', None) is not None: ini_method_dct = thy_dct.get(es_keyword_dct['inplvl']) ini_thy_info = tinfo.from_dct(ini_method_dct) mod_ini_thy_info = tinfo.modify_orb_label(ini_thy_info, ts_info) ini_cnf_run_fs, ini_cnf_save_fs = build_fs( run_prefix, save_prefix, 'CONFORMER', rxn_locs=rxn_info, ts_locs=ts_locs, thy_locs=mod_ini_thy_info[1:]) ini_loc_info = filesys.mincnf.min_energy_conformer_locators( ini_cnf_save_fs, mod_ini_thy_info) ini_min_cnf_locs, ini_path = ini_loc_info if ini_path: ini_zma_save_fs = autofile.fs.zmatrix( ini_cnf_save_fs[-1].path(ini_min_cnf_locs)) if es_keyword_dct.get('runlvl', None) is not None: method_dct = thy_dct.get(es_keyword_dct['runlvl']) thy_info = tinfo.from_dct(method_dct) mod_thy_info = tinfo.modify_orb_label(thy_info, ts_info) hs_thy_info = tinfo.modify_orb_label(thy_info, hs_info) runlvl_cnf_run_fs, runlvl_cnf_save_fs = build_fs( run_prefix, save_prefix, 'CONFORMER', rxn_locs=rxn_info, ts_locs=ts_locs, thy_locs=mod_thy_info[1:]) _, runlvl_ts_zma_save_fs = build_fs(run_prefix, save_prefix, 'ZMATRIX', rxn_locs=rxn_info, ts_locs=ts_locs, thy_locs=mod_thy_info[1:]) runlvl_loc_info = filesys.mincnf.min_energy_conformer_locators( runlvl_cnf_save_fs, mod_thy_info) runlvl_min_cnf_locs, _ = runlvl_loc_info runlvl_cnf_save_fs = (runlvl_cnf_save_fs, runlvl_min_cnf_locs) runlvl_scn_run_fs, runlvl_scn_save_fs = build_fs( run_prefix, save_prefix, 'SCAN', rxn_locs=rxn_info, ts_locs=ts_locs, thy_locs=mod_thy_info[1:], zma_locs=(0, )) runlvl_cscn_run_fs, runlvl_cscn_save_fs = build_fs( run_prefix, save_prefix, 'CSCAN', rxn_locs=rxn_info, ts_locs=ts_locs, thy_locs=mod_thy_info[1:], zma_locs=(0, )) if es_keyword_dct.get('var_scnlvl', None) is not None: method_dct = thy_dct.get(es_keyword_dct['var_scnlvl']) vscnlvl_thy_info = tinfo.from_dct(method_dct) mod_vscnlvl_thy_info = tinfo.modify_orb_label(vscnlvl_thy_info, ts_info) hs_vscnlvl_thy_info = tinfo.modify_orb_label(vscnlvl_thy_info, hs_info) vscnlvl_scn_run_fs, vscnlvl_scn_save_fs = build_fs( run_prefix, save_prefix, 'SCAN', rxn_locs=rxn_info, ts_locs=ts_locs, thy_locs=mod_thy_info[1:], zma_locs=(0, )) vscnlvl_cscn_run_fs, vscnlvl_cscn_save_fs = build_fs( run_prefix, save_prefix, 'CSCAN', rxn_locs=rxn_info, ts_locs=ts_locs, thy_locs=mod_thy_info[1:], zma_locs=(0, )) vrctst_run_fs, vrctst_save_fs = build_fs(run_prefix, save_prefix, 'VRCTST', rxn_locs=rxn_info, ts_locs=ts_locs, thy_locs=mod_thy_info[1:]) if es_keyword_dct.get('var_splvl1', None) is not None: method_dct = thy_dct.get(es_keyword_dct['var_scnlvl1']) vsplvl1_thy_info = tinfo.from_dct(method_dct) mod_vsplvl1_thy_info = tinfo.modify_orb_label( vsplvl1_thy_info, ts_info) hs_vsplvl1_thy_info = tinfo.modify_orb_label( vsplvl1_thy_info, hs_info) if es_keyword_dct.get('var_splvl2', None) is not None: method_dct = thy_dct.get(es_keyword_dct['var_scnlvl2']) vsplvl2_thy_info = tinfo.from_dct(method_dct) mod_vsplvl2_thy_info = tinfo.modify_orb_label( vsplvl2_thy_info, ts_info) hs_vsplvl2_thy_info = tinfo.modify_orb_label( vsplvl2_thy_info, hs_info) # Get the conformer filesys for the reactants _rcts_cnf_fs = rcts_cnf_fs(rct_info, thy_dct, es_keyword_dct, run_prefix, save_prefix) thy_inf_dct = { 'inplvl': ini_thy_info, 'runlvl': thy_info, 'var_scnlvl': vscnlvl_thy_info, 'var_splvl1': vsp1lvl_thy_info, 'var_splvl2': vsp2lvl_thy_info, 'mod_inplvl': mod_ini_thy_info, 'mod_runlvl': mod_thy_info, 'mod_var_scnlvl': mod_vscnlvl_thy_info, 'mod_var_splvl1': mod_vsp1lvl_thy_info, 'mod_var_splvl2': mod_vsp2lvl_thy_info, 'hs_var_scnlvl': hs_vscnlvl_thy_info, 'hs_var_splvl1': hs_vsp1lvl_thy_info, 'hs_var_splvl2': hs_vsp2lvl_thy_info, 'hs_runlvl': hs_thy_info } runfs_dct = { 'runlvl_scn_fs': runlvl_scn_run_fs, 'runlvl_cscn_fs': runlvl_cscn_run_fs, 'runlvl_cnf_fs': runlvl_cnf_run_fs, 'vscnlvl_ts_fs': vscnlvl_ts_run_fs, 'vscnlvl_scn_fs': vscnlvl_scn_run_fs, 'vscnlvl_cscn_fs': vscnlvl_cscn_run_fs, 'vrctst_fs': vrctst_run_fs, } savefs_dct = { 'inilvl_zma_fs': ini_zma_save_fs, 'runlvl_scn_fs': runlvl_scn_save_fs, 'runlvl_cscn_fs': runlvl_cscn_save_fs, 'runlvl_cnf_fs': runlvl_cnf_save_fs, 'vscnlvl_scn_fs': vscnlvl_scn_save_fs, 'vscnlvl_cscn_fs': vscnlvl_cscn_save_fs, 'vrctst_fs': vrctst_save_fs, 'rcts_cnf_fs': _rcts_cnf_fs, 'runlvl_ts_zma_fs': runlvl_ts_zma_save_fs } return thy_inf_dct, runfs_dct, savefs_dct
def parse_user_reaction(insert_dct): smis = insert_dct['smiles'] ichs = insert_dct['inchi'] mults = insert_dct['mult'] chgs = insert_dct['charge'] rxn_class = insert_dct['rxn_class'] # zrxn_file = insert_dct['zrxn_file'] if ichs is None: ichs = [[], []] for smi in smis[0]: ichs[0].append(automol.smiles.inchi(smi)) for smi in smis[1]: ichs[1].append(automol.smiles.inchi(smi)) for idx, ich in enumerate(ichs[0]): if not automol.inchi.is_complete(ich): ich = automol.inchi.add_stereo(ich) ichs[0][idx] = ich for idx, ich in enumerate(ichs[1]): if not automol.inchi.is_complete(ich): ich = automol.inchi.add_stereo(ich) ichs[1][idx] = ich if mults is None: print('Error: user did not specify mults in input') sys.exit() if chgs is None: print('Error: user did not specify charges in input') sys.exit() flat_ichs = sum(ichs, []) if len(flat_ichs) != len(mults): print('Error: number of species does not match number of mults') sys.exit() if len(flat_ichs) != len(chgs): print('Error: number of species does not match number of charges') sys.exit() idx = 0 rxn_muls = [[], []] rxn_chgs = [[], []] for ich in ichs[0]: mults_allowed = automol.graph.possible_spin_multiplicities( automol.inchi.graph(ich, stereo=False)) if mults[idx] not in mults_allowed: print('user specified mult of {}'.format(mults[idx]) + 'is not an allowed multiplicty for inchi {}'.format(ich)) sys.exit() rxn_muls[0].append(mults[idx]) rxn_chgs[0].append(chgs[idx]) idx += 1 for ich in ichs[1]: mults_allowed = automol.graph.possible_spin_multiplicities( automol.inchi.graph(ich, stereo=False)) if mults[idx] not in mults_allowed: print('user specified mult of {}'.format(mults[idx]) + 'is not an allowed multiplicty for inchi {}'.format(ich)) sys.exit() rxn_muls[1].append(mults[idx]) rxn_chgs[1].append(chgs[idx]) idx += 1 ts_mult = insert_dct['ts_mult'] if ts_mult is None: print('Error: user did not specify ts_mul') sys.exit() rxn_info = rinfo.sort((ichs, rxn_chgs, rxn_muls, ts_mult)) ts_info = rinfo.ts_info(rxn_info) # if zrxn_file is not None: # zrxn_str = autofile.io_.read_file(zrxn_file) # zrxns = [automol.reac.from_string(zrxn_str)] # else: # zrxns, _ = _id_reaction(rxn_info) if rxn_class is None: print('Error: user did not specify rxn_class') sys.exit() return rxn_info, ts_info, rxn_class
def rpath_tsk(job, spc_dct, spc_name, thy_dct, es_keyword_dct, run_prefix, save_prefix): """ run a scan over the specified torsional coordinates """ # Get dct for specific species task is run for spc_dct_i = spc_dct[spc_name] # Set up coordinate name rxn_coord = es_keyword_dct.get('rxn_coord') if rxn_coord == 'auto': coord_name = ['Rn'] # grab from zrxn object else: # coord_name = coord_name = ['IRC'] # Set the spc_info spc_info = sinfo.from_dct(spc_dct_i) # Modify the theory method_dct = thy_dct.get(es_keyword_dct['runlvl']) ini_method_dct = thy_dct.get(es_keyword_dct['inplvl']) thy_info = tinfo.from_dct(method_dct) ini_thy_info = tinfo.from_dct(ini_method_dct) mod_thy_info = tinfo.modify_orb_label(thy_info, spc_info) mod_ini_thy_info = tinfo.modify_orb_label(ini_thy_info, spc_info) # Get options from the dct or es options lst overwrite = es_keyword_dct['overwrite'] # retryfail = es_keyword_dct['retryfail'] # Set up the script script_str, kwargs = qchem_params(method_dct, elstruct.Job.OPTIMIZATION) # Set the filesystem objects rxn_info = spc_dct_i['rxn_info'] fs_rxn_info = rinfo.sort(rxn_info) # New filesystem objects if coord_name == 'irc': _root = root_locs(spc_dct_i, saddle=True) # ini_cnf_run_fs, ini_cnf_save_fs = build_fs( # run_prefix, save_prefix, 'CONFORMER', # thy_locs=mod_ini_thy_info[1:], # **_root) # cnf_run_fs, cnf_save_fs = build_fs( # run_prefix, save_prefix, 'CONFORMER', # thy_locs=mod_thy_info[1:], # **_root) ini_cnf_run_fs, ini_cnf_save_fs = build_fs( run_prefix, save_prefix, 'CONFORMER', thy_locs=mod_ini_thy_info[1:], **_root) cnf_run_fs, cnf_save_fs = build_fs(run_prefix, save_prefix, 'CONFORMER', thy_locs=mod_thy_info[1:], **_root) ini_loc_info = filesys.mincnf.min_energy_conformer_locators( ini_cnf_save_fs, mod_ini_thy_info) ini_min_locs, ini_pfx_save_path = ini_loc_info # ini_min_rng_locs, ini_min_cnf_locs = ini_min_cnf_locs # ini_min_rng_path, ini_min_cnf_path = ini_min_cnf_path ini_cnf_run_fs[-1].create(ini_min_locs) ini_pfx_run_path = ini_cnf_run_fs[-1].path(ini_min_locs) else: ts_info = (ts_num, ) ini_ts_run_fs, ini_ts_save_fs = build_fs(run_prefix, save_prefix, 'TS', thy_locs=mod_ini_thy_info[1:], **_root) ini_pfx_run_path = ini_ts_run_fs.path(ts_info) ini_pfx_save_path = ini_ts_save_fs.path(ts_info) # Get options from the dct or es options lst overwrite = es_keyword_dct['overwrite'] ini_scn_run_fs, ini_scn_save_fs = build_fs(ini_pfx_run_path, ini_pfx_save_path, 'SCAN', zma_locs=(0, )) ini_zma_save_fs = autofile.fs.zmatrix(ini_cnf_save_path) geo = ini_cnf_save_fs[-1].file.geometry.read(ini_min_locs) zma = ini_zma_save_fs[-1].file.zmatrix.read((0, )) # Run job if job == 'scan': if rcoord == 'auto': pass elif rcoord == 'irc': rpath.irc_scan(geo, spc_info, coord_name, mod_ini_thy_info, ini_method_dct, ini_scn_save_fs, ini_cnf_run_path, overwrite) elif job in ('energy', 'grad', 'hess'): # Script script_str, kwargs = qchem_params(method_dct) # Need to put in something with the IRC idxs for locs in ini_scn_save_fs[-1].existing(): geo_run_path = ini_scn_run_fs[-1].path(locs) geo_save_path = ini_scn_save_fs[-1].path(locs) geo = ini_scn_save_fs[-1].file.geometry.read(locs) zma = None ini_scn_run_fs[-1].create(locs) ES_TSKS[job](zma, geo, spc_info, mod_thy_info, ini_scn_save_fs, geo_run_path, geo_save_path, locs, script_str, overwrite, **kwargs) ioprinter.obj('vspace') elif job == 'infene': pass
def thy_dcts(tsname, ts_dct, thy_dct, es_keyword_dct, run_prefix, save_prefix): """ set the theory """ # Get transition state info ts_zma = ts_dct['zma'] aspace = ts_dct['active'] # Set reaction info rxn_info = ts_dct['rxn_info'] ts_info = rinfo.ts_info(rxn_info) rct_info = rinfo.rgt_info(rxn_info, 'reacs') rxn_info_sort = rinfo.sort(rxn_info) # Set the high-sping ts info high_mult = rinfo.ts_mult(rxn_info, rxn_mul='high') hs_info = (ts_info[0], ts_info[1], high_mult) # Set the filesystem locs ts_locs = (int(tsname.split('_')[-1]),) zma_locs = (ts_dct.get('zma_idx', 0),) # Initialize the theory objects ini_thy_info, mod_ini_thy_info = None, None thy_info, mod_thy_info = None, None vscnlvl_thy_info, mod_vscnlvl_thy_info = None, None vsp1lvl_thy_info, mod_vsp1lvl_thy_info = None, None vsp2lvl_thy_info, mod_vsp2lvl_thy_info = None, None hs_vscnlvl_thy_info = None hs_vsp1lvl_thy_info = None hs_vsp2lvl_thy_info = None hs_thy_info = None # Method dicts ini_method_dct = None run_method_dct = None vscn_method_dct = None vsp1_method_dct = None vsp2_method_dct = None # Multireference Params inplvl_mref_params = {} runlvl_mref_params = {} vscn_mref_params = {} vsp1_mref_params = {} vsp2_mref_params = {} # Initialize the necessary run filesystem runlvl_scn_run_fs = None runlvl_cscn_run_fs = None vscnlvl_ts_run_fs = None vscnlvl_scn_run_fs = None vscnlvl_cscn_run_fs = None vrctst_run_fs = None # Initialize the necessary save filesystem inplvl_cnf_save_fs = None runlvl_scn_save_fs = None # above cnf filesys, for search scans runlvl_cscn_save_fs = None # above cnf filesys, for search scans runlvl_cnf_save_fs = None vscnlvl_scn_save_fs = None vscnlvl_cscn_save_fs = None vrctst_save_fs = None if es_keyword_dct.get('inplvl', None) is not None: ini_method_dct = thy_dct.get(es_keyword_dct['inplvl']) ini_thy_info = tinfo.from_dct(ini_method_dct) mod_ini_thy_info = tinfo.modify_orb_label( ini_thy_info, ts_info) # Conformer Layer for saddle point structures _, inplvl_cnf_save_fs = build_fs( run_prefix, save_prefix, 'CONFORMER', rxn_locs=rxn_info_sort, ts_locs=ts_locs, thy_locs=mod_ini_thy_info[1:]) inplvl_loc_info = filesys.mincnf.min_energy_conformer_locators( inplvl_cnf_save_fs, mod_thy_info) inplvl_min_cnf_locs, _ = inplvl_loc_info inplvl_cnf_save_tuple = (inplvl_cnf_save_fs, inplvl_min_cnf_locs) if elstruct.par.Method.is_multiref(ini_thy_info[1]): inplvl_mref_params = multireference_calculation_parameters( ts_zma, ts_info, hs_info, aspace, mod_ini_thy_info, rxn_info=rxn_info) if es_keyword_dct.get('runlvl', None) is not None: run_method_dct = thy_dct.get(es_keyword_dct['runlvl']) thy_info = tinfo.from_dct(run_method_dct) mod_thy_info = tinfo.modify_orb_label( thy_info, ts_info) hs_thy_info = tinfo.modify_orb_label( thy_info, hs_info) # Conformer Layer for saddle point structures runlvl_cnf_run_fs, runlvl_cnf_save_fs = build_fs( run_prefix, save_prefix, 'CONFORMER', rxn_locs=rxn_info_sort, ts_locs=ts_locs, thy_locs=mod_thy_info[1:]) runlvl_loc_info = filesys.mincnf.min_energy_conformer_locators( runlvl_cnf_save_fs, mod_thy_info) runlvl_min_cnf_locs, _ = runlvl_loc_info runlvl_cnf_save_tuple = (runlvl_cnf_save_fs, runlvl_min_cnf_locs) # TS/IDX/Z Layer used for coordinate scans (perhaps for guesses) _, runlvl_z_save_fs = build_fs( run_prefix, save_prefix, 'ZMATRIX', rxn_locs=rxn_info_sort, ts_locs=ts_locs, thy_locs=mod_thy_info[1:]) runlvl_scn_run_fs, runlvl_scn_save_fs = build_fs( run_prefix, save_prefix, 'SCAN', rxn_locs=rxn_info_sort, ts_locs=ts_locs, thy_locs=mod_thy_info[1:], zma_locs=zma_locs) runlvl_cscn_run_fs, runlvl_cscn_save_fs = build_fs( run_prefix, save_prefix, 'CSCAN', rxn_locs=rxn_info_sort, ts_locs=ts_locs, thy_locs=mod_thy_info[1:], zma_locs=zma_locs) if elstruct.par.Method.is_multiref(thy_info[1]): runlvl_mref_params = multireference_calculation_parameters( ts_zma, ts_info, hs_info, aspace, mod_thy_info, rxn_info=rxn_info) if es_keyword_dct.get('var_scnlvl', None) is not None: vscn_method_dct = thy_dct.get(es_keyword_dct['var_scnlvl']) vscnlvl_thy_info = tinfo.from_dct(vscn_method_dct) mod_vscnlvl_thy_info = tinfo.modify_orb_label( vscnlvl_thy_info, ts_info) hs_vscnlvl_thy_info = tinfo.modify_orb_label( vscnlvl_thy_info, hs_info) vscnlvl_scn_run_fs, vscnlvl_scn_save_fs = build_fs( run_prefix, save_prefix, 'SCAN', rxn_locs=rxn_info_sort, ts_locs=ts_locs, thy_locs=mod_vscnlvl_thy_info[1:], zma_locs=zma_locs) vscnlvl_cscn_run_fs, vscnlvl_cscn_save_fs = build_fs( run_prefix, save_prefix, 'CSCAN', rxn_locs=rxn_info_sort, ts_locs=ts_locs, thy_locs=mod_vscnlvl_thy_info[1:], zma_locs=zma_locs) vrctst_run_fs, vrctst_save_fs = build_fs( run_prefix, save_prefix, 'VRCTST', rxn_locs=rxn_info_sort, ts_locs=ts_locs, thy_locs=mod_vscnlvl_thy_info[1:]) if elstruct.par.Method.is_multiref(vscnlvl_thy_info[1]): vscn_mref_params = multireference_calculation_parameters( ts_zma, ts_info, hs_info, aspace, mod_vscnlvl_thy_info, rxn_info=rxn_info) if es_keyword_dct.get('var_splvl1', None) is not None: vsp1_method_dct = thy_dct.get(es_keyword_dct['var_splvl1']) vsp1lvl_thy_info = tinfo.from_dct(vsp1_method_dct) mod_vsp1lvl_thy_info = tinfo.modify_orb_label( vsp1lvl_thy_info, ts_info) hs_vsp1lvl_thy_info = tinfo.modify_orb_label( vsp1lvl_thy_info, hs_info) if elstruct.par.Method.is_multiref(vsp1lvl_thy_info[1]): vsp1_mref_params = multireference_calculation_parameters( ts_zma, ts_info, hs_info, aspace, mod_vsp1lvl_thy_info, rxn_info=rxn_info) if es_keyword_dct.get('var_splvl2', None) is not None: vsp2_method_dct = thy_dct.get(es_keyword_dct['var_splvl2']) vsp2lvl_thy_info = tinfo.from_dct(vsp2_method_dct) mod_vsp2lvl_thy_info = tinfo.modify_orb_label( vsp2lvl_thy_info, ts_info) hs_vsp2lvl_thy_info = tinfo.modify_orb_label( vsp2lvl_thy_info, hs_info) if elstruct.par.Method.is_multiref(vsp2lvl_thy_info[1]): vsp2_mref_params = multireference_calculation_parameters( ts_zma, ts_info, hs_info, aspace, mod_vsp2lvl_thy_info, rxn_info=rxn_info) # Get the conformer filesys for the reactants _rcts_cnf_fs = rcts_cnf_fs(rct_info, ini_thy_info, run_prefix, save_prefix) if _rcts_cnf_fs is None: _rcts_cnf_fs = rcts_cnf_fs(rct_info, thy_info, run_prefix, save_prefix) thy_inf_dct = { 'inplvl': ini_thy_info, 'runlvl': thy_info, 'var_scnlvl': vscnlvl_thy_info, 'var_splvl1': vsp1lvl_thy_info, 'var_splvl2': vsp2lvl_thy_info, 'mod_inplvl': mod_ini_thy_info, 'mod_runlvl': mod_thy_info, 'mod_var_scnlvl': mod_vscnlvl_thy_info, 'mod_var_splvl1': mod_vsp1lvl_thy_info, 'mod_var_splvl2': mod_vsp2lvl_thy_info, 'hs_var_scnlvl': hs_vscnlvl_thy_info, 'hs_var_splvl1': hs_vsp1lvl_thy_info, 'hs_var_splvl2': hs_vsp2lvl_thy_info, 'hs_runlvl': hs_thy_info, 'rct_info': rct_info } thy_method_dct = { 'inplvl': ini_method_dct, 'runlvl': run_method_dct, 'var_scnlvl': vscn_method_dct, 'var_splvl1': vsp1_method_dct, 'var_splvl2': vsp2_method_dct, } mref_params_dct = { 'inplvl': inplvl_mref_params, 'runlvl': runlvl_mref_params, 'var_scnlvl': vscn_mref_params, 'var_splvl1': vsp1_mref_params, 'var_splvl2': vsp2_mref_params, } runfs_dct = { 'runlvl_scn': runlvl_scn_run_fs, 'runlvl_cscn': runlvl_cscn_run_fs, 'runlvl_cnf': runlvl_cnf_run_fs, 'vscnlvl_ts': vscnlvl_ts_run_fs, 'vscnlvl_scn': vscnlvl_scn_run_fs, 'vscnlvl_cscn': vscnlvl_cscn_run_fs, 'vrctst': vrctst_run_fs, 'prefix': run_prefix } savefs_dct = { 'runlvl_scn': runlvl_scn_save_fs, 'runlvl_cscn': runlvl_cscn_save_fs, 'runlvl_ts_zma': runlvl_z_save_fs, 'inplvl_cnf_tuple': inplvl_cnf_save_tuple, 'runlvl_cnf_tuple': runlvl_cnf_save_tuple, 'vscnlvl_scn': vscnlvl_scn_save_fs, 'vscnlvl_cscn': vscnlvl_cscn_save_fs, 'vrctst': vrctst_save_fs, 'rcts_cnf': _rcts_cnf_fs, 'prefix': save_prefix } return (thy_inf_dct, thy_method_dct, mref_params_dct, runfs_dct, savefs_dct)