-
Notifications
You must be signed in to change notification settings - Fork 824
Description
Expected behavior
This data file attached below is a topology file (in MDAnalysis lingo) for a single ring polymer in cylindrical simulation box. The polymer in the input data file (test_already_recentered_in_LAMMPS.data.txt) is already centered at the origin (the center of geometry (COG) of the polymer is at the center of box at (0, 0, 0)), with x, y, and z values ranging from
Background
The fix recenter command in LAMMPS and similar commands in other MD packages constrain the center-of-mass position of a group of atoms (an AtomGroup in MDAnalysis lingo) by adjusting the coordinates of the atoms every timestep, which helps the user later conveniently apply some measurement on a trajectory file; moreover, this option "can be used to ensure the entire collection of atoms (or a portion of them) do not drift during the simulation due to random perturbations (e.g. fix langevin thermostatting)." (from LAMMPS documentation).
What is the problem in MDAnalysis?
In version 2.3, MDAnalysis reads the coordinates as they were and the user could apply transformation if needed. However, in version 2.4, I have noticed that MDAnalysis automatically translates the box to the origin, which destroy all the re-centering operations done during a simulation. Please see the implementation of DumpReader in version 2.3 here (the last lines of the DumpReader class at end of the html page) and compare it with this line in version 2.4.
Actual behavior
When running the code with MDAnalysis version 2.4.3, the resulting test_written_by_mda.data file shows that the polymer is shifted to the center of the box at
Code to reproduce the behavior
- Download the following files:
- test_already_recentered_in_LAMMPS.data.txt (topology file)
- test_already_recentered_in_LAMMPS.lammpstrj.txt (associated trajectory file)
- Use the following Python code to reproduce the behavior:
import MDAnalysis as mda
# drop the ".txt" from the enda of attached files before running this code
topo = "./test_already_recentered_in_LAMMPS.data"
trj = "./test_already_recentered_in_LAMMPS.lammpstrj"
u = mda.Universe(topo, trj, topology_format='DATA', format='LAMMPSDUMP', lammps_coordinate_convention='unscaled',
unwrap_images=False, atom_style="id resid type x y z")
for ts in u:
with mda.Writer("test_written_by_mda.data") as W:
W.write(u.atoms)Current version of MDAnalysis
- Which version are you using? 2.4.3
- Which version of Python ? 3.11.3
- Which operating system? macOS Big Sur Version 11.7.4