From 1359c52f302aba77a79a8afb43f74ba7c55f03ba Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 27 Feb 2024 23:42:24 -0500 Subject: [PATCH] include-what-you-use updates --- src/angle_write.cpp | 1 - src/atom_vec_sphere.cpp | 2 -- src/compute_aggregate_atom.cpp | 1 - src/compute_cluster_atom.cpp | 1 - src/compute_cna_atom.cpp | 1 - src/compute_count_type.cpp | 4 ++-- src/compute_dipole_chunk.h | 3 --- src/compute_erotate_sphere_atom.cpp | 35 ++++++++++++++--------------- src/compute_ke_atom.cpp | 2 +- src/dihedral_write.cpp | 1 - src/dump_grid.cpp | 1 - src/fix_deform.cpp | 1 - src/fix_enforce2d.cpp | 1 - src/fix_pair.cpp | 2 ++ src/fix_press_langevin.cpp | 1 - src/fix_vector.cpp | 2 ++ src/fix_wall_lj126.cpp | 2 -- src/fix_wall_lj93.cpp | 2 -- src/grid2d.cpp | 2 ++ src/grid3d.cpp | 2 ++ src/integrate.h | 2 +- src/lammps.cpp | 1 - src/min.h | 4 ++-- src/npair_bin.cpp | 2 ++ 24 files changed, 33 insertions(+), 43 deletions(-) diff --git a/src/angle_write.cpp b/src/angle_write.cpp index 0a0c457000..48420ae7be 100644 --- a/src/angle_write.cpp +++ b/src/angle_write.cpp @@ -25,7 +25,6 @@ #include "error.h" #include "force.h" #include "input.h" -#include "lammps.h" #include "math_const.h" #include "update.h" diff --git a/src/atom_vec_sphere.cpp b/src/atom_vec_sphere.cpp index 3e8c2fd2a3..3c7be5d3ee 100644 --- a/src/atom_vec_sphere.cpp +++ b/src/atom_vec_sphere.cpp @@ -19,8 +19,6 @@ #include "math_const.h" #include "modify.h" -#include - using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/compute_aggregate_atom.cpp b/src/compute_aggregate_atom.cpp index 5a489092b7..8c6f7165a2 100644 --- a/src/compute_aggregate_atom.cpp +++ b/src/compute_aggregate_atom.cpp @@ -31,7 +31,6 @@ #include "update.h" #include -#include using namespace LAMMPS_NS; diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index ba0f263747..0021d32e2c 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -25,7 +25,6 @@ #include "update.h" #include -#include using namespace LAMMPS_NS; diff --git a/src/compute_cna_atom.cpp b/src/compute_cna_atom.cpp index a09a671c07..b92dca8f86 100644 --- a/src/compute_cna_atom.cpp +++ b/src/compute_cna_atom.cpp @@ -29,7 +29,6 @@ #include "update.h" #include -#include using namespace LAMMPS_NS; diff --git a/src/compute_count_type.cpp b/src/compute_count_type.cpp index 3d4815f9ff..d430b23e11 100644 --- a/src/compute_count_type.cpp +++ b/src/compute_count_type.cpp @@ -14,12 +14,12 @@ #include "compute_count_type.h" #include "atom.h" -#include "domain.h" #include "error.h" #include "force.h" -#include "group.h" #include "update.h" +#include + using namespace LAMMPS_NS; enum { ATOM, BOND, ANGLE, DIHEDRAL, IMPROPER }; diff --git a/src/compute_dipole_chunk.h b/src/compute_dipole_chunk.h index 603e6a4353..3ed875283f 100644 --- a/src/compute_dipole_chunk.h +++ b/src/compute_dipole_chunk.h @@ -23,7 +23,6 @@ ComputeStyle(dipole/chunk,ComputeDipoleChunk); #include "compute_chunk.h" namespace LAMMPS_NS { -class Fix; class ComputeDipoleChunk : public ComputeChunk { public: @@ -43,8 +42,6 @@ class ComputeDipoleChunk : public ComputeChunk { void allocate() override; }; - } // namespace LAMMPS_NS - #endif #endif diff --git a/src/compute_erotate_sphere_atom.cpp b/src/compute_erotate_sphere_atom.cpp index b1aca68614..fa1ce8a180 100644 --- a/src/compute_erotate_sphere_atom.cpp +++ b/src/compute_erotate_sphere_atom.cpp @@ -12,28 +12,25 @@ ------------------------------------------------------------------------- */ #include "compute_erotate_sphere_atom.h" -#include + #include "atom.h" -#include "update.h" -#include "modify.h" #include "comm.h" +#include "error.h" #include "force.h" #include "memory.h" -#include "error.h" +#include "modify.h" +#include "update.h" using namespace LAMMPS_NS; -static constexpr double INERTIA = 0.4; // moment of inertia prefactor for sphere +static constexpr double INERTIA = 0.4; // moment of inertia prefactor for sphere /* ---------------------------------------------------------------------- */ -ComputeErotateSphereAtom:: -ComputeErotateSphereAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), - erot(nullptr) +ComputeErotateSphereAtom::ComputeErotateSphereAtom(LAMMPS *lmp, int narg, char **arg) : + Compute(lmp, narg, arg), erot(nullptr) { - if (narg != 3) - error->all(FLERR,"Illegal compute erotate/sphere//atom command"); + if (narg != 3) error->all(FLERR, "Illegal compute erotate/sphere//atom command"); peratom_flag = 1; size_peratom_cols = 0; @@ -41,9 +38,9 @@ ComputeErotateSphereAtom(LAMMPS *lmp, int narg, char **arg) : // error check if (!atom->omega_flag) - error->all(FLERR,"Compute erotate/sphere/atom requires atom attribute omega"); + error->all(FLERR, "Compute erotate/sphere/atom requires atom attribute omega"); if (!atom->radius_flag) - error->all(FLERR,"Compute erotate/sphere/atom requires atom attribute radius"); + error->all(FLERR, "Compute erotate/sphere/atom requires atom attribute radius"); nmax = 0; } @@ -76,7 +73,7 @@ void ComputeErotateSphereAtom::compute_peratom() if (atom->nmax > nmax) { memory->destroy(erot); nmax = atom->nmax; - memory->create(erot,nmax,"erotate/sphere/atom:erot"); + memory->create(erot, nmax, "erotate/sphere/atom:erot"); vector_atom = erot; } @@ -91,10 +88,12 @@ void ComputeErotateSphereAtom::compute_peratom() for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - erot[i] = (omega[i][0]*omega[i][0] + omega[i][1]*omega[i][1] + - omega[i][2]*omega[i][2]) * radius[i]*radius[i]*rmass[i]; + erot[i] = + (omega[i][0] * omega[i][0] + omega[i][1] * omega[i][1] + omega[i][2] * omega[i][2]) * + radius[i] * radius[i] * rmass[i]; erot[i] *= pfactor; - } else erot[i] = 0.0; + } else + erot[i] = 0.0; } } @@ -104,6 +103,6 @@ void ComputeErotateSphereAtom::compute_peratom() double ComputeErotateSphereAtom::memory_usage() { - double bytes = (double)nmax * sizeof(double); + double bytes = (double) nmax * sizeof(double); return bytes; } diff --git a/src/compute_ke_atom.cpp b/src/compute_ke_atom.cpp index 9a329232b3..e8ab1b8b25 100644 --- a/src/compute_ke_atom.cpp +++ b/src/compute_ke_atom.cpp @@ -12,6 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_ke_atom.h" + #include "atom.h" #include "comm.h" #include "error.h" @@ -19,7 +20,6 @@ #include "memory.h" #include "modify.h" #include "update.h" -#include using namespace LAMMPS_NS; diff --git a/src/dihedral_write.cpp b/src/dihedral_write.cpp index 375373523b..dd1ca1de6a 100644 --- a/src/dihedral_write.cpp +++ b/src/dihedral_write.cpp @@ -25,7 +25,6 @@ #include "error.h" #include "force.h" #include "input.h" -#include "lammps.h" #include "math_const.h" #include "update.h" diff --git a/src/dump_grid.cpp b/src/dump_grid.cpp index 4c89b05739..ac42a85b01 100644 --- a/src/dump_grid.cpp +++ b/src/dump_grid.cpp @@ -23,7 +23,6 @@ #include "grid3d.h" #include "memory.h" #include "modify.h" -#include "region.h" #include "update.h" #include diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index c19423d844..bb27faeaa8 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -36,7 +36,6 @@ #include #include #include -#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/fix_enforce2d.cpp b/src/fix_enforce2d.cpp index c13e2147a3..048f8de543 100644 --- a/src/fix_enforce2d.cpp +++ b/src/fix_enforce2d.cpp @@ -17,7 +17,6 @@ #include "atom.h" #include "domain.h" #include "error.h" -#include "modify.h" #include "respa.h" #include "update.h" diff --git a/src/fix_pair.cpp b/src/fix_pair.cpp index 66212684a8..93a88a60c9 100644 --- a/src/fix_pair.cpp +++ b/src/fix_pair.cpp @@ -23,6 +23,8 @@ #include "update.h" #include "fmt/format.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/fix_press_langevin.cpp b/src/fix_press_langevin.cpp index d8d2a3b04a..8116d66c0a 100644 --- a/src/fix_press_langevin.cpp +++ b/src/fix_press_langevin.cpp @@ -24,7 +24,6 @@ #include "error.h" #include "fix_deform.h" #include "force.h" -#include "group.h" #include "irregular.h" #include "kspace.h" #include "modify.h" diff --git a/src/fix_vector.cpp b/src/fix_vector.cpp index e18b53f615..7c75f93a3a 100644 --- a/src/fix_vector.cpp +++ b/src/fix_vector.cpp @@ -22,6 +22,8 @@ #include "update.h" #include "variable.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/fix_wall_lj126.cpp b/src/fix_wall_lj126.cpp index f0f7750edb..d526390153 100644 --- a/src/fix_wall_lj126.cpp +++ b/src/fix_wall_lj126.cpp @@ -17,8 +17,6 @@ #include "error.h" #include "math_special.h" -#include - using namespace LAMMPS_NS; using MathSpecial::powint; diff --git a/src/fix_wall_lj93.cpp b/src/fix_wall_lj93.cpp index c0c5e86ce3..dda0298be1 100644 --- a/src/fix_wall_lj93.cpp +++ b/src/fix_wall_lj93.cpp @@ -17,8 +17,6 @@ #include "error.h" #include "math_special.h" -#include - using namespace LAMMPS_NS; using MathSpecial::powint; diff --git a/src/grid2d.cpp b/src/grid2d.cpp index ea6e8e4123..e1265839f9 100644 --- a/src/grid2d.cpp +++ b/src/grid2d.cpp @@ -23,6 +23,8 @@ #include "memory.h" #include "pair.h" +#include + using namespace LAMMPS_NS; static constexpr int DELTA = 16; diff --git a/src/grid3d.cpp b/src/grid3d.cpp index 4ce1978660..f11e5d0513 100644 --- a/src/grid3d.cpp +++ b/src/grid3d.cpp @@ -24,6 +24,8 @@ #include "math_extra.h" #include "memory.h" +#include + using namespace LAMMPS_NS; static constexpr int DELTA = 16; diff --git a/src/integrate.h b/src/integrate.h index e622f6328d..d078f4a997 100644 --- a/src/integrate.h +++ b/src/integrate.h @@ -15,9 +15,9 @@ #define LMP_INTEGRATE_H #include "pointers.h" -#include "compute.h" namespace LAMMPS_NS { +class Compute; class Integrate : protected Pointers { public: diff --git a/src/lammps.cpp b/src/lammps.cpp index 3329cb8d7b..b3659fdf50 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -66,7 +66,6 @@ #include "lmpinstalledpkgs.h" #include "lmpgitversion.h" -#include "lmpfftsettings.h" #if defined(LAMMPS_UPDATE) #define UPDATE_STRING " - " LAMMPS_UPDATE diff --git a/src/min.h b/src/min.h index b94d937fa5..a395a98bbc 100644 --- a/src/min.h +++ b/src/min.h @@ -15,9 +15,9 @@ #define LMP_MIN_H #include "pointers.h" // IWYU pragma: export -#include "compute.h" namespace LAMMPS_NS { +class Compute; class Min : protected Pointers { public: @@ -116,7 +116,7 @@ class Min : protected Pointers { int narray; // # of arrays stored by fix_minimize class FixMinimize *fix_minimize; // fix that stores auxiliary data - class Compute *pe_compute; // compute for potential energy + Compute *pe_compute; // compute for potential energy double ecurrent; // current potential energy bigint ndoftotal; // total dof for entire problem diff --git a/src/npair_bin.cpp b/src/npair_bin.cpp index d3d3415bc0..2c6fbbb49b 100644 --- a/src/npair_bin.cpp +++ b/src/npair_bin.cpp @@ -23,6 +23,8 @@ #include "neigh_list.h" #include "neighbor.h" +#include + using namespace LAMMPS_NS; using namespace NeighConst;