Repository navigation
Apply vector timesteps by system in MD updates - #637
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.
Summary
momentum_stepandposition_stepdocument support for a timestep tensor shaped[n_systems], but multiply that vector directly by[n_atoms,3]quantities. Two systems produce a shape error. With exactly three systems, broadcasting silently applies the timesteps to x, y, and z coordinates instead of to each system. For unit-velocity free particles and dt=[0.1,0.2,0.3], every atom moves by[0.1,0.2,0.3]regardless of system membership.This change maps vector timesteps through
state.system_idxand adds a trailing coordinate axis in both update functions. Each system then advances all coordinates by its own timestep. Scalar timesteps keep the existing path.Regression tests cover two and three systems, with equal and unequal atom counts, zero forces, and unit velocities through the complete NVE step, using a separated-particle, zero-epsilon Lennard-Jones model. Direct momentum-step tests use constant nonzero forces so the momentum mapping is checked independently. Both tests include scalar-timestep controls.
Validation
All checks used Python 3.12.9 on macOS CPU, with the isolated checkout imported through
PYTHONPATHand a temporary Warp cache.python -m pytest tests/test_integrators.py -q: 47 passed, including 16 scalar/vector timestep cases across equal and unequal atom counts.python -m pytest: 1019 passed, 208 skipped, exit 0. Each final run includes all regression additions. Three PyTablesUnclosedFileWarningmessages followed the summary during trajectory-file cleanup.git diff --check: passed.The production change is limited to the timestep mapping in the two core MD updates. The new tests cover NVE and direct momentum propagation; they do not establish vector-timestep support throughout every thermostat or barostat. GPU execution and skipped optional-model tests were not exercised.
The F004 evidence report includes the original reproduction, scalar controls, and independently executed native ASE VelocityVerlet comparisons.
Checklist