Trajectory reporter improvements - #599
Open
PascalSalzbrenner wants to merge 3 commits into
Open
Conversation
Collaborator
|
thanks a lot @PascalSalzbrenner! improvements to trajectory reporting are much needed and appreciated! |
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.
Summary
In batch optimize runs, I found I was getting a large number of
inconsistent trajectorywarnings, alongside messages that arrays would be truncated. Digging into this surfaced a few behaviours which I think could act more consistently, alongside a bug. This PR addresses this:inconsistent trajectorymessages triggered when any property array did not end on the same step as the positions array. But this is frequently the case whenstate_frequencyandprop_frequencydiffer, and should therefore arguably be a legitimate case. Resuming from thepositionsarray prevented this if it trailed (considerpositionswritten every 20 steps, and potential energy written every 10: a stop at step 110 would seepositionsat 100, and potential energy at 110). The change in the PR now resumes from the largest step across all arrays instead: writing strictly beyond it satisfies the per-array monotonicity that is the storage layer's only invariant, whatever cadence each array uses. Theinconsistent last stepswarning has been dropped fromTorchSimTrajectory.__init__, because it has no true-positive case reachable through the runners now.truncate_to_stepin__init__was a no-op because the only caller passed itself.last_step, so theif self.last_step == step: returnalways triggered. I repaired it so its early return tests every array rather thanpositionsalong. It is no longer called in__init__, but available & used as an explicit recovery tool for callers reconstructing state from a trajectory.forcetoTrajectoryReporter.reportto bypass the frequency gates, skipping any array already at or beyond the step so a run ending on-grid is not double-written.optimizepops converged systems out of the batch mid-run and immediately repoints the reporter at the remainder, so each system's final frame is written at the moment it converges, through the handles still open for its batch. A single write beforefinish()would miss every system that converged earlier. Note that trajectories that previously ended off-grid gain one frame, so consumers inferring a time axis from frame order rather than the recorded steps will see a shorter final interval.Checklist
Before a pull request can be merged, the following items must be checked: