resolved merge conflicts with master
This commit is contained in:
148
src/set.cpp
148
src/set.cpp
@ -1,6 +1,7 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://lammps.sandia.gov/, Sandia National Laboratories
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
@ -71,9 +72,7 @@ void Set::command(int narg, char **arg)
|
||||
else if (strcmp(arg[0],"region") == 0) style = REGION_SELECT;
|
||||
else error->all(FLERR,"Illegal set command");
|
||||
|
||||
int n = strlen(arg[1]) + 1;
|
||||
id = new char[n];
|
||||
strcpy(id,arg[1]);
|
||||
id = utils::strdup(arg[1]);
|
||||
select = nullptr;
|
||||
selection(atom->nlocal);
|
||||
|
||||
@ -92,7 +91,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
if (strcmp(arg[iarg],"type") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
set(TYPE);
|
||||
iarg += 2;
|
||||
@ -141,7 +140,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"mol") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->molecule_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -150,49 +149,49 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"x") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
set(X);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"y") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
set(Y);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"z") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
set(Z);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"vx") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
set(VX);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"vy") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
set(VY);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"vz") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
set(VZ);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"charge") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -201,7 +200,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"mass") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->rmass_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -210,11 +209,11 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"shape") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
|
||||
else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (!atom->ellipsoid_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -223,7 +222,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"length") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->line_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -232,7 +231,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"tri") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->tri_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -241,11 +240,11 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"dipole") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
|
||||
else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -267,13 +266,13 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"spin") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
|
||||
else yvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) varparse(arg[iarg+4],4);
|
||||
if (utils::strmatch(arg[iarg+4],"^v_")) varparse(arg[iarg+4],4);
|
||||
else zvalue = utils::numeric(FLERR,arg[iarg+4],false,lmp);
|
||||
if (!atom->sp_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -295,13 +294,13 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"quat") == 0) {
|
||||
if (iarg+5 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
|
||||
else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) varparse(arg[iarg+4],4);
|
||||
if (utils::strmatch(arg[iarg+4],"^v_")) varparse(arg[iarg+4],4);
|
||||
else wvalue = utils::numeric(FLERR,arg[iarg+4],false,lmp);
|
||||
if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -320,7 +319,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"theta") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
dvalue *= MY_PI/180.0;
|
||||
@ -342,11 +341,11 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"angmom") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
|
||||
else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (!atom->angmom_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -355,11 +354,11 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"omega") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
|
||||
else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (!atom->omega_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -368,7 +367,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"diameter") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->radius_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -378,7 +377,7 @@ void Set::command(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg],"density") == 0 ||
|
||||
(strcmp(arg[iarg],"density/disc") == 0)) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->rmass_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -394,7 +393,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"volume") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->vfrac_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
@ -407,17 +406,17 @@ void Set::command(int narg, char **arg)
|
||||
ximageflag = yimageflag = zimageflag = 0;
|
||||
if (strcmp(arg[iarg+1],"NULL") != 0) {
|
||||
ximageflag = 1;
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else ximage = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
}
|
||||
if (strcmp(arg[iarg+2],"NULL") != 0) {
|
||||
yimageflag = 1;
|
||||
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
else yimage = utils::inumeric(FLERR,arg[iarg+2],false,lmp);
|
||||
}
|
||||
if (strcmp(arg[iarg+3],"NULL") != 0) {
|
||||
zimageflag = 1;
|
||||
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3);
|
||||
if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3);
|
||||
else zimage = utils::inumeric(FLERR,arg[iarg+3],false,lmp);
|
||||
}
|
||||
if (ximageflag && ximage && !domain->xperiodic)
|
||||
@ -474,7 +473,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"sph/e") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->esph_flag)
|
||||
error->all(FLERR,"Cannot set meso/e for this atom style");
|
||||
@ -483,7 +482,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"sph/cv") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->cv_flag)
|
||||
error->all(FLERR,"Cannot set meso/cv for this atom style");
|
||||
@ -492,7 +491,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"sph/rho") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->rho_flag)
|
||||
error->all(FLERR,"Cannot set meso/rho for this atom style");
|
||||
@ -502,7 +501,7 @@ void Set::command(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg],"edpd/temp") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0;
|
||||
else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (dvalue < 0.0) error->all(FLERR,"Illegal set command");
|
||||
@ -515,7 +514,7 @@ void Set::command(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg],"edpd/cv") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0;
|
||||
else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (dvalue < 0.0) error->all(FLERR,"Illegal set command");
|
||||
@ -528,7 +527,7 @@ void Set::command(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg],"cc") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0;
|
||||
else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
cc_index = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
dvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
@ -541,7 +540,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"smd/mass/density") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->smd_flag)
|
||||
error->all(FLERR,"Cannot set smd/mass/density for this atom style");
|
||||
@ -550,7 +549,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(arg[iarg],"smd/contact/radius") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->smd_flag)
|
||||
error->all(FLERR,"Cannot set smd/contact/radius "
|
||||
@ -561,7 +560,7 @@ void Set::command(int narg, char **arg)
|
||||
} else if (strcmp(arg[iarg],"dpd/theta") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0;
|
||||
else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (dvalue < 0.0) error->all(FLERR,"Illegal set command");
|
||||
@ -572,26 +571,31 @@ void Set::command(int narg, char **arg)
|
||||
iarg += 2;
|
||||
|
||||
// custom per-atom vector
|
||||
|
||||
} else if (strstr(arg[iarg],"i_") == arg[iarg] ||
|
||||
strstr(arg[iarg],"d_") == arg[iarg]) {
|
||||
|
||||
} else if (utils::strmatch(arg[iarg],"^i_")) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
int which = 0;
|
||||
if (arg[iarg][0] == 'd') which = 1;
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
else if (!which) ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
int flag;
|
||||
index_custom = atom->find_custom(&arg[iarg][2],flag);
|
||||
if (index_custom < 0 || flag != 0)
|
||||
error->all(FLERR,"Set command integer vector does not exist");
|
||||
set(IVEC);
|
||||
iarg += 2;
|
||||
|
||||
} else if (utils::strmatch(arg[iarg],"^d_")) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
|
||||
int flag,cols;
|
||||
index_custom = atom->find_custom(&arg[iarg][2],flag,cols);
|
||||
if ((!which && (index_custom < 0 || flag || cols)) ||
|
||||
(which && (index_custom < 0 || !flag || cols)))
|
||||
error->all(FLERR,"Set command per-atom custom vector does not exist");
|
||||
if (!which) set(IVEC);
|
||||
else set(DVEC);
|
||||
int flag;
|
||||
index_custom = atom->find_custom(&arg[iarg][2],flag);
|
||||
if (index_custom < 0 || flag != 1)
|
||||
error->all(FLERR,"Set command floating point vector does not exist");
|
||||
set(DVEC);
|
||||
iarg += 2;
|
||||
|
||||
// custom per-atom array, must include bracketed index
|
||||
// OLDSTYLE code
|
||||
|
||||
} else if (strstr(arg[iarg],"i2_") == arg[iarg] ||
|
||||
strstr(arg[iarg],"d2_") == arg[iarg]) {
|
||||
@ -627,7 +631,7 @@ void Set::command(int narg, char **arg)
|
||||
if (!which) set(IARRAY);
|
||||
else set(DARRAY);
|
||||
iarg += 2;
|
||||
|
||||
|
||||
} else error->all(FLERR,"Illegal set command");
|
||||
|
||||
// statistics
|
||||
@ -637,11 +641,11 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
if (comm->me == 0) {
|
||||
if (strcmp(arg[origarg],"cc") == 0)
|
||||
utils::logmesg(lmp,fmt::format(" {} settings made for {} index {}\n",
|
||||
allcount,arg[origarg],arg[origarg+1]));
|
||||
utils::logmesg(lmp," {} settings made for {} index {}\n",
|
||||
allcount,arg[origarg],arg[origarg+1]);
|
||||
else
|
||||
utils::logmesg(lmp,fmt::format(" {} settings made for {}\n",
|
||||
allcount,arg[origarg]));
|
||||
utils::logmesg(lmp," {} settings made for {}\n",
|
||||
allcount,arg[origarg]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user