Repository navigation
Stop MD before a non-finite state reaches a frame or a checkpoint - #84
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before: a model that returns NaN or inf during MD can leave damage that outlives the job. In checks on stub calculators:
neb_failed,unresolved, orrelaxation_failed.running.After: the job stops before any of that is saved.
accel, and at constant pressurep_eps,force_eps, andgamma_mod) is NaN or inf.running,newif it has no checkpoint yet, orrefiningwith an empty queue if the fault comes in the first interval after a refinement. The next job repeats from the last checkpoint or starts over. Nothing else is cancelled.There is no option, because a state like that cannot continue, and a healthy run is unchanged.
How:
_require_finiteinrun.py, called at those two places in_run_segment, readsruntime.snapshot(). It evaluates no model and takes 18 microseconds on 288 atoms. It raises outside_fatal, so it does not mark the run failed.run.pyis not in the checkpoint's environment record, so running trajectories resume with no warning. That is 19 added lines inrun.py. A smaller check of only positions, momenta, and cell, plus forces at the start, misses the NaN-stress cases, where the atoms stay finite.Test: one, written before the code, with nine cases: first evaluation, last step of an interval, and inside an interval, each for forces at constant volume, forces at constant pressure, and stress at constant pressure. All nine fail on main. 349 passed, 25 skipped; ruff is clean.
Checked outside the test suite, with real
reactionflow runprocesses and BAOAB MD, on stub calculators unless noted:refine_after_mdon and off: the same results, against those two merged without this.hydrostatic: false: the same result, where main cannot finish 9 of them and keeps a bad frame in the tenth. All-inf stress inside an interval takes about 4.5 minutes to stop, on main too, because SciPy'sexpmspends about 73 s on each such matrix before this check can run (SciPy 1.18.1 on an arm64 Mac).refiningwith an empty queue, and a good GPU gives the control.neb_failedwith exit 0, as on main.refine_after_md: the queue waits through resubmissions, and optionfalsegives the same 23 results before MD stops, as on Refine a trajectory's barriers after its MD when the campaign asks for it #82. The NaN frame those two keep is gone.statusreports the error while the trajectory is stopped, andscanstill matches every recorded event. Neither changes the run.Limits:
You have 0 lattice vectors: volume not defined.run()again on the same Python object after it raises can continue from the wrong atoms, as on main with a model that raises, so the docs now say to reopen the run. The CLI is not affected.docs/how-it-works.mdstill says a trajectory stops only if it cannot save its state, which is already loose on main. Refine a trajectory's barriers after its MD when the campaign asks for it #82 corrects it.Not run: a real MLIP on a GPU. Whether UMA, MACE, AIMNet2, or ANI ever return NaN without raising, or accept NaN positions or a NaN cell, is not known. AIMNet2's preflight refuses non-finite values on a new trajectory (read, not run). ASE 3.28, which
requirements/perlmutter-ani1xnr.txtpins, was not run; its integrator source initializes these arrays the same way as 3.29 (read).Merges with #82 and #83 in every order with no conflicts and the same tree; 356 passed, 25 skipped on the merge.