Merge branch 'develop' into gran-temp
This commit is contained in:
299
src/set.cpp
299
src/set.cpp
@ -2,7 +2,7 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
LAMMPS development team: developers@lammps.org
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
@ -46,9 +46,9 @@ enum{ATOM_SELECT,MOL_SELECT,TYPE_SELECT,GROUP_SELECT,REGION_SELECT};
|
||||
|
||||
enum{TYPE,TYPE_FRACTION,TYPE_RATIO,TYPE_SUBSET,
|
||||
MOLECULE,X,Y,Z,VX,VY,VZ,CHARGE,MASS,SHAPE,LENGTH,TRI,
|
||||
DIPOLE,DIPOLE_RANDOM,SPIN,SPIN_RANDOM,QUAT,QUAT_RANDOM,
|
||||
THETA,THETA_RANDOM,ANGMOM,OMEGA,TEMPERATURE,
|
||||
DIAMETER,DENSITY,VOLUME,IMAGE,BOND,ANGLE,DIHEDRAL,IMPROPER,
|
||||
DIPOLE,DIPOLE_RANDOM,SPIN_ATOM,SPIN_RANDOM,SPIN_ELECTRON,RADIUS_ELECTRON,
|
||||
QUAT,QUAT_RANDOM,THETA,THETA_RANDOM,ANGMOM,OMEGA,TEMPERATURE,
|
||||
DIAMETER,RADIUS_ATOM,DENSITY,VOLUME,IMAGE,BOND,ANGLE,DIHEDRAL,IMPROPER,
|
||||
SPH_E,SPH_CV,SPH_RHO,EDPD_TEMP,EDPD_CV,CC,SMD_MASS_DENSITY,
|
||||
SMD_CONTACT_RADIUS,DPDTHETA,EPSILON,IVEC,DVEC,IARRAY,DARRAY};
|
||||
|
||||
@ -61,8 +61,8 @@ void Set::command(int narg, char **arg)
|
||||
if (domain->box_exist == 0)
|
||||
error->all(FLERR,"Set command before simulation box is defined");
|
||||
if (atom->natoms == 0)
|
||||
error->all(FLERR,"Set command with no atoms existing");
|
||||
if (narg < 3) error->all(FLERR,"Illegal set command");
|
||||
error->all(FLERR,"Set command on system without atoms");
|
||||
if (narg < 4) error->all(FLERR,"Illegal set command: need at least four arguments");
|
||||
|
||||
// style and ID info
|
||||
|
||||
@ -71,7 +71,7 @@ void Set::command(int narg, char **arg)
|
||||
else if (strcmp(arg[0],"type") == 0) style = TYPE_SELECT;
|
||||
else if (strcmp(arg[0],"group") == 0) style = GROUP_SELECT;
|
||||
else if (strcmp(arg[0],"region") == 0) style = REGION_SELECT;
|
||||
else error->all(FLERR,"Illegal set command");
|
||||
else error->all(FLERR,"Unknown set command style: {}", arg[0]);
|
||||
|
||||
id = utils::strdup(arg[1]);
|
||||
select = nullptr;
|
||||
@ -91,125 +91,125 @@ void Set::command(int narg, char **arg)
|
||||
origarg = iarg;
|
||||
|
||||
if (strcmp(arg[iarg],"type") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set type", error);
|
||||
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;
|
||||
|
||||
} else if (strcmp(arg[iarg],"type/fraction") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set type/fraction", error);
|
||||
newtype = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
fraction = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
ivalue = utils::inumeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (newtype <= 0 || newtype > atom->ntypes)
|
||||
error->all(FLERR,"Invalid value in set command");
|
||||
error->all(FLERR,"Invalid type value {} in set type/fraction command", newtype);
|
||||
if (fraction < 0.0 || fraction > 1.0)
|
||||
error->all(FLERR,"Invalid value in set command");
|
||||
error->all(FLERR,"Invalid fraction value {} in set type/fraction command", fraction);
|
||||
if (ivalue <= 0)
|
||||
error->all(FLERR,"Invalid random number seed in set command");
|
||||
error->all(FLERR,"Invalid random number seed {} in set type/fraction command", ivalue);
|
||||
setrandom(TYPE_FRACTION);
|
||||
iarg += 4;
|
||||
|
||||
} else if (strcmp(arg[iarg],"type/ratio") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set type/ratio", error);
|
||||
newtype = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
fraction = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
ivalue = utils::inumeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (newtype <= 0 || newtype > atom->ntypes)
|
||||
error->all(FLERR,"Invalid value in set command");
|
||||
error->all(FLERR,"Invalid type value {} in set type/ratio command", newtype);
|
||||
if (fraction < 0.0 || fraction > 1.0)
|
||||
error->all(FLERR,"Invalid value in set command");
|
||||
error->all(FLERR,"Invalid fraction value {} in set type/ratio command", fraction);
|
||||
if (ivalue <= 0)
|
||||
error->all(FLERR,"Invalid random number seed in set command");
|
||||
error->all(FLERR,"Invalid random number seed {} in set type/ratio command", ivalue);
|
||||
setrandom(TYPE_RATIO);
|
||||
iarg += 4;
|
||||
|
||||
} else if (strcmp(arg[iarg],"type/subset") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set type/subset", error);
|
||||
newtype = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
nsubset = utils::bnumeric(FLERR,arg[iarg+2],false,lmp);
|
||||
ivalue = utils::inumeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (newtype <= 0 || newtype > atom->ntypes)
|
||||
error->all(FLERR,"Invalid value in set command");
|
||||
error->all(FLERR,"Invalid type value {} in set type/subset command", newtype);
|
||||
if (nsubset < 0)
|
||||
error->all(FLERR,"Invalid value in set command");
|
||||
error->all(FLERR,"Invalid subset size {} in set type/subset command", nsubset);
|
||||
if (ivalue <= 0)
|
||||
error->all(FLERR,"Invalid random number seed in set command");
|
||||
error->all(FLERR,"Invalid random number seed {} in set type/subset command", ivalue);
|
||||
setrandom(TYPE_SUBSET);
|
||||
iarg += 4;
|
||||
|
||||
} else if (strcmp(arg[iarg],"mol") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set mol", error);
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(MOLECULE);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"x") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set x", error);
|
||||
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 (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set y", error);
|
||||
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 (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set z", error);
|
||||
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 (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set vx", error);
|
||||
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 (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set vy", error);
|
||||
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 (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set vz", error);
|
||||
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 (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set charge", error);
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(CHARGE);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"mass") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set mass", error);
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(MASS);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"shape") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set shape", error);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
@ -217,30 +217,30 @@ void Set::command(int narg, char **arg)
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(SHAPE);
|
||||
iarg += 4;
|
||||
|
||||
} else if (strcmp(arg[iarg],"length") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set length", error);
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(LENGTH);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"tri") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set tri", error);
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(TRI);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"dipole") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set dipole", error);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
@ -248,16 +248,16 @@ void Set::command(int narg, char **arg)
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(DIPOLE);
|
||||
iarg += 4;
|
||||
|
||||
} else if (strcmp(arg[iarg],"dipole/random") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "set dipole/random", error);
|
||||
ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
dvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (ivalue <= 0)
|
||||
error->all(FLERR,"Invalid random number seed in set command");
|
||||
if (dvalue <= 0.0)
|
||||
@ -265,8 +265,10 @@ void Set::command(int narg, char **arg)
|
||||
setrandom(DIPOLE_RANDOM);
|
||||
iarg += 3;
|
||||
|
||||
} else if (strcmp(arg[iarg],"spin") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
} else if ((strcmp(arg[iarg],"spin") == 0) || (strcmp(arg[iarg],"spin/atom") == 0)) {
|
||||
if ((strcmp(arg[iarg],"spin") == 0) && (comm->me == 0))
|
||||
error->warning(FLERR, "Set attribute spin is deprecated. Please use spin/atom instead.");
|
||||
if (iarg+5 > narg) utils::missing_cmd_args(FLERR, "set spin/atom", error);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
@ -275,26 +277,52 @@ void Set::command(int narg, char **arg)
|
||||
else yvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp);
|
||||
if (utils::strmatch(arg[iarg+4],"^v_")) varparse(arg[iarg+4],4);
|
||||
else zvalue = utils::numeric(FLERR,arg[iarg+4],false,lmp);
|
||||
if ((xvalue == 0.0) && (yvalue == 0.0) && (zvalue == 0.0))
|
||||
error->all(FLERR,"At least one spin vector component must be non-zero");
|
||||
if (!atom->sp_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
set(SPIN);
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (dvalue <= 0.0)
|
||||
error->all(FLERR,"Invalid spin magnitude {} in set {} command", dvalue, arg[iarg]);
|
||||
set(SPIN_ATOM);
|
||||
iarg += 5;
|
||||
|
||||
} else if (strcmp(arg[iarg],"spin/random") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal set command");
|
||||
} else if ((strcmp(arg[iarg],"spin/random") == 0) ||
|
||||
(strcmp(arg[iarg],"spin/atom/random") == 0)) {
|
||||
if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "set spin/atom/random", error);
|
||||
ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
dvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||
if ((strcmp(arg[iarg],"spin/random") == 0) && (comm->me == 0))
|
||||
error->warning(FLERR, "Set attribute spin/random is deprecated. "
|
||||
"Please use spin/atom/random instead.");
|
||||
if (!atom->sp_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (ivalue <= 0)
|
||||
error->all(FLERR,"Invalid random number seed in set command");
|
||||
error->all(FLERR,"Invalid random number seed {} in set {} command", ivalue, arg[iarg]);
|
||||
if (dvalue <= 0.0)
|
||||
error->all(FLERR,"Invalid dipole length in set command");
|
||||
error->all(FLERR,"Invalid spin magnitude {} in set {} command", dvalue, arg[iarg]);
|
||||
setrandom(SPIN_RANDOM);
|
||||
iarg += 3;
|
||||
|
||||
} else if (strcmp(arg[iarg],"radius/electron") == 0) {
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set radius/electron", error);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->eradius_flag)
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(RADIUS_ELECTRON);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"spin/electron") == 0) {
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set spin/electron", error);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->spin_flag)
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(SPIN_ELECTRON);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"quat") == 0) {
|
||||
if (iarg+5 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+5 > narg) utils::missing_cmd_args(FLERR, "set quat", error);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
@ -304,41 +332,41 @@ void Set::command(int narg, char **arg)
|
||||
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 && !atom->quat_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(QUAT);
|
||||
iarg += 5;
|
||||
|
||||
} else if (strcmp(arg[iarg],"quat/random") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set quat/random", error);
|
||||
ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag && !atom->quat_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (ivalue <= 0)
|
||||
error->all(FLERR,"Invalid random number seed in set command");
|
||||
setrandom(QUAT_RANDOM);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"theta") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set theta", error);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else dvalue = DEG2RAD * utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->line_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(THETA);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"theta/random") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set theta/random", error);
|
||||
ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (!atom->line_flag)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (ivalue <= 0)
|
||||
error->all(FLERR,"Invalid random number seed in set command");
|
||||
set(THETA_RANDOM);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"angmom") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set angmom", error);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
@ -346,12 +374,12 @@ void Set::command(int narg, char **arg)
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(ANGMOM);
|
||||
iarg += 4;
|
||||
|
||||
} else if (strcmp(arg[iarg],"omega") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set omega", error);
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2);
|
||||
@ -359,26 +387,35 @@ void Set::command(int narg, char **arg)
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(OMEGA);
|
||||
iarg += 4;
|
||||
|
||||
} else if (strcmp(arg[iarg],"diameter") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
} else if (strcmp(arg[iarg],"radius/atom") == 0) {
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set radius/atom", error);
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(RADIUS_ATOM);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"diameter") == 0) {
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set diameter", error);
|
||||
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 attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(DIAMETER);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"density") == 0 ||
|
||||
(strcmp(arg[iarg],"density/disc") == 0)) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set density", error);
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (dvalue <= 0.0) error->all(FLERR,"Invalid density in set command");
|
||||
discflag = 0;
|
||||
if (strcmp(arg[iarg],"density/disc") == 0) {
|
||||
@ -399,17 +436,17 @@ void Set::command(int narg, char **arg)
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"volume") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set volume", error);
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (dvalue <= 0.0) error->all(FLERR,"Invalid volume in set command");
|
||||
set(VOLUME);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"image") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set image", error);
|
||||
ximageflag = yimageflag = zimageflag = 0;
|
||||
if (strcmp(arg[iarg+1],"NULL") != 0) {
|
||||
ximageflag = 1;
|
||||
@ -439,74 +476,74 @@ void Set::command(int narg, char **arg)
|
||||
iarg += 4;
|
||||
|
||||
} else if (strcmp(arg[iarg],"bond") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set bond", error);
|
||||
ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (atom->avec->bonds_allow == 0)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (ivalue <= 0 || ivalue > atom->nbondtypes)
|
||||
error->all(FLERR,"Invalid value in set command");
|
||||
topology(BOND);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"angle") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set angle", error);
|
||||
ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (atom->avec->angles_allow == 0)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (ivalue <= 0 || ivalue > atom->nangletypes)
|
||||
error->all(FLERR,"Invalid value in set command");
|
||||
topology(ANGLE);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"dihedral") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set dihedral", error);
|
||||
ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (atom->avec->dihedrals_allow == 0)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (ivalue <= 0 || ivalue > atom->ndihedraltypes)
|
||||
error->all(FLERR,"Invalid value in set command");
|
||||
topology(DIHEDRAL);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"improper") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set improper", error);
|
||||
ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (atom->avec->impropers_allow == 0)
|
||||
error->all(FLERR,"Cannot set this attribute for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (ivalue <= 0 || ivalue > atom->nimpropertypes)
|
||||
error->all(FLERR,"Invalid value in set command");
|
||||
topology(IMPROPER);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"sph/e") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set sph/e", error);
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(SPH_E);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"sph/cv") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set sph/cv", error);
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(SPH_CV);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"sph/rho") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set sph/rho", error);
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(SPH_RHO);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"edpd/temp") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set edpd/temp", error);
|
||||
if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0;
|
||||
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
@ -514,12 +551,12 @@ void Set::command(int narg, char **arg)
|
||||
if (dvalue < 0.0) error->all(FLERR,"Illegal set command");
|
||||
}
|
||||
if (!atom->edpd_flag)
|
||||
error->all(FLERR,"Cannot set edpd/temp for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(EDPD_TEMP);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"edpd/cv") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set edpd/cv", error);
|
||||
if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0;
|
||||
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
@ -527,12 +564,12 @@ void Set::command(int narg, char **arg)
|
||||
if (dvalue < 0.0) error->all(FLERR,"Illegal set command");
|
||||
}
|
||||
if (!atom->edpd_flag)
|
||||
error->all(FLERR,"Cannot set edpd/cv for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(EDPD_CV);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"cc") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "set cc", error);
|
||||
if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0;
|
||||
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
@ -541,31 +578,30 @@ void Set::command(int narg, char **arg)
|
||||
if (cc_index < 1) error->all(FLERR,"Illegal set command");
|
||||
}
|
||||
if (!atom->tdpd_flag)
|
||||
error->all(FLERR,"Cannot set cc for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(CC);
|
||||
iarg += 3;
|
||||
|
||||
} else if (strcmp(arg[iarg],"smd/mass/density") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set smd/mass/density", error);
|
||||
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");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(SMD_MASS_DENSITY);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"smd/contact/radius") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set smd/contact/radius", error);
|
||||
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 "
|
||||
"for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(SMD_CONTACT_RADIUS);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"dpd/theta") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set dpd/theta", error);
|
||||
if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0;
|
||||
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
@ -573,12 +609,12 @@ void Set::command(int narg, char **arg)
|
||||
if (dvalue < 0.0) error->all(FLERR,"Illegal set command");
|
||||
}
|
||||
if (!atom->dpd_flag)
|
||||
error->all(FLERR,"Cannot set dpd/theta for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(DPDTHETA);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"epsilon") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set epsilon", error);
|
||||
if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0;
|
||||
else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else {
|
||||
@ -586,7 +622,7 @@ void Set::command(int narg, char **arg)
|
||||
if (dvalue < 0.0) error->all(FLERR,"Illegal set command");
|
||||
}
|
||||
if (!atom->dielectric_flag)
|
||||
error->all(FLERR,"Cannot set epsilon for this atom style");
|
||||
error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
set(EPSILON);
|
||||
iarg += 2;
|
||||
|
||||
@ -597,16 +633,17 @@ void Set::command(int narg, char **arg)
|
||||
int flag,cols;
|
||||
ArgInfo argi(arg[iarg],ArgInfo::DNAME|ArgInfo::INAME);
|
||||
const char *pname = argi.get_name();
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set", error);
|
||||
index_custom = atom->find_custom(argi.get_name(),flag,cols);
|
||||
if (index_custom < 0) error->all(FLERR,"Custom property {} does not exist",pname);
|
||||
if (index_custom < 0)
|
||||
error->all(FLERR,"Set keyword or custom property {} does not exist",pname);
|
||||
|
||||
switch (argi.get_type()) {
|
||||
|
||||
case ArgInfo::INAME:
|
||||
if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1);
|
||||
else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (flag != 0) error->all(FLERR,"Custom property {} is not integer",pname);
|
||||
if (flag != 0) error->all(FLERR,"Set command custom property {} is not integer",pname);
|
||||
|
||||
if (argi.get_dim() == 0) {
|
||||
if (cols > 0)
|
||||
@ -630,14 +667,15 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
if (argi.get_dim() == 0) {
|
||||
if (cols > 0)
|
||||
error->all(FLERR,"Set command custom floating-point property is not a vector");
|
||||
error->all(FLERR,"Set command custom double property {} is not a vector",pname);
|
||||
set(DVEC);
|
||||
} else if (argi.get_dim() == 1) {
|
||||
if (cols == 0)
|
||||
error->all(FLERR,"Set command custom floating-point property is not an array");
|
||||
error->all(FLERR,"Set command custom double property {} is not an array",pname);
|
||||
icol_custom = argi.get_index1();
|
||||
if (icol_custom <= 0 || icol_custom > cols)
|
||||
error->all(FLERR,"Set command per-atom custom integer array is accessed out-of-range");
|
||||
error->all(FLERR,"Set command per-atom custom double array {} is "
|
||||
"accessed out-of-range",pname);
|
||||
set(DARRAY);
|
||||
} else error->all(FLERR,"Illegal set command");
|
||||
break;
|
||||
@ -666,8 +704,8 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
// free local memory
|
||||
|
||||
delete [] id;
|
||||
delete [] select;
|
||||
delete[] id;
|
||||
delete[] select;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -677,7 +715,7 @@ void Set::command(int narg, char **arg)
|
||||
|
||||
void Set::selection(int n)
|
||||
{
|
||||
delete [] select;
|
||||
delete[] select;
|
||||
select = new int[n];
|
||||
int nlo,nhi;
|
||||
|
||||
@ -713,7 +751,7 @@ void Set::selection(int n)
|
||||
|
||||
} else if (style == GROUP_SELECT) {
|
||||
int igroup = group->find(id);
|
||||
if (igroup == -1) error->all(FLERR,"Could not find set group ID");
|
||||
if (igroup == -1) error->all(FLERR,"Could not find set group ID {}", id);
|
||||
int groupbit = group->bitmask[igroup];
|
||||
|
||||
int *mask = atom->mask;
|
||||
@ -790,10 +828,10 @@ void Set::set(int keyword)
|
||||
|
||||
// loop over selected atoms
|
||||
|
||||
auto avec_ellipsoid = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
|
||||
auto avec_line = dynamic_cast<AtomVecLine *>( atom->style_match("line"));
|
||||
auto avec_tri = dynamic_cast<AtomVecTri *>( atom->style_match("tri"));
|
||||
auto avec_body = dynamic_cast<AtomVecBody *>( atom->style_match("body"));
|
||||
auto avec_ellipsoid = dynamic_cast<AtomVecEllipsoid *>(atom->style_match("ellipsoid"));
|
||||
auto avec_line = dynamic_cast<AtomVecLine *>(atom->style_match("line"));
|
||||
auto avec_tri = dynamic_cast<AtomVecTri *>(atom->style_match("tri"));
|
||||
auto avec_body = dynamic_cast<AtomVecBody *>(atom->style_match("body"));
|
||||
|
||||
int nlocal = atom->nlocal;
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
@ -947,7 +985,9 @@ void Set::set(int keyword)
|
||||
|
||||
// set magnetic moments
|
||||
|
||||
else if (keyword == SPIN) {
|
||||
else if (keyword == SPIN_ATOM) {
|
||||
if (dvalue < 0.0)
|
||||
error->one(FLERR,"Incorrect value for atomic spin magnitude: {}", dvalue);
|
||||
double **sp = atom->sp;
|
||||
double inorm = 1.0/sqrt(xvalue*xvalue+yvalue*yvalue+zvalue*zvalue);
|
||||
sp[i][0] = inorm*xvalue;
|
||||
@ -956,6 +996,23 @@ void Set::set(int keyword)
|
||||
sp[i][3] = dvalue;
|
||||
}
|
||||
|
||||
// set electron radius
|
||||
|
||||
else if (keyword == RADIUS_ELECTRON) {
|
||||
atom->eradius[i] = dvalue;
|
||||
if (dvalue < 0.0)
|
||||
error->one(FLERR,"Incorrect value for electron radius: {}", dvalue);
|
||||
}
|
||||
|
||||
// set electron spin
|
||||
|
||||
else if (keyword == SPIN_ELECTRON) {
|
||||
if ((dvalue == -1) || (dvalue == 1) || (dvalue == 0) || (dvalue == 2) || (dvalue == 3))
|
||||
atom->spin[i] = (int)dvalue;
|
||||
else
|
||||
error->one(FLERR,"Incorrect value for electron spin: {}", dvalue);
|
||||
}
|
||||
|
||||
// set quaternion orientation of ellipsoid or tri or body particle or sphere/bpm
|
||||
// enforce quat rotation vector in z dir for 2d systems
|
||||
|
||||
@ -1113,10 +1170,10 @@ void Set::setrandom(int keyword)
|
||||
{
|
||||
int i;
|
||||
|
||||
auto avec_ellipsoid = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
|
||||
auto avec_line = dynamic_cast<AtomVecLine *>( atom->style_match("line"));
|
||||
auto avec_tri = dynamic_cast<AtomVecTri *>( atom->style_match("tri"));
|
||||
auto avec_body = dynamic_cast<AtomVecBody *>( atom->style_match("body"));
|
||||
auto avec_ellipsoid = dynamic_cast<AtomVecEllipsoid *>(atom->style_match("ellipsoid"));
|
||||
auto avec_line = dynamic_cast<AtomVecLine *>(atom->style_match("line"));
|
||||
auto avec_tri = dynamic_cast<AtomVecTri *>(atom->style_match("tri"));
|
||||
auto avec_body = dynamic_cast<AtomVecBody *>(atom->style_match("body"));
|
||||
|
||||
double **x = atom->x;
|
||||
int seed = ivalue;
|
||||
@ -1474,9 +1531,9 @@ void Set::varparse(const char *name, int m)
|
||||
int ivar = input->variable->find(name+2);
|
||||
|
||||
if (ivar < 0)
|
||||
error->all(FLERR,"Variable name for set command does not exist");
|
||||
error->all(FLERR,"Variable name {} for set command does not exist", name);
|
||||
if (!input->variable->atomstyle(ivar))
|
||||
error->all(FLERR,"Variable for set command is invalid style");
|
||||
error->all(FLERR,"Variable {} for set command is invalid style", name);
|
||||
|
||||
if (m == 1) {
|
||||
varflag1 = 1; ivar1 = ivar;
|
||||
|
||||
Reference in New Issue
Block a user