Skip to content

PwOutput: gate total_energy on the calculation type#150

Merged
mbercx merged 1 commit into
mainfrom
new/extend-parsing
May 7, 2026
Merged

PwOutput: gate total_energy on the calculation type#150
mbercx merged 1 commit into
mainfrom
new/extend-parsing

Conversation

@mbercx
Copy link
Copy Markdown
Member

@mbercx mbercx commented May 7, 2026

No description provided.

For `nscf` and `bands` runs QE never assigns `etot` and writes
`<etot>0.0</etot>` to the XML. When such a run shares its `prefix` with a prior
`scf` run — the standard `scf → nscf → bands` workflow — the nscf run also
overwrites the scf XML at `<prefix>.save/`, so the meaningful total energy is
gone from disk regardless of what the user asked for.

`total_energy` is now resolved with a `Coalesce` of two branches: an XML branch
gated by `Check` on `xml.input.control_variables.calculation`, and a stdout
fallback. The XML branch is taken only for documented calculations types
(scf, relax, vc-relax, md, vc-md). For nscf/bands runs the gate fails and
`Coalesce` falls through to the stdout branch.

`PwStdoutParser` now extracts the converged energy from the last `!  total
energy = ... Ry` line (relax/md print one per ionic step; the final value is the
converged one).

Side effect: the `collinear` fixture (which is itself an nscf XML) previously
surfaced `total_energy: 0.0`. With the gate in place the field is correctly
absent — the `0.0` was always meaningless. The regression snapshot drops it.
@mbercx mbercx force-pushed the new/extend-parsing branch from 0352dbe to 3f1032b Compare May 7, 2026 16:40
@mbercx mbercx changed the title Extend pw.x parsing feature set PwOutput: gate total_energy on the calculation type May 7, 2026
@mbercx mbercx merged commit 2097eff into main May 7, 2026
5 checks passed
@mbercx mbercx deleted the new/extend-parsing branch May 7, 2026 16:48
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.

1 participant