Repository navigation
✨ PwOutput: Parse k-points from stdout as fallback - #155
Merged
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 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.
The XML is the structured source of truth for the k-point grid, but it is common to discard the QE
outdirafter a run, or to overwrite it with a follow-upnscf/bandscalculation. 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 stdoutcart. coord. in units 2pi/alatblock. This pattern — XML preferred, stdout as a last-resort fallback — is now expected to recur for other outputs.PwStdoutParsercaptures the lastnumber of k points=block (the last one wins because vc-relax reprints after the relaxed cell is set), reads thek( i ) = ( x y z ), wk = wrows, and converts the cartesian coordinates from 2π/alat to 1/Å using the stdoutlattice 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 everydefault_xml_*snapshot now exercises the stdout fallback.