ase_traj_reader

A module containing a reader for ASE trajectory files.

ASE trajectories are the binary .traj files of the Atomic Simulation Environment, see https://wiki.fysik.dtu.dk/ase/ase/io/trajectory.html. Reading them needs the optional dependency ase (pip install PQAnalysis[ase]).

Summary

Classes:

AseTrajReader

A class for reading the frames of a single ASE trajectory file.

Reference

class AseTrajReader(filename: str)[source]

Bases: object

A class for reading the frames of a single ASE trajectory file.

ASE stores Angstrom, eV and its own time unit. Values are converted to the PQ units used in PQAnalysis: Angstrom, Angstrom s-1, kcal mol-1 Angstrom-1, e and kcal mol-1. The atoms are named by the chemical symbols of their atomic numbers.

Generally, this class should not be used directly. Instead, use the TrajectoryReader with traj_format="ase" or a .traj file.

Parameters:

filename (str) – The name of the ASE trajectory file.

Raises:

AseTrajReaderError – If ase is not installed.

cell_generator() → Generator[Cell][source]

A generator that yields the cell of each frame.

Yields:

Cell – The cell of the frame, a vacuum cell if the frame is not periodic.

frame_generator(
start: int = 0,
stop: int | None = None,
topology: Topology | None = None,
) → Generator[AtomicSystem][source]

A generator that yields the frames of the file.

Parameters:
  • start (int, optional) – The index of the first frame, by default 0.

  • stop (int | None, optional) – The index after the last frame, by default None, meaning all frames.

  • topology (Topology | None, optional) – The topology of the frames, by default None, meaning it is built from the atomic numbers of the first read frame.

Yields:

AtomicSystem – The frames with positions in Angstrom, velocities in Angstrom s-1, forces in kcal mol-1 Angstrom-1, charges in e and the potential energy in kcal mol-1.

logger = <CustomLogger PQAnalysis.AseTrajReader (INFO)>
property number_of_frames: int

The number of frames in the file.

Type:

int

property steps: list[int | None]

The step of each frame, None if not stored.

Type:

list of int | None