Skip to content
Merged

Dev #605

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 59 additions & 64 deletions pixi.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ autoio = { path = "../autoio", editable = true }
autofile = { path = "../autofile", editable = true }
mechanalyzer = { path = "../mechanalyzer", editable = true }

[tool.pixi.feature.dev.pypi-options.dependency-overrides]
autochem = { path = "../autochem", editable = true }
autoio = { path = "../autoio", editable = true }
autofile = { path = "../autofile", editable = true }
mechanalyzer = { path = "../mechanalyzer", editable = true }
# [tool.pixi.feature.dev.pypi-options.dependency-overrides]
# autochem = { path = "../autochem", editable = true }
# autoio = { path = "../autoio", editable = true }
# autofile = { path = "../autofile", editable = true }
# mechanalyzer = { path = "../mechanalyzer", editable = true }

[tool.pixi.system-requirements]
linux = "3.10"
Expand Down
6 changes: 5 additions & 1 deletion src/mechdriver/drivers/ktpdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ def run(pes_rlst, pes_grp_dct,
run_fit_tsk = parser.run.extract_task('run_fits', ktp_tsk_lst)

# Group the PESs into lists
pes_grps_rlst = parser.rlst.pes_groups(pes_rlst, pes_grp_dct)
if pes_rlst is None:
print('No channels requested by user, check input.')
pes_grps_rlst = []
else:
pes_grps_rlst = parser.rlst.pes_groups(pes_rlst, pes_grp_dct)

# --------------------------------------- #
# LOOP OVER ALL OF THE SUBPES in PES_RLST #
Expand Down
4 changes: 1 addition & 3 deletions src/mechlib/amech_io/parser/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,11 @@ def _format_lvl(lvl_val):
""" format weird energy calls
"""
if isinstance(lvl_val, str):
lvl_val = lvl_val.replace(',','*').split('*')
lvl_val = lvl_val.replace(',','*').replace(' ','').split('*')
if len(lvl_val) > 1:
val_inf = (float(lvl_val[0]), tinfo.from_dct(thy_dct.get(lvl_val[1])))
else:
val_inf = (1.00, tinfo.from_dct(thy_dct.get(lvl_val[0])))

return val_inf

new_dct2 = {}
Expand All @@ -180,7 +179,6 @@ def _format_lvl(lvl_val):
_new_dct[key2] = val2

new_dct2[key1] = _new_dct

return new_dct2


Expand Down
52 changes: 36 additions & 16 deletions src/mechlib/filesys/mincnf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@


def min_energy_conformer_locators(
cnf_save_fs, mod_thy_info, hbond_cutoffs=None, nprocs=1):
cnf_save_fs, mod_thy_info, hbond_cutoffs=None, nprocs=1,
print_level=1):
""" Obtain the (ring-id, tors-id) filesystem locator pair and
path for the conformer of a species with the lowest energy
for the specified electronic structure method that currently
Expand All @@ -37,7 +38,8 @@ def min_energy_conformer_locators(

locs, paths = conformer_locators(
cnf_save_fs, mod_thy_info,
cnf_range='min', hbond_cutoffs=hbond_cutoffs, nprocs=nprocs)
cnf_range='min', hbond_cutoffs=hbond_cutoffs, nprocs=nprocs,
print_level=print_level)
if locs and paths:
ret = locs[0], paths[0]
else:
Expand All @@ -48,7 +50,7 @@ def min_energy_conformer_locators(

def conformer_locators(
cnf_save_fs, mod_thy_info,
cnf_range='min', sort_info_lst=None, print_enes=False,
cnf_range='min', sort_info_lst=None, print_level=1,
hbond_cutoffs=None, nprocs=1):
""" Obtain the (ring-id, tors-id) filesystem locator pair and
path for all conformers meeting
Expand Down Expand Up @@ -79,7 +81,7 @@ def _conformer_locators(
cnf_save_fs, mod_thy_info, cnf_range='min',
only_hbnds=True, only_nonhbnds=True,
freq_info=None, sp_info=None, sort_prop_dct=None,
print_enes=False, already_counted_locs_lst=(), hbond_cutoffs=None,
print_level=1, already_counted_locs_lst=(), hbond_cutoffs=None,
nprocs=1):

