apply fix from balance command to fix balance

This commit is contained in:
Axel Kohlmeyer
2021-09-17 22:52:58 -04:00
parent cb2de211b2
commit a46b8688ea
2 changed files with 4 additions and 3 deletions

View File

@ -45,6 +45,7 @@ class Balance : public Command {
int *bisection(int sortflag = 0);
void dumpout(bigint);
static constexpr int BSTR_SIZE = 3;
private:
int me, nprocs;
@ -56,7 +57,6 @@ class Balance : public Command {
int nitermax; // params for shift LB
double stopthresh;
static constexpr int BSTR_SIZE = 3;
char bstr[BSTR_SIZE+1];
int shift_allocate; // 1 if SHIFT vectors have been allocated

View File

@ -64,14 +64,15 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) :
int iarg = 5;
if (lbstyle == SHIFT) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix balance command");
if (strlen(arg[iarg+1]) > 3)
if (strlen(arg[iarg+1]) > Balance::BSTR_SIZE)
error->all(FLERR,"Illegal fix balance command");
strcpy(bstr,arg[iarg+1]);
strncpy(bstr,arg[iarg+1], Balance::BSTR_SIZE+1);
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++;
}