JYJUNG
April 9, 2025, 11:03am
1
Dear users,
I’m currently working with a LAMMPS trajectory that contains only a subset of atoms (specifically, only carbon atoms were dumped from a larger system of 28,800 atoms). The dumped trajectory includes 9,600 C atoms, whose original LAMMPS atom IDs range up to [1, 4,7, … 28,798].
When I try to load this trajectory using:
trajectory_filename = 'dynasor.posvel'
traj = Trajectory(trajectory_filename,
trajectory_format='lammps_internal', frame_stop=500000)
I get the following error:
IndexError: index 9600 is out of bounds for axis 0 with size 9600
So, is there a way to tell dynasor
to treat the trajectory as self-contained, ignoring global atom ID expectations?
or do I have to dump all atoms and only uses specific atoms that I want to calculate?
Any advice or clarification would be really appreciated.
Thanks a lot!
Hi,
Could you provide the full error message to better understand where in dynasor its coming from?
You could also try to use the mdanalysis reader which should be able to parse lammps trajectories and see if that works.
JYJUNG
April 28, 2025, 8:53am
3
Sorry for late response,
Below is the error message.
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[45], line 2
1 trajectory_filename = 'dynasor.posvel'
----> 2 traj = Trajectory(trajectory_filename,
3 trajectory_format='lammps_internal', frame_stop=500000, atomic_indices = atomic_indice)
File ~\anaconda3\Lib\site-packages\dynasor\trajectory\trajectory.py:106, in Trajectory.__init__(self, filename, trajectory_format, atomic_indices, length_unit, time_unit, frame_start, frame_stop, frame_step)
104 # Get two frames to set cell etc.
105 frame0 = next(self._reader_obj)
--> 106 frame1 = next(self._reader_obj)
107 self._cell = frame0.cell
108 self._n_atoms = frame0.n_atoms
File ~\anaconda3\Lib\site-packages\dynasor\trajectory\lammps_trajectory_reader.py:191, in LammpsTrajectoryReader.__next__(self)
188 raise StopIteration
190 if self._first_called:
--> 191 self._get_next()
192 else:
193 self._get_first()
File ~\anaconda3\Lib\site-packages\dynasor\trajectory\lammps_trajectory_reader.py:175, in LammpsTrajectoryReader._get_next(self)
173 self._x[II] = data[:, self._x_I]
174 else:
--> 175 self._x[II] = self._x_map(data[:, self._x_I])
176 if self._v_I is not None:
177 self._v[II] = data[:, self._v_I]
IndexError: index 9600 is out of bounds for axis 0 with size 9600
Also, I have attached a part of dump file.
dynasor.txt (14.1 KB)