httk.atomistic.integrations.vasp.io.wavecar¶
Neutral, numpy-backed VASP WAVECAR binary I/O.
The wavecar value returned by read_wavecar() is a WavecarSource:
an object exposing nspins, nkpts, nbands, encut, cell,
kpoints, eigenvalues, occupations, nplanewaves,
double_precision, and coefficients(spin, kpt, band). WavecarFile
also exposes its record_length. The gamma-half orientation is not stored
in a WAVECAR; gamma_half is a pass-through hint because the consumer’s
default ("x") cannot be inferred from the data.
The atomistic phase may provide the same contract for in-memory data without
depending on this module’s concrete class.
Classes¶
Open a VASP WAVECAR and eagerly read its small metadata headers. |
Functions¶
|
Read a WAVECAR path into a neutral |
|
Write a neutral |
Module Contents¶
- class httk.atomistic.integrations.vasp.io.wavecar.WavecarFile(filename, *, double_precision=None)[source]¶
Open a VASP WAVECAR and eagerly read its small metadata headers.
Public indices are all zero-based. The small metadata headers and band summaries are read eagerly, while each coefficient vector is loaded lazily from its band record. Compressed paths are refused because random access cannot stream decompression.
cellhas shape(3, 3),kpointshas shape(nkpts, 3), the eigenvalue and occupation arrays have shape(nspins, nkpts, nbands), andnplanewaveshas shape(nkpts,).- Parameters:
filename (str | os.PathLike[str]) – Filesystem path to an uncompressed WAVECAR.
double_precision (bool | None) – Override the precision indicated by the WAVECAR header.
- coefficients(spin, kpt, band)[source]¶
Read one zero-based spin/k-point/band coefficient vector.
- Parameters:
- Returns:
The coefficient vector for the selected band record.
- Raises:
ValueError – If the file is closed, an index is invalid, or the record is truncated.
- Return type:
Any
- httk.atomistic.integrations.vasp.io.wavecar.read_wavecar(source, *, double_precision=None, gamma_half=None)[source]¶
Read a WAVECAR path into a neutral
vasp-wavecarpayload.- Parameters:
source (str | os.PathLike[str]) – Filesystem path to an uncompressed WAVECAR.
double_precision (bool | None) – Override the precision indicated by the WAVECAR header.
gamma_half (str | None) – Consumer hint for the gamma-half orientation, or
Nonewhen unspecified.
- Returns:
A payload containing the lazy WAVECAR source and the gamma-half hint.
- Raises:
ValueError – If an option is invalid, compression is present, or the file is malformed.
- Return type:
- httk.atomistic.integrations.vasp.io.wavecar.write_wavecar(destination, payload)[source]¶
Write a neutral
vasp-wavecarpayload to a binary path.- Parameters:
destination (str | os.PathLike[str]) – Filesystem path for the uncompressed binary output.
payload (collections.abc.Mapping[str, Any]) – Neutral payload containing a WAVECAR source.
- Raises:
ValueError – If the destination or payload cannot represent a WAVECAR.
TypeError – If the payload is not a mapping.
KeyError – If the payload mapping does not contain
"wavecar".