httk.io.vasp.outcar¶
Lazy, streaming access to the bounded metadata and final results of OUTCAR.
Attributes¶
Classes¶
Store energy lexemes from the last complete or partial energy block. |
|
Store one complete ionic-step snapshot with VASP numeric lexemes unchanged. |
|
Store one six-by-six elastic-moduli table. |
|
Lazy OUTCAR metadata reader whose scans reopen the source each time. |
Functions¶
|
Return a lazy OUTCAR payload; only filesystem filenames are accepted. |
Module Contents¶
- class httk.io.vasp.outcar.FinalEnergies[source]¶
Store energy lexemes from the last complete or partial energy block.
- Parameters:
free_energy – Free-energy lexeme from the block, when present.
energy_without_entropy – Energy-without-entropy lexeme, when present.
energy_sigma0 – Sigma-zero energy lexeme, when present.
final – Whether the block was complete when parsing ended.
- class httk.io.vasp.outcar.OutcarFrame[source]¶
Store one complete ionic-step snapshot with VASP numeric lexemes unchanged.
- Parameters:
index – Zero-based ionic-step index.
cell – Lattice-vector lexemes, when the step contains a cell.
positions – Position lexemes, when the step contains positions.
forces – Force lexemes, when the step contains forces.
stress_kbar – Six stress lexemes in VASP order, when present.
free_energy – Free-energy lexeme, when present.
energy_without_entropy – Energy-without-entropy lexeme, when present.
energy_sigma0 – Sigma-zero energy lexeme, when present.
temperature – Temperature lexeme, when present.
- class httk.io.vasp.outcar.ElasticModuliBlock[source]¶
Store one six-by-six elastic-moduli table.
- Parameters:
heading – Heading identifying the table in the source.
rows – Table rows with their source numeric lexemes.
- class httk.io.vasp.outcar.OutcarFile(filename)[source]¶
Lazy OUTCAR metadata reader whose scans reopen the source each time.
OUTCAR paths, including compressed paths, are accepted by deliberate forward-streaming divergence from
WavecarFile; random frame access re-streams the file. Construction validates only that the path exists. Prologue and full scans are lazy: the first prologue access scans to the ionic marker and can traverse the whole file when no marker exists. The full pass streams the source once and caches summary fields, all stress rows, and all elastic-moduli blocks. No source handle is retained, soclose()only marks this lazy object closed. The publicpathproperty returns the source filename.- Parameters:
filename (str | os.PathLike[str]) – Filesystem path to an OUTCAR, optionally compressed.
- property version_string: str[source]¶
Return the VASP version string found during the prologue scan.
- property version_numbers: tuple[int, Ellipsis][source]¶
Return the numeric components of the VASP version string.
- property parameters: collections.abc.Mapping[str, str][source]¶
Return the first recognized VASP parameter lexeme for each parameter.
- property ions_per_type: tuple[int, Ellipsis] | None[source]¶
Return the number of ions for each potential type, when reported.
- property xc: str | None[source]¶
Return the recognized exchange-correlation description, when available.
- property potcar_titles: tuple[str, Ellipsis][source]¶
Return distinct POTCAR titles in first-seen order.
- frames()[source]¶
Stream complete ionic frames without retaining the sequence.
- Returns:
An iterator yielding one
OutcarFrameat a time.- Return type:
- frame(index)[source]¶
Return one frame by rescanning from the start of the file.
- Parameters:
index (int) – Zero-based frame index.
- Returns:
The requested frame, or
Nonewhen it is beyond the file.- Raises:
ValueError – If
indexis negative or not an integer.- Return type:
OutcarFrame | None
- property final_energies: FinalEnergies[source]¶
Return energies from the last complete or partial energy block.
- property last_frame: OutcarFrame | None[source]¶
Return the last complete ionic frame, when one exists.
- property elastic_moduli: tuple[ElasticModuliBlock, Ellipsis][source]¶
Return parsed elastic-moduli tables in source order.
- property magnetization: tuple[float, Ellipsis] | None[source]¶
Return per-ion total magnetic moments from the final
magnetization (x)block.The values are the last (
tot) column of each ion row in the lastmagnetization (x)block in the file, in Bohr magnetons. The per-orbital columns and themagnetization (y)/(z)blocks themselves are out of scope, so for a noncollinear run these values are only the x projection of each moment. A caller treating them as a collinear axis projection must checknoncollinear_magnetizationfirst. A malformed or truncated final block never raises: it yieldsNoneand records an entry inissues, so an OUTCAR from a killed job is ordinary input.
- property noncollinear_magnetization: bool[source]¶
Whether a
magnetization (y)or(z)block follows the final(x)block.When
Truethemagnetizationvalues are only the x projection of a noncollinear moment and must not be treated as a collinear axis magnitude.- Returns:
Truefor a noncollinear final block,Falseotherwise, including when the file has no magnetization block.- Return type:
- httk.io.vasp.outcar.read_outcar(source)[source]¶
Return a lazy OUTCAR payload; only filesystem filenames are accepted.
- Parameters:
source (Any) – Filesystem path to an OUTCAR, optionally compressed.
- Returns:
A neutral payload containing the lazy OUTCAR reader.
- Raises:
TypeError – If
sourceis not a filesystem path.FileNotFoundError – If the path does not exist.
- Return type: