Fix unnecessary last step in `Dynamics.irun`
Checklist
-
I have read the contribution guidelines. -
Unit tests have been added for any new or changed code, and the test suite passes. Note: Your request will likely not be merged without the appropriate tests. -
New features and API Changes are described in doc/releasenotes.rst
. -
"closes #XXXX" is in the body of the MR description to link the related issue, if applicable.
Closes #1339 (closed)
The last yield
in irun
caused unnecessary one more iteration in irun
, as mentioned in the issue above, which is fixed in this MR. Accordingly, the yielded value (is_converged
) is carefully revisited to be an expect value.
Tests for this fix are done in three different places.
-
ase/test/optimize/test_nsteps.py
(in this MR): As stated in this test before, it was questionable to have two more steps than the givensteps
. This MR fixes this, and correspondingly the expected results in test are also modified. -
ase/test/optimize/test_optimizers.py
(in !3071 (merged)): We should guarantee the modifiedirun
returnsTrue
when forces are converged. The test for this is given in MR !3071 (merged). -
ase/test/md/{test_md_logger.py,test_md_logger_interval.py}
(existing): We also need to guarantee the change in this MR does not affect the number of steps dumped inlogfile
andtrajectory
. These are checked already in the existing tests.