various coding style updates

This commit is contained in:
Axel Kohlmeyer
2024-01-19 13:00:29 -05:00
parent e0967af6e8
commit 39d21473a0
14 changed files with 33 additions and 53 deletions

View File

@ -100,8 +100,6 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) :
omega_mass_flag = 0; omega_mass_flag = 0;
etap_mass_flag = 0; etap_mass_flag = 0;
flipflag = 1; flipflag = 1;
dipole_flag = 0;
dlm_flag = 0;
tcomputeflag = 0; tcomputeflag = 0;
pcomputeflag = 0; pcomputeflag = 0;
@ -264,13 +262,6 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) :
if (p_flag[2] && domain->zperiodic == 0) if (p_flag[2] && domain->zperiodic == 0)
error->all(FLERR,"Cannot use fix bocs on a non-periodic dimension"); error->all(FLERR,"Cannot use fix bocs on a non-periodic dimension");
if (dipole_flag) {
if (!atom->sphere_flag)
error->all(FLERR,"Using update dipole flag requires atom style sphere");
if (!atom->mu_flag)
error->all(FLERR,"Using update dipole flag requires atom attribute mu");
}
if ((tstat_flag && t_period <= 0.0) || if ((tstat_flag && t_period <= 0.0) ||
(p_flag[0] && p_period[0] <= 0.0) || (p_flag[0] && p_period[0] <= 0.0) ||
(p_flag[1] && p_period[1] <= 0.0) || (p_flag[1] && p_period[1] <= 0.0) ||

View File

@ -129,8 +129,6 @@ class FixBocs : public Fix {
int eta_mass_flag; // 1 if eta_mass updated, 0 if not. int eta_mass_flag; // 1 if eta_mass updated, 0 if not.
int omega_mass_flag; // 1 if omega_mass updated, 0 if not. int omega_mass_flag; // 1 if omega_mass updated, 0 if not.
int etap_mass_flag; // 1 if etap_mass updated, 0 if not. int etap_mass_flag; // 1 if etap_mass updated, 0 if not.
int dipole_flag; // 1 if dipole is updated, 0 if not.
int dlm_flag; // 1 if using the DLM rotational integrator, 0 if not
int scaleyz; // 1 if yz scaled with lz int scaleyz; // 1 if yz scaled with lz
int scalexz; // 1 if xz scaled with lz int scalexz; // 1 if xz scaled with lz

View File

@ -28,7 +28,7 @@ using namespace MathExtra;
FixNVEBPMSphere::FixNVEBPMSphere(LAMMPS *_lmp, int narg, char **arg) : FixNVE(_lmp, narg, arg) FixNVEBPMSphere::FixNVEBPMSphere(LAMMPS *_lmp, int narg, char **arg) : FixNVE(_lmp, narg, arg)
{ {
if (narg < 3) error->all(FLERR, "Illegal fix nve/bpm/sphere command"); if (narg < 3) utils::missing_cmd_args(FLERR, "fix nve/bpm/sphere", error);
time_integrate = 1; time_integrate = 1;
@ -45,7 +45,7 @@ FixNVEBPMSphere::FixNVEBPMSphere(LAMMPS *_lmp, int narg, char **arg) : FixNVE(_l
error->all(FLERR, "Fix nve/bpm/sphere disc requires 2d simulation"); error->all(FLERR, "Fix nve/bpm/sphere disc requires 2d simulation");
iarg++; iarg++;
} else } else
error->all(FLERR, "Illegal fix nve/bpm/sphere command"); error->all(FLERR, "Illegal fix nve/bpm/sphere keyword {}", arg[iarg]);
} }
inv_inertia = 1.0 / inertia; inv_inertia = 1.0 / inertia;

View File

@ -204,7 +204,7 @@ FixBrownianBase::~FixBrownianBase()
delete[] gamma_r_invsqrt; delete[] gamma_r_invsqrt;
} }
if (dipole_flag) { delete[] dipole_body; } if (dipole_flag) delete[] dipole_body;
delete rng; delete rng;
} }

View File

