One problem with the code.

Hi,

I am trying to understand the code. I have some problem with the following part.

imagedata = ((imageint) IMGMAX << IMG2BITS) |
((imageint) IMGMAX << IMGBITS) | IMGMAX;

Since IMGMAX for 32-bit system is 512 isn’t imagedata always be 1?

Also what does this mean? I know that the imageflag is set by the set command to specify which image the atom in? I don’t understand the meaning of imagedata? What does this number mean? Also since this number is only 1? why should use imageint?

Thanks very much for your help?

Best!

Hao

Hi,

      I am trying to understand the code. I have some problem with the
following part.

imagedata = ((imageint) IMGMAX << IMG2BITS) |
           ((imageint) IMGMAX << IMGBITS) | IMGMAX;

it would be *extremely* helpful, if you'd also name the file and the
lines of the code that you are talking about.

Since IMGMAX for 32-bit system is 512 isn't imagedata always be 1?

not at all. for 32-bit imageint this evaluates to (512 << 20) | (512
<< 10) | 512 = 537395712 or 0x20080200

Also what does this mean? I know that the imageflag is set by the set
command to specify which image the atom in? I don't understand the meaning
of imagedata? What does this number mean? Also since this number is only 1?

with 32-bit ints for imageint, LAMMPS uses 10-bits to store image
information for x-, y-, and z (-512 to 512).
with the bitshifting, you can store all three 10-bit numbers in a
single integer.

why should use imageint?

so that when you compile with -DLAMMPS_BIGBIG, LAMMPS works correctly.
quite a lot of code that is contributed to LAMMPS is not 64-bit clean
and fails in these issues.

axel.