Troubles with change_box

Hi all:

I am trying to deform my simulation box, which is a Y2O3-ZrO2 bicrystal, by using the “change_box” command. I do not want to change the volume, so I used the following line:

change_box all y scale 1.02 z volume z scale 0.98

It actually changes the Ly and Lz length as specified, but does not keep the volume constant. I tried also:

change_box all x scale 1.1 z volume

(an example taken from the LAMMPS site), but it changes the volume as well.

I am running the latest LAMMPS version (April 20, 2012) made with the "USER-EWALDN” package. My script follows:

lattice custom 20.520 a1 1 0 0 a2 0 1.1855 0 a3 0 0 6.326 basis 0 0 0
read_restart restart.sigma5.mobility
kspace_style ewald/n 1.0e-4

change_box all x scale 1.1 z volume
#or change_box all y scale 1.02 z volume z scale 0.98

#Output settings, fixes, etc…

I am also attaching the restart file, just in case it may be needed. Any help, please? Thank you in advance


Juan J. Meléndez
Associate Professor
Department of Physics · University of Extremadura
Avda. de Elvas, s/n 06006 Badajoz (Spain)
Phone: +34 924 28 96 55
Fax: +34 924 28 96 51
Email: melendez@…1779…

restart.sigma5.mobility (259 KB)


you have run into a bug in the code for the change_box command.

i am looking into it right now.

more later,


as it turns out, there were multiple bugs.
please find attached a patch that corrects
them or use the attached source file to
replace the corresponding file in your tree.
let us know, if there are still any problems.

good luck,

change_box.cpp.gz (3.44 KB)

lammps-change-box-fix.diff.gz (777 Bytes)

posted this as a patch - see if you
agree with the changes Axel - I did
it a bit differently.