apply utils::logical() to more commands

This commit is contained in:
Axel Kohlmeyer
2021-09-20 22:44:42 -04:00
parent 6adac6b637
commit 41a3eccd1c
39 changed files with 210 additions and 410 deletions

View File

@ -233,9 +233,7 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) :
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 bocs command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix bocs command");
if (strcmp(arg[iarg+1],"yes") == 0) mtk_flag = 1; mtk_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) mtk_flag = 0;
else error->all(FLERR,"Illegal fix bocs command");
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 bocs command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix bocs command");

View File

@ -18,20 +18,22 @@
Updated algorithm by: Brian Barnes, brian.c.barnes11.civ@mail.mil Updated algorithm by: Brian Barnes, brian.c.barnes11.civ@mail.mil
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include <cmath>
#include <cstring>
#include "compute_ackland_atom.h" #include "compute_ackland_atom.h"
#include "atom.h" #include "atom.h"
#include "update.h" #include "comm.h"
#include "error.h"
#include "force.h"
#include "memory.h"
#include "modify.h" #include "modify.h"
#include "neighbor.h"
#include "neigh_list.h" #include "neigh_list.h"
#include "neigh_request.h" #include "neigh_request.h"
#include "force.h" #include "neighbor.h"
#include "pair.h" #include "pair.h"
#include "comm.h" #include "update.h"
#include "memory.h"
#include "error.h" #include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -60,16 +62,10 @@ ComputeAcklandAtom::ComputeAcklandAtom(LAMMPS *lmp, int narg, char **arg) :
int iarg = 3; int iarg = 3;
while (narg > iarg) { while (narg > iarg) {
if (strcmp("legacy",arg[iarg]) == 0) { if (strcmp("legacy",arg[iarg]) == 0) {
++iarg; if (iarg+2 > narg) error->all(FLERR,"Invalid compute ackland/atom command");
if (iarg >= narg) legacy = utils::logical(FLERR,arg[iarg+1],false,lmp);
error->all(FLERR,"Invalid compute ackland/atom command"); iarg += 2;
if (strcmp("yes",arg[iarg]) == 0)
legacy = 1;
else if (strcmp("no",arg[iarg]) == 0)
legacy = 0;
else error->all(FLERR,"Invalid compute ackland/atom command");
} }
++iarg;
} }
} }

View File

@ -822,17 +822,13 @@ void Atom::modify_params(int narg, char **arg)
if (strcmp(arg[iarg],"id") == 0) { if (strcmp(arg[iarg],"id") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command");
if (domain->box_exist) if (domain->box_exist)
error->all(FLERR, error->all(FLERR,"Atom_modify id command after simulation box is defined");
"Atom_modify id command after simulation box is defined"); tag_enable = utils::logical(FLERR,arg[iarg+1],false,lmp);
if (strcmp(arg[iarg+1],"yes") == 0) tag_enable = 1;
else if (strcmp(arg[iarg+1],"no") == 0) tag_enable = 0;
else error->all(FLERR,"Illegal atom_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"map") == 0) { } else if (strcmp(arg[iarg],"map") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command");
if (domain->box_exist) if (domain->box_exist)
error->all(FLERR, error->all(FLERR,"Atom_modify map command after simulation box is defined");
"Atom_modify map command after simulation box is defined");
if (strcmp(arg[iarg+1],"array") == 0) map_user = 1; if (strcmp(arg[iarg+1],"array") == 0) map_user = 1;
else if (strcmp(arg[iarg+1],"hash") == 0) map_user = 2; else if (strcmp(arg[iarg+1],"hash") == 0) map_user = 2;
else if (strcmp(arg[iarg+1],"yes") == 0) map_user = 3; else if (strcmp(arg[iarg+1],"yes") == 0) map_user = 3;

View File

@ -395,9 +395,7 @@ void Comm::modify_params(int narg, char **arg)
iarg += 1; iarg += 1;
} else if (strcmp(arg[iarg],"vel") == 0) { } else if (strcmp(arg[iarg],"vel") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) ghost_velocity = 1; ghost_velocity = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) ghost_velocity = 0;
else error->all(FLERR,"Illegal comm_modify command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal comm_modify command"); } else error->all(FLERR,"Illegal comm_modify command");
} }

View File

@ -128,9 +128,7 @@ void Compute::modify_params(int narg, char **arg)
} else if (strcmp(arg[iarg],"dynamic") == 0 || } else if (strcmp(arg[iarg],"dynamic") == 0 ||
strcmp(arg[iarg],"dynamic/dof") == 0) { strcmp(arg[iarg],"dynamic/dof") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal compute_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal compute_modify command");
if (strcmp(arg[iarg+1],"no") == 0) dynamic_user = 0; dynamic_user = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) dynamic_user = 1;
else error->all(FLERR,"Illegal compute_modify command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal compute_modify command"); } else error->all(FLERR,"Illegal compute_modify command");
} }

View File

@ -17,19 +17,21 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "compute_centro_atom.h" #include "compute_centro_atom.h"
#include <cstring>
#include "atom.h" #include "atom.h"
#include "update.h"
#include "modify.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "force.h"
#include "pair.h"
#include "comm.h" #include "comm.h"
#include "error.h"
#include "force.h"
#include "math_extra.h" #include "math_extra.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "modify.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "pair.h"
#include "update.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -55,11 +57,8 @@ ComputeCentroAtom::ComputeCentroAtom(LAMMPS *lmp, int narg, char **arg) :
int iarg = 4; int iarg = 4;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"axes") == 0) { if (strcmp(arg[iarg],"axes") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute centro/atom command3");
error->all(FLERR,"Illegal compute centro/atom command3"); axes_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
if (strcmp(arg[iarg+1],"yes") == 0) axes_flag = 1;
else if (strcmp(arg[iarg+1],"no") == 0) axes_flag = 0;
else error->all(FLERR,"Illegal compute centro/atom command2");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal compute centro/atom command1"); } else error->all(FLERR,"Illegal compute centro/atom command1");
} }

View File

@ -220,9 +220,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) :
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"compress") == 0) { } else if (strcmp(arg[iarg],"compress") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command");
else if (strcmp(arg[iarg+1],"no") == 0) compress = 0; compress = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) compress = 1;
else error->all(FLERR,"Illegal compute chunk/atom command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"discard") == 0) { } else if (strcmp(arg[iarg],"discard") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command");
@ -255,9 +253,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) :
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"pbc") == 0) { } else if (strcmp(arg[iarg],"pbc") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command");
if (strcmp(arg[iarg+1],"no") == 0) pbcflag = 0; pbcflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) pbcflag = 1;
else error->all(FLERR,"Illegal compute chunk/atom command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal compute chunk/atom command"); } else error->all(FLERR,"Illegal compute chunk/atom command");
} }

View File

@ -54,9 +54,7 @@ ComputeFragmentAtom::ComputeFragmentAtom(LAMMPS *lmp, int narg, char **arg) :
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"single") == 0) { if (strcmp(arg[iarg],"single") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal compute fragment/atom command"); if (iarg+2 > narg) error->all(FLERR,"Illegal compute fragment/atom command");
if (strcmp(arg[iarg+1],"yes") == 0) singleflag = 1; singleflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) singleflag = 0;
else error->all(FLERR,"Illegal compute fragment/atom command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal compute fragment/atom command"); } else error->all(FLERR,"Illegal compute fragment/atom command");
} }

View File

