small cleanup and modernization

This commit is contained in:
Axel Kohlmeyer
2024-10-22 10:25:22 -04:00
parent ec5dfcd0fb
commit 83db9b8fe6
2 changed files with 8 additions and 12 deletions

View File

@ -38,7 +38,7 @@ enum { TYPE, RADIUS };
ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), pstyle(nullptr), pindex(nullptr), vlocal(nullptr), alocal(nullptr)
{
if (narg < 4) error->all(FLERR, "Illegal compute pair/local command");
if (narg < 4) utils::missing_cmd_args(FLERR, "compute pair/local", error);
local_flag = 1;
nvalues = narg - 3;
@ -97,7 +97,7 @@ ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) :
// error check
if (cutstyle == RADIUS && !atom->radius_flag)
error->all(FLERR, "This compute pair/local requires atom attribute radius");
error->all(FLERR, "Compute pair/local with ID {} requires atom attribute radius", id);
// set singleflag if need to call pair->single()

View File

@ -39,7 +39,7 @@ ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), vlocal(nullptr), alocal(nullptr), indices(nullptr),
pack_choice(nullptr)
{
if (narg < 4) error->all(FLERR, "Illegal compute property/local command");
if (narg < 4) utils::missing_cmd_args(FLERR, "compute property/local", error);
local_flag = 1;
nvalues = narg - 3;
@ -202,25 +202,23 @@ ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) :
while (iarg < narg) {
if (strcmp(arg[iarg], "cutoff") == 0) {
if (iarg + 2 > narg) error->all(FLERR, "Illegal compute property/local command");
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "compute property/local cutoff", error);
if (strcmp(arg[iarg + 1], "type") == 0)
cutstyle = TYPE;
else if (strcmp(arg[iarg + 1], "radius") == 0)
cutstyle = RADIUS;
else
error->all(FLERR, "Illegal compute property/local command");
error->all(FLERR, "Unknown compute property/local cutoff keyword: {}", arg[iarg + 1]);
iarg += 2;
} else
error->all(FLERR, "Illegal compute property/local command");
error->all(FLERR, "Unknown compute property/local keyword: {}", arg[iarg]);
}
// error check
if (atom->molecular == 2 &&
(kindflag == BOND || kindflag == ANGLE || kindflag == DIHEDRAL || kindflag == IMPROPER))
error->all(FLERR,
"Compute property/local does not (yet) work "
"with atom_style template");
error->all(FLERR, "Compute property/local does not (yet) work with atom_style template");
if (kindflag == BOND && atom->avec->bonds_allow == 0)
error->all(FLERR, "Compute property/local for property that isn't allocated");
@ -231,7 +229,7 @@ ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) :
if (kindflag == IMPROPER && atom->avec->impropers_allow == 0)
error->all(FLERR, "Compute property/local for property that isn't allocated");
if (cutstyle == RADIUS && !atom->radius_flag)
error->all(FLERR, "Compute property/local requires atom attribute radius");
error->all(FLERR, "Compute property/local with ID {} requires atom attribute radius", id);
nmax = 0;
vlocal = nullptr;
@ -255,8 +253,6 @@ void ComputePropertyLocal::init()
if (kindflag == NEIGH || kindflag == PAIR) {
if (force->pair == nullptr)
error->all(FLERR, "No pair style is defined for compute property/local");
if (force->pair->single_enable == 0)
error->all(FLERR, "Pair style does not support compute property/local");
}
// for NEIGH/PAIR need an occasional half neighbor list