add explanations for "before/after simulation box is defined" errors

This commit is contained in:
Axel Kohlmeyer
2025-03-21 20:17:17 -04:00
parent 649fd86e11
commit 1b58a4695b
45 changed files with 107 additions and 73 deletions

View File

@ -912,3 +912,29 @@ typically happens when there are multiple fix commands that advance atom
positions with overlapping groups. Also, for some fix styles it is not positions with overlapping groups. Also, for some fix styles it is not
immediately obvious that they include time integration. Please check immediately obvious that they include time integration. Please check
the documentation carefully. the documentation carefully.
.. _err0033:
XXX command before simulation box is defined
--------------------------------------------
This error happens, when trying to excute a LAMMPS command that requires
information about the system dimensions, or the number atom, bond,
angle, dihedral, or improper types, or the number of atoms or similar
data that is only available *after* the simulation box has been created.
See the paragraph on :ref:`errors before or after the simulation box is
created <hint12>` for additional information.
.. _err0034:
XXX command after simulation box is defined
--------------------------------------------
This error happens, when trying to excute a LAMMPS command that that
changes a global setting that will be locked in when the simulation box
is created (for instance defining the :doc:`atom style <atom_style>`,
:doc:`dimension <dimension>`, :doc:`newton <newton>`, or :doc:`units
<units>` setting). These settings may only be changed *before* the
simulation box has been created. See the paragraph on :ref:`errors
before or after the simulation box is created <hint12>` for additional
information.

View File

@ -306,10 +306,10 @@ void PPPMDielectric::qsum_qsq(int warning_flag)
// so issue warning or error // so issue warning or error
if (fabs(qsum) > SMALL) { if (fabs(qsum) > SMALL) {
std::string message = fmt::format("System is not charge neutral, net " std::string message = fmt::format("System is not charge neutral, net charge = {:.8}{}",
"charge = {:.8}",qsum); qsum, utils::errorurl(29));
if (!warn_nonneutral) error->all(FLERR,message + utils::errorurl(29)); if (!warn_nonneutral) error->all(FLERR,message);
if (warn_nonneutral == 1 && comm->me == 0) error->warning(FLERR,message + utils::errorurl(29)); if (warn_nonneutral == 1 && comm->me == 0) error->warning(FLERR,message);
warn_nonneutral = 2; warn_nonneutral = 2;
} }
} }

View File

@ -580,10 +580,10 @@ void PPPMDispDielectric::qsum_qsq(int warning_flag)
// so issue warning or error // so issue warning or error
if (fabs(qsum) > SMALL) { if (fabs(qsum) > SMALL) {
std::string message = fmt::format("System is not charge neutral, net " std::string message = fmt::format("System is not charge neutral, net charge = {:.8}{}",
"charge = {:.8}",qsum); qsum, utils::errorurl(29));
if (!warn_nonneutral) error->all(FLERR,message + utils::errorurl(29)); if (!warn_nonneutral) error->all(FLERR,message);
if (warn_nonneutral == 1 && comm->me == 0) error->warning(FLERR,message + utils::errorurl(29)); if (warn_nonneutral == 1 && comm->me == 0) error->warning(FLERR,message);
warn_nonneutral = 2; warn_nonneutral = 2;
} }
} }

View File

@ -86,7 +86,7 @@ void KimInit::command(int narg, char **arg)
if ((narg < 2) || (narg > 3)) error->all(FLERR, "Illegal 'kim init' command"); if ((narg < 2) || (narg > 3)) error->all(FLERR, "Illegal 'kim init' command");
if (domain->box_exist) if (domain->box_exist)
error->all(FLERR, "Must use 'kim init' command before simulation box is defined"); error->all(FLERR, "Must use 'kim init' command before simulation box is defined" + utils::errorurl(33));
char *model_name = utils::strdup(arg[0]); char *model_name = utils::strdup(arg[0]);
char *user_units = utils::strdup(arg[1]); char *user_units = utils::strdup(arg[1]);

View File

@ -112,7 +112,7 @@ void DynamicalMatrix::command(int narg, char **arg)
MPI_Comm_rank(world,&me); MPI_Comm_rank(world,&me);
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Dynamical_matrix command before simulation box is defined"); error->all(FLERR,"Dynamical_matrix command before simulation box is defined" + utils::errorurl(33));
if (narg < 2) error->all(FLERR,"Illegal dynamical_matrix command"); if (narg < 2) error->all(FLERR,"Illegal dynamical_matrix command");
lmp->init(); lmp->init();

View File

@ -118,7 +118,7 @@ void ThirdOrder::command(int narg, char **arg)
MPI_Comm_rank(world,&me); MPI_Comm_rank(world,&me);
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"third_order command before simulation box is defined"); error->all(FLERR,"third_order command before simulation box is defined" + utils::errorurl(33));
if (narg < 2) error->all(FLERR,"Illegal third_order command"); if (narg < 2) error->all(FLERR,"Illegal third_order command");
// request a full neighbor list for use by this command // request a full neighbor list for use by this command

