Skip to content

Commit 37499b2

Browse files
committed
Back to opt.converged(None) for wfl.generate.optimize, since PreconLBFGS supports that but doesn't fully support irun
1 parent 8946a61 commit 37499b2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

wfl/generate/optimize.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,9 @@ def process_step():
159159

160160
# preliminary value
161161
final_status = 'unconverged'
162-
is_converged = False
163162

164163
try:
165-
for is_converged in opt.irun(fmax=fmax, smax=smax, steps=steps):
166-
pass
164+
opt.run(fmax=fmax, smax=smax, steps=steps)
167165
except Exception as exc:
168166
# label actual failed optimizations
169167
# when this happens, the atomic config somehow ends up with a 6-vector stress, which can't be
@@ -186,8 +184,9 @@ def process_step():
186184

187185
# as of 3.26 converged() requires a gradient, but for PreconLBFGS it's not used
188186
# See https://gitlab.com/ase/ase/-/issues/1744
189-
# use Optimizer.irun instead, since it returns converged status
190-
if is_converged:
187+
# would like to use Optimizer.irun instead, since it returns converged status, but
188+
# not supported for PreconLBFGS
189+
if opt.converged(None):
191190
final_status = 'converged'
192191

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

0 commit comments

Comments
 (0)