Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
LAMMPSDUMP should check when returning corrdinates scaled with box dimensions #2135
Loading the testfile wat.lammpstrj should return the input coordinates.
The coordinates returned by the reader are scaled with the box dimension.
Code to reproduce the behavior
import MDAnalysis as mda u = mda.Universe('wat.lammpstrj', format='LAMMPSDUMP') print (u.atoms.positions)
returns the expexted coordinates.
Currently version of MDAnalysis
I tried 0.19.0 and 0.19.1. For some reason the same command with 0.19.2 returns an
I realized in your corresponding test in
So maybe I'm missing something in case this is done on purpose but in the source code I also did not see where the multiplication by the box length would happen...
@schlaicha the rescaling of coordinates is by design, it's done in this line: https://github.com/MDAnalysis/mdanalysis/blob/develop/package/MDAnalysis/coordinates/LAMMPS.py#L573
I couldn't reproduce the error you mention, could you give more details on this?
Okay sorry I missed this line, I see your intention now.
The freedom of LAMMPS dumps makes some work to interpret the files: xs are scaled coordinates, but x are unscaled (so sorry for the trouble, your test is correct).
What I guess one needs to do is to evaluate the ITEM: ATOMS id type x(s) y(s) z(s) lines in order to interpret the coordinates correctly. Note that there is also xu and xus, https://lammps.sandia.gov/doc/dump.html.
Yeah it's no problem, maybe there should be an option to get the original coordinates, I just thought that the unscaled versions are the most useful to people?
So currently the dumpreader only works with the default format, and yeah #2131 looks like the place to get this working better.
But now you are assuming scaled coordinates, right? I have no opinion what is more useful, I guess it just needs to be clear why and what the dumpreader does (which now I think is not obvious for the user).
I think the proper way is to evaluate the kind of coordinates and do the corresponding conversion directly, no need for another option (once #2131 is going to be implemented).