Merge branch 'develop' into type-labels
This commit is contained in:
@ -219,7 +219,7 @@ void DumpCustomADIOS::init_style()
|
||||
delete[] columns;
|
||||
std::string combined;
|
||||
int icol = 0;
|
||||
for (auto item : utils::split_words(columns_default)) {
|
||||
for (const auto &item : utils::split_words(columns_default)) {
|
||||
if (combined.size()) combined += " ";
|
||||
if (keyword_user[icol].size())
|
||||
combined += keyword_user[icol];
|
||||
|
||||
@ -134,6 +134,14 @@ PairAmoeba::PairAmoeba(LAMMPS *lmp) : Pair(lmp)
|
||||
|
||||
id_pole = id_udalt = id_upalt = nullptr;
|
||||
|
||||
memset(special_hal, 0 , sizeof(special_hal));
|
||||
memset(special_repel, 0 , sizeof(special_repel));
|
||||
memset(special_disp, 0 , sizeof(special_disp));
|
||||
memset(special_mpole, 0 , sizeof(special_mpole));
|
||||
memset(special_polar_pscale, 0 , sizeof(special_polar_pscale));
|
||||
memset(special_polar_piscale, 0 , sizeof(special_polar_piscale));
|
||||
memset(special_polar_wscale, 0 , sizeof(special_polar_wscale));
|
||||
|
||||
nualt = 0;
|
||||
first_flag = 1;
|
||||
first_flag_compute = 1;
|
||||
|
||||
@ -99,13 +99,13 @@ class PairAmoeba : public Pair {
|
||||
|
||||
int poltyp;
|
||||
|
||||
double special_hal[5];
|
||||
double special_repel[5];
|
||||
double special_disp[5];
|
||||
double special_mpole[5];
|
||||
double special_polar_pscale[5];
|
||||
double special_polar_piscale[5];
|
||||
double special_polar_wscale[5];
|
||||
double special_hal[8];
|
||||
double special_repel[8];
|
||||
double special_disp[8];
|
||||
double special_mpole[8];
|
||||
double special_polar_pscale[8];
|
||||
double special_polar_piscale[8];
|
||||
double special_polar_wscale[8];
|
||||
|
||||
double polar_dscale, polar_uscale;
|
||||
|
||||
|
||||
@ -236,7 +236,7 @@ void DumpAtomMPIIO::init_style()
|
||||
|
||||
int icol = 0;
|
||||
columns.clear();
|
||||
for (auto item : utils::split_words(default_columns)) {
|
||||
for (const auto &item : utils::split_words(default_columns)) {
|
||||
if (columns.size()) columns += " ";
|
||||
if (keyword_user[icol].size())
|
||||
columns += keyword_user[icol];
|
||||
|
||||
@ -207,7 +207,7 @@ void DumpCustomMPIIO::init_style()
|
||||
delete[] columns;
|
||||
std::string combined;
|
||||
int icol = 0;
|
||||
for (auto item : utils::split_words(columns_default)) {
|
||||
for (const auto &item : utils::split_words(columns_default)) {
|
||||
if (combined.size()) combined += " ";
|
||||
if (keyword_user[icol].size())
|
||||
combined += keyword_user[icol];
|
||||
|
||||
@ -448,7 +448,7 @@ int plugin_get_num_plugins()
|
||||
int plugin_find(const char *style, const char *name)
|
||||
{
|
||||
int i = 0;
|
||||
for (auto entry : pluginlist) {
|
||||
for (const auto &entry : pluginlist) {
|
||||
if ((strcmp(style, entry.style) == 0) && (strcmp(name, entry.name) == 0)) return i;
|
||||
++i;
|
||||
}
|
||||
|
||||
@ -431,22 +431,21 @@ void FixNVESpin::initial_integrate(int /*vflag*/)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (sector_flag == 0) { // serial seq. update
|
||||
} else { // serial seq. update
|
||||
comm->forward_comm(); // comm. positions of ghost atoms
|
||||
for (int i = 0; i < nlocal; i++) { // advance quarter s for nlocal-1
|
||||
for (int i = 0; i < nlocal; i++) { // advance quarter s for nlocal-1
|
||||
if (mask[i] & groupbit) {
|
||||
ComputeInteractionsSpin(i);
|
||||
AdvanceSingleSpin(i);
|
||||
}
|
||||
}
|
||||
for (int i = nlocal-1; i >= 0; i--) { // advance quarter s for nlocal-1
|
||||
for (int i = nlocal-1; i >= 0; i--) { // advance quarter s for nlocal-1
|
||||
if (mask[i] & groupbit) {
|
||||
ComputeInteractionsSpin(i);
|
||||
AdvanceSingleSpin(i);
|
||||
}
|
||||
}
|
||||
} else error->all(FLERR,"Illegal fix nve/spin command");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -323,7 +323,7 @@ void ComputeReduceChunk::compute_one(int m, double *vchunk, int nstride)
|
||||
{
|
||||
// initialize per-chunk values in accumulation vector
|
||||
|
||||
for (int i = 0; i < nchunk; i += nstride) vchunk[i] = initvalue;
|
||||
for (int i = 0; i < nvalues*nchunk; i += nstride) vchunk[i] = initvalue;
|
||||
|
||||
// loop over my atoms
|
||||
// use peratom input and chunk ID of each atom to update vector
|
||||
|
||||
@ -1067,10 +1067,12 @@ void Dump::modify_params(int narg, char **arg)
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
||||
delete[] output->var_dump[idump];
|
||||
output->var_dump[idump] = utils::strdup(&arg[iarg+1][2]);
|
||||
output->last_dump[idump] = -1;
|
||||
n = 0;
|
||||
} else {
|
||||
n = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (n <= 0) error->all(FLERR, "Invalid dump_modify every argument: {}", n);
|
||||
output->next_dump[idump] = (update->ntimestep/n)*n+n;
|
||||
}
|
||||
output->mode_dump[idump] = 0;
|
||||
output->every_dump[idump] = n;
|
||||
@ -1134,7 +1136,7 @@ void Dump::modify_params(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg],"colname") == 0) {
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "dump_modify colname", error);
|
||||
if (strcmp(arg[iarg+1],"default") == 0) {
|
||||
for (auto item : keyword_user) item.clear();
|
||||
for (auto &item : keyword_user) item.clear();
|
||||
iarg += 2;
|
||||
} else {
|
||||
if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "dump_modify colname", error);
|
||||
|
||||
@ -80,7 +80,7 @@ void DumpAtom::init_style()
|
||||
|
||||
int icol = 0;
|
||||
columns.clear();
|
||||
for (auto item : utils::split_words(default_columns)) {
|
||||
for (const auto &item : utils::split_words(default_columns)) {
|
||||
if (columns.size()) columns += " ";
|
||||
if (keyword_user[icol].size()) columns += keyword_user[icol];
|
||||
else columns += item;
|
||||
|
||||
@ -241,7 +241,7 @@ void DumpCustom::init_style()
|
||||
delete[] columns;
|
||||
std::string combined;
|
||||
int icol = 0;
|
||||
for (auto item : utils::split_words(columns_default)) {
|
||||
for (const auto &item : utils::split_words(columns_default)) {
|
||||
if (combined.size()) combined += " ";
|
||||
if (keyword_user[icol].size()) combined += keyword_user[icol];
|
||||
else combined += item;
|
||||
|
||||
@ -161,7 +161,7 @@ void DumpLocal::init_style()
|
||||
delete[] columns;
|
||||
std::string combined;
|
||||
int icol = 0;
|
||||
for (auto item : utils::split_words(columns_default)) {
|
||||
for (const auto &item : utils::split_words(columns_default)) {
|
||||
if (combined.size()) combined += " ";
|
||||
if (keyword_user[icol].size()) combined += keyword_user[icol];
|
||||
else combined += item;
|
||||
|
||||
@ -260,45 +260,36 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
for (int i = 0; i < nvalues; i++) {
|
||||
if (which[i] == ArgInfo::COMPUTE) {
|
||||
int icompute = modify->find_compute(ids[i]);
|
||||
if (icompute < 0)
|
||||
error->all(FLERR,"Compute ID for fix ave/chunk does not exist");
|
||||
if (modify->compute[icompute]->peratom_flag == 0)
|
||||
error->all(FLERR,"Fix ave/chunk compute does not "
|
||||
"calculate per-atom values");
|
||||
if (argindex[i] == 0 &&
|
||||
modify->compute[icompute]->size_peratom_cols != 0)
|
||||
error->all(FLERR,"Fix ave/chunk compute does not "
|
||||
"calculate a per-atom vector");
|
||||
if (argindex[i] && modify->compute[icompute]->size_peratom_cols == 0)
|
||||
error->all(FLERR,"Fix ave/chunk compute does not "
|
||||
"calculate a per-atom array");
|
||||
if (argindex[i] &&
|
||||
argindex[i] > modify->compute[icompute]->size_peratom_cols)
|
||||
error->all(FLERR,
|
||||
"Fix ave/chunk compute vector is accessed out-of-range");
|
||||
auto icompute = modify->get_compute_by_id(ids[i]);
|
||||
if (!icompute)
|
||||
error->all(FLERR,"Compute ID {} for fix ave/chunk does not exist",ids[i]);
|
||||
if (icompute->peratom_flag == 0)
|
||||
error->all(FLERR,"Fix ave/chunk compute {} does not calculate per-atom values",ids[i]);
|
||||
if (argindex[i] == 0 && (icompute->size_peratom_cols != 0))
|
||||
error->all(FLERR,"Fix ave/chunk compute {} does not calculate a per-atom vector",ids[i]);
|
||||
if (argindex[i] && (icompute->size_peratom_cols == 0))
|
||||
error->all(FLERR,"Fix ave/chunk compute {} does not calculate a per-atom array",ids[i]);
|
||||
if (argindex[i] && (argindex[i] > icompute->size_peratom_cols))
|
||||
error->all(FLERR,"Fix ave/chunk compute {} vector is accessed out-of-range",ids[i]);
|
||||
|
||||
} else if (which[i] == ArgInfo::FIX) {
|
||||
int ifix = modify->find_fix(ids[i]);
|
||||
if (ifix < 0)
|
||||
error->all(FLERR,"Fix ID for fix ave/chunk does not exist");
|
||||
if (modify->fix[ifix]->peratom_flag == 0)
|
||||
error->all(FLERR,
|
||||
"Fix ave/chunk fix does not calculate per-atom values");
|
||||
if (argindex[i] == 0 && modify->fix[ifix]->size_peratom_cols != 0)
|
||||
error->all(FLERR,
|
||||
"Fix ave/chunk fix does not calculate a per-atom vector");
|
||||
if (argindex[i] && modify->fix[ifix]->size_peratom_cols == 0)
|
||||
error->all(FLERR,
|
||||
"Fix ave/chunk fix does not calculate a per-atom array");
|
||||
if (argindex[i] && argindex[i] > modify->fix[ifix]->size_peratom_cols)
|
||||
error->all(FLERR,"Fix ave/chunk fix vector is accessed out-of-range");
|
||||
auto ifix = modify->get_fix_by_id(ids[i]);
|
||||
if (!ifix)
|
||||
error->all(FLERR, "Fix ID {} for fix ave/chunk does not exist",ids[i]);
|
||||
if (ifix->peratom_flag == 0)
|
||||
error->all(FLERR, "Fix ave/chunk fix {} does not calculate per-atom values",ids[i]);
|
||||
if (argindex[i] == 0 && (ifix->size_peratom_cols != 0))
|
||||
error->all(FLERR, "Fix ave/chunk fix {} does not calculate a per-atom vector",ids[i]);
|
||||
if (argindex[i] && (ifix->size_peratom_cols == 0))
|
||||
error->all(FLERR, "Fix ave/chunk fix {} does not calculate a per-atom array",ids[i]);
|
||||
if (argindex[i] && argindex[i] > ifix->size_peratom_cols)
|
||||
error->all(FLERR,"Fix ave/chunk fix {} vector is accessed out-of-range",ids[i]);
|
||||
} else if (which[i] == ArgInfo::VARIABLE) {
|
||||
int ivariable = input->variable->find(ids[i]);
|
||||
if (ivariable < 0)
|
||||
error->all(FLERR,"Variable name for fix ave/chunk does not exist");
|
||||
error->all(FLERR,"Variable name {} for fix ave/chunk does not exist",ids[i]);
|
||||
if (input->variable->atomstyle(ivariable) == 0)
|
||||
error->all(FLERR,"Fix ave/chunk variable is not atom-style variable");
|
||||
error->all(FLERR,"Fix ave/chunk variable {} is not atom-style variable",ids[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,14 +297,12 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) :
|
||||
// only if nrepeat > 1 or ave = RUNNING/WINDOW,
|
||||
// so that locking spans multiple timesteps
|
||||
|
||||
int icompute = modify->find_compute(idchunk);
|
||||
if (icompute < 0)
|
||||
error->all(FLERR,"Chunk/atom compute does not exist for fix ave/chunk");
|
||||
cchunk = dynamic_cast<ComputeChunkAtom *>( modify->compute[icompute]);
|
||||
if (strcmp(cchunk->style,"chunk/atom") != 0)
|
||||
error->all(FLERR,"Fix ave/chunk does not use chunk/atom compute");
|
||||
cchunk = dynamic_cast<ComputeChunkAtom *>(modify->get_compute_by_id(idchunk));
|
||||
if (!cchunk)
|
||||
error->all(FLERR,"Chunk/atom compute {} does not exist or is "
|
||||
"incorrect style for fix ave/chunk",idchunk);
|
||||
|
||||
if (nrepeat > 1 || ave == RUNNING || ave == WINDOW) cchunk->lockcount++;
|
||||
if ((nrepeat > 1) || (ave == RUNNING) || (ave == WINDOW)) cchunk->lockcount++;
|
||||
lockforever = 0;
|
||||
|
||||
// print file comment lines
|
||||
@ -430,9 +419,8 @@ FixAveChunk::~FixAveChunk()
|
||||
// decrement lock counter in compute chunk/atom, it if still exists
|
||||
|
||||
if (nrepeat > 1 || ave == RUNNING || ave == WINDOW) {
|
||||
int icompute = modify->find_compute(idchunk);
|
||||
if (icompute >= 0) {
|
||||
cchunk = dynamic_cast<ComputeChunkAtom *>( modify->compute[icompute]);
|
||||
cchunk = dynamic_cast<ComputeChunkAtom *>(modify->get_compute_by_id(idchunk));
|
||||
if (cchunk) {
|
||||
if (ave == RUNNING || ave == WINDOW) cchunk->unlock(this);
|
||||
cchunk->lockcount--;
|
||||
}
|
||||
|
||||
@ -678,7 +678,7 @@ void FixAveTime::invoke_scalar(bigint ntimestep)
|
||||
if (!yaml_header || overwrite) {
|
||||
yaml_header = true;
|
||||
fputs("keywords: ['Step', ", fp);
|
||||
for (auto k : keyword) fmt::print(fp, "'{}', ", k);
|
||||
for (const auto &k : keyword) fmt::print(fp, "'{}', ", k);
|
||||
fputs("]\ndata:\n", fp);
|
||||
}
|
||||
fmt::print(fp, " - [{}, ", ntimestep);
|
||||
@ -900,7 +900,7 @@ void FixAveTime::invoke_vector(bigint ntimestep)
|
||||
if (!yaml_header || overwrite) {
|
||||
yaml_header = true;
|
||||
fputs("keywords: [", fp);
|
||||
for (auto k : keyword) fmt::print(fp, "'{}', ", k);
|
||||
for (const auto &k : keyword) fmt::print(fp, "'{}', ", k);
|
||||
fputs("]\ndata:\n", fp);
|
||||
}
|
||||
fmt::print(fp, " {}:\n", ntimestep);
|
||||
|
||||
@ -46,7 +46,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg),
|
||||
id_temp(nullptr), id_press(nullptr), tflag(0), pflag(0)
|
||||
{
|
||||
if (narg < 5) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (narg < 5) utils::missing_cmd_args(FLERR, "fix box/relax", error);
|
||||
|
||||
scalar_flag = 1;
|
||||
extscalar = 1;
|
||||
@ -89,7 +89,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"iso") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax iso", error);
|
||||
pcouple = XYZ;
|
||||
p_target[0] = p_target[1] = p_target[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
p_flag[0] = p_flag[1] = p_flag[2] = 1;
|
||||
@ -99,7 +99,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) :
|
||||
}
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"aniso") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax aniso", error);
|
||||
pcouple = NONE;
|
||||
p_target[0] = p_target[1] = p_target[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
p_flag[0] = p_flag[1] = p_flag[2] = 1;
|
||||
@ -109,7 +109,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) :
|
||||
}
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"tri") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax tri", error);
|
||||
pcouple = NONE;
|
||||
scalexy = scalexz = scaleyz = 0;
|
||||
p_target[0] = p_target[1] = p_target[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
@ -123,46 +123,43 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"x") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax x", error);
|
||||
p_target[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
p_flag[0] = 1;
|
||||
deviatoric_flag = 1;
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"y") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax y", error);
|
||||
p_target[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
p_flag[1] = 1;
|
||||
deviatoric_flag = 1;
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"z") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax z", error);
|
||||
p_target[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
p_flag[2] = 1;
|
||||
deviatoric_flag = 1;
|
||||
iarg += 2;
|
||||
if (dimension == 2)
|
||||
error->all(FLERR,"Invalid fix box/relax command for a 2d simulation");
|
||||
if (dimension == 2) error->all(FLERR,"Fix box/relax z not allowed for a 2d simulation");
|
||||
|
||||
} else if (strcmp(arg[iarg],"yz") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax yz", error);
|
||||
p_target[3] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
p_flag[3] = 1;
|
||||
deviatoric_flag = 1;
|
||||
scaleyz = 0;
|
||||
iarg += 2;
|
||||
if (dimension == 2)
|
||||
error->all(FLERR,"Invalid fix box/relax command for a 2d simulation");
|
||||
if (dimension == 2) error->all(FLERR,"Fix box/relax yz not allowed for a 2d simulation");
|
||||
} else if (strcmp(arg[iarg],"xz") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax xz", error);
|
||||
p_target[4] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
p_flag[4] = 1;
|
||||
deviatoric_flag = 1;
|
||||
scalexz = 0;
|
||||
iarg += 2;
|
||||
if (dimension == 2)
|
||||
error->all(FLERR,"Invalid fix box/relax command for a 2d simulation");
|
||||
if (dimension == 2) error->all(FLERR,"Fix box/relax xz not allowed for a 2d simulation");
|
||||
} else if (strcmp(arg[iarg],"xy") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax xy", error);
|
||||
p_target[5] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
p_flag[5] = 1;
|
||||
deviatoric_flag = 1;
|
||||
@ -170,49 +167,50 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"couple") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax couple", error);
|
||||
if (strcmp(arg[iarg+1],"xyz") == 0) pcouple = XYZ;
|
||||
else if (strcmp(arg[iarg+1],"xy") == 0) pcouple = XY;
|
||||
else if (strcmp(arg[iarg+1],"yz") == 0) pcouple = YZ;
|
||||
else if (strcmp(arg[iarg+1],"xz") == 0) pcouple = XZ;
|
||||
else if (strcmp(arg[iarg+1],"none") == 0) pcouple = NONE;
|
||||
else error->all(FLERR,"Illegal fix box/relax command");
|
||||
else error->all(FLERR,"Illegal fix box/relax couple command: {} unknown", arg[iarg+1]);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"dilate") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax dilate", error);
|
||||
if (strcmp(arg[iarg+1],"all") == 0) allremap = 1;
|
||||
else if (strcmp(arg[iarg+1],"partial") == 0) allremap = 0;
|
||||
else error->all(FLERR,"Illegal fix box/relax command");
|
||||
else error->all(FLERR,"Illegal fix box/relax dilate command: {} unkown", arg[iarg+1]);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"vmax") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax vmax", error);
|
||||
vmax = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (vmax <= 0.0) error->all(FLERR,"Fix box/relax vmax value {} must be > 0", vmax);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"nreset") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax nreset", error);
|
||||
nreset_h0 = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (nreset_h0 < 0) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (nreset_h0 < 0) error->all(FLERR,"Fix box/relax nreset value {} must be >= 0", nreset_h0);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"scalexy") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax scalexy", error);
|
||||
scalexy = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"scalexz") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax scalexz", error);
|
||||
scalexz = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"scaleyz") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix box/relax scaleyz", error);
|
||||
scaleyz = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"fixedpoint") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix box/relax fixedpoint", error);
|
||||
fixedpoint[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
fixedpoint[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
fixedpoint[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
iarg += 4;
|
||||
} else error->all(FLERR,"Illegal fix box/relax command");
|
||||
} else error->all(FLERR,"Unknown fix box/relax keyword {}", arg[iarg]);
|
||||
}
|
||||
|
||||
if (p_flag[0]) box_change |= BOX_CHANGE_X;
|
||||
@ -245,61 +243,55 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) :
|
||||
// require periodicity in tensile dimension
|
||||
|
||||
if (p_flag[0] && domain->xperiodic == 0)
|
||||
error->all(FLERR,"Cannot use fix box/relax on a non-periodic dimension");
|
||||
error->all(FLERR,"Cannot use fix box/relax with non-periodic x dimension");
|
||||
if (p_flag[1] && domain->yperiodic == 0)
|
||||
error->all(FLERR,"Cannot use fix box/relax on a non-periodic dimension");
|
||||
error->all(FLERR,"Cannot use fix box/relax with non-periodic y dimension");
|
||||
if (p_flag[2] && domain->zperiodic == 0)
|
||||
error->all(FLERR,"Cannot use fix box/relax on a non-periodic dimension");
|
||||
error->all(FLERR,"Cannot use fix box/relax with non-periodic z dimension");
|
||||
|
||||
// require periodicity in 2nd dim of off-diagonal tilt component
|
||||
|
||||
if (p_flag[3] && domain->zperiodic == 0)
|
||||
error->all(FLERR,
|
||||
"Cannot use fix box/relax on a 2nd non-periodic dimension");
|
||||
error->all(FLERR, "Cannot use fix box/relax yz with non-periodic z dimension");
|
||||
if (p_flag[4] && domain->zperiodic == 0)
|
||||
error->all(FLERR,
|
||||
"Cannot use fix box/relax on a 2nd non-periodic dimension");
|
||||
error->all(FLERR, "Cannot use fix box/relax xz with non-periodic z dimension");
|
||||
if (p_flag[5] && domain->yperiodic == 0)
|
||||
error->all(FLERR,
|
||||
"Cannot use fix box/relax on a 2nd non-periodic dimension");
|
||||
error->all(FLERR, "Cannot use fix box/relax xz with non-periodic y dimension");
|
||||
|
||||
if (scaleyz == 1 && domain->zperiodic == 0)
|
||||
error->all(FLERR,"Cannot use fix box/relax "
|
||||
"with tilt factor scaling on a 2nd non-periodic dimension");
|
||||
error->all(FLERR,"Cannot use fix box/relax with yz tilt factor scaling "
|
||||
"with non-periodic z dimension");
|
||||
if (scalexz == 1 && domain->zperiodic == 0)
|
||||
error->all(FLERR,"Cannot use fix box/relax "
|
||||
"with tilt factor scaling on a 2nd non-periodic dimension");
|
||||
error->all(FLERR,"Cannot use fix box/relax with xz tilt factor scaling "
|
||||
"with non-periodic z dimension");
|
||||
if (scalexy == 1 && domain->yperiodic == 0)
|
||||
error->all(FLERR,"Cannot use fix box/relax "
|
||||
"with tilt factor scaling on a 2nd non-periodic dimension");
|
||||
error->all(FLERR,"Cannot use fix box/relax with xy tilt factor scaling "
|
||||
"with non-periodic y dimension");
|
||||
|
||||
if (p_flag[3] && scaleyz == 1)
|
||||
error->all(FLERR,"Cannot use fix box/relax with "
|
||||
"both relaxation and scaling on a tilt factor");
|
||||
error->all(FLERR,"Cannot use fix box/relax with both yz relaxation "
|
||||
"and scaling on yz tilt factor");
|
||||
if (p_flag[4] && scalexz == 1)
|
||||
error->all(FLERR,"Cannot use fix box/relax with "
|
||||
"both relaxation and scaling on a tilt factor");
|
||||
error->all(FLERR,"Cannot use fix box/relax with both xy relaxation "
|
||||
"and scaling on xz tilt factor");
|
||||
if (p_flag[5] && scalexy == 1)
|
||||
error->all(FLERR,"Cannot use fix box/relax with "
|
||||
"both relaxation and scaling on a tilt factor");
|
||||
error->all(FLERR,"Cannot use fix box/relax with both xy relaxation "
|
||||
"and scaling on xy tilt factor");
|
||||
|
||||
if (!domain->triclinic && (p_flag[3] || p_flag[4] || p_flag[5]))
|
||||
error->all(FLERR,"Can not specify Pxy/Pxz/Pyz in "
|
||||
"fix box/relax with non-triclinic box");
|
||||
error->all(FLERR,"Cannot specify Pxy/Pxz/Pyz in fix box/relax with non-triclinic box");
|
||||
|
||||
if (pcouple == XYZ && dimension == 3 &&
|
||||
(p_target[0] != p_target[1] || p_target[0] != p_target[2]))
|
||||
error->all(FLERR,"Invalid fix box/relax pressure settings");
|
||||
error->all(FLERR,"Fix box/relax pressure for x, y, and z must be the same with couple xyz");
|
||||
if (pcouple == XYZ && dimension == 2 && p_target[0] != p_target[1])
|
||||
error->all(FLERR,"Invalid fix box/relax pressure settings");
|
||||
error->all(FLERR,"Fix box/relax pressure for x and y must be the same with couple xyz");
|
||||
if (pcouple == XY && p_target[0] != p_target[1])
|
||||
error->all(FLERR,"Invalid fix box/relax pressure settings");
|
||||
error->all(FLERR,"Fix box/relax pressure for x and y must be the same with couple xy");
|
||||
if (pcouple == YZ && p_target[1] != p_target[2])
|
||||
error->all(FLERR,"Invalid fix box/relax pressure settings");
|
||||
error->all(FLERR,"Fix box/relax pressure for y and z must be the same with couple yz");
|
||||
if (pcouple == XZ && p_target[0] != p_target[2])
|
||||
error->all(FLERR,"Invalid fix box/relax pressure settings");
|
||||
|
||||
if (vmax <= 0.0) error->all(FLERR,"Illegal fix box/relax command");
|
||||
error->all(FLERR,"Fix box/relax pressure for x and z must be the same with couple xz");
|
||||
|
||||
// pstyle = TRICLINIC if any off-diagonal term is controlled -> 6 dof
|
||||
// else pstyle = ISO if XYZ coupling or XY coupling in 2d -> 1 dof
|
||||
@ -315,7 +307,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) :
|
||||
// and thus its KE/temperature contribution should use group all
|
||||
|
||||
id_temp = utils::strdup(std::string(id) + "_temp");
|
||||
modify->add_compute(fmt::format("{} all temp",id_temp));
|
||||
temperature = modify->add_compute(fmt::format("{} all temp",id_temp));
|
||||
tflag = 1;
|
||||
|
||||
// create a new compute pressure style (virial only)
|
||||
@ -323,7 +315,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) :
|
||||
// pass id_temp as 4th arg to pressure constructor
|
||||
|
||||
id_press = utils::strdup(std::string(id) + "_press");
|
||||
modify->add_compute(fmt::format("{} all pressure {} virial",id_press, id_temp));
|
||||
pressure = modify->add_compute(fmt::format("{} all pressure {} virial", id_press, id_temp));
|
||||
pflag = 1;
|
||||
|
||||
dimension = domain->dimension;
|
||||
@ -337,14 +329,14 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
FixBoxRelax::~FixBoxRelax()
|
||||
{
|
||||
delete [] rfix;
|
||||
delete[] rfix;
|
||||
|
||||
// delete temperature and pressure if fix created them
|
||||
|
||||
if (tflag) modify->delete_compute(id_temp);
|
||||
if (pflag) modify->delete_compute(id_press);
|
||||
delete [] id_temp;
|
||||
delete [] id_press;
|
||||
delete[] id_temp;
|
||||
delete[] id_press;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -362,15 +354,13 @@ void FixBoxRelax::init()
|
||||
{
|
||||
// set temperature and pressure ptrs
|
||||
|
||||
int icompute = modify->find_compute(id_temp);
|
||||
if (icompute < 0)
|
||||
error->all(FLERR,"Temperature ID for fix box/relax does not exist");
|
||||
temperature = modify->compute[icompute];
|
||||
temperature = modify->get_compute_by_id(id_temp);
|
||||
if (!temperature)
|
||||
error->all(FLERR,"Temperature compute ID {} for fix box/relax does not exist", id_temp);
|
||||
|
||||
icompute = modify->find_compute(id_press);
|
||||
if (icompute < 0)
|
||||
error->all(FLERR,"Pressure ID for fix box/relax does not exist");
|
||||
pressure = modify->compute[icompute];
|
||||
pressure = modify->get_compute_by_id(id_press);
|
||||
if (!pressure)
|
||||
error->all(FLERR,"Pressure compute ID {} for fix box/relax does not exist", id_press);
|
||||
|
||||
pv2e = 1.0 / force->nktv2p;
|
||||
|
||||
@ -380,7 +370,7 @@ void FixBoxRelax::init()
|
||||
// detect if any rigid fixes exist so rigid bodies move when box is remapped
|
||||
// rfix[] = indices to each fix rigid
|
||||
|
||||
delete [] rfix;
|
||||
delete[] rfix;
|
||||
nrigid = 0;
|
||||
rfix = nullptr;
|
||||
|
||||
@ -742,49 +732,49 @@ void FixBoxRelax::couple()
|
||||
int FixBoxRelax::modify_param(int narg, char **arg)
|
||||
{
|
||||
if (strcmp(arg[0],"temp") == 0) {
|
||||
if (narg < 2) error->all(FLERR,"Illegal fix_modify command");
|
||||
if (narg < 2) utils::missing_cmd_args(FLERR, "fix_modify", error);
|
||||
if (tflag) {
|
||||
modify->delete_compute(id_temp);
|
||||
tflag = 0;
|
||||
}
|
||||
delete [] id_temp;
|
||||
delete[] id_temp;
|
||||
id_temp = utils::strdup(arg[1]);
|
||||
|
||||
int icompute = modify->find_compute(arg[1]);
|
||||
if (icompute < 0)
|
||||
error->all(FLERR,"Could not find fix_modify temperature ID");
|
||||
temperature = modify->compute[icompute];
|
||||
temperature = modify->get_compute_by_id(id_temp);
|
||||
if (!temperature)
|
||||
error->all(FLERR,"Could not find fix_modify {} temperature compute ID {}", id, id_temp);
|
||||
|
||||
if (temperature->tempflag == 0)
|
||||
error->all(FLERR,
|
||||
"Fix_modify temperature ID does not compute temperature");
|
||||
error->all(FLERR, "Fix_modify {} temperature compute {} does not compute temperature",
|
||||
id, id_temp);
|
||||
if (temperature->igroup != 0 && comm->me == 0)
|
||||
error->warning(FLERR,"Temperature for fix modify is not for group all");
|
||||
error->warning(FLERR,"Temperature compute {} for fix modify {} is not for group all",
|
||||
id, id_temp);
|
||||
|
||||
// reset id_temp of pressure to new temperature ID
|
||||
|
||||
icompute = modify->find_compute(id_press);
|
||||
if (icompute < 0)
|
||||
error->all(FLERR,"Pressure ID for fix modify does not exist");
|
||||
modify->compute[icompute]->reset_extra_compute_fix(id_temp);
|
||||
pressure = modify->get_compute_by_id(id_press);
|
||||
if (!pressure)
|
||||
error->all(FLERR,"Pressure compute ID {} for fix modify {} does not exist", id_press, id);
|
||||
pressure->reset_extra_compute_fix(id_temp);
|
||||
|
||||
return 2;
|
||||
|
||||
} else if (strcmp(arg[0],"press") == 0) {
|
||||
if (narg < 2) error->all(FLERR,"Illegal fix_modify command");
|
||||
if (narg < 2) utils::missing_cmd_args(FLERR, "fix_modify", error);
|
||||
if (pflag) {
|
||||
modify->delete_compute(id_press);
|
||||
pflag = 0;
|
||||
}
|
||||
delete [] id_press;
|
||||
delete[] id_press;
|
||||
id_press = utils::strdup(arg[1]);
|
||||
|
||||
int icompute = modify->find_compute(arg[1]);
|
||||
if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID");
|
||||
pressure = modify->compute[icompute];
|
||||
pressure = modify->get_compute_by_id(id_press);
|
||||
if (!pressure)
|
||||
error->all(FLERR,"Could not find fix_modify {} compute pressure ID {}", id, id_press);
|
||||
|
||||
if (pressure->pressflag == 0)
|
||||
error->all(FLERR,"Fix_modify pressure ID does not compute pressure");
|
||||
error->all(FLERR,"Fix_modify {} pressure compute {} does not compute pressure", id, id_press);
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -38,7 +38,7 @@ FixSpringChunk::FixSpringChunk(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg),
|
||||
idchunk(nullptr), idcom(nullptr), com0(nullptr), fcom(nullptr)
|
||||
{
|
||||
if (narg != 6) error->all(FLERR,"Illegal fix spring/chunk command");
|
||||
if (narg != 6) utils::missing_cmd_args(FLERR, "fix spring/chunk", error);
|
||||
|
||||
restart_global = 1;
|
||||
scalar_flag = 1;
|
||||
@ -66,15 +66,14 @@ FixSpringChunk::~FixSpringChunk()
|
||||
|
||||
// decrement lock counter in compute chunk/atom, it if still exists
|
||||
|
||||
int icompute = modify->find_compute(idchunk);
|
||||
if (icompute >= 0) {
|
||||
cchunk = dynamic_cast<ComputeChunkAtom *>( modify->compute[icompute]);
|
||||
cchunk = dynamic_cast<ComputeChunkAtom *>(modify->get_compute_by_id(idchunk));
|
||||
if (cchunk) {
|
||||
cchunk->unlock(this);
|
||||
cchunk->lockcount--;
|
||||
}
|
||||
|
||||
delete [] idchunk;
|
||||
delete [] idcom;
|
||||
delete[] idchunk;
|
||||
delete[] idcom;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -94,24 +93,19 @@ void FixSpringChunk::init()
|
||||
{
|
||||
// current indices for idchunk and idcom
|
||||
|
||||
int icompute = modify->find_compute(idchunk);
|
||||
if (icompute < 0)
|
||||
error->all(FLERR,"Chunk/atom compute does not exist for fix spring/chunk");
|
||||
cchunk = dynamic_cast<ComputeChunkAtom *>( modify->compute[icompute]);
|
||||
if (strcmp(cchunk->style,"chunk/atom") != 0)
|
||||
error->all(FLERR,"Fix spring/chunk does not use chunk/atom compute");
|
||||
cchunk = dynamic_cast<ComputeChunkAtom *>(modify->get_compute_by_id(idchunk));
|
||||
if (!cchunk)
|
||||
error->all(FLERR,"Chunk/atom compute {} does not exist or is not chunk/atom style", idchunk);
|
||||
|
||||
icompute = modify->find_compute(idcom);
|
||||
if (icompute < 0)
|
||||
error->all(FLERR,"Com/chunk compute does not exist for fix spring/chunk");
|
||||
ccom = dynamic_cast<ComputeCOMChunk *>( modify->compute[icompute]);
|
||||
if (strcmp(ccom->style,"com/chunk") != 0)
|
||||
error->all(FLERR,"Fix spring/chunk does not use com/chunk compute");
|
||||
ccom = dynamic_cast<ComputeCOMChunk *>(modify->get_compute_by_id(idcom));
|
||||
if (!ccom)
|
||||
error->all(FLERR,"Com/chunk compute {} does not exist or is not com/chunk style", idcom);
|
||||
|
||||
// check that idchunk is consistent with ccom->idchunk
|
||||
|
||||
if (strcmp(idchunk,ccom->idchunk) != 0)
|
||||
error->all(FLERR,"Fix spring chunk chunkID not same as comID chunkID");
|
||||
if (ccom && (strcmp(idchunk,ccom->idchunk) != 0))
|
||||
error->all(FLERR,"Fix spring/chunk chunk ID {} not the same as compute com/chunk chunk ID {}",
|
||||
idchunk, ccom->idchunk);
|
||||
|
||||
if (utils::strmatch(update->integrate_style,"^respa")) {
|
||||
ilevel_respa = (dynamic_cast<Respa *>( update->integrate))->nlevels-1;
|
||||
@ -268,21 +262,18 @@ void FixSpringChunk::restart(char *buf)
|
||||
memory->destroy(com0);
|
||||
memory->destroy(fcom);
|
||||
|
||||
int icompute = modify->find_compute(idchunk);
|
||||
if (icompute < 0)
|
||||
error->all(FLERR,"Chunk/atom compute does not exist for fix spring/chunk");
|
||||
cchunk = dynamic_cast<ComputeChunkAtom *>( modify->compute[icompute]);
|
||||
if (strcmp(cchunk->style,"chunk/atom") != 0)
|
||||
error->all(FLERR,"Fix spring/chunk does not use chunk/atom compute");
|
||||
cchunk = dynamic_cast<ComputeChunkAtom *>(modify->get_compute_by_id(idchunk));
|
||||
if (!cchunk)
|
||||
error->all(FLERR,"Chunk/atom compute {} does not exist or is not chunk/atom style", idchunk);
|
||||
|
||||
nchunk = cchunk->setup_chunks();
|
||||
cchunk->compute_ichunk();
|
||||
memory->create(com0,nchunk,3,"spring/chunk:com0");
|
||||
memory->create(fcom,nchunk,3,"spring/chunk:fcom");
|
||||
printf("restart chunks:%d computed chunks: %d\n",n,nchunk);
|
||||
|
||||
if (n != nchunk) {
|
||||
if (comm->me == 0)
|
||||
error->warning(FLERR,"Number of chunks has changed. Cannot use restart");
|
||||
error->warning(FLERR,"Number of chunks changed from {} to {}. Cannot use restart", n, nchunk);
|
||||
memory->destroy(com0);
|
||||
memory->destroy(fcom);
|
||||
nchunk = 1;
|
||||
|
||||
@ -1625,7 +1625,9 @@ auto snprintf_float(T value, int precision, float_specs specs,
|
||||
|
||||
template <typename T>
|
||||
using convert_float_result =
|
||||
conditional_t<std::is_same<T, float>::value || sizeof(T) == sizeof(double),
|
||||
conditional_t<std::is_same<T, float>::value ||
|
||||
std::numeric_limits<T>::digits ==
|
||||
std::numeric_limits<double>::digits,
|
||||
double, T>;
|
||||
|
||||
template <typename T>
|
||||
|
||||
@ -629,7 +629,7 @@ void Thermo::modify_params(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg], "colname") == 0) {
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "thermo_modify colname", error);
|
||||
if (strcmp(arg[iarg + 1], "default") == 0) {
|
||||
for (auto item : keyword_user) item.clear();
|
||||
for (auto &item : keyword_user) item.clear();
|
||||
iarg += 2;
|
||||
} else {
|
||||
if (iarg + 3 > narg) utils::missing_cmd_args(FLERR, "thermo_modify colname", error);
|
||||
@ -658,7 +658,7 @@ void Thermo::modify_params(int narg, char **arg)
|
||||
format_int_user.clear();
|
||||
format_bigint_user.clear();
|
||||
format_float_user.clear();
|
||||
for (auto item : format_column_user) item.clear();
|
||||
for (auto &item : format_column_user) item.clear();
|
||||
iarg += 2;
|
||||
continue;
|
||||
}
|
||||
@ -747,7 +747,7 @@ void Thermo::allocate()
|
||||
|
||||
int i = 0;
|
||||
key2col.clear();
|
||||
for (auto item : utils::split_words(line)) { key2col[item] = i++; }
|
||||
for (const auto &item : utils::split_words(line)) { key2col[item] = i++; }
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user