flag some more compatible time and out-of-bounds errors with errorurl()s

This commit is contained in:
Axel Kohlmeyer
2025-03-20 06:16:59 -04:00
parent 643afe6eff
commit e4c96459e5
11 changed files with 84 additions and 51 deletions

View File

@ -273,8 +273,8 @@ void DumpCustomADIOS::init_style()
fix[i] = modify->get_fix_by_id(id_fix[i]);
if (!fix[i]) error->all(FLERR, "Could not find dump custom/adios fix ID {}", id_fix[i]);
if (nevery % fix[i]->peratom_freq)
error->all(FLERR, "dump custom/adios and fix {} with ID {} not computed at compatible times",
fix[i]->style, id_fix[i]);
error->all(FLERR, Error::NOLASTLINE, "dump custom/adios and fix {} with ID {} not "
"computed at compatible times{}", fix[i]->style, id_fix[i], utils::errorurl(7));
}
int ivariable;

View File

@ -244,8 +244,8 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS *lmp, int narg, char **arg) :
"Fix ave/correlate/long fix {} vector is accessed out-of-range", val.id);
if (nevery % val.val.f->global_freq)
error->all(FLERR, val.iarg,
"Fix {} for fix ave/correlate/long not computed at compatible time",
val.id);
"Fix {} for fix ave/correlate/long not computed at compatible time{}",
val.id, utils::errorurl(7));
} else if (val.which == ArgInfo::VARIABLE) {
val.val.v = input->variable->find(val.id.c_str());

View File

@ -224,7 +224,8 @@ void DumpVTK::init_style()
error->all(FLERR,"Could not find dump vtk fix ID {}", id_fix[i]);
} else {
if (nevery % fix[i]->peratom_freq)
error->all(FLERR,"Dump vtk and fix ID {} not called at compatible times", id_fix[i]);
error->all(FLERR,"Dump vtk and fix ID {} not called at compatible times{}", id_fix[i],
utils::errorurl(7));
}
}

View File

