def read_locs_harmonic_freqs(cnf_fs, cnf_locs, run_prefix, zrxn=None): """ Read the harmonic frequencies for a specific conformer Do the freqs obtain for two species for fake and pst? """ if cnf_locs is not None: geo_exists = cnf_fs[-1].file.geometry.exists(cnf_locs) hess_exists = cnf_fs[-1].file.hessian.exists(cnf_locs) if not geo_exists: ioprinter.error_message( 'No Reference geometry for harmonic frequencies at path', cnf_fs[-1].file.hessian.path(cnf_locs)) if not hess_exists: ioprinter.error_message( 'No Hessian available for harmonic frequencies at path', cnf_fs[-1].file.hessian.path(cnf_locs)) else: geo_exists, hess_exists = False, False if geo_exists and hess_exists: # Obtain geom and freqs from filesys geo = cnf_fs[-1].file.geometry.read(cnf_locs) hess = cnf_fs[-1].file.hessian.read(cnf_locs) ioprinter.reading('Hessian', cnf_fs[-1].path(cnf_locs)) # Build the run filesystem using locs fml_str = automol.geom.formula_string(geo) vib_path = job_path(run_prefix, 'PROJROT', 'FREQ', fml_str) # Obtain the frequencies ioprinter.info_message( 'Calling ProjRot to diagonalize Hessian and get freqs...') script_str = autorun.SCRIPT_DCT['projrot'] freqs, _, imag_freqs, _ = autorun.projrot.frequencies( script_str, vib_path, [geo], [[]], [hess]) # Obtain the displacements norm_coord_str, _ = autorun.projrot.displacements( script_str, vib_path, [geo], [[]], [hess]) # Calculate the zpve ioprinter.frequencies(freqs) zpe = (sum(freqs) / 2.0) * phycon.WAVEN2EH # Check imaginary frequencies and set freqs if zrxn is not None: if len(imag_freqs) > 1: ioprinter.warning_message('Saddle Point has more than', 'one imaginary frequency') imag = imag_freqs[0] else: imag = None ret = (freqs, imag, zpe, norm_coord_str) else: ret = None return ret
def tors_projected_freqs(pf_filesystems, mess_hr_str, projrot_hr_str, prefix, zrxn=None, conf=None): """ Get the projected frequencies from harmonic frequencies, which requires projrot run :param pf_filesytem: dictionary of the locations of various info :param runf_pfx: location to run projrot """ [harm_cnf_fs, _, harm_min_locs, _, _] = pf_filesystems['harm'] [tors_cnf_fs, _, tors_min_locs, _, _] = pf_filesystems['tors'] if conf: harm_min_locs = conf[1] harm_cnf_fs = conf[2] # Read info from the filesystem that is needed harm_geo = harm_cnf_fs[-1].file.geometry.read(harm_min_locs) hess = harm_cnf_fs[-1].file.hessian.read(harm_min_locs) tors_geo = tors_cnf_fs[-1].file.geometry.read(tors_min_locs) ioprinter.reading('Hessian', harm_cnf_fs[-1].path(harm_min_locs)) fml_str = automol.geom.formula_string(harm_geo) vib_path = job_path(prefix, 'PROJROT', 'FREQ', fml_str, print_path=True) # print('proj test:', vib_path) # tors_path = job_path(run_pfx, 'MESS', 'TORS', fml_str, print_path=True) mess_script_str = autorun.SCRIPT_DCT['messpf'] projrot_script_str = autorun.SCRIPT_DCT['projrot'] dist_cutoff_dct1 = {('H', 'O'): 2.26767, ('H', 'C'): 2.26767} dist_cutoff_dct2 = { ('H', 'O'): 2.83459, ('H', 'C'): 2.83459, ('C', 'O'): 3.7807 } proj_inf = autorun.projected_frequencies(mess_script_str, projrot_script_str, vib_path, mess_hr_str, projrot_hr_str, tors_geo, harm_geo, hess, dist_cutoff_dct1=dist_cutoff_dct1, dist_cutoff_dct2=dist_cutoff_dct2, saddle=(zrxn is not None)) # Obtain the displacements disp_path = os.path.join(vib_path, 'DISP') harm_disps = autorun.projrot.displacements(projrot_script_str, disp_path, [harm_geo], [[]], [hess]) proj_freqs, proj_imag, _, harm_freqs, tors_freqs = proj_inf return proj_freqs, harm_freqs, tors_freqs, proj_imag, harm_disps
def read_anharmon_matrix(pf_filesystems): """ Read the anharmonicity matrix """ # Set up vpt2 level filesystem for rotational values [cnf_fs, cnf_path, min_cnf_locs, _, _] = pf_filesystems['vpt2'] if cnf_path: xmat = cnf_fs[-1].file.anharmonicity_matrix.read(min_cnf_locs) ioprinter.reading('Anharm matrix', cnf_path) else: ioprinter.error_message('No anharm matrix at path', cnf_path) return xmat
def electronic_energy(spc_dct_i, pf_filesystems, spc_model_dct_i, conf=None): """ get high level energy at low level optimized geometry """ ioprinter.info_message('- Calculating electronic energy') # spc_dct_i = spc_dct[spc_name] rxn_info = spc_dct_i.get('rxn_info', None) if rxn_info is not None: spc_info = rinfo.ts_info(rxn_info) else: spc_info = sinfo.from_dct(spc_dct_i) # Get the harmonic filesys information if conf: cnf_path = conf[1] else: [_, cnf_path, _, _, _] = pf_filesystems['harm'] # Get the electronic energy levels ene_levels = tuple(val[1] for key, val in spc_model_dct_i['ene'].items() if 'lvl' in key) print('ene levels', ene_levels) # Read the energies from the filesystem e_elec = None if os.path.exists(cnf_path): e_elec = 0.0 # ioprinter.info_message('lvls', ene_levels) for (coeff, level) in ene_levels: # Build SP filesys mod_thy_info = tinfo.modify_orb_label(level, spc_info) sp_save_fs = autofile.fs.single_point(cnf_path) sp_save_fs[-1].create(mod_thy_info[1:4]) # Read the energy sp_path = sp_save_fs[-1].path(mod_thy_info[1:4]) if os.path.exists(sp_path): ioprinter.reading('Energy', sp_path) ene = sp_save_fs[-1].file.energy.read(mod_thy_info[1:4]) e_elec += (coeff * ene) else: ioprinter.warning_message('No energy at path') e_elec = None break else: ioprinter.warning_message('No conformer to calculate the energy') return e_elec
def read_geom(pf_filesystems): """ Read the geometry from the filesys """ # Get the harmonic filesys information [cnf_fs, cnf_path, min_cnf_locs, _, _] = pf_filesystems['harm'] # Read the filesys for the geometry if cnf_path: geom = cnf_fs[-1].file.geometry.read(min_cnf_locs) ioprinter.reading('geometry', cnf_path) else: ioprinter.info_message('No geometry found at path:', cnf_path) return geom
def read_locs_harmonic_freqs(cnf_fs, harm_path, cnf_locs, run_prefix, zrxn=None): """ Read the harmonic frequencies for a specific conformer """ # probably should read freqs # Do the freqs obtain for two species for fake and pst if cnf_locs is not None: # Obtain geom and freqs from filesys geo = cnf_fs[-1].file.geometry.read(cnf_locs) hess = cnf_fs[-1].file.hessian.read(cnf_locs) ioprinter.reading('Hessian', cnf_fs[-1].path(cnf_locs)) # Build the run filesystem using locs fml_str = automol.geom.formula_string(geo) vib_path = job_path(run_prefix, 'PROJROT', 'FREQ', fml_str) # Obtain the frequencies ioprinter.info_message( 'Calling ProjRot to diagonalize Hessian and get freqs...') script_str = autorun.SCRIPT_DCT['projrot'] freqs, _, imag_freqs, _ = autorun.projrot.frequencies( script_str, vib_path, [geo], [[]], [hess]) # Calculate the zpve ioprinter.frequencies(freqs) zpe = (sum(freqs) / 2.0) * phycon.WAVEN2EH # Check imaginary frequencies and set freqs if zrxn is not None: if len(imag_freqs) > 1: ioprinter.warning_message('Saddle Point has more than', 'one imaginary frequency') imag = imag_freqs[0] else: imag = None else: ioprinter.error_message( 'Reference geometry is missing for harmonic frequencies') return freqs, imag, zpe
def read_spc_data(spc_dct, spc_name, pes_mod_dct_i, spc_mod_dct_i, run_prefix, save_prefix, chn_basis_ene_dct, calc_chn_ene=True): """ Determines which block writer to use tau """ ioprinter.obj('line_plus') ioprinter.reading('Reading filesystem info for {}'.format(spc_name), newline=1) vib_model = spc_mod_dct_i['vib']['mod'] tors_model = spc_mod_dct_i['tors']['mod'] spc_dct_i = spc_dct[spc_name] if typ.is_atom(spc_dct_i): inf_dct = atm_data(spc_dct, spc_name, pes_mod_dct_i, spc_mod_dct_i, run_prefix, save_prefix) writer = 'atom_block' else: if vib_model == 'tau' or tors_model == 'tau': inf_dct = tau_data(spc_dct_i, spc_mod_dct_i, run_prefix, save_prefix, saddle=False) writer = 'tau_block' else: inf_dct, chn_basis_ene_dct = mol_data(spc_name, spc_dct, pes_mod_dct_i, spc_mod_dct_i, chn_basis_ene_dct, run_prefix, save_prefix, calc_chn_ene=calc_chn_ene, zrxn=None) writer = 'species_block' # Add writer to inf dct inf_dct['writer'] = writer return inf_dct, chn_basis_ene_dct
def read_geom(pf_filesystems): """ Read a Cartesian geometry from the SAVE filesystem for a species or transition state. something about electronic structure mehtod in pf_filesys """ # Get the harmonic filesys information [cnf_fs, cnf_path, min_cnf_locs, _, _] = pf_filesystems['harm'] # Read the filesys for the geometry if cnf_path: geom = cnf_fs[-1].file.geometry.read(min_cnf_locs) ioprinter.reading('geometry', cnf_path) else: ioprinter.info_message('No geometry found at path:', cnf_path) return geom
def read_rotational_values(pf_filesystems): """ Read the rotational info from filesys """ # Set up vpt2 level filesystem for rotational values [cnf_fs, cnf_path, min_cnf_locs, _, _] = pf_filesystems['vpt2'] # Read the filesys for rotational anharmonicity information if cnf_path: ioprinter.reading( 'Vib-Rot Matrix and Centrifugal Dist. Consts from path:', cnf_path) vibrot_mat = cnf_fs[-1].file.vibro_rot_alpha_matrix.read( min_cnf_locs) cd_consts = cnf_fs[-1].file.quartic_centrifugal_dist_consts.read( min_cnf_locs) else: ioprinter.info_message( 'No Vib-Rot Matrix and Centrifugal Dist. Consts from path:', cnf_path) return vibrot_mat, cd_consts
def read_rotational_values(pf_filesystems): """ Read the vibration-rotation matrix and centrifugal distortion constant matrix calculated via VPT2 from the SAVE filesystem for a species or transition state. """ # Set up vpt2 level filesystem for rotational values [cnf_fs, cnf_path, min_cnf_locs, _, _] = pf_filesystems['vpt2'] # Read the filesys for rotational anharmonicity information if cnf_path: ioprinter.reading( 'Vib-Rot Matrix and Centrifugal Dist. Consts from path:', cnf_path) vibrot_mat = cnf_fs[-1].file.vibro_rot_alpha_matrix.read(min_cnf_locs) cd_consts = cnf_fs[-1].file.quartic_centrifugal_dist_consts.read( min_cnf_locs) else: ioprinter.info_message( 'No Vib-Rot Matrix and Centrifugal Dist. Consts from path:', cnf_path) return vibrot_mat, cd_consts
def energy(spc_name, spc_dct_i, spc_mod_dct_i, proc_keyword_dct, thy_dct, locs, locs_path, cnf_fs, run_prefix, save_prefix): """ collect energy """ saddle = 'ts_' in spc_name _ene = None if spc_mod_dct_i: pf_filesystems = filesys.models.pf_filesys(spc_dct_i, spc_mod_dct_i, run_prefix, save_prefix, name=spc_name, saddle=saddle) _ene = ene.electronic_energy(spc_dct_i, pf_filesystems, spc_mod_dct_i, conf=(locs, locs_path, cnf_fs)) else: spc_info = sinfo.from_dct(spc_dct_i) thy_info = tinfo.from_dct(thy_dct.get(proc_keyword_dct['proplvl'])) mod_thy_info = tinfo.modify_orb_label(thy_info, spc_info) sp_save_fs = autofile.fs.single_point(locs_path) # Read the energy sp_path = sp_save_fs[-1].path(mod_thy_info[1:4]) if os.path.exists(sp_path): if sp_save_fs[-1].file.energy.exists(mod_thy_info[1:4]): ioprinter.reading('Energy', sp_path) _ene = sp_save_fs[-1].file.energy.read(mod_thy_info[1:4]) if _ene is not None: miss_data = None else: miss_data = (spc_name + '_'.join(locs), mod_thy_info, 'energy') return [locs_path, _ene], miss_data
def read_spc_data(spc_dct, spc_name, pes_mod_dct_i, spc_mod_dct_i, run_prefix, save_prefix, chn_basis_ene_dct, calc_chn_ene=True, spc_locs=None): """ Reads all required data from the SAVE filesystem for a given species. Also sets the writer for appropriately formatting the data into an MESS input file string. All of the data that is read is determined by the models that are described in the pes and spc model dictionaries. Info and basis species stored in dicts. :param spc_dct: :type spc_dct: :param spc_name: mechanism name of species :type spc_name: str :param pes_mod_dct_i: keyword dict of specific PES model :type pes_mod_dct_i: dict[] :param spc_mod_dct_i: keyword dict of specific species model :type spc_mod_dct_i: dict[] :param run_prefix: root-path to the run-filesystem :type run_prefix: str :param save_prefix: root-path to the save-filesystem :type save_prefix: str :param chn_basis_ene_dct: basis species <names> for mechanism species :type chn_basis_ene_dct: dict[] :rtype: (dict[], dict[]) """ ioprinter.obj('line_plus') ioprinter.reading(f'filesystem info for {spc_name}', newline=1) vib_model = spc_mod_dct_i['vib']['mod'] tors_model = spc_mod_dct_i['tors']['mod'] spc_dct_i = spc_dct[spc_name] if typ.is_atom(spc_dct_i): inf_dct = atm_data(spc_dct, spc_name, pes_mod_dct_i, spc_mod_dct_i, run_prefix, save_prefix) writer = 'atom_block' else: if vib_model == 'tau' or 'tau' in tors_model: inf_dct = tau_data(spc_dct_i, spc_mod_dct_i, run_prefix, save_prefix, saddle=False) writer = 'tau_block' else: inf_dct, chn_basis_ene_dct = mol_data(spc_name, spc_dct, pes_mod_dct_i, spc_mod_dct_i, chn_basis_ene_dct, run_prefix, save_prefix, calc_chn_ene=calc_chn_ene, spc_locs=spc_locs, zrxn=None) writer = 'species_block' # Add writer to inf dct inf_dct['writer'] = writer return inf_dct, chn_basis_ene_dct
def read_ts_data(spc_dct, tsname, rcts, prds, pes_mod_dct_i, spc_mod_dct_i, run_prefix, save_prefix, chn_basis_ene_dct, spc_locs=None): """ Reads all required data from the SAVE filesystem for a transition state. Also sets the writer for appropriately formatting the data into an MESS input file string. All of the data that is read is determined by the models that are described in the pes and spc model dictionaries. :param spc_dct: :type spc_dct: :param tsname: mechanism name of transition state :type tsname: str :param rcts: mechanism names of reactants connected to transition state :type rcts: tuple(str) :param prds: mechanism names of products connected to transition state :type prds: tuple(str) :param pes_mod_dct_i: keyword dict of specific PES model :type pes_mod_dct_i: dict[] :param spc_mod_dct_i: keyword dict of specific species model :type spc_mod_dct_i: dict[] :param run_prefix: root-path to the run-filesystem :type run_prefix: str :param save_prefix: root-path to the save-filesystem :type save_prefix: str :param chn_basis_ene_dct: basis species <names> for mechanism species :type chn_basis_ene_dct: dict[] :rtype: (dict[], dict[]) """ ioprinter.obj('line_plus') ioprinter.reading(f'Reading filesystem info for {tsname}', newline=1) ts_dct = spc_dct[tsname] reac_dcts = [spc_dct[name] for name in rcts] prod_dcts = [spc_dct[name] for name in prds] ts_mod = spc_mod_dct_i['ts'] ts_sadpt, ts_nobar = ts_mod['sadpt'], ts_mod['nobar'] # Get all of the information for the filesystem if not automol.par.is_radrad(ts_dct['class']): # Set up the saddle point keyword sadpt = True search = ts_dct.get('ts_search') if search is not None: if 'vtst' in search: sadpt = False # Build MESS string for TS at a saddle point if ts_sadpt == 'pst': inf_dct = pst_data(ts_dct, reac_dcts, spc_mod_dct_i, run_prefix, save_prefix) writer = 'pst_block' elif ts_sadpt == 'rpvtst': inf_dct = rpvtst_data(ts_dct, reac_dcts, spc_mod_dct_i, run_prefix, save_prefix, sadpt=sadpt) writer = 'rpvtst_block' else: print('Obtaining a ZRXN object from conformer any TS, ' 'shouldn matter') print('-----') pf_filesystems = filesys.models.pf_filesys(spc_dct[tsname], spc_mod_dct_i, run_prefix, save_prefix, True, name=tsname) [cnf_fs, _, min_cnf_locs, _, _] = pf_filesystems['harm'] cnf_path = cnf_fs[-1].path(min_cnf_locs) zma_fs = autofile.fs.zmatrix(cnf_path) zrxn = zma_fs[-1].file.reaction.read((0, )) print('-----') inf_dct, chn_basis_ene_dct = mol_data(tsname, spc_dct, pes_mod_dct_i, spc_mod_dct_i, chn_basis_ene_dct, run_prefix, save_prefix, zrxn=zrxn, spc_locs=spc_locs) writer = 'species_block' else: # Build MESS string for TS with no saddle point if ts_nobar == 'pst': if len(rcts) == 2: inf_dct = pst_data(ts_dct, reac_dcts, spc_mod_dct_i, run_prefix, save_prefix) else: inf_dct = pst_data(ts_dct, prod_dcts, spc_mod_dct_i, run_prefix, save_prefix) writer = 'pst_block' elif ts_nobar == 'rpvtst': inf_dct = rpvtst_data(ts_dct, reac_dcts, spc_mod_dct_i, run_prefix, save_prefix, sadpt=False) writer = 'rpvtst_block' elif ts_nobar == 'vrctst': inf_dct = flux_data(ts_dct, spc_mod_dct_i) writer = 'vrctst_block' # Add writer to inf dct inf_dct['writer'] = writer return inf_dct, chn_basis_ene_dct
def make_pes_mess_str(spc_dct, rxn_lst, pes_idx, pesgrp_num, unstable_chnls, run_prefix, save_prefix, label_dct, tsk_key_dct, pes_param_dct, thy_dct, pes_model_dct_i, spc_model_dct_i, spc_model): """ Write all the MESS input file strings for the reaction channels """ ioprinter.messpf('channel_section') # Initialize data carrying objects and empty MESS strings basis_energy_dct = {} basis_energy_dct[spc_model] = {} full_well_str, full_bi_str, full_ts_str = '', '', '' full_dat_str_dct = {} # Set the energy and model for the first reference species ioprinter.info_message('\nCalculating reference energy for PES') ref_ene, model_basis_energy_dct = set_reference_ene( rxn_lst, spc_dct, tsk_key_dct, basis_energy_dct[spc_model], thy_dct, pes_model_dct_i, spc_model_dct_i, run_prefix, save_prefix, ref_idx=0) basis_energy_dct[spc_model].update(model_basis_energy_dct) print('basis energy dct') print(basis_energy_dct) # Loop over all the channels and write the MESS strings written_labels = [] for rxn in rxn_lst: chnl_idx, (reacs, prods) = rxn ioprinter.obj('vspace') ioprinter.reading('PES electronic structure data') ioprinter.channel(chnl_idx + 1, reacs, prods) # Get the names for all of the configurations of the TS tsname = base_tsname(pes_idx, chnl_idx) tsname_allconfigs = tsnames_in_dct(pes_idx, chnl_idx, spc_dct) # Pass in full ts class chnl_infs, chn_basis_ene_dct = get_channel_data( reacs, prods, tsname_allconfigs, spc_dct, tsk_key_dct, basis_energy_dct[spc_model], thy_dct, pes_model_dct_i, spc_model_dct_i, run_prefix, save_prefix) basis_energy_dct[spc_model].update(chn_basis_ene_dct) # Calculate the relative energies of all spc on the channel chnl_enes = sum_channel_enes(chnl_infs, ref_ene) # Set the hot energies using the relative enes that will be # written into the global key section of MESS input later hot_enes_dct = set_hot_enes(pesgrp_num, reacs, prods, chnl_enes, pes_param_dct, ene_range=None) # Write the mess strings for all spc on the channel mess_strs, dat_str_dct, written_labels = _make_channel_mess_strs( tsname, reacs, prods, pesgrp_num, spc_dct, label_dct, written_labels, pes_param_dct, chnl_infs, chnl_enes, spc_model_dct_i, unstable_chnl=(chnl_idx in unstable_chnls)) # Append to full MESS strings [well_str, bi_str, ts_str] = mess_strs full_well_str += well_str full_bi_str += bi_str full_ts_str += ts_str full_dat_str_dct.update(dat_str_dct) # Combine all the reaction channel strings; remove empty lines rxn_chan_str = '\n'.join([full_well_str, full_bi_str, full_ts_str]) rxn_chan_str = ioformat.remove_empty_lines(rxn_chan_str) return rxn_chan_str, full_dat_str_dct, hot_enes_dct
def save_tau(tau_run_fs, tau_save_fs, mod_thy_info): """ save the tau dependent geometries that have been found so far """ # db_style = 'jsondb' db_style = 'directory' if db_style == 'jsondb': saved_locs = tau_save_fs[-1].json_existing() saved_geos = tau_save_fs[-1].json.geometry.read_all(saved_locs) elif db_style == 'directory': saved_geos = [tau_save_fs[-1].file.geometry.read(locs) for locs in tau_save_fs[-1].existing()] if not tau_run_fs[0].exists(): ioprinter.info_message("No tau geometries to save. Skipping...") else: if db_style == 'jsondb': save_info = [[], [], [], [], []] sp_save_info = [[], [], [], [], []] for locs in tau_run_fs[-1].existing(): run_path = tau_run_fs[-1].path(locs) run_fs = autofile.fs.run(run_path) save_path = tau_save_fs[-1].root.path() ioprinter.reading("tau run", run_path) success, ret = es_runner.read_job( job=elstruct.Job.OPTIMIZATION, run_fs=run_fs) if success: inf_obj, inp_str, out_str = ret prog = inf_obj.prog method = inf_obj.method ene = elstruct.reader.energy(prog, method, out_str) geo = elstruct.reader.opt_geometry(prog, out_str) if db_style == 'directory': ioprinter.save_geo(save_path) tau_save_fs[-1].create(locs) tau_save_fs[-1].file.geometry_info.write(inf_obj, locs) tau_save_fs[-1].file.geometry_input.write(inp_str, locs) tau_save_fs[-1].file.energy.write(ene, locs) tau_save_fs[-1].file.geometry.write(geo, locs) # Saving the energy to a SP filesystem save_path = tau_save_fs[-1].path(locs) ioprinter.save_energy(save_path) sp_save_fs = autofile.fs.single_point(save_path) sp_save_fs[-1].create(mod_thy_info[1:4]) sp_save_fs[-1].file.input.write(inp_str, mod_thy_info[1:4]) sp_save_fs[-1].file.info.write(inf_obj, mod_thy_info[1:4]) sp_save_fs[-1].file.energy.write(ene, mod_thy_info[1:4]) elif db_style == 'jsondb': # tau_save_fs[-1].json.geometry_info.write(inf_obj, locs) # tau_save_fs[-1].json.geometry_input.write(inp_str, locs) # tau_save_fs[-1].json.energy.write(ene, locs) # tau_save_fs[-1].json.geometry.write(geo, locs) ioprinter.info_message( " - Saving energy and geo of unique geometry...") save_info[0].append(locs) save_info[1].append(inf_obj) save_info[2].append(inp_str) save_info[3].append(ene) save_info[4].append(geo) sp_save_fs = autofile.fs.single_point( save_path, json_layer=locs) sp_save_info[0].append(sp_save_fs) sp_save_info[1].append(mod_thy_info[1:4]) sp_save_info[2].append(inp_str) sp_save_info[3].append(inf_obj) sp_save_info[4].append(ene) sp_save_fs[-1].json.input.write(inp_str, mod_thy_info[1:4]) sp_save_fs[-1].json.info.write(inf_obj, mod_thy_info[1:4]) sp_save_fs[-1].json.energy.write(ene, mod_thy_info[1:4]) saved_geos.append(geo) if db_style == 'jsondb': tau_save_fs[-1].json_create() tau_save_fs[-1].json.geometry_info.write_all( save_info[1], save_info[0]) tau_save_fs[-1].json.geometry_input.write_all( save_info[2], save_info[0]) tau_save_fs[-1].json.energy.write_all( save_info[3], save_info[0]) tau_save_fs[-1].json.geometry.write_all( save_info[4], save_info[0]) for i, sp_save_fs_i in enumerate(sp_save_info[0]): sp_save_fs_i[-1].json.input.write( sp_save_info[2][i], sp_save_info[1][i]) sp_save_fs_i[-1].json.info.write( sp_save_info[3][i], sp_save_info[1][i]) sp_save_fs_i[-1].json.energy.write( sp_save_info[4][i], sp_save_info[1][i]) # update the tau trajectory file filesys.mincnf.traj_sort(tau_save_fs, mod_thy_info)
def make_pes_mess_str(spc_dct, rxn_lst, pes_idx, run_prefix, save_prefix, label_dct, pes_model_dct_i, spc_model_dct_i, spc_model, thy_dct): """ Write all the MESS input file strings for the reaction channels """ ioprinter.messpf('channel_section') # Initialize empty MESS strings full_well_str, full_bi_str, full_ts_str = '', '', '' full_dat_str_dct = {} pes_ene_dct = {} conn_lst = tuple() # Set the energy and model for the first reference species ioprinter.info_message('\nCalculating reference energy for PES') ref_ene = set_reference_ene( rxn_lst, spc_dct, thy_dct, pes_model_dct_i, spc_model_dct_i, run_prefix, save_prefix, ref_idx=0) # Loop over all the channels and write the MESS strings written_labels = [] basis_energy_dct = {} for rxn in rxn_lst: chnl_idx, (reacs, prods) = rxn ioprinter.obj('vspace') ioprinter.reading('PES electrion structure data') ioprinter.channel(chnl_idx, reacs, prods) # Set the TS name and channel model tsname = 'ts_{:g}_{:g}'.format(pes_idx+1, chnl_idx+1) # Obtain all of the species data if spc_model not in basis_energy_dct: basis_energy_dct[spc_model] = {} # Pass in full ts class chnl_infs, chn_basis_ene_dct = get_channel_data( reacs, prods, tsname, spc_dct, basis_energy_dct[spc_model], pes_model_dct_i, spc_model_dct_i, run_prefix, save_prefix) basis_energy_dct[spc_model].update(chn_basis_ene_dct) # Calculate the relative energies of all spc on the channel chnl_enes = sum_channel_enes(chnl_infs, ref_ene) # Write the mess strings for all spc on the channel mess_strs, dat_str_dct, written_labels = _make_channel_mess_strs( tsname, reacs, prods, spc_dct, label_dct, written_labels, chnl_infs, chnl_enes, spc_model_dct_i) # Append to full MESS strings [well_str, bi_str, ts_str] = mess_strs full_well_str += well_str full_bi_str += bi_str full_ts_str += ts_str full_dat_str_dct.update(dat_str_dct) ioprinter.debug_message('rxn', rxn) ioprinter.debug_message('enes', chnl_enes) ioprinter.debug_message('label dct', label_dct) ioprinter.debug_message('written labels', written_labels) # Combine all the reaction channel strings rxn_chan_str = '\n'.join([full_well_str, full_bi_str, full_ts_str]) return rxn_chan_str, full_dat_str_dct, pes_ene_dct, conn_lst
def read_amech_input(job_path): """ Reads all MechDriver input files provided by the user into strings. All whitespace and comment lines are stripped from the files. :param job_path: directory path where all input files exist :type job_path: str :rtype: dict[str:str] """ # Read required input strings run_str = ioformat.pathtools.read_file(job_path, RUN_INP, remove_comments='#', remove_whitespace=True) ioprinter.reading('run.dat...', newline=1) # Add a Found <file> to msg thy_str = ioformat.pathtools.read_file(job_path, THY_INP, remove_comments='#', remove_whitespace=True) ioprinter.reading('theory.dat...', newline=1) mod_str = ioformat.pathtools.read_file(job_path, MODEL_INP, remove_comments='#', remove_whitespace=True) ioprinter.reading('model.dat...', newline=1) spc_str = ioformat.pathtools.read_file(job_path, CSV_INP) ioprinter.reading('species.csv...', newline=1) mech_str = ioformat.pathtools.read_file(job_path, MECH_INP, remove_comments='!', remove_whitespace=True) ioprinter.reading('mechanism.dat...', newline=1) # Read auxiliary input strings dat_str = ioformat.pathtools.read_file(job_path, DAT_INP, remove_comments='#') ioprinter.reading('species.dat...', newline=1) # Read structural and template files geo_dct = _geometry_dictionary(job_path) ioprinter.reading('geom.xyzs...', newline=1) act_dct = _active_space_dictionary(job_path) ioprinter.reading('active_space templates...', newline=1) inp_str_dct = { # required 'run': run_str, 'thy': thy_str, 'mod': mod_str, 'spc': spc_str, 'mech': mech_str, # auxiliary 'dat': dat_str, # structural/template 'geo': geo_dct, 'act': act_dct } # Assess if all required strings are present _check_input_avail(inp_str_dct) return inp_str_dct
def run_tsk(tsk, spc_dct, spc_name, thy_dct, proc_keyword_dct, pes_mod_dct_i, spc_mod_dct_i, run_prefix, save_prefix): """ run a proc tess task for generating a list of conformer or tau sampling geometries """ # Print the head of the task ioprinter.output_task_header(tsk) ioprinter.obj('line_dash') ioprinter.output_keyword_list(proc_keyword_dct, thy_dct) # Setup csv data dictionary for specific task csv_data = util.set_csv_data(tsk) chn_basis_ene_dct = {} spc_array = [] # print species ioprinter.obj('line_dash') ioprinter.info_message("Species: ", spc_name) # Heat of formation basis molecules and coefficients # is not conformer specific if 'coeffs' in tsk: thy_info = spc_mod_dct_i['geo'][1] filelabel = 'coeffs' filelabel += '_{}'.format(pes_mod_dct_i['thermfit']['ref_scheme']) filelabel += '.csv' label = spc_name basis_dct, _ = basis.prepare_refs( pes_mod_dct_i['thermfit']['ref_scheme'], spc_dct, (spc_name, )) # Get the basis info for the spc of interest spc_basis, coeff_basis = basis_dct[spc_name] coeff_array = [] for spc_i in spc_basis: if spc_i not in spc_array: spc_array.append(spc_i) for spc_i in spc_array: if spc_i in spc_basis: coeff_array.append(coeff_basis[spc_basis.index(spc_i)]) else: coeff_array.append(0) csv_data[label] = [*coeff_array] else: # unpack spc and level info spc_dct_i = spc_dct[spc_name] if proc_keyword_dct['geolvl']: thy_info = tinfo.from_dct(thy_dct.get(proc_keyword_dct['geolvl'])) else: thy_info = spc_mod_dct_i['geo'][1] # Loop over conformers if proc_keyword_dct['geolvl']: _, rng_cnf_locs_lst, rng_cnf_locs_path = util.conformer_list( proc_keyword_dct, save_prefix, run_prefix, spc_dct_i, thy_dct) spc_mod_dct_i, pf_models = None, None else: ret = util.conformer_list_from_models(proc_keyword_dct, save_prefix, run_prefix, spc_dct_i, thy_dct, spc_mod_dct_i, pf_models) _, rng_cnf_locs_lst, rng_cnf_locs_path = ret for locs, locs_path in zip(rng_cnf_locs_lst, rng_cnf_locs_path): label = spc_name + '_' + '_'.join(locs) _, cnf_fs = filesys.build_fs(run_prefix, save_prefix, 'CONFORMER') if 'freq' in tsk: filelabel = 'freq' if spc_mod_dct_i: filelabel += '_m{}'.format(spc_mod_dct_i['harm'][0]) else: filelabel += '_{}'.format(proc_keyword_dct['geolvl']) filelabel += '.csv' if pf_models: pf_filesystems = filesys.models.pf_filesys(spc_dct_i, spc_mod_dct_i, run_prefix, save_prefix, saddle=False) ret = vib.full_vib_analysis(spc_dct_i, pf_filesystems, spc_mod_dct_i, run_prefix, zrxn=None) freqs, _, tors_zpe, sfactor, torsfreqs, all_freqs = ret csv_data['tfreq'][label] = torsfreqs csv_data['allfreq'][label] = all_freqs csv_data['scalefactor'][label] = [sfactor] else: es_model = util.freq_es_levels(proc_keyword_dct) spc_mod_dct_i = parser.model.pf_level_info( es_model, thy_dct) try: freqs, _, zpe = vib.read_locs_harmonic_freqs( cnf_fs, locs, run_prefix, zrxn=None) except: freqs = [] zpe = 0 tors_zpe = 0.0 spc_data = [] zpe = tors_zpe + (sum(freqs) / 2.0) * phycon.WAVEN2EH if freqs and proc_keyword_dct['scale'] is not None: freqs, zpe = vib.scale_frequencies(freqs, tors_zpe, spc_mod_dct_i, scale_method='3c') spc_data = [locs_path, zpe, *freqs] csv_data['freq'][label] = spc_data elif 'geo' in tsk: filelabel = 'geo' if spc_mod_dct_i: filelabel += '_{}'.format(spc_mod_dct_i['harm']) else: filelabel += '_{}'.format(proc_keyword_dct['geolvl']) filelabel += '.txt' if cnf_fs[-1].file.geometry.exists(locs): geo = cnf_fs[-1].file.geometry.read(locs) energy = cnf_fs[-1].file.energy.read(locs) comment = 'energy: {0:>15.10f}'.format(energy) xyz_str = automol.geom.xyz_string(geo, comment=comment) else: xyz_str = '\t -- Missing --' spc_data = '\n\nSPC: {}\tConf: {}\tPath: {}\n'.format( spc_name, locs, locs_path) + xyz_str csv_data[label] = spc_data elif 'zma' in tsk: filelabel = 'zmat' if spc_mod_dct_i: filelabel += '_{}'.format(spc_mod_dct_i['harm']) else: filelabel += '_{}'.format(proc_keyword_dct['geolvl']) filelabel += '.txt' geo = cnf_fs[-1].file.geometry.read(locs) zma = automol.geom.zmatrix(geo) energy = cnf_fs[-1].file.energy.read(locs) comment = 'energy: {0:>15.10f}\n'.format(energy) zma_str = automol.zmat.string(zma) spc_data = '\n\nSPC: {}\tConf: {}\tPath: {}\n'.format( spc_name, locs, locs_path) + comment + zma_str csv_data[label] = spc_data elif 'ene' in tsk: filelabel = 'ene' if spc_mod_dct_i: filelabel += '_{}'.format(spc_mod_dct_i['harm']) filelabel += '_{}'.format(spc_mod_dct_i['ene']) else: filelabel += '_{}'.format(proc_keyword_dct['geolvl']) filelabel += '_{}'.format(proc_keyword_dct['proplvl']) filelabel += '.csv' energy = None if spc_mod_dct_i: pf_filesystems = filesys.models.pf_filesys(spc_dct_i, spc_mod_dct_i, run_prefix, save_prefix, saddle=False) energy = ene.electronic_energy(spc_dct_i, pf_filesystems, spc_mod_dct_i, conf=(locs, locs_path, cnf_fs)) else: spc_info = sinfo.from_dct(spc_dct_i) thy_info = tinfo.from_dct( thy_dct.get(proc_keyword_dct['proplvl'])) mod_thy_info = tinfo.modify_orb_label(thy_info, spc_info) sp_save_fs = autofile.fs.single_point(locs_path) sp_save_fs[-1].create(mod_thy_info[1:4]) # Read the energy sp_path = sp_save_fs[-1].path(mod_thy_info[1:4]) if os.path.exists(sp_path): if sp_save_fs[-1].file.energy.exists( mod_thy_info[1:4]): ioprinter.reading('Energy', sp_path) energy = sp_save_fs[-1].file.energy.read( mod_thy_info[1:4]) csv_data[label] = [locs_path, energy] elif 'enthalpy' in tsk: filelabel = 'enthalpy' if spc_mod_dct_i: filelabel += '_{}'.format(spc_mod_dct_i['harm']) filelabel += '_{}'.format(spc_mod_dct_i['ene']) else: filelabel += '_{}'.format(proc_keyword_dct['geolvl']) filelabel += '_{}'.format(proc_keyword_dct['proplvl']) filelabel = '.csv' energy = None pf_filesystems = filesys.models.pf_filesys(spc_dct_i, spc_mod_dct_i, run_prefix, save_prefix, saddle=False) ene_abs = ene.read_energy(spc_dct_i, pf_filesystems, spc_mod_dct_i, run_prefix, conf=(locs, locs_path, cnf_fs), read_ene=True, read_zpe=True, saddle=False) hf0k, _, chn_basis_ene_dct, hbasis = basis.enthalpy_calculation( spc_dct, spc_name, ene_abs, chn_basis_ene_dct, pes_mod_dct_i, spc_mod_dct_i, run_prefix, save_prefix, pforktp='pf', zrxn=None) spc_basis, coeff_basis = hbasis[spc_name] coeff_array = [] for spc_i in spc_basis: if spc_i not in spc_array: spc_array.append(spc_i) for spc_i in spc_array: if spc_i in spc_basis: coeff_array.append(coeff_basis[spc_basis.index(spc_i)]) else: coeff_array.append(0) csv_data[label] = [locs_path, ene_abs, hf0k, *coeff_array] util.write_csv_data(tsk, csv_data, filelabel, spc_array)
# Print the header message and host name (probably combine into one function) ioprinter.program_header('amech') ioprinter.random_cute_animal() ioprinter.host_name() # Parse all of the input ioprinter.program_header('inp') # THY_DCT = parser.theory.build_thy_dct(JOB_PATH) # PES_MODEL_DCT, SPC_MODEL_DCT = parser.model.read_models_sections(JOB_PATH) # SPC_DCT = parser.species.build_spc_dct(JOB_PATH, 'csv') # RUN_PES_DCT = parser.mechanism.build_pes_dct( # SUB_SCRIPT_DCT = build_sub_script_dct(JOB_PATH) # Parse the run input ioprinter.reading('run.dat...', newline=1) RUN_INP_DCT = parser.run.build_run_inp_dct(JOB_PATH) RUN_OBJ_DCT = parser.run.objects_dct(JOB_PATH) RUN_JOBS_LST = parser.run.build_run_jobs_lst(JOB_PATH) ES_TSK_STR = parser.run.read_es_tsks(JOB_PATH) PRINT_TSK_STR = parser.run.read_print_tsks(JOB_PATH) TRANS_TSK_STR = parser.run.read_trans_tsks(JOB_PATH) # Parse the theory input ioprinter.reading('theory.dat...', newline=1) THY_DCT = parser.theory.build_thy_dct(JOB_PATH) # Parse the model input ioprinter.reading('model.dat...', newline=1) PES_MODEL_DCT, SPC_MODEL_DCT = parser.model.read_models_sections(JOB_PATH)
def tors_projected_freqs(pf_filesystems, mess_hr_str, projrot_hr_str, prefix, zrxn=None, conf=None): """ Get frequencies from one version of ProjRot """ run_prefix = pf_filesystems['run_prefix'] # Build the filesystems [harm_cnf_fs, _, harm_min_locs, _, _] = pf_filesystems['harm'] [tors_cnf_fs, _, tors_min_locs, _, _] = pf_filesystems['tors'] if conf: harm_min_locs = conf[1] harm_cnf_fs = conf[2] # Read info from the filesystem that is needed harm_geo = harm_cnf_fs[-1].file.geometry.read(harm_min_locs) hess = harm_cnf_fs[-1].file.hessian.read(harm_min_locs) tors_geo = tors_cnf_fs[-1].file.geometry.read(tors_min_locs) ioprinter.reading('Hessian', harm_cnf_fs[-1].path(harm_min_locs)) fml_str = automol.geom.formula_string(harm_geo) vib_path = job_path(run_prefix, 'PROJROT', 'PROJFREQ', fml_str, print_path=True) # Read info for the hindered rotors and calculate the ZPVE ioprinter.info_message(' - Calculating the torsional ZPVES using MESS...') script_str = autorun.SCRIPT_DCT['messpf'] tors_freqs, _ = autorun.mess.torsions(script_str, vib_path, tors_geo, mess_hr_str) tors_zpe = (sum(tors_freqs) / 2.0) * phycon.WAVEN2EH ioprinter.info_message( ' - Calculating the RT and RT-rotor projected frequencies ProjRot') # NEW projrot writing script_str = autorun.SCRIPT_DCT['projrot'] dist_cutoff_dct1 = {('H', 'O'): 2.26767, ('H', 'C'): 2.26767} dist_cutoff_dct2 = { ('H', 'O'): 2.83459, ('H', 'C'): 2.83459, ('C', 'O'): 3.7807 } rotor_dist1_str = projrot_io.writer.projection_distance_aux( dist_cutoff_dct=dist_cutoff_dct1) rotor_dist2_str = projrot_io.writer.projection_distance_aux( dist_cutoff_dct=dist_cutoff_dct2) aux_dct1 = {'dist_rotpr.dat': rotor_dist1_str} aux_dct2 = {'dist_rotpr.dat': rotor_dist2_str} rt_freqs1, rth_freqs1, rt_imag1, _ = autorun.projrot.frequencies( script_str, vib_path, [harm_geo], [[]], [hess], rotors_str=projrot_hr_str, aux_dct=aux_dct1) _, rth_freqs2, rt_imag2, _ = autorun.projrot.frequencies( script_str, vib_path, [harm_geo], [[]], [hess], rotors_str=projrot_hr_str, aux_dct=aux_dct2) # Calculate harmonic ZPVE from all harmonic freqs, including torsionals harm_zpe = (sum(rt_freqs1) / 2.0) * phycon.WAVEN2EH ioprinter.info_message('harmonic zpe is {} kcal/mol'.format(harm_zpe)) # Calculate harmonic ZPVE from freqs where torsions have been projected out # Value from both projrot versions, which use different projection schemes harm_zpe_notors_1 = (sum(rth_freqs1) / 2.0) * phycon.WAVEN2EH harm_zpe_notors_2 = (sum(rth_freqs2) / 2.0) * phycon.WAVEN2EH # Calcuate the difference in the harmonic ZPVE from projecting out torsions harm_tors_zpe = harm_zpe - harm_zpe_notors_1 harm_tors_zpe_2 = harm_zpe - harm_zpe_notors_2 # Check to see which of the above ZPVEs match more closely with tors ZPVE # calculated directly by treating the torsions in MESS diff_tors_zpe = harm_tors_zpe - tors_zpe diff_tors_zpe_2 = harm_tors_zpe_2 - tors_zpe if diff_tors_zpe <= diff_tors_zpe_2: freqs = rth_freqs1 imag_freqs = rt_imag1 proj_zpe = harm_zpe_notors_1 else: freqs = rth_freqs2 imag_freqs = rt_imag2 proj_zpe = harm_zpe_notors_2 # Check imaginary frequencies and set freqs if zrxn is not None: if len(imag_freqs) > 1: ioprinter.warning_message( 'There is more than one imaginary frequency') imag = max(imag_freqs) else: imag = None # NEW autorun function for the frequencies # mess_script_str = autorun.SCRIPT_DCT['messpf'] # projrot_script_str = autorun.SCRIPT_DCT['projrot'] # proj_freqs, proj_imags, proj_zpe, harm_freqs, tors_freqs = autorun.projected_frequencies( # mess_script_str, projrot_script_str, vib_path, # mess_hr_str, projrot_hr_str, # tors_geo, harm_geo, hess) # if saddle: # proj_imag = proj_imags[0] # else: # proj_imag = [] # NEW scale factor functions # scale_factor = automol.prop.freq.rotor_scale_factor_from_harmonics( # harm_freqs, tors_freqs) # Create a scaling factor for the frequencies # First sort tors frequencies in ascending order sort_tors_freqs = sorted(tors_freqs) # keep only freqs whose RRHO freqs are above a threshold freq_thresh = 50. log_rt_freq = 0.0 nfreq_remove = 0 for freq in rt_freqs1: if freq > freq_thresh: log_rt_freq += numpy.log(freq) else: nfreq_remove += 1 log_freq = [numpy.log(freq) for freq in freqs] log_freq = sum(log_freq) log_tors_freq = 0.0 idx_remove = [] for idx, freq in enumerate(sort_tors_freqs): if idx + 1 > nfreq_remove: log_tors_freq += numpy.log(freq) else: idx_remove.append(tors_freqs.index(freq)) # log_rt_freq = [numpy.log(freq) for freq in rt_freqs1] # log_rt_freq = sum(log_rt_freq) # log_tors_freq = [numpy.log(freq) for freq in tors_freqs] # log_tors_freq = sum(log_tors_freq) #unproj_prod = numpy.prod(rt_freqs1) #proj_prod = numpy.prod(freqs) * numpy.prod(tors_freqs) #print('proj_prod test:', unproj_prod, proj_prod) # ioprinter.info_message('log_freq_tests:', log_rt_freq, log_freq, log_tors_freq) #scale_factor = unproj_prod / proj_prod # generate the scaling factor factor = numpy.exp(log_rt_freq - log_freq - log_tors_freq) ioprinter.info_message('freq test:', freqs, tors_freqs, rt_freqs1) tau_factor = numpy.exp(log_rt_freq - log_freq) tau_factor_mode = tau_factor # generate the set of indices for torsions that are two be scales scale_factor = (idx_remove, factor) ioprinter.info_message('scale fact test', scale_factor) ioprinter.info_message('TAU FACTOR {:4.6f} \t {:g} \t {:3.6f} {} '.format( tau_factor_mode, len(tors_freqs), factor, '-'.join([str(ridx) for ridx in idx_remove]))) # Check if there are significant differences caused by the rotor projection diff_tors_zpe *= phycon.EH2KCAL diff_tors_zpe_2 *= phycon.EH2KCAL if abs(diff_tors_zpe) > 0.2 and abs(diff_tors_zpe_2) > 0.2: ioprinter.warning_message( 'There is a difference of ', '{0:.2f} and {1:.2f}'.format(diff_tors_zpe, diff_tors_zpe_2), 'kcal/mol between harmonic and hindered torsional ZPVEs') return (proj_freqs, proj_imag, proj_zpe, scale_factor, tors_freqs, harm_freqs)
def read_ts_data(spc_dct, tsname, rcts, prds, pes_mod_dct_i, spc_mod_dct_i, run_prefix, save_prefix, chn_basis_ene_dct, ref_pf_models=(), ref_pf_levels=()): """ Determine which block function to useset block functions """ ioprinter.obj('line_plus') ioprinter.reading('Reading filesystem info for {}'.format(tsname), newline=1) ts_dct = spc_dct[tsname] reac_dcts = [spc_dct[name] for name in rcts] prod_dcts = [spc_dct[name] for name in prds] # Set information for transition states pf_filesystems = filesys.models.pf_filesys(spc_dct[tsname], spc_mod_dct_i, run_prefix, save_prefix, True, name=tsname) [cnf_fs, _, min_cnf_locs, _, _] = pf_filesystems['harm'] cnf_path = cnf_fs[-1].path(min_cnf_locs) zma_fs = autofile.fs.zmatrix(cnf_path) zrxn = zma_fs[-1].file.reaction.read((0, )) ts_mod = spc_mod_dct_i['ts'] ts_sadpt, ts_nobar = ts_mod['sadpt'], ts_mod['nobar'] # Get all of the information for the filesystem if not typ.var_radrad(ts_dct['class']): # Set up the saddle point keyword sadpt = True search = ts_dct.get('ts_search') if search is not None: if 'vtst' in search: sadpt = False # Build MESS string for TS at a saddle point if ts_sadpt == 'pst': inf_dct = pst_data(ts_dct, reac_dcts, spc_mod_dct_i, run_prefix, save_prefix) writer = 'pst_block' elif ts_sadpt == 'rpvtst': inf_dct = rpvtst_data(ts_dct, reac_dcts, spc_mod_dct_i, ref_pf_models, ref_pf_levels, run_prefix, save_prefix, sadpt=sadpt) writer = 'rpvtst_block' else: inf_dct, chn_basis_ene_dct = mol_data(tsname, spc_dct, pes_mod_dct_i, spc_mod_dct_i, chn_basis_ene_dct, run_prefix, save_prefix, zrxn=zrxn) writer = 'species_block' else: # Build MESS string for TS with no saddle point if ts_nobar == 'pst': if len(rcts) == 2: inf_dct = pst_data(ts_dct, reac_dcts, spc_mod_dct_i, run_prefix, save_prefix) else: inf_dct = pst_data(ts_dct, prod_dcts, spc_mod_dct_i, run_prefix, save_prefix) writer = 'pst_block' elif ts_nobar == 'rpvtst': inf_dct = rpvtst_data(ts_dct, reac_dcts, spc_mod_dct_i, run_prefix, save_prefix, sadpt=False) writer = 'rpvtst_block' elif ts_nobar == 'vrctst': inf_dct = flux_data(ts_dct, spc_mod_dct_i) writer = 'vrctst_block' # Add writer to inf dct inf_dct['writer'] = writer return inf_dct, chn_basis_ene_dct
def read_amech_input(job_path): """ Parse the run.dat file """ # Read required input strings run_str = ioformat.pathtools.read_file(job_path, RUN_INP, remove_comments='#', remove_whitespace=True) ioprinter.reading('run.dat...', newline=1) # Add a Found <file> to msg thy_str = ioformat.pathtools.read_file(job_path, THY_INP, remove_comments='#', remove_whitespace=True) ioprinter.reading('theory.dat...', newline=1) mod_str = ioformat.pathtools.read_file(job_path, MODEL_INP, remove_comments='#', remove_whitespace=True) ioprinter.reading('model.dat...', newline=1) spc_str = ioformat.pathtools.read_file(job_path, CSV_INP) ioprinter.reading('species.csv...', newline=1) mech_str = ioformat.pathtools.read_file(job_path, MECH_INP, remove_comments='!', remove_whitespace=True) ioprinter.reading('mechanism.dat...', newline=1) # Read auxiliary input strings dat_str = ioformat.pathtools.read_file(job_path, DAT_INP, remove_comments='#') ioprinter.reading('species.dat...', newline=1) # Read structural and template files geo_dct = _geometry_dictionary(job_path) ioprinter.reading('geom.xyzs...', newline=1) act_dct = _active_space_dictionary(job_path) ioprinter.reading('active_space templates...', newline=1) return { # required 'run': run_str, 'thy': thy_str, 'mod': mod_str, 'spc': spc_str, 'mech': mech_str, # auxiliary 'dat': dat_str, # structural/template 'geo': geo_dct, 'act': act_dct }