Hi everyone,
Thanks for the great tool! I am trying to access the velocity of each atom in a lammps trajectory (see attached image for a screenshot of the lammpstrj file) for 1 frame at a time. In my code, I have the tried the following:
import MDAnalysis as mda
lammps_data = "npt_stp04.data"
lammps_trajectory = "dump_npt_step04.lammpstrj"
data = mda.Universe(lammps_data, lammps_trajectory, format="LAMMPSDUMP", has_velocities = True)
choice_atoms = data.select_atoms("type 63")
for ts in data.trajectory:
reference = choice_atoms.ts.velocities
I got the following error
NoDataError Traceback (most recent call last)
<ipython-input-108-7356210d6102> in <module>
1 for ts in data.trajectory:
----> 2 reference = choice_atoms.ts.velocities
~/opt/anaconda3/lib/python3.8/site-packages/MDAnalysis/coordinates/base.py in __getattr__(self, attr)
488 # special-case timestep info
489 if attr in ('velocities', 'forces', 'positions'):
--> 490 raise NoDataError('This Timestep has no ' + attr)
491 err = "{selfcls} object has no attribute '{attr}'"
492 raise AttributeError(err.format(selfcls=type(self).__name__,
NoDataError: This Timestep has no velocities
Please advise on what to do. Thank you very much!