Adding custom grouping option
This commit is contained in:
@ -28,14 +28,14 @@ NPairHalfMultiNewton::NPairHalfMultiNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with full Newton's 3rd law
|
||||
multi-type stencil is itype-jtype dependent
|
||||
multi stencil is igroup-jgroup 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,ibin,jbin,which,ns,imol,iatom,moltemplate;
|
||||
int i,j,k,n,itype,jtype,igroup,jgroup,ibin,jbin,which,ns,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*s;
|
||||
@ -68,8 +68,8 @@ void NPairHalfMultiNewton::build(NeighList *list)
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
igroup = map_type_multi[itype];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
@ -79,28 +79,28 @@ void NPairHalfMultiNewton::build(NeighList *list)
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
ibin = atom2bin_multi[itype][i];
|
||||
ibin = atom2bin_multi[igroup][i];
|
||||
|
||||
// loop through stencils for all types
|
||||
for (jtype = 1; jtype <= atom->ntypes; jtype++) {
|
||||
// loop through stencils for all groups
|
||||
for (jgroup = 0; jgroup < n_multi_groups; jgroup++) {
|
||||
|
||||
// if same type use own bin
|
||||
if(itype == jtype) jbin = ibin;
|
||||
else jbin = coord2bin(x[i], jtype);
|
||||
// if same group use own bin
|
||||
if(igroup == jgroup) jbin = ibin;
|
||||
else jbin = coord2bin(x[i], jgroup);
|
||||
|
||||
if(cutneighsq[itype][itype] == cutneighsq[jtype][jtype]){
|
||||
if(cutmultisq[igroup][igroup] == cutmultisq[jgroup][jgroup]){
|
||||
|
||||
// if same size: use half stencil
|
||||
if(itype == jtype){
|
||||
if(igroup == jgroup){
|
||||
|
||||
// if same type, implement with:
|
||||
// if same group, implement with:
|
||||
// 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
|
||||
|
||||
js = bins_multi[itype][i];
|
||||
js = bins_multi[igroup][i];
|
||||
|
||||
for (j = js; j >= 0; j = bins_multi[jtype][j]) {
|
||||
for (j = js; j >= 0; j = bins_multi[jgroup][j]) {
|
||||
if (j >= nlocal) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
@ -109,7 +109,8 @@ void NPairHalfMultiNewton::build(NeighList *list)
|
||||
}
|
||||
}
|
||||
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
@ -134,14 +135,14 @@ void NPairHalfMultiNewton::build(NeighList *list)
|
||||
}
|
||||
} else {
|
||||
|
||||
// if different types, implement with:
|
||||
// loop over all atoms in jtype bin
|
||||
// if different groups, implement with:
|
||||
// loop over all atoms in jgroup bin
|
||||
// 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
|
||||
|
||||
js = binhead_multi[jtype][jbin];
|
||||
js = binhead_multi[jgroup][jbin];
|
||||
|
||||
for (j = js; j >= 0; j = bins_multi[jtype][j]) {
|
||||
for (j = js; j >= 0; j = bins_multi[jgroup][j]) {
|
||||
if(j < i) continue;
|
||||
|
||||
if (j >= nlocal) {
|
||||
@ -152,7 +153,8 @@ void NPairHalfMultiNewton::build(NeighList *list)
|
||||
}
|
||||
}
|
||||
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
@ -178,20 +180,21 @@ void NPairHalfMultiNewton::build(NeighList *list)
|
||||
}
|
||||
}
|
||||
|
||||
// for all types, loop over all atoms in other bins in stencil, store every pair
|
||||
// for all groups, 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[itype][jtype];
|
||||
ns = nstencil_multi[itype][jtype];
|
||||
s = stencil_multi[igroup][jgroup];
|
||||
ns = nstencil_multi[igroup][jgroup];
|
||||
|
||||
for (k = 0; k < ns; k++) {
|
||||
js = binhead_multi[jtype][jbin + s[k]];
|
||||
for (j = js; j >= 0; j = bins_multi[jtype][j]) {
|
||||
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
js = binhead_multi[jgroup][jbin + s[k]];
|
||||
for (j = js; j >= 0; j = bins_multi[jgroup][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];
|
||||
|
||||
Reference in New Issue
Block a user