Dear LAMMPS Community,
I am facing an issue with repositioning atoms when changing the simulation box in periodic boundary conditions. Below is the detailed description.
Currently, I have a data file containing some polymer chains, the simulation box is PBC in three dimensions, and some atoms are out of the box which are in the image box. I am trying to expand the simulation box in the Z direction with the command change_box all z final -30 96 . The box did enlarge in the Z direction, however, the atoms that were out of the original box did not “unwrap” in the new box, resulting in bad bond connectivity for the atoms in the original image box.

How can I enlarge the box ensuring the atoms are in the right place? Any guidance or suggestions would be greatly appreciated!
The input file and the data file are uploaded below.
in_temp.in (884 Bytes)
UA-beads.data (1.8 MB)
This only happens because the atoms are outside the box in the original data file.
There are no (non-zero) image flags in the data file.
There would be more complex ways to do this, if your data file did have non-zero image flags set, but in this case the most straightforward way is to just edit the “zlo zhi” parameters in the data file directly with a text editor.
1 Like
I had the same problem and resolved by creating a simulation box first and loading the system after.
# Load the unwrapped coordinates into a larger box.
region newbox block 0 35.935 0 107.805 -30 100
create_box 4 newbox bond/types 1 extra/bond/per/atom 2 angle/types 2 extra/angle/per/atom 3 dihedral/types 2 extra/dihedral/per/atom 2 improper/types 1 extra/improper/per/atom 1
read_data UA-beads.data add merge
The number of extra/stuff/per/atom is printed by LAMMPS when you simply load the original data file.
2 Likes
Thank you for your reply. I had the same idea as you at first. I looked for similar problems on the forum but didn’t see any. So I wanted to know how everyone solved this problem.
