pyscal Trajectory#

Trajectory is a pyscal module intended for working with molecular dynamics trajectories which contain more than one time slice. Currently, the module only supports LAMMPS dump text file formats. It can be used to get a single or slices from a trajectory, trim the trajectory or even combine multiple trajectories. The example below illustrates various uses of the module.

Start with importing the module

from pyscal3 import Trajectory

Read in a trajectory.

traj = Trajectory("traj.light")

When using the above statement, the trajectory is not yet read in to memory. Just the basic information is available now.

traj
Trajectory of 10 slices with 500 atoms

We can know the number of slices in the trajectory and the number of atoms. Trajectory only works with fixed number of atoms.

Now, one can get a single slice or multiple slices just as is done with a python list. Getting the 2nd slice (counting starts from 0!).

sl = traj[2]
sl
Trajectory slice
 2-2
 natoms=500

This slice can now be converted to a more usable format, either to a pyscal3 System or just written to another text file. Convert to a pyscal3 System object,

sys = sl.to_system()
sys[0].show.all()