@ -19,21 +19,22 @@
#include "compute_group_group.h" #include "compute_group_group.h"
#include <cstring>
#include <cmath>
#include "atom.h" #include "atom.h"
#include "update.h"
#include "force.h"
#include "pair.h"
#include "neighbor.h"
#include "neigh_request.h"
#include "neigh_list.h"
#include "group.h"
#include "kspace.h"
#include "error.h"
#include "comm.h" #include "comm.h"
#include "domain.h" #include "domain.h"
#include "error.h"
#include "force.h"
#include "group.h"
#include "kspace.h"
#include "math_const.h" #include "math_const.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "pair.h"
#include "update.h"
#include <cstring>
#include <cmath>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;
@ -69,29 +70,19 @@ ComputeGroupGroup::ComputeGroupGroup(LAMMPS *lmp, int narg, char **arg) :
int iarg = 4; int iarg = 4;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"pair") == 0) { if (strcmp(arg[iarg],"pair") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute group/group command");
error->all(FLERR,"Illegal compute group/group command"); pairflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
if (strcmp(arg[iarg+1],"yes") == 0) pairflag = 1;
else if (strcmp(arg[iarg+1],"no") == 0) pairflag = 0;
else error->all(FLERR,"Illegal compute group/group command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"kspace") == 0) { } else if (strcmp(arg[iarg],"kspace") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute group/group command");
error->all(FLERR,"Illegal compute group/group command"); kspaceflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
if (strcmp(arg[iarg+1],"yes") == 0) kspaceflag = 1;
else if (strcmp(arg[iarg+1],"no") == 0) kspaceflag = 0;
else error->all(FLERR,"Illegal compute group/group command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"boundary") == 0) { } else if (strcmp(arg[iarg],"boundary") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute group/group command");
error->all(FLERR,"Illegal compute group/group command"); boundaryflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
if (strcmp(arg[iarg+1],"yes") == 0) boundaryflag = 1;
else if (strcmp(arg[iarg+1],"no") == 0) boundaryflag = 0;
else error->all(FLERR,"Illegal compute group/group command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"molecule") == 0) { } else if (strcmp(arg[iarg],"molecule") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute group/group command");
error->all(FLERR,"Illegal compute group/group command");
if (strcmp(arg[iarg+1],"off") == 0) molflag = OFF; if (strcmp(arg[iarg+1],"off") == 0) molflag = OFF;
else if (strcmp(arg[iarg+1],"inter") == 0) molflag = INTER; else if (strcmp(arg[iarg+1],"inter") == 0) molflag = INTER;
else if (strcmp(arg[iarg+1],"intra") == 0) molflag = INTRA; else if (strcmp(arg[iarg+1],"intra") == 0) molflag = INTRA;

View File

@ -49,15 +49,11 @@ ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg) :
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) error->all(FLERR,"Illegal compute msd command");
if (strcmp(arg[iarg+1],"no") == 0) comflag = 0; comflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) comflag = 1;
else error->all(FLERR,"Illegal compute msd command");
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) error->all(FLERR,"Illegal compute msd command");
if (strcmp(arg[iarg+1],"no") == 0) avflag = 0; avflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) avflag = 1;
else error->all(FLERR,"Illegal compute msd command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal compute msd command"); } else error->all(FLERR,"Illegal compute msd command");
} }

View File

@ -83,53 +83,41 @@ ComputeOrientOrderAtom::ComputeOrientOrderAtom(LAMMPS *lmp, int narg, char **arg
int iarg = 3; int iarg = 3;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"nnn") == 0) { if (strcmp(arg[iarg],"nnn") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command");
error->all(FLERR,"Illegal compute orientorder/atom command");
if (strcmp(arg[iarg+1],"NULL") == 0) { if (strcmp(arg[iarg+1],"NULL") == 0) {
nnn = 0; nnn = 0;
} else { } else {
nnn = utils::numeric(FLERR,arg[iarg+1],false,lmp); nnn = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (nnn <= 0) if (nnn <= 0) error->all(FLERR,"Illegal compute orientorder/atom command");
error->all(FLERR,"Illegal compute orientorder/atom command");
} }
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"degrees") == 0) { } else if (strcmp(arg[iarg],"degrees") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command");
error->all(FLERR,"Illegal compute orientorder/atom command");
nqlist = utils::numeric(FLERR,arg[iarg+1],false,lmp); nqlist = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (nqlist <= 0) if (nqlist <= 0) error->all(FLERR,"Illegal compute orientorder/atom command");
error->all(FLERR,"Illegal compute orientorder/atom command");
memory->destroy(qlist); memory->destroy(qlist);
memory->create(qlist,nqlist,"orientorder/atom:qlist"); memory->create(qlist,nqlist,"orientorder/atom:qlist");
iarg += 2; iarg += 2;
if (iarg+nqlist > narg) if (iarg+nqlist > narg) error->all(FLERR,"Illegal compute orientorder/atom command");
error->all(FLERR,"Illegal compute orientorder/atom command");
qmax = 0; qmax = 0;
for (int il = 0; il < nqlist; il++) { for (int il = 0; il < nqlist; il++) {
qlist[il] = utils::numeric(FLERR,arg[iarg+il],false,lmp); qlist[il] = utils::numeric(FLERR,arg[iarg+il],false,lmp);
if (qlist[il] < 0) if (qlist[il] < 0) error->all(FLERR,"Illegal compute orientorder/atom command");
error->all(FLERR,"Illegal compute orientorder/atom command");
if (qlist[il] > qmax) qmax = qlist[il]; if (qlist[il] > qmax) qmax = qlist[il];
} }
iarg += nqlist; iarg += nqlist;
} else if (strcmp(arg[iarg],"wl") == 0) { } else if (strcmp(arg[iarg],"wl") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg)
error->all(FLERR,"Illegal compute orientorder/atom command"); error->all(FLERR,"Illegal compute orientorder/atom command");
if (strcmp(arg[iarg+1],"yes") == 0) wlflag = 1; wlflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) wlflag = 0;
else error->all(FLERR,"Illegal compute orientorder/atom command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"wl/hat") == 0) { } else if (strcmp(arg[iarg],"wl/hat") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command");
error->all(FLERR,"Illegal compute orientorder/atom command"); wlhatflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
if (strcmp(arg[iarg+1],"yes") == 0) wlhatflag = 1;
else if (strcmp(arg[iarg+1],"no") == 0) wlhatflag = 0;
else error->all(FLERR,"Illegal compute orientorder/atom command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"components") == 0) { } else if (strcmp(arg[iarg],"components") == 0) {
qlcompflag = 1; qlcompflag = 1;
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command");
error->all(FLERR,"Illegal compute orientorder/atom command");
qlcomp = utils::numeric(FLERR,arg[iarg+1],false,lmp); qlcomp = utils::numeric(FLERR,arg[iarg+1],false,lmp);
iqlcomp = -1; iqlcomp = -1;
for (int il = 0; il < nqlist; il++) for (int il = 0; il < nqlist; il++)
@ -137,23 +125,18 @@ ComputeOrientOrderAtom::ComputeOrientOrderAtom(LAMMPS *lmp, int narg, char **arg
iqlcomp = il; iqlcomp = il;
break; break;
} }
if (iqlcomp == -1) if (iqlcomp == -1) error->all(FLERR,"Illegal compute orientorder/atom command");
error->all(FLERR,"Illegal compute orientorder/atom command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"cutoff") == 0) { } else if (strcmp(arg[iarg],"cutoff") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command");
error->all(FLERR,"Illegal compute orientorder/atom command");
double cutoff = utils::numeric(FLERR,arg[iarg+1],false,lmp); double cutoff = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (cutoff <= 0.0) if (cutoff <= 0.0) error->all(FLERR,"Illegal compute orientorder/atom command");
error->all(FLERR,"Illegal compute orientorder/atom command");
cutsq = cutoff*cutoff; cutsq = cutoff*cutoff;
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"chunksize") == 0) { } else if (strcmp(arg[iarg],"chunksize") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command");
error->all(FLERR,"Illegal compute orientorder/atom command");
chunksize = utils::numeric(FLERR,arg[iarg+1],false,lmp); chunksize = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (chunksize <= 0) if (chunksize <= 0) error->all(FLERR,"Illegal compute orientorder/atom command");
error->all(FLERR,"Illegal compute orientorder/atom command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal compute orientorder/atom command"); } else error->all(FLERR,"Illegal compute orientorder/atom command");
} }

