enable CommStyle tiled and load-balancing to work for triclinic

This commit is contained in:
Steve Plimpton
2020-07-29 14:30:49 -06:00
parent 29c50671da
commit cb98fa00da
4 changed files with 96 additions and 41 deletions

View File

@ -569,16 +569,25 @@ int *Balance::bisection(int sortflag)
{
if (!rcb) rcb = new RCB(lmp);
// NOTE: this logic is specific to orthogonal boxes, not triclinic
int dim = domain->dimension;
double *boxlo = domain->boxlo;
double *boxhi = domain->boxhi;
double *prd = domain->prd;
int triclinic = domain->triclinic;
double *boxlo,*boxhi,*prd;
if (triclinic == 0) {
boxlo = domain->boxlo;
boxhi = domain->boxhi;
prd = domain->prd;
} else {
boxlo = domain->boxlo_lamda;
boxhi = domain->boxhi_lamda;
prd = domain->prd_lamda;
}
// shrink-wrap simulation box around atoms for input to RCB
// leads to better-shaped sub-boxes when atoms are far from box boundaries
// if triclinic, do this in lamda coords
double shrink[6],shrinkall[6];
shrink[0] = boxhi[0]; shrink[1] = boxhi[1]; shrink[2] = boxhi[2];
@ -586,6 +595,9 @@ int *Balance::bisection(int sortflag)
double **x = atom->x;
int nlocal = atom->nlocal;
if (triclinic) domain->x2lamda(nlocal);
for (int i = 0; i < nlocal; i++) {
shrink[0] = MIN(shrink[0],x[i][0]);
shrink[1] = MIN(shrink[1],x[i][1]);
@ -621,8 +633,9 @@ int *Balance::bisection(int sortflag)
// invoke RCB
// then invert() to create list of proc assignments for my atoms
// if triclinic, RCB operates on lamda coords
// NOTE: (3/2017) can remove undocumented "old" option at some point
// ditto in rcb.cpp
// ditto in rcb.cpp, or make it an option
if (oldrcb) {
if (wtflag) {
@ -636,6 +649,8 @@ int *Balance::bisection(int sortflag)
} else rcb->compute(dim,atom->nlocal,atom->x,NULL,shrinklo,shrinkhi);
}
if (triclinic) domain->lamda2x(nlocal);
rcb->invert(sortflag);
// reset RCB lo/hi bounding box to full simulation box as needed
@ -1270,6 +1285,9 @@ void Balance::debug_shift_output(int idim, int m, int np, double *split)
else if (bdim[idim] == Z) dim = "Z";
fprintf(stderr,"Dimension %s, Iteration %d\n",dim,m);
fprintf(stderr," Count:");
for (i = 0; i <= np; i++) fmt::print(stderr," {}",count[i]);
fprintf(stderr,"\n");
fprintf(stderr," Sum:");
for (i = 0; i <= np; i++) fmt::print(stderr," {}",sum[i]);
fprintf(stderr,"\n");