I made a custom pair style that uses a full neighbor list. When I increase the cutoff past a certain level, some atoms get included twice (although the cutoff is still smaller than the box size).
Specifically, when looping over atoms “ii”, the pair atoms “jj” are listed with
jlist = firstneigh[i];
jnum = numneigh[i];
In my case, when I reach a certain cutoff, “jlist” starts to include atoms of the same tag more than once.
Are there any reasons this would happen? I can provide source code if necessary.
I made a custom pair style that uses a full neighbor list. When I increase
the cutoff past a certain level, some atoms get included twice (although the
cutoff is still smaller than the box size).
you mean half the box size, right?
Specifically, when looping over atoms "ii", the pair atoms "jj" are listed
with
jlist = firstneigh[i];
jnum = numneigh[i];
In my case, when I reach a certain cutoff, "jlist" starts to include atoms
of the same tag more than once.
Are there any reasons this would happen? I can provide source code if
necessary.
yes, this is intentional.
for this reason, LAMMPS is not subject to minimum image conventions,
but can use cutoffs large than half the (shortest) box length.
please note that the cutoff for the neighborlist is usually larger
than the largest pairwise cutoff, due to the use of the neighbor list
skin, which in turn allows to reuse the same neighbor list for
multiple steps (if atoms move slow enough).
I tried doing something similar, but unfortunately I have a strange situation where I need a cutoff greater than half the box size (this is a potential where different parameters are defined for each atom pair).
I was wondering if there is a way to avoid double counting even when the cutoff is greater than half the box size. Ideally my cutoff should be the box size in the case of this special potential.
I tried doing something similar, but unfortunately I have a strange
situation where I need a cutoff greater than half the box size (this is a
potential where different parameters are defined for each atom pair).
I was wondering if there is a way to avoid double counting even when the
cutoff is greater than half the box size. Ideally my cutoff should be the
box size in the case of this special potential.
but then you have to properly consider periodic images and address the
fact that you will have multiple atoms with the same tag accordingly.
this is not double counting, but proper counting of the interactions.
If I understand correctly, you want to include the nearest periodic image of j in the neighbor list of i, and exclude all other periodic images. This problem is already solved by LAMMPS by constructing special neighbor lists for things like harmonic or FENE bonds. See neigh_bond.cpp and bond_harmonic.cpp. If you don’t want to modify your neighbor list because you are using it for others interactions, then you will have to add some code to your force loop over the jnum neighbors of i, storing each new value of jtag in a temporary list, and skipping the force calculation for recurring values.