Skip to content

✨ PwOutput: Parse k-points from stdout as fallback - #155

Merged
mbercx merged 1 commit into
aiidateam:mainfrom
mbercx:new/outputs
May 15, 2026
Merged

mbercx merged 1 commit into
aiidateam:mainfrom
mbercx:new/outputs

Conversation

@mbercx

@mbercx mbercx commented May 15, 2026

Copy link
Copy Markdown
Member

The XML is the structured source of truth for the k-point grid, but it is common to discard the QE outdir after a run, or to overwrite it with a follow-up nscf/bands calculation. With only stdout on disk, the three k-point outputs (number_of_k_points, k_points_weights, k_points_cartesian) were previously unreachable, even though the same information is printed verbatim in the stdout cart. coord. in units 2pi/alat block. This pattern — XML preferred, stdout as a last-resort fallback — is now expected to recur for other outputs.

PwStdoutParser captures the last number of k points= block (the last one wins because vc-relax reprints after the relaxed cell is set), reads the k( i ) = ( x y z ), wk = w rows, and converts the cartesian coordinates from 2π/alat to 1/Å using the stdout lattice parameter (alat) so the units match the XML-derived path. Stdout precision is fundamentally lower than XML (5-digit alat, 7-digit k components) so the fallback values agree with the XML only to ~1e-3 in 1/Å; one of the new tests pins this tolerance.

Each of the three Specs is wrapped in Coalesce(xml, stdout) so the XML path keeps winning when present. Two trimmed fixtures (default_xml_220603, default_xml_250521) gained a reconstructed k-point block — built from their own XML at fixture-creation time — so every default_xml_* snapshot now exercises the stdout fallback.

The XML is the structured source of truth for the k-point grid, but it is common
to discard the QE `outdir` after a run, or to overwrite it with a follow-up
`nscf`/`bands` calculation. With only stdout on disk, the three k-point outputs
(`number_of_k_points`, `k_points_weights`, `k_points_cartesian`) were previously
unreachable, even though the same information is printed verbatim in the stdout
`cart. coord. in units 2pi/alat` block. This pattern — XML preferred, stdout as
a last-resort fallback — is now expected to recur for other outputs.

`PwStdoutParser` captures the last `number of k points=` block (the last one
wins because vc-relax reprints after the relaxed cell is set), reads the `k( i )
= ( x y z ), wk = w` rows, and converts the cartesian coordinates from 2π/alat
to 1/Å using the stdout `lattice parameter (alat)` so the units match the
XML-derived path. Stdout precision is fundamentally lower than XML (5-digit
alat, 7-digit k components) so the fallback values agree with the XML only to
~1e-3 in 1/Å; one of the new tests pins this tolerance.

Each of the three Specs is wrapped in `Coalesce(xml, stdout)` so the XML path
keeps winning when present. Two trimmed fixtures (`default_xml_220603`,
`default_xml_250521`) gained a reconstructed k-point block — built from their
own XML at fixture-creation time — so every `default_xml_*` snapshot now
exercises the stdout fallback.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.40%. Comparing base (d0f8124) to head (88efa57).
⚠️ Report is 131 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #155      +/-   ##
==========================================
- Coverage   89.77%   88.40%   -1.37%     
==========================================
  Files          11       23      +12     
  Lines         489     1087     +598     
==========================================
+ Hits          439      961     +522     
- 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 22237a1 into aiidateam:main May 15, 2026
5 checks passed
@mbercx
mbercx deleted the new/outputs branch May 15, 2026 16:23
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