Trajectory handling#
- class dynasor.Trajectory(filename, trajectory_format, atomic_indices=None, length_unit=None, time_unit=None, 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 specify the species and the values are a list of atomic indices, (2)'read_from_trajectory'
, in which case the species are read from the trajectory or (3) the path to a gromacs index file.length_unit (
Optional
[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. If no length unit is specified and the reader cannot read units from the trajectory, Angstrom is assumed.time_unit (
Optional
[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. If no time unit is specified and the reader cannot read units from the trajectory, fs is assumed.frame_start (
Optional
[int
]) – First frame to read; must be larger or equal0
.frame_stop (
Optional
[int
]) – Last frame to read. By default (None
) the entire trajectory is read.frame_step (
Optional
[int
]) – Read everyframe_step
-th step of the input trajectory. By default (1
) every frame is read. Must be larger than0
.
- property atomic_indices: dict[str, list[int]]#
Return copy of index arrays
- property filename: str#
The trajectory filename
- property frame_step: int#
Frame to access, trajectory will return every
frame_step
-th snapshot.
- property n_atoms: int#
Number of atoms