[lammps-users] Image flag calculation

Hi,
I am trying to figure out how image flags are calculated in LAMMPS. I
know that from the 1Oct2006 release the image flags are calculated using
bitwise operations. I did look into the code. However, I don't quite
understand the bitwise operations performed to calculate the atom
images. It would be a great help if someone could explain the procedure.

Thanks,
Arun

All 3 image counts (x,y,z) are stored in one int, so each takes 10 bits.
Initially, each is set to 512, which effectively means "no image" or
the atom is in the original box. Each time it crosses a periodic boundary
it is incremented/decremented. And if it gets to 0 or 1023, then it
wraps around. So if your atom goes thru the box 512 times
(in the same direction) it's image flag will jump by +/- 1024.

Steve