Merge branch 'master' into prepare-clang-format
# Conflicts: # src/KOKKOS/nbin_kokkos.h # src/KOKKOS/nbin_ssa_kokkos.h # src/MOLECULE/bond_fene_expand.h # src/USER-DPD/nbin_ssa.h # src/USER-DPD/nstencil_half_bin_2d_ssa.h # src/USER-DPD/nstencil_half_bin_3d_ssa.h # src/USER-INTEL/nbin_intel.h # src/USER-MISC/fix_propel_self.cpp # src/USER-OMP/npair_full_multi_old_omp.h # src/USER-OMP/npair_half_multi_old_newton_omp.h # src/USER-OMP/npair_half_size_multi_newtoff_omp.h # src/USER-OMP/npair_halffull_newtoff_omp.h # src/USER-OMP/npair_halffull_newton_omp.h # src/USER-OMP/npair_skip_omp.h # src/main.cpp # src/nbin_standard.h # src/npair_full_multi_old.h # src/npair_halffull_newtoff.h # src/npair_halffull_newton.h # src/npair_skip.h # src/npair_skip_respa.h # src/npair_skip_size.h # src/npair_skip_size_off2on.h # src/npair_skip_size_off2on_oneside.h # src/nstencil_full_bin_2d.h # src/nstencil_full_bin_3d.h # src/nstencil_full_ghost_bin_2d.h # src/nstencil_full_ghost_bin_3d.h # src/nstencil_full_multi_2d.h # src/nstencil_full_multi_3d.h # src/nstencil_full_multi_old_2d.h # src/nstencil_full_multi_old_3d.h # src/nstencil_half_bin_2d_newtoff.cpp # src/nstencil_half_bin_3d_newtoff.cpp # src/nstencil_half_bin_3d_newton_tri.h # src/nstencil_half_ghost_bin_2d_newtoff.cpp # src/nstencil_half_ghost_bin_2d_newtoff.h # src/nstencil_half_ghost_bin_3d_newtoff.cpp # src/nstencil_half_ghost_bin_3d_newtoff.h # src/nstencil_half_multi_2d.h # src/nstencil_half_multi_2d_newtoff.h # src/nstencil_half_multi_2d_newton_tri.h # src/nstencil_half_multi_2d_tri.h # src/nstencil_half_multi_3d_newtoff.h # src/nstencil_half_multi_3d_newton_tri.h
This commit is contained in:
@ -13,13 +13,15 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "npair_half_multi_newton.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -29,19 +31,20 @@ NPairHalfMultiNewton::NPairHalfMultiNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with full Newton's 3rd law
|
||||
multi stencil is icollection-jcollection dependent
|
||||
each owned atom i checks its own bin and other bins in Newton stencil
|
||||
multi-type stencil is itype dependent and is distance checked
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfMultiNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom,moltemplate;
|
||||
int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,which,ns,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*s;
|
||||
double *cutsq,*distsq;
|
||||
int js;
|
||||
|
||||
int *collection = neighbor->collection;
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
@ -55,7 +58,7 @@ void NPairHalfMultiNewton::build(NeighList *list)
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
if (molecular == 2) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
@ -69,8 +72,8 @@ void NPairHalfMultiNewton::build(NeighList *list)
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
icollection = collection[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
@ -80,80 +83,103 @@ void NPairHalfMultiNewton::build(NeighList *list)
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over rest of atoms in i's bin, ghosts are at end of linked list
|
||||
// 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
|
||||
|
||||
for (j = bins[i]; j >= 0; j = bins[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 != Atom::ATOMIC) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// loop over all atoms in other bins in stencil, store every pair
|
||||
// skip if i,j neighbor cutoff is less than bin distance
|
||||
|
||||
ibin = atom2bin[i];
|
||||
s = stencil_multi[itype];
|
||||
distsq = distsq_multi[itype];
|
||||
cutsq = cutneighsq[itype];
|
||||
ns = nstencil_multi[itype];
|
||||
for (k = 0; k < ns; k++) {
|
||||
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
|
||||
jtype = type[j];
|
||||
if (cutsq[jtype] < distsq[k]) continue;
|
||||
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
// loop through stencils for all collections
|
||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
// if same collection use own bin
|
||||
if(icollection == jcollection) jbin = ibin;
|
||||
else jbin = coord2bin(x[i], jcollection);
|
||||
|
||||
if (rsq <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
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;
|
||||
}
|
||||
// if same size: uses half stencil so check central bin
|
||||
if(cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
|
||||
|
||||
if (icollection == jcollection) js = bins[i];
|
||||
else js = binhead_multi[jcollection][jbin];
|
||||
|
||||
// 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 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
|
||||
|
||||
for (j = js; j >= 0; j = bins[j]) {
|
||||
if((icollection != jcollection) && (j < i)) continue;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for all collections, loop over all atoms in other bins in stencil, store every pair
|
||||
// stencil is empty if i larger than j
|
||||
// stencil is half if i same size as j
|
||||
// stencil is full if i smaller than j
|
||||
|
||||
s = stencil_multi[icollection][jcollection];
|
||||
ns = nstencil_multi[icollection][jcollection];
|
||||
|
||||
for (k = 0; k < ns; k++) {
|
||||
js = binhead_multi[jcollection][jbin + s[k]];
|
||||
for (j = js; j >= 0; j = bins[j]) {
|
||||
|
||||
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 != Atom::ATOMIC) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ilist[inum++] = i;
|
||||
|
||||
Reference in New Issue
Block a user