diff --git a/src/npair_multi.cpp b/src/npair_multi.cpp index ba703691cd..9f719f403a 100644 --- a/src/npair_multi.cpp +++ b/src/npair_multi.cpp @@ -160,7 +160,7 @@ void NPairMulti::build(NeighList *list) delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; + rsq = delx * delx + dely * dely + delz * delz; if (SIZE) { radsum = radius[i] + radius[j]; diff --git a/src/nstencil_multi.cpp b/src/nstencil_multi.cpp index 76329db12d..6e9fefea1e 100644 --- a/src/nstencil_multi.cpp +++ b/src/nstencil_multi.cpp @@ -68,12 +68,6 @@ void NStencilMulti::create() int n = ncollections; double cutsq; - // For half stencils, only the upper plane is needed - int sy_min = sy; - int sz_min = sz; - if (HALF && (!DIM_3D)) sy_min = 0; - if (HALF && DIM_3D) sz_min = 0; - for (icollection = 0; icollection < n; icollection++) { for (jcollection = 0; jcollection < n; jcollection++) { if (flag_skip_multi[icollection][jcollection]) { @@ -101,15 +95,25 @@ void NStencilMulti::create() // as the old npair classes used to separately parse the central bin first if (half_flag && (!TRI)) stencil[nstencil++] = 0; + // For half stencils, only the upper plane is needed + int sy_min = sy; + int sz_min = sz; + if (HALF) { + if (half_flag && (!DIM_3D)) sy_min = 0; + if (half_flag && DIM_3D) sz_min = 0; + } + 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_flag && (!DIM_3D) && (!TRI)) - if (! (j > 0 || (j == 0 && i > 0))) continue; - if (half_flag && DIM_3D && (!TRI)) - if (! (k > 0 || j > 0 || (j == 0 && i > 0))) continue; + if (HALF) { + if (half_flag && (!DIM_3D) && (!TRI)) + if (! (j > 0 || (j == 0 && i > 0))) continue; + if (half_flag && DIM_3D && (!TRI)) + if (! (k > 0 || 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;