Skip to content

fix(md): reject init_vel when STRU velocities are all zero Fix #7428 - #8396

Open
mohanchen wants to merge 1 commit into
deepmodeling:developfrom
mohanchen:2026-11-25-a
Open

mohanchen wants to merge 1 commit into
deepmodeling:developfrom
mohanchen:2026-11-25-a

Conversation

@mohanchen

Copy link
Copy Markdown
Collaborator

Fix #7428

When init_vel=true but the STRU file carries no velocity information, all atom velocities start at zero. The previous guard only rescaled velocities when the computed initial temperature was positive, so the zero-velocity case silently fell through with md_tfirst kept at its target value. The NHC thermostat then diverged exponentially from rest and aborted with the misleading message "Please set a proper md_tfreq!".

Abort early with a clear message that names the real cause and tells the user to set init_vel=false to use random initial velocities.

Add unit tests covering both MDCell branches (with and without backing UnitCell), the restart exemption, and the normal rescale path.

Reminder

  • I have read AGENTS.md and docs/developers_guide/agent_governance.md.
  • I have linked an issue or explained why this PR does not need one.
  • I have added adequate unit tests and/or case tests, or explained why not.
  • I have listed the exact verification commands run and their results.
  • I have described user-visible behavior changes, including INPUT parameter changes.
  • I have explained core-module impact for ESolver, HSolver, ElecState, Hamilt, Operator, Psi, or other source/ changes.
  • I have requested any needed governance exception below.

Linked Issue

Fix #

Unit Tests and/or Case Tests for my changes

  • Commands run:
  • Result summary:
  • Checks not run, with reason:

What's changed?

  • Example: brief summary of the user-visible or developer-facing change.

Governance Notes

  • INPUT/docs changes:
  • Core module impact:
  • Exceptions requested:

When init_vel=true but the STRU file carries no velocity information,
all atom velocities start at zero. The previous guard only rescaled
velocities when the computed initial temperature was positive, so the
zero-velocity case silently fell through with md_tfirst kept at its
target value. The NHC thermostat then diverged exponentially from rest
and aborted with the misleading message "Please set a proper md_tfreq!".

Abort early with a clear message that names the real cause and tells
the user to set init_vel=false to use random initial velocities.

Add unit tests covering both MDCell branches (with and without backing
UnitCell), the restart exemption, and the normal rescale path.
@mohanchen
mohanchen requested a review from 19hello November 25, 2026 14:37
@mohanchen mohanchen added Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes labels Nov 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

molecular dynamics fail when "Please set a proper md_tfreq"

1 participant