httk.atomistic.integrations.vasp

Expose VASP structure and trajectory integrations.

Submodules

Classes

VASPStructure

Load a VASP POSCAR structure lazily.

VASPTrajectory

Read VASP OUTCAR and/or XDATCAR data lazily.

Package Contents

class httk.atomistic.integrations.vasp.VASPStructure(obj, **hints)[source]

Bases: httk.atomistic.models.structure.backend.StructureBackend

Load a VASP POSCAR structure lazily.

This backend is explicitly constructed because a generic structure source should not silently claim every POSCAR path.

It is not registered in backend_classes. Constructing it from a view whose unwrapped value is already a VASPStructure returns that backend by identity. The payload’s raw channel preserves the source representation for byte-exact saving.

Parameters:
  • obj (Any) – A POSCAR path, neutral payload, or serializer-supported source.

  • **hints (Any) – Backend-selection hints.

kind: ClassVar[str] = 'vasp'
property payload: collections.abc.Mapping[str, Any]

Return the original, loaded, or synthesized neutral POSCAR payload.

property comment: Any

Return the POSCAR comment, if present.

property selective_dynamics: Any

Return selective-dynamics flags, if present.

resolve()[source]

Build and memoize the canonical structure from the POSCAR payload.

Returns:

The resolved unit-cell structure.

Return type:

httk.atomistic.models.structure.unitcell.UnitcellStructure

property cell: httk.atomistic.models.cell.cell.Cell

Return the resolved cell.

property sites: httk.atomistic.models.sites.sites.Sites

Return the resolved reduced coordinates.

property species: tuple[httk.atomistic.models.species.species.Species, Ellipsis]

Return the resolved distinct species.

property species_at_sites: tuple[str, Ellipsis]

Return the resolved species name at each site.

property site_moments: httk.atomistic.models.moments.backend.SiteMomentsBackend | None

Return resolved site moments, or None.

property charge: Any

Return the resolved structure charge, if present.

unwrap()[source]

Return the original POSCAR source.

class httk.atomistic.integrations.vasp.VASPTrajectory(source, **hints)[source]

Bases: httk.atomistic.models.trajectory.backend.TrajectoryBackend

Read VASP OUTCAR and/or XDATCAR data lazily.

XDATCAR supplies geometry when present. OUTCAR observables use the per-frame energy_sigma0, parsed as a float, plus temperature and stress_gpa_voigt(). One bounded pass caches those three scalar/6-tuple sequences; frame geometry is never cached.

XDATCAR geometry is preferred when both files are available. Cartesian coordinates are reduced exactly against the frame cell. A mismatch between OUTCAR and XDATCAR frame counts raises an error.

Parameters:
  • source (Any) – A VASP trajectory path, directory, payload, or VASP-outputs-like object.

  • **hints (Any) – Backend-selection hints.

kind: ClassVar[str] = 'vasp'
property nframes: int

Return the validated number of frames.

property species: tuple[Any, Ellipsis]

Return the composition inferred from POSCAR, XDATCAR, or OUTCAR.

property species_at_sites: tuple[str, Ellipsis]

Return the species name at each site.

property reference_frames: None

Return None because VASP frames are not bounded references.

frame(i)[source]

Read one VASP frame by index.

Parameters:

i (int) – Frame index; negative indexes count from the end.

Returns:

The requested unit-cell structure.

Raises:
  • IndexError – If the frame index is out of range.

  • ValueError – If the source has no complete frame geometry.

Return type:

httk.atomistic.models.structure.unitcell.UnitcellStructure

frames()[source]

Stream VASP frame geometry without caching full frames.

Yields:

Unit-cell structures in source order.

property observable_names: tuple[str, Ellipsis]

Return available OUTCAR observable names.

observable(name)[source]

Return one OUTCAR observable in frame order.

Parameters:

name (str) – Observable name.

Returns:

The observable values.

Raises:

KeyError – If the observable is unavailable.

Return type:

tuple[Any, Ellipsis]

unwrap()[source]

Return the original VASP trajectory source.

property source_locator: str | None

Return the source path, if one is available.