httk.atomistic.models.trajectory.api

Define the canonical trajectory interface for httk-atomistic.

Classes

TrajectoryAPI

Define the common, frame-oriented trajectory interface.

Module Contents

class httk.atomistic.models.trajectory.api.TrajectoryAPI[source]

Bases: abc.ABC

Define the common, frame-oriented trajectory interface.

A trajectory has one constant composition for all frames. Trajectories whose number or identity of sites changes are intentionally outside this interface.

property nframes: int[source]

Count frames by streaming them in O(n) time.

Each call requires frames() to provide a fresh traversal; a one-shot backend must override this default or cache its frames. Random-access backends override this default.

Returns:

The number of frames.

Return type:

int

frame(i)[source]

Stream to and return one frame in O(n) time.

Each call requires frames() to provide a fresh traversal; a one-shot backend must override this default or cache its frames. Random-access backends override this default.

Parameters:

i (int) – Frame index.

Returns:

The requested UnitcellStructure.

Raises:
  • IndexError – If i is before the first frame or past the end.

  • TypeError – If i is not an integer.

Return type:

httk.atomistic.models.structure.unitcell.UnitcellStructure

abstractmethod frames()[source]

Iterate over the frames with a fresh traversal on every call.

A one-shot backend must override the streaming defaults or cache its frames.

Returns:

A fresh iterator of unit-cell structures.

Return type:

collections.abc.Iterator[httk.atomistic.models.structure.unitcell.UnitcellStructure]

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

Return the constant distinct species.

property species_at_sites: tuple[str, Ellipsis][source]
Abstractmethod:

Return the constant species name at each site.

property reference_frames: tuple[int, Ellipsis] | None[source]

Return stored reference-frame indexes, or None.

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

Return the names of available per-frame observables.

observable(name)[source]

Return one observable’s values by frame.

Parameters:

name (str) – Observable name.

Returns:

The observable values in frame order.

Raises:

KeyError – If the observable is unavailable.

Return type:

tuple[Any, Ellipsis]