Example #1
0
def vib_analysis(spc_dct_i,
                 pf_filesystems,
                 spc_mod_dct_i,
                 run_prefix,
                 zrxn=None):
    """ process to get freq
    """

    tors_strs = ['']

    rotors = tors.build_rotors(spc_dct_i, pf_filesystems, spc_mod_dct_i)

    if typ.nonrigid_tors(spc_mod_dct_i, rotors):
        tors_strs = tors.make_hr_strings(rotors)
        [_, hr_str, _, prot_str, _] = tors_strs

        freqs, imag, tors_zpe, pot_scalef = tors_projected_freqs_zpe(
            pf_filesystems, hr_str, prot_str, run_prefix, zrxn=zrxn)

        # Make final hindered rotor strings and get corrected tors zpe
        if typ.scale_1d(spc_mod_dct_i):
            rotors = tors.scale_rotor_pots(rotors, scale_factor=pot_scalef)
            tors_strs = tors.make_hr_strings(rotors)
            [_, hr_str, _, prot_str, _] = tors_strs
            _, _, tors_zpe, _ = tors_projected_freqs_zpe(pf_filesystems,
                                                         hr_str,
                                                         prot_str,
                                                         run_prefix,
                                                         zrxn=zrxn)
            # Calculate current zpe assuming no freq scaling: tors+projfreq

        zpe = tors_zpe + (sum(freqs) / 2.0) * phycon.WAVEN2EH

        # For mdhrv model no freqs needed in MESS input, zero out freqs lst
        if 'mdhrv' in spc_mod_dct_i['tors']['mod']:
            freqs = ()
    else:
        freqs, imag, zpe = read_harmonic_freqs(pf_filesystems,
                                               run_prefix,
                                               zrxn=zrxn)
        tors_zpe = 0.0

    freqs, zpe = scale_frequencies(freqs,
                                   tors_zpe,
                                   spc_mod_dct_i,
                                   scale_method='3c')

    return freqs, imag, zpe, tors_strs
Example #2
0
def full_vib_analysis(spc_dct_i,
                      pf_filesystems,
                      spc_mod_dct_i,
                      run_prefix,
                      zrxn=None):
    """ process to get freq
    """

    tors_strs = ['']
    freqs = []
    imag = []
    tors_zpe = 0.0
    sfactor = 1.0
    tors_freqs = []
    rt_freqs1 = []

    rotors = tors.build_rotors(spc_dct_i, pf_filesystems, spc_mod_dct_i)

    if typ.nonrigid_tors(spc_mod_dct_i, rotors):
        tors_strs = tors.make_hr_strings(rotors)
        [_, hr_str, _, prot_str, _] = tors_strs

        freqs, imag, tors_zpe, pot_scalef = tors_projected_freqs_zpe(
            pf_filesystems, hr_str, prot_str, run_prefix, zrxn=zrxn)

        # Make final hindered rotor strings and get corrected tors zpe
        if typ.scale_1d(spc_mod_dct_i):
            rotors = tors.scale_rotor_pots(rotors, scale_factor=pot_scalef)
            tors_strs = tors.make_hr_strings(rotors)
            [_, hr_str, _, prot_str, _] = tors_strs
            torsinf = tors_projected_freqs(pf_filesystems,
                                           hr_str,
                                           prot_str,
                                           run_prefix,
                                           zrxn=zrxn)
            freqs, imag, tors_zpe, sfactor, tors_freqs, rt_freqs1 = torsinf

        # For mdhrv model no freqs needed in MESS input, zero out freqs lst
        if 'mdhrv' in spc_mod_dct_i['tors']['mod']:
            freqs = ()
    else:
        freqs, imag, _ = read_harmonic_freqs(pf_filesystems,
                                             run_prefix,
                                             zrxn=zrxn)
        tors_zpe = 0.0

    return freqs, imag, tors_zpe, sfactor, tors_freqs, rt_freqs1
