Skip to content

Refactor MD structure, restart, and thermodynamic output - #8375

Open
19hello wants to merge 17 commits into
deepmodeling:developfrom
19hello:refactor/md-output-parameters
Open

19hello wants to merge 17 commits into
deepmodeling:developfrom
19hello:refactor/md-output-parameters

Conversation

@19hello

@19hello 19hello commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Reminder

  • Read AGENTS.md and docs/developers_guide/agent_governance.md.
  • Documented behavior and INPUT changes.
  • Added focused tests and recorded verification.

Linked Issue

No linked issue; this PR follows the requested MD output redesign.

What's changed

  • Unify ordinary MD structure naming with DFT/relax out_app_flag modes. out_stru=1 writes ABACUS STRU with per-atom forces and velocities; out_stru=2 writes CIF geometry. MD mode 1 overwrites periodic STRU.cif, matching relax CIF behavior. out_freq_ion selects periodic frames; a final structure is always written when out_stru>0. Distributed atoms are sorted by stable identity and duplicate/missing indices are rejected. A legacy OUT.<suffix>/STRU/ directory is handled safely on restart.
  • Separate STRU_restart and Restart_md.txt from ordinary output; md_restartfreq controls checkpoints. Restart STRU retains velocities.
  • Remove MD_dump and its INPUT controls. Update affected Autotest properties, scripts, ASE reader, and MD documentation. ASE now reads STRU/CIF output, aligns restarted MD steps, and reconstructs electronic stress from step-labelled virial.
  • Use MD-only out_thermo_freq (default 1), remove md_thermo_freq, print one-based MD STEP independently of stress, and print full 3x3 virial/total-stress tensors on the thermodynamic cadence. Suppress solver-specific MD force/stress tables while leaving non-MD output unchanged.
  • Keep CANDELA's legacy geo_in_type ABACUS compatibility limitation documented.

Verification

Latest local commit 82b56a2c8:

  • cmake --build build_parallel_md1_current --target abacus_basic_para MODULE_CELL_mdcell_cif_io -j 12 — passed.
  • env OMP_NUM_THREADS=1 ctest --test-dir build_parallel_md1_current -R '^(MODULE_CELL_mdcell_cif_io(_np2)?|MODULE_CELL_NEIGHBOR_mdcell_reader_np4|MODULE_MD_(fire|verlet|nhc|msst|lgv)|04_FF_md_output_cadence)$' --output-on-failure — 9/9 passed. The cadence driver covers CIF modes 0/1/2, independent restart output, and legacy-directory restart.
  • env PYTHONPATH=interfaces/ASE_interface /tmp/abacus-ase-venv/bin/python -m unittest abacuslite.io.latestio — 21/21 passed (ASE installed in a temporary virtual environment).
  • python3 -m unittest tests/integrate/validation_tools/test_props_basic.py — 6/6 passed.
  • bash -n tests/integrate/validation_tools/props_basic.sh; python3 -m py_compile interfaces/ASE_interface/abacuslite/io/latestio.py tests/integrate/validation_tools/check_md_output_cadence.py tests/integrate/validation_tools/test_props_basic.py; git diff --check origin/develop...HEAD — passed.
  • build_parallel_md1_current/abacus_basic_para -h out_stru and --check-input on an MD CIF case — passed. A five-step MD CIF run and a restart from STRU_restart completed locally.
  • python3 tools/03_code_analysis/agent_governance_check.py --base origin/develop --head HEAD --format text — exit 0, warnings only.

Earlier validation covered targeted LCAO, PW, OFDFT, SDFT, FF, and relax Autotest cases. Optional DeePMD/NEP runtime cases were unavailable in this build.

Governance notes

The PR-level global dependency count falls by 5 (11 additions, 16 removals). The new running-log reference in read_input.cpp moves the restart-file confirmation until after the log opens; other added references are migration-neutral moves in existing output functions. mdcell_cif_io.h needs <string> for its public filename/comment parameters and has no cyclic include. New source is listed in source/source_cell/CMakeLists.txt and source/Makefile.Objects; pyabacus has no hardcoded print_cell.cpp/CIF source entry. Generated INPUT reference pages are intentionally not committed. No governance exception is requested.

The previous CI run failed five MD tests that assumed the old log layout; their assertions now check the step label and tensor block. The CUDA run failed scf_out_wf on wavefunction coefficient maxima, outside the modified MD/output paths; no reference was changed. New CI on the pushed commit is pending.

@mohanchen mohanchen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change and it looks good to me.

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The STRU output migration leaves regressions in ASE reading, legacy restart output and final-stress collection. The inline comments identify five defects and three non-blocking improvements.

Static review only; no builds or runtime tests were run.

Comment thread source/source_md/run_md.cpp Resolved
Comment thread source/source_cell/print_cell.cpp Resolved
@mohanchen mohanchen added MD & LAM MD and Larege Atomic Models Refactor Refactor ABACUS codes labels Nov 25, 2026
/// @brief Find the structure file for restarting a molecular dynamics run.
void log_read_file(const std::string& filename)
{
char cwd[PATH_MAX];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's PATH_MAX? Try avoid using global parameter

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

MD & LAM MD and Larege Atomic Models Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants