add some more missing errorurl() calls and error pointers

This commit is contained in:
Axel Kohlmeyer
2025-03-20 21:03:52 -04:00
parent 3b61bcf890
commit e9bc334a14
6 changed files with 259 additions and 166 deletions

View File

@ -81,12 +81,12 @@ ComputeSLCSAAtom::ComputeSLCSAAtom(LAMMPS *lmp, int narg, char **arg) :
int twojmax = utils::inumeric(FLERR, arg[3], false, lmp);
if (twojmax < 0)
error->all(FLERR, "Illegal compute slcsa/atom command: twojmax must be a non-negative integer");
error->all(FLERR, 3, "Illegal compute slcsa/atom command: twojmax must be >= 0");
ncomps = compute_ncomps(twojmax);
nclasses = utils::inumeric(FLERR, arg[4], false, lmp);
if (nclasses < 2)
error->all(FLERR, "Illegal compute slcsa/atom command: nclasses must be greater than 1");
error->all(FLERR, 4, "Illegal compute slcsa/atom command: nclasses must be greater than 1");
database_mean_descriptor_file = arg[5];
lda_scalings_file = arg[6];
@ -116,11 +116,12 @@ ComputeSLCSAAtom::ComputeSLCSAAtom(LAMMPS *lmp, int narg, char **arg) :
val.which = argi.get_type();
val.argindex = argi.get_index1();
val.id = argi.get_name();
if ((val.which == ArgInfo::FIX) || (val.which == ArgInfo::VARIABLE) ||
(val.which == ArgInfo::UNKNOWN) || (val.which == ArgInfo::NONE) || (argi.get_dim() > 1))
error->all(FLERR, "Invalid compute slcsa/atom argument: {}", arg[0]);
error->all(FLERR, 10, "Invalid compute slcsa/atom argument: {}", arg[0]);
// if wildcard expansion occurred, free earg memory from exapnd_args()
// if wildcard expansion occurred, free earg memory from expand_args()
if (expand) {
for (int i = 0; i < nvalues; i++) delete[] earg[i];
@ -128,15 +129,19 @@ ComputeSLCSAAtom::ComputeSLCSAAtom(LAMMPS *lmp, int narg, char **arg) :
}
val.val.c = modify->get_compute_by_id(val.id);
if (!val.val.c) error->all(FLERR, "Compute ID {} for fix slcsa/atom does not exist", val.id);
if (!val.val.c) error->all(FLERR, 10, "Compute ID {} for fix slcsa/atom does not exist", val.id);
if (val.val.c->peratom_flag == 0)
error->all(FLERR, "Compute slcsa/atom compute {} does not calculate per-atom values", val.id);
error->all(FLERR, 10, "Compute slcsa/atom compute {} does not calculate per-atom values",
val.id);
if (val.argindex == 0 && val.val.c->size_peratom_cols != 0)
error->all(FLERR, "Compute slcsa/atom compute {} does not calculate a per-atom vector", val.id);
error->all(FLERR, 10, "Compute slcsa/atom compute {} does not calculate a per-atom vector",
val.id);
if (val.argindex && val.val.c->size_peratom_cols == 0)
error->all(FLERR, "Compute slcsa/atom compute {} does not calculate a per-atom array", val.id);
error->all(FLERR, 10, "Compute slcsa/atom compute {} does not calculate a per-atom array",
val.id);
if (val.argindex && val.argindex > val.val.c->size_peratom_cols)
error->all(FLERR, "Compute slcsa/atom compute {} array is accessed out-of-range", val.id);
error->all(FLERR, 10, "Compute slcsa/atom compute {} array is accessed out-of-range{}", val.id,
utils::errorurl(20));
descriptorval = val;
memory->create(database_mean_descriptor, ncomps, "slcsa/atom:database_mean_descriptor");
memory->create(lda_scalings, ncomps, nclasses - 1, "slcsa/atom:lda_scalings");
@ -150,7 +155,7 @@ ComputeSLCSAAtom::ComputeSLCSAAtom(LAMMPS *lmp, int narg, char **arg) :
if (comm->me == 0) {
if (strcmp(database_mean_descriptor_file, "NULL") == 0) {
error->one(FLERR,
error->one(FLERR, Error::NOLASTLINE,
"Cannot open database mean descriptor file {}: ", database_mean_descriptor_file,
utils::getsyserror());
} else {
@ -165,8 +170,8 @@ ComputeSLCSAAtom::ComputeSLCSAAtom(LAMMPS *lmp, int narg, char **arg) :
}
if (strcmp(lda_scalings_file, "NULL") == 0) {
error->one(FLERR, "Cannot open database linear discriminant analysis scalings file {}: ",
lda_scalings_file, utils::getsyserror());
error->one(FLERR, Error::NOLASTLINE, "Cannot open database linear discriminant analysis "
"scalings file {}: ", lda_scalings_file, utils::getsyserror());
} else {
PotentialFileReader reader(lmp, lda_scalings_file, "lda scalings file");
int nread = 0;
@ -180,8 +185,8 @@ ComputeSLCSAAtom::ComputeSLCSAAtom(LAMMPS *lmp, int narg, char **arg) :
}
if (strcmp(lr_decision_file, "NULL") == 0) {
error->one(FLERR, "Cannot open logistic regression decision file {}: ", lr_decision_file,
utils::getsyserror());
error->one(FLERR, Error::NOLASTLINE, "Cannot open logistic regression decision file {}: ",
lr_decision_file, utils::getsyserror());
} else {
PotentialFileReader reader(lmp, lr_decision_file, "lr decision file");
int nread = 0;
@ -195,8 +200,8 @@ ComputeSLCSAAtom::ComputeSLCSAAtom(LAMMPS *lmp, int narg, char **arg) :
}
if (strcmp(lr_bias_file, "NULL") == 0) {
error->one(FLERR, "Cannot open logistic regression bias file {}: ", lr_bias_file,
utils::getsyserror());
error->one(FLERR, Error::NOLASTLINE, "Cannot open logistic regression bias file {}: ",
lr_bias_file, utils::getsyserror());
} else {
PotentialFileReader reader(lmp, lr_bias_file, "lr bias file");
auto values = reader.next_values(nclasses);
@ -207,7 +212,8 @@ ComputeSLCSAAtom::ComputeSLCSAAtom(LAMMPS *lmp, int narg, char **arg) :
}
if (strcmp(maha_file, "NULL") == 0) {
error->one(FLERR, "Cannot open mahalanobis stats file {}: ", maha_file, utils::getsyserror());
error->one(FLERR, Error::NOLASTLINE, "Cannot open mahalanobis stats file {}: ", maha_file,
utils::getsyserror());
} else {
PotentialFileReader reader(lmp, maha_file, "mahalanobis stats file");
int nvalues = nclasses * ((nclasses - 1) * (nclasses - 1) + nclasses);

View File

@ -225,8 +225,8 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS *lmp, int narg, char **arg) :
"Fix ave/correlate/long compute {} does not calculate a vector", val.id);
if (val.argindex && val.argindex > val.val.c->size_vector)
error->all(FLERR, val.iarg,
"Fix ave/correlate/long compute {} vector is accessed out-of-range",
val.id);
"Fix ave/correlate/long compute {} vector is accessed out-of-range{}",
val.id, utils::errorurl(20));
} else if (val.which == ArgInfo::FIX) {
val.val.f = modify->get_fix_by_id(val.id);
@ -241,7 +241,8 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS *lmp, int narg, char **arg) :
"Fix ave/correlate/long fix {} does not calculate a vector", val.id);
if (val.argindex && val.argindex > val.val.f->size_vector)
error->all(FLERR, val.iarg,
"Fix ave/correlate/long fix {} vector is accessed out-of-range", val.id);
"Fix ave/correlate/long fix {} vector is accessed out-of-range{}",
val.id, utils::errorurl(20));
if (nevery % val.val.f->global_freq)
error->all(FLERR, val.iarg,
"Fix {} for fix ave/correlate/long not computed at compatible time{}",
@ -257,8 +258,7 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS *lmp, int narg, char **arg) :
"Fix ave/correlate/long variable {} is not equal-style variable", val.id);
if (val.argindex && input->variable->vectorstyle(val.val.v) == 0)
error->all(FLERR, val.iarg,
"Fix ave/correlate/long variable {} is not vector-style variable",
val.id);
"Fix ave/correlate/long variable {} is not vector-style variable", val.id);
}
}