Example #3
0
def torsions(spc_name, spc_dct_i, spc_mod_dct_i, mod_thy_info, run_prefix,
             save_prefix):
    """ get the torsion potentials
        currently just checks if there any non-empty potentials
    """

    if spc_mod_dct_i is not None:
        mod_thy_info = spc_mod_dct_i['tors']['geolvl'][1][1]

    saddle = 'ts_' in spc_name
    pf_filesystems = filesys.models.pf_filesys(spc_dct_i,
                                               spc_mod_dct_i,
                                               run_prefix,
                                               save_prefix,
                                               name=spc_name,
                                               saddle=saddle)

    # Do initial check to see if a torsions file exists
    if pf_filesystems['tors'] is not None:
        [cnf_fs, _, min_cnf_locs, _, _] = pf_filesystems['tors']
        zma_fs = autofile.fs.zmatrix(cnf_fs[-1].path(min_cnf_locs))
        print('cnf_path', cnf_fs[-1].path(min_cnf_locs))
        if zma_fs[-1].file.torsions.exists([0]):
            rotors = tors.build_rotors(spc_dct_i, pf_filesystems,
                                       spc_mod_dct_i)
            pots = automol.rotor.potentials(rotors, flat=True)
            # Just check if there any potentials with
            if all(pot for pot in pots):
                miss_data = None
            else:
                miss_data = (spc_name, mod_thy_info, 'torsions')
        else:
            miss_data = None
            print('No rotors file in SAVE filesys. Assuming no rotors')
    else:
        miss_data = None

    return None, miss_data
