Skip to content

fix(esolver): sort DeePMD MD neighbors by distance - #8104

Merged
mohanchen merged 6 commits into
deepmodeling:developfrom
19hello:issue8071-fix
Oct 10, 2026
Merged

mohanchen merged 6 commits into
deepmodeling:developfrom
19hello:issue8071-fix

Conversation

@19hello

@19hello 19hello commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Reminder

  • I have read AGENTS.md and docs/developers_guide/agent_governance.md.
  • I have linked the related issue below.
  • I have added a focused unit test for the neighbor sorting logic.
  • I have listed the exact verification commands and results.
  • I have described the user-visible behavior change.
  • I have explained the core-module impact.
  • No governance exception is requested.

Linked Issue

Fixes #8071

Unit Tests and/or Case Tests for my changes

  • Commands run:

    cmake -S . -B build_issue8071 \
      -DENABLE_MPI=ON \
      -DENABLE_LCAO=OFF \
      -DENABLE_OPENMP=OFF \
      -DBUILD_TESTING=ON \
      -DGIT_SUBMODULE=OFF
    
    CCACHE_DISABLE=1 cmake --build build_issue8071 \
      --target MODULE_ESOLVER_esolver_dp_test -j2
    
    OMP_NUM_THREADS=1 ctest --test-dir build_issue8071 -V \
      -R MODULE_ESOLVER_esolver_dp_test
    

The issue reproduction was also run with the provided DeepMD comparison script:

PYTHONPATH=/tmp/issue8071_pydeps
LD_LIBRARY_PATH=/tmp/mpichvenv/lib:/tmp/issue8071_pydeps
TF_INTRA_OP_PARALLELISM_THREADS=1
TF_INTER_OP_PARALLELISM_THREADS=1
OMP_NUM_THREADS=1
python3 compare_issue8071.py . frozen_seed1.pth

  • Result summary:
  • Checks not run, with reason:
    • The CTest executable could not start because of a local BLAS/ScaLAPACK runtime conflict:

      libblas.so.3: undefined symbol: gotoblas

    • The DeePMD-enabled test target reached compilation of the modified production source, but final linking was blocked by the locally installed DeePMD 2.2.11/TensorFlow dependency setup.

What's changed?

  • DeePMD MD neighbor lists are now sorted by the physical distance from the central atom before constructing InputNlist.
  • The sorted neighbor storage remains alive until the DeePMD computation completes.
  • A focused unit test verifies distance ordering and deterministic index ordering for equal distances.
  • This fixes force discrepancies caused by different neighbor ordering between ABACUS and native DeepMD. The neighbor set was already correct, but se_e2_a may truncate the list according to sel, making the order significant.

Governance Notes

  • INPUT/docs changes:
    • None. No INPUT parameter or user-facing input behavior was changed.
  • Core module impact:
    • The change is limited to ESolver_DP, specifically the MDCell-to-DeePMD InputNlist adapter.
    • It does not modify HSolver, ElecState, Hamilt, Operator, or Psi.
    • Generic neighbor-list construction is unchanged.
  • Exceptions requested:
    • None.
  • Scope note:
    • The separate DPA-2/repformers ghost-embedding communication issue is intentionally not addressed in this PR. That issue concerns missing distributed communication metadata such as nswap, sendlist, sendproc, and world, and is independent of the neighbor-ordering bug fixed here.

@mohanchen mohanchen added Bugs Bugs that only solvable with sufficient knowledge of DFT Refactor Refactor ABACUS codes MD & LAM MD and Larege Atomic Models Machine Learning & AI Issues related to AI labels Oct 9, 2026
@mohanchen
mohanchen merged commit f2160f6 into deepmodeling:develop Oct 10, 2026
17 of 18 checks passed
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 Machine Learning & AI Issues related to AI MD & LAM MD and Larege Atomic Models Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] v3.11.0-beta10: esolver_type=dp forces deviate from model predictions (MDCell neighbor-list path)

2 participants