View File

@ -14,15 +14,16 @@
#include "compute_temp_chunk.h" #include "compute_temp_chunk.h"
#include <cstring>
#include "atom.h" #include "atom.h"
#include "update.h"
#include "force.h"
#include "modify.h"
#include "compute_chunk_atom.h" #include "compute_chunk_atom.h"
#include "domain.h" #include "domain.h"
#include "memory.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "memory.h"
#include "modify.h"
#include "update.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -76,26 +77,20 @@ ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) :
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"com") == 0) { if (strcmp(arg[iarg],"com") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/chunk command");
error->all(FLERR,"Illegal compute temp/chunk command"); comflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
if (strcmp(arg[iarg+1],"yes") == 0) comflag = 1;
else if (strcmp(arg[iarg+1],"no") == 0) comflag = 0;
else error->all(FLERR,"Illegal compute temp/chunk command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"bias") == 0) { } else if (strcmp(arg[iarg],"bias") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/chunk command");
error->all(FLERR,"Illegal compute temp/chunk command");
biasflag = 1; biasflag = 1;
id_bias = utils::strdup(arg[iarg+1]); id_bias = utils::strdup(arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"adof") == 0) { } else if (strcmp(arg[iarg],"adof") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/chunk command");
error->all(FLERR,"Illegal compute temp/chunk command");
adof = utils::numeric(FLERR,arg[iarg+1],false,lmp); adof = utils::numeric(FLERR,arg[iarg+1],false,lmp);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"cdof") == 0) { } else if (strcmp(arg[iarg],"cdof") == 0) {
if (iarg+2 > narg) if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/chunk command");
error->all(FLERR,"Illegal compute temp/chunk command");
cdof = utils::numeric(FLERR,arg[iarg+1],false,lmp); cdof = utils::numeric(FLERR,arg[iarg+1],false,lmp);
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal compute temp/chunk command"); } else error->all(FLERR,"Illegal compute temp/chunk command");

View File

@ -151,9 +151,7 @@ void CreateAtoms::command(int narg, char **arg)
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"remap") == 0) { } else if (strcmp(arg[iarg],"remap") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal create_atoms command"); if (iarg+2 > narg) error->all(FLERR,"Illegal create_atoms command");
if (strcmp(arg[iarg+1],"yes") == 0) remapflag = 1; remapflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) remapflag = 0;
else error->all(FLERR,"Illegal create_atoms command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"mol") == 0) { } else if (strcmp(arg[iarg],"mol") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal create_atoms command"); if (iarg+3 > narg) error->all(FLERR,"Illegal create_atoms command");

View File

@ -125,9 +125,7 @@ void CreateBonds::command(int narg, char **arg)
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"special") == 0) { if (strcmp(arg[iarg],"special") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal create_bonds command"); if (iarg+2 > narg) error->all(FLERR,"Illegal create_bonds command");
if (strcmp(arg[iarg+1],"yes") == 0) specialflag = 1; specialflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) specialflag = 0;
else error->all(FLERR,"Illegal create_bonds command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal create_bonds command"); } else error->all(FLERR,"Illegal create_bonds command");
} }

View File

@ -738,30 +738,21 @@ void DeleteAtoms::options(int narg, char **arg)
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"compress") == 0) { if (strcmp(arg[iarg],"compress") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal delete_atoms command"); if (iarg+2 > narg) error->all(FLERR,"Illegal delete_atoms command");
if (strcmp(arg[iarg+1],"yes") == 0) compress_flag = 1; compress_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) compress_flag = 0;
else error->all(FLERR,"Illegal delete_atoms command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"bond") == 0) { } else if (strcmp(arg[iarg],"bond") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal delete_atoms command"); if (iarg+2 > narg) error->all(FLERR,"Illegal delete_atoms command");
if (atom->molecular == Atom::ATOMIC) if (atom->molecular == Atom::ATOMIC)
error->all(FLERR,"Cannot delete_atoms bond yes for " error->all(FLERR,"Cannot delete_atoms bond yes for non-molecular systems");
"non-molecular systems");
if (atom->molecular == Atom::TEMPLATE) if (atom->molecular == Atom::TEMPLATE)
error->all(FLERR,"Cannot use delete_atoms bond yes with " error->all(FLERR,"Cannot use delete_atoms bond yes with atom_style template");
"atom_style template"); bond_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
if (strcmp(arg[iarg+1],"yes") == 0) bond_flag = 1;
else if (strcmp(arg[iarg+1],"no") == 0) bond_flag = 0;
else error->all(FLERR,"Illegal delete_atoms command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"mol") == 0) { } else if (strcmp(arg[iarg],"mol") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal delete_atoms command"); if (iarg+2 > narg) error->all(FLERR,"Illegal delete_atoms command");
if (atom->molecule_flag == 0) if (atom->molecule_flag == 0)
error->all(FLERR,"Delete_atoms mol yes requires " error->all(FLERR,"Delete_atoms mol yes requires atom attribute molecule");
"atom attribute molecule"); mol_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
if (strcmp(arg[iarg+1],"yes") == 0) mol_flag = 1;
else if (strcmp(arg[iarg+1],"no") == 0) mol_flag = 0;
else error->all(FLERR,"Illegal delete_atoms command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal delete_atoms command"); } else error->all(FLERR,"Illegal delete_atoms command");
} }

View File

