Adding collection array, new user arguments, and multi communication

This commit is contained in:
Joel Clemmer
2021-02-02 09:39:13 -07:00
parent 2c92737cd5
commit d79a2c3a02
51 changed files with 2109 additions and 697 deletions

View File

@ -12,6 +12,7 @@
------------------------------------------------------------------------- */
#include "npair_half_multi_newton.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "atom.h"
#include "atom_vec.h"
@ -28,19 +29,20 @@ NPairHalfMultiNewton::NPairHalfMultiNewton(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction with full Newton's 3rd law
multi stencil is igroup-jgroup dependent
multi stencil is icollection-jcollection dependent
each owned atom i checks its own bin and other bins in Newton stencil
every pair stored exactly once by some processor
------------------------------------------------------------------------- */
void NPairHalfMultiNewton::build(NeighList *list)
{
int i,j,k,n,itype,jtype,igroup,jgroup,ibin,jbin,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;
int js;
int *collection = neighbor->collection;
double **x = atom->x;
int *type = atom->type;
int *mask = atom->mask;
@ -69,7 +71,7 @@ void NPairHalfMultiNewton::build(NeighList *list)
n = 0;
neighptr = ipage->vget();
itype = type[i];
igroup = map_type_multi[itype];
icollection = collection[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
@ -81,29 +83,29 @@ void NPairHalfMultiNewton::build(NeighList *list)
ibin = atom2bin[i];
// loop through stencils for all groups
for (jgroup = 0; jgroup < n_multi_groups; jgroup++) {
// loop through stencils for all collections
for (jcollection = 0; jcollection < ncollections; jcollection++) {
// if same group use own bin
if(igroup == jgroup) jbin = ibin;
else jbin = coord2bin(x[i], jgroup);
// if same collection use own bin
if(icollection == jcollection) jbin = ibin;
else jbin = coord2bin(x[i], jcollection);
// if same size: uses half stencil so check central bin
if(cutmultisq[igroup][igroup] == cutmultisq[jgroup][jgroup]){
if(cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
if(igroup == jgroup) js = bins[i];
else js = binhead_multi[jgroup][jbin];
if(icollection == jcollection) js = bins[i];
else js = binhead_multi[jcollection][jbin];
// if same group,
// 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 groups,
// 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(igroup != jgroup and j < i) continue;
if(icollection != jcollection and j < i) continue;
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
@ -139,16 +141,16 @@ void NPairHalfMultiNewton::build(NeighList *list)
}
}
// for all groups, loop over all atoms in other bins in stencil, store every pair
// 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[igroup][jgroup];
ns = nstencil_multi[igroup][jgroup];
s = stencil_multi[icollection][jcollection];
ns = nstencil_multi[icollection][jcollection];
for (k = 0; k < ns; k++) {
js = binhead_multi[jgroup][jbin + s[k]];
js = binhead_multi[jcollection][jbin + s[k]];
for (j = js; j >= 0; j = bins[j]) {
jtype = type[j];