fix: compare pwscf energy by relative error#1643
fix: compare pwscf energy by relative error#1643wanghan-iapcm merged 2 commits intodeepmodeling:develfrom
Conversation
WalkthroughWalkthroughThe changes involve modifications to the Changes
Sequence Diagram(s)sequenceDiagram
participant Test as Test Suite
participant CompSys as CompLabeledSys
participant System1 as system_1
participant System2 as system_2
Test->>CompSys: Run test_coord
CompSys->>CompSys: Check tmp_cell_norm
alt tmp_cell_norm < 1e-12
CompSys->>CompSys: Set tmp_cell_norm to ones
end
Test->>CompSys: Run test_energy
CompSys->>System1: Get energy value
CompSys->>System2: Get energy value
alt energy from system_2 < 1e-12
CompSys->>Test: Assert energies are approximately equal
else energy from system_2 >= 1e-12
CompSys->>Test: Assert ratio of energies is approximately one
end
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 (
|
for more information, see https://pre-commit.ci
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## devel #1643 +/- ##
=======================================
Coverage 49.54% 49.54%
=======================================
Files 83 83
Lines 14848 14848
=======================================
Hits 7357 7357
Misses 7491 7491 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- tests/generator/comp_sys.py (2 hunks)
Additional comments not posted (1)
tests/generator/comp_sys.py (1)
89-91: Proper Handling of Zero-Cell Cases to Avoid Division by ZeroThe added check ensures that when
tmp_cell_normis effectively zero (indicating a non-periodic system with zero cell dimensions), it is replaced with ones to prevent division by zero errors during coordinate normalization.
ut failure caused by deepmodeling/dpdata#725
Summary by CodeRabbit