View File

@ -336,7 +336,8 @@ void FixQEq::init()
MPI_Allreduce(&qsum_local,&qsum,1,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(&qsum_local,&qsum,1,MPI_DOUBLE,MPI_SUM,world);
if ((comm->me == 0) && (fabs(qsum) > QSUMSMALL)) if ((comm->me == 0) && (fabs(qsum) > QSUMSMALL))
error->warning(FLERR,"Fix {} group is not charge neutral, net charge = {:.8}", style, qsum); error->warning(FLERR,"Fix {} group is not charge neutral, net charge = {:.8}{}",
style, qsum, utils::errorurl(29));
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -52,7 +52,7 @@ void Hyper::command(int narg, char **arg)
// error checks // error checks
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Hyper command before simulation box is defined"); error->all(FLERR,"Hyper command before simulation box is defined" + utils::errorurl(33));
if (narg < 4) error->all(FLERR,"Illegal hyper command"); if (narg < 4) error->all(FLERR,"Illegal hyper command");

View File

@ -113,7 +113,7 @@ NEB::~NEB()
void NEB::command(int narg, char **arg) void NEB::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->universe_all(FLERR, "NEB command before simulation box is defined"); error->universe_all(FLERR, "NEB command before simulation box is defined" + utils::errorurl(33));
if (narg < 6) error->universe_all(FLERR, "Illegal NEB command: missing argument(s)"); if (narg < 6) error->universe_all(FLERR, "Illegal NEB command: missing argument(s)");

View File

@ -60,7 +60,7 @@ void PRD::command(int narg, char **arg)
// error checks // error checks
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"PRD command before simulation box is defined"); error->all(FLERR,"PRD command before simulation box is defined" + utils::errorurl(33));
if (universe->nworlds != universe->nprocs && if (universe->nworlds != universe->nprocs &&
atom->map_style == Atom::MAP_NONE) atom->map_style == Atom::MAP_NONE)
error->all(FLERR,"Cannot use PRD with multi-processor replicas " error->all(FLERR,"Cannot use PRD with multi-processor replicas "

View File

@ -74,7 +74,7 @@ void TAD::command(int narg, char **arg)
// error checks // error checks
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Tad command before simulation box is defined"); error->all(FLERR,"Tad command before simulation box is defined" + utils::errorurl(33));
if (universe->nworlds == 1) if (universe->nworlds == 1)
error->all(FLERR,"Cannot use TAD with a single replica for NEB"); error->all(FLERR,"Cannot use TAD with a single replica for NEB");
if (universe->nworlds != universe->nprocs) if (universe->nworlds != universe->nprocs)

View File

@ -64,7 +64,7 @@ void Temper::command(int narg, char **arg)
if (universe->nworlds == 1) if (universe->nworlds == 1)
error->universe_all(FLERR,"More than one processor partition required for temper command"); error->universe_all(FLERR,"More than one processor partition required for temper command");
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->universe_all(FLERR,"Temper command before simulation box is defined"); error->universe_all(FLERR,"Temper command before simulation box is defined" + utils::errorurl(33));
if (narg != 6 && narg != 7) error->universe_all(FLERR,"Illegal temper command"); if (narg != 6 && narg != 7) error->universe_all(FLERR,"Illegal temper command");
int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); int nsteps = utils::inumeric(FLERR,arg[0],false,lmp);

View File

@ -66,7 +66,7 @@ void TemperGrem::command(int narg, char **arg)
if (universe->nworlds == 1) if (universe->nworlds == 1)
error->universe_all(FLERR,"More than one processor partition required for temper/grem command"); error->universe_all(FLERR,"More than one processor partition required for temper/grem command");
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->universe_all(FLERR,"Temper/grem command before simulation box is defined"); error->universe_all(FLERR,"Temper/grem command before simulation box is defined" + utils::errorurl(33));
if (narg != 7 && narg != 8) error->universe_all(FLERR,"Illegal temper/grem command"); if (narg != 7 && narg != 8) error->universe_all(FLERR,"Illegal temper/grem command");
int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); int nsteps = utils::inumeric(FLERR,arg[0],false,lmp);

View File

@ -66,7 +66,7 @@ void TemperNPT::command(int narg, char **arg)
if (universe->nworlds == 1) if (universe->nworlds == 1)
error->universe_all(FLERR,"More than one processor partition required for temper/npt command"); error->universe_all(FLERR,"More than one processor partition required for temper/npt command");
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->universe_all(FLERR,"Temper/npt command before simulation box is defined"); error->universe_all(FLERR,"Temper/npt command before simulation box is defined" + utils::errorurl(33));
if (narg != 7 && narg != 8) error->universe_all(FLERR,"Illegal temper/npt command"); if (narg != 7 && narg != 8) error->universe_all(FLERR,"Illegal temper/npt command");
int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); int nsteps = utils::inumeric(FLERR,arg[0],false,lmp);

