CompositeReader

class mdcraft.io.reader.CompositeReader(filename: str | Path, /, *, n_workers: int | None = 1)[source]

Bases: BaseTrajectoryReader

Methods

close

Closes the topology or trajectory file and deletes the handle.

open

Opens the topology or trajectory file and stores a handle to it.

read_frames

Reads data from one or more frames from the trajectory file.

abstractmethod close() None

Closes the topology or trajectory file and deletes the handle.

abstract property dt: float | None

Time step size between timesteps in the trajectory. If None, the time step size is not constant across frames or could not be determined from the trajectory.

Reference unit: \(\mathrm{ps}\).

abstract property n_atoms: int | None

Number of atoms in each frame. If None, the number of atoms is not constant across frames.

abstract property n_frames: int

Number of frames in the trajectory.

abstractmethod open() None

Opens the topology or trajectory file and stores a handle to it.

read_frames(frame_indices: int | slice | Iterable[int], /, *, _convert_units: bool = True) dict[str, Any] | list[dict[str, Any]]

Reads data from one or more frames from the trajectory file.

Parameters:
frame_indicesint, slice, or array-like, positional-only

Indices of frames to read.

Returns:
datadict or list

Data from the frame(s).

abstract property time_step: float | None

Time step between frames in the trajectory. If None, the time step is not constant across frames.

Reference unit: \(\mathrm{ps}\).

abstract property times: ndarray[float64]

Simulation times found in the trajectory.

Reference unit: \(\mathrm{ps}\).

abstract property timesteps: ndarray[uint32] | None

Simulation timesteps found in the trajectory. If None, the timesteps could not be determined from the trajectory.