Skip to content

✨ PwOutput: Parse forces from stdout as fallback - #156

Merged
mbercx merged 1 commit into
aiidateam:mainfrom
mbercx:new/stdout-forces
May 16, 2026
Merged

mbercx merged 1 commit into
aiidateam:mainfrom
mbercx:new/stdout-forces

Conversation

@mbercx

@mbercx mbercx commented May 16, 2026

Copy link
Copy Markdown
Member

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.

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-commenter

codecov-commenter commented May 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.46%. Comparing base (d0f8124) to head (14a13fb).
⚠️ Report is 132 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mbercx
mbercx merged commit 269ac9d into aiidateam:main May 16, 2026
5 checks passed
@mbercx
mbercx deleted the new/stdout-forces branch May 16, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants