change zero-size shrink box to original box

This commit is contained in:
Steven J. Plimpton
2018-08-09 08:50:11 -06:00
parent d10a470245
commit d5594350c4
3 changed files with 27 additions and 20 deletions

View File

@ -2,7 +2,7 @@
:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
:link(lc,Section_commands.html#comm)
:link(lc,Commands_all.html)
:line
@ -48,10 +48,10 @@ compute 1 all property/local atype aatom2 :pre
Define a computation that stores the specified attributes as local
data so it can be accessed by other "output
commands"_Section_howto.html#howto_15. If the input attributes refer
to bond information, then the number of datums generated, aggregated
across all processors, equals the number of bonds in the system.
Ditto for pairs, angles, etc.
commands"_Howto_output.html. If the input attributes refer to bond
information, then the number of datums generated, aggregated across
all processors, equals the number of bonds in the system. Ditto for
pairs, angles, etc.
If multiple attributes are specified then they must all generate the
same amount of information, so that the resulting local array has the
@ -140,8 +140,8 @@ the array is the number of bonds, angles, etc. If a single input is
specified, a local vector is produced. If two or more inputs are
specified, a local array is produced where the number of columns = the
number of inputs. The vector or array can be accessed by any command
that uses local values from a compute as input. See "this
section"_Section_howto.html#howto_15 for an overview of LAMMPS output
that uses local values from a compute as input. See the "Howto
output"_Howto_output.html doc page for an overview of LAMMPS output
options.
The vector or array values will be integers that correspond to the

View File

@ -28,7 +28,6 @@
#include "rcb.h"
#include "irregular.h"
#include "domain.h"
#include "neighbor.h"
#include "force.h"
#include "update.h"
#include "group.h"
@ -351,13 +350,13 @@ void Balance::command(int narg, char **arg)
domain->set_local_box();
// move particles to new processors via irregular()
// set disable = 0, so weights migrate with atoms for imbfinal calculation
if (domain->triclinic) domain->x2lamda(atom->nlocal);
Irregular *irregular = new Irregular(lmp);
if (wtflag) fixstore->disable = 0;
if (style == BISECTION) irregular->migrate_atoms(1,1,rcb->sendproc);
else irregular->migrate_atoms(1);
if (wtflag) fixstore->disable = 1;
delete irregular;
if (domain->triclinic) domain->lamda2x(atom->nlocal);
@ -378,9 +377,11 @@ void Balance::command(int narg, char **arg)
}
// imbfinal = final imbalance
// set disable = 1, so weights no longer migrate with atoms
double maxfinal;
double imbfinal = imbalance_factor(maxfinal);
if (wtflag) fixstore->disable = 1;
// stats output
@ -541,6 +542,8 @@ void Balance::weight_storage(char *prefix)
fixstore = (FixStore *) modify->fix[modify->nfix-1];
} else fixstore = (FixStore *) modify->fix[ifix];
// do not carry weights with atoms during normal atom migration
fixstore->disable = 1;
if (prefix) delete [] fixargs[0];
@ -644,17 +647,19 @@ int *Balance::bisection(int sortflag)
double *shrinklo = &shrinkall[0];
double *shrinkhi = &shrinkall[3];
// ensure that that the box has at least some extent.
const double nproc_rt = domain->dimension == 3 ?
cbrt(static_cast<double>(comm->nprocs)) :
sqrt(static_cast<double>(comm->nprocs));
const double min_extent = ceil(nproc_rt)*neighbor->skin;
for (int i = 0; i < domain->dimension; i++) {
if (shrinkall[3+i]-shrinkall[i] < min_extent) {
const double mid = 0.5*(shrinkall[3+i]+shrinkall[i]);
shrinkall[3+i] = std::min(mid + min_extent*0.5, boxhi[i]);
shrinkall[i] = std::max(mid - min_extent*0.5, boxlo[i]);
}
// if shrink size in any dim is zero, use box size in that dim
if (shrinklo[0] == shrinkhi[0]) {
shrinklo[0] = boxlo[0];
shrinkhi[0] = boxhi[0];
}
if (shrinklo[1] == shrinkhi[1]) {
shrinklo[1] = boxlo[1];
shrinkhi[1] = boxhi[1];
}
if (shrinklo[2] == shrinkhi[2]) {
shrinklo[2] = boxlo[2];
shrinkhi[2] = boxhi[2];
}
// invoke RCB

View File

@ -241,6 +241,8 @@ void RCB::compute(int dimension, int n, double **x, double *wt,
// dim_select = selected cut dimension
// valuehalf_select = valuehalf in that dimension
// dotmark_select = dot markings in that dimension
// initialize largest = -1.0 to insure a cut in some dim is accepted
// e.g. if current recursed box is size 0 in all dims
int dim_select = -1;
double largest = -1.0;