Skip to content

test(md): consolidate source_md unit tests and restore serial coverage - #8322

Merged
mohanchen merged 16 commits into
deepmodeling:developfrom
19hello:refactor/source-md-tests
Nov 19, 2026
Merged

mohanchen merged 16 commits into
deepmodeling:developfrom
19hello:refactor/source-md-tests

Conversation

@19hello

@19hello 19hello commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Reminder

  • I have read AGENTS.md and docs/developers_guide/agent_governance.md.
  • I have linked an issue.
  • I have added or preserved focused unit tests.
  • I have listed the verification commands and results.
  • I have described user-visible behavior and core-module impact.
  • I have stated whether a governance exception is needed.

Linked Issue

Fixes #8298

What's changed?

  • Consolidate source_md tests under unittests/, merging the md_base and md_func suites and adding a dedicated MODULE_MD_base target.
  • Enable serial-compatible MD tests without MPI while retaining MPI-specific targets.
  • Consolidate module_neighlist tests under its unittests/ directory; preserve serial, MPI, and CUDA target conditions.
  • Move force-field pressure-correction assertions to ESolver ownership; keep MD LJ potential and MDCell/UnitCell assertions in MD.
  • Name the four force-field wrapper source/header files and matching tests dp_forcefield, lj_forcefield, nep_forcefield, and snap_forcefield. Existing C++ class names and runtime algorithms are unchanged.
  • Keep the local nep_forcefield.h separate from the NEP backend's nep.h, fixing compilation with NEP_DIR enabled.
  • Give the missing-restart death test a unique empty directory under testing::TempDir().
  • Remove unused md_statistics.h and obsolete test files/directories.

Verification

  • cmake -S . -B /tmp/abacus-md-serial -DNEP_DIR=/tmp/abacus-nep-cpu-8322/install — passed. This existing serial test build uses ENABLE_MPI=OFF, ENABLE_LCAO=OFF, and BUILD_TESTING=ON; NEP_CPU was built from the toolchain-pinned commit 629ec5d.
  • cmake --build /tmp/abacus-md-serial --target md MODULE_MD_nep_forcefield -j8 — passed with NEP enabled.
  • cmake --build /tmp/abacus-md-serial --target MODULE_MD_dp_forcefield MODULE_MD_lj_forcefield MODULE_MD_snap_forcefield MODULE_MD_func -j8 — passed.
  • env OMP_NUM_THREADS=1 LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/openblas-pthread:$LD_LIBRARY_PATH ctest --test-dir /tmp/abacus-md-serial --output-on-failure -R '^MODULE_MD|^MODULE_ESOLVER_forcefields$|^MODULE_CELL_NEIGHBOR_domain_decomposition_serial$' — 18/18 passed, including the enabled NEP test.
  • env OMP_NUM_THREADS=1 LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/openblas-pthread:$LD_LIBRARY_PATH ctest --test-dir /tmp/abacus-md-serial --output-on-failure -j4 -R '^MODULE_MD_(nep|dp|lj|snap)_forcefield$|^MODULE_MD_func$|^MODULE_MD_fire$' — 6/6 passed with concurrent MD_func and FIRE tests.
  • cmake --build build_parallel_md1_current --target md esolver MODULE_MD_lj_forcefield_mpi -j8 — passed.
  • env OMP_NUM_THREADS=1 LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/openblas-pthread:$LD_LIBRARY_PATH ctest --test-dir build_parallel_md1_current --output-on-failure -R '^MODULE_MD_lj_forcefield_mpi' — 2/2 passed outside the restricted sandbox.
  • After the Cell directory move: ctest --test-dir /tmp/abacus-md-serial --output-on-failure -R '^MODULE_CELL_NEIGHBOR_domain_decomposition_serial$' — 1/1 passed.
  • After the Cell directory move: env OMP_NUM_THREADS=1 LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/openblas-pthread:$LD_LIBRARY_PATH ctest --test-dir build_parallel_md1_current --output-on-failure -R '^MODULE_CELL_NEIGHBOR_(neighbor_search|bin_manager|allocator_and_list|page_allocator|mdcell_migrate_mpi|domain_decomposition_np[14]|mdcell_reader_np4)$' — 8/8 passed outside the restricted sandbox.
  • python3 tools/03_code_analysis/agent_governance_check.py --base origin/develop --head HEAD --format text and git diff --check origin/develop...HEAD — both exit 0.

Governance Notes

  • INPUT/docs changes: None. The changes are internal test organization and wrapper filenames; user-facing INPUT behavior is unchanged.
  • Core-module impact: ESolver factory includes the renamed wrappers and gains a focused force-field test; Cell owns its neighbor-list tests. No ESolver or Cell production algorithm changes.
  • Header dependency warning: lj_test_solver.h must include lj_forcefield.h because its inline helper constructs a ModuleMD::LJ object, which requires the complete type.
  • Existing global dependencies: this refactor does not add cross-layer global access.
  • Exceptions requested: None.

@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.

Two issues remain: the NEP header rename breaks the enabled-backend include path, and the moved missing-restart test shares a directory with restart writers. Static review only; no build or runtime tests were executed, and author-reported results were not independently verified.

Non-blocking: Please consolidate the repeated verification/change sections and restore the two truncated Cell CTest commands. Their regex quotes and code spans currently run into later sections, so the selections cannot be copied or checked against the reported pass counts.

Comment thread source/source_md/module_nep/nep.cpp Resolved
@mohanchen mohanchen added MD & LAM MD and Larege Atomic Models Tests/Examples Issues/PR related to unit tests and integrate tests labels Nov 17, 2026
@mohanchen mohanchen added the Refactor Refactor ABACUS codes label Nov 19, 2026
@mohanchen
mohanchen merged commit 31ccd90 into deepmodeling:develop Nov 19, 2026
20 checks passed
mohanchen pushed a commit to mohanchen/abacus-mc that referenced this pull request Nov 19, 2026
… 2026-11-05-a

Conflicts resolved:
- source/source_io/CMakeLists.txt: merged both sides' object lists, keeping
  parse_args.cpp + upstream's new parse_command_line.cpp + local libxc_r_suffix.cpp
- source/source_md/unittests/test_run_md.cpp: kept upstream's consolidate
  (deepmodeling#8322) RunMDTest/RunMDCadenceTest suite and appended local RunMdFinalStepTest
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 Tests/Examples Issues/PR related to unit tests and integrate tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Title: test(md): consolidate source _md unit tests into a one-file-per-source layout

3 participants