예제 #1
0
def set_etrans_well(rxn_lst, spc_dct):
    """ Build info object for reference well on PES
    """

    well_dct = None

    reacs = rxn_lst[0]['reacs']
    prods = rxn_lst[0]['prods']
    if len(reacs) == 1:
        well_dct = spc_dct[reacs[0]]
    elif len(prods) == 1:
        well_dct = spc_dct[prods[0]]
    else:
        rct1_dct = spc_dct[reacs[0]]
        rct2_dct = spc_dct[reacs[1]]
        rct1_count = automol.geom.count(
            automol.inchi.geometry(rct1_dct['inchi']))
        rct2_count = automol.geom.count(
            automol.inchi.geometry(rct2_dct['inchi']))
        if rct1_count > rct2_count:
            well_dct = rct1_dct
        else:
            well_dct = rct2_dct

    well_info = finf.get_spc_info(well_dct)

    return well_info
예제 #2
0
def thermo_paths(spc_dct_i, run_prefix, idx):
    """ Set up the path for saving the pf input and output.
        Placed in a MESSPF, NASA dirs high in run filesys.
    """

    # Get the formula and inchi key
    spc_info = inf.get_spc_info(spc_dct_i)
    spc_formula = automol.inchi.formula_string(spc_info[0])
    ich_key = automol.inchi.inchi_key(spc_info[0])
    print(spc_info[0])

    # PF
    bld_locs = ['PF', idx]
    bld_save_fs = autofile.fs.build(run_prefix)
    bld_save_fs[-1].create(bld_locs)
    bld_path = bld_save_fs[-1].path(bld_locs)
    print(bld_path, spc_formula, ich_key)
    spc_pf_path = os.path.join(bld_path, spc_formula, ich_key)

    # NASA polynomials
    bld_locs = ['NASA', idx]
    bld_save_fs = autofile.fs.build(run_prefix)
    bld_save_fs[-1].create(bld_locs)
    bld_path = bld_save_fs[-1].path(bld_locs)
    spc_nasa_path = os.path.join(bld_path, spc_formula, ich_key)

    return spc_pf_path, spc_nasa_path
예제 #3
0
def set_model_filesys(spc_dct_i, level, run_prefix, save_prefix, saddle):
    """ Gets filesystem objects for reading many calculations
    """

    # Set the spc_info
    spc_info = finf.get_spc_info(spc_dct_i)
    # Set some path stuff
    if saddle:
        save_path = spc_dct_i['rxn_fs'][3]
        run_path = spc_dct_i['rxn_fs'][2]
    else:
        spc_save_fs = autofile.fs.species(save_prefix)
        spc_save_fs[-1].create(spc_info)
        save_path = spc_save_fs[-1].path(spc_info)
        spc_run_fs = autofile.fs.species(run_prefix)
        spc_run_fs[-1].create(spc_info)
        run_path = spc_run_fs[-1].path(spc_info)

    # Set theory filesystem used throughout
    thy_save_fs = autofile.fs.theory(save_path)
    thy_run_fs = autofile.fs.theory(run_path)

    # Set the level for the model
    levelp = finf.modify_orb_restrict(spc_info, level)

    # Get the save fileystem path
    save_path = thy_save_fs[-1].path(levelp[1:4])
    run_path = thy_run_fs[-1].path(levelp[1:4])
    thy_run_fs[-1].create(levelp[1:4])
    if saddle:
        save_fs = autofile.fs.transition_state(save_path)
        save_fs[0].create()
        save_path = save_fs[0].path()
        run_fs = autofile.fs.transition_state(run_path)
        run_fs[0].create()
        run_path = run_fs[0].path()

    # Get the fs object and the locs
    cnf_run_fs = autofile.fs.conformer(run_path)
    cnf_save_fs = autofile.fs.conformer(save_path)
    min_cnf_locs, cnf_save_path = mincnf.min_energy_conformer_locators(
        cnf_save_fs, levelp)

    # Get the save path for the conformers
    # if min_cnf_locs:
    #     cnf_save_path = cnf_save_fs[-1].path(min_cnf_locs)
    # else:
    #     cnf_save_path = ''

    return [cnf_save_fs, cnf_save_path, min_cnf_locs, save_path, cnf_run_fs]
예제 #4
0
def rpath_ref_idx(ts_dct, scn_vals, coord_name, scn_prefix,
                  ene_info1, ene_info2):
    """ Get the reference energy along a reaction path
    """

    # Set up the filesystem
    zma_fs = autofile.fs.manager(scn_prefix, 'ZMATRIX')
    zma_path = zma_fs[-1].path([0])
    scn_fs = autofile.fs.scan(zma_path)

    ene_info1 = ene_info1[1][0][1]
    ene_info2 = ene_info2[0]
    print('mod_eneinf1', ene_info1)
    print('mod_eneinf2', ene_info2)
    mod_ene_info1 = finf.modify_orb_restrict(
        finf.get_spc_info(ts_dct), ene_info1)
    mod_ene_info2 = finf.modify_orb_restrict(
        finf.get_spc_info(ts_dct), ene_info2)

    ene1, ene2, ref_val = None, None, None
    for val in reversed(scn_vals):
        locs = [[coord_name], [val]]
        path = scn_fs[-1].path(locs)
        hs_fs = autofile.fs.high_spin(path)
        if hs_fs[-1].file.energy.exists(mod_ene_info1[1:4]):
            ene1 = hs_fs[-1].file.energy.read(mod_ene_info1[1:4])
        if hs_fs[-1].file.energy.exists(mod_ene_info2[1:4]):
            ene2 = hs_fs[-1].file.energy.read(mod_ene_info2[1:4])
        if ene1 is not None and ene2 is not None:
            print('found', val)
            ref_val = val
            break

    if ref_val is not None:
        scn_idx = scn_vals.index(ref_val)

    return scn_idx, ene1, ene2
예제 #5
0
def set_bath(spc_dct, etrans_dct):
    """ Build nfo object for the bath
    """

    # Try to obtain bath set by the user, otherwise use N2
    bath_name = etrans_dct.get('bath', None)
    bath_dct = spc_dct.get(bath_name, None)
    if bath_dct is not None:
        bath_info = finf.get_spc_info(bath_dct)
        print('  - Using bath {} input by user'.format(bath_name))
    else:
        bath_info = ['InChI=1S/Ar', 0, 1]
        print('  - No bath provided, using Argon as bath')

    return bath_info
예제 #6
0
def electronic_energy(spc_dct_i, pf_filesystems, pf_levels):
    """ get high level energy at low level optimized geometry
    """

    print('- Calculating electronic energy')

    # spc_dct_i = spc_dct[spc_name]
    spc_info = finf.get_spc_info(spc_dct_i)

    # Get the harmonic filesys information
    [_, cnf_path, _, _, _] = pf_filesystems['harm']

    # Get the electronic energy levels
    ene_levels = pf_levels['ene'][1]

    # Read the energies from the filesystem
    e_elec = None
    if os.path.exists(cnf_path):

        e_elec = 0.0
        # print('lvls', ene_levels)
        for (coeff, level) in ene_levels:
            # Build SP filesys
            mod_thy_info = finf.modify_orb_restrict(spc_info, level)
            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):
                print('Energy read from path {}'.format(sp_path))
                ene = sp_save_fs[-1].file.energy.read(mod_thy_info[1:4])
                e_elec += (coeff * ene)
            else:
                print('No energy at path')
                e_elec = None
                break
    else:
        print('No conformer to calculate the energy')

    return e_elec
예제 #7
0
def set_rpath_filesys(ts_dct, level):
    """ Gets filesystem objects for reading many calculations
    """

    # Set the spc_info
    spc_info = finf.get_spc_info(ts_dct)

    # Set some path stuff
    save_path = ts_dct['rxn_fs'][3]
    run_path = ts_dct['rxn_fs'][2]

    # Set theory filesystem used throughout
    thy_save_fs = autofile.fs.theory(save_path)
    thy_run_fs = autofile.fs.theory(run_path)

    levelp = finf.modify_orb_restrict(spc_info, level[1])

    # Get the save fileystem path
    print('level', levelp)
    save_path = thy_save_fs[-1].path(levelp[1:4])
    run_path = thy_run_fs[-1].path(levelp[1:4])

    thy_save_fs[-1].create(levelp[1:4])
    thy_run_fs[-1].create(levelp[1:4])

    thy_save_path = thy_save_fs[-1].path(levelp[1:4])
    thy_run_path = thy_run_fs[-1].path(levelp[1:4])

    ts_save_fs = autofile.fs.transition_state(thy_save_path)
    ts_save_fs[0].create()
    ts_save_path = ts_save_fs[0].path()
    ts_run_fs = autofile.fs.transition_state(thy_run_path)
    ts_run_fs[0].create()
    ts_run_path = ts_run_fs[0].path()

    return ts_run_path, ts_save_path, thy_run_path, thy_save_path