Atom index exceeds the number of atoms

Hi,

I’m adding my own pair potential based on ‘pair_sph_heatconduction.cpp’ in the ‘USER-SPH’ package. Like other pair potentials, in the ‘compute’ function of this routine, it would usually involve loop over all atom pairs like this

for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
itype = type[i];
jlist = firstneigh[i];
jnum = numneigh[i];

for (jj = 0; jj < jnum; jj++) {
j = jlist[jj];
j &= NEIGHMASK;

delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delxdelx + delydely + delz*delz;
jtype = type[j];


Since there are something abnormal with my simulation, I’m debugging my pair potential by printing out information of each atom. However, I found that some of the atom index j has exceeded the number of atoms in my system. For example, there are 1440 atoms in my system and the number j printed out can be as large as 2300. I ran my code with both serial and MPI version, and got the same output.

So I’m a bit confused with this. Since I haven’t fully understood the data structure of lammps, I’m wondering if it is normal that an atom index can exceed the number of atoms in lammps?

Thanks.

Shule

Yes, it is normal as those are ghost atoms, i.e., periodic images of
local atoms.

Ray

I see. Thanks a lot.

Yes, it is normal as those are ghost atoms, i.e., periodic images of
local atoms.

Ray