Updating logic for multi
This commit is contained in:
@ -118,15 +118,16 @@ void NPairMultiOmp<HALF, NEWTON, TRI, SIZE>::build(NeighList *list)
|
||||
if (icollection == jcollection) jbin = ibin;
|
||||
else jbin = coord2bin(x[i], jcollection);
|
||||
|
||||
// loop over all atoms in surrounding bins in stencil including self
|
||||
// skip i = j
|
||||
// use full stencil for all collection combinations
|
||||
|
||||
s = stencil_multi[icollection][jcollection];
|
||||
ns = nstencil_multi[icollection][jcollection];
|
||||
|
||||
for (k = 0; k < ns; k++) {
|
||||
js = binhead_multi[jcollection][jbin + s[k]];
|
||||
|
||||
// own-bin for half stencil
|
||||
if (HALF)
|
||||
if (flag_half_multi[icollection][jcollection] && s[k] == 0) js = bins[i];
|
||||
|
||||
for (j = js; j >= 0; j = bins[j]) {
|
||||
if (!HALF) {
|
||||
// Full neighbor list
|
||||
@ -144,6 +145,9 @@ void NPairMultiOmp<HALF, NEWTON, TRI, SIZE>::build(NeighList *list)
|
||||
// below = lower z or (equal z and lower y) or (equal zy and lower x)
|
||||
// (equal zyx and j <= i)
|
||||
// latter excludes self-self interaction but allows superposed atoms
|
||||
|
||||
// if same size (same collection), use half stencil
|
||||
if (flag_half_multi[icollection][jcollection]) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
@ -152,13 +156,22 @@ void NPairMultiOmp<HALF, NEWTON, TRI, SIZE>::build(NeighList *list)
|
||||
if (x[j][0] == xtmp && j <= i) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Half neighbor list, newton on, orthonormal
|
||||
// store every pair for every bin in stencil,except for i's bin
|
||||
|
||||
if (stencil[k] == 0) {
|
||||
// if same size: uses half stencil so includes a check of the central bin
|
||||
if (flag_half_multi[icollection][jcollection]){
|
||||
if (s[k] == 0) {
|
||||
// if same collection,
|
||||
// if j is owned atom, store it, since j is beyond i in linked list
|
||||
// if j is ghost, only store if j coords are "above and to the "right" of i
|
||||
// if j is ghost, only store if j coords are "above and to the right" of i
|
||||
|
||||
// if different collections,
|
||||
// if j is owned atom, store it if j > i
|
||||
// if j is ghost, only store if j coords are "above and to the right" of i
|
||||
|
||||
if ((icollection != jcollection) && (j < i)) continue;
|
||||
|
||||
if (j >= nlocal) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
@ -168,6 +181,7 @@ void NPairMultiOmp<HALF, NEWTON, TRI, SIZE>::build(NeighList *list)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
@ -177,7 +191,6 @@ void NPairMultiOmp<HALF, NEWTON, TRI, SIZE>::build(NeighList *list)
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
|
||||
|
||||
if (SIZE) {
|
||||
radsum = radius[i] + radius[j];
|
||||
cut = radsum + skin;
|
||||
|
||||
@ -174,6 +174,8 @@ void NPair::copy_stencil_info()
|
||||
|
||||
nstencil_multi = ns->nstencil_multi;
|
||||
stencil_multi = ns->stencil_multi;
|
||||
|
||||
flag_half_multi = ns->flag_half_multi;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -96,6 +96,7 @@ class NPair : protected Pointers {
|
||||
int *nstencil_multi_old;
|
||||
int **stencil_multi_old;
|
||||
double **distsq_multi_old;
|
||||
bool **flag_half_multi;
|
||||
|
||||
int **nstencil_multi;
|
||||
int ***stencil_multi;
|
||||
|
||||
@ -112,6 +112,11 @@ void NPairMulti<HALF, NEWTON, TRI, SIZE>::build(NeighList *list)
|
||||
|
||||
for (k = 0; k < ns; k++) {
|
||||
js = binhead_multi[jcollection][jbin + s[k]];
|
||||
|
||||
// own-bin for half stencil
|
||||
if (HALF)
|
||||
if (flag_half_multi[icollection][jcollection] && s[k] == 0) js = bins[i];
|
||||
|
||||
for (j = js; j >= 0; j = bins[j]) {
|
||||
if (!HALF) {
|
||||
// Full neighbor list
|
||||
@ -129,6 +134,9 @@ void NPairMulti<HALF, NEWTON, TRI, SIZE>::build(NeighList *list)
|
||||
// below = lower z or (equal z and lower y) or (equal zy and lower x)
|
||||
// (equal zyx and j <= i)
|
||||
// latter excludes self-self interaction but allows superposed atoms
|
||||
|
||||
// if same size (same collection), use half stencil
|
||||
if (flag_half_multi[icollection][jcollection]) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
@ -137,13 +145,22 @@ void NPairMulti<HALF, NEWTON, TRI, SIZE>::build(NeighList *list)
|
||||
if (x[j][0] == xtmp && j <= i) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Half neighbor list, newton on, orthonormal
|
||||
// store every pair for every bin in stencil,except for i's bin
|
||||
|
||||
if (stencil[k] == 0) {
|
||||
// if same size: uses half stencil so includes a check of the central bin
|
||||
if (flag_half_multi[icollection][jcollection]) {
|
||||
if (s[k] == 0) {
|
||||
// if same collection,
|
||||
// if j is owned atom, store it, since j is beyond i in linked list
|
||||
// if j is ghost, only store if j coords are "above and to the "right" of i
|
||||
// if j is ghost, only store if j coords are "above and to the right" of i
|
||||
|
||||
// if different collections,
|
||||
// if j is owned atom, store it if j > i
|
||||
// if j is ghost, only store if j coords are "above and to the right" of i
|
||||
|
||||
if ((icollection != jcollection) && (j < i)) continue;
|
||||
|
||||
if (j >= nlocal) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
@ -153,6 +170,7 @@ void NPairMulti<HALF, NEWTON, TRI, SIZE>::build(NeighList *list)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
|
||||
@ -87,13 +87,13 @@ void NStencilMulti<HALF, DIM_3D, TRI>::create()
|
||||
|
||||
bin_collection = bin_collection_multi[icollection][jcollection];
|
||||
cutsq = cutcollectionsq[icollection][jcollection];
|
||||
|
||||
half_flag = flag_half_multi[icollection][jcollection];
|
||||
|
||||
// Half and ortho stencils include central bin first
|
||||
// This preserves the historical order of the neighbor list
|
||||
// as the old npair classes used to separately parse the central bin first
|
||||
if (half_flag && (!TRI)) stencil[nstencil++] = 0;
|
||||
if (HALF && (!TRI))
|
||||
if (half_flag) stencil_multi[icollection][jcollection][ns++] = 0;
|
||||
|
||||
// For half stencils, only the upper plane is needed
|
||||
int sy_min = sy;
|
||||
@ -106,15 +106,16 @@ void NStencilMulti<HALF, DIM_3D, TRI>::create()
|
||||
for (k = -sz_min; k <= sz; k++) {
|
||||
for (j = -sy_min; j <= sy; j++) {
|
||||
for (i = -sx; i <= sx; i++) {
|
||||
|
||||
// Now only include "upper right" bins for half and ortho stencils
|
||||
if (HALF) {
|
||||
if (half_flag && (!DIM_3D) && (!TRI))
|
||||
if (! (j > 0 || (j == 0 && i > 0))) continue;
|
||||
if (half_flag && DIM_3D && (!TRI))
|
||||
if (HALF && (!TRI)) {
|
||||
if (half_flag) {
|
||||
if (DIM_3D) {
|
||||
if (! (k > 0 || j > 0 || (j == 0 && i > 0))) continue;
|
||||
} else {
|
||||
if (! (j > 0 || (j == 0 && i > 0))) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
|
||||
stencil_multi[icollection][jcollection][ns++] = k * mbiny * mbinx + j * mbinx + i;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user