@ -912,16 +912,12 @@ void Dump::modify_params(int narg, char **arg)
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"append") == 0) { if (strcmp(arg[iarg],"append") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) append_flag = 1; append_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) append_flag = 0;
else error->all(FLERR,"Illegal dump_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"buffer") == 0) { } else if (strcmp(arg[iarg],"buffer") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) buffer_flag = 1; buffer_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) buffer_flag = 0;
else error->all(FLERR,"Illegal dump_modify command");
if (buffer_flag && buffer_allow == 0) if (buffer_flag && buffer_allow == 0)
error->all(FLERR,"Dump_modify buffer yes not allowed for this style"); error->all(FLERR,"Dump_modify buffer yes not allowed for this style");
iarg += 2; iarg += 2;
@ -935,9 +931,7 @@ void Dump::modify_params(int narg, char **arg)
} else if (strcmp(arg[iarg],"header") == 0) { } else if (strcmp(arg[iarg],"header") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) write_header_flag = 1; header_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) write_header_flag = 0;
else error->all(FLERR,"Illegal dump_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"every") == 0) { } else if (strcmp(arg[iarg],"every") == 0) {
@ -960,8 +954,7 @@ void Dump::modify_params(int narg, char **arg)
} else if (strcmp(arg[iarg],"fileper") == 0) { } else if (strcmp(arg[iarg],"fileper") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
if (!multiproc) if (!multiproc)
error->all(FLERR,"Cannot use dump_modify fileper " error->all(FLERR,"Cannot use dump_modify fileper without % in dump file name");
"without % in dump file name");
int nper = utils::inumeric(FLERR,arg[iarg+1],false,lmp); int nper = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (nper <= 0) error->all(FLERR,"Illegal dump_modify command"); if (nper <= 0) error->all(FLERR,"Illegal dump_modify command");
@ -986,16 +979,12 @@ void Dump::modify_params(int narg, char **arg)
} else if (strcmp(arg[iarg],"first") == 0) { } else if (strcmp(arg[iarg],"first") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) first_flag = 1; first_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) first_flag = 0;
else error->all(FLERR,"Illegal dump_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"flush") == 0) { } else if (strcmp(arg[iarg],"flush") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) flush_flag = 1; flush_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) flush_flag = 0;
else error->all(FLERR,"Illegal dump_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"format") == 0) { } else if (strcmp(arg[iarg],"format") == 0) {
@ -1032,8 +1021,7 @@ void Dump::modify_params(int narg, char **arg)
} else if (strcmp(arg[iarg],"maxfiles") == 0) { } else if (strcmp(arg[iarg],"maxfiles") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
if (!multifile) if (!multifile)
error->all(FLERR,"Cannot use dump_modify maxfiles " error->all(FLERR,"Cannot use dump_modify maxfiles without * in dump file name");
"without * in dump file name");
// wipe out existing storage // wipe out existing storage
if (maxfiles > 0) { if (maxfiles > 0) {
for (int idx=0; idx < numfiles; ++idx) for (int idx=0; idx < numfiles; ++idx)
@ -1053,8 +1041,7 @@ void Dump::modify_params(int narg, char **arg)
} else if (strcmp(arg[iarg],"nfile") == 0) { } else if (strcmp(arg[iarg],"nfile") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
if (!multiproc) if (!multiproc)
error->all(FLERR,"Cannot use dump_modify nfile " error->all(FLERR,"Cannot use dump_modify nfile without % in dump file name");
"without % in dump file name");
int nfile = utils::inumeric(FLERR,arg[iarg+1],false,lmp); int nfile = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (nfile <= 0) error->all(FLERR,"Illegal dump_modify command"); if (nfile <= 0) error->all(FLERR,"Illegal dump_modify command");
nfile = MIN(nfile,nprocs); nfile = MIN(nfile,nprocs);
@ -1090,9 +1077,7 @@ void Dump::modify_params(int narg, char **arg)
} else if (strcmp(arg[iarg],"pbc") == 0) { } else if (strcmp(arg[iarg],"pbc") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) pbcflag = 1; pbcflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) pbcflag = 0;
else error->all(FLERR,"Illegal dump_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"sort") == 0) { } else if (strcmp(arg[iarg],"sort") == 0) {
@ -1117,16 +1102,12 @@ void Dump::modify_params(int narg, char **arg)
} else if (strcmp(arg[iarg],"time") == 0) { } else if (strcmp(arg[iarg],"time") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) time_flag = 1; time_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) time_flag = 0;
else error->all(FLERR,"Illegal dump_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"units") == 0) { } else if (strcmp(arg[iarg],"units") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) unit_flag = 1; unit_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) unit_flag = 0;
else error->all(FLERR,"Illegal dump_modify command");
iarg += 2; iarg += 2;
} else { } else {

View File

@ -13,13 +13,15 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "dump_atom.h" #include "dump_atom.h"
#include <cstring>
#include "domain.h"
#include "atom.h" #include "atom.h"
#include "memory.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "memory.h"
#include "update.h" #include "update.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define ONELINE 256 #define ONELINE 256
@ -114,15 +116,11 @@ int DumpAtom::modify_param(int narg, char **arg)
{ {
if (strcmp(arg[0],"scale") == 0) { if (strcmp(arg[0],"scale") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
if (strcmp(arg[1],"yes") == 0) scale_flag = 1; scale_flag = utils::logical(FLERR,arg[1],false,lmp);
else if (strcmp(arg[1],"no") == 0) scale_flag = 0;
else error->all(FLERR,"Illegal dump_modify command");
return 2; return 2;
} else if (strcmp(arg[0],"image") == 0) { } else if (strcmp(arg[0],"image") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
if (strcmp(arg[1],"yes") == 0) image_flag = 1; image_flag = utils::logical(FLERR,arg[1],false,lmp);
else if (strcmp(arg[1],"no") == 0) image_flag = 0;
else error->all(FLERR,"Illegal dump_modify command");
return 2; return 2;
} }
return 0; return 0;

View File

@ -47,7 +47,7 @@ using namespace MathConst;
enum{NUMERIC,ATOM,TYPE,ELEMENT,ATTRIBUTE}; enum{NUMERIC,ATOM,TYPE,ELEMENT,ATTRIBUTE};
enum{SPHERE,LINE,TRI}; // also in some Body and Fix child classes enum{SPHERE,LINE,TRI}; // also in some Body and Fix child classes
enum{STATIC,DYNAMIC}; enum{STATIC,DYNAMIC};
enum{NO,YES}; enum{NO=0,YES=1};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -146,9 +146,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"atom") == 0) { if (strcmp(arg[iarg],"atom") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump image command"); if (iarg+2 > narg) error->all(FLERR,"Illegal dump image command");
if (strcmp(arg[iarg+1],"yes") == 0) atomflag = YES; atomflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) atomflag = NO;
else error->all(FLERR,"Illegal dump image command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"adiam") == 0) { } else if (strcmp(arg[iarg],"adiam") == 0) {
@ -290,18 +288,14 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[iarg],"box") == 0) { } else if (strcmp(arg[iarg],"box") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command"); if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
if (strcmp(arg[iarg+1],"yes") == 0) boxflag = YES; boxflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) boxflag = NO;
else error->all(FLERR,"Illegal dump image command");
boxdiam = utils::numeric(FLERR,arg[iarg+2],false,lmp); boxdiam = utils::numeric(FLERR,arg[iarg+2],false,lmp);
if (boxdiam < 0.0) error->all(FLERR,"Illegal dump image command"); if (boxdiam < 0.0) error->all(FLERR,"Illegal dump image command");
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"axes") == 0) { } else if (strcmp(arg[iarg],"axes") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command"); if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
if (strcmp(arg[iarg+1],"yes") == 0) axesflag = YES; axesflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) axesflag = NO;
else error->all(FLERR,"Illegal dump image command");
axeslen = utils::numeric(FLERR,arg[iarg+2],false,lmp); axeslen = utils::numeric(FLERR,arg[iarg+2],false,lmp);
axesdiam = utils::numeric(FLERR,arg[iarg+3],false,lmp); axesdiam = utils::numeric(FLERR,arg[iarg+3],false,lmp);
if (axeslen < 0.0 || axesdiam < 0.0) if (axeslen < 0.0 || axesdiam < 0.0)
@ -310,9 +304,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[iarg],"subbox") == 0) { } else if (strcmp(arg[iarg],"subbox") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command"); if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
if (strcmp(arg[iarg+1],"yes") == 0) subboxflag = YES; subboxflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) subboxflag = NO;
else error->all(FLERR,"Illegal dump image command");
subboxdiam = utils::numeric(FLERR,arg[iarg+2],false,lmp); subboxdiam = utils::numeric(FLERR,arg[iarg+2],false,lmp);
if (subboxdiam < 0.0) error->all(FLERR,"Illegal dump image command"); if (subboxdiam < 0.0) error->all(FLERR,"Illegal dump image command");
iarg += 3; iarg += 3;
@ -327,9 +319,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[iarg],"ssao") == 0) { } else if (strcmp(arg[iarg],"ssao") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal dump image command"); if (iarg+4 > narg) error->all(FLERR,"Illegal dump image command");
if (strcmp(arg[iarg+1],"yes") == 0) image->ssao = YES; image->ssao = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) image->ssao = NO;
else error->all(FLERR,"Illegal dump image command");
int seed = utils::inumeric(FLERR,arg[iarg+2],false,lmp); int seed = utils::inumeric(FLERR,arg[iarg+2],false,lmp);
if (seed <= 0) error->all(FLERR,"Illegal dump image command"); if (seed <= 0) error->all(FLERR,"Illegal dump image command");
image->seed = seed; image->seed = seed;

View File

