Hello,

This may have been answered already in the mailing list, but I couldn’t find anything that matched this exactly so I figured I’d ask. I’m trying to construct a periodic graph, meaning there are no vertices for ghost atoms, only real atoms. I’ve created a pair style to do the neighbor list construction, but when I use the following lines:

inum = list->inum;

ilist = list->ilist;

numneigh = list->numneigh;

firstneigh = list->firstneigh;

for(ii = 0; ii < inum; ii++){

i = ilist[ii];

itype = map[type[i]];

xtmp = x[i][0];

ytmp = x[i][1];

ztmp = x[i][2];

jlist = firstneigh[i];

jnum = numneigh[i];

for(jj = 0; j < jnum; j++){

j = jlist[jj];

j &= NEIGHMASK;

delx = xtmp – x[j][0];

dely = ytmp – x[j][1];

delz = ztmp – x[j][2];

rsq = delx*delx + dely*dely + delz*delz;

if(rsq > 0 && rsq < cut*cut){

const double r = sqrt(rsq);

int neighbor = j;

double neighbor_dist = r;

}

}

}

The issue is that the value for j is sometimes greater than the total number of atoms, which I’m assuming means that it’s the ID of a ghost atom. Is this correct? If so, how can I access the real atom ID for the ghost atom j? Please let me know if this has already been answered or if anything is unclear.

Thanks and regards,

James