httk.atomistic.models.trajectory.api¶
Define the canonical trajectory interface for httk-atomistic.
Classes¶
Define the common, frame-oriented trajectory interface. |
Module Contents¶
- class httk.atomistic.models.trajectory.api.TrajectoryAPI[source]¶
Bases:
abc.ABCDefine 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:
- 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
iis before the first frame or past the end.TypeError – If
iis not an integer.
- Return type:
- 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.