Example #4
0
def tau_data(spc_dct_i, spc_mod_dct_i, run_prefix, save_prefix, saddle=False):
    """ Read the filesystem to get information for TAU
    """

    # Set up model and basic thy objects
    spc_info = sinfo.from_dct(spc_dct_i)
    thy_info = spc_mod_dct_i['vib']['geolvl'][1][1]
    mod_thy_info = tinfo.modify_orb_label(thy_info, spc_info)

    vib_model = spc_mod_dct_i['vib']['mod']

    # Set up reference conformer filesys
    pf_filesystems = filesys.models.pf_filesys(spc_dct_i, spc_mod_dct_i,
                                               run_prefix, save_prefix, saddle)
    [harm_save_fs, _, harm_min_locs, _, _] = pf_filesystems['harm']

    # Obtain all values from initial reference conformer
    rotors = tors.build_rotors(spc_dct_i,
                               pf_filesystems,
                               spc_mod_dct_i,
                               read_potentials=False)
    vib_info = vib.full_vib_analysis(spc_dct_i,
                                     pf_filesystems,
                                     spc_mod_dct_i,
                                     run_prefix,
                                     zrxn=None)
    freqs, _, zpe, _, tors_strs, _, harm_freqs, _ = vib_info
    harm_zpve = 0.5 * sum(harm_freqs) * phycon.WAVEN2EH

    ioprinter.info_message('Determining the symmetry factor...', newline=1)
    sym_factor = symm.symmetry_factor(
        pf_filesystems,
        spc_mod_dct_i,
        spc_dct_i,
        rotors,
    )

    zpe_chnlvl = zpe * phycon.EH2KCAL
    ref_ene = harm_zpve * phycon.EH2KCAL

    ref_geom = [harm_save_fs[-1].file.geometry.read(harm_min_locs)]
    ref_grad = [harm_save_fs[-1].file.gradient.read(harm_min_locs)]
    ref_hessian = [harm_save_fs[-1].file.hessian.read(harm_min_locs)]

    min_cnf_ene = filesys.read.energy(harm_save_fs, harm_min_locs,
                                      mod_thy_info)

    # Set up the TAU filesystem objects, get locs, and read info
    _, tau_save_fs = filesys.build_fs(run_prefix,
                                      save_prefix,
                                      'TAU',
                                      spc_locs=spc_info,
                                      thy_locs=mod_thy_info[1:])

    db_style = 'jsondb'
    vib_model = spc_mod_dct_i['vib']['mod']
    if vib_model == 'tau':
        if db_style == 'directory':
            tau_locs = [
                locs for locs in tau_save_fs[-1].existing()
                if tau_save_fs[-1].file.hessian.exists(locs)
            ]
        elif db_style == 'jsondb':
            tau_locs = [
                locs for locs in tau_save_fs[-1].json_existing()
                if tau_save_fs[-1].json.hessian.exists(locs)
            ]
    else:
        if db_style == 'directory':
            tau_locs = tau_save_fs[-1].existing()
        elif db_style == 'jsondb':
            tau_locs = tau_save_fs[-1].json_existing()

    ioprinter.info_message(
        'Reading data for the Monte Carlo samples from db.json'
        f'at path {tau_save_fs[0].path()}')
    samp_geoms, samp_enes, samp_grads, samp_hessians = [], [], [], []
    tot_locs = len(tau_locs)
    for idx, locs in enumerate(tau_locs):

        if db_style == 'directory':
            geo = tau_save_fs[-1].file.geometry.read(locs)
        elif db_style == 'jsondb':
            geo = tau_save_fs[-1].json.geometry.read(locs)

        # geo_str = autofile.data_types.swrite.geometry(geo)
        samp_geoms.append(geo)

        if db_style == 'directory':
            tau_ene = tau_save_fs[-1].file.energy.read(locs)
        elif db_style == 'jsondb':
            tau_ene = tau_save_fs[-1].json.energy.read(locs)
        rel_ene = (tau_ene - min_cnf_ene) * phycon.EH2KCAL
        # ene_str = autofile.data_types.swrite.energy(rel_ene)
        samp_enes.append(rel_ene)

        if vib_model == 'tau':
            if db_style == 'directory':
                grad = tau_save_fs[-1].file.gradient.read(locs)
            elif db_style == 'jsondb':
                grad = tau_save_fs[-1].json.gradient.read(locs)
            # grad_str = autofile.data_types.swrite.gradient(grad)
            samp_grads.append(grad)

            if db_style == 'directory':
                hess = tau_save_fs[-1].file.hessian.read(locs)
            elif db_style == 'jsondb':
                hess = tau_save_fs[-1].json.hessian.read(locs)
            # hess_str = autofile.data_types.swrite.hessian(hess)
            samp_hessians.append(hess)

        # Print progress message (every 150 geoms read)
        if idx % 149 == 0:
            print(f'Read {idx+1}/{tot_locs} samples...')

    # Determine the successful conformer ratio
    inf_obj = tau_save_fs[0].file.info.read()
    excluded_volume_factor = len(samp_geoms) / inf_obj.nsamp
    print('excluded volume factor test:', excluded_volume_factor,
          len(samp_geoms), inf_obj.nsamp)

    # Create info dictionary
    keys = [
        'geom', 'sym_factor', 'elec_levels', 'freqs', 'flux_mode_str',
        'samp_geoms', 'samp_enes', 'samp_grads', 'samp_hessians', 'ref_geom',
        'ref_grad', 'ref_hessian', 'zpe_chnlvl', 'ref_ene',
        'excluded_volume_factor'
    ]
    vals = [
        ref_geom[0], sym_factor, spc_dct_i['elec_levels'], freqs, tors_strs[2],
        samp_geoms, samp_enes, samp_grads, samp_hessians, ref_geom, ref_grad,
        ref_hessian, zpe_chnlvl, ref_ene, excluded_volume_factor
    ]
    inf_dct = dict(zip(keys, vals))

    return inf_dct
