I got a dump file with wrapped coordinate “ux,uy,uz”. And I am writing a python code to convert the dump to a dump with unwrapped coordinate “x, y, z”. And I use the method “fmod” in numpy package to get the reminder of (wrapped coordinate)/(box length). And the unwrap coordinate is computed by (the origin of box) + (reminder). But I found the results deviates from the lammps results. For example, the x unwrapped coordinate in my code is 1.922400000000000020e+01, while the lammps given as 19.1946. The y and z coordinates seems right and is coincide with lammps results. Why is this difference? Is my computation wrong? Thanks.
Thanks for you reply. I think it results from the second comment. The atoms in my system have traveled through the box 206 times. Is there a existing code to convert the wrapped dump file to a unwrapped one?
Converting from wrapped to unwrapped is tricky, since you have to rely on the heuristic that atoms have not moved more than half a box length between two frames and then compare the current frame to the previous frame. If the trajectory was not written with a sufficient frequency, it is not possible.
I primarily use VMD for pre-/post-processing, visualizing, and analyzing trajectories and it has script tools included for both, wrapping and unwrapping of trajectories as well as trying to rejoin molecules that were broken due to coordinate wrapping with a variety of options. Of course, it is similarly subject to imprecise coordinate and box data.