From 570c574f44444d3c8dd752886df8594bdc7e090c Mon Sep 17 00:00:00 2001 From: Philip Loche Date: Wed, 29 Jun 2022 17:23:07 +0200 Subject: [PATCH] Shift lammps coordinate lower limit to 0 --- package/MDAnalysis/topology/LAMMPSParser.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/package/MDAnalysis/topology/LAMMPSParser.py b/package/MDAnalysis/topology/LAMMPSParser.py index e89760f8b87..21a69bd072e 100644 --- a/package/MDAnalysis/topology/LAMMPSParser.py +++ b/package/MDAnalysis/topology/LAMMPSParser.py @@ -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: @@ -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):