[lammps-users] how does the neighbor list work?

Hi Steve,

I’d like to confirm how the neighbor list works. It seems that if (newton_pair || j < nlocal), mutual neighboring pairs are only listed once and stored in one atom’s neighbor list.
For example, atom i and j are mutual neighbors in cutoff distance. So the j will appear in i’s neighbor list, then i wont be in j’s neighbor list. Is that the case?
Does it mean that when calculating forces and energies, these for both atom i and j should be stored at the same time, if (newton_pair || j < nlocal).

Thanks,
Jiangting

Jianting,

Neighbor lists have two modes: either full or half. The full mode, which is referred to newton throughout pair functions, has a dual representation for atoms: atom j shows up in the neighbor list of atom i and vice versa. The case you are describing corresponds to the half mode, which is the default mode. In this case atom pairs indeed only appear once when (j < nlocal). In this case forces and energies will have to be stored on either of the atoms in the contributing pair. Note that summation of all these atom-based energies will lead to 2*E_total.

Pieter

To clarify Pieter's comment, the newton setting actually has no effect
on neighbor lists, only on how forces are computed using the neighbor lists.

If its a "full" neighbor list, each atom stores all its neighbors. So the i,j
pair will be in the list twice. If its a "half" list, each i,j appears exactly
once in the list, either with atom I or atom J.

Steve

Sorry, scratch this comment. I forgot that the newton setting does affect
the ghost atom storage. Full neighbor lists are as I said. But for half
lists, the I,J pair will be stored by both atom I and atom J if they are
on different procs, i.e. one of them is a ghost on both processors.

Steve