Repository navigation
✨ PwOutput: Parse forces from stdout as fallback - #156
Merged
Merged
Conversation
Another output that we currently only parse from the XML is the forces. As for the k-points, often the user will (no longer) have the XML, and in this case being able to fall back onto the stdout is valuable. `PwStdoutParser` captures the last `Forces acting on atoms (cartesian axes, Ry/au)` block (the last one wins because relax / md runs print one per ionic step), then the `forces` Spec is wrapped in `Coalesce(xml, stdout)` so the XML path keeps winning when present. The stdout path applies the `Ry/bohr → eV/Å` conversion in the Spec, in line with the existing rule that parsers keep the units of the corresponding output file and Specs normalise to documented units. The regex anchors on the `Forces acting on atoms` header and stops at the first non-`atom` row, so the QE follow-up decompositions (`The non-local contrib. to forces`, `The ionic contribution to forces`, `The local contribution to forces` — all of which reuse the same `atom N type M force = ...` row format) do not bleed into the total forces.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #156 +/- ##
==========================================
- Coverage 89.77% 88.46% -1.32%
==========================================
Files 11 23 +12
Lines 489 1092 +603
==========================================
+ Hits 439 966 +527
- Misses 50 126 +76 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Another output that we currently only parse from the XML is the forces. As for the k-points, often the user will (no longer) have the XML, and in this case being able to fall back onto the stdout is valuable.
PwStdoutParsercaptures the lastForces acting on atoms (cartesian axes, Ry/au)block (the last one wins because relax / md runs print one per ionic step), then theforcesSpec is wrapped inCoalesce(xml, stdout)so the XML path keeps winning when present. The stdout path applies theRy/bohr → eV/Åconversion in the Spec, in line with the existing rule that parsers keep the units of the corresponding output file and Specs normalise to documented units.The regex anchors on the
Forces acting on atomsheader and stops at the first non-atomrow, so the QE follow-up decompositions (The non-local contrib. to forces,The ionic contribution to forces,The local contribution to forces— all of which reuse the sameatom N type M force = ...row format) do not bleed into the total forces.