Skip to content

Commit

Permalink
Terachem reqxyz is false when NEB, version in conf.py updated, author…
Browse files Browse the repository at this point in the history
… info updated
  • Loading branch information
hjnpark committed Nov 22, 2024
1 parent b8a17f1 commit aabe41d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions geometric/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def set_tcenv():
os.environ['PATH'] = os.path.join(TCHome,'bin')+":"+os.environ['PATH']
os.environ['LD_LIBRARY_PATH'] = os.path.join(TCHome,'lib')+":"+os.environ['LD_LIBRARY_PATH']

def load_tcin(f_tcin):
def load_tcin(f_tcin, reqxyz=True):
tcdef = OrderedDict()
tcdef['convthre'] = "3.0e-6"
tcdef['threall'] = "1.0e-13"
Expand All @@ -183,7 +183,7 @@ def load_tcin(f_tcin):
# tcdef['dftgrid'] = "1"
# tcdef['precision'] = "mixed"
# tcdef['threspdp'] = "1.0e-8"
tcin = edit_tcin(fin=f_tcin, options={'run':'gradient', 'keep_scr':'yes', 'scrdir':'scr'}, defaults=tcdef)
tcin = edit_tcin(fin=f_tcin, reqxyz=reqxyz, options={'run':'gradient', 'keep_scr':'yes', 'scrdir':'scr'}, defaults=tcdef)
return tcin

#====================================#
Expand Down
9 changes: 6 additions & 3 deletions geometric/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def get_molecule_engine(**kwargs):
if engine_str == 'tera':
logger.info("TeraChem engine selected. Expecting TeraChem input for gradient calculation.\n")
set_tcenv()
tcin = load_tcin(inputf)
tcin = load_tcin(inputf, reqxyz=not NEB)
# The QM-MM interface is designed on the following ideas:
# 1) We are only optimizing the QM portion of the system
# (until we implement fast inversion of G matrices and Hessians)
Expand Down Expand Up @@ -206,6 +206,8 @@ def get_molecule_engine(**kwargs):
M.build_topology()
elif pdb is not None:
M = Molecule(pdb, radii=radii, fragment=frag)
elif NEB:
M = Molecule(kwargs.get('chain_coords'))
else:
if not os.path.exists(tcin['coordinates']):
raise RuntimeError("TeraChem coordinate file does not exist")
Expand Down Expand Up @@ -378,8 +380,9 @@ def get_molecule_engine(**kwargs):

if NEB:
logger.info("\nNudged Elastic Band calculation will be performed.\n")
chain_coord = kwargs.get('chain_coords', None)
M.load_frames(chain_coord)
if engine_str != 'tera':
chain_coord = kwargs.get('chain_coords', None)
M.load_frames(chain_coord)
images = kwargs.get('images', 11)
if images > len(M):
# HP 5/3/2023 : We can interpolate here if len(M) == 2.
Expand Down
9 changes: 0 additions & 9 deletions geometric/tests/test_neb.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ def test_tera_hcn_neb_optimize(localizer, molecule_engine_hcn):
"""
NEB with TeraChem
"""
shutil.copy2(os.path.join(datad, 'hcn_neb_input.xyz'), os.path.join(os.getcwd(), 'hcn_neb_input.xyz'))

M, engine = molecule_engine_hcn('tera', 11)

params = geometric.params.NEBParams(**{"optep": False, "align": False})
Expand Down Expand Up @@ -166,17 +164,13 @@ def test_terachem_bigchem(localizer, molecule_engine_hcn):
"""
Optimize a HCN chain without alignment with BigChem and TeraChem
"""
shutil.copy2(os.path.join(datad, 'hcn_neb_input.xyz'), os.path.join(os.getcwd(), 'hcn_neb_input.xyz'))

M, engine = molecule_engine_hcn('tera', 11)

params = geometric.params.NEBParams(**{"align": False, "verbose": 1, "bigchem": True})
chain = geometric.neb.ElasticBand(
M, engine=engine, tmpdir=tempfile.mkdtemp(), params=params, plain=0
)

os.remove('hcn_neb_input.xyz')

assert chain.coordtype == "cart"

final_chain, optCycle = geometric.neb.OptimizeChain(chain, engine, params)
Expand Down Expand Up @@ -296,9 +290,6 @@ def work_queue_cleanup(self):
@addons.using_terachem
@addons.using_workqueue
def test_terachem_work_queue_neb(self, localizer, molecule_engine_hcn):

shutil.copy2(os.path.join(datad, 'hcn_neb_input.xyz'), os.path.join(os.getcwd(), 'hcn_neb_input.xyz'))

M, engine = molecule_engine_hcn('tera', 11)
params = geometric.params.NEBParams(**{"optep": False, "align": False, "verbose": 1})
chain = geometric.neb.ElasticBand(
Expand Down

0 comments on commit aabe41d

Please sign in to comment.