fix: omit virial in dp test summary if not available#4818
Merged
njzjz merged 1 commit intodeepmodeling:develfrom Jun 25, 2025
Merged
fix: omit virial in dp test summary if not available#4818njzjz merged 1 commit intodeepmodeling:develfrom
njzjz merged 1 commit intodeepmodeling:develfrom
Conversation
Signed-off-by: Chun Cai <amoycaic@gmail.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the test summary output to conditionally include virial statistics only when available in the avg dictionary.
- Replaces
if "...".keys()checks with direct key membership tests (if key in avg). - Adds a guard for printing virial metrics (
mae_v,rmse_v, etc.) only if"rmse_v"exists. - Retains the existing conditional print for Hessian metrics using
if "rmse_h" in avg.
Comments suppressed due to low confidence (2)
deepmd/entrypoints/test.py:608
- Add unit tests for cases when virial data is present and when it's absent to ensure these conditional branches behave correctly and no unexpected KeyErrors occur.
if "rmse_v" in avg:
deepmd/entrypoints/test.py:608
- Guarding only on
rmse_vmay lead to a KeyError if other virial metrics likemae_vormae_vaexist independently. Consider checking a representative key that covers all virial data, or verify the presence of each metric before printing.
if "rmse_v" in avg:
njzjz
approved these changes
Jun 24, 2025
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## devel #4818 +/- ##
=======================================
Coverage 84.57% 84.57%
=======================================
Files 699 699
Lines 68035 68035
Branches 3540 3540
=======================================
Hits 57539 57539
- Misses 9361 9364 +3
+ Partials 1135 1132 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ChiahsinChu
pushed a commit
to ChiahsinChu/deepmd-kit
that referenced
this pull request
Dec 17, 2025
deepmodeling#4563 Signed-off-by: Chun Cai <amoycaic@gmail.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
#4563