View File

@ -95,7 +95,7 @@ NEBSpin::~NEBSpin()
void NEBSpin::command(int narg, char **arg) void NEBSpin::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"NEBSpin command before simulation box is defined"); error->all(FLERR,"NEBSpin command before simulation box is defined" + utils::errorurl(33));
if (narg < 6) error->universe_all(FLERR,"Illegal NEBSpin command"); if (narg < 6) error->universe_all(FLERR,"Illegal NEBSpin command");

View File

@ -43,11 +43,11 @@ void AngleWrite::command(int narg, char **arg)
// sanity checks // sanity checks
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR, "Angle_write command before simulation box is defined"); error->all(FLERR, "Angle_write command before simulation box is defined" + utils::errorurl(33));
if (atom->avec->angles_allow == 0) if (atom->avec->angles_allow == 0)
error->all(FLERR, "Angle_write command when no angles allowed"); error->all(FLERR, "Angle_write command when no angles allowed");
auto angle = force->angle; auto angle = force->angle;
if (angle == nullptr) error->all(FLERR, "Angle_write command before an angle_style is defined"); if (angle == nullptr) error->all(FLERR, "Angle_write command before an angle_style is defined" + utils::errorurl(33));
if (angle && (force->angle->writedata == 0)) if (angle && (force->angle->writedata == 0))
error->all(FLERR, "Angle style must support writing coeffs to data file for angle_write"); error->all(FLERR, "Angle style must support writing coeffs to data file for angle_write");

View File

@ -836,13 +836,15 @@ void Atom::modify_params(int narg, char **arg)
if (strcmp(arg[iarg],"id") == 0) { if (strcmp(arg[iarg],"id") == 0) {
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "atom_modify id", error); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "atom_modify id", error);
if (domain->box_exist) if (domain->box_exist)
error->all(FLERR, idx, "Atom_modify id command after simulation box is defined"); error->all(FLERR, idx, "Atom_modify id command after simulation box is defined"
+ utils::errorurl(34));
tag_enable = utils::logical(FLERR,arg[iarg+1],false,lmp); tag_enable = utils::logical(FLERR,arg[iarg+1],false,lmp);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"map") == 0) { } else if (strcmp(arg[iarg],"map") == 0) {
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "atom_modify map", error); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "atom_modify map", error);
if (domain->box_exist) if (domain->box_exist)
error->all(FLERR, idx, "Atom_modify map command after simulation box is defined"); error->all(FLERR, idx, "Atom_modify map command after simulation box is defined"
+ utils::errorurl(34));
if (strcmp(arg[iarg+1],"array") == 0) map_user = MAP_ARRAY; if (strcmp(arg[iarg+1],"array") == 0) map_user = MAP_ARRAY;
else if (strcmp(arg[iarg+1],"hash") == 0) map_user = MAP_HASH; else if (strcmp(arg[iarg+1],"hash") == 0) map_user = MAP_HASH;
else if (strcmp(arg[iarg+1],"yes") == 0) map_user = MAP_YES; else if (strcmp(arg[iarg+1],"yes") == 0) map_user = MAP_YES;

View File

@ -113,7 +113,7 @@ Balance::~Balance()
void Balance::command(int narg, char **arg) void Balance::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR, -1, "Balance command before simulation box is defined"); error->all(FLERR, -1, "Balance command before simulation box is defined" + utils::errorurl(33));
if (comm->me == 0) utils::logmesg(lmp,"Balancing ...\n"); if (comm->me == 0) utils::logmesg(lmp,"Balancing ...\n");

View File

@ -45,7 +45,7 @@ void ChangeBox::command(int narg, char **arg)
int i; int i;
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Change_box command before simulation box is defined"); error->all(FLERR,"Change_box command before simulation box is defined" + utils::errorurl(33));
if (narg < 2) utils::missing_cmd_args(FLERR, "change_box", error); if (narg < 2) utils::missing_cmd_args(FLERR, "change_box", error);
if (comm->me == 0) utils::logmesg(lmp,"Changing box ...\n"); if (comm->me == 0) utils::logmesg(lmp,"Changing box ...\n");

View File

@ -73,7 +73,7 @@ CreateAtoms::CreateAtoms(LAMMPS *lmp) : Command(lmp), basistype(nullptr) {}
void CreateAtoms::command(int narg, char **arg) void CreateAtoms::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR, "Create_atoms command before simulation box is defined"); error->all(FLERR, "Create_atoms command before simulation box is defined" + utils::errorurl(33));
if (modify->nfix_restart_peratom) if (modify->nfix_restart_peratom)
error->all(FLERR, "Cannot create_atoms after reading restart file with per-atom info"); error->all(FLERR, "Cannot create_atoms after reading restart file with per-atom info");

View File