@ -137,27 +137,19 @@ void Fix::modify_params(int narg, char **arg)
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"dynamic/dof") == 0) { if (strcmp(arg[iarg],"dynamic/dof") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command");
if (strcmp(arg[iarg+1],"no") == 0) dynamic = 0; dynamic = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) dynamic = 1;
else error->all(FLERR,"Illegal fix_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"energy") == 0) { } else if (strcmp(arg[iarg],"energy") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command");
if (strcmp(arg[iarg+1],"no") == 0) thermo_energy = 0; thermo_energy = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) { if (thermo_energy && !energy_global_flag && !energy_peratom_flag)
if (energy_global_flag == 0 && energy_peratom_flag == 0)
error->all(FLERR,"Illegal fix_modify command"); error->all(FLERR,"Illegal fix_modify command");
thermo_energy = 1;
} else error->all(FLERR,"Illegal fix_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"virial") == 0) { } else if (strcmp(arg[iarg],"virial") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command");
if (strcmp(arg[iarg+1],"no") == 0) thermo_virial = 0; thermo_virial = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) { if (thermo_virial && !virial_global_flag && !virial_peratom_flag)
if (virial_global_flag == 0 && virial_peratom_flag == 0)
error->all(FLERR,"Illegal fix_modify command"); error->all(FLERR,"Illegal fix_modify command");
thermo_virial = 1;
} else error->all(FLERR,"Illegal fix_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"respa") == 0) { } else if (strcmp(arg[iarg],"respa") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command");

View File

@ -158,21 +158,15 @@ nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr)
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"reset") == 0) { if (strcmp(arg[iarg],"reset") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix adapt command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix adapt command");
if (strcmp(arg[iarg+1],"no") == 0) resetflag = 0; resetflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) resetflag = 1;
else error->all(FLERR,"Illegal fix adapt command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"scale") == 0) { } else if (strcmp(arg[iarg],"scale") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix adapt command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix adapt command");
if (strcmp(arg[iarg+1],"no") == 0) scaleflag = 0; scaleflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) scaleflag = 1;
else error->all(FLERR,"Illegal fix adapt command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"mass") == 0) { } else if (strcmp(arg[iarg],"mass") == 0) {
if (iarg+2 > narg)error->all(FLERR,"Illegal fix adapt command"); if (iarg+2 > narg)error->all(FLERR,"Illegal fix adapt command");
if (strcmp(arg[iarg+1],"no") == 0) massflag = 0; massflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) massflag = 1;
else error->all(FLERR,"Illegal fix adapt command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal fix adapt command"); } else error->all(FLERR,"Illegal fix adapt command");
} }

View File

@ -196,21 +196,15 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) :
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 box/relax command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
if (strcmp(arg[iarg+1],"yes") == 0) scalexy = 1; scalexy = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) scalexy = 0;
else error->all(FLERR,"Illegal fix box/relax command");
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 box/relax command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
if (strcmp(arg[iarg+1],"yes") == 0) scalexz = 1; scalexz = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) scalexz = 0;
else error->all(FLERR,"Illegal fix box/relax command");
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 box/relax command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
if (strcmp(arg[iarg+1],"yes") == 0) scaleyz = 1; scaleyz = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) scaleyz = 0;
else error->all(FLERR,"Illegal fix box/relax command");
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 box/relax command"); if (iarg+4 > narg) error->all(FLERR,"Illegal fix box/relax command");

View File

@ -1008,9 +1008,7 @@ void FixDeform::options(int narg, char **arg)
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 deform command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix deform command");
if (strcmp(arg[iarg+1],"yes") == 0) flipflag = 1; flipflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) flipflag = 0;
else error->all(FLERR,"Illegal fix deform command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal fix deform command"); } else error->all(FLERR,"Illegal fix deform command");
} }

View File

@ -14,19 +14,20 @@
#include "fix_evaporate.h" #include "fix_evaporate.h"
#include <cstring>
#include "atom.h" #include "atom.h"
#include "atom_vec.h" #include "atom_vec.h"
#include "molecule.h"
#include "update.h"
#include "domain.h"
#include "region.h"
#include "comm.h" #include "comm.h"
#include "domain.h"
#include "error.h"
#include "force.h" #include "force.h"
#include "group.h" #include "group.h"
#include "random_park.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "molecule.h"
#include "random_park.h"
#include "region.h"
#include "update.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
@ -69,9 +70,7 @@ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) :
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"molecule") == 0) { if (strcmp(arg[iarg],"molecule") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix evaporate command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix evaporate command");
if (strcmp(arg[iarg+1],"no") == 0) molflag = 0; molflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) molflag = 1;
else error->all(FLERR,"Illegal fix evaporate command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal fix evaporate command"); } else error->all(FLERR,"Illegal fix evaporate command");
} }

View File

@ -34,7 +34,7 @@ using namespace FixConst;
enum{BONDMAX,TLIMIT,DISKFREE,VARIABLE}; enum{BONDMAX,TLIMIT,DISKFREE,VARIABLE};
enum{LT,LE,GT,GE,EQ,NEQ,XOR}; enum{LT,LE,GT,GE,EQ,NEQ,XOR};
enum{HARD,SOFT,CONTINUE}; enum{HARD,SOFT,CONTINUE};
enum{NOMSG,YESMSG}; enum{NOMSG=0,YESMSG=1};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -102,9 +102,7 @@ FixHalt::FixHalt(LAMMPS *lmp, int narg, char **arg) :
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"message") == 0) { } else if (strcmp(arg[iarg],"message") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix halt command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix halt command");
if (strcmp(arg[iarg+1],"no") == 0) msgflag = NOMSG; msgflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) msgflag = YESMSG;
else error->all(FLERR,"Illegal fix halt command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"path") == 0) { } else if (strcmp(arg[iarg],"path") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix halt command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix halt command");

View File

@ -128,9 +128,7 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) :
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"omega") == 0) { } else if (strcmp(arg[iarg],"omega") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command");
if (strcmp(arg[iarg+1],"no") == 0) oflag = 0; oflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) oflag = 1;
else error->all(FLERR,"Illegal fix langevin command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"scale") == 0) { } else if (strcmp(arg[iarg],"scale") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal fix langevin command"); if (iarg+3 > narg) error->all(FLERR,"Illegal fix langevin command");
@ -142,15 +140,11 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) :
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"tally") == 0) { } else if (strcmp(arg[iarg],"tally") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command");
if (strcmp(arg[iarg+1],"no") == 0) tallyflag = 0; tallyflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) tallyflag = 1;
else error->all(FLERR,"Illegal fix langevin command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"zero") == 0) { } else if (strcmp(arg[iarg],"zero") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command");
if (strcmp(arg[iarg+1],"no") == 0) zeroflag = 0; zeroflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) zeroflag = 1;
else error->all(FLERR,"Illegal fix langevin command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal fix langevin command"); } else error->all(FLERR,"Illegal fix langevin command");
} }

View File

@ -17,23 +17,25 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "fix_nh.h" #include "fix_nh.h"
#include <cstring>
#include <cmath>
#include "atom.h" #include "atom.h"
#include "comm.h"
#include "compute.h"
#include "domain.h"
#include "error.h"
#include "fix_deform.h"
#include "force.h" #include "force.h"
#include "group.h" #include "group.h"
#include "comm.h"
#include "neighbor.h"
#include "irregular.h" #include "irregular.h"
#include "modify.h"
#include "fix_deform.h"
#include "compute.h"
#include "kspace.h" #include "kspace.h"
#include "update.h"
#include "respa.h"
#include "domain.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "modify.h"
#include "neighbor.h"
#include "respa.h"
#include "update.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
@ -297,9 +299,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
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) error->all(FLERR,"Illegal fix nvt/npt/nph command");
if (strcmp(arg[iarg+1],"yes") == 0) mtk_flag = 1; mtk_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) mtk_flag = 0;
else error->all(FLERR,"Illegal fix nvt/npt/nph command");
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) error->all(FLERR,"Illegal fix nvt/npt/nph command");
@ -318,27 +318,19 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
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) error->all(FLERR,"Illegal fix nvt/npt/nph command");
if (strcmp(arg[iarg+1],"yes") == 0) scalexy = 1; scalexy = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) scalexy = 0;
else error->all(FLERR,"Illegal fix nvt/npt/nph command");
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) error->all(FLERR,"Illegal fix nvt/npt/nph command");
if (strcmp(arg[iarg+1],"yes") == 0) scalexz = 1; scalexz = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) scalexz = 0;
else error->all(FLERR,"Illegal fix nvt/npt/nph command");
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) error->all(FLERR,"Illegal fix nvt/npt/nph command");
if (strcmp(arg[iarg+1],"yes") == 0) scaleyz = 1; scaleyz = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) scaleyz = 0;
else error->all(FLERR,"Illegal fix nvt/npt/nph command");
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) error->all(FLERR,"Illegal fix nvt/npt/nph command");
if (strcmp(arg[iarg+1],"yes") == 0) flipflag = 1; flipflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) flipflag = 0;
else error->all(FLERR,"Illegal fix nvt/npt/nph command");
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) error->all(FLERR,"Illegal fix nvt/npt/nph command");

