About change_box command

Hi all,

I have encountered a strange problem when using the change_box command.
My simulation box’s boundary is s s s(non-period and shrink-wrapped). When I used this command in my script:
change_box all x final 0 30 y final 0 30 z final 0 30 remap units box
I observed that the low box domain is not located at 0, but some values near 0.

And when I added this command to change my box to periodic in three dimensions:
change_box all boundary p p p
Then, the change_box works properly, and the low box boundary is exactly zero.

Could you please give me some advice? Thanks for your time and kind help!

Best regards,
Shusen Guo

Presumably the box is being shrunk “from below” – that is, in (for example) the x-direction, the particle with smallest x-coordinate has x > 0 and thus the xlo boundary is being shifted to that value.

From my memory, you can specify separate treatments for (non-periodic) low and high boundaries – for example, fs should fix the lower boundary and shrink the upper boundary.

Regardless of how you change your box, with shrinkwrap boundaries, the position of the atoms determines the boundaries, i.e. if you try to expand the box, it will “snap back” instantly. So there is nothing unexpected in what you observe.

Hi srtee and akohlmey,

Really appreciate your kind help.
I compared the atomic coordinates before and after the change_box and observed that the change_box behaves differently for boundary ppp and sss.
For periodic boundary, the lowest coordinate of atoms (for example, x dimension) is set to be approximately 0.002, and xlo is exactly zero.
While for the shrink-wrapped boundary, the lowest coordinate of atoms is set to be a positive value close to zero (for example, 1e-14). And the xlo is around -0.002 in this case.
It seems that the box boundary has a margin of 0.002 in these cases.

My lammps version is LAMMPS (2 Aug 2023 - Update 1)

This is a test script. Thanks for your help

units		lj
atom_style	atomic
boundary	s s s

lattice		fcc 0.8442
region		box block 0 10 0 10 0 10
create_box	1 box
create_atoms	1 box
mass		1 1.0

pair_style	lj/cut 2.5
pair_coeff	1 1 1.0 1.0 2.5

neighbor	0.3 bin
neigh_modify	every 20 delay 0 check no


thermo          1
thermo_style    custom  time press density etotal
dump            1   all custom 1  xyz.*.lammpstrj  id type x y z
min_style       cg
minimize        0.0 1.0e-10 1000 1000


variable        BX  equal   lx
variable        BY  equal   ly
variable        BZ  equal   lz
#change_box      all  boundary p p p
change_box      all  x final 0 ${BX}   y final 0 ${BY}   z final 0 ${BZ}   remap   units box  
write_dump      all custom   xyz.*.lammpstrj  id type x y z

Using change_box to adjust box boundaries for shrinkwrap boundaries is a pointless operation. You have to change the box boundaries, e.g. to m m m for change_box to have a meaning.

Thanks for your help.

Best regards,
Shusen Guo