Skip to content

Commit

Permalink
Shift lammps coordinate lower limit to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
PicoCentauri committed Jun 29, 2022
1 parent 56cbf56 commit 570c574
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions package/MDAnalysis/topology/LAMMPSParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,16 @@ def read_DATA_timestep(self, n_atoms, TS_class, TS_kwargs,

header, sects = self.grab_datafile()

unitcell = self._parse_box(header)

try:
positions, ordering = self._parse_pos(sects['Atoms'])
except KeyError as err:
errmsg = f"Position information not found: {err}"
raise IOError(errmsg) from None

unitcell, lo = self._parse_box(header)
# Shift lower limit coordinates to 0
positions -= np.array(lo)

if 'Velocities' in sects:
velocities = self._parse_vel(sects['Velocities'], ordering)
else:
Expand Down Expand Up @@ -580,7 +582,7 @@ def _parse_box(self, header):
unitcell[:3] = x, y, z
unitcell[3:] = 90., 90., 90.

return unitcell
return unitcell, (x1, y1, z1)


class LammpsDumpParser(TopologyReaderBase):
Expand Down

0 comments on commit 570c574

Please sign in to comment.