Example #5
0
def 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=True,
             zrxn=None,
             spc_locs=None):
    """ Reads all required data from the SAVE filesystem for a molecule.
        Stores data into an info dictionary.

        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 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
        :rtype: dict[]
    """

    spc_dct_i = spc_dct[spc_name]
    ene_chnlvl = None
    ene_reflvl = None
    zpe = None
    hf0k = None
    hf0k_trs = None
    hf0k = None

    # Initialize all of the elements of the inf dct
    geom, sym_factor, freqs, imag, elec_levels = None, None, None, None, None
    allr_str, mdhr_dat = '', ''
    xmat, rovib_coups, rot_dists = None, None, None

    # Set up all the filesystem objects using models and levels
    pf_filesystems = filesys.models.pf_filesys(spc_dct_i,
                                               spc_mod_dct_i,
                                               run_prefix,
                                               save_prefix,
                                               zrxn is not None,
                                               name=spc_name,
                                               spc_locs=spc_locs)

    # Obtain rotation partition function information
    ioprinter.info_message('Obtaining info for rotation partition function...',
                           newline=1)
    geom = rot.read_geom(pf_filesystems)

    if typ.nonrigid_rotations(spc_mod_dct_i):
        rovib_coups, rot_dists = rot.read_rotational_values(pf_filesystems)

    # Obtain vibration partition function information
    ioprinter.info_message(
        'Preparing internal rotor info building partition functions...',
        newline=1)
    rotors = tors.build_rotors(spc_dct_i, pf_filesystems, spc_mod_dct_i)
    ioprinter.info_message(
        'Obtaining the vibrational frequencies and zpves...', newline=1)
    freqs, imag, zpe, _, tors_strs, _, _, _ = vib.full_vib_analysis(
        spc_dct_i, pf_filesystems, spc_mod_dct_i, run_prefix, zrxn=zrxn)
    allr_str = tors_strs[0]

    # ioprinter.info_message('zpe in mol_data test:', zpe)
    if typ.anharm_vib(spc_mod_dct_i):
        xmat = vib.read_anharmon_matrix(pf_filesystems)

    # Obtain symmetry factor
    ioprinter.info_message('Determining the symmetry factor...', newline=1)

    zma = None
    if zrxn:
        [_, cnf_save_path, _, _, _] = pf_filesystems['harm']
        # Build the rotors
        if cnf_save_path:
            zma_fs = autofile.fs.zmatrix(cnf_save_path)
            zma = zma_fs[-1].file.zmatrix.read([0])

    sym_factor = symm.symmetry_factor(pf_filesystems,
                                      spc_mod_dct_i,
                                      spc_dct_i,
                                      rotors,
                                      grxn=zrxn,
                                      zma=zma)

    # Obtain electronic energy levels
    elec_levels = spc_dct_i['elec_levels']

    # Obtain energy levels
    ioprinter.info_message('Obtaining the electronic energy + zpve...',
                           newline=1)
    if calc_chn_ene:
        chn_ene = ene.read_energy(spc_dct_i,
                                  pf_filesystems,
                                  spc_mod_dct_i,
                                  run_prefix,
                                  read_ene=True,
                                  read_zpe=False,
                                  saddle=zrxn is not None)
        ene_chnlvl = chn_ene + zpe

        zma = None
        # Determine info about the basis species used in thermochem calcs
        hf0k, hf0k_trs, chn_basis_ene_dct, _ = basis.enthalpy_calculation(
            spc_dct,
            spc_name,
            ene_chnlvl,
            chn_basis_ene_dct,
            pes_mod_dct_i,
            spc_mod_dct_i,
            run_prefix,
            save_prefix,
            zrxn=zrxn)

    ene_reflvl = None

    #  Build the energy transfer section strings
    if zrxn is None:
        ioprinter.info_message('Determining energy transfer parameters...',
                               newline=1)
        well_info = sinfo.from_dct(spc_dct_i)
        # ioprinter.debug_message('well_inf', well_info)
        # bath_info = ['InChI=1S/N2/c1-2', 0, 1]  # how to do...
        bath_info = ['InChI=1S/Ar', 0, 1]  # how to do...
        etrans_dct = etrans.build_etrans_dct(spc_dct_i)

        edown_str, collid_freq_str = etrans.make_energy_transfer_strs(
            well_info, bath_info, etrans_dct)
    else:
        edown_str, collid_freq_str = None, None

    # Create info dictionary
    keys = [
        'geom', 'sym_factor', 'freqs', 'imag', 'elec_levels', 'mess_hr_str',
        'mdhr_dat', 'xmat', 'rovib_coups', 'rot_dists', 'ene_chnlvl',
        'ene_reflvl', 'zpe_chnlvl', 'ene_tsref', 'edown_str', 'collid_freq_str'
    ]
    vals = [
        geom, sym_factor, freqs, imag, elec_levels, allr_str, mdhr_dat, xmat,
        rovib_coups, rot_dists, hf0k, ene_reflvl, zpe, hf0k_trs, edown_str,
        collid_freq_str
    ]
    inf_dct = dict(zip(keys, vals))

    return inf_dct, chn_basis_ene_dct