@ -36,10 +36,10 @@ FixBrownianSphere::FixBrownianSphere(LAMMPS *lmp, int narg, char **arg) :
FixBrownianBase(lmp, narg, arg) FixBrownianBase(lmp, narg, arg)
{ {
if (gamma_t_eigen_flag || gamma_r_eigen_flag) { if (gamma_t_eigen_flag || gamma_r_eigen_flag) {
error->all(FLERR, "Illegal fix brownian command."); error->all(FLERR, "Illegal fix brownian/sphere command.");
} }
if (!gamma_t_flag || !gamma_r_flag) { error->all(FLERR, "Illegal fix brownian command."); } if (!gamma_t_flag || !gamma_r_flag) error->all(FLERR, "Illegal fix brownian/sphere command.");
if (!atom->mu_flag) error->all(FLERR, "Fix brownian/sphere requires atom attribute mu"); if (!atom->mu_flag) error->all(FLERR, "Fix brownian/sphere requires atom attribute mu");
if (!atom->sphere_flag) error->all(FLERR, "Fix brownian/sphere requires atom style sphere"); if (!atom->sphere_flag) error->all(FLERR, "Fix brownian/sphere requires atom style sphere");
} }

View File

@ -91,7 +91,6 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) :
omega_mass_flag = 0; omega_mass_flag = 0;
etap_mass_flag = 0; etap_mass_flag = 0;
flipflag = 1; flipflag = 1;
dlm_flag = 0;
tcomputeflag = 0; tcomputeflag = 0;
pcomputeflag = 0; pcomputeflag = 0;

View File

@ -117,8 +117,6 @@ class FixNPTCauchy : public Fix {
int eta_mass_flag; // 1 if eta_mass updated, 0 if not. int eta_mass_flag; // 1 if eta_mass updated, 0 if not.
int omega_mass_flag; // 1 if omega_mass updated, 0 if not. int omega_mass_flag; // 1 if omega_mass updated, 0 if not.
int etap_mass_flag; // 1 if etap_mass updated, 0 if not. int etap_mass_flag; // 1 if etap_mass updated, 0 if not.
int dipole_flag; // 1 if dipole is updated, 0 if not.
int dlm_flag; // 1 if using the DLM rotational integrator, 0 if not
int scaleyz; // 1 if yz scaled with lz int scaleyz; // 1 if yz scaled with lz
int scalexz; // 1 if xz scaled with lz int scalexz; // 1 if xz scaled with lz

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -174,8 +173,7 @@ int ComputeContactAtom::pack_reverse_comm(int n, int first, double *buf)
m = 0; m = 0;
last = first + n; last = first + n;
for (i = first; i < last; i++) for (i = first; i < last; i++) buf[m++] = contact[i];
buf[m++] = contact[i];
return m; return m;
} }

View File

@ -42,7 +42,7 @@ FixDampingCundall::FixDampingCundall(LAMMPS *_lmp, int narg, char **arg) :
if (!atom->sphere_flag) error->all(FLERR, "Fix damping/cundall requires atom style sphere"); if (!atom->sphere_flag) error->all(FLERR, "Fix damping/cundall requires atom style sphere");
if (narg < 5) error->all(FLERR, "Illegal fix damping/cundall command"); if (narg < 5) utils::missing_cmd_args(FLERR, "fix damping/cundall", error);
gamma_lin = utils::numeric(FLERR, arg[3], false, lmp); gamma_lin = utils::numeric(FLERR, arg[3], false, lmp);
gamma_ang = utils::numeric(FLERR, arg[4], false, lmp); gamma_ang = utils::numeric(FLERR, arg[4], false, lmp);

View File

@ -55,7 +55,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), idregion(nullptr), tstr(nullptr), history_one(nullptr), Fix(lmp, narg, arg), idregion(nullptr), tstr(nullptr), history_one(nullptr),
fix_rigid(nullptr), mass_rigid(nullptr) fix_rigid(nullptr), mass_rigid(nullptr)
{ {
if (narg < 4) error->all(FLERR,"Illegal fix wall/gran command"); if (narg < 4) utils::missing_cmd_args(FLERR,"fix wall/gran", error);
if (!atom->sphere_flag) if (!atom->sphere_flag)
error->all(FLERR,"Fix wall/gran requires atom style sphere"); error->all(FLERR,"Fix wall/gran requires atom style sphere");
@ -110,7 +110,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
model->limit_damping = 1; model->limit_damping = 1;
iarg += 1; iarg += 1;
} else { } else {
error->all(FLERR, "Illegal fix wall/gran command"); error->all(FLERR, "Unknown fix wall/gran keyword {}", arg[iarg]);
} }
} }
} }

View File

