more simplification

This commit is contained in:
Axel Kohlmeyer
2020-06-26 16:22:19 -04:00
parent 41d62b8b8b
commit 91502b8bf6
2 changed files with 13 additions and 32 deletions

View File

@ -489,32 +489,21 @@ void Balance::options(int iarg, int narg, char **arg)
void Balance::weight_storage(char *prefix)
{
char *fixargs[6];
std::string cmd = "";
if (prefix) {
int n = strlen(prefix) + 32;
fixargs[0] = new char[n];
strcpy(fixargs[0],prefix);
strcat(fixargs[0],"IMBALANCE_WEIGHTS");
} else fixargs[0] = (char *) "IMBALANCE_WEIGHTS";
if (prefix) cmd = prefix;
cmd += "IMBALANCE_WEIGHTS";
fixargs[1] = (char *) "all";
fixargs[2] = (char *) "STORE";
fixargs[3] = (char *) "peratom";
fixargs[4] = (char *) "0";
fixargs[5] = (char *) "1";
int ifix = modify->find_fix(fixargs[0]);
int ifix = modify->find_fix(cmd.c_str());
if (ifix < 1) {
modify->add_fix(6,fixargs);
cmd += " all STORE peratom 0 1";
modify->add_fix(cmd);
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];
}
/* ----------------------------------------------------------------------