[lammps-users] small neighborlists

Dear LAMMPS users and developers,

My question is about accessing neighborlists, but I’ll explain what this code is for in case someone is interested.

I’m working on a repulsion potential between bonds for use in DPD simulations. This prevents one bond from pass through another which is sometimes a problem with DPD. If the distance between two non-connected bonds is less than a cutoff, then a repulsive force is applied.

This is essentially a four-body, nonbond potential, so I’ve added it as a pair style that can be used with hybrid overlay. Because the force occurs between pairs of bonds, instead of atoms, a list of pairs of bonds is maintained that should be have their distance checked, and this list is rebuilt whenever the regular neighborlists are rebuilt. Some nice features are: the bond-bond distance can be computed several ways, the force is distributed among atoms depending on where the bonds cross, and bond crossings can be detected. There is also mixing for different bond types, and a skin distance for the bond pair list can be set.

Here is my question:

When I use a very small number of atoms for a test, say 4 atoms with two bonds… then my pair_style has list->inum as zero (which means I can’t access neighbors), while other pair_styles have nonzero inum. I am checking at the top of compute(). If I include a few more atoms/bonds, everything is OK (firstneigh[] has the same info).

Any ideas? The only real difference with the other pair styles is that I need domain.h.

neighbor 2.0 bin
neigh_modify every 1 delay 0 check no #other have same result


When I use a very small number of atoms for a test, say 4 atoms with two bonds... then my pair_style >has list->inum as zero (which means I can't access neighbors), while other pair_styles have nonzero i>num. I am checking at the top of compute(). If I include a few more atoms/bonds, everything is OK >(firstneigh[] has the same info).

I don't understand this. There are various settings your pair style can
make when it requests a neighbor list, and it needs to set cutoffs
correctly, but if you do this, then your pair style is no different than
any other pair style that uses a neigh list under pair hybrid. So I don't
see how those pair styles could get a complete neighbor list, and
yours does not.


I think my problem centers around having bond types in a pair style.

I want the lammps script to accept bond types in the pair_coeff, since this potential is defined between two bonds. However, pair_hybrid thinks its looking at atom types and will either throw an error or not treat setflag/nmap correctly if the number of atom types does not equal bond types.

I don’t want to change pair_hybrid_overlay, so it might be easiest just to scrap the individual pair coeffs.


You can't send in atom type values that aren't valid. I would probably
encode the bond type values you want as arguments to the
pair style or pair coeff command, but not mess with the atom
type values - you could just ignore them in your Pair::coeff() routine.


Thanks for your help. The new pair_style is working well in serial. Yet another question:

What is the best way to access topology of ghost atoms, or is this even communicated?

I am looking at neighbor->bondlist to see if bonds are close together. But this only includes bonds on my processor, which means at least one atom of the bond is not a ghost… I need to see the bonds between two ghost atoms, otherwise some bond-bond interactions might be ignored.

If the ghost topol isn’t available, can someone recommend a fix or compute that would be a good template for adding this communication?


Bond lists for ghost atoms are not communicated. Your pair style
can invoke its own communication (look for comm->forward_comm_pair(this);
and reverse() calls in pair styles, e.g. eam)

and you could then comm whatever you want. Though a bond
list would be a bit tricky b/c of its variable length.