Conversation
…oring Previously, if a FlashMD step increased the total energy by more than the post-step kinetic energy could absorb, the rescale factor's discriminant went negative and np.sqrt silently returned NaN, corrupting momenta with no error raised. Both the ASE and i-PI integrators now raise a clear RuntimeError instead. Also expose the rescale factor for monitoring: ASE's VelocityVerlet stores it as `dyn.alpha`, and the i-PI steppers write it to `motion.flashmd_alpha` (nan when rescaling didn't run), which can be registered as a custom property to appear as a column in the .out file. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Clarified the explanation of energy rescaling and error handling in the documentation.
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
VelocityVerlet.step()and the i-PI VV steppers computed the momentum rescale factor asalpha = sqrt(1 - (E_new - E_old) / E_kin)with no guard: if a step's energy increase exceeded the post-step kinetic energy, the discriminant went negative andnp.sqrtsilently returnedNaN, corrupting momenta with no error raised and no test coverage on this path.RuntimeErrorwhen this happens, naming the energy jump and kinetic energy involved.dyn.alphain ASE, andmotion.flashmd_alphain i-PI (nanon any step where rescaling didn't run), which can be registered as a custom i-PI property to get a genuine.outfile column.docs/energy.md, including the i-PI wiring (custom property registration + XML<properties>entry) and theKeyErrorpitfall if only the XML side is edited.Test plan
ruff checkon changed files🤖 Generated with Claude Code