httk.atomistic.models.trajectory.plain

Map OPTIMADE trajectory properties to a backend.

Classes

PlainTrajectory

Represent a mapping whose structure properties have a frame axis.

Module Contents

class httk.atomistic.models.trajectory.plain.PlainTrajectory(obj, **hints)[source]

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

Represent a mapping whose structure properties have a frame axis.

A compact constant property is represented by a one-element leading axis, e.g. nelements=[2] for any number of frames. Only properties declaring constant on that axis accept this compact form.

Parameters:
kind: ClassVar[str] = 'plain'[source]
frame(i)[source]

Return one frame from the property mapping.

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.

  • KeyError – If a required trajectory property is absent.

  • TypeError – If the frame index is not an integer.

  • ValueError – If the frame cannot be represented as a structure.

Return type:

httk.atomistic.models.structure.unitcell.UnitcellStructure

frames()[source]

Iterate over all frames in source order.

Returns:

An iterator of unit-cell structures.

Return type:

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

property nframes: int[source]

Return the number of frames.

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

Return normalized reference-frame indexes, or None.

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

Return the constant distinct species from the first frame.

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

Return the constant species name at each site.

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

Return names outside the recognized trajectory and structure properties.

observable(name)[source]

Return one mapped observable’s values in frame order.

Parameters:

name (str) – Observable property name.

Returns:

The observable values.

Raises:

KeyError – If the property is not an observable.

Return type:

tuple[Any, Ellipsis]

unwrap()[source]

Return the original property mapping.