PBC problem with atoms coordinates

Dear Sir/Madame,

I used PBC in LAMMPS simulation of a polymer with many freely diffused atoms, by using below command in my script.

boundary p p p

While in the system describing file I have defined the box:

-4.5000000000000000e+01 4.5000000000000000e+01 xlo xhi
-4.5000000000000000e+01 4.5000000000000000e+01 ylo yhi
-4.5000000000000000e+01 4.5000000000000000e+01 zlo zhi

I run simulation for 10**9 time steps, but in the dump file every saved stage have more and more widely distributed diffused atoms. One of them has 45.3 -112.5 and 538.12 coordinates, while if I understand correctly, they should not go further than -45 45 range,they should be always in the box.

What could I do to stop spreading my system and simulate truly PBC, where the atom that cross the edge of the box will appear on the other site within the box?

Best regards,



this is not about what is being simulated, but how you output and/or visualize the trajectory data.

LAMMPS will always apply periodic boundary conditions correctly if you have requested them, so you do simulate PBC.

However, it depends on the kind of analysis that people want to do, whether you want the “wrapped” or “unwrapped” coordinates.
The trajectory of the “unwrapped” coordinates is actually the “true” trajectory.
In most cases, this is the preferred way to output your trajectory, since it is straightforward to later wrap coordinates back into the principal cell during post-processing, but it is much more complex and complicated to regenerate the unwrapped coordinates.

you only get such unwrapped coordinates if you either explicitly request them in your input, or use a file format that stores not only the coordinates but also the image flags and then the unwrapping is done as part of loading the trajectory in your visualization software.

More details about image flags and output options are in the documentation for the dump command.


Dear Axel,

Thank you for explanation. I used some options in VMD to coordinate wrapping and now it really looks like I expected.

I used: