-
Notifications
You must be signed in to change notification settings - Fork 584
test(common): add regression for atom type remap #5050
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
Conversation
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.
Pull Request Overview
This PR adds a regression test to ensure that atom type remapping works correctly when the training system contains fewer atom types than the provided type_map. The test verifies the fix from commit 4ec0437.
Key changes:
- Adds a new test file
test_deepmd_data.pywith regression test for atom type remapping functionality - Tests the scenario where a system has atoms of types O and H, but the type_map includes an unused Si type
- Verifies correct remapping when loading data with a different type_map ordering
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📝 WalkthroughWalkthroughAdds a new unit test module that creates a temporary DeepMD dataset, writes atom type and type map files, and verifies DeepmdData's atom-type remapping, stored internal type_map, and _load_set output shape/content. Changes
Sequence Diagram(s)sequenceDiagram
participant T as TestCase
participant FS as FileSystem (temp dataset)
participant D as DeepmdData
T->>FS: write type.raw, type_map.raw, coord.npy, box.npy
T->>D: instantiate DeepmdData(type_map=custom_map)
D->>FS: read type_map.raw (if used) and type.raw
D->>D: remap atom types using provided type_map / idx_map
D-->>T: expose remapped atom_type and internal type_map
T->>D: call _load_set("set.000")
D->>FS: read set files (type, coord, box)
D-->>T: return loaded set dict with "type" array (2D broadcasted via idx_map)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (29)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devel #5050 +/- ##
=======================================
Coverage 84.18% 84.19%
=======================================
Files 709 709
Lines 70215 70216 +1
Branches 3620 3618 -2
=======================================
+ Hits 59114 59115 +1
- Misses 9934 9935 +1
+ Partials 1167 1166 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
## Summary - add a regression test that reproduces the original atom-type remapping failure when the training system contains fewer atom types than the provided type_map - ensure the fix from commit 4ec0437 remains covered going forward <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Added unit tests for DeepmdData that validate atom-type remapping, handling of unused types, and correct loading/formatting of type arrays. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Summary by CodeRabbit