diff --git a/doc/src/pair_yukawa_colloid.txt b/doc/src/pair_yukawa_colloid.txt index 3d5294bbdb..ecdc1496ab 100644 --- a/doc/src/pair_yukawa_colloid.txt +++ b/doc/src/pair_yukawa_colloid.txt @@ -35,7 +35,7 @@ cutoff. In contrast to "pair_style yukawa"_pair_yukawa.html, this functional form arises from the Coulombic interaction between two colloid particles, screened due to the presence of an electrolyte, see the -book by "Safran"_#Safran for a derivation in the context of DVLO +book by "Safran"_#Safran for a derivation in the context of DLVO theory. "Pair_style yukawa"_pair_yukawa.html is a screened Coulombic potential between two point-charges and uses no such approximation. diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 7e8db7632c..c5b566eef7 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -286,9 +286,6 @@ void FixQEq::setup_pre_force(int vflag) if (force->newton_pair == 0) error->all(FLERR,"QEQ with 'newton pair off' not supported"); - // should not be needed - // neighbor->build_one(list); - deallocate_storage(); allocate_storage(); diff --git a/src/USER-DPD/nbin_ssa.cpp b/src/USER-DPD/nbin_ssa.cpp index 73da5e0df3..f65a397e88 100644 --- a/src/USER-DPD/nbin_ssa.cpp +++ b/src/USER-DPD/nbin_ssa.cpp @@ -76,6 +76,7 @@ void NBinSSA::bin_atoms() if (ssaAIR[i] < 2) continue; // skip ghost atoms not in AIR if (mask[i] & bitmask) { ibin = coord2bin(x[i]); + atom2bin[i] = ibin; bins_ssa[i] = gbinhead_ssa[ibin]; gbinhead_ssa[ibin] = i; } @@ -84,12 +85,14 @@ void NBinSSA::bin_atoms() for (i = nall-1; i >= nlocal; i--) { if (ssaAIR[i] < 2) continue; // skip ghost atoms not in AIR ibin = coord2bin(x[i]); + atom2bin[i] = ibin; bins_ssa[i] = gbinhead_ssa[ibin]; gbinhead_ssa[ibin] = i; } } for (i = nlocal-1; i >= 0; i--) { ibin = coord2bin(x[i]); + atom2bin[i] = ibin; bins_ssa[i] = binhead_ssa[ibin]; binhead_ssa[ibin] = i; } diff --git a/src/USER-DPD/npair_half_bin_newton_ssa.cpp b/src/USER-DPD/npair_half_bin_newton_ssa.cpp index 59acbda301..e8e4b20a0a 100644 --- a/src/USER-DPD/npair_half_bin_newton_ssa.cpp +++ b/src/USER-DPD/npair_half_bin_newton_ssa.cpp @@ -141,7 +141,7 @@ void NPairHalfBinNewtonSSA::build(NeighList *list) } } - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; // loop over all local atoms in other bins in "half" stencil diff --git a/src/USER-OMP/npair_full_bin_ghost_omp.cpp b/src/USER-OMP/npair_full_bin_ghost_omp.cpp index 7f7239fe63..b915aca002 100644 --- a/src/USER-OMP/npair_full_bin_ghost_omp.cpp +++ b/src/USER-OMP/npair_full_bin_ghost_omp.cpp @@ -97,7 +97,7 @@ void NPairFullBinGhostOmp::build(NeighList *list) // no molecular test when i = ghost atom if (i < nlocal) { - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { if (i == j) continue; diff --git a/src/USER-OMP/npair_full_bin_omp.cpp b/src/USER-OMP/npair_full_bin_omp.cpp index ad9e48784e..e1f75c06e2 100644 --- a/src/USER-OMP/npair_full_bin_omp.cpp +++ b/src/USER-OMP/npair_full_bin_omp.cpp @@ -90,7 +90,7 @@ void NPairFullBinOmp::build(NeighList *list) // loop over all atoms in surrounding bins in stencil including self // skip i = j - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { diff --git a/src/USER-OMP/npair_full_multi_omp.cpp b/src/USER-OMP/npair_full_multi_omp.cpp index eb0153d63f..9bc196e17a 100644 --- a/src/USER-OMP/npair_full_multi_omp.cpp +++ b/src/USER-OMP/npair_full_multi_omp.cpp @@ -94,7 +94,7 @@ void NPairFullMultiOmp::build(NeighList *list) // skip if i,j neighbor cutoff is less than bin distance // skip i = j - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; s = stencil_multi[itype]; distsq = distsq_multi[itype]; cutsq = cutneighsq[itype]; diff --git a/src/USER-OMP/npair_half_bin_newtoff_ghost_omp.cpp b/src/USER-OMP/npair_half_bin_newtoff_ghost_omp.cpp index e46afebb0d..05763c3d68 100644 --- a/src/USER-OMP/npair_half_bin_newtoff_ghost_omp.cpp +++ b/src/USER-OMP/npair_half_bin_newtoff_ghost_omp.cpp @@ -103,7 +103,7 @@ void NPairHalfBinNewtoffGhostOmp::build(NeighList *list) // no molecular test when i = ghost atom if (i < nlocal) { - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { diff --git a/src/USER-OMP/npair_half_bin_newtoff_omp.cpp b/src/USER-OMP/npair_half_bin_newtoff_omp.cpp index 99698b1d30..ff74b54d7d 100644 --- a/src/USER-OMP/npair_half_bin_newtoff_omp.cpp +++ b/src/USER-OMP/npair_half_bin_newtoff_omp.cpp @@ -94,7 +94,7 @@ void NPairHalfBinNewtoffOmp::build(NeighList *list) // stores own/own pairs only once // stores own/ghost pairs on both procs - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { diff --git a/src/USER-OMP/npair_half_bin_newton_omp.cpp b/src/USER-OMP/npair_half_bin_newton_omp.cpp index 33d78fe55a..f7d969ba27 100644 --- a/src/USER-OMP/npair_half_bin_newton_omp.cpp +++ b/src/USER-OMP/npair_half_bin_newton_omp.cpp @@ -130,7 +130,7 @@ void NPairHalfBinNewtonOmp::build(NeighList *list) // loop over all atoms in other bins in stencil, store every pair - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { jtype = type[j]; diff --git a/src/USER-OMP/npair_half_bin_newton_tri_omp.cpp b/src/USER-OMP/npair_half_bin_newton_tri_omp.cpp index 9eb9612235..c843d623cd 100644 --- a/src/USER-OMP/npair_half_bin_newton_tri_omp.cpp +++ b/src/USER-OMP/npair_half_bin_newton_tri_omp.cpp @@ -94,7 +94,7 @@ void NPairHalfBinNewtonTriOmp::build(NeighList *list) // (equal zyx and j <= i) // latter excludes self-self interaction but allows superposed atoms - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { if (x[j][2] < ztmp) continue; diff --git a/src/USER-OMP/npair_half_multi_newtoff_omp.cpp b/src/USER-OMP/npair_half_multi_newtoff_omp.cpp index 37dc805857..705d1b8d9f 100644 --- a/src/USER-OMP/npair_half_multi_newtoff_omp.cpp +++ b/src/USER-OMP/npair_half_multi_newtoff_omp.cpp @@ -97,7 +97,7 @@ void NPairHalfMultiNewtoffOmp::build(NeighList *list) // stores own/own pairs only once // stores own/ghost pairs on both procs - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; s = stencil_multi[itype]; distsq = distsq_multi[itype]; cutsq = cutneighsq[itype]; diff --git a/src/USER-OMP/npair_half_multi_newton_omp.cpp b/src/USER-OMP/npair_half_multi_newton_omp.cpp index 9719911afa..f16dd027a0 100644 --- a/src/USER-OMP/npair_half_multi_newton_omp.cpp +++ b/src/USER-OMP/npair_half_multi_newton_omp.cpp @@ -131,7 +131,7 @@ void NPairHalfMultiNewtonOmp::build(NeighList *list) // loop over all atoms in other bins in stencil, store every pair // skip if i,j neighbor cutoff is less than bin distance - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; s = stencil_multi[itype]; distsq = distsq_multi[itype]; cutsq = cutneighsq[itype]; diff --git a/src/USER-OMP/npair_half_multi_newton_tri_omp.cpp b/src/USER-OMP/npair_half_multi_newton_tri_omp.cpp index 717a709386..f66cf194e7 100644 --- a/src/USER-OMP/npair_half_multi_newton_tri_omp.cpp +++ b/src/USER-OMP/npair_half_multi_newton_tri_omp.cpp @@ -99,7 +99,7 @@ void NPairHalfMultiNewtonTriOmp::build(NeighList *list) // (equal zyx and j <= i) // latter excludes self-self interaction but allows superposed atoms - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; s = stencil_multi[itype]; distsq = distsq_multi[itype]; cutsq = cutneighsq[itype]; diff --git a/src/USER-OMP/npair_half_respa_bin_newtoff_omp.cpp b/src/USER-OMP/npair_half_respa_bin_newtoff_omp.cpp index 287f11efa7..12780fa4a3 100644 --- a/src/USER-OMP/npair_half_respa_bin_newtoff_omp.cpp +++ b/src/USER-OMP/npair_half_respa_bin_newtoff_omp.cpp @@ -117,7 +117,7 @@ void NPairHalfRespaBinNewtoffOmp::build(NeighList *list) xtmp = x[i][0]; ytmp = x[i][1]; ztmp = x[i][2]; - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; if (moltemplate) { imol = molindex[i]; iatom = molatom[i]; diff --git a/src/USER-OMP/npair_half_respa_bin_newton_omp.cpp b/src/USER-OMP/npair_half_respa_bin_newton_omp.cpp index 30256bd20d..b9a6364242 100644 --- a/src/USER-OMP/npair_half_respa_bin_newton_omp.cpp +++ b/src/USER-OMP/npair_half_respa_bin_newton_omp.cpp @@ -176,7 +176,7 @@ void NPairHalfRespaBinNewtonOmp::build(NeighList *list) // loop over all atoms in other bins in stencil, store every pair - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { jtype = type[j]; diff --git a/src/USER-OMP/npair_half_respa_bin_newton_tri_omp.cpp b/src/USER-OMP/npair_half_respa_bin_newton_tri_omp.cpp index 27d02000c5..bc03972d85 100644 --- a/src/USER-OMP/npair_half_respa_bin_newton_tri_omp.cpp +++ b/src/USER-OMP/npair_half_respa_bin_newton_tri_omp.cpp @@ -128,7 +128,7 @@ void NPairHalfRespaBinNewtonTriOmp::build(NeighList *list) // (equal zyx and j <= i) // latter excludes self-self interaction but allows superposed atoms - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { if (x[j][2] < ztmp) continue; diff --git a/src/USER-OMP/npair_half_size_bin_newtoff_omp.cpp b/src/USER-OMP/npair_half_size_bin_newtoff_omp.cpp index 699d347db5..dbb62e96ef 100644 --- a/src/USER-OMP/npair_half_size_bin_newtoff_omp.cpp +++ b/src/USER-OMP/npair_half_size_bin_newtoff_omp.cpp @@ -113,7 +113,7 @@ void NPairHalfSizeBinNewtoffOmp::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; // loop over all atoms in surrounding bins in stencil including self // only store pair if i < j diff --git a/src/USER-OMP/npair_half_size_bin_newton_omp.cpp b/src/USER-OMP/npair_half_size_bin_newton_omp.cpp index 0d7e4e68da..2c26c7952c 100644 --- a/src/USER-OMP/npair_half_size_bin_newton_omp.cpp +++ b/src/USER-OMP/npair_half_size_bin_newton_omp.cpp @@ -168,7 +168,7 @@ void NPairHalfSizeBinNewtonOmp::build(NeighList *list) // loop over all atoms in other bins in stencil, store every pair - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { if (exclude && exclusion(i,j,type[i],type[j],mask,molecule)) continue; diff --git a/src/USER-OMP/npair_half_size_bin_newton_tri_omp.cpp b/src/USER-OMP/npair_half_size_bin_newton_tri_omp.cpp index 7463a6aba6..bf273f545f 100644 --- a/src/USER-OMP/npair_half_size_bin_newton_tri_omp.cpp +++ b/src/USER-OMP/npair_half_size_bin_newton_tri_omp.cpp @@ -84,7 +84,7 @@ void NPairHalfSizeBinNewtonTriOmp::build(NeighList *list) // (equal zyx and j <= i) // latter excludes self-self interaction but allows superposed atoms - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { if (x[j][2] < ztmp) continue; diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 01ecd9d399..96df03c668 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -416,9 +416,6 @@ void FixQEqReax::init_taper() void FixQEqReax::setup_pre_force(int vflag) { - // should not be needed - // neighbor->build_one(list); - deallocate_storage(); allocate_storage(); diff --git a/src/USER-REAXC/fix_reaxc_species.cpp b/src/USER-REAXC/fix_reaxc_species.cpp index 672b1e6a56..fe74337128 100644 --- a/src/USER-REAXC/fix_reaxc_species.cpp +++ b/src/USER-REAXC/fix_reaxc_species.cpp @@ -500,7 +500,7 @@ void FixReaxCSpecies::Output_ReaxC_Bonds(bigint ntimestep, FILE *fp) AtomCoord FixReaxCSpecies::chAnchor(AtomCoord in1, AtomCoord in2) { - if (in1.x < in2.x) + if (in1.x <= in2.x) return in1; return in2; } diff --git a/src/nbin.cpp b/src/nbin.cpp index 6aa37a4c43..6bd1ce322f 100644 --- a/src/nbin.cpp +++ b/src/nbin.cpp @@ -29,6 +29,7 @@ NBin::NBin(LAMMPS *lmp) : Pointers(lmp) maxbin = maxatom = 0; binhead = NULL; bins = NULL; + atom2bin = NULL; // geometry settings @@ -42,6 +43,7 @@ NBin::~NBin() { memory->destroy(binhead); memory->destroy(bins); + memory->destroy(atom2bin); } /* ---------------------------------------------------------------------- */ @@ -87,12 +89,15 @@ void NBin::bin_atoms_setup(int nall) memory->create(binhead,maxbin,"neigh:binhead"); } - // bins = per-atom vector + // bins and atom2bin = per-atom vectors + // for both local and ghost atoms if (nall > maxatom) { maxatom = nall; memory->destroy(bins); memory->create(bins,maxatom,"neigh:bins"); + memory->destroy(atom2bin); + memory->create(atom2bin,maxatom,"neigh:atom2bin"); } } @@ -148,6 +153,6 @@ bigint NBin::memory_usage() { bigint bytes = 0; bytes += maxbin*sizeof(int); - bytes += maxatom*sizeof(int); + bytes += 2*maxatom*sizeof(int); return bytes; } diff --git a/src/nbin.h b/src/nbin.h index 9871a229d8..30c74ff295 100644 --- a/src/nbin.h +++ b/src/nbin.h @@ -31,10 +31,11 @@ class NBin : protected Pointers { double binsizex,binsizey,binsizez; // bin sizes and inverse sizes double bininvx,bininvy,bininvz; - int *binhead; // index of first atom in each bin - int *bins; // index of next atom in same bin + int *binhead; // index of first atom in each bin + int *bins; // index of next atom in same bin + int *atom2bin; // bin assignment for each atom (local+ghost) - double cutoff_custom; // cutoff set by requestor + double cutoff_custom; // cutoff set by requestor NBin(class LAMMPS *); ~NBin(); diff --git a/src/nbin_standard.cpp b/src/nbin_standard.cpp index 2a72d996a5..e6941014f9 100644 --- a/src/nbin_standard.cpp +++ b/src/nbin_standard.cpp @@ -211,12 +211,14 @@ void NBinStandard::bin_atoms() for (i = nall-1; i >= nlocal; i--) { if (mask[i] & bitmask) { ibin = coord2bin(x[i]); + atom2bin[i] = ibin; bins[i] = binhead[ibin]; binhead[ibin] = i; } } for (i = atom->nfirst-1; i >= 0; i--) { ibin = coord2bin(x[i]); + atom2bin[i] = ibin; bins[i] = binhead[ibin]; binhead[ibin] = i; } @@ -224,6 +226,7 @@ void NBinStandard::bin_atoms() } else { for (i = nall-1; i >= 0; i--) { ibin = coord2bin(x[i]); + atom2bin[i] = ibin; bins[i] = binhead[ibin]; binhead[ibin] = i; } diff --git a/src/neigh_request.cpp b/src/neigh_request.cpp index 5e77c23077..bb691d00ba 100644 --- a/src/neigh_request.cpp +++ b/src/neigh_request.cpp @@ -50,6 +50,7 @@ NeighRequest::NeighRequest(LAMMPS *lmp) : Pointers(lmp) // default is no Intel-specific neighbor list build // default is no Kokkos neighbor list build // default is no Shardlow Splitting Algorithm (SSA) neighbor list build + // default is no list-specific cutoff // default is no storage of auxiliary floating point values occasional = 0; diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 545c8cf027..62a9143226 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -640,6 +640,24 @@ int Neighbor::init_pair() delete [] neigh_stencil; delete [] neigh_pair; + // error check on requests + // do not allow occasional, ghost, bin list + // b/c it still uses variant of coord2bin() in NPair() method + // instead of atom2bin, this could cause error b/c stoms have + // moved out of proc domain by time occasional list is built + // solution would be to use a different NBin variant + // that used Npair::coord2bin(x,ix,iy,iz) (then delete it from NPair) + // and stored the ix,iy,iz values for all atoms (including ghosts) + // at time of binning when neighbor lists are rebuilt, + // similar to what vanilla Nbin::coord2atom() does now in atom2bin + + if (style == BIN) { + for (i = 0; i < nrequest; i++) + if (requests[i]->occasional && requests[i]->ghost) + error->all(FLERR,"Cannot request an occasional binned neighbor list " + "with ghost info"); + } + // morph requests in various ways // purpose is to avoid duplicate or inefficient builds // may add new requests if a needed request to derive from does not exist @@ -1669,7 +1687,6 @@ int Neighbor::choose_stencil(NeighRequest *rq) else if (rq->newton == 1) newtflag = 1; else if (rq->newton == 2) newtflag = 0; - //printf("STENCIL RQ FLAGS: hff %d %d n %d g %d s %d newtflag %d\n", // rq->half,rq->full,rq->newton,rq->ghost,rq->ssa, // newtflag); @@ -2087,7 +2104,7 @@ void Neighbor::build(int topoflag) } // bin atoms for all NBin instances - // not just NBin associated with perpetual lists + // not just NBin associated with perpetual lists, also occasional lists // b/c cannot wait to bin occasional lists in build_one() call // if bin then, atoms may have moved outside of proc domain & bin extent, // leading to errors or even a crash @@ -2193,6 +2210,7 @@ void Neighbor::build_one(class NeighList *mylist, int preflag) // build the list + if (!mylist->copy) mylist->grow(atom->nlocal,atom->nlocal+atom->nghost); np->build_setup(); np->build(mylist); } diff --git a/src/npair.cpp b/src/npair.cpp index 6c3f8ac05e..3451cd6eae 100644 --- a/src/npair.cpp +++ b/src/npair.cpp @@ -128,6 +128,7 @@ void NPair::copy_bin_info() bininvy = nb->bininvy; bininvz = nb->bininvz; + atom2bin = nb->atom2bin; bins = nb->bins; binhead = nb->binhead; } @@ -198,53 +199,8 @@ int NPair::exclusion(int i, int j, int itype, int jtype, } /* ---------------------------------------------------------------------- - convert atom coords into local bin # - for orthogonal, only ghost atoms will have coord >= bboxhi or coord < bboxlo - take special care to insure ghosts are in correct bins even w/ roundoff - hi ghost atoms = nbin,nbin+1,etc - owned atoms = 0 to nbin-1 - lo ghost atoms = -1,-2,etc - this is necessary so that both procs on either side of PBC - treat a pair of atoms straddling the PBC in a consistent way - for triclinic, doesn't matter since stencil & neigh list built differently -------------------------------------------------------------------------- */ - -int NPair::coord2bin(double *x) -{ - int ix,iy,iz; - - if (!ISFINITE(x[0]) || !ISFINITE(x[1]) || !ISFINITE(x[2])) - error->one(FLERR,"Non-numeric positions - simulation unstable"); - - if (x[0] >= bboxhi[0]) - ix = static_cast ((x[0]-bboxhi[0])*bininvx) + nbinx; - else if (x[0] >= bboxlo[0]) { - ix = static_cast ((x[0]-bboxlo[0])*bininvx); - ix = MIN(ix,nbinx-1); - } else - ix = static_cast ((x[0]-bboxlo[0])*bininvx) - 1; - - if (x[1] >= bboxhi[1]) - iy = static_cast ((x[1]-bboxhi[1])*bininvy) + nbiny; - else if (x[1] >= bboxlo[1]) { - iy = static_cast ((x[1]-bboxlo[1])*bininvy); - iy = MIN(iy,nbiny-1); - } else - iy = static_cast ((x[1]-bboxlo[1])*bininvy) - 1; - - if (x[2] >= bboxhi[2]) - iz = static_cast ((x[2]-bboxhi[2])*bininvz) + nbinz; - else if (x[2] >= bboxlo[2]) { - iz = static_cast ((x[2]-bboxlo[2])*bininvz); - iz = MIN(iz,nbinz-1); - } else - iz = static_cast ((x[2]-bboxlo[2])*bininvz) - 1; - - return (iz-mbinzlo)*mbiny*mbinx + (iy-mbinylo)*mbinx + (ix-mbinxlo); -} - -/* ---------------------------------------------------------------------- - same as coord2bin, but also return ix,iy,iz offsets in each dim + same as coord2bin in Nbin, but also return ix,iy,iz offsets in each dim + used by some of the ghost neighbor lists ------------------------------------------------------------------------- */ int NPair::coord2bin(double *x, int &ix, int &iy, int &iz) diff --git a/src/npair.h b/src/npair.h index 8f2bcb13bc..4e5e3f5dfd 100644 --- a/src/npair.h +++ b/src/npair.h @@ -77,7 +77,7 @@ class NPair : protected Pointers { int mbinx,mbiny,mbinz; int mbinxlo,mbinylo,mbinzlo; double bininvx,bininvy,bininvz; - int *bins; + int *atom2bin,*bins; int *binhead; // data from NStencil class diff --git a/src/npair_full_bin.cpp b/src/npair_full_bin.cpp index a29acb67ab..94a6af129c 100644 --- a/src/npair_full_bin.cpp +++ b/src/npair_full_bin.cpp @@ -80,7 +80,7 @@ void NPairFullBin::build(NeighList *list) // loop over all atoms in surrounding bins in stencil including self // skip i = j - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { diff --git a/src/npair_full_bin_atomonly.cpp b/src/npair_full_bin_atomonly.cpp index 8d4fc254b5..db84733f1c 100644 --- a/src/npair_full_bin_atomonly.cpp +++ b/src/npair_full_bin_atomonly.cpp @@ -64,7 +64,7 @@ void NPairFullBinAtomonly::build(NeighList *list) // loop over all atoms in surrounding bins in stencil including self // skip i = j - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { diff --git a/src/npair_full_bin_ghost.cpp b/src/npair_full_bin_ghost.cpp index 1e258cf518..2edd03cc9e 100644 --- a/src/npair_full_bin_ghost.cpp +++ b/src/npair_full_bin_ghost.cpp @@ -87,7 +87,7 @@ void NPairFullBinGhost::build(NeighList *list) // no molecular test when i = ghost atom if (i < nlocal) { - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { if (i == j) continue; diff --git a/src/npair_full_multi.cpp b/src/npair_full_multi.cpp index 628a706e7a..9a2490ac5d 100644 --- a/src/npair_full_multi.cpp +++ b/src/npair_full_multi.cpp @@ -83,7 +83,7 @@ void NPairFullMulti::build(NeighList *list) // skip if i,j neighbor cutoff is less than bin distance // skip i = j - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; s = stencil_multi[itype]; distsq = distsq_multi[itype]; cutsq = cutneighsq[itype]; diff --git a/src/npair_half_bin_atomonly_newton.cpp b/src/npair_half_bin_atomonly_newton.cpp index bc425cd22e..6bbef0700a 100644 --- a/src/npair_half_bin_atomonly_newton.cpp +++ b/src/npair_half_bin_atomonly_newton.cpp @@ -90,7 +90,8 @@ void NPairHalfBinAtomonlyNewton::build(NeighList *list) // loop over all atoms in other bins in stencil, store every pair - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; + for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { jtype = type[j]; diff --git a/src/npair_half_bin_newtoff.cpp b/src/npair_half_bin_newtoff.cpp index dd072508a9..4c44741ffe 100644 --- a/src/npair_half_bin_newtoff.cpp +++ b/src/npair_half_bin_newtoff.cpp @@ -84,7 +84,7 @@ void NPairHalfBinNewtoff::build(NeighList *list) // stores own/own pairs only once // stores own/ghost pairs on both procs - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { diff --git a/src/npair_half_bin_newtoff_ghost.cpp b/src/npair_half_bin_newtoff_ghost.cpp index f486df105a..72ec15e66a 100644 --- a/src/npair_half_bin_newtoff_ghost.cpp +++ b/src/npair_half_bin_newtoff_ghost.cpp @@ -92,7 +92,7 @@ void NPairHalfBinNewtoffGhost::build(NeighList *list) // no molecular test when i = ghost atom if (i < nlocal) { - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { diff --git a/src/npair_half_bin_newton.cpp b/src/npair_half_bin_newton.cpp index f1fc203403..3a387870e3 100644 --- a/src/npair_half_bin_newton.cpp +++ b/src/npair_half_bin_newton.cpp @@ -119,7 +119,7 @@ void NPairHalfBinNewton::build(NeighList *list) // loop over all atoms in other bins in stencil, store every pair - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { jtype = type[j]; diff --git a/src/npair_half_bin_newton_tri.cpp b/src/npair_half_bin_newton_tri.cpp index 3ef8c3260e..169e710e0e 100644 --- a/src/npair_half_bin_newton_tri.cpp +++ b/src/npair_half_bin_newton_tri.cpp @@ -84,7 +84,7 @@ void NPairHalfBinNewtonTri::build(NeighList *list) // (equal zyx and j <= i) // latter excludes self-self interaction but allows superposed atoms - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { if (x[j][2] < ztmp) continue; diff --git a/src/npair_half_multi_newtoff.cpp b/src/npair_half_multi_newtoff.cpp index 11e45d91ff..07b5c87a6c 100644 --- a/src/npair_half_multi_newtoff.cpp +++ b/src/npair_half_multi_newtoff.cpp @@ -87,7 +87,7 @@ void NPairHalfMultiNewtoff::build(NeighList *list) // stores own/own pairs only once // stores own/ghost pairs on both procs - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; s = stencil_multi[itype]; distsq = distsq_multi[itype]; cutsq = cutneighsq[itype]; diff --git a/src/npair_half_multi_newton.cpp b/src/npair_half_multi_newton.cpp index cd3a37821f..3d90979329 100644 --- a/src/npair_half_multi_newton.cpp +++ b/src/npair_half_multi_newton.cpp @@ -121,7 +121,7 @@ void NPairHalfMultiNewton::build(NeighList *list) // loop over all atoms in other bins in stencil, store every pair // skip if i,j neighbor cutoff is less than bin distance - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; s = stencil_multi[itype]; distsq = distsq_multi[itype]; cutsq = cutneighsq[itype]; diff --git a/src/npair_half_multi_newton_tri.cpp b/src/npair_half_multi_newton_tri.cpp index f9aaeb0414..909c69246b 100644 --- a/src/npair_half_multi_newton_tri.cpp +++ b/src/npair_half_multi_newton_tri.cpp @@ -88,7 +88,7 @@ void NPairHalfMultiNewtonTri::build(NeighList *list) // (equal zyx and j <= i) // latter excludes self-self interaction but allows superposed atoms - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; s = stencil_multi[itype]; distsq = distsq_multi[itype]; cutsq = cutneighsq[itype]; diff --git a/src/npair_half_respa_bin_newtoff.cpp b/src/npair_half_respa_bin_newtoff.cpp index 39f68a289d..11246b4af8 100644 --- a/src/npair_half_respa_bin_newtoff.cpp +++ b/src/npair_half_respa_bin_newtoff.cpp @@ -101,7 +101,7 @@ void NPairHalfRespaBinNewtoff::build(NeighList *list) xtmp = x[i][0]; ytmp = x[i][1]; ztmp = x[i][2]; - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; if (moltemplate) { imol = molindex[i]; iatom = molatom[i]; diff --git a/src/npair_half_respa_bin_newton.cpp b/src/npair_half_respa_bin_newton.cpp index 537a72d0c1..db76678036 100644 --- a/src/npair_half_respa_bin_newton.cpp +++ b/src/npair_half_respa_bin_newton.cpp @@ -160,7 +160,7 @@ void NPairHalfRespaBinNewton::build(NeighList *list) // loop over all atoms in other bins in stencil, store every pair - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { jtype = type[j]; diff --git a/src/npair_half_respa_bin_newton_tri.cpp b/src/npair_half_respa_bin_newton_tri.cpp index 9c5fd39fbe..38621224c4 100644 --- a/src/npair_half_respa_bin_newton_tri.cpp +++ b/src/npair_half_respa_bin_newton_tri.cpp @@ -113,7 +113,7 @@ void NPairHalfRespaBinNewtonTri::build(NeighList *list) // (equal zyx and j <= i) // latter excludes self-self interaction but allows superposed atoms - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { if (x[j][2] < ztmp) continue; diff --git a/src/npair_half_size_bin_newtoff.cpp b/src/npair_half_size_bin_newtoff.cpp index e98923cd11..571b2484ea 100644 --- a/src/npair_half_size_bin_newtoff.cpp +++ b/src/npair_half_size_bin_newtoff.cpp @@ -105,7 +105,7 @@ void NPairHalfSizeBinNewtoff::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; // loop over all atoms in surrounding bins in stencil including self // only store pair if i < j diff --git a/src/npair_half_size_bin_newton.cpp b/src/npair_half_size_bin_newton.cpp index 2cd0943ac2..a8be3ce691 100644 --- a/src/npair_half_size_bin_newton.cpp +++ b/src/npair_half_size_bin_newton.cpp @@ -156,7 +156,7 @@ void NPairHalfSizeBinNewton::build(NeighList *list) // loop over all atoms in other bins in stencil, store every pair - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { if (exclude && exclusion(i,j,type[i],type[j],mask,molecule)) continue; diff --git a/src/npair_half_size_bin_newton_tri.cpp b/src/npair_half_size_bin_newton_tri.cpp index 054487d31f..1107f73026 100644 --- a/src/npair_half_size_bin_newton_tri.cpp +++ b/src/npair_half_size_bin_newton_tri.cpp @@ -112,7 +112,7 @@ void NPairHalfSizeBinNewtonTri::build(NeighList *list) // (equal zyx and j <= i) // latter excludes self-self interaction but allows superposed atoms - ibin = coord2bin(x[i]); + ibin = atom2bin[i]; for (k = 0; k < nstencil; k++) { for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) { if (x[j][2] < ztmp) continue;