@ -44,7 +44,7 @@ CreateBonds::CreateBonds(LAMMPS *lmp) : Command(lmp) {}
void CreateBonds::command(int narg, char **arg) void CreateBonds::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR, "Create_bonds command before simulation box is defined"); error->all(FLERR, "Create_bonds command before simulation box is defined" + utils::errorurl(33));
if (atom->tag_enable == 0) error->all(FLERR, "Cannot use create_bonds unless atoms have IDs"); if (atom->tag_enable == 0) error->all(FLERR, "Cannot use create_bonds unless atoms have IDs");
if (atom->molecular != Atom::MOLECULAR) if (atom->molecular != Atom::MOLECULAR)
error->all(FLERR, "Cannot use create_bonds with non-molecular system"); error->all(FLERR, "Cannot use create_bonds with non-molecular system");

View File

@ -38,7 +38,8 @@ void CreateBox::command(int narg, char **arg)
{ {
if (narg < 2) utils::missing_cmd_args(FLERR, "create_box", error); if (narg < 2) utils::missing_cmd_args(FLERR, "create_box", error);
if (domain->box_exist) error->all(FLERR, "Cannot create_box after simulation box is defined"); if (domain->box_exist)
error->all(FLERR, "Cannot create_box after simulation box is defined" + utils::errorurl(34));
if (domain->dimension == 2 && domain->zperiodic == 0) if (domain->dimension == 2 && domain->zperiodic == 0)
error->all(FLERR, "Cannot run 2d simulation with nonperiodic Z dimension"); error->all(FLERR, "Cannot run 2d simulation with nonperiodic Z dimension");

View File

@ -52,7 +52,7 @@ DeleteAtoms::DeleteAtoms(LAMMPS *lmp) : Command(lmp) {}
void DeleteAtoms::command(int narg, char **arg) void DeleteAtoms::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR, "Delete_atoms command before simulation box is defined"); error->all(FLERR, "Delete_atoms command before simulation box is defined" + utils::errorurl(33));
if (narg < 1) utils::missing_cmd_args(FLERR, "delete_atoms", error); if (narg < 1) utils::missing_cmd_args(FLERR, "delete_atoms", error);
if (atom->tag_enable == 0) error->all(FLERR, "Cannot use delete_atoms unless atoms have IDs"); if (atom->tag_enable == 0) error->all(FLERR, "Cannot use delete_atoms unless atoms have IDs");

View File

@ -40,7 +40,7 @@ DeleteBonds::DeleteBonds(LAMMPS *lmp) : Command(lmp) {}
void DeleteBonds::command(int narg, char **arg) void DeleteBonds::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Delete_bonds command before simulation box is defined"); error->all(FLERR,"Delete_bonds command before simulation box is defined" + utils::errorurl(33));
if (atom->natoms == 0) if (atom->natoms == 0)
error->all(FLERR,"Delete_bonds command with no atoms existing"); error->all(FLERR,"Delete_bonds command with no atoms existing");
if (atom->molecular != Atom::MOLECULAR) if (atom->molecular != Atom::MOLECULAR)

View File

@ -42,12 +42,12 @@ void DihedralWrite::command(int narg, char **arg)
// sanity checks // sanity checks
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR, "Dihedral_write command before simulation box is defined"); error->all(FLERR, "Dihedral_write command before simulation box is defined" + utils::errorurl(33));
if (atom->avec->dihedrals_allow == 0) if (atom->avec->dihedrals_allow == 0)
error->all(FLERR, "Dihedral_write command when no dihedrals allowed"); error->all(FLERR, "Dihedral_write command when no dihedrals allowed");
auto dihedral = force->dihedral; auto dihedral = force->dihedral;
if (dihedral == nullptr) if (dihedral == nullptr)
error->all(FLERR, "Dihedral_write command before an dihedral_style is defined"); error->all(FLERR, "Dihedral_write command before an dihedral_style is defined" + utils::errorurl(33));
if (dihedral && (force->dihedral->writedata == 0)) if (dihedral && (force->dihedral->writedata == 0))
error->all(FLERR, "Dihedral style must support writing coeffs to data file for dihedral_write"); error->all(FLERR, "Dihedral style must support writing coeffs to data file for dihedral_write");

View File