View File

@ -39,7 +39,7 @@ FixController::FixController(LAMMPS *lmp, int narg, char **arg) :
extvector = 0;
nevery = utils::inumeric(FLERR,arg[3],false,lmp);
if (nevery <= 0) error->all(FLERR,"Illegal fix controller command");
if (nevery <= 0) error->all(FLERR, 3, "Illegal fix controller nevery value {}", nevery);
alpha = utils::numeric(FLERR,arg[4],false,lmp);
kp = utils::numeric(FLERR,arg[5],false,lmp);
@ -52,7 +52,7 @@ FixController::FixController(LAMMPS *lmp, int narg, char **arg) :
if ((argi.get_type() == ArgInfo::UNKNOWN)
|| (argi.get_type() == ArgInfo::NONE)
|| (argi.get_dim() != 0))
error->all(FLERR,"Illegal fix controller command");
error->all(FLERR,8,"Illegal fix controller argument {}", arg[8]);
pvwhich = argi.get_type();
pvindex = argi.get_index1();
@ -60,48 +60,51 @@ FixController::FixController(LAMMPS *lmp, int narg, char **arg) :
// setpoint arg
int iarg=9;
setpoint = utils::numeric(FLERR,arg[iarg],false,lmp);
iarg++;
setpoint = utils::numeric(FLERR,arg[9],false,lmp);
// control variable arg
cvID = utils::strdup(arg[iarg]);
cvID = utils::strdup(arg[10]);
// error check
if (pvwhich == ArgInfo::COMPUTE) {
Compute *c = modify->get_compute_by_id(pvID);
if (!c) error->all(FLERR,"Compute ID {} for fix controller does not exist", pvID);
if (!c) error->all(FLERR, 8, "Compute ID {} for fix controller does not exist", pvID);
int flag = 0;
if (c->scalar_flag && pvindex == 0) flag = 1;
else if (c->vector_flag && pvindex > 0) flag = 1;
if (!flag)
error->all(FLERR,"Fix controller compute does not calculate a global scalar or vector");
error->all(FLERR, 8, "Fix controller compute {} does not calculate a global scalar or "
"vector", pvID);
if (pvindex && pvindex > c->size_vector)
error->all(FLERR,"Fix controller compute vector is accessed out-of-range");
error->all(FLERR, 8, "Fix controller compute {} vector is accessed out-of-range{}",
pvID, utils::errorurl(20));
} else if (pvwhich == ArgInfo::FIX) {
Fix *f = modify->get_fix_by_id(pvID);
if (!f) error->all(FLERR,"Fix ID {} for fix controller does not exist", pvID);
if (!f) error->all(FLERR, 8, "Fix ID {} for fix controller does not exist", pvID);
int flag = 0;
if (f->scalar_flag && pvindex == 0) flag = 1;
else if (f->vector_flag && pvindex > 0) flag = 1;
if (!flag) error->all(FLERR,"Fix controller fix does not calculate a global scalar or vector");
if (!flag)
error->all(FLERR, 8, "Fix controller fix {} does not calculate a global scalar or vector",
pvID);
if (pvindex && pvindex > f->size_vector)
error->all(FLERR,"Fix controller fix vector is accessed out-of-range");
error->all(FLERR, 8, "Fix controller fix {} vector is accessed out-of-range{}", pvID,
utils::errorurl(20));
} else if (pvwhich == ArgInfo::VARIABLE) {
int ivariable = input->variable->find(pvID);
if (ivariable < 0)
error->all(FLERR,"Variable name for fix controller does not exist");
error->all(FLERR, 8, "Variable name {} for fix controller does not exist", pvID);
if (input->variable->equalstyle(ivariable) == 0)
error->all(FLERR,"Fix controller variable is not equal-style variable");
error->all(FLERR, 8, "Fix controller variable {} is not equal-style variable", pvID);
}
int ivariable = input->variable->find(cvID);
if (ivariable < 0)
error->all(FLERR,"Variable name for fix controller does not exist");
error->all(FLERR, 10, "Variable name {} for fix controller does not exist", cvID);
if (input->variable->internalstyle(ivariable) == 0)
error->all(FLERR,"Fix controller variable is not internal-style variable");
error->all(FLERR, 10, "Fix controller variable {} is not internal-style variable", cvID);
control = input->variable->compute_equal(ivariable);
firsttime = 1;
@ -130,19 +133,26 @@ void FixController::init()
{
if (pvwhich == ArgInfo::COMPUTE) {
pcompute = modify->get_compute_by_id(pvID);
if (!pcompute) error->all(FLERR,"Compute ID {} for fix controller does not exist", pvID);
if (!pcompute)
error->all(FLERR, Error::NOLASTLINE,
"Compute ID {} for fix controller does not exist", pvID);
} else if (pvwhich == ArgInfo::FIX) {
pfix = modify->get_fix_by_id(pvID);
if (!pfix) error->all(FLERR,"Fix ID {} for fix controller does not exist", pvID);
if (!pfix)
error->all(FLERR, Error::NOLASTLINE, "Fix ID {} for fix controller does not exist", pvID);
} else if (pvwhich == ArgInfo::VARIABLE) {
pvar = input->variable->find(pvID);
if (pvar < 0) error->all(FLERR,"Variable name for fix controller does not exist");
if (pvar < 0)
error->all(FLERR, Error::NOLASTLINE, "Variable name {} for fix controller does not exist",
pvID);
}
cvar = input->variable->find(cvID);
if (cvar < 0) error->all(FLERR,"Variable name for fix controller does not exist");
if (cvar < 0)
error->all(FLERR, Error::NOLASTLINE, "Variable name {} for fix controller does not exist",
cvID);
// set sampling time

View File

@ -1811,7 +1811,8 @@ int DumpVTK::parse_fields(int narg, char **arg)
if (argi.get_dim() > 0 && ifix->size_peratom_cols == 0)
error->all(FLERR,"Dump vtk fix {} does not compute per-atom array",aname);
if (argi.get_dim() > 0 && argi.get_index1() > ifix->size_peratom_cols)
error->all(FLERR,"Dump vtk fix {} vector is accessed out-of-range",aname);
error->all(FLERR,"Dump vtk fix {} vector is accessed out-of-range{}",
aname, utils::errorurl(20));
field2index[ATTRIBUTES+iarg] = add_fix(aname);
name[ATTRIBUTES+iarg] = arg[iarg];
@ -1851,7 +1852,8 @@ int DumpVTK::parse_fields(int narg, char **arg)
if (!flag || !cols)
error->all(FLERR,"Property double array {} for dump vtk does not exist",aname);
if (argindex[ATTRIBUTES+iarg] > atom->dcols[n])
error->all(FLERR,"Dump vtk property array {} is accessed out-of-range",aname);
error->all(FLERR,"Dump vtk property array {} is accessed out-of-range{}",aname,
utils::errorurl(20));
}
field2index[ATTRIBUTES+iarg] = add_custom(aname,1);
name[ATTRIBUTES+iarg] = arg[iarg];
@ -1874,7 +1876,8 @@ int DumpVTK::parse_fields(int narg, char **arg)
if (flag || !cols)
error->all(FLERR,"Property integer array {} for dump vtk does not exist",aname);
if (argindex[ATTRIBUTES+iarg] > atom->icols[n])
error->all(FLERR,"Dump vtk property array {} is accessed out-of-range",aname);
error->all(FLERR,"Dump vtk property array {} is accessed out-of-range{}",aname,
utils::errorurl(20));
}
field2index[ATTRIBUTES+iarg] = add_custom(aname,0);
name[ATTRIBUTES+iarg] = arg[iarg];

