httk.atomistic.integrations.vasp.io.xdatcar

Lazy, lexeme-preserving readers for VASP XDATCAR files.

Classes

XdatcarFile

Re-openable, forward-streaming XDATCAR source.

Functions

read_xdatcar(source)

Read an XDATCAR path into a lazy neutral vasp-xdatcar payload.

Module Contents

class httk.atomistic.integrations.vasp.io.xdatcar.XdatcarFile(filename)[source]

Re-openable, forward-streaming XDATCAR source.

Construction checks only that filename exists. Compressed paths are accepted by deliberate forward-streaming divergence from WavecarFile; repeated scans re-stream the file. Header properties scan the header; frames opens a fresh stream and never caches frames. Variable-cell files are identified by a repeated POSCAR-like header and expose that header’s cell on the following frame. An incomplete final coordinate block is dropped and reported in issues during the full pass. The public path property returns the source filename.

Parameters:

filename (str | os.PathLike[str]) – Filesystem path to an XDATCAR, optionally compressed.

property path: str[source]

Return the source filename used to construct this lazy reader.

property closed: bool[source]

Whether this lazy reader has been closed.

close()[source]

Close the object; scans use short-lived streams and own no handle.

property comment: str[source]

Return the source comment line.

property scale: str[source]

Return the source scaling-factor lexeme.

property cell: tuple[tuple[str, str, str], Ellipsis][source]

Return the initial cell-vector lexemes.

property symbols: tuple[str, Ellipsis] | None[source]

Return initial species symbols, or None for the older header form.

property counts: tuple[int, Ellipsis][source]

Return the number of sites for each initial species entry.

property cartesian: bool[source]

Whether the first configuration uses Cartesian coordinates.

property issues: tuple[str, Ellipsis][source]

Return issues collected while scanning all frames.

frames()[source]

Yield complete frames in file order without retaining them.

Yield:

One complete frame mapping at a time.

property nframes: int[source]

Return the number of complete frames after a full scan.

httk.atomistic.integrations.vasp.io.xdatcar.read_xdatcar(source)[source]

Read an XDATCAR path into a lazy neutral vasp-xdatcar payload.

Parameters:

source (str | os.PathLike[str]) – Filesystem path to an XDATCAR, optionally compressed.

Returns:

A neutral payload containing the lazy XDATCAR reader.

Raises:
Return type:

dict[str, Any]