fin_locs_lst, fin_paths_lst = (), ()
Expand Down Expand Up @@ -117,7 +119,7 @@ def _conformer_locators(
for idx, locs in enumerate(fin_locs_lst):
fin_paths_lst += (cnf_save_fs[-1].path(locs),)

if print_enes:
if print_level == 2:
header = '\nConformer Ordering'
if only_hbnds:
header += ' for only hydrogen bonded conformers'
Expand All @@ -136,7 +138,7 @@ def _conformer_locators(
mark = ''
print(f'{locs[0]:<16}{locs[1]:<16}{_ene:<6.2f}{mark:<3}')
print()
else:
elif print_level > 0:
print(f'No conformers located in {cnf_save_fs[0].path()}')

return fin_locs_lst, fin_paths_lst
Expand All @@ -154,7 +156,7 @@ def _conformer_locators(
only_hbnds=True, only_nonhbnds=False,
freq_info=freq_info, sp_info=sp_info,
sort_prop_dct=sort_prop_dct,
print_enes=print_enes,
print_level=print_level,
already_counted_locs_lst=union_locs_lst,
hbond_cutoffs=hbond_cutoffs,
nprocs=nprocs)
Expand All @@ -166,7 +168,7 @@ def _conformer_locators(
only_hbnds=False, only_nonhbnds=True,
freq_info=freq_info, sp_info=sp_info,
sort_prop_dct=sort_prop_dct,
print_enes=print_enes,
print_level=print_level,
already_counted_locs_lst=union_locs_lst,
hbond_cutoffs=hbond_cutoffs,
nprocs=nprocs)
Expand All @@ -179,7 +181,7 @@ def _conformer_locators(
only_hbnds=False, only_nonhbnds=False,
freq_info=freq_info, sp_info=sp_info,
sort_prop_dct=sort_prop_dct,
print_enes=print_enes,
print_level=print_level,
already_counted_locs_lst=union_locs_lst,
hbond_cutoffs=hbond_cutoffs,
nprocs=nprocs)
Expand Down Expand Up @@ -455,7 +457,8 @@ def traj_sort(save_fs, mod_thy_info, rid=None):

locs_lst = save_fs[-1].existing()
if locs_lst:
# Update the trajectory file in the CONFS/rid level for rings
# Update the trajectory file in the CONFS/conf.t.xyz level for
# lowest torsional configurations of all puckering configurations
enes = []
for locs in locs_lst:
cnf_path = save_fs[-1].path(locs)
Expand All @@ -464,17 +467,24 @@ def traj_sort(save_fs, mod_thy_info, rid=None):
sp_fs[-1].file.energy.read(mod_thy_info[1:4]))
geos = [save_fs[-1].file.geometry.read(locs)
for locs in locs_lst]
traj = []
traj_sort_data = sorted(zip(enes, geos, locs_lst), key=lambda x: x[0])
traj = []
used_rids = []
for ene, geo, locs in traj_sort_data:
comment = f'energy: {ene:<15.10f} \t {locs[0]}'
trid, _ = locs
if trid in used_rids:
continue
used_rids.append(trid)
comment = f'energy: {ene:<15.10f} \t {trid}'
traj.append((geo, comment))
traj_path = save_fs[0].file.trajectory.path()

print(f"Updating ring-torsion trajectory file at {traj_path}")
save_fs[0].file.trajectory.write(traj)

if rid is not None:
# Update the trajectory file in the CONFS/rid/conf.t.xyz for the
# torsional configurations of a puckering configuration
locs_lst = save_fs[-1].existing()
if locs_lst:
enes, geos = [], []
Expand Down Expand Up @@ -899,10 +909,10 @@ def fs_confs_dict(cnf_save_fs, cnf_save_locs_lst,
if saddle:
dist_tol = 0.25
for ini_locs in ini_cnf_save_locs_lst:

match_dct[tuple(ini_locs)] = None
# Loop over structs in cnf_save, see if they match the current struct
# inigeo = ini_cnf_save_fs[-1].file.geometry.read(ini_locs)
##
inigeos = [ini_cnf_save_fs[-1].file.geometry.read(ini_locs)]
# inizma = automol.geom.zmatrix(inigeo)
# inizma = ini_cnf_save_fs[-1].file.zmatrix.read(ini_locs)
ini_cnf_save_path = ini_cnf_save_fs[-1].path(ini_locs)
Expand All @@ -913,14 +923,18 @@ def fs_confs_dict(cnf_save_fs, cnf_save_locs_lst,
dtt = automol.zmat.conversion_info(inizmas[0])
for sym_locs in ini_sym_fs[-1].existing():
geo = ini_sym_fs[-1].file.geometry.read(sym_locs)
##
inigeos.append(geo)
geo_wdummy = automol.geom.apply_zmatrix_conversion(geo, dtt)
try:
inizmas.append(automol.zmat.from_geometry(inizmas[0], geo_wdummy))
except:
print('some structures have a different zmatrix')
for inizma in inizmas:
for idx, inizma in enumerate(inizmas):
for locs in cnf_save_locs_lst:
# geo = cnf_save_fs[-1].file.geometry.read(locs)
print('checking against run', cnf_save_fs[-1].path(locs))
##
geo = cnf_save_fs[-1].file.geometry.read(locs)
# zma = automol.geom.zmatrix(geo)
zma_save_fs = autofile.fs.zmatrix(cnf_save_fs[-1].path(locs))
zma = zma_save_fs[-1].file.zmatrix.read((0,))
Expand All @@ -932,6 +946,12 @@ def fs_confs_dict(cnf_save_fs, cnf_save_locs_lst,
# f'- Similar structure found at {cnf_save_path}')
match_dct[tuple(ini_locs)] = tuple(locs)
break
_, sym_idx = automol.geom.is_unique(
geo, [inigeos[idx]], check_dct={'coulomb': 1e-2})
if sym_idx is not None:
print(' - Structure is not symmetrically unique.')
match_dct[tuple(ini_locs)] = tuple(locs)

else:
sym_fs = autofile.fs.symmetry(cnf_save_fs[-1].path(locs))
dtt = automol.zmat.conversion_info(zma)
Expand Down
2 changes: 1 addition & 1 deletion src/mechlib/filesys/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def get_spc_locs_lst(
hbond_cutoffs = spc_dct_i['hbond_cutoffs']
min_locs_lst, _ = conformer_locators(
cnf_save_fs, levelp, cnf_range=cnf_range,
sort_info_lst=mod_info_lst, print_enes=True,
sort_info_lst=mod_info_lst, print_level=2,
hbond_cutoffs=hbond_cutoffs, nprocs=nprocs)
for min_locs in min_locs_lst:
cnf_run_fs[-1].create(min_locs)
Expand Down
12 changes: 5 additions & 7 deletions src/mechlib/filesys/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,16 +362,14 @@ def instability_transformation(spc_dct, spc_name, thy_info, save_prefix,

# Check if any locs exist first?
# hbond_cutoffs = spc_dct[spc_name]['hbond_cutoffs']
#ini_loc_info = min_energy_conformer_locators(
# ini_loc_info = min_energy_conformer_locators(
# cnf_save_fs, mod_thy_info, hbond_cutoffs=hbond_cutoffs, nprocs=nprocs)
ini_loc_lst = cnf_save_fs[-1].existing()
if len(ini_loc_lst) > 0:
min_cnf_path = cnf_save_fs[-1].path(ini_loc_lst[0])

else:
min_cnf_path = None
if len(ini_loc_lst) < 1:
return None, None

min_cnf_path = cnf_save_fs[-1].path(ini_loc_lst[0])
zma_save_fs = autofile.fs.zmatrix(min_cnf_path)

# Check if the instability files exist
if zma_save_fs[-1].file.instability.exists(zma_locs):
instab_trans = zma_save_fs[-1].file.instability.read(zma_locs)
Expand Down
2 changes: 0 additions & 2 deletions src/mechlib/filesys/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ def read_zma_from_geo(init_zma, geo):
"""
zma = None
if init_zma is not None:
print('Resetting ZMA coords using opt geoms...')
zma = rebuild_zma_from_opt_geo(init_zma, geo)
return zma

Expand Down Expand Up @@ -405,7 +404,6 @@ def _save_zmatrix(ret, zma_fs, zma_locs, init_zma=None):
inf_obj, inp_str, out_str, prog, _ = _unpack_ret(ret)
zma = None
if init_zma is not None:
print('using opt geo fro zma')
geo = elstruct.reader.opt_geometry(prog, out_str)
zma = read_zma_from_geo(init_zma, geo)
if zma is None:
Expand Down
Loading
Loading