Skip to content

fix(dprc): count local atoms in qm-only maps#5843

Open
njzjz-bot wants to merge 2 commits into
deepmodeling:masterfrom
njzjz-bot:fix/dprc-single-fragment-pairwise-maps-5649
Open

fix(dprc): count local atoms in qm-only maps#5843
njzjz-bot wants to merge 2 commits into
deepmodeling:masterfrom
njzjz-bot:fix/dprc-single-fragment-pairwise-maps-5649

Conversation

@njzjz-bot

@njzjz-bot njzjz-bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • count local QM atoms before iterating over MM fragments
  • preserve correct QM and QM/MM atom metadata when a frame contains only one non-placeholder fragment
  • add direct C++ coverage for a QM fragment with local atoms, ghosts, and -1 placeholders
  • add mixed-frame TensorFlow coverage for local padding, ghost offsets, QMMM row omission, and frame indices

Why existing tests missed the bug

  • The C++ mapper test used four fragments, so the MM-fragment loop always ran and overwrote the incorrect nloc initialization with the real local-QM count.
  • The TensorFlow op test duplicated the same multi-fragment fixture, so it never exercised an empty QMMM map or the out-of-bounds forward-map copy.
  • Existing fragment-index inputs did not combine a single QM fragment with ignored -1 placeholders, leaving the one-fragment branch uncovered.

Validation

  • cmake --build source/build --target runUnitTests_lib -j2
  • source/build/lib/tests/runUnitTests_lib --gtest_filter='TestGroupAtoms.*:TestPairwiseMap.*' (3 passed)
  • pytest source/tests/tf/test_pairwise_dprc.py::TestPairwiseOP::test_op_single_fragment_with_placeholders source/tests/tf/test_pairwise_dprc.py::TestPairwiseOP::test_op_single_frame -q (2 passed)
  • ruff format .
  • ruff check .

Fixes #5649

Coding agent: Codex
Codex version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning effort: xhigh

Summary by CodeRabbit

  • Bug Fixes

    • Fixed QM atom counting for single-fragment inputs that include placeholder entries.
    • Corrected pairwise QM/QMMM map generation when there are no additional QMMM map rows to populate.
  • Tests

    • Added new test coverage for placeholder handling in the native CPU pairwise-map computation.
    • Added a TensorFlow op test to verify exact QM/QMMM maps, atom counts, padding behavior, and frame indexing.

Count local QM atoms independently of the MM-fragment loop so single-fragment pairwise maps report consistent metadata and cannot overrun the forward map. Cover direct map construction and mixed-frame TensorFlow padding.

Coding-Agent: Codex
Codex-Version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning-Effort: xhigh
@dosubot dosubot Bot added the bug label Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.32%. Comparing base (6c3b985) to head (65f3bf1).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5843      +/-   ##
==========================================
- Coverage   78.58%   78.32%   -0.26%     
==========================================
  Files        1050     1050              
  Lines      120637   120644       +7     
  Branches     4356     4355       -1     
==========================================
- Hits        94801    94500     -301     
- Misses      24278    24583     +305     
- Partials     1558     1561       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code scan] Count or reject single-fragment pairwise DPRc maps

1 participant