Skip to content

Commit

Permalink
minor change in test_neb.py and wq command for Psi4 engine is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
hjnpark committed Oct 4, 2024
1 parent 987a895 commit b4edfb2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion geometric/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ def calc_wq_new(self, coords, dirname):
out_files = [('%s/run.out' % dirname, 'run.out'), ('%s/run.log' % dirname, 'run.log')]
# We will assume that the number of threads on the worker is 1, as this maximizes efficiency
# in the limit of large numbers of jobs, although it may be controlled via environment variables.
queue_up_src_dest(wq, 'psi4 input.dat > run.log 2>&1', in_files, out_files, verbose=False)
queue_up_src_dest(wq, 'psi4 input.dat run.out 2>&1', in_files, out_files, verbose=False)

def number_output(self, dirname, calcNum):
if not os.path.exists(os.path.join(dirname, 'run.out')):
Expand Down
2 changes: 1 addition & 1 deletion geometric/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
datad = addons.datad

@pytest.fixture
def molecule_engine_neb():
def molecule_engine_hcn_neb():
"""Return the Molecule and Engine for an NEB Calculation."""
input_ext = {'psi4': 'psi4in', 'qchem': 'qcin', 'tera': 'tcin'}
def get_molecule_engine(engine: str, images: int):
Expand Down
30 changes: 15 additions & 15 deletions geometric/tests/test_neb.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@
datad = addons.datad
exampled = addons.exampled

def test_hcn_neb_input(localizer, molecule_engine_neb):
def test_hcn_neb_input(localizer, molecule_engine_hcn_neb):
"""
Test lengths of input chains
"""
chain_M = geometric.molecule.Molecule(os.path.join(datad, "hcn_neb_input.xyz"))
nimg = 7

M1, engine = molecule_engine_neb('psi4', nimg)
M1, engine = molecule_engine_hcn_neb('psi4', nimg)

# The number of images can't exceed the maximum number of images in the input chain
M2, engine = molecule_engine_neb('psi4', 9999)
M2, engine = molecule_engine_hcn_neb('psi4', 9999)

assert nimg == len(M1)
assert len(M2) == len(chain_M)


@addons.using_psi4
def test_hcn_neb_optimize_1(localizer, molecule_engine_neb):
def test_hcn_neb_optimize_1(localizer, molecule_engine_hcn_neb):
"""
Optimize a HCN chain without alignment
"""
M, engine = molecule_engine_neb('psi4', 11)
M, engine = molecule_engine_hcn_neb('psi4', 11)

params = geometric.params.NEBParams(**{"optep": True, "align": False, "verbose": 1})
chain = geometric.neb.ElasticBand(
Expand All @@ -52,11 +52,11 @@ def test_hcn_neb_optimize_1(localizer, molecule_engine_neb):


@addons.using_psi4
def test_hcn_neb_optimize_2(localizer, molecule_engine_neb):
def test_hcn_neb_optimize_2(localizer, molecule_engine_hcn_neb):
"""
Optimize a HCN chain with alignment
"""
M, engine = molecule_engine_neb('psi4', 11)
M, engine = molecule_engine_hcn_neb('psi4', 11)

# maxg and avgg are increased here to make them converge faster after the alignment
params = geometric.params.NEBParams(**{"verbose": 1, "maxg": 3.0, "avgg": 2.0})
Expand All @@ -75,11 +75,11 @@ def test_hcn_neb_optimize_2(localizer, molecule_engine_neb):

@addons.using_psi4
@addons.using_bigchem
def test_psi4_bigchem(localizer, molecule_engine_neb):
def test_psi4_bigchem(localizer, molecule_engine_hcn_neb):
"""
Optimize a HCN chain without alignment with BigChem and Psi4
"""
M, engine = molecule_engine_neb('psi4', 11)
M, engine = molecule_engine_hcn_neb('psi4', 11)

params = geometric.params.NEBParams(**{"align": False, "verbose": 1, "bigchem": True})
chain = geometric.neb.ElasticBand(
Expand All @@ -98,11 +98,11 @@ def test_psi4_bigchem(localizer, molecule_engine_neb):

@addons.using_qchem
@addons.using_bigchem
def test_qchem_bigchem(localizer, molecule_engine_neb):
def test_qchem_bigchem(localizer, molecule_engine_hcn_neb):
"""
Optimize a HCN chain without alignment with BigChem and QChem
"""
M, engine = molecule_engine_neb('qchem', 11)
M, engine = molecule_engine_hcn_neb('qchem', 11)

params = geometric.params.NEBParams(**{"align": False, "verbose": 1, "bigchem": True})
chain = geometric.neb.ElasticBand(
Expand All @@ -120,13 +120,13 @@ def test_qchem_bigchem(localizer, molecule_engine_neb):

@addons.using_terachem
@addons.using_bigchem
def test_terachem_bigchem(localizer, molecule_engine_neb):
def test_terachem_bigchem(localizer, molecule_engine_hcn_neb):
"""
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_neb('tera', 11)
M, engine = molecule_engine_hcn_neb('tera', 11)

params = geometric.params.NEBParams(**{"align": False, "verbose": 1, "bigchem": True})
chain = geometric.neb.ElasticBand(
Expand Down Expand Up @@ -159,8 +159,8 @@ def work_queue_cleanup(self):

@addons.using_psi4
@addons.using_workqueue
def test_psi4_work_queue_neb(self, localizer, molecule_engine_neb):
M, engine = molecule_engine_neb('psi4', 11)
def test_psi4_work_queue_neb(self, localizer, molecule_engine_hcn_neb):
M, engine = molecule_engine_hcn_neb('psi4', 11)
params = geometric.params.NEBParams(**{"optep": True, "align": False, "verbose": 1})
chain = geometric.neb.ElasticBand(
M, engine=engine, tmpdir=tempfile.mkdtemp(), params=params, plain=0
Expand Down

0 comments on commit b4edfb2

Please sign in to comment.