Example #6
0
def messpf_input(spc_name, spc_dct_i, spc_mod_dct_i, pes_mod_dct_i, locs,
                 locs_path, cnf_fs, run_prefix, save_prefix):
    """ collect enthalpies
    """

    _, _ = locs_path, cnf_fs  # needed

    zrxn = spc_dct_i.get('zrxn')
    saddle = bool(zrxn)
    miss_data = None

    # print('spc_mod_dct_i', 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,
                                               spc_locs=locs)
    geom = rot.read_geom(pf_filesystems)
    rotors = tors.build_rotors(spc_dct_i, pf_filesystems, spc_mod_dct_i)
    freqs, imag, zpe, _, tors_strs, _, _, _ = vib.full_vib_analysis(
        spc_dct_i, pf_filesystems, spc_mod_dct_i, run_prefix, zrxn=zrxn)
    allr_str = tors_strs[0]

    zma = None
    sym_factor = symm.symmetry_factor(pf_filesystems,
                                      spc_mod_dct_i,
                                      spc_dct_i,
                                      rotors,
                                      grxn=zrxn,
                                      zma=zma)
    elec_levels = spc_dct_i['elec_levels']

    keys = [
        'writer', 'geom', 'sym_factor', 'freqs', 'imag', 'elec_levels',
        'mess_hr_str', 'mdhr_dat', 'xmat', 'rovib_coups', 'rot_dists',
        'ene_chnlvl', 'ene_reflvl', 'zpe_chnlvl', 'ene_tsref', 'edown_str',
        'collid_freq_str'
    ]
    vals = [
        'species_block', geom, sym_factor, freqs, imag, elec_levels, allr_str,
        None, None, None, None, None, None, zpe, None, None, None
    ]
    inf_dct = dict(zip(keys, vals))

    temps = pes_mod_dct_i['therm_temps']
    globkey_str = mess_io.writer.global_pf_input(temperatures=temps,
                                                 rel_temp_inc=0.001,
                                                 atom_dist_min=0.6)
    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)
    messpf_inp_str = mess_io.writer.messpf_inp_str(globkey_str, spc_str)

    return (messpf_inp_str, dat_str_dct, miss_data)
