(no subject)

Hello List,

I’ve encountered a peculiarity in LAMMPS concerning the generation of neighborlists with neighbors of ghosts included. It is possible to have a fix request such lists by setting the ‘ghost’ flag of the neighborlist request object. The routine that generates such a list (i.e. Neighbor::full_bin_ghost) uses values from the cutneighghostsq array in the neighbor class. However, this array is only ever initialized if the ‘ghostneigh’ property in the current pairstyle is set to 1. Otherwise the neighborlist ist built using uninitialized data.

This behavior is unexpected. A request for a neighborlist with ghost=1 shoulf fail for a pairstyle with ghostneigh=0.

Fo my fix I need neighbors of neighbors (this includes neighbors of ghost atoms). I worked around it by setting the ghostneigh flag of the current pairstyle to 1 and initializing cutneighghostsq to cutneighsq from within my fix code. This feels a bit (very) hackish.

Daniel

I'll take a look. Thanks for the careful explanation.

Steve

It is possible to have a
fix request such lists by setting the 'ghost' flag of the neighborlist
request object.
This behavior is unexpected.

Well, we have never thought about what you are trying to do.
The only other fix that does this is qeq/reax which is only
used with ReaxFF, which also uses ghost neighbors.
So LAMMPS currently only uses the the ghost option
with pair styles where it becomes a feature of the primary
neighbor list.

Is your fix wanting to use the ghost info every timestep, or
just occasionally? I presume you want your fix to have this
info even if the pair style does not need it?

Steve

Is your fix wanting to use the ghost info every timestep, or
just occasionally? I presume you want your fix to have this
info even if the pair style does not need it?

I’m not sure yet if it will be needed at every timestep or just every 5th, 10th etc. But indeed I need the info even if the pairstyle does not need it. Furthermore I’ll currently have to manually make sure the ghost atom layers are thick enough so that every ghost neighbor of a real atom has a full neighbor list (essentially that means having a ghost layer thickness of twice the potential cut-off (plus padding)). I use the ‘communicate’ command for that. Maybe I can trigger that from within my fix as well.
Daniel

I ended up applying this patch:

— a/src/neighbor.cpp
+++ b/src/neighbor.cpp
@@ -253,8 +253,8 @@ void Neighbor::init()

if (force->pair && force->pair->ghostneigh) {
cut = force->pair->cutghost[i][j] + skin;

  • cutneighghostsq[i][j] = cut*cut;
    }
  • cutneighghostsq[i][j] = cut*cut;
    }
    }
    cutneighmaxsq = cutneighmax * cutneighmax;

This ensures that cutneighghostsq is initialized in every case. If force->pair->ghostneigh is not set (i.e. no specific ghost cut-offs are supplied) the regular cutoffs are used instead.
Daniel