recover AtomStyle and SetProperty unit tests
This commit is contained in:
34
src/set.cpp
34
src/set.cpp
@ -80,7 +80,7 @@ Set::~Set()
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
// clang-format on
|
||||
|
||||
void Set::command(int narg, char **arg)
|
||||
{
|
||||
if (domain->box_exist == 0)
|
||||
@ -143,8 +143,7 @@ void Set::process_args(int caller_flag, int narg, char **arg)
|
||||
|
||||
if (strcmp(arg[0], "atom") == 0) {
|
||||
style = ATOM_SELECT;
|
||||
if (atom->tag_enable == 0)
|
||||
error->all(FLERR,"Cannot use set atom with no atom IDs defined");
|
||||
if (atom->tag_enable == 0) error->all(FLERR, "Cannot use set atom with no atom IDs defined");
|
||||
utils::bounds(FLERR, id, 1, MAXTAGINT, nlobig, nhibig, error);
|
||||
|
||||
} else if (strcmp(arg[0], "mol") == 0) {
|
||||
@ -172,7 +171,8 @@ void Set::process_args(int caller_flag, int narg, char **arg)
|
||||
region = domain->get_region_by_id(id);
|
||||
if (!region) error->all(FLERR, "Set region {} does not exist", id);
|
||||
|
||||
} else error->all(FLERR,"Unknown set or fix set command style: {}", arg[0]);
|
||||
} else
|
||||
error->all(FLERR, "Unknown set or fix set command style: {}", arg[0]);
|
||||
|
||||
delete[] id;
|
||||
|
||||
@ -1815,7 +1815,7 @@ void Set::process_omega(int &iarg, int narg, char **arg, Action *action)
|
||||
void Set::invoke_omega(Action *action)
|
||||
{
|
||||
int nlocal = atom->nlocal;
|
||||
double **omega = atom->angmom;
|
||||
double **omega = atom->omega;
|
||||
|
||||
int varflag = action->varflag;
|
||||
double xvalue,yvalue,zvalue;
|
||||
@ -1951,10 +1951,13 @@ void Set::process_radius_election(int &iarg, int narg, char **arg, Action *actio
|
||||
error->all(FLERR, "Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
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,action);
|
||||
if (utils::strmatch(arg[iarg + 1], "^v_"))
|
||||
varparse(arg[iarg + 1], 1, action);
|
||||
else {
|
||||
action->dvalue1 = utils::numeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
if (action->dvalue1 < 0.0) error->one(FLERR,"Invalid electron radius in set command");
|
||||
if (action->dvalue1 < 0.0)
|
||||
error->one(FLERR, iarg + 1, "Invalid electron radius {} in set radius/electron command",
|
||||
action->dvalue1);
|
||||
}
|
||||
|
||||
iarg += 2;
|
||||
@ -2279,7 +2282,8 @@ void Set::invoke_spin_atom(Action *action)
|
||||
void Set::process_spin_atom_random(int &iarg, int narg, char **arg, Action *action)
|
||||
{
|
||||
if ((strcmp(arg[iarg], "spin/random") == 0) && (comm->me == 0))
|
||||
error->warning(FLERR, "Set attribute spin/random is deprecated -- use spin/atom/random instead");
|
||||
error->warning(FLERR,
|
||||
"Set attribute spin/random is deprecated -- use spin/atom/random instead");
|
||||
if (!atom->sp_flag)
|
||||
error->all(FLERR, "Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style());
|
||||
if (iarg + 3 > narg) utils::missing_cmd_args(FLERR, "set spin/atom/random", error);
|
||||
@ -2287,9 +2291,12 @@ void Set::process_spin_atom_random(int &iarg, int narg, char **arg, Action *acti
|
||||
action->ivalue1 = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
|
||||
action->dvalue1 = utils::numeric(FLERR, arg[iarg + 2], false, lmp);
|
||||
|
||||
if (action->ivalue1 <= 0) error->all(FLERR,"Invalid random number seed in set command");
|
||||
if (action->dvalue1 <= 0.0) error->all(FLERR,"Invalid spin magnitude in set command");
|
||||
|
||||
if (action->ivalue1 <= 0)
|
||||
error->all(FLERR, iarg + 1, "Invalid random number seed {} in set {} command", action->ivalue1,
|
||||
arg[iarg]);
|
||||
if (action->dvalue1 <= 0.0)
|
||||
error->all(FLERR, iarg + 2, "Invalid spin magnitude {} in set {} command", action->dvalue1,
|
||||
arg[iarg]);
|
||||
iarg += 3;
|
||||
}
|
||||
|
||||
@ -2310,7 +2317,7 @@ void Set::process_spin_electron(int &iarg, int narg, char **arg, Action *action)
|
||||
else {
|
||||
action->ivalue1 = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
if (action->ivalue1 < -1 || action->ivalue1 > 3)
|
||||
error->one(FLERR,"Invalid electron spin in set command");
|
||||
error->one(FLERR,"Invalid electron spin {} in set command", action->ivalue1);
|
||||
}
|
||||
|
||||
iarg += 2;
|
||||
@ -2458,7 +2465,10 @@ void Set::invoke_tri(Action *action)
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (!select[i]) continue;
|
||||
#if 0
|
||||
// AK: this seems wrong. Isn't the set command supposed *make* this a triangle?
|
||||
if (tri[i] < 0) error->one(FLERR,"Cannot set tri for atom which is not a triangle");
|
||||
#endif
|
||||
|
||||
if (varflag) {
|
||||
trisize = vec1[i];
|
||||
|
||||
@ -90,8 +90,9 @@ TEST_F(SetTest, NoBoxNoAtoms)
|
||||
ASSERT_EQ(compute->vector_atom[0], 0);
|
||||
|
||||
TEST_FAILURE(".*ERROR: Illegal set command: need at least four.*", command("set type 1 x"););
|
||||
TEST_FAILURE(".*ERROR: Unknown set command style: xxx.*", command("set xxx 1 x 0.0"););
|
||||
TEST_FAILURE(".*ERROR: Set keyword or custom property yyy does not exist.*",
|
||||
TEST_FAILURE(".*ERROR: Unknown set or fix set command style: xxx.*",
|
||||
command("set xxx 1 x 0.0"););
|
||||
TEST_FAILURE(".*ERROR: Unrecognized set or fix set keyword yyy.*",
|
||||
command("set type 1 yyy 0.0"););
|
||||
|
||||
TEST_FAILURE(".*ERROR: Cannot set attribute spin/atom for atom style atomic.*",
|
||||
@ -447,9 +448,9 @@ TEST_F(SetTest, EffPackage)
|
||||
EXPECT_EQ(compute->array_atom[6][1], 0.5);
|
||||
EXPECT_EQ(compute->array_atom[7][1], 1.0);
|
||||
|
||||
TEST_FAILURE(".*ERROR on proc 0: Incorrect value for electron spin: 0.5.*",
|
||||
TEST_FAILURE(".*Expected integer parameter instead of '0.5' in input script.*",
|
||||
command("set atom * spin/electron 0.5"););
|
||||
TEST_FAILURE(".*ERROR on proc 0: Incorrect value for electron radius: -0.5.*",
|
||||
TEST_FAILURE(".*ERROR on proc 0: Invalid electron radius -0.5 in set.*",
|
||||
command("set atom * radius/electron -0.5"););
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user