I’m trying to get an understanding of how LAMMPS runs in parallel, and as such I’ve been reading through the source code (specifically the Comm classes) and the wiki a lot. One thing I feel stuck on (and must be missing something) is where ghost particles are stored and if/how they are marked as such?
They are in the regular arrays (x, v, f, tag, etc.).
The distinction is that particles from 0 to atom->nlocal are “owned” atoms and from atom->nlocal to atom->nlocal + atom->nghost are ghost atoms. In many places in the code you’ll see: int nall = atom->nlocal + atom->nghost;
Per-atom arrays (unless they are explicitly only for “owned” atoms) are usually allocated to atom->nmax (which is the MAX() of nlocal+nghost across all MPI ranks).
1 Like