You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(pt-expt): allow DPZBL inference without ghost atoms - #6155
Select local atoms in the tabulated pair potential without introducing an export constraint that requires the extended atom count to differ from the local atom count. Add coverage for the equal-count case.
Compared frozen and eager energy, forces and virial for a nonperiodic system and two periodic box sizes. The maximum absolute difference was below 6e-14. All 16 targeted PairTab and DPZBL tests passed.
Updated local atom selection in pairwise calculations for more consistent handling of local atoms.
Tests
Added coverage confirming that frozen DP ZBL models without ghost atoms produce energy, force, and virial results consistent with eager model evaluation.
No actionable comments were generated in the recent review.
Walkthrough
The pair-table model now selects local atom types and coordinates with indexed operations. A new test compares eager DP ZBL outputs with frozen-model inference without a cell.
Changes: Pair-table local atom selection
Layer / File(s)
Summary
Indexed local atom selection deepmd/dpmodel/atomic_model/pairtab_atomic_model.py
forward_atomic and _get_pairwise_dist select local atom types and coordinates with device-aware indices and xp.take instead of prefix slicing.
Frozen inference regression test source/tests/pt_expt/model/test_dp_zbl_model.py
The test exports a DP ZBL model with lower_kind="nlist", evaluates it without a cell, and compares energy, force, and virial with eager-model outputs.
This change lets exported DPZBL models run inference when the extended atom count equals the local atom count, such as for nonperiodic inputs. The change is small and localized, a regression test covers the reported case, and no merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the fix (DPZBL inference without ghost atoms) in the pt-expt backend. The raw summary confirms the PairTab atomic model change selects local atoms by explicit indices instead of prefix…
Linked Issues check
[#6087] The issue requires successful pt_expt .pt2 inference of a DPZBL model (nlist lower) when nall == nloc. The reviewed head of deepmd/dpmodel/atomic_model/pairtab_atomic_model.py removes the pref…
Out of Scope Changes check
The PR changes two files. deepmd/dpmodel/atomic_model/pairtab_atomic_model.py replaces prefix slicing with explicit local-index selection in forward_atomic and _get_pairwise_dist. This is the fix for …
Full details: Title check
Explanation
The title names the fix (DPZBL inference without ghost atoms) in the pt-expt backend. The raw summary confirms the PairTab atomic model change selects local atoms by explicit indices instead of prefix slicing. This removes the need for nall to differ from nloc, which the linked issue #6087 reports as a runtime assertion failure. The added test covers the frozen-versus-eager comparison without a cell input. The title matches the main change and is specific enough for history scanning.
Full details: Linked Issues check
Explanation
[#6087] The issue requires successful pt_expt .pt2 inference of a DPZBL model (nlist lower) when nall == nloc. The reviewed head of deepmd/dpmodel/atomic_model/pairtab_atomic_model.py removes the prefix slice that specialized the exported graph. forward_atomic builds local_indices = xp.arange(nloc) and selects atom types with xp.take(extended_atype, local_indices, axis=1). _get_pairwise_dist selects local coordinates with xp.take(coords, local_indices, axis=1). The neighbor gather uses masked_nlist and does not depend on a prefix of nall. This targets the nall != nloc guard named in the issue. The test test_frozen_no_ghosts in source/tests/pt_expt/model/test_dp_zbl_model.py freezes with lower_kind="nlist", evaluates input without a cell through DeepPot, and compares energy, force and virial with the eager model. This covers the equal-count case. Change since the previous reviewed head (579ae4c) could not be read as a diff because changed blobs are missing from the checkout. The head file content matches the PR summary. Limits: the exported graph was not run, so absence of the Ne(s54, s96) assertion is not directly verified. The reported test results (16 PairTab and DPZBL tests, max difference below 6e-14) were not independently reproduced.
Full details: Out of Scope Changes check
Explanation
The PR changes two files. deepmd/dpmodel/atomic_model/pairtab_atomic_model.py replaces prefix slicing with explicit local-index selection in forward_atomic and _get_pairwise_dist. This is the fix for the export guard in #6087. source/tests/pt_expt/model/test_dp_zbl_model.py adds test_frozen_no_ghosts, a regression test for the same case. No unrelated files or behavior changes appear in the summary or in the head file content. Limit: the base-to-head and previous-to-head diffs were unavailable, so the file list comes from the PR summary and the head file, not from a diff.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: a2febb76-e67e-4b05-8119-00fa15c6b5a4
Commits
Reviewing files that changed from the base of the PR and between 579ae4c and b150ca5.
Files selected for processing: 1
source/tests/pt_expt/model/test_dp_zbl_model.py
Files skipped from review as they are similar to previous changes: 1
source/tests/pt_expt/model/test_dp_zbl_model.py
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Select local atoms in the tabulated pair potential without introducing an export constraint that requires the extended atom count to differ from the local atom count. Add coverage for the equal-count case.
Compared frozen and eager energy, forces and virial for a nonperiodic system and two periodic box sizes. The maximum absolute difference was below 6e-14. All 16 targeted PairTab and DPZBL tests passed.
Closes #6087.
Summary by CodeRabbit