add a new potential

No, I'm no clear on what you're trying to do. If J indexes
the neihbors of atom J, then some proc knows those neighbors
and can compute that loop. The accumulated result f(j) can
be communicated to another processor if needed.

Steve

I will expalin it. If the u is the potential.
Then the interaction force on atomi is from the sum of forces of its neighbors atomj

for (i=0;i<inum;i++)
for(j=0;j<jnum;j++) ///atomj is the neighbor list of i
{
f[i]+=-du/drij/rij
f[j]-=-du/drij/rij

As the potential is a function of the coordination number (coord[i])*f(coord[j])
and coord[i] or coord[j] is the sum of the function of distance of the atom and its neighbors.
so there should be another loop for the derivate of coord[i]/dr
for (k=0;k<jnum;k++) /////k is the neighbor list of i
{
f[i]+=-du/dcoord[i] *dcoord[i]/drik
f[k]-=-du/dcoord[i] *dcoord[i]/drik
}
This should be done also for j because of the coord[j] term

for (l=0;l<lnum;l++) /////l is the neighbor list of l
{
f[j]+=-du/dcoord[j] *dcoord[j/drjl
f[l]-=-du/dcoord[j]*dcoord[j/drjl
}

}
The force acting on atomi and j are different from each other. Now I am using the half neighbor list, so the force acting on atomj must be added. If I turn the newton off and using the full neighbor list, there is the same problem because the force acting on the atomi partly comes from the other pairs jk.

2011/6/6 Steve Plimpton <[email protected]>

I'm not following all this. I'll simply say
that comm->forward() can communicate one
or more quantities from owned atoms to the
ghost atoms of other procs. Comm->reverse()
does the opposite, it communicates ghost atom
values back to the owning atoms, typically
summing the contributions from multiple ghost
images.

I have yet to see a potential where these kernels
are not sufficient to do the needed computations
in parallel, if you break them up in the proper way.

Steve