@ -81,7 +81,7 @@ FixWallGranOld::FixWallGranOld(LAMMPS *lmp, int narg, char **arg) :
else if (strcmp(arg[3],"hooke/history") == 0) pairstyle = HOOKE_HISTORY; else if (strcmp(arg[3],"hooke/history") == 0) pairstyle = HOOKE_HISTORY;
else if (strcmp(arg[3],"hertz/history") == 0) pairstyle = HERTZ_HISTORY; else if (strcmp(arg[3],"hertz/history") == 0) pairstyle = HERTZ_HISTORY;
else if (strcmp(arg[3],"granular") == 0) pairstyle = GRANULAR; else if (strcmp(arg[3],"granular") == 0) pairstyle = GRANULAR;
else error->all(FLERR,"Invalid fix wall/gran interaction style"); else error->all(FLERR,"Invalid fix {} interaction style: {}", style, arg[3]);
use_history = restart_peratom = 1; use_history = restart_peratom = 1;
if (pairstyle == HOOKE) use_history = restart_peratom = 0; if (pairstyle == HOOKE) use_history = restart_peratom = 0;

View File

@ -60,13 +60,10 @@ AtomVecSphere::AtomVecSphere(LAMMPS *lmp) : AtomVec(lmp)
void AtomVecSphere::process_args(int narg, char **arg) void AtomVecSphere::process_args(int narg, char **arg)
{ {
if (narg != 0 && narg != 1) error->all(FLERR, "Illegal atom_style sphere command"); if (narg > 1) error->all(FLERR, "Illegal atom_style sphere command");
radvary = 0; radvary = 0;
if (narg == 1) { if (narg == 1) radvary = utils::logical(FLERR, arg[0], true, lmp);
radvary = utils::numeric(FLERR, arg[0], true, lmp);
if (radvary < 0 || radvary > 1) error->all(FLERR, "Illegal atom_style sphere command");
}
// dynamic particle radius and mass must be communicated every step // dynamic particle radius and mass must be communicated every step

View File

@ -46,8 +46,8 @@ using namespace FixConst;
enum { NOBIAS, BIAS }; enum { NOBIAS, BIAS };
enum { CONSTANT, EQUAL, ATOM }; enum { CONSTANT, EQUAL, ATOM };
#define SINERTIA 0.4 // moment of inertia prefactor for sphere static constexpr double SINERTIA = 0.4; // moment of inertia prefactor for sphere
#define EINERTIA 0.2 // moment of inertia prefactor for ellipsoid static constexpr double EINERTIA = 0.2; // moment of inertia prefactor for ellipsoid
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -801,8 +801,7 @@ void FixLangevin::compute_target()
for (int i = 0; i < nlocal; i++) for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) if (mask[i] & groupbit)
if (tforce[i] < 0.0) if (tforce[i] < 0.0)
error->one(FLERR, error->one(FLERR, "Fix langevin variable returned negative temperature");
"Fix langevin variable returned negative temperature");
} }
modify->addstep_compute(update->ntimestep + 1); modify->addstep_compute(update->ntimestep + 1);
} }

View File

@ -38,7 +38,7 @@ enum { LJ93, LJ126, LJ1043, COLLOID, HARMONIC, MORSE };
FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) : FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), idregion(nullptr), region(nullptr) Fix(lmp, narg, arg), idregion(nullptr), region(nullptr)
{ {
if (narg < 8) error->all(FLERR, "Illegal fix wall/region command"); if (narg < 8) utils::missing_cmd_args(FLERR, "fix wall/region", error);
scalar_flag = 1; scalar_flag = 1;
vector_flag = 1; vector_flag = 1;
@ -70,12 +70,12 @@ FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) :
else if (strcmp(arg[4], "morse") == 0) else if (strcmp(arg[4], "morse") == 0)
style = MORSE; style = MORSE;
else else
error->all(FLERR, "Illegal fix wall/region command"); error->all(FLERR, "Unknown fix wall/region style {}", arg[4]);
if (style != COLLOID) dynamic_group_allow = 1; if (style != COLLOID) dynamic_group_allow = 1;
if (style == MORSE) { if (style == MORSE) {
if (narg != 9) error->all(FLERR, "Illegal fix wall/region command"); if (narg != 9) error->all(FLERR, "Illegal fix wall/region morse command");
epsilon = utils::numeric(FLERR, arg[5], false, lmp); epsilon = utils::numeric(FLERR, arg[5], false, lmp);
alpha = utils::numeric(FLERR, arg[6], false, lmp); alpha = utils::numeric(FLERR, arg[6], false, lmp);