def make_spc_mess_str(spc_dct, spc_name, pes_mod_dct_i, spc_mod_dct_i, run_prefix, save_prefix): """ Write the MESS input file strings """ # Read the filesystem for the information inf_dct, _ = build.read_spc_data( spc_dct, spc_name, pes_mod_dct_i, spc_mod_dct_i, run_prefix, save_prefix, {}, calc_chn_ene=False) # Write the mol block mess_writer = getattr(BLOCK_MODULE, inf_dct['writer']) mess_block, dat_str_dct = mess_writer(inf_dct) if inf_dct['writer'] == 'tau_block': zero_energy = None else: zero_energy = inf_dct['zpe_chnlvl'] # Write the mess string spc_str = mess_io.writer.species( spc_label=spc_name, spc_data=mess_block, zero_ene=zero_energy ) return spc_str, dat_str_dct
def get_channel_data(reacs, prods, tsname, spc_dct, model_basis_energy_dct, pes_model_dct_i, spc_model_dct_i, run_prefix, save_prefix): """ For all species and transition state for the channel and read all required data from the save filesys, then process and format it to be able to write it into a MESS filesystem. :param tsname: mechanism name of the transition state :param reacs: mechanisms name for the reactants of the reaction channel :type reacs: tuple(str) :param prods: mechanisms name for the products of the reaction channel :type prods: tuple(str) """ # Initialize the dict chnl_infs = {} # Initialize the symm_barrier variable for TS # symm_barrier = False # Determine the MESS data for the reactants and products # Gather data or set fake information for dummy reactants/products chnl_infs['reacs'], chnl_infs['prods'] = [], [] for rgts, side in zip((reacs, prods), ('reacs', 'prods')): for rgt in rgts: chnl_infs_i, model_basis_energy_dct = build.read_spc_data( spc_dct, rgt, pes_model_dct_i, spc_model_dct_i, run_prefix, save_prefix, model_basis_energy_dct) chnl_infs[side].append(chnl_infs_i) # if side in rxn['dummy']: # symm_barrier = True # for _ in range(len(rxn[side])): # chnl_infs[side].append({'ene_chnlvl': 0.00}) # Set up data for TS chnl_infs['ts'] = [] tsnames = [name for name in spc_dct.keys() if tsname in name] for name in tsnames: inf_dct, model_basis_energy_dct = build.read_ts_data( spc_dct, name, reacs, prods, pes_model_dct_i, spc_model_dct_i, run_prefix, save_prefix, model_basis_energy_dct) chnl_infs['ts'].append(inf_dct) # turn back on with fixed TSs # chnl_infs['ts']['symm_barrier'] = symm_barrier # Set up the info for the wells rwell_model = spc_model_dct_i['ts']['rwells'] pwell_model = spc_model_dct_i['ts']['pwells'] rxn_class = spc_dct[tsname + '_0']['class'] if need_fake_wells(rxn_class, rwell_model): chnl_infs['fake_vdwr'] = copy.deepcopy(chnl_infs['reacs']) # pwell_model = spc_model_dct_i['ts']['pwells'] if need_fake_wells(rxn_class, pwell_model): chnl_infs['fake_vdwp'] = copy.deepcopy(chnl_infs['prods']) return chnl_infs, model_basis_energy_dct
def make_messpf_str(temps, spc_dct, spc_name, spc_locs, pes_mod_dct_i, spc_mod_dct_i, run_prefix, save_prefix): """ Reads and processes all information in the save filesys for a given species that are required for MESSPF calculations, as specified by the model dictionaries built from user input. :param temps: temperatures to calculate partition functions (in K) :type temps: tuple(float) :param spc_dct: :type spc_dct: :param spc_name: mechanism name of species to write MESSPF input for :type spc_name: str :param pes_mod_dct_i: keyword dict of specific kin 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 :rtype: str """ # Read the filesystem for the information inf_dct, _ = build.read_spc_data(spc_dct, spc_name, pes_mod_dct_i, spc_mod_dct_i, run_prefix, save_prefix, {}, calc_chn_ene=False, spc_locs=spc_locs) # Write the header string for the MESS input file globkey_str = mess_io.writer.global_pf_input(temperatures=temps, rel_temp_inc=0.001, atom_dist_min=0.6) # Write the species data block for the MESS input file mess_writer = getattr(blocks, inf_dct['writer']) mess_block, dat_str_dct = mess_writer(inf_dct) if inf_dct['writer'] == 'tau_block': zero_energy = None else: zero_energy = inf_dct['zpe_chnlvl'] spc_str = mess_io.writer.species(spc_label=spc_name, spc_data=mess_block, zero_ene=zero_energy) # Combine the strings together to create full MESS input file string mess_inp_str = mess_io.writer.messpf_inp_str(globkey_str, spc_str) return mess_inp_str, dat_str_dct
def set_reference_ene(rxn_lst, spc_dct, tsk_key_dct, model_basis_energy_dct, thy_dct, pes_model_dct_i, spc_model_dct_i, run_prefix, save_prefix, ref_idx=0): """ Sets the reference species for the PES for which all energies are scaled relative to. """ # Set the index for the reference species, right now defualt to 1st spc ref_rxn = rxn_lst[ref_idx] _, (ref_rgts, _) = ref_rxn ioprinter.info_message( 'Determining the reference energy for PES...', newline=1) ioprinter.info_message( ' - Reference species assumed to be the', f' first set of reactants on PES: {"+".join(ref_rgts)}') # Get the model for the first reference species cnf_range = tsk_key_dct['cnf_range'] sort_info_lst = filesys.mincnf.sort_info_lst(tsk_key_dct['sort'], thy_dct) print('sort info list in ref ene', sort_info_lst) # Get the elec+zpe energy for the reference species ioprinter.info_message('') hf0k = 0.0 for rgt in ref_rgts: spc_locs_lst = filesys.models.get_spc_locs_lst( spc_dct[rgt], spc_model_dct_i, run_prefix, save_prefix, saddle=False, cnf_range=cnf_range, sort_info_lst=sort_info_lst, name=rgt) chnl_infs_i, model_basis_energy_dct = build.read_spc_data( spc_dct, rgt, pes_model_dct_i, spc_model_dct_i, run_prefix, save_prefix, model_basis_energy_dct, spc_locs=spc_locs_lst[0]) hf0k += chnl_infs_i['ene_chnlvl'] # hf0k += chnl_infs_i['ene_tsref'] return hf0k, model_basis_energy_dct
def get_channel_data(reacs, prods, tsname_allconfigs, spc_dct, tsk_key_dct, model_basis_energy_dct, thy_dct, pes_model_dct_i, spc_model_dct_i, run_prefix, save_prefix): """ For all species and transition state for the channel and read all required data from the save filesys, then process and format it to be able to write it into a MESS filesystem. :param tsname: mechanism name of the transition state :param reacs: mechanisms name for the reactants of the reaction channel :type reacs: tuple(str) :param prods: mechanisms name for the products of the reaction channel :type prods: tuple(str) """ # Initialize the dict chnl_infs = {} # Get the data for conformer sorting for reading the filesystem cnf_range = tsk_key_dct['cnf_range'] sort_info_lst = filesys.mincnf.sort_info_lst(tsk_key_dct['sort'], thy_dct) # Determine the MESS data for the reactants and products # Gather data or set fake information for dummy reactants/products chnl_infs['reacs'], chnl_infs['prods'] = [], [] for rgts, side in zip((reacs, prods), ('reacs', 'prods')): for rgt in rgts: spc_locs_lst = filesys.models.get_spc_locs_lst( spc_dct[rgt], spc_model_dct_i, run_prefix, save_prefix, saddle=False, cnf_range=cnf_range, sort_info_lst=sort_info_lst, name=rgt) chnl_infs_i, model_basis_energy_dct = build.read_spc_data( spc_dct, rgt, pes_model_dct_i, spc_model_dct_i, run_prefix, save_prefix, model_basis_energy_dct, spc_locs=spc_locs_lst[0]) chnl_infs[side].append(chnl_infs_i) # Get data for all configurations for a TS chnl_infs['ts'] = [] for name in tsname_allconfigs: spc_locs_lst = filesys.models.get_spc_locs_lst( spc_dct[name], spc_model_dct_i, run_prefix, save_prefix, saddle=True, cnf_range=cnf_range, sort_info_lst=sort_info_lst, name=name) spc_locs = spc_locs_lst[0] if spc_locs_lst else None inf_dct, model_basis_energy_dct = build.read_ts_data( spc_dct, name, reacs, prods, pes_model_dct_i, spc_model_dct_i, run_prefix, save_prefix, model_basis_energy_dct, spc_locs=spc_locs) chnl_infs['ts'].append(inf_dct) # Set up the info for the wells rwell_model = spc_model_dct_i['ts']['rwells'] pwell_model = spc_model_dct_i['ts']['pwells'] rxn_class = spc_dct[tsname_allconfigs[0]]['class'] if need_fake_wells(rxn_class, rwell_model): chnl_infs['fake_vdwr'] = copy.deepcopy(chnl_infs['reacs']) if need_fake_wells(rxn_class, pwell_model): chnl_infs['fake_vdwp'] = copy.deepcopy(chnl_infs['prods']) return chnl_infs, model_basis_energy_dct