improve error messages in change_box,create_box,domain,input,lattice and neighbor.cpp
This commit is contained in:
@ -35,7 +35,7 @@ CreateBox::CreateBox(LAMMPS *lmp) : Command(lmp) {}
|
||||
|
||||
void CreateBox::command(int narg, char **arg)
|
||||
{
|
||||
if (narg < 2) error->all(FLERR, "Illegal create_box command");
|
||||
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->dimension == 2 && domain->zperiodic == 0)
|
||||
@ -107,56 +107,56 @@ void CreateBox::command(int narg, char **arg)
|
||||
int iarg = 2;
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg], "bond/types") == 0) {
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal create_box command");
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box bond/type", error);
|
||||
if (!atom->avec->bonds_allow) error->all(FLERR, "No bonds allowed with this atom style");
|
||||
atom->nbondtypes = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "angle/types") == 0) {
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal create_box command");
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box angle/types", error);
|
||||
if (!atom->avec->angles_allow) error->all(FLERR, "No angles allowed with this atom style");
|
||||
atom->nangletypes = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "dihedral/types") == 0) {
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal create_box command");
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box dihedral/types", error);
|
||||
if (!atom->avec->dihedrals_allow)
|
||||
error->all(FLERR, "No dihedrals allowed with this atom style");
|
||||
atom->ndihedraltypes = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "improper/types") == 0) {
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal create_box command");
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box improper/types", error);
|
||||
if (!atom->avec->impropers_allow)
|
||||
error->all(FLERR, "No impropers allowed with this atom style");
|
||||
atom->nimpropertypes = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "extra/bond/per/atom") == 0) {
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal create_box command");
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box extra/bond/per/atom", error);
|
||||
if (!atom->avec->bonds_allow) error->all(FLERR, "No bonds allowed with this atom style");
|
||||
atom->bond_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "extra/angle/per/atom") == 0) {
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal create_box command");
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box extra/angle/per/atom", error);
|
||||
if (!atom->avec->angles_allow) error->all(FLERR, "No angles allowed with this atom style");
|
||||
atom->angle_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "extra/dihedral/per/atom") == 0) {
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal create_box command");
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box extra/dihedral/per/atom", error);
|
||||
if (!atom->avec->dihedrals_allow)
|
||||
error->all(FLERR, "No dihedrals allowed with this atom style");
|
||||
atom->dihedral_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "extra/improper/per/atom") == 0) {
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal create_box command");
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box extra/improper/per/atom", error);
|
||||
if (!atom->avec->impropers_allow)
|
||||
error->all(FLERR, "No impropers allowed with this atom style");
|
||||
atom->improper_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg], "extra/special/per/atom") == 0) {
|
||||
if (iarg + 2 > narg) error->all(FLERR, "Illegal create_box command");
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "create_box extra/special/per/atom", error);
|
||||
force->special_extra = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
atom->maxspecial += force->special_extra;
|
||||
iarg += 2;
|
||||
} else
|
||||
error->all(FLERR, "Illegal create_box command");
|
||||
error->all(FLERR, "Unknown create_box keyword: {}", arg[iarg]);
|
||||
}
|
||||
|
||||
// problem setup using info from header
|
||||
|
||||
Reference in New Issue
Block a user