View File

@ -69,9 +69,7 @@ FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) :
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"screen") == 0) { } else if (strcmp(arg[iarg],"screen") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix print command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix print command");
if (strcmp(arg[iarg+1],"yes") == 0) screenflag = 1; screenflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) screenflag = 0;
else error->all(FLERR,"Illegal fix print command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"title") == 0) { } else if (strcmp(arg[iarg],"title") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix print command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix print command");

View File

@ -151,9 +151,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"ghost") == 0) { if (strcmp(arg[iarg],"ghost") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix property/atom command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix property/atom command");
if (strcmp(arg[iarg+1],"no") == 0) border = 0; border = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) border = 1;
else error->all(FLERR,"Illegal fix property/atom command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal fix property/atom command"); } else error->all(FLERR,"Illegal fix property/atom command");
} }

View File

@ -231,9 +231,7 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) :
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 fix store/state command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix store/state command");
if (strcmp(arg[iarg+1],"no") == 0) comflag = 0; comflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) comflag = 1;
else error->all(FLERR,"Illegal fix store/state command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal fix store/state command"); } else error->all(FLERR,"Illegal fix store/state command");
} }
@ -246,16 +244,13 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) :
if (icompute < 0) if (icompute < 0)
error->all(FLERR,"Compute ID for fix store/state does not exist"); error->all(FLERR,"Compute ID for fix store/state does not exist");
if (modify->compute[icompute]->peratom_flag == 0) if (modify->compute[icompute]->peratom_flag == 0)
error->all(FLERR,"Fix store/state compute " error->all(FLERR,"Fix store/state compute does not calculate per-atom values");
"does not calculate per-atom values");
if (argindex[i] == 0 && if (argindex[i] == 0 &&
modify->compute[icompute]->size_peratom_cols != 0) modify->compute[icompute]->size_peratom_cols != 0)
error->all(FLERR,"Fix store/state compute does not " error->all(FLERR,"Fix store/state compute does not calculate a per-atom vector");
"calculate a per-atom vector");
if (argindex[i] && modify->compute[icompute]->size_peratom_cols == 0) if (argindex[i] && modify->compute[icompute]->size_peratom_cols == 0)
error->all(FLERR, error->all(FLERR,
"Fix store/state compute does not " "Fix store/state compute does not calculate a per-atom array");
"calculate a per-atom array");
if (argindex[i] && if (argindex[i] &&
argindex[i] > modify->compute[icompute]->size_peratom_cols) argindex[i] > modify->compute[icompute]->size_peratom_cols)
error->all(FLERR, error->all(FLERR,

View File

@ -128,15 +128,11 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) :
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"fld") == 0) { } else if (strcmp(arg[iarg],"fld") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix wall command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix wall command");
if (strcmp(arg[iarg+1],"no") == 0) fldflag = 0; fldflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) fldflag = 1;
else error->all(FLERR,"Illegal fix wall command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"pbc") == 0) { } else if (strcmp(arg[iarg],"pbc") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix wall command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix wall command");
if (strcmp(arg[iarg+1],"yes") == 0) pbcflag = 1; pbcflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) pbcflag = 0;
else error->all(FLERR,"Illegal fix wall command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal fix wall command"); } else error->all(FLERR,"Illegal fix wall command");
} }

View File

@ -811,15 +811,11 @@ void Force::set_special(int narg, char **arg)
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"angle") == 0) { } else if (strcmp(arg[iarg],"angle") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal special_bonds command"); if (iarg+2 > narg) error->all(FLERR,"Illegal special_bonds command");
if (strcmp(arg[iarg+1],"no") == 0) special_angle = 0; special_angle = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) special_angle = 1;
else error->all(FLERR,"Illegal special_bonds command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"dihedral") == 0) { } else if (strcmp(arg[iarg],"dihedral") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal special_bonds command"); if (iarg+2 > narg) error->all(FLERR,"Illegal special_bonds command");
if (strcmp(arg[iarg+1],"no") == 0) special_dihedral = 0; special_dihedral = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"yes") == 0) special_dihedral = 1;
else error->all(FLERR,"Illegal special_bonds command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal special_bonds command"); } else error->all(FLERR,"Illegal special_bonds command");
} }

View File

@ -1068,19 +1068,14 @@ void Input::partition()
{ {
if (narg < 3) error->all(FLERR,"Illegal partition command"); if (narg < 3) error->all(FLERR,"Illegal partition command");
int yesflag = 0;
if (strcmp(arg[0],"yes") == 0) yesflag = 1;
else if (strcmp(arg[0],"no") == 0) yesflag = 0;
else error->all(FLERR,"Illegal partition command");
int ilo,ihi; int ilo,ihi;
int yesflag = utils::logical(FLERR,arg[0],false,lmp);
utils::bounds(FLERR,arg[1],1,universe->nworlds,ilo,ihi,error); utils::bounds(FLERR,arg[1],1,universe->nworlds,ilo,ihi,error);
// new command starts at the 3rd argument, // new command starts at the 3rd argument,
// which must not be another partition command // which must not be another partition command
if (strcmp(arg[2],"partition") == 0) if (strcmp(arg[2],"partition") == 0) error->all(FLERR,"Illegal partition command");
error->all(FLERR,"Illegal partition command");
char *cmd = strstr(line,arg[2]); char *cmd = strstr(line,arg[2]);
@ -1123,21 +1118,16 @@ void Input::print()
if (strcmp(arg[iarg],"file") == 0) fp = fopen(arg[iarg+1],"w"); if (strcmp(arg[iarg],"file") == 0) fp = fopen(arg[iarg+1],"w");
else fp = fopen(arg[iarg+1],"a"); else fp = fopen(arg[iarg+1],"a");
if (fp == nullptr) if (fp == nullptr)
error->one(FLERR,"Cannot open print file {}: {}", error->one(FLERR,"Cannot open print file {}: {}", arg[iarg+1], utils::getsyserror());
arg[iarg+1], utils::getsyserror());
} }
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"screen") == 0) { } else if (strcmp(arg[iarg],"screen") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal print command"); if (iarg+2 > narg) error->all(FLERR,"Illegal print command");
if (strcmp(arg[iarg+1],"yes") == 0) screenflag = 1; screenflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) screenflag = 0;
else error->all(FLERR,"Illegal print command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"universe") == 0) { } else if (strcmp(arg[iarg],"universe") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal print command"); if (iarg+2 > narg) error->all(FLERR,"Illegal print command");
if (strcmp(arg[iarg+1],"yes") == 0) universeflag = 1; universeflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) universeflag = 0;
else error->all(FLERR,"Illegal print command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal print command"); } else error->all(FLERR,"Illegal print command");
} }

View File

