apply utils::logical() to more commands
This commit is contained in:
@ -233,9 +233,7 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"mtk") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix bocs command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) mtk_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) mtk_flag = 0;
|
||||
else error->all(FLERR,"Illegal fix bocs command");
|
||||
mtk_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"tloop") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix bocs command");
|
||||
|
||||
@ -18,20 +18,22 @@
|
||||
Updated algorithm by: Brian Barnes, brian.c.barnes11.civ@mail.mil
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include "compute_ackland_atom.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "update.h"
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
#include "modify.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "pair.h"
|
||||
#include "comm.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "update.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -60,16 +62,10 @@ ComputeAcklandAtom::ComputeAcklandAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
int iarg = 3;
|
||||
while (narg > iarg) {
|
||||
if (strcmp("legacy",arg[iarg]) == 0) {
|
||||
++iarg;
|
||||
if (iarg >= narg)
|
||||
error->all(FLERR,"Invalid compute ackland/atom command");
|
||||
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");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Invalid compute ackland/atom command");
|
||||
legacy = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
}
|
||||
++iarg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
10
src/atom.cpp
10
src/atom.cpp
@ -822,17 +822,13 @@ void Atom::modify_params(int narg, char **arg)
|
||||
if (strcmp(arg[iarg],"id") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command");
|
||||
if (domain->box_exist)
|
||||
error->all(FLERR,
|
||||
"Atom_modify id command after simulation box is defined");
|
||||
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");
|
||||
error->all(FLERR,"Atom_modify id command after simulation box is defined");
|
||||
tag_enable = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"map") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command");
|
||||
if (domain->box_exist)
|
||||
error->all(FLERR,
|
||||
"Atom_modify map command after simulation box is defined");
|
||||
error->all(FLERR,"Atom_modify map command after simulation box is defined");
|
||||
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],"yes") == 0) map_user = 3;
|
||||
|
||||
@ -395,9 +395,7 @@ void Comm::modify_params(int narg, char **arg)
|
||||
iarg += 1;
|
||||
} else if (strcmp(arg[iarg],"vel") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) ghost_velocity = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) ghost_velocity = 0;
|
||||
else error->all(FLERR,"Illegal comm_modify command");
|
||||
ghost_velocity = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal comm_modify command");
|
||||
}
|
||||
|
||||
@ -128,9 +128,7 @@ void Compute::modify_params(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg],"dynamic") == 0 ||
|
||||
strcmp(arg[iarg],"dynamic/dof") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute_modify command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) dynamic_user = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) dynamic_user = 1;
|
||||
else error->all(FLERR,"Illegal compute_modify command");
|
||||
dynamic_user = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal compute_modify command");
|
||||
}
|
||||
|
||||
@ -17,19 +17,21 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "compute_centro_atom.h"
|
||||
#include <cstring>
|
||||
|
||||
#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 "error.h"
|
||||
#include "force.h"
|
||||
#include "math_extra.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;
|
||||
|
||||
@ -55,11 +57,8 @@ ComputeCentroAtom::ComputeCentroAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
int iarg = 4;
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"axes") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute centro/atom command3");
|
||||
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");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute centro/atom command3");
|
||||
axes_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal compute centro/atom command1");
|
||||
}
|
||||
|
||||
@ -220,9 +220,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"compress") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command");
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) compress = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) compress = 1;
|
||||
else error->all(FLERR,"Illegal compute chunk/atom command");
|
||||
compress = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"discard") == 0) {
|
||||
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;
|
||||
} else if (strcmp(arg[iarg],"pbc") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) pbcflag = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) pbcflag = 1;
|
||||
else error->all(FLERR,"Illegal compute chunk/atom command");
|
||||
pbcflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal compute chunk/atom command");
|
||||
}
|
||||
|
||||
@ -54,9 +54,7 @@ ComputeFragmentAtom::ComputeFragmentAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"single") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute fragment/atom command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) singleflag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) singleflag = 0;
|
||||
else error->all(FLERR,"Illegal compute fragment/atom command");
|
||||
singleflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal compute fragment/atom command");
|
||||
}
|
||||
|
||||
@ -19,21 +19,22 @@
|
||||
|
||||
#include "compute_group_group.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
#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 "domain.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "group.h"
|
||||
#include "kspace.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 MathConst;
|
||||
@ -69,29 +70,19 @@ ComputeGroupGroup::ComputeGroupGroup(LAMMPS *lmp, int narg, char **arg) :
|
||||
int iarg = 4;
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"pair") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute group/group command");
|
||||
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");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute group/group command");
|
||||
pairflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"kspace") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute group/group command");
|
||||
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");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute group/group command");
|
||||
kspaceflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"boundary") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute group/group command");
|
||||
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");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute group/group command");
|
||||
boundaryflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"molecule") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute group/group command");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute group/group command");
|
||||
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],"intra") == 0) molflag = INTRA;
|
||||
|
||||
@ -49,15 +49,11 @@ ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg) :
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"com") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute msd command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) comflag = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) comflag = 1;
|
||||
else error->all(FLERR,"Illegal compute msd command");
|
||||
comflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"average") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute msd command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) avflag = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) avflag = 1;
|
||||
else error->all(FLERR,"Illegal compute msd command");
|
||||
avflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal compute msd command");
|
||||
}
|
||||
|
||||
@ -83,53 +83,41 @@ ComputeOrientOrderAtom::ComputeOrientOrderAtom(LAMMPS *lmp, int narg, char **arg
|
||||
int iarg = 3;
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"nnn") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (strcmp(arg[iarg+1],"NULL") == 0) {
|
||||
nnn = 0;
|
||||
} else {
|
||||
nnn = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (nnn <= 0)
|
||||
error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (nnn <= 0) error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
}
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"degrees") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
nqlist = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (nqlist <= 0)
|
||||
error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (nqlist <= 0) error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
memory->destroy(qlist);
|
||||
memory->create(qlist,nqlist,"orientorder/atom:qlist");
|
||||
iarg += 2;
|
||||
if (iarg+nqlist > narg)
|
||||
error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (iarg+nqlist > narg) error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
qmax = 0;
|
||||
for (int il = 0; il < nqlist; il++) {
|
||||
qlist[il] = utils::numeric(FLERR,arg[iarg+il],false,lmp);
|
||||
if (qlist[il] < 0)
|
||||
error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (qlist[il] < 0) error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (qlist[il] > qmax) qmax = qlist[il];
|
||||
}
|
||||
iarg += nqlist;
|
||||
} else if (strcmp(arg[iarg],"wl") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) wlflag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) wlflag = 0;
|
||||
else error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
wlflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"wl/hat") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
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");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
wlhatflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"components") == 0) {
|
||||
qlcompflag = 1;
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
qlcomp = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
iqlcomp = -1;
|
||||
for (int il = 0; il < nqlist; il++)
|
||||
@ -137,23 +125,18 @@ ComputeOrientOrderAtom::ComputeOrientOrderAtom(LAMMPS *lmp, int narg, char **arg
|
||||
iqlcomp = il;
|
||||
break;
|
||||
}
|
||||
if (iqlcomp == -1)
|
||||
error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (iqlcomp == -1) error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"cutoff") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
double cutoff = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (cutoff <= 0.0)
|
||||
error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (cutoff <= 0.0) error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
cutsq = cutoff*cutoff;
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"chunksize") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
chunksize = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (chunksize <= 0)
|
||||
error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
if (chunksize <= 0) error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal compute orientorder/atom command");
|
||||
}
|
||||
|
||||
@ -14,15 +14,16 @@
|
||||
|
||||
#include "compute_temp_chunk.h"
|
||||
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "update.h"
|
||||
#include "force.h"
|
||||
#include "modify.h"
|
||||
#include "compute_chunk_atom.h"
|
||||
#include "domain.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
#include "modify.h"
|
||||
#include "update.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -76,26 +77,20 @@ ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"com") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute temp/chunk command");
|
||||
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");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/chunk command");
|
||||
comflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"bias") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute temp/chunk command");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/chunk command");
|
||||
biasflag = 1;
|
||||
id_bias = utils::strdup(arg[iarg+1]);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"adof") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute temp/chunk command");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/chunk command");
|
||||
adof = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"cdof") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
error->all(FLERR,"Illegal compute temp/chunk command");
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/chunk command");
|
||||
cdof = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal compute temp/chunk command");
|
||||
|
||||
@ -151,9 +151,7 @@ void CreateAtoms::command(int narg, char **arg)
|
||||
iarg += 3;
|
||||
} else if (strcmp(arg[iarg],"remap") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal create_atoms command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) remapflag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) remapflag = 0;
|
||||
else error->all(FLERR,"Illegal create_atoms command");
|
||||
remapflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"mol") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal create_atoms command");
|
||||
|
||||
@ -125,9 +125,7 @@ void CreateBonds::command(int narg, char **arg)
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"special") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal create_bonds command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) specialflag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) specialflag = 0;
|
||||
else error->all(FLERR,"Illegal create_bonds command");
|
||||
specialflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal create_bonds command");
|
||||
}
|
||||
|
||||
@ -738,30 +738,21 @@ void DeleteAtoms::options(int narg, char **arg)
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"compress") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal delete_atoms command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) compress_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) compress_flag = 0;
|
||||
else error->all(FLERR,"Illegal delete_atoms command");
|
||||
compress_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"bond") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal delete_atoms command");
|
||||
if (atom->molecular == Atom::ATOMIC)
|
||||
error->all(FLERR,"Cannot delete_atoms bond yes for "
|
||||
"non-molecular systems");
|
||||
error->all(FLERR,"Cannot delete_atoms bond yes for non-molecular systems");
|
||||
if (atom->molecular == Atom::TEMPLATE)
|
||||
error->all(FLERR,"Cannot use delete_atoms bond yes with "
|
||||
"atom_style template");
|
||||
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");
|
||||
error->all(FLERR,"Cannot use delete_atoms bond yes with atom_style template");
|
||||
bond_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"mol") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal delete_atoms command");
|
||||
if (atom->molecule_flag == 0)
|
||||
error->all(FLERR,"Delete_atoms mol yes requires "
|
||||
"atom attribute molecule");
|
||||
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");
|
||||
error->all(FLERR,"Delete_atoms mol yes requires atom attribute molecule");
|
||||
mol_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal delete_atoms command");
|
||||
}
|
||||
|
||||
41
src/dump.cpp
41
src/dump.cpp
@ -912,16 +912,12 @@ void Dump::modify_params(int narg, char **arg)
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"append") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) append_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) append_flag = 0;
|
||||
else error->all(FLERR,"Illegal dump_modify command");
|
||||
append_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"buffer") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) buffer_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) buffer_flag = 0;
|
||||
else error->all(FLERR,"Illegal dump_modify command");
|
||||
buffer_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
if (buffer_flag && buffer_allow == 0)
|
||||
error->all(FLERR,"Dump_modify buffer yes not allowed for this style");
|
||||
iarg += 2;
|
||||
@ -935,9 +931,7 @@ void Dump::modify_params(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"header") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) write_header_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) write_header_flag = 0;
|
||||
else error->all(FLERR,"Illegal dump_modify command");
|
||||
header_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
|
||||
} 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) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (!multiproc)
|
||||
error->all(FLERR,"Cannot use dump_modify fileper "
|
||||
"without % in dump file name");
|
||||
error->all(FLERR,"Cannot use dump_modify fileper without % in dump file name");
|
||||
int nper = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
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) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) first_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) first_flag = 0;
|
||||
else error->all(FLERR,"Illegal dump_modify command");
|
||||
first_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"flush") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) flush_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) flush_flag = 0;
|
||||
else error->all(FLERR,"Illegal dump_modify command");
|
||||
flush_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
|
||||
} 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) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (!multifile)
|
||||
error->all(FLERR,"Cannot use dump_modify maxfiles "
|
||||
"without * in dump file name");
|
||||
error->all(FLERR,"Cannot use dump_modify maxfiles without * in dump file name");
|
||||
// wipe out existing storage
|
||||
if (maxfiles > 0) {
|
||||
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) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (!multiproc)
|
||||
error->all(FLERR,"Cannot use dump_modify nfile "
|
||||
"without % in dump file name");
|
||||
error->all(FLERR,"Cannot use dump_modify nfile without % in dump file name");
|
||||
int nfile = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (nfile <= 0) error->all(FLERR,"Illegal dump_modify command");
|
||||
nfile = MIN(nfile,nprocs);
|
||||
@ -1090,9 +1077,7 @@ void Dump::modify_params(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"pbc") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) pbcflag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) pbcflag = 0;
|
||||
else error->all(FLERR,"Illegal dump_modify command");
|
||||
pbcflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
|
||||
} 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) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) time_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) time_flag = 0;
|
||||
else error->all(FLERR,"Illegal dump_modify command");
|
||||
time_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"units") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) unit_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) unit_flag = 0;
|
||||
else error->all(FLERR,"Illegal dump_modify command");
|
||||
unit_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
|
||||
} else {
|
||||
|
||||
@ -13,13 +13,15 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "dump_atom.h"
|
||||
#include <cstring>
|
||||
#include "domain.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "memory.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "memory.h"
|
||||
#include "update.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
#define ONELINE 256
|
||||
@ -114,15 +116,11 @@ int DumpAtom::modify_param(int narg, char **arg)
|
||||
{
|
||||
if (strcmp(arg[0],"scale") == 0) {
|
||||
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (strcmp(arg[1],"yes") == 0) scale_flag = 1;
|
||||
else if (strcmp(arg[1],"no") == 0) scale_flag = 0;
|
||||
else error->all(FLERR,"Illegal dump_modify command");
|
||||
scale_flag = utils::logical(FLERR,arg[1],false,lmp);
|
||||
return 2;
|
||||
} else if (strcmp(arg[0],"image") == 0) {
|
||||
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
|
||||
if (strcmp(arg[1],"yes") == 0) image_flag = 1;
|
||||
else if (strcmp(arg[1],"no") == 0) image_flag = 0;
|
||||
else error->all(FLERR,"Illegal dump_modify command");
|
||||
image_flag = utils::logical(FLERR,arg[1],false,lmp);
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -47,7 +47,7 @@ using namespace MathConst;
|
||||
enum{NUMERIC,ATOM,TYPE,ELEMENT,ATTRIBUTE};
|
||||
enum{SPHERE,LINE,TRI}; // also in some Body and Fix child classes
|
||||
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) {
|
||||
if (strcmp(arg[iarg],"atom") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal dump image command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) atomflag = YES;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) atomflag = NO;
|
||||
else error->all(FLERR,"Illegal dump image command");
|
||||
atomflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
|
||||
} 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) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) boxflag = YES;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) boxflag = NO;
|
||||
else error->all(FLERR,"Illegal dump image command");
|
||||
boxflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
boxdiam = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (boxdiam < 0.0) error->all(FLERR,"Illegal dump image command");
|
||||
iarg += 3;
|
||||
|
||||
} else if (strcmp(arg[iarg],"axes") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) axesflag = YES;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) axesflag = NO;
|
||||
else error->all(FLERR,"Illegal dump image command");
|
||||
axesflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
axeslen = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
axesdiam = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
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) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) subboxflag = YES;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) subboxflag = NO;
|
||||
else error->all(FLERR,"Illegal dump image command");
|
||||
subboxflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
subboxdiam = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (subboxdiam < 0.0) error->all(FLERR,"Illegal dump image command");
|
||||
iarg += 3;
|
||||
@ -327,9 +319,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
} else if (strcmp(arg[iarg],"ssao") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal dump image command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) image->ssao = YES;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) image->ssao = NO;
|
||||
else error->all(FLERR,"Illegal dump image command");
|
||||
image->ssao = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
int seed = utils::inumeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (seed <= 0) error->all(FLERR,"Illegal dump image command");
|
||||
image->seed = seed;
|
||||
|
||||
20
src/fix.cpp
20
src/fix.cpp
@ -137,27 +137,19 @@ void Fix::modify_params(int narg, char **arg)
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"dynamic/dof") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) dynamic = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) dynamic = 1;
|
||||
else error->all(FLERR,"Illegal fix_modify command");
|
||||
dynamic = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"energy") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) thermo_energy = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) {
|
||||
if (energy_global_flag == 0 && energy_peratom_flag == 0)
|
||||
thermo_energy = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
if (thermo_energy && !energy_global_flag && !energy_peratom_flag)
|
||||
error->all(FLERR,"Illegal fix_modify command");
|
||||
thermo_energy = 1;
|
||||
} else error->all(FLERR,"Illegal fix_modify command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"virial") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) thermo_virial = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) {
|
||||
if (virial_global_flag == 0 && virial_peratom_flag == 0)
|
||||
error->all(FLERR,"Illegal fix_modify command");
|
||||
thermo_virial = 1;
|
||||
} else error->all(FLERR,"Illegal fix_modify command");
|
||||
thermo_virial = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
if (thermo_virial && !virial_global_flag && !virial_peratom_flag)
|
||||
error->all(FLERR,"Illegal fix_modify command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"respa") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command");
|
||||
|
||||
@ -158,21 +158,15 @@ nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr)
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"reset") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix adapt command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) resetflag = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) resetflag = 1;
|
||||
else error->all(FLERR,"Illegal fix adapt command");
|
||||
resetflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"scale") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix adapt command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) scaleflag = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) scaleflag = 1;
|
||||
else error->all(FLERR,"Illegal fix adapt command");
|
||||
scaleflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"mass") == 0) {
|
||||
if (iarg+2 > narg)error->all(FLERR,"Illegal fix adapt command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) massflag = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) massflag = 1;
|
||||
else error->all(FLERR,"Illegal fix adapt command");
|
||||
massflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal fix adapt command");
|
||||
}
|
||||
|
||||
@ -196,21 +196,15 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"scalexy") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) scalexy = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) scalexy = 0;
|
||||
else error->all(FLERR,"Illegal fix box/relax command");
|
||||
scalexy = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"scalexz") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) scalexz = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) scalexz = 0;
|
||||
else error->all(FLERR,"Illegal fix box/relax command");
|
||||
scalexz = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"scaleyz") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) scaleyz = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) scaleyz = 0;
|
||||
else error->all(FLERR,"Illegal fix box/relax command");
|
||||
scaleyz = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"fixedpoint") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal fix box/relax command");
|
||||
|
||||
@ -1008,9 +1008,7 @@ void FixDeform::options(int narg, char **arg)
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"flip") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix deform command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) flipflag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) flipflag = 0;
|
||||
else error->all(FLERR,"Illegal fix deform command");
|
||||
flipflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal fix deform command");
|
||||
}
|
||||
|
||||
@ -14,19 +14,20 @@
|
||||
|
||||
#include "fix_evaporate.h"
|
||||
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "update.h"
|
||||
#include "domain.h"
|
||||
#include "region.h"
|
||||
#include "comm.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "group.h"
|
||||
#include "random_park.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 FixConst;
|
||||
@ -69,9 +70,7 @@ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) :
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"molecule") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix evaporate command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) molflag = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) molflag = 1;
|
||||
else error->all(FLERR,"Illegal fix evaporate command");
|
||||
molflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal fix evaporate command");
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ using namespace FixConst;
|
||||
enum{BONDMAX,TLIMIT,DISKFREE,VARIABLE};
|
||||
enum{LT,LE,GT,GE,EQ,NEQ,XOR};
|
||||
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;
|
||||
} else if (strcmp(arg[iarg],"message") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix halt command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) msgflag = NOMSG;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) msgflag = YESMSG;
|
||||
else error->all(FLERR,"Illegal fix halt command");
|
||||
msgflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"path") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix halt command");
|
||||
|
||||
@ -128,9 +128,7 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"omega") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) oflag = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) oflag = 1;
|
||||
else error->all(FLERR,"Illegal fix langevin command");
|
||||
oflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"scale") == 0) {
|
||||
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;
|
||||
} else if (strcmp(arg[iarg],"tally") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) tallyflag = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) tallyflag = 1;
|
||||
else error->all(FLERR,"Illegal fix langevin command");
|
||||
tallyflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"zero") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) zeroflag = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) zeroflag = 1;
|
||||
else error->all(FLERR,"Illegal fix langevin command");
|
||||
zeroflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal fix langevin command");
|
||||
}
|
||||
|
||||
@ -17,23 +17,25 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "fix_nh.h"
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "compute.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "fix_deform.h"
|
||||
#include "force.h"
|
||||
#include "group.h"
|
||||
#include "comm.h"
|
||||
#include "neighbor.h"
|
||||
#include "irregular.h"
|
||||
#include "modify.h"
|
||||
#include "fix_deform.h"
|
||||
#include "compute.h"
|
||||
#include "kspace.h"
|
||||
#include "update.h"
|
||||
#include "respa.h"
|
||||
#include "domain.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 FixConst;
|
||||
@ -297,9 +299,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"mtk") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) mtk_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) mtk_flag = 0;
|
||||
else error->all(FLERR,"Illegal fix nvt/npt/nph command");
|
||||
mtk_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"tloop") == 0) {
|
||||
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;
|
||||
} else if (strcmp(arg[iarg],"scalexy") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) scalexy = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) scalexy = 0;
|
||||
else error->all(FLERR,"Illegal fix nvt/npt/nph command");
|
||||
scalexy = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"scalexz") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) scalexz = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) scalexz = 0;
|
||||
else error->all(FLERR,"Illegal fix nvt/npt/nph command");
|
||||
scalexz = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"scaleyz") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) scaleyz = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) scaleyz = 0;
|
||||
else error->all(FLERR,"Illegal fix nvt/npt/nph command");
|
||||
scaleyz = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"flip") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) flipflag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) flipflag = 0;
|
||||
else error->all(FLERR,"Illegal fix nvt/npt/nph command");
|
||||
flipflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"update") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command");
|
||||
|
||||
@ -64,14 +64,12 @@ FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) :
|
||||
else fp = fopen(arg[iarg+1],"a");
|
||||
if (fp == nullptr)
|
||||
error->one(FLERR,"Cannot open fix print file {}: {}",
|
||||
arg[iarg+1], utils::getsyserror());
|
||||
arg[iarg+1], utils::getsyserror());
|
||||
}
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"screen") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix print command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) screenflag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) screenflag = 0;
|
||||
else error->all(FLERR,"Illegal fix print command");
|
||||
screenflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"title") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix print command");
|
||||
|
||||
@ -151,9 +151,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"ghost") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix property/atom command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) border = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) border = 1;
|
||||
else error->all(FLERR,"Illegal fix property/atom command");
|
||||
border = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal fix property/atom command");
|
||||
}
|
||||
|
||||
@ -231,9 +231,7 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) :
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"com") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix store/state command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) comflag = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) comflag = 1;
|
||||
else error->all(FLERR,"Illegal fix store/state command");
|
||||
comflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal fix store/state command");
|
||||
}
|
||||
@ -246,16 +244,13 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) :
|
||||
if (icompute < 0)
|
||||
error->all(FLERR,"Compute ID for fix store/state does not exist");
|
||||
if (modify->compute[icompute]->peratom_flag == 0)
|
||||
error->all(FLERR,"Fix store/state compute "
|
||||
"does not calculate per-atom values");
|
||||
error->all(FLERR,"Fix store/state compute does not calculate per-atom values");
|
||||
if (argindex[i] == 0 &&
|
||||
modify->compute[icompute]->size_peratom_cols != 0)
|
||||
error->all(FLERR,"Fix store/state compute does not "
|
||||
"calculate a per-atom vector");
|
||||
error->all(FLERR,"Fix store/state compute does not calculate a per-atom vector");
|
||||
if (argindex[i] && modify->compute[icompute]->size_peratom_cols == 0)
|
||||
error->all(FLERR,
|
||||
"Fix store/state compute does not "
|
||||
"calculate a per-atom array");
|
||||
"Fix store/state compute does not calculate a per-atom array");
|
||||
if (argindex[i] &&
|
||||
argindex[i] > modify->compute[icompute]->size_peratom_cols)
|
||||
error->all(FLERR,
|
||||
|
||||
@ -128,15 +128,11 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) :
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"fld") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix wall command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) fldflag = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) fldflag = 1;
|
||||
else error->all(FLERR,"Illegal fix wall command");
|
||||
fldflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"pbc") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix wall command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) pbcflag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) pbcflag = 0;
|
||||
else error->all(FLERR,"Illegal fix wall command");
|
||||
pbcflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal fix wall command");
|
||||
}
|
||||
|
||||
@ -811,15 +811,11 @@ void Force::set_special(int narg, char **arg)
|
||||
iarg += 4;
|
||||
} else if (strcmp(arg[iarg],"angle") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal special_bonds command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) special_angle = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) special_angle = 1;
|
||||
else error->all(FLERR,"Illegal special_bonds command");
|
||||
special_angle = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"dihedral") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal special_bonds command");
|
||||
if (strcmp(arg[iarg+1],"no") == 0) special_dihedral = 0;
|
||||
else if (strcmp(arg[iarg+1],"yes") == 0) special_dihedral = 1;
|
||||
else error->all(FLERR,"Illegal special_bonds command");
|
||||
special_dihedral = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal special_bonds command");
|
||||
}
|
||||
|
||||
@ -1068,19 +1068,14 @@ void Input::partition()
|
||||
{
|
||||
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 yesflag = utils::logical(FLERR,arg[0],false,lmp);
|
||||
utils::bounds(FLERR,arg[1],1,universe->nworlds,ilo,ihi,error);
|
||||
|
||||
// new command starts at the 3rd argument,
|
||||
// which must not be another partition command
|
||||
|
||||
if (strcmp(arg[2],"partition") == 0)
|
||||
error->all(FLERR,"Illegal partition command");
|
||||
if (strcmp(arg[2],"partition") == 0) error->all(FLERR,"Illegal partition command");
|
||||
|
||||
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");
|
||||
else fp = fopen(arg[iarg+1],"a");
|
||||
if (fp == nullptr)
|
||||
error->one(FLERR,"Cannot open print file {}: {}",
|
||||
arg[iarg+1], utils::getsyserror());
|
||||
error->one(FLERR,"Cannot open print file {}: {}", arg[iarg+1], utils::getsyserror());
|
||||
}
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"screen") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal print command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) screenflag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) screenflag = 0;
|
||||
else error->all(FLERR,"Illegal print command");
|
||||
screenflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"universe") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal print command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) universeflag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) universeflag = 0;
|
||||
else error->all(FLERR,"Illegal print command");
|
||||
universeflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal print command");
|
||||
}
|
||||
|
||||
@ -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)
|
||||
gridflag_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 "
|
||||
"zero or all positive");
|
||||
error->all(FLERR,"Kspace_modify mesh/disp parameters must be all zero or all positive");
|
||||
else gridflag_6 = 1;
|
||||
iarg += 4;
|
||||
} else if (strcmp(arg[iarg],"order") == 0) {
|
||||
@ -499,9 +498,7 @@ void KSpace::modify_params(int narg, char **arg)
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"overlap") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) overlap_allowed = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) overlap_allowed = 0;
|
||||
else error->all(FLERR,"Illegal kspace_modify command");
|
||||
overlap_allowed = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"force") == 0) {
|
||||
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;
|
||||
} else if (strcmp(arg[iarg],"compute") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) compute_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) compute_flag = 0;
|
||||
else error->all(FLERR,"Illegal kspace_modify command");
|
||||
compute_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"fftbench") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) fftbench = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) fftbench = 0;
|
||||
else error->all(FLERR,"Illegal kspace_modify command");
|
||||
fftbench = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"collective") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) collective_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) collective_flag = 0;
|
||||
else error->all(FLERR,"Illegal kspace_modify command");
|
||||
collective_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"diff") == 0) {
|
||||
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;
|
||||
} else if (strcmp(arg[iarg],"cutoff/adjust") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) adjust_cutoff_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) adjust_cutoff_flag = 0;
|
||||
else error->all(FLERR,"Illegal kspace_modify command");
|
||||
adjust_cutoff_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"kmax/ewald") == 0) {
|
||||
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;
|
||||
} else if (strcmp(arg[iarg],"pressure/scalar") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) scalar_pressure_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) scalar_pressure_flag = 0;
|
||||
else error->all(FLERR,"Illegal kspace_modify command");
|
||||
scalar_pressure_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"disp/auto") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) auto_disp_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) auto_disp_flag = 0;
|
||||
else error->all(FLERR,"Illegal kspace_modify command");
|
||||
auto_disp_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else {
|
||||
int n = modify_param(narg-iarg,&arg[iarg]);
|
||||
|
||||
@ -705,15 +705,11 @@ void Min::modify_params(int narg, char **arg)
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"halfstepback") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) halfstepback_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) halfstepback_flag = 0;
|
||||
else error->all(FLERR,"Illegal min_modify command");
|
||||
halfstepback_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"initialdelay") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) delaystep_start_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) delaystep_start_flag = 0;
|
||||
else error->all(FLERR,"Illegal min_modify command");
|
||||
delaystep_start_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"vdfmax") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
|
||||
|
||||
@ -2404,15 +2404,11 @@ void Neighbor::modify_params(int narg, char **arg)
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"check") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) dist_check = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) dist_check = 0;
|
||||
else error->all(FLERR,"Illegal neigh_modify command");
|
||||
dist_check = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"once") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) build_once = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) build_once = 0;
|
||||
else error->all(FLERR,"Illegal neigh_modify command");
|
||||
build_once = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"page") == 0) {
|
||||
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;
|
||||
} else if (strcmp(arg[iarg],"cluster") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) cluster_check = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) cluster_check = 0;
|
||||
else error->all(FLERR,"Illegal neigh_modify command");
|
||||
cluster_check = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"include") == 0) {
|
||||
|
||||
12
src/pair.cpp
12
src/pair.cpp
@ -167,9 +167,7 @@ void Pair::modify_params(int narg, char **arg)
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"shift") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) offset_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) offset_flag = 0;
|
||||
else error->all(FLERR,"Illegal pair_modify command");
|
||||
offset_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"table") == 0) {
|
||||
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;
|
||||
} else if (strcmp(arg[iarg],"tail") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) tail_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) tail_flag = 0;
|
||||
else error->all(FLERR,"Illegal pair_modify command");
|
||||
tail_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"compute") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) compute_flag = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) compute_flag = 0;
|
||||
else error->all(FLERR,"Illegal pair_modify command");
|
||||
compute_flag = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"nofdotr") == 0) {
|
||||
no_virial_fdotr_compute = 1;
|
||||
|
||||
@ -918,8 +918,7 @@ void PairHybrid::modify_params(int narg, char **arg)
|
||||
again:
|
||||
|
||||
if (iarg < narg && strcmp(arg[iarg],"special") == 0) {
|
||||
if (narg < iarg+5)
|
||||
error->all(FLERR,"Illegal pair_modify special command");
|
||||
if (narg < iarg+5) error->all(FLERR,"Illegal pair_modify special command");
|
||||
modify_special(m,narg-iarg,&arg[iarg+1]);
|
||||
iarg += 5;
|
||||
goto again;
|
||||
@ -929,13 +928,8 @@ again:
|
||||
// set flag to register TALLY computes accordingly
|
||||
|
||||
if (iarg < narg && strcmp(arg[iarg],"compute/tally") == 0) {
|
||||
if (narg < iarg+2)
|
||||
error->all(FLERR,"Illegal pair_modify compute/tally command");
|
||||
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");
|
||||
if (narg < iarg+2) error->all(FLERR,"Illegal pair_modify compute/tally command");
|
||||
compute_tally[m] = utils::logical(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
goto again;
|
||||
}
|
||||
|
||||
@ -160,7 +160,8 @@ TEST_F(SimpleCommandsTest, Partition)
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("echo none");
|
||||
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.*",
|
||||
command("partition yes 2 echo none"););
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ TEST_F(DumpAtomTest, format_line_run0)
|
||||
TEST_F(DumpAtomTest, no_scale_run0)
|
||||
{
|
||||
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);
|
||||
auto lines = read_lines(dump_file);
|
||||
@ -135,7 +135,7 @@ TEST_F(DumpAtomTest, no_scale_run0)
|
||||
TEST_F(DumpAtomTest, no_buffer_no_scale_run0)
|
||||
{
|
||||
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);
|
||||
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)
|
||||
{
|
||||
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);
|
||||
auto lines = read_lines(dump_file);
|
||||
@ -165,7 +165,7 @@ TEST_F(DumpAtomTest, no_buffer_with_scale_run0)
|
||||
TEST_F(DumpAtomTest, with_image_run0)
|
||||
{
|
||||
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);
|
||||
auto lines = read_lines(dump_file);
|
||||
@ -178,7 +178,7 @@ TEST_F(DumpAtomTest, with_image_run0)
|
||||
TEST_F(DumpAtomTest, with_units_run0)
|
||||
{
|
||||
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);
|
||||
auto lines = read_lines(dump_file);
|
||||
@ -193,7 +193,7 @@ TEST_F(DumpAtomTest, with_units_run0)
|
||||
TEST_F(DumpAtomTest, with_time_run0)
|
||||
{
|
||||
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);
|
||||
auto lines = read_lines(dump_file);
|
||||
@ -207,7 +207,7 @@ TEST_F(DumpAtomTest, with_time_run0)
|
||||
TEST_F(DumpAtomTest, with_units_run1)
|
||||
{
|
||||
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);
|
||||
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)
|
||||
{
|
||||
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);
|
||||
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";
|
||||
enable_triclinic();
|
||||
generate_dump(dump_file, "units yes", 0);
|
||||
generate_dump(dump_file, "units on", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(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";
|
||||
enable_triclinic();
|
||||
generate_dump(dump_file, "time yes", 0);
|
||||
generate_dump(dump_file, "time on", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(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");
|
||||
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)
|
||||
@ -557,7 +558,8 @@ TEST_F(DumpAtomTest, dump_modify_image_invalid)
|
||||
command("dump id all atom 1 dump.txt");
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user