Example #7
0
def tau_data(spc_dct_i, spc_mod_dct_i, run_prefix, save_prefix, saddle=False):
    """ Read the filesystem to get information for TAU
    """

    # Set up all the filesystem objects using models and levels
    pf_filesystems = filesys.models.pf_filesys(spc_dct_i, spc_mod_dct_i,
                                               run_prefix, save_prefix, saddle)
    [harm_cnf_fs, _, harm_min_locs, harm_save, _] = pf_filesystems['harm']
    # [tors_cnf_fs, _, tors_min_locs, _, _] = pf_filesystems['tors']

    # Get the conformer filesys for the reference geom and energy
    if harm_min_locs:
        geom = harm_cnf_fs[-1].file.geometry.read(harm_min_locs)
        min_ene = harm_cnf_fs[-1].file.energy.read(harm_min_locs)

    # Set the filesystem
    tau_save_fs = autofile.fs.tau(harm_save)

    # Get the rotor info
    rotors = tors.build_rotors(spc_dct_i, pf_filesystems, spc_mod_dct_i)

    run_path = filesys.models.make_run_path(pf_filesystems, 'tors')
    tors_strs = tors.make_hr_strings(rotors, run_path, spc_mod_dct_i)
    [_, hr_str, flux_str, prot_str, _] = tors_strs

    # Use model to determine whether to read grads and hessians
    vib_model = spc_mod_dct_i['vib']['mod']
    freqs = ()
    _, _, proj_zpve, harm_zpve = vib.tors_projected_freqs_zpe(pf_filesystems,
                                                              hr_str,
                                                              prot_str,
                                                              run_prefix,
                                                              zrxn=None)
    zpe_chnlvl = proj_zpve * phycon.EH2KCAL

    # Set reference energy to harmonic zpve
    db_style = 'directory'
    reference_energy = harm_zpve * phycon.EH2KCAL
    if vib_model == 'tau':
        if db_style == 'directory':
            tau_locs = [
                locs for locs in tau_save_fs[-1].existing()
                if tau_save_fs[-1].file.hessian.exists(locs)
            ]
        elif db_style == 'jsondb':
            tau_locs = [
                locs for locs in tau_save_fs[-1].json_existing()
                if tau_save_fs[-1].json.hessian.exists(locs)
            ]
    else:
        if db_style == 'directory':
            tau_locs = tau_save_fs[-1].existing()
        elif db_style == 'jsondb':
            tau_locs = tau_save_fs[-1].json_existing()

    # Read the geom, ene, grad, and hessian for each sample
    samp_geoms, samp_enes, samp_grads, samp_hessians = [], [], [], []
    for locs in tau_locs:

        # ioprinter.info_message('Reading tau info at path {}'.format(
        #     tau_save_fs[-1].path(locs)))

        if db_style == 'directory':
            geo = tau_save_fs[-1].file.geometry.read(locs)
        elif db_style == 'jsondb':
            geo = tau_save_fs[-1].json.geometry.read(locs)

        geo_str = autofile.data_types.swrite.geometry(geo)
        samp_geoms.append(geo_str)

        if db_style == 'directory':
            tau_ene = tau_save_fs[-1].file.energy.read(locs)
        elif db_style == 'jsondb':
            tau_ene = tau_save_fs[-1].json.energy.read(locs)
        rel_ene = (tau_ene - min_ene) * phycon.EH2KCAL
        ene_str = autofile.data_types.swrite.energy(rel_ene)
        samp_enes.append(ene_str)

        if vib_model == 'tau':
            if db_style == 'directory':
                grad = tau_save_fs[-1].file.gradient.read(locs)
            elif db_style == 'jsondb':
                grad = tau_save_fs[-1].json.gradient.read(locs)
            grad_str = autofile.data_types.swrite.gradient(grad)
            samp_grads.append(grad_str)

            if db_style == 'directory':
                hess = tau_save_fs[-1].file.hessian.read(locs)
            elif db_style == 'jsondb':
                hess = tau_save_fs[-1].json.hessian.read(locs)
            hess_str = autofile.data_types.swrite.hessian(hess)
            samp_hessians.append(hess_str)

    # Read a geometry, grad, and hessian for a reference geom if needed
    ref_geom, ref_grad, ref_hessian = [], [], []
    if vib_model != 'tau':

        # Get harmonic filesystem information
        [harm_save_fs, _, harm_min_locs, _, _] = pf_filesystems['harm']

        # Read the geometr, gradient, and Hessian
        geo = harm_save_fs[-1].file.geometry.read(harm_min_locs)
        geo_str = autofile.data_types.swrite.geometry(geo)
        ref_geom.append(geo_str)

        grad = harm_save_fs[-1].file.gradient.read(harm_min_locs)
        grad_str = autofile.data_types.swrite.gradient(grad)
        ref_grad.append(grad_str)

        hess = harm_save_fs[-1].file.hessian.read(harm_min_locs)
        hess_str = autofile.data_types.swrite.hessian(hess)
        ref_hessian.append(hess_str)

    # Obtain symmetry factor
    ioprinter.info_message('Determining the symmetry factor...', newline=1)
    sym_factor = symm.symmetry_factor(
        pf_filesystems,
        spc_mod_dct_i,
        spc_dct_i,
        rotors,
    )

    # Create info dictionary
    keys = [
        'geom', 'sym_factor', 'elec_levels', 'freqs', 'flux_mode_str',
        'samp_geoms', 'samp_enes', 'samp_grads', 'samp_hessians', 'ref_geom',
        'ref_grad', 'ref_hessian', 'zpe_chnlvl', 'reference_energy'
    ]
    vals = [
        geom, sym_factor, spc_dct_i['elec_levels'], freqs, flux_str,
        samp_geoms, samp_enes, samp_grads, samp_hessians, ref_geom, ref_grad,
        ref_hessian, zpe_chnlvl, reference_energy
    ]
    inf_dct = dict(zip(keys, vals))

    return inf_dct
