diff --git a/doc/src/fix_balance.rst b/doc/src/fix_balance.rst index 83be726ba7..0a0ea64c6a 100644 --- a/doc/src/fix_balance.rst +++ b/doc/src/fix_balance.rst @@ -14,15 +14,15 @@ Syntax * balance = style name of this fix command * Nfreq = perform dynamic load balancing every this many steps * thresh = imbalance threshold that must be exceeded to perform a re-balance -* style = *shift* *shift/report* or *rcb* or *rcb/report* - +* style = *shift* or *rcb* or *report* .. parsed-literal:: - *shift* or *shift/report* args = dimstr Niter stopthresh + *shift* args = dimstr Niter stopthresh dimstr = sequence of letters containing *x* or *y* or *z*, each not more than once Niter = # of times to iterate within each dimension of dimstr sequence stopthresh = stop balancing when this imbalance threshold is reached - *rcb* or *rcb/report* args = none + *rcb* args = none + *report* args = none * zero or more keyword/arg pairs may be appended * keyword = *weight* or *out* @@ -72,10 +72,10 @@ perform "static" balancing, before or between runs, see the .. versionadded:: TBD -The *shift/report* and *rcb/report* styles only compute the -load imbalance but do not attempt any re-balancing. This way -the load imbalance information can be used otherwise, for -instance for stopping a run with :doc:`fix halt `. +The *report* balance style only computes the load imbalance but +does not attempt any re-balancing. This way the load imbalance +information can be used otherwise, for instance for stopping a +run with :doc:`fix halt `. Load-balancing is typically most useful if the particles in the simulation box have a spatially-varying density distribution or diff --git a/src/fix_balance.cpp b/src/fix_balance.cpp index ae1d00db8f..2a32e96106 100644 --- a/src/fix_balance.cpp +++ b/src/fix_balance.cpp @@ -64,26 +64,34 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) : reportonly = 0; if (strcmp(arg[5],"shift") == 0) { lbstyle = SHIFT; - } else if (strcmp(arg[5],"shift/report") == 0) { - lbstyle = SHIFT; - reportonly = 1; } else if (strcmp(arg[5],"rcb") == 0) { lbstyle = BISECTION; - } else if (strcmp(arg[5],"rcb/report") == 0) { - lbstyle = BISECTION; + } else if (strcmp(arg[5],"report") == 0) { + lbstyle = SHIFT; reportonly = 1; } else error->all(FLERR,"Unknown fix balance style {}", arg[5]); int iarg = 5; if (lbstyle == SHIFT) { - if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix balance shift", error); - bstr = arg[iarg+1]; - if (bstr.size() > Balance::BSTR_SIZE) error->all(FLERR,"Illegal fix balance shift command"); - nitermax = utils::inumeric(FLERR,arg[iarg+2],false,lmp); - if (nitermax <= 0) error->all(FLERR,"Illegal fix balance command"); - stopthresh = utils::numeric(FLERR,arg[iarg+3],false,lmp); - if (stopthresh < 1.0) error->all(FLERR,"Illegal fix balance command"); - iarg += 4; + if (reportonly) { + if (dimension == 2) + bstr = "xy"; + else + bstr = "xyz"; + nitermax = 5; + stopthresh = 1.1; + iarg++; + } else { + if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix balance shift", error); + bstr = arg[iarg+1]; + if (bstr.size() > Balance::BSTR_SIZE) error->all(FLERR,"Illegal fix balance shift command"); + nitermax = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + if (nitermax <= 0) error->all(FLERR,"Illegal fix balance command"); + stopthresh = utils::numeric(FLERR,arg[iarg+3],false,lmp); + if (stopthresh < 1.0) error->all(FLERR,"Illegal fix balance command"); + iarg += 4; + } + } else if (lbstyle == BISECTION) { iarg++; }