Repository navigation
Refine a trajectory's barriers after its MD when the campaign asks for it - #82
Merged
Merged
Conversation
…eturns NaN A lost GPU can end an event as saddle_unchecked or stepwise, and a model returning NaN as relaxation_failed, so checking only after a failed status let the next event fail too or let the whole queue finish with no results. Also keep the failure that stopped MD when a later one follows.
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 trajectory stops MD at each confirmed reaction, refines it, and then continues, and nothing turns that off. A slow refinement holds up its trajectory's MD. In the 288-atom acetonitrile T-P series, one event held a trajectory for 12.7 hours and another trajectory made about 3 ps of MD in 17 hours. Running MD alone later took a subclass that overrides private methods.
After: with
"refine_after_md": trueat the top of a campaign, MD runs straight through tototal_stepsin one segment. Confirmed reactions wait in the queuestate.jsonalready keeps, and the same process refines them when MD ends, in the order MD found them. A job that ends partway resumes as usual. With the option off, results are unchanged.The key is not part of the trajectory contract, so trajectories already running keep their hash and can resume, and it can change on resubmission. A trajectory already paused for refinement finishes that refinement first.
statusneeds no change: the phase isrunningwitheventscounting up during MD, thenrefining.A queue can hold many events and results are never overwritten, so three failures are handled:
falseand resubmit: the queue is refined before MD is touched, and MD then stops as it did.Three small changes also reach the option-off path. A run marked failed with reactions still queued refines them on resubmission, where main raises at once. An event with no barrier and more events queued runs the model check before going on, which costs one model load and one evaluation and changes no result unless the model is gone. And that check refuses a model giving NaN forces, where main publishes every event left in that queue first and stops only if MD resumes.
How:
_observeenters therefiningphase only when the option is off or at MD's last step, and_checkpointsaves that phase together with that step._refine_duedecides whether the queue runs now: it waits only in therunningphase with the option on. The existing model check on resume, moved into_check_model, still comes before any result is published. That is about 45 changed lines inrun.py, plus the campaign key and one line incli.py.Tests: two, written before the code. One runs a campaign through to completion (one segment, MD's lease closed before refinement). The other interrupts during MD and before refinement (queue kept, each event refined once, model checked once, MD not repeated). 342 passed, 25 skipped; ruff is clean.
Checked outside the test suite, with real
reactionflow runprocesses and BAOAB MD, where "main" is the commit before #84:failedand 10 queued, another job on the bad GPU loses nothing more, and a job on a good one finishes with those 10 equal to main's.TorchModelAdapterover a stub torch. Each model check costs one evaluation, measured at constant volume and constant pressure.falsegives main's 23 results before MD stops as before.reactions.sqlite3locked past its timeout during an observation, with no code patched: main keeps 5 results and fails, and here the resubmission gives those same 5 and reports the failure. A failed publish during the drain: all 11 results equal main's. A second failure during the drain leaves the first instate.jsonandstatus, and goes to that job's log andlast-error.json.Not run: a real MLIP on a GPU. The lost GPU above is simulated, and a real one may hang or kill the process instead of raising; a killed process keeps the queue. Whether GPU memory is freed when MD's lease closes has not been measured. Calculators stay alive until garbage collection on main too.
Limits: the model check is one evaluation, so a fault that comes and goes can pass it and fail events across the queue. With one evaluation in 50 raising, 9 of 11 events ended
failedand the job exited 0, where main stops at its next MD failure. The saved runs show no such fault: none of their 94 distinct results isfailed. And a calculator that cannot evaluate the last checkpoint when freshly loaded, as an SCF without its restart guess might, fails the check and holds the queue with no way through. Simulated, with MD ending at such a checkpoint: exit 1 after 2 of 24 results, where main finishes all 24. A stateless model cannot reach this, because MD already evaluated that geometry.docs/exact-restart.mdlimits the generic adapter to stateless inference, thoughexamples/xtbruns tblite through it; tblite was not run.#84, now merged, stops MD before NaN or inf from the model can leave a bad frame or a checkpoint no later job can use. This merged with it: 351 passed, 25 skipped; ruff is clean.
Refinement stays serial, so a long queue keeps the job busy after MD ends. Merges with #83 in either order with no conflicts.