Skip to content

Commit 0f9104d

Browse files
committed
fix changes in ase optimizer API
1 parent ff7755f commit 0f9104d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/mattersim/applications/batch_relax.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ def step_batch(self):
122122

123123
opt.step()
124124
opt.nsteps += 1
125-
if opt.converged() or opt.nsteps >= self.max_n_steps:
125+
# Get gradient for convergence check
126+
# Note: gradient = -forces for the optimizable object
127+
gradient = opt.optimizable.get_gradient()
128+
if opt.converged(gradient) or opt.nsteps >= self.max_n_steps:
126129
self.is_active_instance[idx] = False
127130
self.total_converged += 1
128131
if self.total_converged % 100 == 0:

0 commit comments

Comments
 (0)