small cleanup and modernization
This commit is contained in:
@ -38,7 +38,7 @@ enum { TYPE, RADIUS };
|
|||||||
ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) :
|
ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) :
|
||||||
Compute(lmp, narg, arg), pstyle(nullptr), pindex(nullptr), vlocal(nullptr), alocal(nullptr)
|
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;
|
local_flag = 1;
|
||||||
nvalues = narg - 3;
|
nvalues = narg - 3;
|
||||||
@ -97,7 +97,7 @@ ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// error check
|
// error check
|
||||||
|
|
||||||
if (cutstyle == RADIUS && !atom->radius_flag)
|
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()
|
// set singleflag if need to call pair->single()
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
Compute(lmp, narg, arg), vlocal(nullptr), alocal(nullptr), indices(nullptr),
|
Compute(lmp, narg, arg), vlocal(nullptr), alocal(nullptr), indices(nullptr),
|
||||||
pack_choice(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;
|
local_flag = 1;
|
||||||
nvalues = narg - 3;
|
nvalues = narg - 3;
|
||||||
@ -202,25 +202,23 @@ ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg], "cutoff") == 0) {
|
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)
|
if (strcmp(arg[iarg + 1], "type") == 0)
|
||||||
cutstyle = TYPE;
|
cutstyle = TYPE;
|
||||||
else if (strcmp(arg[iarg + 1], "radius") == 0)
|
else if (strcmp(arg[iarg + 1], "radius") == 0)
|
||||||
cutstyle = RADIUS;
|
cutstyle = RADIUS;
|
||||||
else
|
else
|
||||||
error->all(FLERR, "Illegal compute property/local command");
|
error->all(FLERR, "Unknown compute property/local cutoff keyword: {}", arg[iarg + 1]);
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else
|
} else
|
||||||
error->all(FLERR, "Illegal compute property/local command");
|
error->all(FLERR, "Unknown compute property/local keyword: {}", arg[iarg]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// error check
|
// error check
|
||||||
|
|
||||||
if (atom->molecular == 2 &&
|
if (atom->molecular == 2 &&
|
||||||
(kindflag == BOND || kindflag == ANGLE || kindflag == DIHEDRAL || kindflag == IMPROPER))
|
(kindflag == BOND || kindflag == ANGLE || kindflag == DIHEDRAL || kindflag == IMPROPER))
|
||||||
error->all(FLERR,
|
error->all(FLERR, "Compute property/local does not (yet) work with atom_style template");
|
||||||
"Compute property/local does not (yet) work "
|
|
||||||
"with atom_style template");
|
|
||||||
|
|
||||||
if (kindflag == BOND && atom->avec->bonds_allow == 0)
|
if (kindflag == BOND && atom->avec->bonds_allow == 0)
|
||||||
error->all(FLERR, "Compute property/local for property that isn't allocated");
|
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)
|
if (kindflag == IMPROPER && atom->avec->impropers_allow == 0)
|
||||||
error->all(FLERR, "Compute property/local for property that isn't allocated");
|
error->all(FLERR, "Compute property/local for property that isn't allocated");
|
||||||
if (cutstyle == RADIUS && !atom->radius_flag)
|
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;
|
nmax = 0;
|
||||||
vlocal = nullptr;
|
vlocal = nullptr;
|
||||||
@ -255,8 +253,6 @@ void ComputePropertyLocal::init()
|
|||||||
if (kindflag == NEIGH || kindflag == PAIR) {
|
if (kindflag == NEIGH || kindflag == PAIR) {
|
||||||
if (force->pair == nullptr)
|
if (force->pair == nullptr)
|
||||||
error->all(FLERR, "No pair style is defined for compute property/local");
|
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
|
// for NEIGH/PAIR need an occasional half neighbor list
|
||||||
|
|||||||
Reference in New Issue
Block a user