@ -63,7 +63,7 @@ void DisplaceAtoms::command(int narg, char **arg)
int i; int i;
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Displace_atoms command before simulation box is defined"); error->all(FLERR,"Displace_atoms command before simulation box is defined" + utils::errorurl(33));
if (narg < 2) error->all(FLERR,"Illegal displace_atoms command"); if (narg < 2) error->all(FLERR,"Illegal displace_atoms command");
if (modify->nfix_restart_peratom) if (modify->nfix_restart_peratom)
error->all(FLERR,"Cannot displace_atoms after " error->all(FLERR,"Cannot displace_atoms after "

View File

@ -92,7 +92,7 @@ void Group::assign(int narg, char **arg)
{ {
int i; int i;
if (domain->box_exist == 0) error->all(FLERR, "Group command before simulation box is defined"); if (domain->box_exist == 0) error->all(FLERR, "Group command before simulation box is defined" + utils::errorurl(33));
if (narg < 2) utils::missing_cmd_args(FLERR, "group", error); if (narg < 2) utils::missing_cmd_args(FLERR, "group", error);
// delete the group if not being used elsewhere // delete the group if not being used elsewhere

View File

@ -1347,7 +1347,7 @@ void Input::variable_command()
void Input::angle_coeff() void Input::angle_coeff()
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Angle_coeff command before simulation box is defined"); error->all(FLERR,"Angle_coeff command before simulation box is defined" + utils::errorurl(33));
if (force->angle == nullptr) if (force->angle == nullptr)
error->all(FLERR,"Angle_coeff command before angle_style is defined"); error->all(FLERR,"Angle_coeff command before angle_style is defined");
if (atom->avec->angles_allow == 0) if (atom->avec->angles_allow == 0)
@ -1382,7 +1382,7 @@ void Input::atom_style()
{ {
if (narg < 1) utils::missing_cmd_args(FLERR, "atom_style", error); if (narg < 1) utils::missing_cmd_args(FLERR, "atom_style", error);
if (domain->box_exist) if (domain->box_exist)
error->all(FLERR,"Atom_style command after simulation box is defined"); error->all(FLERR,"Atom_style command after simulation box is defined" + utils::errorurl(34));
atom->create_avec(arg[0],narg-1,&arg[1],1); atom->create_avec(arg[0],narg-1,&arg[1],1);
} }
@ -1391,7 +1391,7 @@ void Input::atom_style()
void Input::bond_coeff() void Input::bond_coeff()
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Bond_coeff command before simulation box is defined"); error->all(FLERR,"Bond_coeff command before simulation box is defined" + utils::errorurl(33));
if (force->bond == nullptr) if (force->bond == nullptr)
error->all(FLERR,"Bond_coeff command before bond_style is defined"); error->all(FLERR,"Bond_coeff command before bond_style is defined");
if (atom->avec->bonds_allow == 0) if (atom->avec->bonds_allow == 0)
@ -1429,7 +1429,7 @@ void Input::bond_write()
void Input::boundary() void Input::boundary()
{ {
if (domain->box_exist) if (domain->box_exist)
error->all(FLERR,"Boundary command after simulation box is defined"); error->all(FLERR,"Boundary command after simulation box is defined" + utils::errorurl(34));
domain->set_boundary(narg,arg,0); domain->set_boundary(narg,arg,0);
} }
@ -1486,7 +1486,8 @@ void Input::dielectric()
void Input::dihedral_coeff() void Input::dihedral_coeff()
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Dihedral_coeff command before simulation box is defined"); error->all(FLERR,"Dihedral_coeff command before simulation box is defined"
+ utils::errorurl(33));
if (force->dihedral == nullptr) if (force->dihedral == nullptr)
error->all(FLERR,"Dihedral_coeff command before dihedral_style is defined"); error->all(FLERR,"Dihedral_coeff command before dihedral_style is defined");
if (atom->avec->dihedrals_allow == 0) if (atom->avec->dihedrals_allow == 0)
@ -1514,7 +1515,7 @@ void Input::dimension()
{ {
if (narg != 1) error->all(FLERR, "Dimension command expects exactly 1 argument"); if (narg != 1) error->all(FLERR, "Dimension command expects exactly 1 argument");
if (domain->box_exist) if (domain->box_exist)
error->all(FLERR,"Dimension command after simulation box is defined"); error->all(FLERR,"Dimension command after simulation box is defined" + utils::errorurl(34));
domain->dimension = utils::inumeric(FLERR,arg[0],false,lmp); domain->dimension = utils::inumeric(FLERR,arg[0],false,lmp);
if (domain->dimension != 2 && domain->dimension != 3) if (domain->dimension != 2 && domain->dimension != 3)
error->all(FLERR, "Invalid dimension argument: {}", arg[0]); error->all(FLERR, "Invalid dimension argument: {}", arg[0]);
@ -1565,7 +1566,7 @@ void Input::group_command()
void Input::improper_coeff() void Input::improper_coeff()
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Improper_coeff command before simulation box is defined"); error->all(FLERR,"Improper_coeff command before simulation box is defined" + utils::errorurl(33));
if (force->improper == nullptr) if (force->improper == nullptr)
error->all(FLERR,"Improper_coeff command before improper_style is defined"); error->all(FLERR,"Improper_coeff command before improper_style is defined");
if (atom->avec->impropers_allow == 0) if (atom->avec->impropers_allow == 0)
@ -1607,7 +1608,8 @@ void Input::kspace_style()
void Input::labelmap() void Input::labelmap()
{ {
if (domain->box_exist == 0) error->all(FLERR,"Labelmap command before simulation box is defined"); if (domain->box_exist == 0)
error->all(FLERR,"Labelmap command before simulation box is defined" + utils::errorurl(33));
if (!atom->labelmapflag) atom->add_label_map(); if (!atom->labelmapflag) atom->add_label_map();
atom->lmap->modify_lmap(narg,arg); atom->lmap->modify_lmap(narg,arg);
} }
@ -1625,7 +1627,7 @@ void Input::mass()
{ {
if (narg != 2) error->all(FLERR,"Illegal mass command: expected 2 arguments but found {}", narg); if (narg != 2) error->all(FLERR,"Illegal mass command: expected 2 arguments but found {}", narg);
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Mass command before simulation box is defined"); error->all(FLERR,"Mass command before simulation box is defined" + utils::errorurl(33));
atom->set_mass(FLERR,narg,arg); atom->set_mass(FLERR,narg,arg);
} }
@ -1641,7 +1643,7 @@ void Input::min_modify()
void Input::min_style() void Input::min_style()
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Min_style command before simulation box is defined"); error->all(FLERR,"Min_style command before simulation box is defined" + utils::errorurl(33));
update->create_minimize(narg,arg,1); update->create_minimize(narg,arg,1);
} }
@ -1682,7 +1684,7 @@ void Input::newton()
force->newton_pair = newton_pair; force->newton_pair = newton_pair;
if (domain->box_exist && (newton_bond != force->newton_bond)) if (domain->box_exist && (newton_bond != force->newton_bond))
error->all(FLERR,"Newton bond change after simulation box is defined"); error->all(FLERR,"Newton bond change after simulation box is defined" + utils::errorurl(34));
force->newton_bond = newton_bond; force->newton_bond = newton_bond;
if (newton_pair || newton_bond) force->newton = 1; if (newton_pair || newton_bond) force->newton = 1;
@ -1696,8 +1698,8 @@ void Input::newton()
void Input::package() void Input::package()
{ {
if (domain->box_exist) if (domain->box_exist)
error->all(FLERR,"Package command after simulation box is defined"); error->all(FLERR,"Package command after simulation box is defined" + utils::errorurl(34));
if (narg < 1) error->all(FLERR,"Illegal package command"); if (narg < 1) utils::missing_cmd_args(FLERR, "package", error);
// same checks for packages existing as in LAMMPS::post_create() // same checks for packages existing as in LAMMPS::post_create()
// since can be invoked here by package command in input script // since can be invoked here by package command in input script
@ -1739,7 +1741,7 @@ void Input::package()
void Input::pair_coeff() void Input::pair_coeff()
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Pair_coeff command before simulation box is defined"); error->all(FLERR,"Pair_coeff command before simulation box is defined" + utils::errorurl(33));
if (force->pair == nullptr) error->all(FLERR,"Pair_coeff command without a pair style"); if (force->pair == nullptr) error->all(FLERR,"Pair_coeff command without a pair style");
if (narg < 2) utils::missing_cmd_args(FLERR,"pair_coeff", error); if (narg < 2) utils::missing_cmd_args(FLERR,"pair_coeff", error);
if (force->pair->one_coeff && ((strcmp(arg[0],"*") != 0) || (strcmp(arg[1],"*") != 0))) if (force->pair->one_coeff && ((strcmp(arg[0],"*") != 0) || (strcmp(arg[1],"*") != 0)))
@ -1820,7 +1822,7 @@ void Input::pair_write()
void Input::processors() void Input::processors()
{ {
if (domain->box_exist) if (domain->box_exist)
error->all(FLERR,"Processors command after simulation box is defined"); error->all(FLERR,"Processors command after simulation box is defined" + utils::errorurl(34));
comm->set_processors(narg,arg); comm->set_processors(narg,arg);
} }
@ -1850,7 +1852,7 @@ void Input::restart()
void Input::run_style() void Input::run_style()
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Run_style command before simulation box is defined"); error->all(FLERR,"Run_style command before simulation box is defined" + utils::errorurl(33));
update->create_integrate(narg,arg,1); update->create_integrate(narg,arg,1);
} }
@ -2002,7 +2004,7 @@ void Input::units()
{ {
if (narg != 1) error->all(FLERR,"Illegal units command: expected 1 argument but found {}", narg); if (narg != 1) error->all(FLERR,"Illegal units command: expected 1 argument but found {}", narg);
if (domain->box_exist) if (domain->box_exist)
error->all(FLERR,"Units command after simulation box is defined"); error->all(FLERR,"Units command after simulation box is defined" + utils::errorurl(34));
update->set_units(arg[0]); update->set_units(arg[0]);
} }

View File

@ -321,10 +321,10 @@ void KSpace::qsum_qsq(int warning_flag)
// so issue warning or error // so issue warning or error
if (fabs(qsum) > SMALL) { if (fabs(qsum) > SMALL) {
std::string message = fmt::format("System is not charge neutral, net " std::string message = fmt::format("System is not charge neutral, net charge = {:.8}{}",
"charge = {:.8}",qsum); qsum, utils::errorurl(29));
if (!warn_nonneutral) error->all(FLERR,message + utils::errorurl(29)); if (!warn_nonneutral) error->all(FLERR,message);
if (warn_nonneutral == 1 && comm->me == 0) error->warning(FLERR,message + utils::errorurl(29)); if (warn_nonneutral == 1 && comm->me == 0) error->warning(FLERR,message);
warn_nonneutral = 2; warn_nonneutral = 2;
} }
} }

View File

@ -254,7 +254,7 @@ int LabelMap::find_or_create(const std::string &mylabel, std::vector<std::string
// if label cannot be found or created, need more space reserved // if label cannot be found or created, need more space reserved
error->all(FLERR, "Topology type exceeds system topology type"); error->all(FLERR, "Topology type exceeds system topology type" + utils::errorurl(25));
// never reaches here, just to prevent compiler warning // never reaches here, just to prevent compiler warning

View File

@ -35,7 +35,7 @@ void Minimize::command(int narg, char **arg)
error->all(FLERR, "Illegal minimize command: expected 4 arguments but found {}", narg); error->all(FLERR, "Illegal minimize command: expected 4 arguments but found {}", narg);
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR, "Minimize command before simulation box is defined"); error->all(FLERR, "Minimize command before simulation box is defined" + utils::errorurl(33));
// ignore minimize command, if walltime limit was already reached // ignore minimize command, if walltime limit was already reached
if (timer->is_timeout()) return; if (timer->is_timeout()) return;

View File

@ -896,7 +896,7 @@ void Output::create_thermo(int narg, char **arg)
// don't allow this so that dipole style can safely allocate inertia vector // don't allow this so that dipole style can safely allocate inertia vector
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Thermo_style command before simulation box is defined"); error->all(FLERR,"Thermo_style command before simulation box is defined" + utils::errorurl(33));
// warn if previous thermo had been modified via thermo_modify command // warn if previous thermo had been modified via thermo_modify command

View File

@ -339,9 +339,11 @@ void ReadData::command(int narg, char **arg)
"Reading a data file with shrinkwrap boundaries is not " "Reading a data file with shrinkwrap boundaries is not "
"compatible with a MSM KSpace style"); "compatible with a MSM KSpace style");
if (domain->box_exist && !addflag) if (domain->box_exist && !addflag)
error->all(FLERR, "Cannot use read_data without add keyword after simulation box is defined"); error->all(FLERR, "Cannot use read_data without add keyword after simulation box is defined"
+ utils::errorurl(34));
if (!domain->box_exist && addflag) if (!domain->box_exist && addflag)
error->all(FLERR, "Cannot use read_data add before simulation box is defined"); error->all(FLERR, "Cannot use read_data add before simulation box is defined"
+ utils::errorurl(33));
if (offsetflag) { if (offsetflag) {
if (addflag == NONE) { if (addflag == NONE) {
error->all(FLERR, "Cannot use read_data offset without add keyword"); error->all(FLERR, "Cannot use read_data offset without add keyword");

View File

@ -80,7 +80,7 @@ ReadDump::~ReadDump()
void ReadDump::command(int narg, char **arg) void ReadDump::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Read_dump command before simulation box is defined"); error->all(FLERR,"Read_dump command before simulation box is defined" + utils::errorurl(33));
if (narg < 2) utils::missing_cmd_args(FLERR, "read_dump", error); if (narg < 2) utils::missing_cmd_args(FLERR, "read_dump", error);

View File

@ -52,7 +52,7 @@ void ReadRestart::command(int narg, char **arg)
if (narg != 1 && narg != 2) error->all(FLERR,"Illegal read_restart command"); if (narg != 1 && narg != 2) error->all(FLERR,"Illegal read_restart command");
if (domain->box_exist) if (domain->box_exist)
error->all(FLERR,"Cannot read_restart after simulation box is defined"); error->all(FLERR,"Cannot read_restart after simulation box is defined" + utils::errorurl(34));
MPI_Barrier(world); MPI_Barrier(world);
double time1 = platform::walltime(); double time1 = platform::walltime();

View File

@ -52,7 +52,7 @@ void Replicate::command(int narg, char **arg)
int i,n; int i,n;
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Replicate command before simulation box is defined"); error->all(FLERR,"Replicate command before simulation box is defined" + utils::errorurl(33));
if (narg < 3 || narg > 4) error->all(FLERR,"Illegal replicate command"); if (narg < 3 || narg > 4) error->all(FLERR,"Illegal replicate command");

View File

@ -41,7 +41,7 @@ Rerun::Rerun(LAMMPS *lmp) : Command(lmp) {}
void Rerun::command(int narg, char **arg) void Rerun::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Rerun command before simulation box is defined"); error->all(FLERR,"Rerun command before simulation box is defined" + utils::errorurl(33));
if (narg < 2) error->all(FLERR,"Illegal rerun command"); if (narg < 2) error->all(FLERR,"Illegal rerun command");

View File

@ -53,7 +53,7 @@ ResetAtomsID::ResetAtomsID(LAMMPS *lmp) : Command(lmp)
void ResetAtomsID::command(int narg, char **arg) void ResetAtomsID::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR, "Reset_atoms id command before simulation box is defined"); error->all(FLERR, "Reset_atoms id command before simulation box is defined" + utils::errorurl(33));
if (atom->tag_enable == 0) error->all(FLERR, "Cannot use reset_atoms id unless atoms have IDs"); if (atom->tag_enable == 0) error->all(FLERR, "Cannot use reset_atoms id unless atoms have IDs");
for (const auto &ifix : modify->get_fix_list()) for (const auto &ifix : modify->get_fix_list())

View File

@ -39,7 +39,7 @@ ResetAtomsImage::ResetAtomsImage(LAMMPS *lmp) : Command(lmp) {}
void ResetAtomsImage::command(int narg, char **arg) void ResetAtomsImage::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR, "Reset_atoms image command before simulation box is defined"); error->all(FLERR, "Reset_atoms image command before simulation box is defined" + utils::errorurl(33));
if (atom->tag_enable == 0) if (atom->tag_enable == 0)
error->all(FLERR, "Cannot use reset_atoms image unless atoms have IDs"); error->all(FLERR, "Cannot use reset_atoms image unless atoms have IDs");
if (atom->avec->bonds_allow == 0) if (atom->avec->bonds_allow == 0)

View File

@ -61,7 +61,7 @@ ResetAtomsMol::~ResetAtomsMol()
void ResetAtomsMol::command(int narg, char **arg) void ResetAtomsMol::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR, "Reset_atoms mol command before simulation box is defined"); error->all(FLERR, "Reset_atoms mol command before simulation box is defined" + utils::errorurl(33));
if (atom->tag_enable == 0) error->all(FLERR, "Cannot use reset_atoms mol unless atoms have IDs"); if (atom->tag_enable == 0) error->all(FLERR, "Cannot use reset_atoms mol unless atoms have IDs");
if (atom->molecular != Atom::MOLECULAR) if (atom->molecular != Atom::MOLECULAR)
error->all(FLERR, "Can only use reset_atoms mol on molecular systems"); error->all(FLERR, "Can only use reset_atoms mol on molecular systems");

View File

@ -39,7 +39,7 @@ void Run::command(int narg, char **arg)
if (narg < 1) utils::missing_cmd_args(FLERR, "run", error); if (narg < 1) utils::missing_cmd_args(FLERR, "run", error);
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Run command before simulation box is defined"); error->all(FLERR,"Run command before simulation box is defined" + utils::errorurl(33));
// ignore run command, if walltime limit was already reached // ignore run command, if walltime limit was already reached

View File

@ -51,7 +51,7 @@ void Velocity::command(int narg, char **arg)
if (narg < 2) utils::missing_cmd_args(FLERR, "velocity", error); if (narg < 2) utils::missing_cmd_args(FLERR, "velocity", error);
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Velocity command before simulation box is defined"); error->all(FLERR,"Velocity command before simulation box is defined" + utils::errorurl(33));
if (atom->natoms == 0) if (atom->natoms == 0)
error->all(FLERR,"Velocity command with no atoms existing"); error->all(FLERR,"Velocity command with no atoms existing");

View File

@ -39,7 +39,7 @@ static constexpr int BUF_SIZE = 256;
void WriteCoeff::command(int narg, char **arg) void WriteCoeff::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR, "Write_coeff command before simulation box is defined"); error->all(FLERR, "Write_coeff command before simulation box is defined" + utils::errorurl(33));
if (narg != 1) utils::missing_cmd_args(FLERR, "write_coeff", error); if (narg != 1) utils::missing_cmd_args(FLERR, "write_coeff", error);

View File

@ -51,7 +51,7 @@ WriteData::WriteData(LAMMPS *lmp) : Command(lmp) {}
void WriteData::command(int narg, char **arg) void WriteData::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Write_data command before simulation box is defined"); error->all(FLERR,"Write_data command before simulation box is defined" + utils::errorurl(33));
if (narg < 1) utils::missing_cmd_args(FLERR, "write_data", error); if (narg < 1) utils::missing_cmd_args(FLERR, "write_data", error);

View File

@ -59,7 +59,7 @@ WriteRestart::WriteRestart(LAMMPS *lmp) : Command(lmp)
void WriteRestart::command(int narg, char **arg) void WriteRestart::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Write_restart command before simulation box is defined"); error->all(FLERR,"Write_restart command before simulation box is defined" + utils::errorurl(33));
if (narg < 1) utils::missing_cmd_args(FLERR, "write_restart", error); if (narg < 1) utils::missing_cmd_args(FLERR, "write_restart", error);
// if filename contains a "*", replace with current timestep // if filename contains a "*", replace with current timestep