Add cross type self bin check for newton

This commit is contained in:
Joel Clemmer
2020-11-22 21:22:29 -07:00
parent de5df539c9
commit d7047245f4
4 changed files with 98 additions and 0 deletions

View File

@ -163,6 +163,45 @@ void NPairHalfMulti2Newton::build(NeighList *list)
// smaller -> larger: locate i in the ktype bin structure
kbin = coord2bin(x[i], ktype);
// if same size, use half list so check own bin
if(cutneighsq[itype][itype] == cutneighsq[ktype][ktype]){
js = binhead_multi2[ktype][kbin];
for (j = js; j >= 0; j = bins_multi2[ktype][j]) {
if (j >= nlocal) {
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;
}
}
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
}
s = stencil_multi2[itype][ktype];
ns = nstencil_multi2[itype][ktype];

View File

@ -143,6 +143,19 @@ void NPairHalfMulti2NewtonTri::build(NeighList *list)
for (j = js; j >= 0; j = bins_multi2[ktype][j]) {
jtype = type[j];
// if same size, use half stencil
if(cutneighsq[itype][itype] == cutneighsq[ktype][ktype]){
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;
}
}
}
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];

View File

@ -138,6 +138,39 @@ void NPairHalfSizeMulti2Newton::build(NeighList *list)
// smaller -> larger: locate i in the ktype bin structure
kbin = coord2bin(x[i], ktype);
// if same size, use half list so check own bin
if(cutneighsq[itype][itype] == cutneighsq[ktype][ktype]){
js = binhead_multi2[ktype][kbin];
for (j = js; j >= 0; j = bins_multi2[ktype][j]) {
if (j >= nlocal) {
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;
}
}
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
}
}
// Check other stencils
s = stencil_multi2[itype][ktype];
ns = nstencil_multi2[itype][ktype];
for (k = 0; k < ns; k++) {

View File

@ -115,6 +115,7 @@ void NPairHalfSizeMulti2NewtonTri::build(NeighList *list)
}
} else {
// smaller -> larger: locate i in the ktype bin structure
kbin = coord2bin(x[i], ktype);
s = stencil_multi2[itype][ktype];
@ -124,6 +125,18 @@ void NPairHalfSizeMulti2NewtonTri::build(NeighList *list)
for (j = js; j >= 0; j = bins_multi2[ktype][j]) {
jtype = type[j];
// if same size, use half stencil
if(cutneighsq[itype][itype] == cutneighsq[ktype][ktype]){
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;
}
}
}
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;