@ -283,7 +283,8 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
if (val.argindex && val.val.c->size_local_cols == 0)
error->all(FLERR, val.iarg, "{} compute {} does not calculate a local array", mycmd, val.id);
if (val.argindex && val.argindex > val.val.c->size_local_cols)
error->all(FLERR, val.iarg, "{} compute {} array is accessed out-of-range", mycmd, val.id);
error->all(FLERR, val.iarg, "{} compute {} array is accessed out-of-range{}", mycmd,
val.id, utils::errorurl(20));
} else if (val.which == ArgInfo::FIX && kind == GLOBAL && mode == SCALAR) {
if (val.argindex == 0 && val.val.f->scalar_flag == 0)
@ -291,9 +292,11 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
if (val.argindex && val.val.f->vector_flag == 0)
error->all(FLERR, val.iarg, "{} fix {} does not calculate a global vector", mycmd, val.id);
if (val.argindex && val.argindex > val.val.f->size_vector)
error->all(FLERR, val.iarg, "{} fix {} vector is accessed out-of-range", mycmd, val.id);
error->all(FLERR, val.iarg, "{} fix {} vector is accessed out-of-range{}", mycmd,
val.id, utils::errorurl(20));
if (nevery % val.val.f->global_freq)
error->all(FLERR, val.iarg, "Fix {} for {} not computed at compatible time", val.id, mycmd);
error->all(FLERR, val.iarg, "Fix {} for {} not computed at compatible time{}",
val.id, mycmd, utils::errorurl(7));
} else if (val.which == ArgInfo::FIX && kind == GLOBAL && mode == VECTOR) {
if (val.argindex == 0 && val.val.f->vector_flag == 0)
@ -301,9 +304,11 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
if (val.argindex && val.val.f->array_flag == 0)
error->all(FLERR, val.iarg, "{} fix {} does not calculate a global array", mycmd, val.id);
if (val.argindex && val.argindex > val.val.f->size_array_cols)
error->all(FLERR, val.iarg, "{} fix {} array is accessed out-of-range", mycmd, val.id);
error->all(FLERR, val.iarg, "{} fix {} array is accessed out-of-range{}", mycmd, val.id,
utils::errorurl(20));
if (nevery % val.val.f->global_freq)
error->all(FLERR, val.iarg, "Fix {} for {} not computed at compatible time", val.id, mycmd);
error->all(FLERR, val.iarg, "Fix {} for {} not computed at compatible time{}",
val.id, mycmd, utils::errorurl(7));
} else if (val.which == ArgInfo::FIX && kind == PERATOM) {
if (val.val.f->peratom_flag == 0)
@ -313,9 +318,11 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
if (val.argindex && val.val.f->size_peratom_cols == 0)
error->all(FLERR, val.iarg, "{} fix {} does not ""calculate a per-atom array", mycmd, val.id);
if (val.argindex && val.argindex > val.val.f->size_peratom_cols)
error->all(FLERR, val.iarg, "{} fix {} array is accessed out-of-range", mycmd, val.id);
error->all(FLERR, val.iarg, "{} fix {} array is accessed out-of-range{}", mycmd, val.id,
utils::errorurl(20));
if (nevery % val.val.f->global_freq)
error->all(FLERR, val.iarg, "Fix {} for {} not computed at compatible time", val.id, mycmd);
error->all(FLERR, val.iarg, "Fix {} for {} not computed at compatible time{}", val.id,
mycmd, utils::errorurl(7));
} else if (val.which == ArgInfo::FIX && kind == LOCAL) {
if (val.val.f->local_flag == 0)
@ -325,9 +332,11 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
if (val.argindex && val.val.f->size_local_cols == 0)
error->all(FLERR, val.iarg, "{} fix does not calculate a local array", mycmd, val.id);
if (val.argindex && val.argindex > val.val.f->size_local_cols)
error->all(FLERR, val.iarg, "{} fix {} array is accessed out-of-range", mycmd, val.id);
error->all(FLERR, val.iarg, "{} fix {} array is accessed out-of-range{}", mycmd,
val.id, utils::errorurl(20));
if (nevery % val.val.f->global_freq)
error->all(FLERR, val.iarg, "Fix {} for {} not computed at compatible time", val.id, mycmd);
error->all(FLERR, val.iarg, "Fix {} for {} not computed at compatible time{}", val.id,
mycmd, utils::errorurl(7));
} else if (val.which == ArgInfo::VARIABLE && kind == GLOBAL && mode == SCALAR) {
if (val.argindex == 0 && input->variable->equalstyle(val.val.v) == 0)

View File

@ -148,8 +148,8 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR, val.iarg, "Fix ave/time compute {} does not calculate a vector", val.id);
if (val.argindex && (val.argindex > val.val.c->size_vector) &&
(val.val.c->size_vector_variable == 0))
error->all(FLERR, val.iarg, "Fix ave/time compute {} vector is accessed out-of-range",
val.id);
error->all(FLERR, val.iarg, "Fix ave/time compute {} vector is accessed out-of-range{}",
val.id, utils::errorurl(20));
if (val.argindex && val.val.c->size_vector_variable) val.varlen = 1;
} else if ((val.which == ArgInfo::COMPUTE) && (mode == VECTOR)) {
@ -161,8 +161,8 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
if (val.argindex && (val.val.c->array_flag == 0))
error->all(FLERR, val.iarg, "Fix ave/time compute {} does not calculate an array", val.id);
if (val.argindex && (val.argindex > val.val.c->size_array_cols))
error->all(FLERR, val.iarg, "Fix ave/time compute {} array is accessed out-of-range",
val.id);
error->all(FLERR, val.iarg, "Fix ave/time compute {} array is accessed out-of-range{}",
val.id, utils::errorurl(20));
if ((val.argindex == 0) && (val.val.c->size_vector_variable)) val.varlen = 1;
if (val.argindex && (val.val.c->size_array_rows_variable)) val.varlen = 1;
@ -176,10 +176,11 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
if (val.argindex && (val.val.f->size_vector_variable))
error->all(FLERR, val.iarg, "Fix ave/time fix {} vector cannot be variable length", val.id);
if (val.argindex && (val.argindex > val.val.f->size_vector))
error->all(FLERR, val.iarg, "Fix ave/time fix {} vector is accessed out-of-range", val.id);
error->all(FLERR, val.iarg, "Fix ave/time 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/time not computed at compatible time",
val.id);
error->all(FLERR, val.iarg, "Fix {} for fix ave/time not computed at compatible time{}",
val.id, utils::errorurl(7));
} else if ((val.which == ArgInfo::FIX) && (mode == VECTOR)) {
val.val.f = modify->get_fix_by_id(val.id);
@ -193,10 +194,11 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR, val.iarg, "Fix ave/time fix {} array cannot have variable row length",
val.id);
if (val.argindex && (val.argindex > val.val.f->size_array_cols))
error->all(FLERR, val.iarg, "Fix ave/time fix {} array is accessed out-of-range", val.id);
error->all(FLERR, val.iarg, "Fix ave/time fix {} array 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/time not computed at compatible time",
val.id);
error->all(FLERR, val.iarg, "Fix {} for fix ave/time not computed at compatible time{}",
val.id, utils::errorurl(7));
} else if ((val.which == ArgInfo::VARIABLE) && (mode == SCALAR)) {
int ivariable = input->variable->find(val.id.c_str());

View File

@ -263,7 +263,8 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) :
if (val.argindex && val.val.c->size_peratom_cols == 0)
error->all(FLERR, "Fix store/state compute {} does not calculate per-atom array", val.id);
if (val.argindex && (val.argindex > val.val.c->size_peratom_cols))
error->all(FLERR, "Fix store/state compute array {} is accessed out-of-range", val.id);
error->all(FLERR, "Fix store/state compute array {} 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);
@ -276,9 +277,11 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) :
if (val.argindex && val.val.f->size_peratom_cols == 0)
error->all(FLERR, "Fix store/state fix {} does not calculate per-atom array", val.id);
if (val.argindex && (val.argindex > val.val.f->size_peratom_cols))
error->all(FLERR, "Fix store/state fix {} array is accessed out-of-range", val.id);
error->all(FLERR, "Fix store/state fix {} array is accessed out-of-range{}",
val.id, utils::errorurl(20));
if (nevery % val.val.f->peratom_freq)
error->all(FLERR, "Fix {} for fix store/state not computed at compatible time", val.id);
error->all(FLERR, "Fix {} for fix store/state not computed at compatible time{}",
val.id, utils::errorurl(7));
} else if (val.which == ArgInfo::VARIABLE) {
val.val.v = input->variable->find(val.id.c_str());

View File

@ -35,7 +35,7 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) :
if (narg < 5) utils::missing_cmd_args(FLERR, "fix vector", error);
nevery = utils::inumeric(FLERR, arg[3], false, lmp);
if (nevery <= 0) error->all(FLERR, "Invalid fix vector every argument: {}", nevery);
if (nevery <= 0) error->all(FLERR, 3, "Invalid fix vector every argument: {}", nevery);
nmaxval = MAXSMALLINT;
nindex = 0;
@ -91,7 +91,8 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) :
if (val.argindex && icompute->vector_flag == 0)
error->all(FLERR, "Fix vector compute {} does not calculate a vector", val.id);
if (val.argindex && (val.argindex > icompute->size_vector))
error->all(FLERR, "Fix vector compute {} vector is accessed out-of-range", val.id);
error->all(FLERR, "Fix vector compute {} vector is accessed out-of-range{}",
val.id, utils::errorurl(20));
if (val.argindex == 0)
value = icompute->extscalar;
@ -109,9 +110,11 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) :
if (val.argindex && ifix->vector_flag == 0)
error->all(FLERR, "Fix vector fix {} does not calculate a vector", val.id);
if (val.argindex && val.argindex > ifix->size_vector)
error->all(FLERR, "Fix vector fix {} vector is accessed out-of-range", val.id);
error->all(FLERR, "Fix vector fix {} vector is accessed out-of-range{}",
val.id, utils::errorurl(20));
if (nevery % ifix->global_freq)
error->all(FLERR, "Fix for fix {} vector not computed at compatible time", val.id);
error->all(FLERR, "Fix for fix {} vector not computed at compatible time{}",
val.id, utils::errorurl(7));
if (val.argindex == 0)
value = ifix->extscalar;

