improved some error messages in compute_msd,fix_indent and fix_nh.cpp

This commit is contained in:
Jiancheng Chen 2022-08-15 10:51:29 +08:00
parent 89f32e43dc
commit d047053473
3 changed files with 53 additions and 54 deletions

View File

@ -27,8 +27,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg) ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), id_fix(nullptr)
: Compute(lmp, narg, arg), id_fix(nullptr)
{ {
if (narg < 3) error->all(FLERR, "Illegal compute msd command"); if (narg < 3) error->all(FLERR, "Illegal compute msd command");
@ -46,15 +45,15 @@ ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg)
int iarg = 3; int iarg = 3;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg], "com") == 0) { if (strcmp(arg[iarg], "com") == 0) {
if (iarg + 2 > narg) error->all(FLERR, "Illegal compute msd command"); if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "compute msd com", error);
comflag = utils::logical(FLERR, arg[iarg + 1], false, lmp); comflag = utils::logical(FLERR, arg[iarg + 1], false, lmp);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg], "average") == 0) { } else if (strcmp(arg[iarg], "average") == 0) {
if (iarg + 2 > narg) error->all(FLERR, "Illegal compute msd command"); if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "compute msd average", error);
avflag = utils::logical(FLERR, arg[iarg + 1], false, lmp); avflag = utils::logical(FLERR, arg[iarg + 1], false, lmp);
iarg += 2; iarg += 2;
} else } else
error->all(FLERR, "Illegal compute msd command"); error->all(FLERR, "Unknown compute msd keyword: {}", arg[iarg]);
} }
if (group->dynamic[igroup]) if (group->dynamic[igroup])

View File