View File

@ -310,7 +310,8 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) :
"Fix ave/atom compute {} does not calculate a per-atom array", ids[i]);
if (argindex[i] && (argindex[i] > icompute->size_peratom_cols))
error->all(FLERR, iarg_orig[i],
"Fix ave/atom compute {} array is accessed out-of-range", ids[i]);
"Fix ave/atom compute {} array is accessed out-of-range{}", ids[i],
utils::errorurl(20));
} else if (which[i] == ArgInfo::FIX) {
auto ifix = modify->get_fix_by_id(ids[i]);
@ -327,10 +328,12 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) :
"Fix ave/atom fix {} does not calculate a per-atom array", ids[i]);
if (argindex[i] && (argindex[i] > ifix->size_peratom_cols))
error->all(FLERR, iarg_orig[i],
"Fix ave/atom fix {} array is accessed out-of-range", ids[i]);
"Fix ave/atom fix {} array is accessed out-of-range{}", ids[i],
utils::errorurl(20));
if (nevery % ifix->peratom_freq)
error->all(FLERR, iarg_orig[i],
"Fix {} for fix ave/atom not computed at compatible time", ids[i]);
"Fix {} for fix ave/atom not computed at compatible time{}", ids[i],
utils::errorurl(7));
} else if (which[i] == ArgInfo::VARIABLE) {
int ivariable = input->variable->find(ids[i]);

View File

@ -57,10 +57,11 @@ enum{TYPE,TYPE_FRACTION,TYPE_RATIO,TYPE_SUBSET,
void Set::command(int narg, char **arg)
{
if (domain->box_exist == 0)
error->all(FLERR,"Set command before simulation box is defined");
error->all(FLERR, Error::NOLASTLINE, "Set command before simulation box is defined"
+ utils::errorurl(0));
if (atom->natoms == 0)
error->all(FLERR,"Set command on system without atoms");
if (narg < 4) error->all(FLERR,"Illegal set command: need at least four arguments");
error->all(FLERR, Error::NOLASTLINE, "Set command on system without atoms");
if (narg < 4) error->all(FLERR, 1, "Illegal set command: need at least four arguments");
// style and ID info
@ -69,7 +70,7 @@ void Set::command(int narg, char **arg)
else if (strcmp(arg[0],"type") == 0) style = TYPE_SELECT;
else if (strcmp(arg[0],"group") == 0) style = GROUP_SELECT;
else if (strcmp(arg[0],"region") == 0) style = REGION_SELECT;
else error->all(FLERR,"Unknown set command style: {}", arg[0]);
else error->all(FLERR, Error::ARGZERO, "Unknown set command style: {}", arg[0]);
id = utils::strdup(arg[1]);
select = nullptr;
@ -101,11 +102,13 @@ void Set::command(int narg, char **arg)
fraction = utils::numeric(FLERR, arg[iarg+2], false, lmp);
ivalue = utils::inumeric(FLERR, arg[iarg+3], false, lmp);
if (newtype <= 0 || newtype > atom->ntypes)
error->all(FLERR,"Invalid type value {} in set type/fraction command", newtype);
error->all(FLERR, iarg + 1, "Invalid type value {} in set type/fraction command", newtype);
if (fraction < 0.0 || fraction > 1.0)
error->all(FLERR,"Invalid fraction value {} in set type/fraction command", fraction);
error->all(FLERR, iarg + 2, "Invalid fraction value {} in set type/fraction command",
fraction);
if (ivalue <= 0)
error->all(FLERR,"Invalid random number seed {} in set type/fraction command", ivalue);
error->all(FLERR, iarg + 3, "Invalid random number seed {} in set type/fraction command",
ivalue);
setrandom(TYPE_FRACTION);
iarg += 4;
@ -115,11 +118,13 @@ void Set::command(int narg, char **arg)
fraction = utils::numeric(FLERR, arg[iarg+2], false, lmp);
ivalue = utils::inumeric(FLERR, arg[iarg+3], false, lmp);
if (newtype <= 0 || newtype > atom->ntypes)
error->all(FLERR,"Invalid type value {} in set type/ratio command", newtype);
error->all(FLERR, iarg + 1, "Invalid type value {} in set type/ratio command", newtype);
if (fraction < 0.0 || fraction > 1.0)
error->all(FLERR,"Invalid fraction value {} in set type/ratio command", fraction);
error->all(FLERR, iarg + 2, "Invalid fraction value {} in set type/ratio command",
fraction);
if (ivalue <= 0)
error->all(FLERR,"Invalid random number seed {} in set type/ratio command", ivalue);
error->all(FLERR, iarg + 3, "Invalid random number seed {} in set type/ratio command",
ivalue);
setrandom(TYPE_RATIO);
iarg += 4;
@ -129,11 +134,12 @@ void Set::command(int narg, char **arg)
nsubset = utils::bnumeric(FLERR, arg[iarg+2], false, lmp);
ivalue = utils::inumeric(FLERR, arg[iarg+3], false, lmp);
if (newtype <= 0 || newtype > atom->ntypes)
error->all(FLERR,"Invalid type value {} in set type/subset command", newtype);
error->all(FLERR, iarg + 1, "Invalid type value {} in set type/subset command", newtype);
if (nsubset < 0)
error->all(FLERR,"Invalid subset size {} in set type/subset command", nsubset);
error->all(FLERR, iarg + 2, "Invalid subset size {} in set type/subset command", nsubset);
if (ivalue <= 0)
error->all(FLERR,"Invalid random number seed {} in set type/subset command", ivalue);
error->all(FLERR, iarg + 3, "Invalid random number seed {} in set type/subset command",
ivalue);
setrandom(TYPE_SUBSET);
iarg += 4;
@ -142,7 +148,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->molecule_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(MOLECULE);
iarg += 2;
@ -193,7 +200,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->q_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(CHARGE);
iarg += 2;
@ -202,7 +210,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->rmass_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(MASS);
iarg += 2;
@ -215,7 +224,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
if (!atom->ellipsoid_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(SHAPE);
iarg += 4;
@ -224,7 +234,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->line_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(LENGTH);
iarg += 2;
@ -233,7 +244,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->tri_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(TRI);
iarg += 2;
@ -246,7 +258,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
if (!atom->mu_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(DIPOLE);
iarg += 4;
@ -255,11 +268,12 @@ void Set::command(int narg, char **arg)
ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
dvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
if (!atom->mu_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
if (ivalue <= 0)
error->all(FLERR,"Invalid random number seed in set command");
error->all(FLERR, iarg + 1, "Invalid random number seed in set command");
if (dvalue <= 0.0)
error->all(FLERR,"Invalid dipole length in set command");
error->all(FLERR, iarg + 2, "Invalid dipole length in set command");
setrandom(DIPOLE_RANDOM);
iarg += 3;
@ -276,11 +290,13 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+4],"^v_")) varparse(arg[iarg+4],4);
else zvalue = utils::numeric(FLERR,arg[iarg+4],false,lmp);
if ((xvalue == 0.0) && (yvalue == 0.0) && (zvalue == 0.0))
error->all(FLERR,"At least one spin vector component must be non-zero");
error->all(FLERR, Error::NOPOINTER, "At least one spin vector component must be non-zero");
if (!atom->sp_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
if (dvalue <= 0.0)
error->all(FLERR,"Invalid spin magnitude {} in set {} command", dvalue, arg[iarg]);
error->all(FLERR, iarg + 1, "Invalid spin magnitude {} in set {} command", dvalue,
arg[iarg]);
set(SPIN_ATOM);
iarg += 5;
@ -293,11 +309,14 @@ void Set::command(int narg, char **arg)
error->warning(FLERR, "Set attribute spin/random is deprecated. "
"Please use spin/atom/random instead.");
if (!atom->sp_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
if (ivalue <= 0)
error->all(FLERR,"Invalid random number seed {} in set {} command", ivalue, arg[iarg]);
error->all(FLERR, iarg + 1, "Invalid random number seed {} in set {} command", ivalue,
arg[iarg]);
if (dvalue <= 0.0)
error->all(FLERR,"Invalid spin magnitude {} in set {} command", dvalue, arg[iarg]);
error->all(FLERR, iarg + 2, "Invalid spin magnitude {} in set {} command", dvalue,
arg[iarg]);
setrandom(SPIN_RANDOM);
iarg += 3;
@ -306,7 +325,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->eradius_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(RADIUS_ELECTRON);
iarg += 2;
@ -315,7 +335,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->spin_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(SPIN_ELECTRON);
iarg += 2;
@ -330,7 +351,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+4],"^v_")) varparse(arg[iarg+4],4);
else wvalue = utils::numeric(FLERR,arg[iarg+4],false,lmp);
if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag && !atom->quat_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(QUAT);
iarg += 5;
@ -338,9 +360,10 @@ void Set::command(int narg, char **arg)
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set quat/random", error);
ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag && !atom->quat_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
if (ivalue <= 0)
error->all(FLERR,"Invalid random number seed in set command");
error->all(FLERR, iarg + 1, "Invalid random number seed in set command");
setrandom(QUAT_RANDOM);
iarg += 2;
@ -349,7 +372,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = DEG2RAD * utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->line_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(THETA);
iarg += 2;
@ -357,9 +381,10 @@ void Set::command(int narg, char **arg)
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set theta/random", error);
ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->line_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
if (ivalue <= 0)
error->all(FLERR,"Invalid random number seed in set command");
error->all(FLERR, iarg + 1, "Invalid random number seed in set command");
set(THETA_RANDOM);
iarg += 2;
@ -372,7 +397,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
if (!atom->angmom_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(ANGMOM);
iarg += 4;
@ -385,7 +411,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
if (!atom->omega_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(OMEGA);
iarg += 4;
@ -394,7 +421,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->radius_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(RADIUS_ATOM);
iarg += 2;
@ -403,7 +431,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->radius_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(DIAMETER);
iarg += 2;
@ -413,13 +442,14 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->rmass_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
if (dvalue <= 0.0) error->all(FLERR,"Invalid density in set command");
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
if (dvalue <= 0.0) error->all(FLERR, iarg + 1, "Invalid density in set command");
discflag = 0;
if (strcmp(arg[iarg],"density/disc") == 0) {
discflag = 1;
if (domain->dimension != 2)
error->all(FLERR,"Density/disc option requires 2d simulation");
error->all(FLERR, Error::NOLASTLINE, "Density/disc option requires 2d simulation");
}
set(DENSITY);
iarg += 2;
@ -429,7 +459,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->temperature_flag)
error->all(FLERR,"Cannot set this attribute for this atom style");
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(TEMPERATURE);
iarg += 2;
@ -438,8 +469,9 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->vfrac_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
if (dvalue <= 0.0) error->all(FLERR,"Invalid volume in set command");
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
if (dvalue <= 0.0) error->all(FLERR, iarg + 1, "Invalid volume in set command");
set(VOLUME);
iarg += 2;
@ -462,14 +494,11 @@ void Set::command(int narg, char **arg)
else zimage = utils::inumeric(FLERR,arg[iarg+3],false,lmp);
}
if (ximageflag && ximage && !domain->xperiodic)
error->all(FLERR,
"Cannot set non-zero image flag for non-periodic dimension");
error->all(FLERR, iarg + 1,"Cannot set non-zero image flag for non-periodic dimension");
if (yimageflag && yimage && !domain->yperiodic)
error->all(FLERR,
"Cannot set non-zero image flag for non-periodic dimension");
error->all(FLERR, iarg + 2, "Cannot set non-zero image flag for non-periodic dimension");
if (zimageflag && zimage && !domain->zperiodic)
error->all(FLERR,
"Cannot set non-zero image flag for non-periodic dimension");
error->all(FLERR, iarg + 3, "Cannot set non-zero image flag for non-periodic dimension");
set(IMAGE);
iarg += 4;
@ -477,9 +506,10 @@ void Set::command(int narg, char **arg)
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set bond", error);
ivalue = utils::expand_type_int(FLERR, arg[iarg+1], Atom::BOND, lmp);
if (atom->avec->bonds_allow == 0)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
if (ivalue <= 0 || ivalue > atom->nbondtypes)
error->all(FLERR,"Invalid value in set command");
error->all(FLERR, iarg + 1, "Invalid value {} in set bond command", ivalue);
topology(BOND);
iarg += 2;
@ -487,9 +517,10 @@ void Set::command(int narg, char **arg)
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set angle", error);
ivalue = utils::expand_type_int(FLERR, arg[iarg+1], Atom::ANGLE, lmp);
if (atom->avec->angles_allow == 0)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
if (ivalue <= 0 || ivalue > atom->nangletypes)
error->all(FLERR,"Invalid value in set command");
error->all(FLERR, iarg + 1, "Invalid value {} in set angle command", ivalue);
topology(ANGLE);
iarg += 2;
@ -497,8 +528,10 @@ void Set::command(int narg, char **arg)
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set dihedral", error);
ivalue = utils::expand_type_int(FLERR, arg[iarg+1], Atom::DIHEDRAL, lmp);
if (atom->avec->dihedrals_allow == 0)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
if (ivalue <= 0 || ivalue > atom->ndihedraltypes)
error->all(FLERR, iarg + 1, "Invalid value {} in set dihedral command", ivalue);
error->all(FLERR,"Invalid value in set command");
topology(DIHEDRAL);
iarg += 2;
@ -507,9 +540,10 @@ void Set::command(int narg, char **arg)
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set improper", error);
ivalue = utils::expand_type_int(FLERR, arg[iarg+1], Atom::IMPROPER, lmp);
if (atom->avec->impropers_allow == 0)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
if (ivalue <= 0 || ivalue > atom->nimpropertypes)
error->all(FLERR,"Invalid value in set command");
error->all(FLERR, iarg + 1, "Invalid value {} in set improper command", ivalue);
topology(IMPROPER);
iarg += 2;
@ -518,7 +552,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->rho_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(SPH_RHO);
iarg += 2;
@ -527,7 +562,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->rheo_status_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(RHEO_STATUS);
iarg += 2;
@ -536,7 +572,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->esph_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(SPH_E);
iarg += 2;
@ -545,7 +582,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->cv_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(SPH_CV);
iarg += 2;
@ -554,7 +592,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->rho_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(SPH_RHO);
iarg += 2;
@ -564,10 +603,12 @@ void Set::command(int narg, char **arg)
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else {
dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (dvalue < 0.0) error->all(FLERR,"Illegal set command");
if (dvalue < 0.0)
error->all(FLERR, iarg + 1, "Invalid value {} in set edpd/temp command", dvalue);
}
if (!atom->edpd_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(EDPD_TEMP);
iarg += 2;
@ -577,10 +618,12 @@ void Set::command(int narg, char **arg)
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else {
dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (dvalue < 0.0) error->all(FLERR,"Illegal set command");
if (dvalue < 0.0)
error->all(FLERR, iarg + 1, "Invalid value {} in set edpd/cv command", dvalue);
}
if (!atom->edpd_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(EDPD_CV);
iarg += 2;
@ -592,9 +635,11 @@ void Set::command(int narg, char **arg)
cc_index = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
dvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
if (cc_index < 1) error->all(FLERR,"Illegal set command");
error->all(FLERR, iarg + 1, "Invalid index value {} in set cc command", cc_index);
}
if (!atom->tdpd_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(CC);
iarg += 3;
@ -603,7 +648,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->smd_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(SMD_MASS_DENSITY);
iarg += 2;
@ -612,7 +658,8 @@ void Set::command(int narg, char **arg)
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (!atom->smd_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(SMD_CONTACT_RADIUS);
iarg += 2;
@ -622,10 +669,12 @@ void Set::command(int narg, char **arg)
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else {
dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (dvalue < 0.0) error->all(FLERR,"Illegal set command");
if (dvalue < 0.0)
error->all(FLERR, iarg + 1, "Invalid value {} in set dpd/theta command", dvalue);
}
if (!atom->dpd_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(DPDTHETA);
iarg += 2;
@ -635,10 +684,12 @@ void Set::command(int narg, char **arg)
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else {
dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (dvalue < 0.0) error->all(FLERR,"Illegal set command");
if (dvalue < 0.0)
error->all(FLERR, iarg + 1, "Invalid value {} in set epsilon command", dvalue);
}
if (!atom->dielectric_flag)
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg],
atom->get_style());
set(EPSILON);
iarg += 2;
@ -652,26 +703,29 @@ void Set::command(int narg, char **arg)
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set", error);
index_custom = atom->find_custom(argi.get_name(),flag,cols);
if (index_custom < 0)
error->all(FLERR,"Set keyword or custom property {} does not exist",pname);
error->all(FLERR, iarg, "Set keyword or custom property {} does not exist", pname);
switch (argi.get_type()) {
case ArgInfo::INAME:
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (flag != 0) error->all(FLERR,"Set command custom property {} is not integer",pname);
if (flag != 0)
error->all(FLERR, iarg + 1, "Set command custom property {} is not integer", pname);
if (argi.get_dim() == 0) {
if (cols > 0)
error->all(FLERR,"Set command custom integer property {} is not a vector",pname);
error->all(FLERR, iarg, "Set command custom integer property {} is not a vector",
pname);
set(IVEC);
} else if (argi.get_dim() == 1) {
if (cols == 0)
error->all(FLERR,"Set command custom integer property {} is not an array",pname);
error->all(FLERR, iarg, "Set command custom integer property {} is not an array",
pname);
icol_custom = argi.get_index1();
if (icol_custom <= 0 || icol_custom > cols)
error->all(FLERR,"Set command per-atom custom integer array {} is accessed "
"out-of-range",pname);
error->all(FLERR, iarg, "Set command per-atom custom integer array {} is accessed "
"out-of-range{}", pname, utils::errorurl(20));
set(IARRAY);
} else error->all(FLERR,"Illegal set command");
break;
@ -683,15 +737,15 @@ void Set::command(int narg, char **arg)
if (argi.get_dim() == 0) {
if (cols > 0)
error->all(FLERR,"Set command custom double property {} is not a vector",pname);
error->all(FLERR, iarg, "Set command custom double property {} is not a vector", pname);
set(DVEC);
} else if (argi.get_dim() == 1) {
if (cols == 0)
error->all(FLERR,"Set command custom double property {} is not an array",pname);
error->all(FLERR, iarg, "Set command custom double property {} is not an array", pname);
icol_custom = argi.get_index1();
if (icol_custom <= 0 || icol_custom > cols)
error->all(FLERR,"Set command per-atom custom double array {} is "
"accessed out-of-range",pname);
error->all(FLERR, iarg, "Set command per-atom custom double array {} is accessed "
"out-of-range{}", pname, utils::errorurl(20));
set(DARRAY);
} else error->all(FLERR,"Illegal set command");
break;
@ -737,7 +791,7 @@ void Set::selection(int n)
if (style == ATOM_SELECT) {
if (atom->tag_enable == 0)
error->all(FLERR,"Cannot use set atom with no atom IDs defined");
error->all(FLERR, Error::NOLASTLINE, "Cannot use set atom with no atom IDs defined");
bigint nlobig,nhibig;
utils::bounds(FLERR,id,1,MAXTAGINT,nlobig,nhibig,error);
@ -748,7 +802,7 @@ void Set::selection(int n)
} else if (style == MOL_SELECT) {
if (atom->molecule_flag == 0)
error->all(FLERR,"Cannot use set mol with no molecule IDs defined");
error->all(FLERR, Error::NOLASTLINE, "Cannot use set mol with no molecule IDs defined");
bigint nlobig,nhibig;
utils::bounds(FLERR,id,1,MAXTAGINT,nlobig,nhibig,error);
@ -767,7 +821,7 @@ void Set::selection(int n)
} else if (style == GROUP_SELECT) {
int igroup = group->find(id);
if (igroup == -1) error->all(FLERR,"Could not find set group ID {}", id);
if (igroup == -1) error->all(FLERR, Error::NOLASTLINE, "Could not find set group ID {}", id);
int groupbit = group->bitmask[igroup];
int *mask = atom->mask;
@ -777,7 +831,7 @@ void Set::selection(int n)
} else if (style == REGION_SELECT) {
auto region = domain->get_region_by_id(id);
if (!region) error->all(FLERR,"Set region {} does not exist", id);
if (!region) error->all(FLERR, Error::NOLASTLINE, "Set region {} does not exist", id);
region->prematch();
double **x = atom->x;
@ -871,7 +925,7 @@ void Set::set(int keyword)
if (keyword == TYPE) {
if (ivalue <= 0 || ivalue > atom->ntypes)
error->one(FLERR,"Invalid value in set command");
error->one(FLERR, Error::NOLASTLINE, "Invalid value {} in set type command", ivalue);
atom->type[i] = ivalue;
}
else if (keyword == MOLECULE) atom->molecule[i] = ivalue;
@ -886,21 +940,25 @@ void Set::set(int keyword)
// ensure that scaled charges are consistent the new charge value
if (atom->epsilon) atom->q_scaled[i] = dvalue / atom->epsilon[i];
} else if (keyword == MASS) {
if (dvalue <= 0.0) error->one(FLERR,"Invalid mass in set command");
if (dvalue <= 0.0)
error->one(FLERR, Error::NOLASTLINE, "Invalid mass {} in set command", dvalue);
atom->rmass[i] = dvalue;
}
else if (keyword == DIAMETER) {
if (dvalue < 0.0) error->one(FLERR,"Invalid diameter in set command");
if (dvalue < 0.0)
error->one(FLERR, Error::NOLASTLINE, "Invalid diameter {} in set command", dvalue);
atom->radius[i] = 0.5 * dvalue;
}
else if (keyword == VOLUME) {
if (dvalue <= 0.0) error->one(FLERR,"Invalid volume in set command");
if (dvalue <= 0.0)
error->one(FLERR, Error::NOLASTLINE, "Invalid volume {} in set command", dvalue);
atom->vfrac[i] = dvalue;
}
else if (keyword == RHEO_STATUS) {
if (ivalue != 0 && ivalue != 1)
error->one(FLERR,"Invalid value {} in set command for rheo/status", ivalue);
error->one(FLERR, Error::NOLASTLINE, "Invalid value {} in set command for rheo/status",
ivalue);
atom->rheo_status[i] = ivalue;
}
@ -936,10 +994,12 @@ void Set::set(int keyword)
else if (keyword == SHAPE) {
if (xvalue < 0.0 || yvalue < 0.0 || zvalue < 0.0)
error->one(FLERR,"Invalid shape in set command");
error->one(FLERR, Error::NOLASTLINE, "Invalid ellipsoid shape {} {} {} in set command",
xvalue, yvalue, zvalue);
if (xvalue > 0.0 || yvalue > 0.0 || zvalue > 0.0) {
if (xvalue == 0.0 || yvalue == 0.0 || zvalue == 0.0)
error->one(FLERR,"Invalid shape in set command");
error->one(FLERR, Error::NOLASTLINE, "Invalid ellipsoid shape {} {} {} in set command",
xvalue, yvalue, zvalue);
}
avec_ellipsoid->set_shape(i,0.5*xvalue,0.5*yvalue,0.5*zvalue);
}
@ -947,14 +1007,16 @@ void Set::set(int keyword)
// set length of line particle
else if (keyword == LENGTH) {
if (dvalue < 0.0) error->one(FLERR,"Invalid length in set command");
if (dvalue < 0.0)
error->one(FLERR, Error::NOLASTLINE, "Invalid length {} in set command", dvalue);
avec_line->set_length(i,dvalue);
}
// set corners of tri particle
else if (keyword == TRI) {
if (dvalue < 0.0) error->one(FLERR,"Invalid length in set command");
if (dvalue < 0.0)
error->one(FLERR, Error::NOLASTLINE, "Invalid length {} in set command", dvalue);
avec_tri->set_equilateral(i,dvalue);
}
@ -966,7 +1028,8 @@ void Set::set(int keyword)
// else set rmass to density directly
else if (keyword == DENSITY) {
if (dvalue <= 0.0) error->one(FLERR,"Invalid density in set command");
if (dvalue <= 0.0)
error->one(FLERR, Error::NOLASTLINE, "Invalid density {} in set command", dvalue);
if (atom->radius_flag && atom->radius[i] > 0.0)
if (discflag)
atom->rmass[i] = MY_PI*atom->radius[i]*atom->radius[i] * dvalue;
@ -1013,7 +1076,8 @@ void Set::set(int keyword)
else if (keyword == SPIN_ATOM) {
if (dvalue < 0.0)
error->one(FLERR,"Incorrect value for atomic spin magnitude: {}", dvalue);
error->one(FLERR, Error::NOLASTLINE, "Incorrect value for atomic spin magnitude: {}",
dvalue);
double **sp = atom->sp;
double inorm = 1.0/sqrt(xvalue*xvalue+yvalue*yvalue+zvalue*zvalue);
sp[i][0] = inorm*xvalue;
@ -1027,7 +1091,7 @@ void Set::set(int keyword)
else if (keyword == RADIUS_ELECTRON) {
atom->eradius[i] = dvalue;
if (dvalue < 0.0)
error->one(FLERR,"Incorrect value for electron radius: {}", dvalue);
error->one(FLERR, Error::NOLASTLINE, "Incorrect value for electron radius: {}", dvalue);
}
// set electron spin
@ -1036,7 +1100,7 @@ void Set::set(int keyword)
if ((dvalue == -1) || (dvalue == 1) || (dvalue == 0) || (dvalue == 2) || (dvalue == 3))
atom->spin[i] = (int)dvalue;
else
error->one(FLERR,"Incorrect value for electron spin: {}", dvalue);
error->one(FLERR, Error::NOLASTLINE, "Incorrect value for electron spin: {}", dvalue);
}
// set quaternion orientation of ellipsoid or tri or body particle or sphere/bpm
@ -1054,9 +1118,10 @@ void Set::set(int keyword)
else if (atom->quat_flag)
quat2 = atom->quat;
else
error->one(FLERR,"Cannot set quaternion for atom that has none");
error->one(FLERR, Error::NOLASTLINE, "Cannot set quaternion for atom that has none");
if (domain->dimension == 2 && (xvalue != 0.0 || yvalue != 0.0))
error->one(FLERR,"Cannot set quaternion with xy components for 2d system");
error->one(FLERR, Error::NOLASTLINE,
"Cannot set quaternion with xy components for 2d system");
const double theta2 = MY_PI2 * wvalue/180.0;
const double sintheta2 = sin(theta2);
@ -1083,7 +1148,7 @@ void Set::set(int keyword)
else if (keyword == THETA) {
if (atom->line[i] < 0)
error->one(FLERR,"Cannot set theta for atom that is not a line");
error->one(FLERR, Error::NOLASTLINE, "Cannot set theta for atom that is not a line");
avec_line->bonus[atom->line[i]].theta = dvalue;
}
@ -1104,7 +1169,8 @@ void Set::set(int keyword)
// set temperature of particle
else if (keyword == TEMPERATURE) {
if (dvalue < 0.0) error->one(FLERR,"Invalid temperature in set command");
if (dvalue < 0.0)
error->one(FLERR, Error::NOLASTLINE, "Invalid temperature {} in set command", dvalue);
atom->temperature[i] = dvalue;
}
@ -1240,7 +1306,7 @@ void Set::setrandom(int keyword)
nsubset = static_cast<bigint> (fraction * allcount);
} else if (keyword == TYPE_SUBSET) {
if (nsubset > allcount)
error->all(FLERR,"Set type/subset value exceeds eligible atoms");
error->all(FLERR, Error::NOLASTLINE, "Set type/subset value exceeds eligible atoms");
}
// make selection
@ -1372,7 +1438,7 @@ void Set::setrandom(int keyword)
else if (atom->quat_flag)
quat2 = atom->quat;
else
error->one(FLERR,"Cannot set quaternion for atom that has none");
error->one(FLERR, Error::NOLASTLINE, "Cannot set quaternion for atom that has none");
ranpark->reset(seed,x[i]);
s = ranpark->uniform();
@ -1405,7 +1471,7 @@ void Set::setrandom(int keyword)
else if (atom->quat_flag)
quat2 = atom->quat;
else
error->one(FLERR,"Cannot set quaternion for atom that has none");
error->one(FLERR, Error::NOLASTLINE, "Cannot set quaternion for atom that has none");
ranpark->reset(seed,x[i]);
theta2 = MY_PI*ranpark->uniform();
@ -1431,7 +1497,7 @@ void Set::setrandom(int keyword)
for (i = 0; i < nlocal; i++) {
if (select[i]) {
if (atom->line[i] < 0)
error->one(FLERR,"Cannot set theta for atom that is not a line");
error->one(FLERR, Error::NOLASTLINE, "Cannot set theta for atom that is not a line");
ranpark->reset(seed,x[i]);
avec_line->bonus[atom->line[i]].theta = MY_2PI*ranpark->uniform();
count++;
@ -1452,7 +1518,7 @@ void Set::topology(int keyword)
// error check
if (atom->molecular == Atom::TEMPLATE)
error->all(FLERR,"Cannot set bond topology types for atom style template");
error->all(FLERR, Error::NOLASTLINE, "Cannot set bond topology types for atom style template");
// border swap to acquire ghost atom info
// enforce PBC before in case atoms are outside box
@ -1481,7 +1547,9 @@ void Set::topology(int keyword)
for (int i = 0; i < nlocal; i++)
for (m = 0; m < atom->num_bond[i]; m++) {
atom1 = atom->map(atom->bond_atom[i][m]);
if (atom1 == -1) error->one(FLERR,"Bond atom missing in set command");
if (atom1 == -1)
error->one(FLERR, Error::NOLASTLINE, "Bond atom missing in set command"
+ utils::errorurl(5));
if (select[i] && select[atom1]) {
atom->bond_type[i][m] = ivalue;
count++;
@ -1499,7 +1567,8 @@ void Set::topology(int keyword)
atom2 = atom->map(atom->angle_atom2[i][m]);
atom3 = atom->map(atom->angle_atom3[i][m]);
if (atom1 == -1 || atom2 == -1 || atom3 == -1)
error->one(FLERR,"Angle atom missing in set command");
error->one(FLERR, Error::NOLASTLINE, "Angle atom missing in set command"
+ utils::errorurl(5));
if (select[atom1] && select[atom2] && select[atom3]) {
atom->angle_type[i][m] = ivalue;
count++;
@ -1518,7 +1587,8 @@ void Set::topology(int keyword)
atom3 = atom->map(atom->dihedral_atom3[i][m]);
atom4 = atom->map(atom->dihedral_atom4[i][m]);
if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1)
error->one(FLERR,"Dihedral atom missing in set command");
error->one(FLERR, Error::NOLASTLINE, "Dihedral atom missing in set command"
+ utils::errorurl(5));
if (select[atom1] && select[atom2] && select[atom3] && select[atom4]) {
atom->dihedral_type[i][m] = ivalue;
count++;
@ -1537,7 +1607,8 @@ void Set::topology(int keyword)
atom3 = atom->map(atom->improper_atom3[i][m]);
atom4 = atom->map(atom->improper_atom4[i][m]);
if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1)
error->one(FLERR,"Improper atom missing in set command");
error->one(FLERR, Error::NOLASTLINE, "Improper atom missing in set command"
+ utils::errorurl(5));
if (select[atom1] && select[atom2] && select[atom3] && select[atom4]) {
atom->improper_type[i][m] = ivalue;
count++;
@ -1554,9 +1625,9 @@ void Set::varparse(const char *name, int m)
int ivar = input->variable->find(name+2);
if (ivar < 0)
error->all(FLERR,"Variable name {} for set command does not exist", name);
error->all(FLERR, Error::NOLASTLINE, "Variable name {} for set command does not exist", name);
if (!input->variable->atomstyle(ivar))
error->all(FLERR,"Variable {} for set command is invalid style", name);
error->all(FLERR, Error::NOLASTLINE, "Variable {} for set command is invalid style", name);
if (m == 1) {
varflag1 = 1; ivar1 = ivar;