View File

@ -4401,7 +4401,8 @@ void lammps_gather(void *handle, const char *name, int type, int count, void *da
}
if (lmp->update->ntimestep % fix->peratom_freq) {
lmp->error->all(FLERR,"lammps_gather: fix {} not computed at compatible time", fixid);
lmp->error->all(FLERR,"lammps_gather: fix {} not computed at compatible time{}",
fixid, utils::errorurl(7));
return;
}
@ -4670,8 +4671,8 @@ void lammps_gather_concat(void *handle, const char *name, int type, int count,
return;
}
if (lmp->update->ntimestep % fix->peratom_freq) {
lmp->error->all(FLERR,"lammps_gather_concat(): fix {} not computed at compatible time",
fixid);
lmp->error->all(FLERR,"lammps_gather_concat(): fix {} not computed at compatible time{}",
fixid, utils::errorurl(7));
return;
}
@ -4957,7 +4958,8 @@ void lammps_gather_subset(void *handle, const char *name, int type, int count,
return;
}
if (lmp->update->ntimestep % fix->peratom_freq) {
lmp->error->all(FLERR,"lammps_gather_subset(): fix {} not computed at compatible time", fixid);
lmp->error->all(FLERR,"lammps_gather_subset(): fix {} not computed at compatible time{}",
fixid, utils::errorurl(7));
return;
}