@ -43,7 +43,7 @@ FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), Fix(lmp, narg, arg),
xstr(nullptr), ystr(nullptr), zstr(nullptr), rstr(nullptr), pstr(nullptr) xstr(nullptr), ystr(nullptr), zstr(nullptr), rstr(nullptr), pstr(nullptr)
{ {
if (narg < 4) error->all(FLERR,"Illegal fix indent command"); if (narg < 4) utils::missing_cmd_args(FLERR, "fix indent", error);
scalar_flag = 1; scalar_flag = 1;
vector_flag = 1; vector_flag = 1;
@ -405,7 +405,7 @@ double FixIndent::compute_vector(int n)
void FixIndent::options(int narg, char **arg) void FixIndent::options(int narg, char **arg)
{ {
if (narg < 0) error->all(FLERR,"Illegal fix indent command"); if (narg < 0) utils::missing_cmd_args(FLERR, "fix indent", error);
istyle = NONE; istyle = NONE;
xstr = ystr = zstr = rstr = pstr = nullptr; xstr = ystr = zstr = rstr = pstr = nullptr;
@ -416,7 +416,7 @@ void FixIndent::options(int narg, char **arg)
int iarg = 0; int iarg = 0;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"sphere") == 0) { if (strcmp(arg[iarg],"sphere") == 0) {
if (iarg+5 > narg) error->all(FLERR,"Illegal fix indent command"); if (iarg+5 > narg) utils::missing_cmd_args(FLERR, "fix indent sphere", error);
if (utils::strmatch(arg[iarg+1],"^v_")) { if (utils::strmatch(arg[iarg+1],"^v_")) {
xstr = utils::strdup(arg[iarg+1]+2); xstr = utils::strdup(arg[iarg+1]+2);
@ -435,7 +435,7 @@ void FixIndent::options(int narg, char **arg)
iarg += 5; iarg += 5;
} else if (strcmp(arg[iarg],"cylinder") == 0) { } else if (strcmp(arg[iarg],"cylinder") == 0) {
if (iarg+5 > narg) error->all(FLERR,"Illegal fix indent command"); if (iarg+5 > narg) utils::missing_cmd_args(FLERR, "fix indent cylinder", error);
if (strcmp(arg[iarg+1],"x") == 0) { if (strcmp(arg[iarg+1],"x") == 0) {
cdim = 0; cdim = 0;
@ -461,7 +461,7 @@ void FixIndent::options(int narg, char **arg)
if (utils::strmatch(arg[iarg+3],"^v_")) { if (utils::strmatch(arg[iarg+3],"^v_")) {
ystr = utils::strdup(arg[iarg+3]+2); ystr = utils::strdup(arg[iarg+3]+2);
} else yvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); } else yvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
} else error->all(FLERR,"Illegal fix indent command"); } else error->all(FLERR,"Unknown fix indent cylinder argument: {}", arg[iarg+1]);
if (utils::strmatch(arg[iarg+4],"^v_")) { if (utils::strmatch(arg[iarg+4],"^v_")) {
rstr = utils::strdup(arg[iarg+4]+2); rstr = utils::strdup(arg[iarg+4]+2);
@ -471,11 +471,11 @@ void FixIndent::options(int narg, char **arg)
iarg += 5; iarg += 5;
} else if (strcmp(arg[iarg],"plane") == 0) { } else if (strcmp(arg[iarg],"plane") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix indent command"); if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix indent plane", error);
if (strcmp(arg[iarg+1],"x") == 0) cdim = 0; if (strcmp(arg[iarg+1],"x") == 0) cdim = 0;
else if (strcmp(arg[iarg+1],"y") == 0) cdim = 1; else if (strcmp(arg[iarg+1],"y") == 0) cdim = 1;
else if (strcmp(arg[iarg+1],"z") == 0) cdim = 2; else if (strcmp(arg[iarg+1],"z") == 0) cdim = 2;
else error->all(FLERR,"Illegal fix indent command"); else error->all(FLERR,"Unknown fix indent plane argument: {}", arg[iarg+1]);
if (utils::strmatch(arg[iarg+2],"^v_")) { if (utils::strmatch(arg[iarg+2],"^v_")) {
pstr = utils::strdup(arg[iarg+2]+2); pstr = utils::strdup(arg[iarg+2]+2);
@ -483,23 +483,23 @@ void FixIndent::options(int narg, char **arg)
if (strcmp(arg[iarg+3],"lo") == 0) planeside = -1; if (strcmp(arg[iarg+3],"lo") == 0) planeside = -1;
else if (strcmp(arg[iarg+3],"hi") == 0) planeside = 1; else if (strcmp(arg[iarg+3],"hi") == 0) planeside = 1;
else error->all(FLERR,"Illegal fix indent command"); else error->all(FLERR,"Unknown fix indent plane argument: {}", arg[iarg+3]);
istyle = PLANE; istyle = PLANE;
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"units") == 0) { } else if (strcmp(arg[iarg],"units") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix indent command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix indent units", error);
if (strcmp(arg[iarg+1],"box") == 0) scaleflag = 0; if (strcmp(arg[iarg+1],"box") == 0) scaleflag = 0;
else if (strcmp(arg[iarg+1],"lattice") == 0) scaleflag = 1; else if (strcmp(arg[iarg+1],"lattice") == 0) scaleflag = 1;
else error->all(FLERR,"Illegal fix indent command"); else error->all(FLERR,"Unknown fix indent units argument: {}", arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"side") == 0) { } else if (strcmp(arg[iarg],"side") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix indent command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix indent side", error);
if (strcmp(arg[iarg+1],"in") == 0) side = INSIDE; if (strcmp(arg[iarg+1],"in") == 0) side = INSIDE;
else if (strcmp(arg[iarg+1],"out") == 0) side = OUTSIDE; else if (strcmp(arg[iarg+1],"out") == 0) side = OUTSIDE;
else error->all(FLERR,"Illegal fix indent command"); else error->all(FLERR,"Unknown fix indent side argument: {}", arg[iarg+1]);
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal fix indent command"); } else error->all(FLERR,"Unknown fix indent argument: {}", arg[iarg]);
} }
} }

View File

@ -60,7 +60,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
eta_mass(nullptr), etap(nullptr), etap_dot(nullptr), etap_dotdot(nullptr), eta_mass(nullptr), etap(nullptr), etap_dot(nullptr), etap_dotdot(nullptr),
etap_mass(nullptr) etap_mass(nullptr)
{ {
if (narg < 4) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (narg < 4) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph", error);
restart_global = 1; restart_global = 1;
dynamic_group_allow = 1; dynamic_group_allow = 1;
@ -130,7 +130,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"temp") == 0) { if (strcmp(arg[iarg],"temp") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph temp", error);
tstat_flag = 1; tstat_flag = 1;
t_start = utils::numeric(FLERR,arg[iarg+1],false,lmp); t_start = utils::numeric(FLERR,arg[iarg+1],false,lmp);
t_target = t_start; t_target = t_start;
@ -142,7 +142,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"iso") == 0) { } else if (strcmp(arg[iarg],"iso") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph iso", error);
pcouple = XYZ; pcouple = XYZ;
p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp);
@ -155,7 +155,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
} }
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"aniso") == 0) { } else if (strcmp(arg[iarg],"aniso") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph aniso", error);
pcouple = NONE; pcouple = NONE;
p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp);
@ -168,7 +168,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
} }
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"tri") == 0) { } else if (strcmp(arg[iarg],"tri") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph tri", error);
pcouple = NONE; pcouple = NONE;
scalexy = scalexz = scaleyz = 0; scalexy = scalexz = scaleyz = 0;
p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
@ -191,7 +191,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
} }
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"x") == 0) { } else if (strcmp(arg[iarg],"x") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph x", error);
p_start[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_start[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
p_stop[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_stop[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp);
p_period[0] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_period[0] = utils::numeric(FLERR,arg[iarg+3],false,lmp);
@ -199,7 +199,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
deviatoric_flag = 1; deviatoric_flag = 1;
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"y") == 0) { } else if (strcmp(arg[iarg],"y") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph y", error);
p_start[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_start[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
p_stop[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_stop[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp);
p_period[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_period[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp);
@ -207,7 +207,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
deviatoric_flag = 1; deviatoric_flag = 1;
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"z") == 0) { } else if (strcmp(arg[iarg],"z") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph z", error);
p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp);
p_period[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_period[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp);
@ -218,7 +218,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Invalid fix nvt/npt/nph command for a 2d simulation"); error->all(FLERR,"Invalid fix nvt/npt/nph command for a 2d simulation");
} else if (strcmp(arg[iarg],"yz") == 0) { } else if (strcmp(arg[iarg],"yz") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph yz", error);
p_start[3] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_start[3] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
p_stop[3] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_stop[3] = utils::numeric(FLERR,arg[iarg+2],false,lmp);
p_period[3] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_period[3] = utils::numeric(FLERR,arg[iarg+3],false,lmp);
@ -229,7 +229,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
if (dimension == 2) if (dimension == 2)
error->all(FLERR,"Invalid fix nvt/npt/nph command for a 2d simulation"); error->all(FLERR,"Invalid fix nvt/npt/nph command for a 2d simulation");
} else if (strcmp(arg[iarg],"xz") == 0) { } else if (strcmp(arg[iarg],"xz") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph xz", error);
p_start[4] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_start[4] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
p_stop[4] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_stop[4] = utils::numeric(FLERR,arg[iarg+2],false,lmp);
p_period[4] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_period[4] = utils::numeric(FLERR,arg[iarg+3],false,lmp);
@ -240,7 +240,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
if (dimension == 2) if (dimension == 2)
error->all(FLERR,"Invalid fix nvt/npt/nph command for a 2d simulation"); error->all(FLERR,"Invalid fix nvt/npt/nph command for a 2d simulation");
} else if (strcmp(arg[iarg],"xy") == 0) { } else if (strcmp(arg[iarg],"xy") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph xy", error);
p_start[5] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_start[5] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
p_stop[5] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_stop[5] = utils::numeric(FLERR,arg[iarg+2],false,lmp);
p_period[5] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_period[5] = utils::numeric(FLERR,arg[iarg+3],false,lmp);
@ -250,7 +250,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"couple") == 0) { } else if (strcmp(arg[iarg],"couple") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph couple", error);
if (strcmp(arg[iarg+1],"xyz") == 0) pcouple = XYZ; if (strcmp(arg[iarg+1],"xyz") == 0) pcouple = XYZ;
else if (strcmp(arg[iarg+1],"xy") == 0) pcouple = XY; else if (strcmp(arg[iarg+1],"xy") == 0) pcouple = XY;
else if (strcmp(arg[iarg+1],"yz") == 0) pcouple = YZ; else if (strcmp(arg[iarg+1],"yz") == 0) pcouple = YZ;
@ -260,18 +260,18 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"drag") == 0) { } else if (strcmp(arg[iarg],"drag") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph drag", error);
drag = utils::numeric(FLERR,arg[iarg+1],false,lmp); drag = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (drag < 0.0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (drag < 0.0) error->all(FLERR, "Invalid fix nvt/npt/nph drag argument: {}", drag);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"ptemp") == 0) { } else if (strcmp(arg[iarg],"ptemp") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph ptemp", error);
p_temp = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_temp = utils::numeric(FLERR,arg[iarg+1],false,lmp);
p_temp_flag = 1; p_temp_flag = 1;
if (p_temp <= 0.0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (p_temp <= 0.0) error->all(FLERR, "Invalid fix nvt/npt/nph ptemp argument: {}", p_temp);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"dilate") == 0) { } else if (strcmp(arg[iarg],"dilate") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph dilate", error);
if (strcmp(arg[iarg+1],"all") == 0) allremap = 1; if (strcmp(arg[iarg+1],"all") == 0) allremap = 1;
else { else {
allremap = 0; allremap = 0;
@ -284,62 +284,62 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"tchain") == 0) { } else if (strcmp(arg[iarg],"tchain") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph tchain", error);
mtchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); mtchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
// used by FixNVTSllod to preserve non-default value // used by FixNVTSllod to preserve non-default value
mtchain_default_flag = 0; mtchain_default_flag = 0;
if (mtchain < 1) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (mtchain < 1) error->all(FLERR, "Invalid fix nvt/npt/nph tchain argument: {}", mtchain);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"pchain") == 0) { } else if (strcmp(arg[iarg],"pchain") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph pchain", error);
mpchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); mpchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (mpchain < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (mpchain < 0) error->all(FLERR, "Invalid fix nvt/npt/nph pchain argument: {}", mpchain);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"mtk") == 0) { } else if (strcmp(arg[iarg],"mtk") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph mtk", error);
mtk_flag = utils::logical(FLERR,arg[iarg+1],false,lmp); mtk_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"tloop") == 0) { } else if (strcmp(arg[iarg],"tloop") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph tloop", error);
nc_tchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); nc_tchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (nc_tchain < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (nc_tchain < 0) error->all(FLERR, "Invalid fix nvt/npt/nph tloop argument: {}", nc_tchain);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"ploop") == 0) { } else if (strcmp(arg[iarg],"ploop") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph ploop", error);
nc_pchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); nc_pchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (nc_pchain < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (nc_pchain < 0) error->all(FLERR, "Invalid fix nvt/npt/nph ploop argument: {}", nc_pchain);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"nreset") == 0) { } else if (strcmp(arg[iarg],"nreset") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph nreset", error);
nreset_h0 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); nreset_h0 = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (nreset_h0 < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (nreset_h0 < 0) error->all(FLERR, "Invalid fix nvt/npt/nph nreset argument: {}", nreset_h0);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"scalexy") == 0) { } else if (strcmp(arg[iarg],"scalexy") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph scalexy", error);
scalexy = utils::logical(FLERR,arg[iarg+1],false,lmp); scalexy = utils::logical(FLERR,arg[iarg+1],false,lmp);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"scalexz") == 0) { } else if (strcmp(arg[iarg],"scalexz") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph scalexz", error);
scalexz = utils::logical(FLERR,arg[iarg+1],false,lmp); scalexz = utils::logical(FLERR,arg[iarg+1],false,lmp);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"scaleyz") == 0) { } else if (strcmp(arg[iarg],"scaleyz") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph scaleyz", error);
scaleyz = utils::logical(FLERR,arg[iarg+1],false,lmp); scaleyz = utils::logical(FLERR,arg[iarg+1],false,lmp);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"flip") == 0) { } else if (strcmp(arg[iarg],"flip") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph flip", error);
flipflag = utils::logical(FLERR,arg[iarg+1],false,lmp); flipflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"update") == 0) { } else if (strcmp(arg[iarg],"update") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph update", error);
if (strcmp(arg[iarg+1],"dipole") == 0) dipole_flag = 1; if (strcmp(arg[iarg+1],"dipole") == 0) dipole_flag = 1;
else if (strcmp(arg[iarg+1],"dipole/dlm") == 0) { else if (strcmp(arg[iarg+1],"dipole/dlm") == 0) {
dipole_flag = 1; dipole_flag = 1;
dlm_flag = 1; dlm_flag = 1;
} else error->all(FLERR,"Illegal fix nvt/npt/nph command"); } else error->all(FLERR, "Invalid fix nvt/npt/nph update argument: {}", arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"fixedpoint") == 0) { } else if (strcmp(arg[iarg],"fixedpoint") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix nvt/npt/nph fixedpoint", error);
fixedpoint[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); fixedpoint[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp);
fixedpoint[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); fixedpoint[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp);
fixedpoint[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); fixedpoint[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp);
@ -359,7 +359,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[iarg],"ext") == 0) { } else if (strcmp(arg[iarg],"ext") == 0) {
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal fix nvt/npt/nph command"); } else error->all(FLERR,"Unknown fix nvt/npt/nph keyword: {}", arg[iarg]);
} }
// error checks // error checks