Loading atom coordinates from dump file in periodic boundary conditions

Dear LAMMPS community!

This is my system:

atom_style hybrid sphere dipole bond
boundary p p p
pair_style hybrid/overlay gran/hertz/history lj/cut/dipole/cut

pair_coeff 1 1 gran/hertz/history

region reg block 0.0 30.0 0.0 30.0 0.0 19.1889

create_box 1 reg

I am loading unwrapped atom coordinates and some characterictics from dump file in script file like this

create_atoms 1 single 0.888142 0.859957 0.198352 remap yes
set atom 1 diameter 0.1000000E+01
set atom 1 density 0.5008568E+00
set atom 1 mol 97
set atom 1 dipole 0.2571050E+03 0.6373690E+02 -0.2142280E+03

Or like wrapped coordinates with image like this

create_atoms 1 single 0.888142 0.859957 0.198352
set atom 1 diameter 0.1000000E+01
set atom 1 density 0.5008568E+00
set atom 1 mol 97

set atom 1 image 0 0 0
set atom 1 dipole 0.2571050E+03 0.6373690E+02 -0.2142280E+03

After I integrate the system by rigid/small:

fix groupgran all rigid/small molecule

As the result I have the output:

2700 rigid bodies with 27000 atoms

41.1434 = max distance from body owner to body atom

But if I load the system from restart file the output will be:

2700 rigid bodies with 27000 atoms

1.11804 = max distance from body owner to body atom

The rigid bogy consists of 10 overlapping spherical particles, maximum size of each body is 3. So I think there is a mistake in loading from dump and something is wrong with straddling the periodic boundaries. I cannot use restart as I make some changes with dipole moments of atoms before calculation. I will appreciate any help on how this can be fixed.

Faithfully yours,


You have to debug your script. Once you have inserted
a particle(s), you can write the coords to the screen or a dump file
and see if they are where you expect. Note that several commands

have “units” option for box or lattice units. If you mess that up,

your particles will not be where you expect.


Thank you for the reply. I studied again dump files on the 0 step of the simulation. Thus:

  1. coordinates are the same in all dumps
  2. The remapping does not change the image flags to non-zero values.
  3. When I set image by
    set atom 1 image -1 0 0
    the output is

Setting atom values …
1 settings made for image
But in fact in dump the image remains ix=iy=iz=0

When I load from restart image flags for appropriate atoms are non-zero.
So what is wrong? The bug of the version or my mistake? My version is 14 Aug 2013.


I would try the current version.

The attached script puts the values you would expect in the dump


in.lj (573 Bytes)

Here it is


Hello, Steve!

The current version is writing image flags, but now in the output I have:

0 = max distance from body owner to body atom

Could this be OK? In the earlier version (compilled by mkl) I had 1.11.

Beside this, mkl old version is counting flags for unwrapped coordinates when you load data file.


yes, that’s probably not a good sign.

I suggest you debug by reading in a single
rigid body, and moving it around so it crosses
periodic boundaries if that seems to be an issue.


Well I am not sure, so I attach my dump, log and script. The straddling begins on the step 1940. In the simulation I have one atom rigid body in the constant position and a rigid body of 10 spheres moving in -y direction. During the straddling image flags are changing, but in the end body appears in the same image as the immobile atom. Not sure this is OK. Anyway, max distance is 0, but in such body it should be more than 1. Could you possibly check on your compilation?


Пятница, 14 февраля 2014, 8:51 -07:00 от Steve Plimpton <[email protected]…24…>:

in.sin_rig (3.62 KB)

log.lammps (7 KB)

dump.sinrig (548 KB)

The max distance is not a dynamic value. It is
pre-computed once when you define your system.
So it’s either right or wrong - it doesn’t

Don’t know what you mean by “my compilation”.
My version is always the current version of LAMMPS.

If you are running an older version, you can (should)
check it against the current version yourself.


I am talking about the current version (1Feb14). I just want to understand is this the problem of my making of lammps by intel compiller (though i have the same results by either make.serial or make.mkl) or its the problem of the script or the code itself. I do not think that the defined rigid body can have max distance 0. It consists of 10 overlapping spheres arranged in two rows, length is 3 and width is 1,5 (lj units). That is why I ask you to check on your PC.
The changing of unwrapped coordinates described in my previous message also concerns the current version of lammps.
In the older version (1Aug14) of lammps I had max distance 1.11, but I could not change image flags from the script.


Hello, Steve.

The problem with zero max distance can be solved by changing line 1395 in fix_rigid_small.cpp
now: buf[m++]=ubuf(bodytag[i]).i
should be: buf[m++]=ubuf(bodytag[i]).d


yes, good catch
made the change, will be in next patch