View File

@ -311,8 +311,8 @@ void Thermo::init()
error->all(FLERR, Error::NOLASTLINE, "Could not find thermo fix ID {}", id_fix[i]);
if (output->thermo_every % fixes[i]->global_freq)
error->all(FLERR, Error::NOLASTLINE, "Thermo and fix {} not computed at compatible times",
id_fix[i]);
error->all(FLERR, Error::NOLASTLINE, "Thermo and fix {} not computed at compatible times{}",
id_fix[i], utils::errorurl(7));
}
// find current ptr for each Variable ID

View File

@ -1244,8 +1244,8 @@ int utils::check_grid_reference(char *errstr, char *ref, int nevery, char *&id,
lmp->error->all(FLERR, "{} compute {} data {} is not per-grid array", errstr, idcompute,
dname);
if (argi.get_dim() && argi.get_index1() > ncol)
lmp->error->all(FLERR, "{} compute {} array {} is accessed out-of-range", errstr, idcompute,
dname);
lmp->error->all(FLERR, "{} compute {} array {} is accessed out-of-range{}", errstr,
idcompute, dname, errorurl(20));
id = utils::strdup(idcompute);
return ArgInfo::COMPUTE;
@ -1267,7 +1267,8 @@ int utils::check_grid_reference(char *errstr, char *ref, int nevery, char *&id,
if (ifix->pergrid_flag == 0)
lmp->error->all(FLERR, "{} fix {} does not compute per-grid info", errstr, idfix);
if (nevery % ifix->pergrid_freq)
lmp->error->all(FLERR, "{} fix {} not computed at compatible time", errstr, idfix);
lmp->error->all(FLERR, "{} fix {} not computed at compatible time{}", errstr, idfix,
errorurl(7));
int dim;
igrid = ifix->get_grid_by_name(gname, dim);
@ -1284,7 +1285,8 @@ int utils::check_grid_reference(char *errstr, char *ref, int nevery, char *&id,
if (argi.get_dim() > 0 && ncol == 0)
lmp->error->all(FLERR, "{} fix {} data {} is not per-grid array", errstr, idfix, dname);
if (argi.get_dim() > 0 && argi.get_index1() > ncol)
lmp->error->all(FLERR, "{} fix {} array {} is accessed out-of-range", errstr, idfix, dname);
lmp->error->all(FLERR, "{} fix {} array {} is accessed out-of-range{}", errstr, idfix,
dname, errorurl(20));
id = utils::strdup(idfix);
return ArgInfo::FIX;

View File

@ -1880,7 +1880,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
if (!fix->scalar_flag)
print_var_error(FLERR,"Mismatched fix in variable formula",ivar);
if (update->whichflag > 0 && update->ntimestep % fix->global_freq)
print_var_error(FLERR,"Fix in variable not computed at a compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at a compatible time"
+ utils::errorurl(7), ivar);
value1 = fix->compute_scalar();
argstack[nargstack++] = value1;
@ -1895,7 +1896,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
print_var_error(FLERR,"Variable formula fix vector is accessed out-of-range"
+ utils::errorurl(20), ivar,0);
if (update->whichflag > 0 && update->ntimestep % fix->global_freq)
print_var_error(FLERR,"Fix in variable not computed at a compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at a compatible time"
+ utils::errorurl(7) ,ivar);
// if index exceeds variable vector length, use a zero value
// this can be useful if vector length is not known a priori
@ -1917,7 +1919,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
print_var_error(FLERR,"Variable formula fix array is accessed out-of-range"
+ utils::errorurl(20), ivar,0);
if (update->whichflag > 0 && update->ntimestep % fix->global_freq)
print_var_error(FLERR,"Fix in variable not computed at a compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at a compatible time"
+ utils::errorurl(7), ivar);
// if index exceeds variable array rows, use a zero value
// this can be useful if array size is not known a priori
@ -1936,7 +1939,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
print_var_error(FLERR,"Mismatched fix in variable formula",ivar);
if (update->whichflag > 0 &&
update->ntimestep % fix->peratom_freq)
print_var_error(FLERR,"Fix in variable not computed at a compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at a compatible time"
+ utils::errorurl(7), ivar);
peratom2global(1,nullptr,fix->vector_atom,1,index1,tree,
treestack,ntreestack,argstack,nargstack);
@ -1953,7 +1957,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
print_var_error(FLERR,"Variable formula fix array is accessed out-of-range"
+ utils::errorurl(20), ivar,0);
if (update->whichflag > 0 && update->ntimestep % fix->peratom_freq)
print_var_error(FLERR,"Fix in variable not computed at a compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at a compatible time"
+ utils::errorurl(7), ivar);
if (fix->array_atom)
peratom2global(1,nullptr,&fix->array_atom[0][index2-1],
@ -1980,7 +1985,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
if (fix->size_vector == 0)
print_var_error(FLERR,"Variable formula fix vector is zero length",ivar);
if (update->whichflag > 0 && update->ntimestep % fix->global_freq)
print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at compatible time"
+ utils::errorurl(7), ivar);
int nvec = fix->size_vector;
double *vec;
@ -2008,7 +2014,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
print_var_error(FLERR,"Variable formula fix array is accessed out-of-range"
+ utils::errorurl(20), ivar,0);
if (update->whichflag > 0 && update->ntimestep % fix->global_freq)
print_var_error(FLERR,"Fix in variable not computed at a compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at a compatible time"
+ utils::errorurl(7), ivar);
int nvec = fix->size_array_rows;
double *vec;
@ -2041,7 +2048,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
if (fix->size_peratom_cols)
print_var_error(FLERR,"Mismatched fix in variable formula",ivar);
if (update->whichflag > 0 && update->ntimestep % fix->peratom_freq)
print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at compatible time"
+ utils::errorurl(7), ivar);
auto newtree = new Tree();
newtree->type = ATOMARRAY;
@ -2061,7 +2069,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
print_var_error(FLERR,"Variable formula fix array is accessed out-of-range"
+ utils::errorurl(20), ivar,0);
if (update->whichflag > 0 && update->ntimestep % fix->peratom_freq)
print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at compatible time"
+ utils::errorurl(7), ivar);
auto newtree = new Tree();
newtree->type = ATOMARRAY;
@ -4531,6 +4540,7 @@ int Variable::special_function(const std::string &word, char *contents, Tree **t
std::string mesg = "Fix with ID '";
mesg += (args[0]+2);
mesg += "' in variable formula not computed at compatible time";
mesg += utils::errorurl(7);
print_var_error(FLERR,mesg,ivar);
}
nvec = fix->size_vector;
@ -4540,7 +4550,8 @@ int Variable::special_function(const std::string &word, char *contents, Tree **t
print_var_error(FLERR,"Variable formula fix array is accessed out-of-range"
+ utils::errorurl(20), ivar);
if (update->whichflag > 0 && update->ntimestep % fix->global_freq)
print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at compatible time"
+ utils::errorurl(7), ivar);
nvec = fix->size_array_rows;
nstride = fix->size_array_cols;
} else print_var_error(FLERR,"Mismatched fix in variable formula",ivar);