@ -480,8 +480,7 @@ void KSpace::modify_params(int narg, char **arg)
if (nx_pppm_6 == 0 && ny_pppm_6 == 0 && nz_pppm_6 == 0) if (nx_pppm_6 == 0 && ny_pppm_6 == 0 && nz_pppm_6 == 0)
gridflag_6 = 0; gridflag_6 = 0;
else if (nx_pppm_6 <= 0 || ny_pppm_6 <= 0 || nz_pppm_6 == 0) else if (nx_pppm_6 <= 0 || ny_pppm_6 <= 0 || nz_pppm_6 == 0)
error->all(FLERR,"Kspace_modify mesh/disp parameters must be all " error->all(FLERR,"Kspace_modify mesh/disp parameters must be all zero or all positive");
"zero or all positive");
else gridflag_6 = 1; else gridflag_6 = 1;
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"order") == 0) { } else if (strcmp(arg[iarg],"order") == 0) {
@ -499,9 +498,7 @@ void KSpace::modify_params(int narg, char **arg)
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"overlap") == 0) { } else if (strcmp(arg[iarg],"overlap") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) overlap_allowed = 1; overlap_allowed = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) overlap_allowed = 0;
else error->all(FLERR,"Illegal kspace_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"force") == 0) { } else if (strcmp(arg[iarg],"force") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
@ -535,21 +532,15 @@ void KSpace::modify_params(int narg, char **arg)
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"compute") == 0) { } else if (strcmp(arg[iarg],"compute") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) compute_flag = 1; compute_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) compute_flag = 0;
else error->all(FLERR,"Illegal kspace_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"fftbench") == 0) { } else if (strcmp(arg[iarg],"fftbench") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) fftbench = 1; fftbench = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) fftbench = 0;
else error->all(FLERR,"Illegal kspace_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"collective") == 0) { } else if (strcmp(arg[iarg],"collective") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) collective_flag = 1; collective_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) collective_flag = 0;
else error->all(FLERR,"Illegal kspace_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"diff") == 0) { } else if (strcmp(arg[iarg],"diff") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
@ -559,9 +550,7 @@ void KSpace::modify_params(int narg, char **arg)
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"cutoff/adjust") == 0) { } else if (strcmp(arg[iarg],"cutoff/adjust") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) adjust_cutoff_flag = 1; adjust_cutoff_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) adjust_cutoff_flag = 0;
else error->all(FLERR,"Illegal kspace_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"kmax/ewald") == 0) { } else if (strcmp(arg[iarg],"kmax/ewald") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal kspace_modify command"); if (iarg+4 > narg) error->all(FLERR,"Illegal kspace_modify command");
@ -598,15 +587,11 @@ void KSpace::modify_params(int narg, char **arg)
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"pressure/scalar") == 0) { } else if (strcmp(arg[iarg],"pressure/scalar") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) scalar_pressure_flag = 1; scalar_pressure_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) scalar_pressure_flag = 0;
else error->all(FLERR,"Illegal kspace_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"disp/auto") == 0) { } else if (strcmp(arg[iarg],"disp/auto") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) auto_disp_flag = 1; auto_disp_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) auto_disp_flag = 0;
else error->all(FLERR,"Illegal kspace_modify command");
iarg += 2; iarg += 2;
} else { } else {
int n = modify_param(narg-iarg,&arg[iarg]); int n = modify_param(narg-iarg,&arg[iarg]);

View File

@ -705,15 +705,11 @@ void Min::modify_params(int narg, char **arg)
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"halfstepback") == 0) { } else if (strcmp(arg[iarg],"halfstepback") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) halfstepback_flag = 1; halfstepback_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) halfstepback_flag = 0;
else error->all(FLERR,"Illegal min_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"initialdelay") == 0) { } else if (strcmp(arg[iarg],"initialdelay") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) delaystep_start_flag = 1; delaystep_start_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) delaystep_start_flag = 0;
else error->all(FLERR,"Illegal min_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"vdfmax") == 0) { } else if (strcmp(arg[iarg],"vdfmax") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");

View File

@ -2404,15 +2404,11 @@ void Neighbor::modify_params(int narg, char **arg)
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"check") == 0) { } else if (strcmp(arg[iarg],"check") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) dist_check = 1; dist_check = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) dist_check = 0;
else error->all(FLERR,"Illegal neigh_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"once") == 0) { } else if (strcmp(arg[iarg],"once") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) build_once = 1; build_once = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) build_once = 0;
else error->all(FLERR,"Illegal neigh_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"page") == 0) { } else if (strcmp(arg[iarg],"page") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command");
@ -2432,9 +2428,7 @@ void Neighbor::modify_params(int narg, char **arg)
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"cluster") == 0) { } else if (strcmp(arg[iarg],"cluster") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) cluster_check = 1; cluster_check = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) cluster_check = 0;
else error->all(FLERR,"Illegal neigh_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"include") == 0) { } else if (strcmp(arg[iarg],"include") == 0) {

View File

@ -167,9 +167,7 @@ void Pair::modify_params(int narg, char **arg)
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"shift") == 0) { } else if (strcmp(arg[iarg],"shift") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) offset_flag = 1; offset_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) offset_flag = 0;
else error->all(FLERR,"Illegal pair_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"table") == 0) { } else if (strcmp(arg[iarg],"table") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command");
@ -193,15 +191,11 @@ void Pair::modify_params(int narg, char **arg)
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"tail") == 0) { } else if (strcmp(arg[iarg],"tail") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) tail_flag = 1; tail_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) tail_flag = 0;
else error->all(FLERR,"Illegal pair_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"compute") == 0) { } else if (strcmp(arg[iarg],"compute") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) compute_flag = 1; compute_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
else if (strcmp(arg[iarg+1],"no") == 0) compute_flag = 0;
else error->all(FLERR,"Illegal pair_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"nofdotr") == 0) { } else if (strcmp(arg[iarg],"nofdotr") == 0) {
no_virial_fdotr_compute = 1; no_virial_fdotr_compute = 1;

View File

@ -918,8 +918,7 @@ void PairHybrid::modify_params(int narg, char **arg)
again: again:
if (iarg < narg && strcmp(arg[iarg],"special") == 0) { if (iarg < narg && strcmp(arg[iarg],"special") == 0) {
if (narg < iarg+5) if (narg < iarg+5) error->all(FLERR,"Illegal pair_modify special command");
error->all(FLERR,"Illegal pair_modify special command");
modify_special(m,narg-iarg,&arg[iarg+1]); modify_special(m,narg-iarg,&arg[iarg+1]);
iarg += 5; iarg += 5;
goto again; goto again;
@ -929,13 +928,8 @@ again:
// set flag to register TALLY computes accordingly // set flag to register TALLY computes accordingly
if (iarg < narg && strcmp(arg[iarg],"compute/tally") == 0) { if (iarg < narg && strcmp(arg[iarg],"compute/tally") == 0) {
if (narg < iarg+2) if (narg < iarg+2) error->all(FLERR,"Illegal pair_modify compute/tally command");
error->all(FLERR,"Illegal pair_modify compute/tally command"); compute_tally[m] = utils::logical(FLERR,arg[iarg+1],false,lmp);
if (strcmp(arg[iarg+1],"yes") == 0) {
compute_tally[m] = 1;
} else if (strcmp(arg[iarg+1],"no") == 0) {
compute_tally[m] = 0;
} else error->all(FLERR,"Illegal pair_modify compute/tally command");
iarg += 2; iarg += 2;
goto again; goto again;
} }

View File

@ -160,7 +160,8 @@ TEST_F(SimpleCommandsTest, Partition)
BEGIN_HIDE_OUTPUT(); BEGIN_HIDE_OUTPUT();
command("echo none"); command("echo none");
END_HIDE_OUTPUT(); END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Illegal partition command .*", command("partition xxx 1 echo none");); TEST_FAILURE(".*ERROR: Expected boolean parameter instead of 'xxx'.*",
command("partition xxx 1 echo none"););
TEST_FAILURE(".*ERROR: Numeric index 2 is out of bounds.*", TEST_FAILURE(".*ERROR: Numeric index 2 is out of bounds.*",
command("partition yes 2 echo none");); command("partition yes 2 echo none"););

View File

@ -120,7 +120,7 @@ TEST_F(DumpAtomTest, format_line_run0)
TEST_F(DumpAtomTest, no_scale_run0) TEST_F(DumpAtomTest, no_scale_run0)
{ {
auto dump_file = "dump_no_scale_run0.melt"; auto dump_file = "dump_no_scale_run0.melt";
generate_dump(dump_file, "scale no", 0); generate_dump(dump_file, "scale off", 0);
ASSERT_FILE_EXISTS(dump_file); ASSERT_FILE_EXISTS(dump_file);
auto lines = read_lines(dump_file); auto lines = read_lines(dump_file);
@ -135,7 +135,7 @@ TEST_F(DumpAtomTest, no_scale_run0)
TEST_F(DumpAtomTest, no_buffer_no_scale_run0) TEST_F(DumpAtomTest, no_buffer_no_scale_run0)
{ {
auto dump_file = "dump_no_buffer_no_scale_run0.melt"; auto dump_file = "dump_no_buffer_no_scale_run0.melt";
generate_dump(dump_file, "buffer no scale no", 0); generate_dump(dump_file, "buffer false scale false", 0);
ASSERT_FILE_EXISTS(dump_file); ASSERT_FILE_EXISTS(dump_file);
auto lines = read_lines(dump_file); auto lines = read_lines(dump_file);
@ -150,7 +150,7 @@ TEST_F(DumpAtomTest, no_buffer_no_scale_run0)
TEST_F(DumpAtomTest, no_buffer_with_scale_run0) TEST_F(DumpAtomTest, no_buffer_with_scale_run0)
{ {
auto dump_file = "dump_no_buffer_with_scale_run0.melt"; auto dump_file = "dump_no_buffer_with_scale_run0.melt";
generate_dump(dump_file, "buffer no scale yes", 0); generate_dump(dump_file, "buffer 0 scale 1", 0);
ASSERT_FILE_EXISTS(dump_file); ASSERT_FILE_EXISTS(dump_file);
auto lines = read_lines(dump_file); auto lines = read_lines(dump_file);
@ -165,7 +165,7 @@ TEST_F(DumpAtomTest, no_buffer_with_scale_run0)
TEST_F(DumpAtomTest, with_image_run0) TEST_F(DumpAtomTest, with_image_run0)
{ {
auto dump_file = "dump_with_image_run0.melt"; auto dump_file = "dump_with_image_run0.melt";
generate_dump(dump_file, "scale no image yes", 0); generate_dump(dump_file, "scale no image on", 0);
ASSERT_FILE_EXISTS(dump_file); ASSERT_FILE_EXISTS(dump_file);
auto lines = read_lines(dump_file); auto lines = read_lines(dump_file);
@ -178,7 +178,7 @@ TEST_F(DumpAtomTest, with_image_run0)
TEST_F(DumpAtomTest, with_units_run0) TEST_F(DumpAtomTest, with_units_run0)
{ {
auto dump_file = "dump_with_units_run0.melt"; auto dump_file = "dump_with_units_run0.melt";
generate_dump(dump_file, "scale no units yes", 0); generate_dump(dump_file, "scale false units 1", 0);
ASSERT_FILE_EXISTS(dump_file); ASSERT_FILE_EXISTS(dump_file);
auto lines = read_lines(dump_file); auto lines = read_lines(dump_file);
@ -193,7 +193,7 @@ TEST_F(DumpAtomTest, with_units_run0)
TEST_F(DumpAtomTest, with_time_run0) TEST_F(DumpAtomTest, with_time_run0)
{ {
auto dump_file = "dump_with_time_run0.melt"; auto dump_file = "dump_with_time_run0.melt";
generate_dump(dump_file, "scale no time yes", 0); generate_dump(dump_file, "scale off time true", 0);
ASSERT_FILE_EXISTS(dump_file); ASSERT_FILE_EXISTS(dump_file);
auto lines = read_lines(dump_file); auto lines = read_lines(dump_file);
@ -207,7 +207,7 @@ TEST_F(DumpAtomTest, with_time_run0)
TEST_F(DumpAtomTest, with_units_run1) TEST_F(DumpAtomTest, with_units_run1)
{ {
auto dump_file = "dump_with_units_run1.melt"; auto dump_file = "dump_with_units_run1.melt";
generate_dump(dump_file, "scale no units yes", 1); generate_dump(dump_file, "scale 0 units on", 1);
ASSERT_FILE_EXISTS(dump_file); ASSERT_FILE_EXISTS(dump_file);
auto lines = read_lines(dump_file); auto lines = read_lines(dump_file);
@ -222,7 +222,7 @@ TEST_F(DumpAtomTest, with_units_run1)
TEST_F(DumpAtomTest, no_buffer_with_scale_and_image_run0) TEST_F(DumpAtomTest, no_buffer_with_scale_and_image_run0)
{ {
auto dump_file = "dump_no_buffer_with_scale_and_image_run0.melt"; auto dump_file = "dump_no_buffer_with_scale_and_image_run0.melt";
generate_dump(dump_file, "buffer no scale yes image yes", 0); generate_dump(dump_file, "buffer 0 scale 1 image true", 0);
ASSERT_FILE_EXISTS(dump_file); ASSERT_FILE_EXISTS(dump_file);
auto lines = read_lines(dump_file); auto lines = read_lines(dump_file);
@ -253,7 +253,7 @@ TEST_F(DumpAtomTest, triclinic_with_units_run0)
{ {
auto dump_file = "dump_triclinic_with_units_run0.melt"; auto dump_file = "dump_triclinic_with_units_run0.melt";
enable_triclinic(); enable_triclinic();
generate_dump(dump_file, "units yes", 0); generate_dump(dump_file, "units on", 0);
ASSERT_FILE_EXISTS(dump_file); ASSERT_FILE_EXISTS(dump_file);
auto lines = read_lines(dump_file); auto lines = read_lines(dump_file);
@ -271,7 +271,7 @@ TEST_F(DumpAtomTest, triclinic_with_time_run0)
{ {
auto dump_file = "dump_triclinic_with_time_run0.melt"; auto dump_file = "dump_triclinic_with_time_run0.melt";
enable_triclinic(); enable_triclinic();
generate_dump(dump_file, "time yes", 0); generate_dump(dump_file, "time on", 0);
ASSERT_FILE_EXISTS(dump_file); ASSERT_FILE_EXISTS(dump_file);
auto lines = read_lines(dump_file); auto lines = read_lines(dump_file);
@ -548,7 +548,8 @@ TEST_F(DumpAtomTest, dump_modify_scale_invalid)
command("dump id all atom 1 dump.txt"); command("dump id all atom 1 dump.txt");
END_HIDE_OUTPUT(); END_HIDE_OUTPUT();
TEST_FAILURE(".*Illegal dump_modify command.*", command("dump_modify id scale true");); TEST_FAILURE(".*Expected boolean parameter instead of 'xxx'.*",
command("dump_modify id scale xxx"););
} }
TEST_F(DumpAtomTest, dump_modify_image_invalid) TEST_F(DumpAtomTest, dump_modify_image_invalid)
@ -557,7 +558,8 @@ TEST_F(DumpAtomTest, dump_modify_image_invalid)
command("dump id all atom 1 dump.txt"); command("dump id all atom 1 dump.txt");
END_HIDE_OUTPUT(); END_HIDE_OUTPUT();
TEST_FAILURE(".*Illegal dump_modify command.*", command("dump_modify id image true");); TEST_FAILURE(".*Expected boolean parameter instead of 'xxx'.*",
command("dump_modify id image xxx"););
} }
TEST_F(DumpAtomTest, dump_modify_invalid) TEST_F(DumpAtomTest, dump_modify_invalid)