update error messages for compute property/atom

This commit is contained in:
Axel Kohlmeyer
2022-08-29 22:42:20 -04:00
parent bdac6d3e05
commit f6b2846b8f

View File

@ -39,7 +39,7 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg),
index(nullptr), colindex(nullptr), pack_choice(nullptr)
{
if (narg < 4) error->all(FLERR,"Illegal compute property/atom command");
if (narg < 4) utils::missing_cmd_args(FLERR, "compute property/atom", error);
peratom_flag = 1;
nvalues = narg - 3;
@ -52,6 +52,10 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
pack_choice = new FnPtrPack[nvalues];
index = new int[nvalues];
colindex = new int[nvalues];
avec_ellipsoid = dynamic_cast<AtomVecEllipsoid *>(atom->style_match("ellipsoid"));
avec_body = dynamic_cast<AtomVecBody *>(atom->style_match("body"));
avec_line = dynamic_cast<AtomVecLine *>(atom->style_match("line"));
avec_tri = dynamic_cast<AtomVecTri *>(atom->style_match("tri"));
int i;
for (int iarg = 3; iarg < narg; iarg++) {
@ -61,8 +65,7 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
pack_choice[i] = &ComputePropertyAtom::pack_id;
} else if (strcmp(arg[iarg],"mol") == 0) {
if (!atom->molecule_flag)
error->all(FLERR,"Compute property/atom for "
"atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_molecule;
} else if (strcmp(arg[iarg],"proc") == 0) {
pack_choice[i] = &ComputePropertyAtom::pack_proc;
@ -123,217 +126,204 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[iarg],"q") == 0) {
if (!atom->q_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_q;
} else if (strcmp(arg[iarg],"mux") == 0) {
if (!atom->mu_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_mux;
} else if (strcmp(arg[iarg],"muy") == 0) {
if (!atom->mu_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_muy;
} else if (strcmp(arg[iarg],"muz") == 0) {
if (!atom->mu_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_muz;
} else if (strcmp(arg[iarg],"mu") == 0) {
if (!atom->mu_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_mu;
// pack magnetic variables
} else if (strcmp(arg[iarg],"spx") == 0) {
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_spx;
} else if (strcmp(arg[iarg],"spy") == 0) {
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_spy;
} else if (strcmp(arg[iarg],"spz") == 0) {
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_spz;
} else if (strcmp(arg[iarg],"sp") == 0) {
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_sp;
} else if (strcmp(arg[iarg],"fmx") == 0) {
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_fmx;
} else if (strcmp(arg[iarg],"fmy") == 0) {
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_fmy;
} else if (strcmp(arg[iarg],"fmz") == 0) {
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_fmz;
// bond count
} else if (strcmp(arg[iarg],"nbonds") == 0) {
if (!atom->molecule_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_nbonds;
// finite-size particles
} else if (strcmp(arg[iarg],"radius") == 0) {
if (!atom->radius_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_radius;
} else if (strcmp(arg[iarg],"diameter") == 0) {
if (!atom->radius_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_diameter;
} else if (strcmp(arg[iarg],"omegax") == 0) {
if (!atom->omega_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_omegax;
} else if (strcmp(arg[iarg],"omegay") == 0) {
if (!atom->omega_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_omegay;
} else if (strcmp(arg[iarg],"omegaz") == 0) {
if (!atom->omega_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_omegaz;
} else if (strcmp(arg[iarg],"angmomx") == 0) {
if (!atom->angmom_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_angmomx;
} else if (strcmp(arg[iarg],"angmomy") == 0) {
if (!atom->angmom_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_angmomy;
} else if (strcmp(arg[iarg],"angmomz") == 0) {
if (!atom->angmom_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_angmomz;
} else if (strcmp(arg[iarg],"shapex") == 0) {
avec_ellipsoid = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
if (!avec_ellipsoid) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_ellipsoid)
error->all(FLERR,"Compute property/atom {} requires atom style ellipsoid", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_shapex;
} else if (strcmp(arg[iarg],"shapey") == 0) {
avec_ellipsoid = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
if (!avec_ellipsoid) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_ellipsoid)
error->all(FLERR,"Compute property/atom {} requires atom style ellipsoid", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_shapey;
} else if (strcmp(arg[iarg],"shapez") == 0) {
avec_ellipsoid = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
if (!avec_ellipsoid) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_ellipsoid)
error->all(FLERR,"Compute property/atom {} requires atom style ellipsoid", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_shapez;
} else if (strcmp(arg[iarg],"quatw") == 0) {
avec_ellipsoid = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
avec_body = dynamic_cast<AtomVecBody *>( atom->style_match("body"));
if (!avec_ellipsoid && !avec_body && !atom->quat_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_quatw;
} else if (strcmp(arg[iarg],"quati") == 0) {
avec_ellipsoid = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
avec_body = dynamic_cast<AtomVecBody *>( atom->style_match("body"));
if (!avec_ellipsoid && !avec_body && !atom->quat_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_quati;
} else if (strcmp(arg[iarg],"quatj") == 0) {
avec_ellipsoid = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
avec_body = dynamic_cast<AtomVecBody *>( atom->style_match("body"));
if (!avec_ellipsoid && !avec_body && !atom->quat_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_quatj;
} else if (strcmp(arg[iarg],"quatk") == 0) {
avec_ellipsoid = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
avec_body = dynamic_cast<AtomVecBody *>( atom->style_match("body"));
if (!avec_ellipsoid && !avec_body && !atom->quat_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_quatk;
} else if (strcmp(arg[iarg],"tqx") == 0) {
if (!atom->torque_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_tqx;
} else if (strcmp(arg[iarg],"tqy") == 0) {
if (!atom->torque_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_tqy;
} else if (strcmp(arg[iarg],"tqz") == 0) {
if (!atom->torque_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
error->all(FLERR,"Compute property/atom {} is not available", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_tqz;
} else if (strcmp(arg[iarg],"end1x") == 0) {
avec_line = dynamic_cast<AtomVecLine *>( atom->style_match("line"));
if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_line)
error->all(FLERR,"Compute property/atom {} requires atom style line", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_end1x;
} else if (strcmp(arg[iarg],"end1y") == 0) {
avec_line = dynamic_cast<AtomVecLine *>( atom->style_match("line"));
if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_line)
error->all(FLERR,"Compute property/atom {} requires atom style line", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_end1y;
} else if (strcmp(arg[iarg],"end1z") == 0) {
avec_line = dynamic_cast<AtomVecLine *>( atom->style_match("line"));
if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_line)
error->all(FLERR,"Compute property/atom {} requires atom style line", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_end1z;
} else if (strcmp(arg[iarg],"end2x") == 0) {
avec_line = dynamic_cast<AtomVecLine *>( atom->style_match("line"));
if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_line)
error->all(FLERR,"Compute property/atom {} requires atom style line", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_end2x;
} else if (strcmp(arg[iarg],"end2y") == 0) {
avec_line = dynamic_cast<AtomVecLine *>( atom->style_match("line"));
if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_line)
error->all(FLERR,"Compute property/atom {} requires atom style line", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_end2y;
} else if (strcmp(arg[iarg],"end2z") == 0) {
avec_line = dynamic_cast<AtomVecLine *>( atom->style_match("line"));
if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_line)
error->all(FLERR,"Compute property/atom {} requires atom style line", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_end2z;
} else if (strcmp(arg[iarg],"corner1x") == 0) {
avec_tri = dynamic_cast<AtomVecTri *>( atom->style_match("tri"));
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_tri)
error->all(FLERR,"Compute property/atom {} requires atom style tri", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_corner1x;
} else if (strcmp(arg[iarg],"corner1y") == 0) {
avec_tri = dynamic_cast<AtomVecTri *>( atom->style_match("tri"));
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_tri)
error->all(FLERR,"Compute property/atom {} requires atom style tri", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_corner1y;
} else if (strcmp(arg[iarg],"corner1z") == 0) {
avec_tri = dynamic_cast<AtomVecTri *>( atom->style_match("tri"));
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_tri)
error->all(FLERR,"Compute property/atom {} requires atom style tri", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_corner1z;
} else if (strcmp(arg[iarg],"corner2x") == 0) {
avec_tri = dynamic_cast<AtomVecTri *>( atom->style_match("tri"));
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_tri)
error->all(FLERR,"Compute property/atom {} requires atom style tri", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_corner2x;
} else if (strcmp(arg[iarg],"corner2y") == 0) {
avec_tri = dynamic_cast<AtomVecTri *>( atom->style_match("tri"));
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_tri)
error->all(FLERR,"Compute property/atom {} requires atom style tri", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_corner2y;
} else if (strcmp(arg[iarg],"corner2z") == 0) {
avec_tri = dynamic_cast<AtomVecTri *>( atom->style_match("tri"));
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_tri)
error->all(FLERR,"Compute property/atom {} requires atom style tri", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_corner2z;
} else if (strcmp(arg[iarg],"corner3x") == 0) {
avec_tri = dynamic_cast<AtomVecTri *>( atom->style_match("tri"));
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_tri)
error->all(FLERR,"Compute property/atom {} requires atom style tri", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_corner3x;
} else if (strcmp(arg[iarg],"corner3y") == 0) {
avec_tri = dynamic_cast<AtomVecTri *>( atom->style_match("tri"));
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_tri)
error->all(FLERR,"Compute property/atom {} requires atom style tri", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_corner3y;
} else if (strcmp(arg[iarg],"corner3z") == 0) {
avec_tri = dynamic_cast<AtomVecTri *>( atom->style_match("tri"));
if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
if (!avec_tri)
error->all(FLERR,"Compute property/atom {} requires atom style tri", arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_corner3z;
} else if (strcmp(arg[iarg],"nbonds") == 0) {
if (!atom->molecule_flag)
error->all(FLERR,"Compute property/atom for atom property that isn't allocated");
pack_choice[i] = &ComputePropertyAtom::pack_nbonds;
// custom per-atom vector or array
} else if (utils::strmatch(arg[iarg],"^[id]2?_")) {
@ -386,7 +376,7 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
} else {
index[i] = atom->avec->property_atom(arg[iarg]);
if (index[i] < 0)
error->all(FLERR,"Invalid keyword in compute property/atom command");
error->all(FLERR,"Invalid keyword {} in compute property/atom command",arg[iarg]);
pack_choice[i] = &ComputePropertyAtom::pack_atom_style;
}
}
@ -398,9 +388,9 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
ComputePropertyAtom::~ComputePropertyAtom()
{
delete [] pack_choice;
delete [] index;
delete [] colindex;
delete[] pack_choice;
delete[] index;
delete[] colindex;
memory->destroy(vector_atom);
memory->destroy(array_atom);
}