Example #8
0
def full_vib_analysis(spc_dct_i,
                      pf_filesystems,
                      spc_mod_dct_i,
                      run_prefix,
                      zrxn=None):
    """ process to get freq
    """
    # Pack into big object to pass into functions and return
    tors_strs = ['']
    freqs = []
    imag = []
    tors_zpe = 0.0
    pot_scalef = 1.0
    tors_freqs = []
    harm_freqs = []

    rotors = tors.build_rotors(spc_dct_i, pf_filesystems, spc_mod_dct_i)
    # Squash the rotor potentials as necessary
    if rotors is not None:
        if typ.squash_tors_pot(spc_mod_dct_i):
            for rotor in rotors:
                for torsion in rotor:
                    torsion.pot = automol.pot.relax_scale(torsion.pot)
    if typ.nonrigid_tors(spc_mod_dct_i, rotors):

        # Build initial MESS+ProjRot HindRot strings; calc. projected freq info
        tors_strs = tors.make_hr_strings(rotors)
        [_, hr_str, _, prot_str, _] = tors_strs
        ret = tors_projected_freqs(pf_filesystems,
                                   hr_str,
                                   prot_str,
                                   run_prefix,
                                   zrxn=zrxn)

        if ret is not None:
            proj_freqs, harm_freqs, tors_freqs, imag, disps = ret

            # Make final hindered rotor strings and get corrected tors zpe
            if typ.scale_1d(spc_mod_dct_i):

                scaled_proj_freqs, _ = scale_frequencies(
                    proj_freqs, None, spc_mod_dct_i, scale_method='c3_harm')
                scaled_harm_freqs, _ = scale_frequencies(
                    harm_freqs, None, spc_mod_dct_i, scale_method='c3_harm')
                # print('scaling test:', scaled_harm_freqs,
                #       scaled_proj_freqs, tors_freqs)
                # print('tors string before scaling',tors_strs)
                pot_scalef = potential_scale_factor(scaled_harm_freqs,
                                                    scaled_proj_freqs,
                                                    tors_freqs)
                # print('pot_scalef:', pot_scalef)
                # get the pot scale factor
                # print('before scaling')
                # for rotor in rotors:
                #     for _tors in rotor:
                #         print(_tors.pot)
                rotors = tors.scale_rotor_pots(rotors, scale_factor=pot_scalef)
                # print('after scaling')
                # for rotor in rotors:
                #     for _tors in rotor:
                #         print(_tors.pot)
                tors_strs = tors.make_hr_strings(rotors)
                [_, hr_str, _, prot_str, _] = tors_strs
                # print('tors string after scaling',tors_strs)
                tors_zpe = tors_projected_scaled_zpe(pf_filesystems,
                                                     hr_str,
                                                     prot_str,
                                                     run_prefix,
                                                     spc_mod_dct_i,
                                                     zrxn=zrxn)
            freqs = ret[0]  # freqs equal to proj_freqs

        # For mdhrv model no freqs needed in MESS input, zero out freqs lst
        if 'mdhrv' in spc_mod_dct_i['tors']['mod']:
            freqs = ()
    else:
        ret = read_harmonic_freqs(pf_filesystems, run_prefix, zrxn=zrxn)
        freqs, imag, zpe, disps = ret

    if freqs:
        freqs, zpe = scale_frequencies(freqs,
                                       tors_zpe,
                                       spc_mod_dct_i,
                                       scale_method='c3')
        harm_freqs, _ = scale_frequencies(harm_freqs,
                                          None,
                                          spc_mod_dct_i,
                                          scale_method='c3')

        # harm_freqs, zpe = scale_frequencies(
        #     harm_freqs, 0,
        #    spc_mod_dct_i, scale_method='c3')

    return (freqs, imag, zpe, pot_scalef, tors_strs, tors_freqs, harm_freqs,
            disps)