-
Notifications
You must be signed in to change notification settings - Fork 520
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(tf): throw errors when loc_cellnum is 0 #4180
Conversation
Fix deepmodeling#4122. Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
📝 WalkthroughWalkthroughThe changes in this pull request involve the addition of error handling in the Changes
Assessment against linked issues
Suggested reviewers
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration 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: 0
🧹 Outside diff range and nitpick comments (1)
source/lib/src/coord.cc (1)
99-104
: LGTM: Improved error handling for zero loc_cellnumThe added check for
loc_cellnum
(cell_info[21]) effectively addresses the PR objective. The error message is informative and helps users identify the potential cause of the issue.A minor suggestion to enhance the error message:
Consider adding more context to the error message. For example:
- "loc_cellnum should be positive but is " + - std::to_string(cell_info[21]) + - ". You may give a PBC box with zero volume."); + "Invalid local cell number (loc_cellnum): expected a positive value, but got " + + std::to_string(cell_info[21]) + + ". This may occur if you provided a periodic boundary condition (PBC) box with zero volume.");This change provides more context about what
loc_cellnum
represents and makes the error message slightly more user-friendly.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- source/lib/src/coord.cc (2 hunks)
🔇 Additional comments (2)
source/lib/src/coord.cc (2)
7-7
: LGTM: Inclusion of error handling headerThe addition of the "errors.h" header is appropriate for the new error handling mechanism introduced in this PR. This change aligns well with the objective of improving error feedback for users.
Line range hint
1-150
: Summary: Changes align well with PR objectivesThe modifications in this file effectively address the PR objective of throwing errors when
loc_cellnum
is 0. The implementation is focused and minimal, adding proper error handling without introducing unnecessary changes. This approach improves the feedback to users when encountering issues related to zero volume periodic boundary condition boxes, as described in the linked issue #4122.The changes are well-implemented and should help prevent confusion caused by misleading "invalid configuration argument" errors in CUDA operations when zero box inputs are provided.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## devel #4180 +/- ##
==========================================
- Coverage 83.46% 83.46% -0.01%
==========================================
Files 537 537
Lines 52168 52171 +3
Branches 3046 3047 +1
==========================================
Hits 43543 43543
- Misses 7678 7681 +3
Partials 947 947 ☔ View full report in Codecov by Sentry. |
The CI error has been submitted to data-apis/array-api-compat#186 |
Or shall we drop Python 3.8 support? Python 3.8 has reached EOL |
Fix #4122.
Summary by CodeRabbit
New Features
Bug Fixes
compute_cell_info
function to prevent failures due to invalid input conditions.