Trajectory handling

class dynasor.Trajectory(filename, trajectory_format, atomic_indices=None, length_unit='Angstrom', time_unit='fs', frame_start=0, frame_stop=None, frame_step=1)[source]

Instances of this class hold trajectories in a format suitable for the computation of correlation functions. They behave as iterators, where each step returns the next frame as a TrajectoryFrame object. The latter hold information regarding atomic positions, types, and velocities.

Parameters
  • filename (str) – Name of input file

  • trajectory_format (str) – Type of trajectory. Possible values are: 'lammps_internal', 'extxyz', 'ase' or one of the formats supported by MDAnalysis (except for 'lammpsdump', which can be called by specifying 'lammps_mdanalysis' to avoid ambiguity)

  • atomic_indices (Union[str, Dict[str, List[int]], None]) – Specify which indices belong to which atom type. Can be (1) a dictionary where the keys specicy species and the values are list of atomic indices, (2) 'read_from_trajectory', in which case the species are read from the trajectory or (3) the path to an index file.

  • length_unit (str) – Length unit of trajectory ('Angstrom', 'nm', 'pm', 'fm'). Necessary for correct conversion to internal dynasor units if the trajectory file does not contain unit information.

  • time_unit (str) – Time unit of trajectory ('fs', 'ps', 'ns'). Necessary for correct conversion to internal dynasor units if the trajectory file does not contain unit information.

  • frame_start (int) – First frame to read; must be larger or equal 0.

  • frame_stop (Optional[int]) – Last frame to read. By default (None) the entire trajectory is read.

  • frame_step (int) – Read every frame_step-th step of the input trajectory. By default (1) every frame is read. Must be larger than 0.

property atomic_indices

Return copy of index arrays

property cell

Simulation cell

property filename

The trajectory filename

property frame_step

Frame to access, trajectory will return every frame_step-th snapshot

property n_atoms

Number of atoms