Skip to content

Commit fa89458

Browse files
committed
Switch all tests to ase LangevinBOAB, and fix missing gpu_id_queue when not running in pool. Also, workaround opt.converged ASE issue 1744
1 parent 41bd2be commit fa89458

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

tests/test_md.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
from wfl.generate.md.abort import AbortOnCollision, AbortOnLowEnergy
2121

2222
try:
23-
from wif.Langevin_BAOAB import Langevin_BAOAB
23+
from ase.md.LangevinBAOAB import LangevinBAOAB
2424
except ImportError:
25-
Langevin_BAOAB = None
25+
LangevinBAOAB = None
2626

2727
def select_every_10_steps_for_tests_during(at):
2828
return at.info.get("MD_step", 1) % 10 == 0
@@ -153,14 +153,14 @@ def test_NPT_Berendsen(cu_slab):
153153
assert np.allclose(atoms_traj[0].cell, atoms_traj[-1].cell * cell_f)
154154

155155

156-
@pytest.mark.skipif(Langevin_BAOAB is None, reason="No Langevin_BAOAB available")
157-
def test_NPT_Langevin_BAOAB(cu_slab):
156+
@pytest.mark.skipif(LangevinBAOAB is None, reason="No LangevinBAOAB available")
157+
def test_NPT_LangevinBAOAB(cu_slab):
158158
calc = EMT()
159159

160160
inputs = ConfigSet(cu_slab)
161161
outputs = OutputSpec()
162162

163-
atoms_traj = md.md(inputs, outputs, calculator=calc, integrator="Langevin_BAOAB", steps=300, dt=1.0,
163+
atoms_traj = md.md(inputs, outputs, calculator=calc, integrator="LangevinBAOAB", steps=300, dt=1.0,
164164
temperature=500.0, temperature_tau=100/fs, pressure=0.0,
165165
rng=np.random.default_rng(1))
166166

@@ -176,14 +176,14 @@ def test_NPT_Langevin_BAOAB(cu_slab):
176176
assert np.allclose(atoms_traj[0].cell, atoms_traj[-1].cell * cell_f)
177177

178178

179-
@pytest.mark.skipif(Langevin_BAOAB is None, reason="No Langevin_BAOAB available")
180-
def test_NPT_Langevin_BAOAB_hydro_F(cu_slab):
179+
@pytest.mark.skipif(LangevinBAOAB is None, reason="No LangevinBAOAB available")
180+
def test_NPT_LangevinBAOAB_hydro_F(cu_slab):
181181
calc = EMT()
182182

183183
inputs = ConfigSet(cu_slab)
184184
outputs = OutputSpec()
185185

186-
atoms_traj = md.md(inputs, outputs, calculator=calc, integrator="Langevin_BAOAB", steps=300, dt=1.0,
186+
atoms_traj = md.md(inputs, outputs, calculator=calc, integrator="LangevinBAOAB", steps=300, dt=1.0,
187187
temperature=500.0, temperature_tau=100/fs, pressure=0.0, hydrostatic=False,
188188
rng=np.random.default_rng(1))
189189

wfl/autoparallelize/pool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def do_in_pool(num_python_subprocesses=None, num_inputs_per_python_subprocess=1,
205205
# unpickle to better reproduce the behavior of Pool.map() ?
206206
for items_inputs_group in items_inputs:
207207
result_group = _wrapped_autopara_wrappable(op, iterable_arg, inherited_per_item_info, args,
208-
kwargs, items_inputs_group)
208+
kwargs, None, items_inputs_group)
209209

210210
if outputspec is not None:
211211
for at, from_input_loc in result_group:

wfl/generate/optimize.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ def process_step():
182182
# set for first config, to be overwritten if it's also last config
183183
traj[0].info['optimize_config_type'] = 'optimize_initial'
184184

185-
if opt.converged():
185+
# as of 3.26 converged() requires a gradient, but for PreconLBFGS it's not used
186+
# See https://gitlab.com/ase/ase/-/issues/1744
187+
if opt.converged(None):
186188
final_status = 'converged'
187189

188190
traj[-1].info['optimize_config_type'] = f'optimize_last_{final_status}'

0 commit comments

Comments
 (0)