Adding custom grouping option

This commit is contained in:
Joel Clemmer
2020-12-26 11:03:29 -07:00
parent b421c3d676
commit 2458eaf4f9
30 changed files with 599 additions and 551 deletions

View File

@ -28,13 +28,13 @@ NPairFullMulti::NPairFullMulti(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction for all neighbors
multi-type stencil is itype-jtype dependent
multi stencil is igroup-jgroup dependent
every neighbor pair appears in list of both atoms i and j
------------------------------------------------------------------------- */
void NPairFullMulti::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;
@ -67,8 +67,8 @@ void NPairFullMulti::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];
@ -78,29 +78,30 @@ void NPairFullMulti::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);
// loop over all atoms in surrounding bins in stencil including self
// skip i = j
// use full stencil for all type combinations
// use full stencil for all group combinations
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]) {
js = binhead_multi[jgroup][jbin + s[k]];
for (j = js; j >= 0; j = bins_multi[jgroup][j]) {
if (i == j) continue;
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];
delz = ztmp - x[j][2];