-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: correct exclude_types
in descriptors
#3841
Conversation
WalkthroughWalkthroughRecent updates to the Changes
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
Outside diff range and nitpick comments (1)
deepmd/dpmodel/descriptor/dpa1.py (1)
Line range hint
813-827
: Refactor the reshaping and masking logic for clarity.The reshaping and masking operations in the
call
method are crucial for performance but currently are a bit convoluted. Consider refactoring this part to improve readability and possibly performance. Here's a suggested refactor:def reshape_and_apply_masks(self, nf, nloc, nnei, nlist, exclude_mask, sw): # Reshape operations flat_dim = nf * nloc exclude_mask = exclude_mask.reshape(flat_dim, nnei) nlist = nlist.reshape(flat_dim, nnei) sw = sw.reshape(flat_dim, nnei, 1) # Apply masks nlist_mask = nlist != -1 nlist_mask = nlist_mask * exclude_mask.astype(bool) sw = np.where(nlist_mask[:, :, None], sw, 0.0) nlist_masked = np.where(nlist_mask, nlist, 0) return nlist_masked, swThis method encapsulates the reshaping and masking logic into a single method, improving the modularity and testability of the code.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## devel #3841 +/- ##
==========================================
- Coverage 82.63% 80.86% -1.78%
==========================================
Files 515 515
Lines 49533 49542 +9
Branches 2985 2985
==========================================
- Hits 40932 40060 -872
- Misses 7690 8576 +886
+ Partials 911 906 -5 ☔ View full report in Codecov by Sentry. |
This reverts commit c7aaef5.
1. make `exclude_types` consistent with mask in nlist for all descriptors. (bugs fixed in dpa1 and dpa2) 2. add universal tests for descriptor. (now only test_exclude_types) 3. `TestCaseSingleFrameWithNlist` in source/tests/pt/model/test_env_mat.py will be removed in a seperate PR. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added new test case classes for simulation testing and common test cases on atomic models. - **Bug Fixes** - Adjusted exclusion mask calculations and applications affecting neighbor lists and switch behavior in various descriptors. - **Chores** - Updated GitHub Actions workflow to install CMake directly via pip, removing dependency on an external action. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
exclude_types
consistent with mask in nlist for all descriptors. (bugs fixed in dpa1 and dpa2)TestCaseSingleFrameWithNlist
in source/tests/pt/model/test_env_mat.py will be removed in a seperate PR.Summary by CodeRabbit
New Features
Bug Fixes
Chores