clean up code and comments

This commit is contained in:
Steve Plimpton
2023-07-10 12:53:02 -07:00
parent ce1a084a0e
commit 07f42930ff
6 changed files with 35 additions and 27 deletions

View File

@ -405,7 +405,8 @@ int ComputePropertyLocal::count_pairs(int allflag, int forceflag)
if (!(mask[j] & groupbit)) continue; if (!(mask[j] & groupbit)) continue;
// itag = jtag is possible for long cutoffs that include images of self // itag = jtag is possible for long cutoffs that include images of self
// do not need triclinic logic here b/c neighbor list itself is correct
if (newton_pair == 0 && j >= nlocal) { if (newton_pair == 0 && j >= nlocal) {
jtag = tag[j]; jtag = tag[j];
if (itag > jtag) { if (itag > jtag) {

View File

@ -83,11 +83,12 @@ void NPairHalfBinNewtonTri::build(NeighList *list)
} }
// loop over all atoms in bins in stencil // loop over all atoms in bins in stencil
// pairs for atoms j "below" i are excluded // for triclinic, bin stencil is full in all 3 dims
// below = lower z or (equal z and lower y) or (equal zy and lower x) // must use itag/jtag to eliminate half the I/J interactions
// (equal zyx and j <= i) // cannot use I/J coord comparision
// latter excludes self-self interaction but allows superposed atoms // b/c transforming orthog -> lambda -> orthog for ghost atoms
// with an added PBC offset can shift all 3 coords by epsilon
ibin = atom2bin[i]; ibin = atom2bin[i];
for (k = 0; k < nstencil; k++) { for (k = 0; k < nstencil; k++) {
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
@ -107,25 +108,9 @@ void NPairHalfBinNewtonTri::build(NeighList *list)
} else { } else {
if (x[j][0] < xtmp) continue; if (x[j][0] < xtmp) continue;
} }
//if (x[j][2] < ztmp) continue;
//if (x[j][2] == ztmp) {
// if (x[j][1] < ytmp) continue;
// if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
// }
} }
} }
/*
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp) {
if (x[j][0] < xtmp) continue;
if (x[j][0] == xtmp && j <= i) continue;
}
}
*/
jtype = type[j]; jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
@ -135,8 +120,6 @@ void NPairHalfBinNewtonTri::build(NeighList *list)
rsq = delx*delx + dely*dely + delz*delz; rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) { if (rsq <= cutneighsq[itype][jtype]) {
//printf("NEIGH i,j %d %d ijtag %d %d dist %g\n",
// i,j,tag[i],tag[j],sqrt(rsq));
if (molecular != Atom::ATOMIC) { if (molecular != Atom::ATOMIC) {
if (!moltemplate) if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]); which = find_special(special[i],nspecial[i],tag[j]);

View File

@ -89,7 +89,12 @@ void NPairHalfNsqNewton::build(NeighList *list)
} }
// loop over remaining atoms, owned and ghost // loop over remaining atoms, owned and ghost
// use itag/jtap comparision to eliminate half the interactions
// itag = jtag is possible for long cutoffs that include images of self // itag = jtag is possible for long cutoffs that include images of self
// for triclinic, must use delta to eliminate half the I/J interactions
// cannot use direct I/J coord comparision as for orthog
// b/c transforming orthog -> lambda -> orthog for ghost atoms
// with an added PBC offset can shift all 3 coords by epsilon
for (j = i+1; j < nall; j++) { for (j = i+1; j < nall; j++) {
if (includegroup && !(mask[j] & bitmask)) continue; if (includegroup && !(mask[j] & bitmask)) continue;

View File

@ -70,6 +70,11 @@ void NPairHalffullNewton::build(NeighList *list)
ztmp = x[i][2]; ztmp = x[i][2];
// loop over full neighbor list // loop over full neighbor list
// use i < j < nlocal to eliminate half the local/local interactions
// for triclinic, must use delta to eliminate half the local/ghost interactions
// cannot use direct I/J coord comparision as for orthog
// b/c transforming orthog -> lambda -> orthog for ghost atoms
// with an added PBC offset can shift all 3 coords by epsilon
jlist = firstneigh_full[i]; jlist = firstneigh_full[i];
jnum = numneigh_full[i]; jnum = numneigh_full[i];

View File

@ -27,9 +27,17 @@ void NStencilHalfBin2dTri::create()
{ {
int i, j; int i, j;
// for triclinic, need to use full stencil in all dims
// not a half stencil in y
// b/c transforming orthog -> lambda -> orthog for ghost atoms
// with an added PBC offset can shift both coords by epsilon
// thus for an I/J owned/ghost pair, the xy coords
// and bin assignments can be different on I proc vs J proc
nstencil = 0; nstencil = 0;
for (j = 0; j <= sy; j++) for (j = -sy; j <= sy; j++)
for (i = -sx; i <= sx; i++) for (i = -sx; i <= sx; i++)
if (bin_distance(i, j, 0) < cutneighmaxsq) stencil[nstencil++] = j * mbinx + i; if (bin_distance(i, j, 0) < cutneighmaxsq)
stencil[nstencil++] = j * mbinx + i;
} }

View File

@ -27,9 +27,15 @@ void NStencilHalfBin3dTri::create()
{ {
int i, j, k; int i, j, k;
// for triclinic, need to use full stencil in all dims
// not a half stencil in z
// b/c transforming orthog -> lambda -> orthog for ghost atoms
// with an added PBC offset can shift all 3 coords by epsilon
// thus for an I/J owned/ghost pair, the xyz coords
// and bin assignments can be different on I proc vs J proc
nstencil = 0; nstencil = 0;
//for (k = 0; k <= sz; k++)
for (k = -sz; k <= sz; k++) for (k = -sz; k <= sz; k++)
for (j = -sy; j <= sy; j++) for (j = -sy; j <= sy; j++)
for (i = -sx; i <= sx; i++) for (i = -sx; i <= sx; i++)