diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index a3ceb1df4f..910dccbb8a 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -36,6 +36,7 @@ This is the list of packages that may require additional steps. * :ref:`AWPMD ` * :ref:`COLVARS ` * :ref:`COMPRESS ` + * :ref:`ELECTRODE ` * :ref:`GPU ` * :ref:`H5MD ` * :ref:`INTEL ` diff --git a/doc/src/Commands_removed.rst b/doc/src/Commands_removed.rst index 8f5219fe8f..6d7e7619bd 100644 --- a/doc/src/Commands_removed.rst +++ b/doc/src/Commands_removed.rst @@ -11,6 +11,8 @@ with the direct alternative (if available) and print a warning. Fix ave/spatial and fix ave/spatial/sphere ------------------------------------------ +.. deprecated:: 11Dec2015 + The fixes ave/spatial and ave/spatial/sphere have been removed from LAMMPS since they were superseded by the more general and extensible "chunk infrastructure". Here the system is partitioned in one of many possible diff --git a/doc/src/fix_ave_spatial.rst b/doc/src/fix_ave_spatial.rst new file mode 100644 index 0000000000..96d87bd8db --- /dev/null +++ b/doc/src/fix_ave_spatial.rst @@ -0,0 +1,9 @@ +Fix ave/spatial command +======================= + +.. meta:: + :http-equiv=Refresh: 5; url='https://docs.lammps.org/Commands_removed.html#fix-ave-spatial-and-fix-ave-spatial-sphere' + +.. deprecated:: 11Dec2015 + +The `fix ave/spatial` command has been superseded by :doc:`fix ave/chunk `. diff --git a/doc/src/fix_ave_spatial_sphere.rst b/doc/src/fix_ave_spatial_sphere.rst new file mode 100644 index 0000000000..a3cacc4115 --- /dev/null +++ b/doc/src/fix_ave_spatial_sphere.rst @@ -0,0 +1,9 @@ +Fix ave/spatial command +======================= + +.. meta:: + :http-equiv=Refresh: 5; url='https://docs.lammps.org/Commands_removed.html#fix-ave-spatial-and-fix-ave-spatial-sphere' + +.. deprecated:: 11Dec2015 + +The `fix ave/spatial/sphere` command has been superseded by :doc:`fix ave/chunk `. diff --git a/doc/src/pair_coul.rst b/doc/src/pair_coul.rst index 4e0793467b..f22bc974b0 100644 --- a/doc/src/pair_coul.rst +++ b/doc/src/pair_coul.rst @@ -174,11 +174,11 @@ shifted force model described in :ref:`Fennell `, given by: E = q_iq_j \left[ \frac{\mbox{erfc} (\alpha r)}{r} - \frac{\mbox{erfc} (\alpha r_c)}{r_c} + \left( \frac{\mbox{erfc} (\alpha r_c)}{r_c^2} + \frac{2\alpha}{\sqrt{\pi}}\frac{\exp (-\alpha^2 r^2_c)}{r_c} \right)(r-r_c) \right] \qquad r < r_c -where :math:`\alpha` is the damping parameter and erfc() is the -complementary error-function. The potential corrects issues in the -Wolf model (described below) to provide consistent forces and energies -(the Wolf potential is not differentiable at the cutoff) and smooth -decay to zero. +where :math:`\alpha` is the damping parameter and *erfc()* is the +complementary error-function. The potential corrects issues in the Wolf +model (described below) to provide consistent forces and energies (the +Wolf potential is not differentiable at the cutoff) and smooth decay to +zero. ---------- @@ -192,30 +192,32 @@ summation method, described in :ref:`Wolf `, given by: \frac{1}{2} \sum_{j \neq i} \frac{q_i q_j {\rm erf}(\alpha r_{ij})}{r_{ij}} \qquad r < r_c -where :math:`\alpha` is the damping parameter, and erc() and erfc() are -error-function and complementary error-function terms. This potential -is essentially a short-range, spherically-truncated, +where :math:`\alpha` is the damping parameter, and *erf()* and *erfc()* +are error-function and complementary error-function terms. This +potential is essentially a short-range, spherically-truncated, charge-neutralized, shifted, pairwise *1/r* summation. With a manipulation of adding and subtracting a self term (for i = j) to the -first and second term on the right-hand-side, respectively, and a -small enough :math:`\alpha` damping parameter, the second term shrinks and -the potential becomes a rapidly-converging real-space summation. With -a long enough cutoff and small enough :math:`\alpha` parameter, the energy and -forces calculated by the Wolf summation method approach those of the +first and second term on the right-hand-side, respectively, and a small +enough :math:`\alpha` damping parameter, the second term shrinks and the +potential becomes a rapidly-converging real-space summation. With a +long enough cutoff and small enough :math:`\alpha` parameter, the energy +and forces calculated by the Wolf summation method approach those of the Ewald sum. So it is a means of getting effective long-range interactions with a short-range potential. ---------- -Style *coul/streitz* is the Coulomb pair interaction defined as part -of the Streitz-Mintmire potential, as described in :ref:`this paper `, in which charge distribution about an atom is modeled -as a Slater 1\ *s* orbital. More details can be found in the referenced +Style *coul/streitz* is the Coulomb pair interaction defined as part of +the Streitz-Mintmire potential, as described in :ref:`this paper +`, in which charge distribution about an atom is modeled as a +Slater 1\ *s* orbital. More details can be found in the referenced paper. To fully reproduce the published Streitz-Mintmire potential, -which is a variable charge potential, style *coul/streitz* must be -used with :doc:`pair_style eam/alloy ` (or some other -short-range potential that has been parameterized appropriately) via -the :doc:`pair_style hybrid/overlay ` command. Likewise, -charge equilibration must be performed via the :doc:`fix qeq/slater ` command. For example: +which is a variable charge potential, style *coul/streitz* must be used +with :doc:`pair_style eam/alloy ` (or some other short-range +potential that has been parameterized appropriately) via the +:doc:`pair_style hybrid/overlay ` command. Likewise, +charge equilibration must be performed via the :doc:`fix qeq/slater +` command. For example: .. code-block:: LAMMPS diff --git a/doc/src/pair_tracker.rst b/doc/src/pair_tracker.rst index 04967e952d..e34bedca2c 100644 --- a/doc/src/pair_tracker.rst +++ b/doc/src/pair_tracker.rst @@ -174,8 +174,8 @@ the specified attribute. Restrictions """""""""""" -This fix is part of the MISC package. It is only enabled if LAMMPS -was built with that package. See the :doc:`Build package +This pair style is part of the MISC package. It is only enabled if +LAMMPS was built with that package. See the :doc:`Build package ` page for more info. This pair style is currently incompatible with granular pair styles diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 75a4dc6961..ec7a54349d 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -980,7 +980,6 @@ equilization equipartitioning eradius erate -erc Ercolessi Erdmann erf diff --git a/src/AMOEBA/amoeba_charge_transfer.cpp b/src/AMOEBA/amoeba_charge_transfer.cpp index 3072d90970..718d5c5b22 100644 --- a/src/AMOEBA/amoeba_charge_transfer.cpp +++ b/src/AMOEBA/amoeba_charge_transfer.cpp @@ -15,7 +15,6 @@ #include "pair_amoeba.h" #include "atom.h" -#include "memory.h" #include "neigh_list.h" #include diff --git a/src/AMOEBA/amoeba_convolution.cpp b/src/AMOEBA/amoeba_convolution.cpp index e3d5800ce5..ce466a6ed1 100644 --- a/src/AMOEBA/amoeba_convolution.cpp +++ b/src/AMOEBA/amoeba_convolution.cpp @@ -21,7 +21,9 @@ #include "memory.h" #include "neighbor.h" #include "remap_wrap.h" -#include "update.h" + +#include +#include using namespace LAMMPS_NS; diff --git a/src/AMOEBA/amoeba_dispersion.cpp b/src/AMOEBA/amoeba_dispersion.cpp index b8d2c48022..f3af921d85 100644 --- a/src/AMOEBA/amoeba_dispersion.cpp +++ b/src/AMOEBA/amoeba_dispersion.cpp @@ -18,10 +18,8 @@ #include "atom.h" #include "comm.h" #include "domain.h" -#include "fft3d_wrap.h" #include "math_const.h" #include "math_special.h" -#include "memory.h" #include "neigh_list.h" #include diff --git a/src/AMOEBA/amoeba_file.cpp b/src/AMOEBA/amoeba_file.cpp index af47f04fb5..6bf961cdab 100644 --- a/src/AMOEBA/amoeba_file.cpp +++ b/src/AMOEBA/amoeba_file.cpp @@ -17,14 +17,11 @@ #include "comm.h" #include "domain.h" #include "error.h" -#include "force.h" #include "memory.h" -#include "utils.h" #include "tokenizer.h" #include #include -#include using namespace LAMMPS_NS; diff --git a/src/AMOEBA/amoeba_induce.cpp b/src/AMOEBA/amoeba_induce.cpp index 3fb3e7c705..a6724e2bb7 100644 --- a/src/AMOEBA/amoeba_induce.cpp +++ b/src/AMOEBA/amoeba_induce.cpp @@ -19,16 +19,13 @@ #include "comm.h" #include "domain.h" #include "error.h" -#include "fft3d_wrap.h" #include "fix_store_peratom.h" #include "math_const.h" #include "math_special.h" -#include "memory.h" #include "my_page.h" #include "neigh_list.h" #include -#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/AMOEBA/amoeba_multipole.cpp b/src/AMOEBA/amoeba_multipole.cpp index e40d368f0c..f58395aa1c 100644 --- a/src/AMOEBA/amoeba_multipole.cpp +++ b/src/AMOEBA/amoeba_multipole.cpp @@ -18,14 +18,11 @@ #include "atom.h" #include "comm.h" #include "domain.h" -#include "fft3d_wrap.h" #include "math_const.h" #include "math_special.h" -#include "memory.h" #include "neigh_list.h" #include -#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/AMOEBA/amoeba_polar.cpp b/src/AMOEBA/amoeba_polar.cpp index 9342b6213d..4d143c7a22 100644 --- a/src/AMOEBA/amoeba_polar.cpp +++ b/src/AMOEBA/amoeba_polar.cpp @@ -18,10 +18,8 @@ #include "atom.h" #include "comm.h" #include "domain.h" -#include "fft3d_wrap.h" #include "math_const.h" #include "math_special.h" -#include "memory.h" #include "neigh_list.h" #include diff --git a/src/AMOEBA/amoeba_repulsion.cpp b/src/AMOEBA/amoeba_repulsion.cpp index 30e9a8635e..789674bb8d 100644 --- a/src/AMOEBA/amoeba_repulsion.cpp +++ b/src/AMOEBA/amoeba_repulsion.cpp @@ -16,7 +16,6 @@ #include "atom.h" #include "comm.h" -#include "memory.h" #include "neigh_list.h" #include diff --git a/src/AMOEBA/amoeba_utils.cpp b/src/AMOEBA/amoeba_utils.cpp index 6f15150040..5a4057930c 100644 --- a/src/AMOEBA/amoeba_utils.cpp +++ b/src/AMOEBA/amoeba_utils.cpp @@ -15,7 +15,6 @@ #include "pair_amoeba.h" #include "atom.h" -#include "comm.h" #include "domain.h" #include "error.h" #include "fix_store_peratom.h" diff --git a/src/AMOEBA/fix_amoeba_bitorsion.h b/src/AMOEBA/fix_amoeba_bitorsion.h index eac5eca260..c936fe987d 100644 --- a/src/AMOEBA/fix_amoeba_bitorsion.h +++ b/src/AMOEBA/fix_amoeba_bitorsion.h @@ -119,7 +119,7 @@ class FixAmoebaBiTorsion : public Fix { void chkttor(int, int, int, double &, double &, double &); void bcuint1(double *, double *, double *, double *, double, double, double, double, double, double, double &, double &, double &); - void bcucof(double *, double *, double *, double *, double, double, double[][4]); + void bcucof(double *, double *, double *, double *, double, double, double[4][4]); }; } // namespace LAMMPS_NS #endif diff --git a/src/AMOEBA/improper_amoeba.cpp b/src/AMOEBA/improper_amoeba.cpp index 44f42d9964..b1e403da78 100644 --- a/src/AMOEBA/improper_amoeba.cpp +++ b/src/AMOEBA/improper_amoeba.cpp @@ -22,7 +22,6 @@ #include "memory.h" #include "neighbor.h" #include "pair.h" -#include "update.h" #include diff --git a/src/AMOEBA/pair_amoeba.cpp b/src/AMOEBA/pair_amoeba.cpp index 652d570019..91febc611e 100644 --- a/src/AMOEBA/pair_amoeba.cpp +++ b/src/AMOEBA/pair_amoeba.cpp @@ -19,25 +19,20 @@ #include "comm.h" #include "domain.h" #include "error.h" -#include "fft3d_wrap.h" #include "fix.h" #include "fix_store_peratom.h" #include "force.h" -#include "gridcomm.h" #include "group.h" #include "math_special.h" #include "memory.h" #include "modify.h" #include "my_page.h" #include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" #include "update.h" -#include "utils.h" -#include +#include #include -#include using namespace LAMMPS_NS; diff --git a/src/BPM/atom_vec_bpm_sphere.cpp b/src/BPM/atom_vec_bpm_sphere.cpp index f0cac301f4..3d2ced5429 100644 --- a/src/BPM/atom_vec_bpm_sphere.cpp +++ b/src/BPM/atom_vec_bpm_sphere.cpp @@ -20,7 +20,6 @@ #include "fix_adapt.h" #include "math_const.h" #include "modify.h" -#include "utils.h" #include diff --git a/src/BPM/bond_bpm.cpp b/src/BPM/bond_bpm.cpp index 7772e13fe5..4d65fe7684 100644 --- a/src/BPM/bond_bpm.cpp +++ b/src/BPM/bond_bpm.cpp @@ -25,7 +25,8 @@ #include "modify.h" #include "update.h" -#include +#include +#include using namespace LAMMPS_NS; diff --git a/src/BPM/bond_bpm.h b/src/BPM/bond_bpm.h index feebbdb2b2..cc2e46d5d3 100644 --- a/src/BPM/bond_bpm.h +++ b/src/BPM/bond_bpm.h @@ -16,8 +16,6 @@ #include "bond.h" -#include - namespace LAMMPS_NS { class BondBPM : public Bond { diff --git a/src/BPM/bond_bpm_rotational.cpp b/src/BPM/bond_bpm_rotational.cpp index 93ea2aafaf..3085488ef9 100644 --- a/src/BPM/bond_bpm_rotational.cpp +++ b/src/BPM/bond_bpm_rotational.cpp @@ -19,13 +19,13 @@ #include "error.h" #include "fix_bond_history.h" #include "force.h" -#include "math_const.h" #include "math_extra.h" #include "memory.h" #include "modify.h" #include "neighbor.h" #include +#include #define EPSILON 1e-10 diff --git a/src/BPM/bond_bpm_spring.cpp b/src/BPM/bond_bpm_spring.cpp index 9832aab0e2..ed4e71daf1 100644 --- a/src/BPM/bond_bpm_spring.cpp +++ b/src/BPM/bond_bpm_spring.cpp @@ -23,6 +23,9 @@ #include "modify.h" #include "neighbor.h" +#include +#include + #define EPSILON 1e-10 using namespace LAMMPS_NS; diff --git a/src/BPM/compute_nbond_atom.cpp b/src/BPM/compute_nbond_atom.cpp index f63bbf69e5..4f0fc4c3f0 100644 --- a/src/BPM/compute_nbond_atom.cpp +++ b/src/BPM/compute_nbond_atom.cpp @@ -15,12 +15,8 @@ #include "atom.h" #include "comm.h" -#include "error.h" #include "force.h" #include "memory.h" -#include "update.h" - -#include using namespace LAMMPS_NS; @@ -29,7 +25,7 @@ using namespace LAMMPS_NS; ComputeNBondAtom::ComputeNBondAtom(LAMMPS *_lmp, int narg, char **arg) : Compute(_lmp, narg, arg), nbond(nullptr) { - if (narg < 3) error->all(FLERR, "Illegal compute nbond/atom command"); + if (narg < 3) utils::missing_cmd_args(FLERR, "compute nbond/atom", error); peratom_flag = 1; size_peratom_cols = 0; diff --git a/src/BPM/fix_nve_bpm_sphere.cpp b/src/BPM/fix_nve_bpm_sphere.cpp index cf57092ca5..ceab07822e 100644 --- a/src/BPM/fix_nve_bpm_sphere.cpp +++ b/src/BPM/fix_nve_bpm_sphere.cpp @@ -14,13 +14,10 @@ #include "fix_nve_bpm_sphere.h" #include "atom.h" -#include "atom_vec.h" #include "domain.h" #include "error.h" -#include "force.h" #include "math_extra.h" -#include #include using namespace LAMMPS_NS; diff --git a/src/BPM/pair_bpm_spring.cpp b/src/BPM/pair_bpm_spring.cpp index d58f087a02..1177156359 100644 --- a/src/BPM/pair_bpm_spring.cpp +++ b/src/BPM/pair_bpm_spring.cpp @@ -19,7 +19,8 @@ #include "force.h" #include "memory.h" #include "neigh_list.h" -#include "neighbor.h" + +#include using namespace LAMMPS_NS; diff --git a/src/BROWNIAN/fix_brownian_asphere.cpp b/src/BROWNIAN/fix_brownian_asphere.cpp index 4ff678866c..5ce57df7ce 100644 --- a/src/BROWNIAN/fix_brownian_asphere.cpp +++ b/src/BROWNIAN/fix_brownian_asphere.cpp @@ -27,6 +27,8 @@ #include "math_extra.h" #include "random_mars.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/COLLOID/pair_brownian.cpp b/src/COLLOID/pair_brownian.cpp index 4d17fddc5d..4d78145207 100644 --- a/src/COLLOID/pair_brownian.cpp +++ b/src/COLLOID/pair_brownian.cpp @@ -92,7 +92,6 @@ void PairBrownian::compute(int eflag, int vflag) double prethermostat; double xl[3], a_sq, a_sh, a_pu, Fbmag; double p1[3], p2[3], p3[3]; - int overlaps = 0; // This section of code adjusts R0/RT0/RS0 if necessary due to changes // in the volume fraction as a result of fix deform or moving walls @@ -187,10 +186,6 @@ void PairBrownian::compute(int eflag, int vflag) h_sep = r - 2.0 * radi; - // check for overlaps - - if (h_sep < 0.0) overlaps++; - // if less than minimum gap, use minimum gap instead if (r < cut_inner[itype][jtype]) h_sep = cut_inner[itype][jtype] - 2.0 * radi; @@ -336,9 +331,6 @@ void PairBrownian::compute(int eflag, int vflag) } } - int print_overlaps = 0; - if (print_overlaps && overlaps) printf("Number of overlaps=%d\n", overlaps); - if (vflag_fdotr) virial_fdotr_compute(); } diff --git a/src/COLLOID/pair_brownian_poly.cpp b/src/COLLOID/pair_brownian_poly.cpp index c356669f3f..2654410c03 100644 --- a/src/COLLOID/pair_brownian_poly.cpp +++ b/src/COLLOID/pair_brownian_poly.cpp @@ -72,7 +72,6 @@ void PairBrownianPoly::compute(int eflag, int vflag) int nlocal = atom->nlocal; double vxmu2f = force->vxmu2f; - int overlaps = 0; double randr; double prethermostat; double xl[3],a_sq,a_sh,a_pu,Fbmag; @@ -176,10 +175,6 @@ void PairBrownianPoly::compute(int eflag, int vflag) h_sep = r - radi-radj; - // check for overlaps - - if (h_sep < 0.0) overlaps++; - // if less than minimum gap, use minimum gap instead if (r < cut_inner[itype][jtype]) diff --git a/src/CORESHELL/compute_temp_cs.cpp b/src/CORESHELL/compute_temp_cs.cpp index 2adb6c16ae..49e8a4dd47 100644 --- a/src/CORESHELL/compute_temp_cs.cpp +++ b/src/CORESHELL/compute_temp_cs.cpp @@ -31,9 +31,6 @@ #include "modify.h" #include "update.h" -#include - - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/DIELECTRIC/msm_dielectric.cpp b/src/DIELECTRIC/msm_dielectric.cpp index 4e157e9f2a..0e89ab8946 100644 --- a/src/DIELECTRIC/msm_dielectric.cpp +++ b/src/DIELECTRIC/msm_dielectric.cpp @@ -20,7 +20,6 @@ #include "atom.h" #include "atom_vec_dielectric.h" -#include "comm.h" #include "domain.h" #include "error.h" #include "gridcomm.h" diff --git a/src/DIELECTRIC/pppm_dielectric.cpp b/src/DIELECTRIC/pppm_dielectric.cpp index 1f01cda143..c2211828c8 100644 --- a/src/DIELECTRIC/pppm_dielectric.cpp +++ b/src/DIELECTRIC/pppm_dielectric.cpp @@ -20,10 +20,8 @@ #include "atom.h" #include "atom_vec_dielectric.h" -#include "comm.h" #include "domain.h" #include "error.h" -#include "force.h" #include "gridcomm.h" #include "math_const.h" #include "math_special.h" diff --git a/src/DIELECTRIC/pppm_disp_dielectric.cpp b/src/DIELECTRIC/pppm_disp_dielectric.cpp index 5ef35381d0..201e18145b 100644 --- a/src/DIELECTRIC/pppm_disp_dielectric.cpp +++ b/src/DIELECTRIC/pppm_disp_dielectric.cpp @@ -18,7 +18,6 @@ #include "pppm_disp_dielectric.h" -#include "angle.h" #include "atom.h" #include "atom_vec_dielectric.h" #include "domain.h" diff --git a/src/DIFFRACTION/fix_saed_vtk.cpp b/src/DIFFRACTION/fix_saed_vtk.cpp index 6bbfe5ae0d..b3f6693e9e 100644 --- a/src/DIFFRACTION/fix_saed_vtk.cpp +++ b/src/DIFFRACTION/fix_saed_vtk.cpp @@ -407,7 +407,6 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) // Finding the intersection of the reciprical space and Ewald sphere int NROW1 = 0; - int NROW2 = 0; double dinv2 = 0.0; double r = 0.0; double K[3]; @@ -425,11 +424,9 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) fprintf(fp,"%g\n",vector_total[NROW1]/norm); fflush(fp); NROW1++; - NROW2++; } else { fprintf(fp,"%d\n",-1); fflush(fp); - NROW2++; } } } @@ -449,17 +446,14 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) if ( (r > (R_Ewald - dR_Ewald) ) && (r < (R_Ewald + dR_Ewald) )) { fprintf(fp,"%g\n",vector_total[NROW1]/norm); fflush(fp); - NROW2++; NROW1++; } else { fprintf(fp,"%d\n",-1); fflush(fp); - NROW2++; } } else { fprintf(fp,"%d\n",-1); fflush(fp); - NROW2++; } } } diff --git a/src/DPD-REACT/fix_rx.cpp b/src/DPD-REACT/fix_rx.cpp index 9939a19bb3..96eb9d4572 100644 --- a/src/DPD-REACT/fix_rx.cpp +++ b/src/DPD-REACT/fix_rx.cpp @@ -390,7 +390,6 @@ void FixRX::initSparse() int mxprod = 0; int mxreac = 0; int mxspec = 0; - int nIntegral = 0; for (int i = 0; i < nreactions; ++i) { int nreac_i = 0, nprod_i = 0; std::string pstr, rstr; @@ -430,7 +429,6 @@ void FixRX::initSparse() mxreac = std::max( mxreac, nreac_i ); mxprod = std::max( mxprod, nprod_i ); mxspec = std::max( mxspec, nreac_i + nprod_i ); - if (allAreIntegral) nIntegral++; } if (comm->me == 0 && Verbosity > 1) { diff --git a/src/EFF/atom_vec_electron.cpp b/src/EFF/atom_vec_electron.cpp index c1bb93931d..d763ff0671 100644 --- a/src/EFF/atom_vec_electron.cpp +++ b/src/EFF/atom_vec_electron.cpp @@ -20,6 +20,8 @@ #include "atom.h" #include "citeme.h" +#include + using namespace LAMMPS_NS; static const char cite_user_eff_package[] = diff --git a/src/EFF/compute_temp_region_eff.cpp b/src/EFF/compute_temp_region_eff.cpp index e41adeb5c2..ff20d48124 100644 --- a/src/EFF/compute_temp_region_eff.cpp +++ b/src/EFF/compute_temp_region_eff.cpp @@ -141,12 +141,6 @@ double ComputeTempRegionEff::compute_scalar() if (dof < 0.0 && tarray_all[0] > 0.0) error->all(FLERR, "Temperature compute degrees of freedom < 0"); - int one = 0; - for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) { - if (abs(spin[i]) == 1) one++; - } - if (dof > 0.0) scalar = force->mvv2e * tarray_all[1] / (dof * force->boltz); else diff --git a/src/ELECTRODE/electrode_matrix.cpp b/src/ELECTRODE/electrode_matrix.cpp index 1362026eb3..5faac5a252 100644 --- a/src/ELECTRODE/electrode_matrix.cpp +++ b/src/ELECTRODE/electrode_matrix.cpp @@ -29,6 +29,9 @@ #include "neigh_list.h" #include "pair.h" +#include +#include + using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/ELECTRODE/electrode_vector.cpp b/src/ELECTRODE/electrode_vector.cpp index 1a1b877406..245ba57727 100644 --- a/src/ELECTRODE/electrode_vector.cpp +++ b/src/ELECTRODE/electrode_vector.cpp @@ -29,6 +29,9 @@ #include "neigh_list.h" #include "pair.h" +#include +#include + using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/ELECTRODE/ewald_electrode.cpp b/src/ELECTRODE/ewald_electrode.cpp index a0a081deb0..99266ed450 100644 --- a/src/ELECTRODE/ewald_electrode.cpp +++ b/src/ELECTRODE/ewald_electrode.cpp @@ -18,6 +18,7 @@ #include "ewald_electrode.h" #include "atom.h" +#include "boundary_correction.h" #include "comm.h" #include "domain.h" #include "error.h" @@ -32,7 +33,6 @@ #include #include -#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/ELECTRODE/fix_electrode_conp.cpp b/src/ELECTRODE/fix_electrode_conp.cpp index 73c029a61f..2c39a57532 100644 --- a/src/ELECTRODE/fix_electrode_conp.cpp +++ b/src/ELECTRODE/fix_electrode_conp.cpp @@ -20,7 +20,6 @@ #include "atom.h" #include "citeme.h" #include "comm.h" -#include "compute.h" #include "domain.h" #include "electrode_accel_interface.h" #include "electrode_math.h" @@ -37,12 +36,15 @@ #include "neigh_request.h" #include "neighbor.h" #include "pair.h" -#include "pointers.h" #include "text_file_reader.h" #include "variable.h" +#include #include -#include +#include +#include +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -867,7 +869,7 @@ void FixElectrodeConp::update_charges() accel_interface->intel_pack_buffers(); } -std::vector FixElectrodeConp::ele_ele_interaction(std::vector q_local) +std::vector FixElectrodeConp::ele_ele_interaction(const std::vector& q_local) { assert(q_local.size() == nlocalele); assert(algo == Algo::CG || algo == Algo::MATRIX_CG); @@ -1415,14 +1417,13 @@ void FixElectrodeConp::gather_list_iele() } taglist_local.clear(); iele_to_group_local.clear(); - for (int i = 0, iele = 0; i < nlocal; i++) { + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { tagint const t = tag[i]; if (matrix_algo) list_iele.push_back(tag_to_iele[t]); taglist_local.push_back(t); for (int g = 0; g < num_of_groups; g++) if (mask[i] & group_bits[g]) iele_to_group_local.push_back(g); - iele++; } } nlocalele = static_cast(taglist_local.size()); // just for safety diff --git a/src/ELECTRODE/fix_electrode_conp.h b/src/ELECTRODE/fix_electrode_conp.h index 42b0e5f52b..5d3131bcce 100644 --- a/src/ELECTRODE/fix_electrode_conp.h +++ b/src/ELECTRODE/fix_electrode_conp.h @@ -26,15 +26,19 @@ FixStyle(electrode/conp, FixElectrodeConp); #ifndef LMP_FIX_ELECTRODE_CONP_H #define LMP_FIX_ELECTRODE_CONP_H -#include "electrode_accel_interface.h" #include "fix.h" -#include #include #include #include namespace LAMMPS_NS { +// forward decls + +class ElectrodeAccelInterface; +class ElectrodeVector; +class NeighList; +class Pair; class FixElectrodeConp : public Fix { @@ -75,7 +79,7 @@ class FixElectrodeConp : public Fix { virtual std::vector constraint_projection(std::vector); virtual std::vector constraint_correction(std::vector); virtual void compute_macro_matrices(); - std::vector ele_ele_interaction(std::vector); + std::vector ele_ele_interaction(const std::vector &); std::vector group_psi; std::vector group_bits; std::vector groups; @@ -102,7 +106,7 @@ class FixElectrodeConp : public Fix { private: std::string output_file_inv, output_file_mat, output_file_vec; std::string input_file_inv, input_file_mat; - class ElectrodeVector *elyt_vector, *elec_vector; + ElectrodeVector *elyt_vector, *elec_vector; double **capacitance, **elastance; bool read_inv, read_mat, write_inv, write_mat, write_vec; bool matrix_algo, need_array_compute, need_elec_vector; @@ -121,8 +125,8 @@ class FixElectrodeConp : public Fix { void compute_sd_vectors(); void compute_sd_vectors_ffield(); int groupnum_from_name(char *); - class Pair *pair; - class NeighList *mat_neighlist, *vec_neighlist; + Pair *pair; + NeighList *mat_neighlist, *vec_neighlist; std::vector etypes; int mat_request, vec_request; void request_etypes_neighlists(); diff --git a/src/ELECTRODE/fix_electrode_thermo.cpp b/src/ELECTRODE/fix_electrode_thermo.cpp index 3bdf446f53..52c0a3ce4c 100644 --- a/src/ELECTRODE/fix_electrode_thermo.cpp +++ b/src/ELECTRODE/fix_electrode_thermo.cpp @@ -20,12 +20,13 @@ #include "atom.h" #include "error.h" #include "fix_electrode_conp.h" -#include "force.h" #include "input.h" #include "random_mars.h" #include "update.h" #include "variable.h" +#include + using namespace LAMMPS_NS; #define NUM_GROUPS 2 diff --git a/src/ELECTRODE/slab_2d.cpp b/src/ELECTRODE/slab_2d.cpp index dac6001f9b..f38f22617d 100644 --- a/src/ELECTRODE/slab_2d.cpp +++ b/src/ELECTRODE/slab_2d.cpp @@ -18,12 +18,12 @@ #include "slab_2d.h" #include "atom.h" -#include "comm.h" #include "domain.h" #include "force.h" #include "kspace.h" #include "math_const.h" -#include "memory.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/ELECTRODE/slab_dipole.cpp b/src/ELECTRODE/slab_dipole.cpp index 773d2a6bd6..d5f3eae7aa 100644 --- a/src/ELECTRODE/slab_dipole.cpp +++ b/src/ELECTRODE/slab_dipole.cpp @@ -18,12 +18,13 @@ #include "slab_dipole.h" #include "atom.h" -#include "comm.h" #include "domain.h" #include "force.h" #include "kspace.h" #include "math_const.h" +#include + using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/ELECTRODE/wire_dipole.cpp b/src/ELECTRODE/wire_dipole.cpp index fc9cbc7014..5a3e3d976a 100644 --- a/src/ELECTRODE/wire_dipole.cpp +++ b/src/ELECTRODE/wire_dipole.cpp @@ -19,7 +19,6 @@ #include "atom.h" #include "comm.h" -#include "domain.h" #include "force.h" #include "math_const.h" diff --git a/src/EXTRA-COMPUTE/compute_basal_atom.cpp b/src/EXTRA-COMPUTE/compute_basal_atom.cpp index 90f5c8a33e..b149746fb4 100644 --- a/src/EXTRA-COMPUTE/compute_basal_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_basal_atom.cpp @@ -31,7 +31,6 @@ #include "update.h" #include -#include using namespace LAMMPS_NS; diff --git a/src/EXTRA-COMPUTE/compute_born_matrix.cpp b/src/EXTRA-COMPUTE/compute_born_matrix.cpp index 8ad808c2f3..4eecbbfa14 100644 --- a/src/EXTRA-COMPUTE/compute_born_matrix.cpp +++ b/src/EXTRA-COMPUTE/compute_born_matrix.cpp @@ -33,10 +33,8 @@ #include "modify.h" #include "molecule.h" #include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" #include "pair.h" -#include "universe.h" #include "update.h" #include diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index b33f58798f..eb93a31655 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -20,7 +20,6 @@ #include "error.h" #include "force.h" #include "memory.h" -#include "modify.h" #include "neigh_list.h" #include "neighbor.h" #include "pair.h" diff --git a/src/EXTRA-COMPUTE/compute_stress_cylinder.cpp b/src/EXTRA-COMPUTE/compute_stress_cylinder.cpp index c5fc68f258..f445b258b1 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cylinder.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cylinder.cpp @@ -21,7 +21,6 @@ #include "math_const.h" #include "math_special.h" #include "memory.h" -#include "modify.h" #include "neigh_list.h" #include "neighbor.h" #include "pair.h" @@ -29,7 +28,6 @@ #include #include -#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/EXTRA-COMPUTE/compute_stress_spherical.cpp b/src/EXTRA-COMPUTE/compute_stress_spherical.cpp index c8608e265a..6a6ec4745f 100644 --- a/src/EXTRA-COMPUTE/compute_stress_spherical.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_spherical.cpp @@ -19,19 +19,15 @@ #include "domain.h" #include "error.h" #include "force.h" -#include "lattice.h" #include "math_const.h" #include "math_special.h" #include "memory.h" -#include "modify.h" #include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" #include "pair.h" #include "update.h" #include -#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/EXTRA-DUMP/dump_yaml.cpp b/src/EXTRA-DUMP/dump_yaml.cpp index 117fe84a4c..3c35ec43ba 100644 --- a/src/EXTRA-DUMP/dump_yaml.cpp +++ b/src/EXTRA-DUMP/dump_yaml.cpp @@ -20,6 +20,8 @@ #include "thermo.h" #include "update.h" +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-FIX/fix_ave_correlate_long.cpp b/src/EXTRA-FIX/fix_ave_correlate_long.cpp index 3667cd3a20..a44d6414f7 100644 --- a/src/EXTRA-FIX/fix_ave_correlate_long.cpp +++ b/src/EXTRA-FIX/fix_ave_correlate_long.cpp @@ -36,7 +36,6 @@ #include "update.h" #include "variable.h" -#include #include using namespace LAMMPS_NS; diff --git a/src/EXTRA-FIX/fix_viscous_sphere.cpp b/src/EXTRA-FIX/fix_viscous_sphere.cpp index 14bb03d1aa..5b4dd72231 100644 --- a/src/EXTRA-FIX/fix_viscous_sphere.cpp +++ b/src/EXTRA-FIX/fix_viscous_sphere.cpp @@ -14,11 +14,9 @@ #include "fix_viscous_sphere.h" #include "atom.h" -#include "comm.h" #include "error.h" #include "input.h" #include "memory.h" -#include "modify.h" #include "respa.h" #include "update.h" #include "variable.h" diff --git a/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp b/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp index 8e4d1033fe..206ad4f3ad 100644 --- a/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp +++ b/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp @@ -25,7 +25,6 @@ #include "force.h" #include "memory.h" #include "neighbor.h" -#include "domain.h" #include diff --git a/src/FEP/compute_fep_ta.cpp b/src/FEP/compute_fep_ta.cpp index 9782835945..786bf53bfa 100644 --- a/src/FEP/compute_fep_ta.cpp +++ b/src/FEP/compute_fep_ta.cpp @@ -30,7 +30,6 @@ #include "kspace.h" #include "memory.h" #include "modify.h" -#include "neighbor.h" #include "pair.h" #include "timer.h" #include "update.h" diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index b3d387d845..97f22da0a7 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -120,8 +120,8 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) : // If ngpu is 0, autoset ngpu to the number of devices per node matching // best device - int ngpu = atoi(arg[3]); - if (ngpu < 0) error->all(FLERR,"Illegal package gpu command"); + int ngpu = utils::inumeric(FLERR, arg[3], false, lmp); + if (ngpu < 0) error->all(FLERR,"Illegal number of GPUs ({}) in package gpu command", ngpu); // Negative value indicate GPU package should find the best device ID int first_gpu_id = -1; diff --git a/src/GRANULAR/compute_contact_atom.cpp b/src/GRANULAR/compute_contact_atom.cpp index 1331901884..310fdb5a41 100644 --- a/src/GRANULAR/compute_contact_atom.cpp +++ b/src/GRANULAR/compute_contact_atom.cpp @@ -25,8 +25,6 @@ #include "neighbor.h" #include "update.h" -#include - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index 3d200d1ebc..e9506e8a03 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -27,7 +27,6 @@ #include "memory.h" #include "modify.h" #include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" #include "update.h" diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 51963ae1ff..946e902dc5 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -32,7 +32,6 @@ #include "memory.h" #include "modify.h" #include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" #include "update.h" diff --git a/src/INTERLAYER/pair_drip.cpp b/src/INTERLAYER/pair_drip.cpp index 48bc2d9016..90773b4034 100644 --- a/src/INTERLAYER/pair_drip.cpp +++ b/src/INTERLAYER/pair_drip.cpp @@ -28,7 +28,6 @@ #include "force.h" #include "memory.h" #include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" #include "potential_file_reader.h" diff --git a/src/INTERLAYER/pair_ilp_tmd.cpp b/src/INTERLAYER/pair_ilp_tmd.cpp index 8c9bd3b8a5..c024e23079 100644 --- a/src/INTERLAYER/pair_ilp_tmd.cpp +++ b/src/INTERLAYER/pair_ilp_tmd.cpp @@ -22,15 +22,12 @@ #include "atom.h" #include "citeme.h" -#include "comm.h" #include "error.h" #include "force.h" #include "interlayer_taper.h" #include "memory.h" #include "my_page.h" #include "neigh_list.h" -#include "neigh_request.h" -#include "neighbor.h" #include #include diff --git a/src/INTERLAYER/pair_saip_metal.cpp b/src/INTERLAYER/pair_saip_metal.cpp index 5a4225b0fc..05fbfbf7f4 100644 --- a/src/INTERLAYER/pair_saip_metal.cpp +++ b/src/INTERLAYER/pair_saip_metal.cpp @@ -26,8 +26,6 @@ #include "force.h" #include "interlayer_taper.h" #include "neigh_list.h" -#include "neigh_request.h" -#include "neighbor.h" #include #include diff --git a/src/KIM/kim_param.cpp b/src/KIM/kim_param.cpp index 6dfcfc10a9..6473cb2ad0 100644 --- a/src/KIM/kim_param.cpp +++ b/src/KIM/kim_param.cpp @@ -155,11 +155,9 @@ void KimParam::command(int narg, char **arg) std::string kim_param_get_set(arg[0]); - if ((kim_param_get_set != "get") && (kim_param_get_set != "set")) { - std::string msg("Incorrect arguments in 'kim param' command.\n"); - msg += "'kim param get/set' is mandatory"; - error->all(FLERR, msg); - } + if ((kim_param_get_set != "get") && (kim_param_get_set != "set")) + error->all(FLERR, "Incorrect arguments in 'kim param' command.\n" + "'kim param get/set' is mandatory"); int const ifix = modify->find_fix("KIM_MODEL_STORE"); if (ifix >= 0) { @@ -170,8 +168,7 @@ void KimParam::command(int narg, char **arg) fix_store->getptr("simulator_model")); if (simulatorModel) - error->all(FLERR, - "'kim param' can only be used with a KIM Portable Model"); + error->all(FLERR, "'kim param' can only be used with a KIM Portable Model"); } input->write_echo(fmt::format("#=== BEGIN kim param {} ===================" @@ -196,13 +193,10 @@ void KimParam::command(int narg, char **arg) } else error->all(FLERR, "Pair style is defined, but there is " "no match for kim style in lammps"); - } else { - auto msg = fmt::format("Illegal 'kim param {0}' command.\nTo {0} the new " - "parameter values, pair style must be assigned.\n" - "Must use 'kim interactions' or 'pair_style kim' " - "before 'kim param {0}'", kim_param_get_set); - error->all(FLERR, msg); - } + } else + error->all(FLERR, "Illegal 'kim param {0}' command.\nTo {0} the new parameter values, " + "pair style must be assigned.\nMust use 'kim interactions' or 'pair_style kim' " + "before 'kim param {0}'", kim_param_get_set); // Get the number of mutable parameters in the kim model int numberOfParameters(0); @@ -243,12 +237,9 @@ void KimParam::command(int narg, char **arg) if (paramname == str_name_str) break; } - if (param_index >= numberOfParameters) { - auto msg = fmt::format("Wrong argument in 'kim param get' command.\n" - "This Model does not have the requested '{}' " - "parameter", paramname); - error->all(FLERR, msg); - } + if (param_index >= numberOfParameters) + error->all(FLERR, "Wrong argument in 'kim param get' command.\n" + "This Model does not have the requested '{}' parameter", paramname); // Get the index_range for the requested parameter int nlbound(0); @@ -259,12 +250,9 @@ void KimParam::command(int narg, char **arg) // Check to see if the indices range contains // only integer numbers and/or range : - if (argtostr.find_first_not_of("0123456789:") != std::string::npos) { - auto msg = fmt::format("Illegal index_range.\nExpected integer " - "parameter(s) instead of '{}' in " - "index_range", argtostr); - error->all(FLERR, msg); - } + if (argtostr.find_first_not_of("0123456789:") != std::string::npos) + error->all(FLERR, "Illegal index_range.\nExpected integer parameter(s) instead " + "of '{}' in index_range", argtostr); std::string::size_type npos = argtostr.find(':'); if (npos != std::string::npos) { @@ -273,30 +261,20 @@ void KimParam::command(int narg, char **arg) nlbound = atoi(words[0].c_str()); nubound = atoi(words[1].c_str()); - if (nubound < 1 || nubound > extent || - nlbound < 1 || nlbound > nubound) { - auto msg = fmt::format("Illegal index_range '{}-{}' for '{}' " - "parameter with the extent of '{}'", - nlbound, nubound, paramname, extent); - error->all(FLERR, msg); - } + if ((nubound < 1) || (nubound > extent) || (nlbound < 1) || (nlbound > nubound)) + error->all(FLERR, "Illegal index_range '{}-{}' for '{}' parameter with the " + "extent of '{}'",nlbound, nubound, paramname, extent); } else { nlbound = atoi(argtostr.c_str()); - if (nlbound < 1 || nlbound > extent) { - auto msg = fmt::format("Illegal index '{}' for '{}' parameter " - "with the extent of '{}'", nlbound, - paramname, extent); - error->all(FLERR, msg); - } - + if (nlbound < 1 || nlbound > extent) + error->all(FLERR, "Illegal index '{}' for '{}' parameter with the extent of '{}'", + nlbound, paramname, extent); nubound = nlbound; } - } else { - std::string msg("Wrong number of arguments in 'kim param get' "); - msg += "command.\nIndex range after parameter name is mandatory"; - error->all(FLERR, msg); - } + } else + error->all(FLERR, "Wrong number of arguments in 'kim param get' command.\n" + "Index range after parameter name is mandatory"); int const nvars = nubound - nlbound + 1; std::vector varsname; @@ -304,15 +282,11 @@ void KimParam::command(int narg, char **arg) if (i < narg) { // Get the variable/variable_base name varname = std::string(arg[i++]); - if ((varname == "split") || - (varname == "list") || - (varname == "explicit")) - error->all(FLERR, "Illegal variable name in 'kim param get'"); - } else { - std::string msg("Wrong number of arguments in 'kim param get' "); - msg += "command.\nThe LAMMPS variable name is mandatory"; - error->all(FLERR, msg); - } + if ((varname == "split") || (varname == "list") || (varname == "explicit")) + error->all(FLERR, "Illegal variable name '{}' in 'kim param get'", varname); + } else + error->all(FLERR, "Wrong number of arguments in 'kim param get' command.\n" + "The LAMMPS variable name is mandatory"); // indicator flag for list request bool list_requested(false); @@ -337,28 +311,22 @@ void KimParam::command(int narg, char **arg) --i; for (int j = 0; j < nvars; ++j, ++i) { varsname[j] = std::string(arg[i]); - if (varsname[j] == "split" || varsname[j] == "list" || - varsname[j] == "explicit") - error->all(FLERR, "Illegal variable name in 'kim param get'"); + if (varsname[j] == "split" || varsname[j] == "list" || varsname[j] == "explicit") + error->all(FLERR, "Illegal variable name '{}' in 'kim param get'", varsname[j]); } if (i < narg) { formatarg = std::string(arg[i]); if (formatarg == "explicit") ++i; } } else { - auto msg = - fmt::format("Wrong number of arguments in 'kim param get' " - "command.\nThe LAMMPS '{}' variable names or " - "'{} split' is mandatory", nvars, varname); - error->all(FLERR, msg); + error->all(FLERR, "Wrong number of arguments in 'kim param get' command.\n" + "The LAMMPS '{}' variable names or '{} split' is mandatory", + nvars, varname); } - } else { - auto msg = - fmt::format("Wrong number of arguments in 'kim param get' " - "command.\nThe LAMMPS '{}' variable names or " - "'{} split/list' is mandatory", nvars, varname); - error->all(FLERR, msg); - } + } else + error->all(FLERR, "Wrong number of arguments in 'kim param get' command.\n" + "The LAMMPS '{}' variable names or '{} split/list' is mandatory", + nvars, varname); } else { varsname.resize(1); if (i < narg) { diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index 92fc9b68a7..6a5a792797 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -483,15 +483,13 @@ void PairKIM::coeff(int narg, char **arg) nlbound = atoi(words[0].c_str()); nubound = atoi(words[1].c_str()); - if (nubound < 1 || nubound > extent || - nlbound < 1 || nlbound > nubound) - error->all(FLERR,"Illegal index_range '{}-{}' for '{}' " - "parameter with the extent of '{}'", + if ((nubound < 1) || (nubound > extent) || (nlbound < 1) || (nlbound > nubound)) + error->all(FLERR,"Illegal index_range '{}-{}' for '{}' parameter with the extent of '{}'", nlbound, nubound, paramname, extent); } else { nlbound = atoi(argtostr.c_str()); - if (nlbound < 1 || nlbound > extent) + if ((nlbound < 1) || (nlbound > extent)) error->all(FLERR,"Illegal index '{}' for '{}' parameter with the extent of '{}'", nlbound, paramname, extent); @@ -1081,8 +1079,7 @@ void PairKIM::set_kim_model_has_flags() KIM_ComputeArguments_GetArgumentSupportStatus( pargs, computeArgumentName, &supportStatus); - if (KIM_ComputeArgumentName_Equal(computeArgumentName, - KIM_COMPUTE_ARGUMENT_NAME_partialEnergy)) + if (KIM_ComputeArgumentName_Equal(computeArgumentName, KIM_COMPUTE_ARGUMENT_NAME_partialEnergy)) kim_model_support_for_energy = supportStatus; else if (KIM_ComputeArgumentName_Equal( computeArgumentName, KIM_COMPUTE_ARGUMENT_NAME_partialForces)) @@ -1095,17 +1092,14 @@ void PairKIM::set_kim_model_has_flags() computeArgumentName, KIM_COMPUTE_ARGUMENT_NAME_partialParticleVirial)) kim_model_support_for_particleVirial = supportStatus; - else if (KIM_SupportStatus_Equal(supportStatus, - KIM_SUPPORT_STATUS_required)) { - std::string msg("KIM Model requires unsupported compute argument: "); - msg += KIM_ComputeArgumentName_ToString(computeArgumentName); - error->all(FLERR,msg); + else if (KIM_SupportStatus_Equal(supportStatus, KIM_SUPPORT_STATUS_required)) { + error->all(FLERR, "KIM Model requires unsupported compute argument: {}", + KIM_ComputeArgumentName_ToString(computeArgumentName)); } } if (comm->me == 0) { - if (KIM_SupportStatus_Equal(kim_model_support_for_energy, - KIM_SUPPORT_STATUS_notSupported)) + if (KIM_SupportStatus_Equal(kim_model_support_for_energy, KIM_SUPPORT_STATUS_notSupported)) error->warning(FLERR,"KIM Model does not provide 'partialEnergy'; Potential energy will be zero"); if (KIM_SupportStatus_Equal(kim_model_support_for_forces, diff --git a/src/KSPACE/ewald_disp.cpp b/src/KSPACE/ewald_disp.cpp index 7943ffd194..43b5c8840b 100644 --- a/src/KSPACE/ewald_disp.cpp +++ b/src/KSPACE/ewald_disp.cpp @@ -1209,7 +1209,7 @@ void EwaldDisp::compute_virial_dipole() double *ke, c[EWALD_NFUNCS] = { 8.0*MY_PI*qscale/volume, 2.0*MY_PI*MY_PIS/(12.0*volume), 2.0*MY_PI*MY_PIS/(192.0*volume), 8.0*MY_PI*mumurd2e/volume}; - int i, kx, ky, lbytes = (2*nbox+1)*sizeof(cvector), *type = atom->type; + int i, kx, ky, lbytes = (2*nbox+1)*sizeof(cvector); int func[EWALD_NFUNCS]; memcpy(func, function, EWALD_NFUNCS*sizeof(int)); @@ -1273,7 +1273,6 @@ void EwaldDisp::compute_virial_dipole() vatomj[n] -= mysum[n]; z = (cvector *) ((char *) z+lbytes); - ++type; if (vflag_atom) vatomj += 6; } diff --git a/src/KSPACE/pppm.h b/src/KSPACE/pppm.h index f974f4eb3f..bd17b38629 100644 --- a/src/KSPACE/pppm.h +++ b/src/KSPACE/pppm.h @@ -21,7 +21,7 @@ KSpaceStyle(pppm,PPPM); #define LMP_PPPM_H #include "kspace.h" -#include "lmpfftsettings.h" +#include "lmpfftsettings.h" // IWYU pragma: export namespace LAMMPS_NS { diff --git a/src/MACHDYN/atom_vec_smd.cpp b/src/MACHDYN/atom_vec_smd.cpp index 0a7126ee93..d1bae9ecb7 100644 --- a/src/MACHDYN/atom_vec_smd.cpp +++ b/src/MACHDYN/atom_vec_smd.cpp @@ -26,6 +26,8 @@ #include "atom.h" +#include + using namespace LAMMPS_NS; #define NMAT_FULL 9 diff --git a/src/MACHDYN/fix_smd_adjust_dt.cpp b/src/MACHDYN/fix_smd_adjust_dt.cpp index 6f7539b476..d2728f1042 100644 --- a/src/MACHDYN/fix_smd_adjust_dt.cpp +++ b/src/MACHDYN/fix_smd_adjust_dt.cpp @@ -43,8 +43,7 @@ using namespace FixConst; FixSMDTlsphDtReset::FixSMDTlsphDtReset(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (narg != 4) - error->all(FLERR, "Illegal fix smd/adjust_dt command"); + if (narg != 4) error->all(FLERR, "Illegal fix smd/adjust_dt command"); // set time_depend, else elapsed time accumulation can be messed up @@ -57,7 +56,7 @@ FixSMDTlsphDtReset::FixSMDTlsphDtReset(LAMMPS *lmp, int narg, char **arg) : extvector = 0; restart_global = 1; // this fix stores global (i.e., not per-atom) info: elaspsed time - safety_factor = atof(arg[3]); + safety_factor = utils::numeric(FLERR,arg[3],false,lmp); // initializations t_elapsed = 0.0; diff --git a/src/MACHDYN/pair_smd_hertz.cpp b/src/MACHDYN/pair_smd_hertz.cpp index 7c9eac217f..bf526f5e4e 100644 --- a/src/MACHDYN/pair_smd_hertz.cpp +++ b/src/MACHDYN/pair_smd_hertz.cpp @@ -263,7 +263,7 @@ void PairHertz::coeff(int narg, char **arg) { utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); - double bulkmodulus_one = atof(arg[2]); + double bulkmodulus_one = utils::numeric(FLERR,arg[2],false,lmp); // set short-range force constant double kn_one = 0.0; diff --git a/src/MACHDYN/pair_smd_triangulated_surface.cpp b/src/MACHDYN/pair_smd_triangulated_surface.cpp index fbd2c14aa6..e1ebc2562d 100644 --- a/src/MACHDYN/pair_smd_triangulated_surface.cpp +++ b/src/MACHDYN/pair_smd_triangulated_surface.cpp @@ -345,7 +345,7 @@ void PairTriSurf::coeff(int narg, char **arg) { utils::bounds(FLERR,arg[0], 1,atom->ntypes, ilo, ihi, error); utils::bounds(FLERR,arg[1], 1,atom->ntypes, jlo, jhi, error); - double bulkmodulus_one = atof(arg[2]); + double bulkmodulus_one = utils::numeric(FLERR,arg[2],false,lmp); // set short-range force constant double kn_one = 0.0; diff --git a/src/MANYBODY/pair_bop.cpp b/src/MANYBODY/pair_bop.cpp index 69557a425e..f8c119c436 100644 --- a/src/MANYBODY/pair_bop.cpp +++ b/src/MANYBODY/pair_bop.cpp @@ -40,7 +40,6 @@ #include "atom.h" #include "comm.h" -#include "domain.h" #include "error.h" #include "force.h" #include "math_special.h" diff --git a/src/MANYBODY/pair_extep.cpp b/src/MANYBODY/pair_extep.cpp index 30d8dc44f9..6a3b302fc1 100644 --- a/src/MANYBODY/pair_extep.cpp +++ b/src/MANYBODY/pair_extep.cpp @@ -32,7 +32,6 @@ #include #include -#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/MC/fix_mol_swap.cpp b/src/MC/fix_mol_swap.cpp index f6e421fa66..9fa22542b9 100644 --- a/src/MC/fix_mol_swap.cpp +++ b/src/MC/fix_mol_swap.cpp @@ -33,6 +33,7 @@ #include "update.h" #include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/MISC/pair_srp_react.cpp b/src/MISC/pair_srp_react.cpp index 38a09a7d1b..f8cbafaca9 100644 --- a/src/MISC/pair_srp_react.cpp +++ b/src/MISC/pair_srp_react.cpp @@ -34,14 +34,11 @@ There is an example script for this package in examples/PACKAGES/srp_react/. #include "error.h" #include "fix_srp_react.h" #include "force.h" -#include "memory.h" #include "modify.h" -#include "neigh_list.h" #include "neighbor.h" #include "output.h" #include "thermo.h" -#include #include using namespace LAMMPS_NS; diff --git a/src/MISC/pair_tracker.cpp b/src/MISC/pair_tracker.cpp index c994b02df5..1a9fb1f7c7 100644 --- a/src/MISC/pair_tracker.cpp +++ b/src/MISC/pair_tracker.cpp @@ -27,8 +27,8 @@ #include "neighbor.h" #include "tokenizer.h" #include "update.h" -#include "utils.h" +#include #include using namespace LAMMPS_NS; diff --git a/src/ML-IAP/compute_mliap.cpp b/src/ML-IAP/compute_mliap.cpp index 2c025f025a..161613fae6 100644 --- a/src/ML-IAP/compute_mliap.cpp +++ b/src/ML-IAP/compute_mliap.cpp @@ -98,9 +98,7 @@ ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) : descriptorflag = 1; } else if (strcmp(arg[iarg],"gradgradflag") == 0) { if (iarg+1 > narg) error->all(FLERR,"Illegal compute mliap command"); - gradgradflag = atoi(arg[iarg+1]); - if (gradgradflag != 0 && gradgradflag != 1) - error->all(FLERR,"Illegal compute mliap command"); + gradgradflag = utils::logical(FLERR, arg[iarg+1], false, lmp); iarg += 2; } else error->all(FLERR,"Illegal compute mliap command"); diff --git a/src/ML-IAP/mliap_model.h b/src/ML-IAP/mliap_model.h index f2a6f4a998..0f7a8e8e4f 100644 --- a/src/ML-IAP/mliap_model.h +++ b/src/ML-IAP/mliap_model.h @@ -14,7 +14,7 @@ #ifndef LMP_MLIAP_MODEL_H #define LMP_MLIAP_MODEL_H -#include "pointers.h" +#include "pointers.h" // IWYU pragma: export namespace LAMMPS_NS { diff --git a/src/ML-IAP/mliap_model_python.cpp b/src/ML-IAP/mliap_model_python.cpp index e1859d8e1d..5bd6b45c92 100644 --- a/src/ML-IAP/mliap_model_python.cpp +++ b/src/ML-IAP/mliap_model_python.cpp @@ -26,7 +26,6 @@ #include "mliap_model_python_couple.h" #include "pair_mliap.h" #include "python_compat.h" -#include "utils.h" #include diff --git a/src/ML-IAP/pair_mliap.cpp b/src/ML-IAP/pair_mliap.cpp index 38d98510ce..a79a8c0627 100644 --- a/src/ML-IAP/pair_mliap.cpp +++ b/src/ML-IAP/pair_mliap.cpp @@ -30,12 +30,10 @@ #endif #include "atom.h" -#include "comm.h" #include "error.h" #include "force.h" #include "memory.h" #include "neighbor.h" -#include "neigh_request.h" #include #include diff --git a/src/ML-POD/fitpod_command.cpp b/src/ML-POD/fitpod_command.cpp index c78f5eec76..97ef93ab91 100644 --- a/src/ML-POD/fitpod_command.cpp +++ b/src/ML-POD/fitpod_command.cpp @@ -19,25 +19,16 @@ #include "mlpod.h" -#include "atom.h" #include "comm.h" #include "error.h" -#include "force.h" -#include "math_const.h" #include "math_special.h" #include "memory.h" -#include "modify.h" -#include "neigh_list.h" -#include "neighbor.h" -#include "pair.h" #include "tokenizer.h" -#include "update.h" #include #include #include -#include -#include +#include using namespace LAMMPS_NS; using MathSpecial::powint; @@ -253,7 +244,7 @@ void FitPOD::get_exyz_files(std::vector& files, const std::string & int FitPOD::get_number_atom_exyz(std::vector& num_atom, int& num_atom_sum, std::string file) { - std::string filename = file; + std::string filename = std::move(file); FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); @@ -325,7 +316,7 @@ void FitPOD::read_exyz_file(double *lattice, double *stress, double *energy, dou int *atomtype, std::string file, std::vector species) { - std::string filename = file; + std::string filename = std::move(file); FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); @@ -459,13 +450,13 @@ void FitPOD::read_exyz_file(double *lattice, double *stress, double *energy, dou } } -void FitPOD::get_data(datastruct &data, std::vector species) +void FitPOD::get_data(datastruct &data, const std::vector& species) { get_exyz_files(data.data_files, data.data_path, data.file_extension); data.num_atom_sum = get_number_atoms(data.num_atom, data.num_atom_each_file, data.num_config, data.data_files); data.num_config_sum = data.num_atom.size(); size_t maxname = 9; - for (auto fname : data.data_files) maxname = MAX(maxname,fname.size()); + for (const auto &fname : data.data_files) maxname = MAX(maxname,fname.size()); maxname -= data.data_path.size()+1; const std::string sepline(maxname+46, '-'); if (comm->me == 0) @@ -608,7 +599,7 @@ std::vector FitPOD::select(int n, double fraction, int randomize) return selected; } -void FitPOD::select_data(datastruct &newdata, datastruct data) +void FitPOD::select_data(datastruct &newdata, const datastruct &data) { double fraction = data.fraction; int randomize = data.randomize; @@ -707,7 +698,7 @@ void FitPOD::select_data(datastruct &newdata, datastruct data) "", maxname+90, "data_file", maxname, "", maxname+90); for (int i=0; i< (int) newdata.data_files.size(); i++) { std::string filename = newdata.data_files[i].substr(newdata.data_path.size()+1,newdata.data_files[i].size()); - newdata.filenames.push_back(filename.c_str()); + newdata.filenames.emplace_back(filename.c_str()); if (comm->me == 0) utils::logmesg(lmp, " {:<{}} | {:>8} | {:>8} | {:>8} | {:>8}\n", newdata.filenames[i], maxname, newdata.num_config[i], newdata.num_atom_each_file[i], @@ -720,7 +711,7 @@ void FitPOD::select_data(datastruct &newdata, datastruct data) } } -void FitPOD::read_data_files(std::string data_file, std::vector species) +void FitPOD::read_data_files(const std::string& data_file, const std::vector& species) { datastruct data; diff --git a/src/ML-POD/fitpod_command.h b/src/ML-POD/fitpod_command.h index 201461e951..b359130240 100644 --- a/src/ML-POD/fitpod_command.h +++ b/src/ML-POD/fitpod_command.h @@ -11,7 +11,6 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ - #ifdef COMMAND_CLASS // clang-format off CommandStyle(fitpod,FitPOD); @@ -26,11 +25,11 @@ CommandStyle(fitpod,FitPOD); namespace LAMMPS_NS { class FitPOD : public Command { -public: + public: FitPOD(LAMMPS *); void command(int, char **) override; -private: + private: struct datastruct { std::string file_format = "extxyz"; std::string file_extension = "xyz"; @@ -68,7 +67,8 @@ private: double fitting_weights[12] = {100.0, 1.0, 0.0, 1, 1, 0, 0, 1, 1, 1, 1, 1e-10}; - void copydatainfo(datastruct &data) { + void copydatainfo(datastruct &data) const + { data.data_path = data_path; data.file_format = file_format; data.file_extension = file_extension; @@ -84,8 +84,7 @@ private: data.precision = precision; data.training = training; data.normalizeenergy = normalizeenergy; - for (int i = 0; i < 12; i++) - data.fitting_weights[i] = fitting_weights[i]; + for (int i = 0; i < 12; i++) data.fitting_weights[i] = fitting_weights[i]; } }; @@ -106,11 +105,11 @@ private: }; struct descriptorstruct { - double *gd; // global descriptors - double *gdd; // derivatives of global descriptors and peratom descriptors - double *A; // least-square matrix for all descriptors - double *b; // least-square vector for all descriptors - double *c; // coefficents of descriptors + double *gd; // global descriptors + double *gdd; // derivatives of global descriptors and peratom descriptors + double *A; // least-square matrix for all descriptors + double *b; // least-square vector for all descriptors + double *c; // coefficents of descriptors int *tmpint; int szd; int szi; @@ -147,24 +146,28 @@ private: // functions for reading input files and fitting - int read_data_file(double *fitting_weights, std::string &file_format, std::string &file_extension, - std::string &test_path, std::string &training_path, std::string &filenametag, const std::string &data_file); + std::string &test_path, std::string &training_path, std::string &filenametag, + const std::string &data_file); void get_exyz_files(std::vector &, const std::string &, const std::string &); - int get_number_atom_exyz(std::vector& num_atom, int& num_atom_sum, std::string file); - int get_number_atoms(std::vector& num_atom, std::vector &num_atom_sum, std::vector& num_config, std::vector training_files); + int get_number_atom_exyz(std::vector &num_atom, int &num_atom_sum, std::string file); + int get_number_atoms(std::vector &num_atom, std::vector &num_atom_sum, + std::vector &num_config, std::vector training_files); void read_exyz_file(double *lattice, double *stress, double *energy, double *pos, double *forces, - int *atomtype, std::string file, std::vector species); - void get_data(datastruct &data, std::vector species); + int *atomtype, std::string file, std::vector species); + void get_data(datastruct &data, const std::vector& species); std::vector linspace(int start_in, int end_in, int num_in); std::vector shuffle(int start_in, int end_in, int num_in); std::vector select(int n, double fraction, int randomize); - void select_data(datastruct &newdata, datastruct data); - void read_data_files(std::string data_file, std::vector species); - int latticecoords(double *y, int *alist, double *x, double *a1, double *a2, double *a3, double rcut, int *pbc, int nx); - int podneighborlist(int *neighlist, int *numneigh, double *r, double rcutsq, int nx, int N, int dim); + void select_data(datastruct &newdata, const datastruct &data); + void read_data_files(const std::string& data_file, const std::vector& species); + int latticecoords(double *y, int *alist, double *x, double *a1, double *a2, double *a3, + double rcut, int *pbc, int nx); + int podneighborlist(int *neighlist, int *numneigh, double *r, double rcutsq, int nx, int N, + int dim); int podfullneighborlist(double *y, int *alist, int *neighlist, int *numneigh, int *numneighsum, - double *x, double *a1, double *a2, double *a3, double rcut, int *pbc, int nx); + double *x, double *a1, double *a2, double *a3, double rcut, int *pbc, + int nx); void allocate_memory(const datastruct &data); void linear_descriptors(const datastruct &data, int ci); void quadratic_descriptors(const datastruct &data, int ci); @@ -177,8 +180,7 @@ private: void energyforce_calculation(const datastruct &data, double *coeff); }; -} // namespace LAMMPS_NS +} // namespace LAMMPS_NS #endif #endif - diff --git a/src/ML-POD/mlpod.cpp b/src/ML-POD/mlpod.cpp index 859b269375..ef729e3ce6 100644 --- a/src/ML-POD/mlpod.cpp +++ b/src/ML-POD/mlpod.cpp @@ -218,7 +218,7 @@ void MLPOD::podeigenvaluedecomposition(double *Phi, double *Lambda, double *bess int lwork = ns * ns; // the length of the array work, lwork >= max(1,3*N-1) int info = 1; // = 0: successful exit - std::vector work(ns*ns); + std::vector work(lwork); DSYEV(&chv, &chu, &ns, A, &ns, b, work.data(), &lwork, &info); // order eigenvalues and eigenvectors from largest to smallest diff --git a/src/ML-POD/pair_pod.cpp b/src/ML-POD/pair_pod.cpp index aaf8f730a4..d106b11a18 100644 --- a/src/ML-POD/pair_pod.cpp +++ b/src/ML-POD/pair_pod.cpp @@ -23,14 +23,9 @@ #include "comm.h" #include "error.h" #include "force.h" -#include "math_const.h" #include "memory.h" #include "neigh_list.h" #include "neighbor.h" -#include "tokenizer.h" - -#include -#include using namespace LAMMPS_NS; diff --git a/src/ML-SNAP/compute_grid.cpp b/src/ML-SNAP/compute_grid.cpp index 797020013c..d70344e1fb 100644 --- a/src/ML-SNAP/compute_grid.cpp +++ b/src/ML-SNAP/compute_grid.cpp @@ -13,14 +13,10 @@ #include "compute_grid.h" -#include "atom.h" #include "comm.h" #include "domain.h" #include "error.h" -#include "force.h" #include "memory.h" -#include "modify.h" -#include "update.h" #include diff --git a/src/ML-SNAP/compute_grid_local.cpp b/src/ML-SNAP/compute_grid_local.cpp index 6f15186625..36c4d25305 100644 --- a/src/ML-SNAP/compute_grid_local.cpp +++ b/src/ML-SNAP/compute_grid_local.cpp @@ -13,14 +13,10 @@ #include "compute_grid_local.h" -#include "atom.h" #include "comm.h" #include "domain.h" #include "error.h" -#include "force.h" #include "memory.h" -#include "modify.h" -#include "update.h" #include diff --git a/src/ML-SNAP/compute_sna_grid.cpp b/src/ML-SNAP/compute_sna_grid.cpp index f209cf9fe8..2e2f0cbb66 100644 --- a/src/ML-SNAP/compute_sna_grid.cpp +++ b/src/ML-SNAP/compute_sna_grid.cpp @@ -16,13 +16,11 @@ #include "atom.h" #include "comm.h" #include "error.h" -#include "force.h" #include "memory.h" #include "modify.h" #include "sna.h" #include "update.h" -#include #include using namespace LAMMPS_NS; diff --git a/src/ML-SNAP/compute_sna_grid_local.cpp b/src/ML-SNAP/compute_sna_grid_local.cpp index b74fbe59e5..09c989bffb 100644 --- a/src/ML-SNAP/compute_sna_grid_local.cpp +++ b/src/ML-SNAP/compute_sna_grid_local.cpp @@ -16,13 +16,11 @@ #include "atom.h" #include "comm.h" #include "error.h" -#include "force.h" #include "memory.h" #include "modify.h" #include "sna.h" #include "update.h" -#include #include using namespace LAMMPS_NS; diff --git a/src/MOLECULE/angle_cosine.cpp b/src/MOLECULE/angle_cosine.cpp index b547345b1f..86d67f94aa 100644 --- a/src/MOLECULE/angle_cosine.cpp +++ b/src/MOLECULE/angle_cosine.cpp @@ -23,6 +23,7 @@ #include "neighbor.h" #include +#include using namespace LAMMPS_NS; using MathConst::MY_PI; diff --git a/src/MOLECULE/angle_harmonic.cpp b/src/MOLECULE/angle_harmonic.cpp index ddcf44ff45..4d0683b9bc 100644 --- a/src/MOLECULE/angle_harmonic.cpp +++ b/src/MOLECULE/angle_harmonic.cpp @@ -23,6 +23,7 @@ #include "neighbor.h" #include +#include using namespace LAMMPS_NS; using MathConst::DEG2RAD; diff --git a/src/OPENMP/fix_omp.cpp b/src/OPENMP/fix_omp.cpp index 411b16441b..3a249bad82 100644 --- a/src/OPENMP/fix_omp.cpp +++ b/src/OPENMP/fix_omp.cpp @@ -25,7 +25,6 @@ #include "error.h" #include "force.h" #include "neighbor.h" -#include "neigh_request.h" #include "universe.h" #include "update.h" diff --git a/src/OPENMP/pair_brownian_omp.cpp b/src/OPENMP/pair_brownian_omp.cpp index de095bb063..45288f13dd 100644 --- a/src/OPENMP/pair_brownian_omp.cpp +++ b/src/OPENMP/pair_brownian_omp.cpp @@ -197,7 +197,6 @@ void PairBrownianOMP::eval(int iifrom, int iito, ThrData * const thr) double prethermostat; double xl[3],a_sq,a_sh,a_pu,Fbmag; double p1[3],p2[3],p3[3]; - int overlaps = 0; // scale factor for Brownian moments @@ -252,10 +251,6 @@ void PairBrownianOMP::eval(int iifrom, int iito, ThrData * const thr) h_sep = r - 2.0*radi; - // check for overlaps - - if (h_sep < 0.0) overlaps++; - // if less than minimum gap, use minimum gap instead if (r < cut_inner[itype][jtype]) diff --git a/src/OPENMP/pair_brownian_poly_omp.cpp b/src/OPENMP/pair_brownian_poly_omp.cpp index 2d28c47a1d..91a496979d 100644 --- a/src/OPENMP/pair_brownian_poly_omp.cpp +++ b/src/OPENMP/pair_brownian_poly_omp.cpp @@ -187,7 +187,6 @@ void PairBrownianPolyOMP::eval(int iifrom, int iito, ThrData * const thr) RanMars &rng = *random_thr[thr->get_tid()]; double vxmu2f = force->vxmu2f; - int overlaps = 0; double randr; double prethermostat; double xl[3],a_sq,a_sh,a_pu,Fbmag; @@ -248,10 +247,6 @@ void PairBrownianPolyOMP::eval(int iifrom, int iito, ThrData * const thr) h_sep = r - radi-radj; - // check for overlaps - - if (h_sep < 0.0) overlaps++; - // if less than minimum gap, use minimum gap instead if (r < cut_inner[itype][jtype]) diff --git a/src/OPENMP/pair_lubricate_omp.cpp b/src/OPENMP/pair_lubricate_omp.cpp index 260fcdfdc7..2145744a5b 100644 --- a/src/OPENMP/pair_lubricate_omp.cpp +++ b/src/OPENMP/pair_lubricate_omp.cpp @@ -162,8 +162,6 @@ void PairLubricateOMP::eval(int iifrom, int iito, ThrData * const thr) const int * const type = atom->type; const int nlocal = atom->nlocal; - int overlaps = 0; - ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; @@ -317,10 +315,6 @@ void PairLubricateOMP::eval(int iifrom, int iito, ThrData * const thr) h_sep = r - 2.0*radi; - // check for overlaps - - if (h_sep < 0.0) overlaps++; - // if less than the minimum gap use the minimum gap instead if (r < cut_inner[itype][jtype]) diff --git a/src/OPENMP/pair_lubricate_poly_omp.cpp b/src/OPENMP/pair_lubricate_poly_omp.cpp index b4c2380532..5b98ec7b14 100644 --- a/src/OPENMP/pair_lubricate_poly_omp.cpp +++ b/src/OPENMP/pair_lubricate_poly_omp.cpp @@ -163,8 +163,6 @@ void PairLubricatePolyOMP::eval(int iifrom, int iito, ThrData * const thr) const int * const type = atom->type; const int nlocal = atom->nlocal; - int overlaps = 0; - ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; @@ -322,10 +320,6 @@ void PairLubricatePolyOMP::eval(int iifrom, int iito, ThrData * const thr) h_sep = r - radi-radj; - // check for overlaps - - if (h_sep < 0.0) overlaps++; - // if less than the minimum gap use the minimum gap instead if (r < cut_inner[itype][jtype]) diff --git a/src/OPENMP/reaxff_hydrogen_bonds_omp.cpp b/src/OPENMP/reaxff_hydrogen_bonds_omp.cpp index e8db77389f..6e1db5ffe7 100644 --- a/src/OPENMP/reaxff_hydrogen_bonds_omp.cpp +++ b/src/OPENMP/reaxff_hydrogen_bonds_omp.cpp @@ -56,7 +56,6 @@ namespace ReaxFF { int start_j, end_j, hb_start_j, hb_end_j; int hblist[MAX_BONDS]; int itr, top; - int num_hb_intrs = 0; double r_jk, theta, cos_theta, sin_xhz4, cos_xhz1, sin_theta2; double e_hb, e_hb_thr = 0.0, exp_hb2, exp_hb3, CEhb1, CEhb2, CEhb3; rvec dcos_theta_di, dcos_theta_dj, dcos_theta_dk; @@ -140,7 +139,6 @@ namespace ReaxFF { type_i = system->my_atoms[i].type; if (type_i < 0) continue; hbp = &(system->reax_param.hbp[type_i][type_j][type_k]); - ++num_hb_intrs; Calculate_Theta(pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, &theta, &cos_theta); diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.cpp b/src/OPT/pair_ilp_graphene_hbn_opt.cpp index b93979b3f7..586c44be08 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.cpp +++ b/src/OPT/pair_ilp_graphene_hbn_opt.cpp @@ -23,17 +23,15 @@ #include "atom.h" #include "citeme.h" -#include "comm.h" #include "error.h" #include "force.h" #include "interlayer_taper.h" #include "memory.h" #include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" #include -#include +#include using namespace LAMMPS_NS; using namespace InterLayer; diff --git a/src/OPT/pair_ilp_tmd_opt.cpp b/src/OPT/pair_ilp_tmd_opt.cpp index 4a394ea5b8..834f2a0c9f 100644 --- a/src/OPT/pair_ilp_tmd_opt.cpp +++ b/src/OPT/pair_ilp_tmd_opt.cpp @@ -33,17 +33,10 @@ #include "pair_ilp_tmd_opt.h" #include "atom.h" -#include "citeme.h" #include "comm.h" -#include "error.h" -#include "force.h" #include "interlayer_taper.h" #include "memory.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "neighbor.h" -#include #include using namespace LAMMPS_NS; diff --git a/src/OPT/pair_saip_metal_opt.cpp b/src/OPT/pair_saip_metal_opt.cpp index d63294a5c4..e64b3a189e 100644 --- a/src/OPT/pair_saip_metal_opt.cpp +++ b/src/OPT/pair_saip_metal_opt.cpp @@ -34,17 +34,10 @@ #include "pair_saip_metal_opt.h" #include "atom.h" -#include "citeme.h" #include "comm.h" -#include "error.h" -#include "force.h" #include "interlayer_taper.h" #include "memory.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "neighbor.h" -#include #include using namespace LAMMPS_NS; diff --git a/src/PERI/fix_peri_neigh.cpp b/src/PERI/fix_peri_neigh.cpp index 71542b78c5..3d965b7280 100644 --- a/src/PERI/fix_peri_neigh.cpp +++ b/src/PERI/fix_peri_neigh.cpp @@ -27,7 +27,6 @@ #include "comm.h" #include "neighbor.h" #include "neigh_list.h" -#include "neigh_request.h" #include "pair.h" #include "lattice.h" #include "memory.h" diff --git a/src/PHONON/third_order.cpp b/src/PHONON/third_order.cpp index b7bba13c9f..4a8948de77 100644 --- a/src/PHONON/third_order.cpp +++ b/src/PHONON/third_order.cpp @@ -34,7 +34,6 @@ #include "memory.h" #include "modify.h" #include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" #include "pair.h" #include "timer.h" diff --git a/src/PLUGIN/plugin.cpp b/src/PLUGIN/plugin.cpp index 6cb8c14b8a..f4a0903be4 100644 --- a/src/PLUGIN/plugin.cpp +++ b/src/PLUGIN/plugin.cpp @@ -21,7 +21,6 @@ #include "force.h" #include "input.h" #include "modify.h" -#include "region.h" #include #include diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index fd02f8f240..c8112ca24d 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -60,7 +60,7 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : b_t(nullptr), p(nullptr), q(nullptr), r(nullptr), d(nullptr), qf(nullptr), q1(nullptr), q2(nullptr), qv(nullptr) { - if (narg < 8) error->all(FLERR,"Illegal fix qeq command"); + if (narg < 8) utils::missing_cmd_args(FLERR, "fix " + std::string(style), error); scalar_flag = 1; extscalar = 0; diff --git a/src/QEQ/fix_qeq_dynamic.cpp b/src/QEQ/fix_qeq_dynamic.cpp index 8e66d7e25f..3bc0650ef1 100644 --- a/src/QEQ/fix_qeq_dynamic.cpp +++ b/src/QEQ/fix_qeq_dynamic.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -34,8 +33,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -FixQEqDynamic::FixQEqDynamic(LAMMPS *lmp, int narg, char **arg) : - FixQEq(lmp, narg, arg) +FixQEqDynamic::FixQEqDynamic(LAMMPS *lmp, int narg, char **arg) : FixQEq(lmp, narg, arg) { qdamp = 0.10; qstep = 0.02; @@ -43,19 +41,20 @@ FixQEqDynamic::FixQEqDynamic(LAMMPS *lmp, int narg, char **arg) : int iarg = 8; while (iarg < narg) { - if (strcmp(arg[iarg],"qdamp") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/dynamic command"); - qdamp = atof(arg[iarg+1]); + if (strcmp(arg[iarg], "qdamp") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix qeq/dynamic qdamp", error); + qdamp = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"qstep") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/dynamic command"); - qstep = atof(arg[iarg+1]); + } else if (strcmp(arg[iarg], "qstep") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix qeq/dynamic qstep", error); + qstep = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"warn") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/dynamic command"); - maxwarn = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "warn") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix qeq/dynamic warn", error); + maxwarn = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else error->all(FLERR,"Illegal fix qeq/dynamic command"); + } else + error->all(FLERR, "Unknown fix qeq/dynamic keyword: {}", arg[iarg]); } } @@ -69,16 +68,17 @@ void FixQEqDynamic::init() if (tolerance < 1e-4) if (comm->me == 0) - error->warning(FLERR,"Fix qeq/dynamic tolerance may be too small for damped dynamics"); + error->warning(FLERR, "Fix qeq/dynamic tolerance {} may be too small for damped dynamics", + tolerance); } /* ---------------------------------------------------------------------- */ void FixQEqDynamic::pre_force(int /*vflag*/) { - int i,ii,iloop,inum,*ilist; - double qmass,dtq2; - double enegchkall,enegmaxall; + int i, ii, iloop, inum, *ilist; + double qmass, dtq2; + double enegchkall, enegmaxall; double *q = atom->q; int *mask = atom->mask; @@ -94,20 +94,20 @@ void FixQEqDynamic::pre_force(int /*vflag*/) inum = list->inum; ilist = list->ilist; - qmass = 0.016; - dtq2 = 0.5*qstep*qstep/qmass; + qmass = 0.016; + dtq2 = 0.5 * qstep * qstep / qmass; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; q1[i] = q2[i] = qf[i] = 0.0; } - for (iloop = 0; iloop < maxiter; iloop ++) { + for (iloop = 0; iloop < maxiter; iloop++) { for (ii = 0; ii < inum; ii++) { i = ilist[ii]; if (mask[i] & groupbit) { - q1[i] += qf[i]*dtq2 - qdamp*q1[i]; - q[i] += q1[i]; + q1[i] += qf[i] * dtq2 - qdamp * q1[i]; + q[i] += q1[i]; } } @@ -119,34 +119,32 @@ void FixQEqDynamic::pre_force(int /*vflag*/) enegchk = enegmax = 0.0; - for (ii = 0; ii < inum ; ii++) { + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; if (mask[i] & groupbit) { - q2[i] = enegtot-qf[i]; - enegmax = MAX(enegmax,fabs(q2[i])); + q2[i] = enegtot - qf[i]; + enegmax = MAX(enegmax, fabs(q2[i])); enegchk += fabs(q2[i]); qf[i] = q2[i]; } } - MPI_Allreduce(&enegchk,&enegchkall,1,MPI_DOUBLE,MPI_SUM,world); - enegchk = enegchkall/ngroup; - MPI_Allreduce(&enegmax,&enegmaxall,1,MPI_DOUBLE,MPI_MAX,world); + MPI_Allreduce(&enegchk, &enegchkall, 1, MPI_DOUBLE, MPI_SUM, world); + enegchk = enegchkall / ngroup; + MPI_Allreduce(&enegmax, &enegmaxall, 1, MPI_DOUBLE, MPI_MAX, world); enegmax = enegmaxall; - if ((enegchk <= tolerance) && (enegmax <= 100.0*tolerance)) break; + if ((enegchk <= tolerance) && (enegmax <= 100.0 * tolerance)) break; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - if (mask[i] & groupbit) - q1[i] += qf[i]*dtq2 - qdamp*q1[i]; + if (mask[i] & groupbit) q1[i] += qf[i] * dtq2 - qdamp * q1[i]; } } matvecs = iloop; if ((comm->me == 0) && maxwarn && (iloop >= maxiter)) - error->warning(FLERR,"Charges did not converge at step {}: {}", - update->ntimestep,enegchk); + error->warning(FLERR, "Charges did not converge at step {}: {}", update->ntimestep, enegchk); if (force->kspace) force->kspace->qsum_qsq(); } @@ -172,8 +170,7 @@ double FixQEqDynamic::compute_eneg() for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - if (mask[i] & groupbit) - qf[i] = 0.0; + if (mask[i] & groupbit) qf[i] = 0.0; } // communicating charge force to all nodes, first forward then reverse @@ -198,12 +195,12 @@ double FixQEqDynamic::compute_eneg() delr[0] = x[i][0] - x[j][0]; delr[1] = x[i][1] - x[j][1]; delr[2] = x[i][2] - x[j][2]; - rsq = delr[0]*delr[0] + delr[1]*delr[1] + delr[2]*delr[2]; + rsq = delr[0] * delr[0] + delr[1] * delr[1] + delr[2] * delr[2]; if (rsq > cutoff_sq) continue; r = sqrt(rsq); - rinv = 1.0/r; + rinv = 1.0 / r; qf[i] += q[j] * rinv; qf[j] += q[i] * rinv; } @@ -218,20 +215,17 @@ double FixQEqDynamic::compute_eneg() eneg = enegtot = 0.0; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - if (mask[i] & groupbit) - eneg += qf[i]; + if (mask[i] & groupbit) eneg += qf[i]; } - MPI_Allreduce(&eneg,&enegtot,1,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&eneg, &enegtot, 1, MPI_DOUBLE, MPI_SUM, world); return enegtot; - } /* ---------------------------------------------------------------------- */ -int FixQEqDynamic::pack_forward_comm(int n, int *list, double *buf, - int /*pbc_flag*/, int * /*pbc*/) +int FixQEqDynamic::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { - int m=0; + int m = 0; if (pack_flag == 1) for (m = 0; m < n; m++) buf[m] = atom->q[list[m]]; diff --git a/src/QEQ/fix_qeq_fire.cpp b/src/QEQ/fix_qeq_fire.cpp index b84cb3ca83..34ef51d947 100644 --- a/src/QEQ/fix_qeq_fire.cpp +++ b/src/QEQ/fix_qeq_fire.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -45,7 +44,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixQEqFire::FixQEqFire(LAMMPS *lmp, int narg, char **arg) : - FixQEq(lmp, narg, arg), comb(nullptr), comb3(nullptr) + FixQEq(lmp, narg, arg), comb(nullptr), comb3(nullptr) { qdamp = 0.20; qstep = 0.20; @@ -53,19 +52,20 @@ FixQEqFire::FixQEqFire(LAMMPS *lmp, int narg, char **arg) : int iarg = 8; while (iarg < narg) { - if (strcmp(arg[iarg],"qdamp") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/fire command"); - qdamp = atof(arg[iarg+1]); + if (strcmp(arg[iarg], "qdamp") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix qeq/fire qdamp", error); + qdamp = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"qstep") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/fire command"); - qstep = atof(arg[iarg+1]); + } else if (strcmp(arg[iarg], "qstep") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix qeq/fire qstep", error); + qstep = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"warn") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/fire command"); - maxwarn = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "warn") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix qeq/fire warn", error); + maxwarn = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else error->all(FLERR,"Illegal fix qeq/fire command"); + } else + error->all(FLERR, "Unknown fix qeq/fire keyword: {}", arg[iarg]); } } @@ -79,10 +79,11 @@ void FixQEqFire::init() if (tolerance < 1e-4) if (comm->me == 0) - error->warning(FLERR,"Fix qeq/fire tolerance may be too small for damped fires"); + error->warning(FLERR, "Fix qeq/fire tolerance {} may be too small for damped fires", + tolerance); - comb3 = dynamic_cast(force->pair_match("^comb3",0)); - if (!comb3) comb = dynamic_cast(force->pair_match("^comb",0)); + comb3 = dynamic_cast(force->pair_match("^comb3", 0)); + if (!comb3) comb = dynamic_cast(force->pair_match("^comb", 0)); } /* ---------------------------------------------------------------------- */ @@ -90,13 +91,13 @@ void FixQEqFire::init() void FixQEqFire::pre_force(int /*vflag*/) { int inum, *ilist; - int i,ii,iloop; + int i, ii, iloop; double *q = atom->q; - double vmax,vdotf,vdotfall,vdotv,vdotvall,fdotf,fdotfall; - double scale1,scale2; - double dtvone,dtv; - double enegtot,enegchk; + double vmax, vdotf, vdotfall, vdotv, vdotvall, fdotf, fdotfall; + double scale1, scale2; + double dtvone, dtv; + double enegtot, enegchk; double alpha = qdamp; double dt, dtmax; double enegchkall; @@ -118,15 +119,15 @@ void FixQEqFire::pre_force(int /*vflag*/) dt = qstep; dtmax = TMAX * dt; - for (iloop = 0; iloop < maxiter; iloop ++) { + for (iloop = 0; iloop < maxiter; iloop++) { pack_flag = 1; comm->forward_comm(this); if (comb) { - comb->yasu_char(qf,igroup); + comb->yasu_char(qf, igroup); enegtot = comb->enegtot / ngroup; } else if (comb3) { - comb3->combqeq(qf,igroup); + comb3->combqeq(qf, igroup); enegtot = comb3->enegtot / ngroup; } else { enegtot = compute_eneg(); @@ -135,7 +136,7 @@ void FixQEqFire::pre_force(int /*vflag*/) for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - qf[i] -= enegtot; // Enforce adiabatic + qf[i] -= enegtot; // Enforce adiabatic } // FIRE minimization algorithm @@ -143,30 +144,32 @@ void FixQEqFire::pre_force(int /*vflag*/) vdotf = 0.0; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - vdotf += (qv[i]*qf[i]); + vdotf += (qv[i] * qf[i]); } - MPI_Allreduce(&vdotf,&vdotfall,1,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&vdotf, &vdotfall, 1, MPI_DOUBLE, MPI_SUM, world); if (vdotfall > 0.0) { vdotv = fdotf = 0.0; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - vdotv += qv[i]*qv[i]; - fdotf += qf[i]*qf[i]; + vdotv += qv[i] * qv[i]; + fdotf += qf[i] * qf[i]; } - MPI_Allreduce(&vdotv,&vdotvall,1,MPI_DOUBLE,MPI_SUM,world); - MPI_Allreduce(&fdotf,&fdotfall,1,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&vdotv, &vdotvall, 1, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(&fdotf, &fdotfall, 1, MPI_DOUBLE, MPI_SUM, world); scale1 = 1.0 - alpha; - if (fdotfall == 0.0) scale2 = 0.0; - else scale2 = alpha * sqrt(vdotvall/fdotfall); + if (fdotfall == 0.0) + scale2 = 0.0; + else + scale2 = alpha * sqrt(vdotvall / fdotfall); for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - qv[i] = scale1*qv[i] + scale2*qf[i]; + qv[i] = scale1 * qv[i] + scale2 * qf[i]; } if (ntimestep - last_negative > DELAYSTEP) { - dt = MIN(dt*DT_GROW,dtmax); + dt = MIN(dt * DT_GROW, dtmax); alpha *= ALPHA_SHRINK; } } else { @@ -184,10 +187,10 @@ void FixQEqFire::pre_force(int /*vflag*/) double dmax = 0.1; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - vmax = MAX(fabs(qv[i]),0); - if (dtvone*vmax > dmax) dtvone = dmax/vmax; + vmax = MAX(fabs(qv[i]), 0); + if (dtvone * vmax > dmax) dtvone = dmax / vmax; } - MPI_Allreduce(&dtvone,&dtv,1,MPI_DOUBLE,MPI_MIN,world); + MPI_Allreduce(&dtvone, &dtv, 1, MPI_DOUBLE, MPI_MIN, world); //dtv = dt; // Euler integration step @@ -198,7 +201,7 @@ void FixQEqFire::pre_force(int /*vflag*/) qv[i] += dtv * qf[i]; enegchk += fabs(qf[i]); } - MPI_Allreduce(&enegchk,&enegchkall,1,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&enegchk, &enegchkall, 1, MPI_DOUBLE, MPI_SUM, world); enegchk = enegchkall / ngroup; if (enegchk < tolerance) break; @@ -206,8 +209,7 @@ void FixQEqFire::pre_force(int /*vflag*/) matvecs = iloop; if ((comm->me == 0) && maxwarn && (iloop >= maxiter)) - error->warning(FLERR,"Charges did not converge at step {}: {}", - update->ntimestep,enegchk); + error->warning(FLERR, "Charges did not converge at step {}: {}", update->ntimestep, enegchk); if (force->kspace) force->kspace->qsum_qsq(); } @@ -233,8 +235,7 @@ double FixQEqFire::compute_eneg() for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - if (mask[i] & groupbit) - qf[i] = 0.0; + if (mask[i] & groupbit) qf[i] = 0.0; } // communicating charge force to all nodes, first forward then reverse @@ -259,12 +260,12 @@ double FixQEqFire::compute_eneg() delr[0] = x[i][0] - x[j][0]; delr[1] = x[i][1] - x[j][1]; delr[2] = x[i][2] - x[j][2]; - rsq = delr[0]*delr[0] + delr[1]*delr[1] + delr[2]*delr[2]; + rsq = delr[0] * delr[0] + delr[1] * delr[1] + delr[2] * delr[2]; if (rsq > cutoff_sq) continue; r = sqrt(rsq); - rinv = 1.0/r; + rinv = 1.0 / r; qf[i] += q[j] * rinv; qf[j] += q[i] * rinv; } @@ -279,18 +280,15 @@ double FixQEqFire::compute_eneg() eneg = enegtot = 0.0; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - if (mask[i] & groupbit) - eneg += qf[i]; + if (mask[i] & groupbit) eneg += qf[i]; } - MPI_Allreduce(&eneg,&enegtot,1,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&eneg, &enegtot, 1, MPI_DOUBLE, MPI_SUM, world); return enegtot; - } /* ---------------------------------------------------------------------- */ -int FixQEqFire::pack_forward_comm(int n, int *list, double *buf, - int /*pbc_flag*/, int * /*pbc*/) +int FixQEqFire::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int m = 0; diff --git a/src/QEQ/fix_qeq_point.cpp b/src/QEQ/fix_qeq_point.cpp index 4f82bea4b5..3eb150559c 100644 --- a/src/QEQ/fix_qeq_point.cpp +++ b/src/QEQ/fix_qeq_point.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -35,13 +34,15 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -FixQEqPoint::FixQEqPoint(LAMMPS *lmp, int narg, char **arg) : - FixQEq(lmp, narg, arg) { +FixQEqPoint::FixQEqPoint(LAMMPS *lmp, int narg, char **arg) : FixQEq(lmp, narg, arg) +{ if (narg == 10) { - if (strcmp(arg[8],"warn") == 0) { - maxwarn = utils::logical(FLERR,arg[9],false,lmp); - } else error->all(FLERR,"Illegal fix qeq/point command"); - } else if (narg > 8) error->all(FLERR,"Illegal fix qeq/point command"); + if (strcmp(arg[8], "warn") == 0) { + maxwarn = utils::logical(FLERR, arg[9], false, lmp); + } else + error->all(FLERR, "Illegal fix qeq/point command"); + } else if (narg > 8) + error->all(FLERR, "Illegal fix qeq/point command"); } /* ---------------------------------------------------------------------- */ @@ -53,9 +54,11 @@ void FixQEqPoint::init() neighbor->add_request(this, NeighConst::REQ_FULL); int ntypes = atom->ntypes; - memory->create(shld,ntypes+1,ntypes+1,"qeq:shielding"); + memory->create(shld, ntypes + 1, ntypes + 1, "qeq:shielding"); } +// clang-format off + /* ---------------------------------------------------------------------- */ void FixQEqPoint::pre_force(int /*vflag*/) diff --git a/src/QEQ/fix_qeq_shielded.cpp b/src/QEQ/fix_qeq_shielded.cpp index 1a575e2c8c..6987732048 100644 --- a/src/QEQ/fix_qeq_shielded.cpp +++ b/src/QEQ/fix_qeq_shielded.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -36,13 +35,15 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -FixQEqShielded::FixQEqShielded(LAMMPS *lmp, int narg, char **arg) : - FixQEq(lmp, narg, arg) { +FixQEqShielded::FixQEqShielded(LAMMPS *lmp, int narg, char **arg) : FixQEq(lmp, narg, arg) +{ if (narg == 10) { - if (strcmp(arg[8],"warn") == 0) { - maxwarn = utils::logical(FLERR,arg[9],false,lmp); - } else error->all(FLERR,"Illegal fix qeq/shielded command"); - } else if (narg > 8) error->all(FLERR,"Illegal fix qeq/shielded command"); + if (strcmp(arg[8], "warn") == 0) { + maxwarn = utils::logical(FLERR, arg[9], false, lmp); + } else + error->all(FLERR, "Illegal fix qeq/shielded command"); + } else if (narg > 8) + error->all(FLERR, "Illegal fix qeq/shielded command"); if (reax_flag) extract_reax(); } @@ -55,14 +56,13 @@ void FixQEqShielded::init() neighbor->add_request(this, NeighConst::REQ_FULL); int ntypes = atom->ntypes; - memory->create(shld,ntypes+1,ntypes+1,"qeq:shielding"); + memory->create(shld, ntypes + 1, ntypes + 1, "qeq:shielding"); init_shielding(); int i; for (i = 1; i <= ntypes; i++) { - if (gamma[i] == 0.0) - error->all(FLERR,"Invalid param file for fix qeq/shielded"); + if (gamma[i] == 0.0) error->all(FLERR, "Invalid param file for fix qeq/shielded"); } } @@ -70,17 +70,17 @@ void FixQEqShielded::init() void FixQEqShielded::extract_reax() { - Pair *pair = force->pair_match("^reax..",0); - if (pair == nullptr) error->all(FLERR,"No pair reaxff for fix qeq/shielded"); + Pair *pair = force->pair_match("^reax..", 0); + if (pair == nullptr) error->all(FLERR, "No pair reaxff for fix qeq/shielded"); int tmp; - chi = (double *) pair->extract("chi",tmp); - eta = (double *) pair->extract("eta",tmp); - gamma = (double *) pair->extract("gamma",tmp); + chi = (double *) pair->extract("chi", tmp); + eta = (double *) pair->extract("eta", tmp); + gamma = (double *) pair->extract("gamma", tmp); if (chi == nullptr || eta == nullptr || gamma == nullptr) error->all(FLERR, "Fix qeq/shielded could not extract params from pair reaxff"); } - +// clang-format off /* ---------------------------------------------------------------------- */ void FixQEqShielded::init_shielding() diff --git a/src/QEQ/fix_qeq_slater.cpp b/src/QEQ/fix_qeq_slater.cpp index 645164b45b..e80bad04b9 100644 --- a/src/QEQ/fix_qeq_slater.cpp +++ b/src/QEQ/fix_qeq_slater.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -38,23 +37,23 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixQEqSlater::FixQEqSlater(LAMMPS *lmp, int narg, char **arg) : - FixQEq(lmp, narg, arg) +FixQEqSlater::FixQEqSlater(LAMMPS *lmp, int narg, char **arg) : FixQEq(lmp, narg, arg) { alpha = 0.20; // optional arg int iarg = 8; while (iarg < narg) { - if (strcmp(arg[iarg],"alpha") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/slater command"); - alpha = atof(arg[iarg+1]); + if (strcmp(arg[iarg], "alpha") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix qeq/slater alpha", error); + alpha = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"warn") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/slater command"); - maxwarn = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "warn") == 0) { + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix qeq/slater warn", error); + maxwarn = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else error->all(FLERR,"Illegal fix qeq/slater command"); + } else + error->all(FLERR, "Unknown fix qeq/slater keyword: {}", arg[iarg]); } if (streitz_flag) extract_streitz(); @@ -70,8 +69,7 @@ void FixQEqSlater::init() int ntypes = atom->ntypes; for (int i = 1; i <= ntypes; i++) { - if (zeta[i] == 0.0) - error->all(FLERR,"Invalid param file for fix qeq/slater"); + if (zeta[i] == 0.0) error->all(FLERR, "Invalid parameter file values for fix qeq/slater"); } } @@ -79,21 +77,19 @@ void FixQEqSlater::init() void FixQEqSlater::extract_streitz() { - Pair *pair = force->pair_match("coul/streitz",1); - if (pair == nullptr) error->all(FLERR,"No pair coul/streitz for fix qeq/slater"); + Pair *pair = force->pair_match("coul/streitz", 1); + if (pair == nullptr) error->all(FLERR, "No pair style coul/streitz for fix qeq/slater"); int tmp; - chi = (double *) pair->extract("chi",tmp); - eta = (double *) pair->extract("eta",tmp); - gamma = (double *) pair->extract("gamma",tmp); - zeta = (double *) pair->extract("zeta",tmp); - zcore = (double *) pair->extract("zcore",tmp); - if (chi == nullptr || eta == nullptr || gamma == nullptr - || zeta == nullptr || zcore == nullptr) - error->all(FLERR, - "Fix qeq/slater could not extract params from pair coul/streitz"); - + chi = (double *) pair->extract("chi", tmp); + eta = (double *) pair->extract("eta", tmp); + gamma = (double *) pair->extract("gamma", tmp); + zeta = (double *) pair->extract("zeta", tmp); + zcore = (double *) pair->extract("zcore", tmp); + if (chi == nullptr || eta == nullptr || gamma == nullptr || zeta == nullptr || zcore == nullptr) + error->all(FLERR, "Fix qeq/slater could not extract parameters from pair coul/streitz"); } +// clang-format off /* ---------------------------------------------------------------------- */ void FixQEqSlater::pre_force(int /*vflag*/) diff --git a/src/QTB/fix_qbmsst.cpp b/src/QTB/fix_qbmsst.cpp index 839e08662c..b5fb5ca77c 100644 --- a/src/QTB/fix_qbmsst.cpp +++ b/src/QTB/fix_qbmsst.cpp @@ -45,7 +45,7 @@ using namespace MathConst; FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (narg < 5) error->all(FLERR,"Illegal fix qbmsst command"); + if (narg < 5) utils::missing_cmd_args(FLERR,"fix qbmsst",error); if (strcmp(arg[3],"x") == 0) { direction = 0; @@ -57,11 +57,10 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) direction = 2; box_change |= BOX_CHANGE_Z; } else { - error->all(FLERR,"Illegal fix qbmsst command"); + error->all(FLERR,"Unknown fix qbmsst direction keyword: {}", arg[3]); } - velocity = atof(arg[4]); - if (velocity < 0) - error->all(FLERR,"Illegal fix qbmsst command"); + velocity = utils::numeric(FLERR,arg[4],false,lmp); + if (velocity < 0) error->all(FLERR,"Illegal fix qbmsst velocity value {}", velocity); // default parameters diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index b983172860..87d83da1ae 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -35,7 +35,6 @@ Contributing Author: Jacob Gissinger (jacob.r.gissinger@gmail.com) #include "modify.h" #include "molecule.h" #include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" #include "pair.h" #include "random_mars.h" @@ -52,6 +51,7 @@ Contributing Author: Jacob Gissinger (jacob.r.gissinger@gmail.com) #include #include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -2308,7 +2308,7 @@ double FixBondReact::custom_constraint(const std::string& varstr) evlstr.push_back(varstr.substr(prev3+1)); for (auto & evl : evlstr) evlcat += evl; - return input->variable->compute_equal(evlcat.c_str()); + return input->variable->compute_equal(evlcat); } /* ---------------------------------------------------------------------- @@ -4274,12 +4274,14 @@ void FixBondReact::readID(char *strarg, int iconstr, int myrxn, int i) if (isalpha(strarg[0])) { constraints[iconstr][myrxn].idtype[i] = FRAG; // fragment vs. atom ID flag int ifragment = onemol->findfragment(strarg); - if (ifragment < 0) error->one(FLERR,"Fix bond/react: Molecule fragment does not exist"); + if (ifragment < 0) + error->one(FLERR,"Fix bond/react: Molecule fragment {} does not exist", strarg); constraints[iconstr][myrxn].id[i] = ifragment; } else { constraints[iconstr][myrxn].idtype[i] = ATOM; // fragment vs. atom ID flag - int iatom = atoi(strarg); - if (iatom > onemol->natoms) error->one(FLERR,"Fix bond/react: Invalid template atom ID in map file"); + int iatom = utils::inumeric(FLERR, strarg, true, lmp); + if (iatom > onemol->natoms) + error->one(FLERR,"Fix bond/react: Invalid template atom ID {} in map file", strarg); constraints[iconstr][myrxn].id[i] = iatom; } } @@ -4287,7 +4289,7 @@ void FixBondReact::readID(char *strarg, int iconstr, int myrxn, int i) void FixBondReact::open(char *file) { fp = fopen(file,"r"); - if (fp == nullptr) error->one(FLERR, "Fix bond/react: Cannot open map file {}",file); + if (fp == nullptr) error->one(FLERR, "Fix bond/react: Cannot open map file {}", file); } void FixBondReact::readline(char *line) diff --git a/src/REAXFF/pair_reaxff.cpp b/src/REAXFF/pair_reaxff.cpp index 63c5e0d730..ef859a0cda 100644 --- a/src/REAXFF/pair_reaxff.cpp +++ b/src/REAXFF/pair_reaxff.cpp @@ -587,8 +587,8 @@ void PairReaxFF::set_far_nbr(far_neighbor_data *fdest, int PairReaxFF::estimate_reax_lists() { int itr_i, itr_j, i, j; - int num_nbrs, num_marked; - int *ilist, *jlist, *numneigh, **firstneigh, *marked; + int num_nbrs; + int *ilist, *jlist, *numneigh, **firstneigh; double d_sqr; rvec dvec; double **x; @@ -602,15 +602,11 @@ int PairReaxFF::estimate_reax_lists() firstneigh = list->firstneigh; num_nbrs = 0; - num_marked = 0; - marked = (int*) calloc(api->system->N, sizeof(int)); int numall = list->inum + list->gnum; for (itr_i = 0; itr_i < numall; ++itr_i) { i = ilist[itr_i]; - marked[i] = 1; - ++num_marked; jlist = firstneigh[i]; for (itr_j = 0; itr_j < numneigh[i]; ++itr_j) { @@ -623,8 +619,6 @@ int PairReaxFF::estimate_reax_lists() } } - free(marked); - return static_cast (MAX(num_nbrs*safezone, mincap*REAX_MIN_NBRS)); } diff --git a/src/REAXFF/reaxff_hydrogen_bonds.cpp b/src/REAXFF/reaxff_hydrogen_bonds.cpp index 5c7629ffb7..6f5c663da0 100644 --- a/src/REAXFF/reaxff_hydrogen_bonds.cpp +++ b/src/REAXFF/reaxff_hydrogen_bonds.cpp @@ -39,7 +39,6 @@ namespace ReaxFF { int start_j, end_j, hb_start_j, hb_end_j; int hblist[MAX_BONDS]; int itr, top; - int num_hb_intrs = 0; double r_jk, theta, cos_theta, sin_xhz4, cos_xhz1, sin_theta2; double e_hb, exp_hb2, exp_hb3, CEhb1, CEhb2, CEhb3; rvec dcos_theta_di, dcos_theta_dj, dcos_theta_dk; @@ -102,7 +101,6 @@ namespace ReaxFF { if (type_i < 0) continue; hbp = &(system->reax_param.hbp[type_i][type_j][type_k]); if (hbp->r0_hb <= 0.0) continue; - ++num_hb_intrs; Calculate_Theta(pbond_ij->dvec, pbond_ij->d, dvec_jk, r_jk, &theta, &cos_theta); diff --git a/src/REAXFF/reaxff_torsion_angles.cpp b/src/REAXFF/reaxff_torsion_angles.cpp index 2b94bf50ae..e9b6bc618d 100644 --- a/src/REAXFF/reaxff_torsion_angles.cpp +++ b/src/REAXFF/reaxff_torsion_angles.cpp @@ -119,7 +119,6 @@ namespace ReaxFF { int type_i, type_j, type_k, type_l; int start_j, end_j; int start_pj, end_pj, start_pk, end_pk; - int num_frb_intrs = 0; double Delta_j, Delta_k; double r_ij, r_jk, r_kl, r_li; @@ -242,7 +241,6 @@ namespace ReaxFF { if (i != l && fbh->cnt && bo_kl->BO > control->thb_cut/*0*/ && bo_ij->BO * bo_jk->BO * bo_kl->BO > control->thb_cut/*0*/) { - ++num_frb_intrs; r_kl = pbond_kl->d; BOA_kl = bo_kl->BO - control->thb_cut; diff --git a/src/REPLICA/hyper.cpp b/src/REPLICA/hyper.cpp index f045ae7a43..2c7d13766f 100644 --- a/src/REPLICA/hyper.cpp +++ b/src/REPLICA/hyper.cpp @@ -22,7 +22,6 @@ #include "fix_event_hyper.h" #include "fix_hyper.h" #include "integrate.h" -#include "memory.h" #include "min.h" #include "modify.h" #include "neighbor.h" diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index 7c08ca7b4b..1678a36e02 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -869,13 +869,11 @@ void FixShake::find_clusters() // else it's an error flag = 0; - int flag2 = 0; for (i = 0; i < nlocal; i++) for (j = 0; j < npartner[i]; j++) { if (partner_type[i][j] == 0) flag++; if (!(mask[i] & groupbit)) continue; if (!(partner_mask[i][j] & groupbit)) continue; - if (partner_bondtype[i][j] == 0) flag2++; } MPI_Allreduce(&flag,&flag_all,1,MPI_INT,MPI_SUM,world); diff --git a/src/SPH/atom_vec_sph.cpp b/src/SPH/atom_vec_sph.cpp index c27a53069e..8d92558655 100644 --- a/src/SPH/atom_vec_sph.cpp +++ b/src/SPH/atom_vec_sph.cpp @@ -15,6 +15,8 @@ #include "atom.h" +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/SPIN/atom_vec_spin.cpp b/src/SPIN/atom_vec_spin.cpp index 5534f148d3..9a7e4c6aac 100644 --- a/src/SPIN/atom_vec_spin.cpp +++ b/src/SPIN/atom_vec_spin.cpp @@ -28,6 +28,7 @@ #include "atom.h" #include +#include using namespace LAMMPS_NS; diff --git a/src/SPIN/fix_setforce_spin.cpp b/src/SPIN/fix_setforce_spin.cpp index b54dbf1b7e..156fe6afbe 100644 --- a/src/SPIN/fix_setforce_spin.cpp +++ b/src/SPIN/fix_setforce_spin.cpp @@ -24,7 +24,6 @@ #include "fix_setforce_spin.h" #include "atom.h" -#include "domain.h" #include "input.h" #include "memory.h" #include "modify.h" diff --git a/src/SPIN/pair_spin.cpp b/src/SPIN/pair_spin.cpp index 15446a2b83..909d9a977a 100644 --- a/src/SPIN/pair_spin.cpp +++ b/src/SPIN/pair_spin.cpp @@ -32,7 +32,6 @@ #include "math_const.h" #include "memory.h" #include "modify.h" -#include "neigh_request.h" #include "neighbor.h" #include "pair.h" #include "update.h" diff --git a/src/STUBS/mpi.cpp b/src/STUBS/mpi.cpp index b68270bbe8..53b83236ba 100644 --- a/src/STUBS/mpi.cpp +++ b/src/STUBS/mpi.cpp @@ -19,7 +19,6 @@ #include #include -#include #include #if defined(_WIN32) diff --git a/src/angle_hybrid.cpp b/src/angle_hybrid.cpp index f0e9002ace..7419139942 100644 --- a/src/angle_hybrid.cpp +++ b/src/angle_hybrid.cpp @@ -20,7 +20,6 @@ #include "memory.h" #include "neighbor.h" -#include #include using namespace LAMMPS_NS; diff --git a/src/atom.h b/src/atom.h index 944e0e1484..e8b1330651 100644 --- a/src/atom.h +++ b/src/atom.h @@ -21,9 +21,10 @@ namespace LAMMPS_NS { -// forward declaration +// forward declarations class AtomVec; +class Molecule; class Atom : protected Pointers { public: @@ -252,7 +253,7 @@ class Atom : protected Pointers { // 1st molecule in template stores nset = # in set int nmolecule; - class Molecule **molecules; + Molecule **molecules; // type label maps @@ -354,7 +355,7 @@ class Atom : protected Pointers { void add_molecule(int, char **); int find_molecule(const char *); std::vector get_molecule_by_id(const std::string &); - void add_molecule_atom(class Molecule *, int, int, tagint); + void add_molecule_atom(Molecule *, int, int, tagint); void add_label_map(); diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index e431488a39..bfda951823 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -20,12 +20,8 @@ #include "fix.h" #include "force.h" #include "label_map.h" -#include "math_const.h" #include "memory.h" #include "modify.h" -#include "tokenizer.h" - -#include using namespace LAMMPS_NS; diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index 6da3ee6671..538e9783df 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -22,6 +22,8 @@ #include "modify.h" #include "my_pool_chunk.h" +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/atom_vec_ellipsoid.cpp b/src/atom_vec_ellipsoid.cpp index c87179183c..59b8310d3f 100644 --- a/src/atom_vec_ellipsoid.cpp +++ b/src/atom_vec_ellipsoid.cpp @@ -25,6 +25,8 @@ #include "memory.h" #include "modify.h" +#include + using namespace LAMMPS_NS; using MathConst::MY_PI; diff --git a/src/atom_vec_hybrid.cpp b/src/atom_vec_hybrid.cpp index 5e70890414..c81ea56202 100644 --- a/src/atom_vec_hybrid.cpp +++ b/src/atom_vec_hybrid.cpp @@ -16,7 +16,6 @@ #include "atom.h" #include "comm.h" #include "error.h" -#include "tokenizer.h" #include #include diff --git a/src/atom_vec_line.cpp b/src/atom_vec_line.cpp index 92cb994f96..ff09bed6d0 100644 --- a/src/atom_vec_line.cpp +++ b/src/atom_vec_line.cpp @@ -22,6 +22,7 @@ #include "modify.h" #include +#include using namespace LAMMPS_NS; using MathConst::MY_PI; diff --git a/src/atom_vec_sphere.cpp b/src/atom_vec_sphere.cpp index c18e68855c..d2f9c51880 100644 --- a/src/atom_vec_sphere.cpp +++ b/src/atom_vec_sphere.cpp @@ -20,6 +20,8 @@ #include "math_const.h" #include "modify.h" +#include + using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/atom_vec_tri.cpp b/src/atom_vec_tri.cpp index 6c66907518..a46609b02c 100644 --- a/src/atom_vec_tri.cpp +++ b/src/atom_vec_tri.cpp @@ -24,6 +24,7 @@ #include "modify.h" #include +#include using namespace LAMMPS_NS; using MathConst::MY_PI; diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index 1528c25fe8..4e477ab3a6 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -20,7 +20,6 @@ #include "memory.h" #include "neighbor.h" -#include #include using namespace LAMMPS_NS; diff --git a/src/compute_angmom_chunk.h b/src/compute_angmom_chunk.h index f86c69fc67..04023dbe44 100644 --- a/src/compute_angmom_chunk.h +++ b/src/compute_angmom_chunk.h @@ -23,6 +23,7 @@ ComputeStyle(angmom/chunk,ComputeAngmomChunk); #include "compute.h" namespace LAMMPS_NS { + class Fix; class ComputeAngmomChunk : public Compute { public: @@ -34,8 +35,8 @@ class ComputeAngmomChunk : public Compute { void lock_enable() override; void lock_disable() override; int lock_length() override; - void lock(class Fix *, bigint, bigint) override; - void unlock(class Fix *) override; + void lock(Fix *, bigint, bigint) override; + void unlock(Fix *) override; double memory_usage() override; diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index 59139f4c68..0a0a36debd 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -17,7 +17,6 @@ #include "comm.h" #include "error.h" #include "force.h" -#include "group.h" #include "memory.h" #include "modify.h" #include "neigh_list.h" diff --git a/src/compute_com_chunk.h b/src/compute_com_chunk.h index bd7c8f6fe0..c617e181fe 100644 --- a/src/compute_com_chunk.h +++ b/src/compute_com_chunk.h @@ -23,6 +23,7 @@ ComputeStyle(com/chunk,ComputeCOMChunk); #include "compute.h" namespace LAMMPS_NS { +class Fix; class ComputeCOMChunk : public Compute { public: @@ -38,8 +39,8 @@ class ComputeCOMChunk : public Compute { void lock_enable() override; void lock_disable() override; int lock_length() override; - void lock(class Fix *, bigint, bigint) override; - void unlock(class Fix *) override; + void lock(Fix *, bigint, bigint) override; + void unlock(Fix *) override; double memory_usage() override; diff --git a/src/compute_dipole_chunk.h b/src/compute_dipole_chunk.h index df2a75712e..42198fe478 100644 --- a/src/compute_dipole_chunk.h +++ b/src/compute_dipole_chunk.h @@ -23,6 +23,7 @@ ComputeStyle(dipole/chunk,ComputeDipoleChunk); #include "compute.h" namespace LAMMPS_NS { +class Fix; class ComputeDipoleChunk : public Compute { public: @@ -34,8 +35,8 @@ class ComputeDipoleChunk : public Compute { void lock_enable() override; void lock_disable() override; int lock_length() override; - void lock(class Fix *, bigint, bigint) override; - void unlock(class Fix *) override; + void lock(Fix *, bigint, bigint) override; + void unlock(Fix *) override; double memory_usage() override; diff --git a/src/compute_fragment_atom.cpp b/src/compute_fragment_atom.cpp index 177b62b5ac..a1fd19d7af 100644 --- a/src/compute_fragment_atom.cpp +++ b/src/compute_fragment_atom.cpp @@ -148,11 +148,7 @@ void ComputeFragmentAtom::compute_peratom() commflag = 1; - int iteration = 0; - while (true) { - iteration++; - comm->forward_comm(this); done = 1; diff --git a/src/compute_reduce.cpp b/src/compute_reduce.cpp index 14c381c84d..f2afeab3e6 100644 --- a/src/compute_reduce.cpp +++ b/src/compute_reduce.cpp @@ -26,6 +26,7 @@ #include "update.h" #include "variable.h" +#include #include using namespace LAMMPS_NS; diff --git a/src/compute_reduce_region.cpp b/src/compute_reduce_region.cpp index f79e160684..efce00ff66 100644 --- a/src/compute_reduce_region.cpp +++ b/src/compute_reduce_region.cpp @@ -15,13 +15,11 @@ #include "arg_info.h" #include "atom.h" -#include "domain.h" #include "error.h" #include "fix.h" #include "group.h" #include "input.h" #include "memory.h" -#include "modify.h" #include "region.h" #include "update.h" #include "variable.h" diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index 7fda4a4cdb..9c66d1d19b 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -38,7 +38,9 @@ #include "text_file_reader.h" #include "variable.h" +#include #include +#include using namespace LAMMPS_NS; using MathConst::MY_2PI; diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp index 3b36f45500..c6d3f1838e 100644 --- a/src/create_bonds.cpp +++ b/src/create_bonds.cpp @@ -26,7 +26,6 @@ #include "force.h" #include "group.h" #include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" #include "special.h" diff --git a/src/dihedral_hybrid.cpp b/src/dihedral_hybrid.cpp index 734009b901..d38ccf5d52 100644 --- a/src/dihedral_hybrid.cpp +++ b/src/dihedral_hybrid.cpp @@ -20,7 +20,6 @@ #include "memory.h" #include "neighbor.h" -#include #include using namespace LAMMPS_NS; diff --git a/src/domain.h b/src/domain.h index 7d3194ccc9..1999baac2b 100644 --- a/src/domain.h +++ b/src/domain.h @@ -19,7 +19,6 @@ #include #include #include -#include namespace LAMMPS_NS { class Region; diff --git a/src/dump.cpp b/src/dump.cpp index 93d9ee30bf..82a25c31f2 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -29,6 +29,7 @@ #include "variable.h" #include +#include using namespace LAMMPS_NS; diff --git a/src/finish.cpp b/src/finish.cpp index 3217d025f9..554f250fe1 100644 --- a/src/finish.cpp +++ b/src/finish.cpp @@ -24,8 +24,6 @@ #include "memory.h" // IWYU pragma: keep #include "min.h" #include "molecule.h" -#include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" // IWYU pragma: keep #include "output.h" #include "pair.h" diff --git a/src/fix_ave_time.cpp b/src/fix_ave_time.cpp index 0d1797fc6d..6c0397c74b 100644 --- a/src/fix_ave_time.cpp +++ b/src/fix_ave_time.cpp @@ -29,6 +29,7 @@ #include "variable.h" #include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/fix_bond_history.h b/src/fix_bond_history.h index 23d6a62d52..fafcf52bd9 100644 --- a/src/fix_bond_history.h +++ b/src/fix_bond_history.h @@ -24,7 +24,6 @@ FixStyle(BOND_HISTORY,FixBondHistory); #include #include -#include namespace LAMMPS_NS { diff --git a/src/fix_nve.cpp b/src/fix_nve.cpp index af87eb42d8..30c1f24867 100644 --- a/src/fix_nve.cpp +++ b/src/fix_nve.cpp @@ -15,7 +15,6 @@ #include "fix_nve.h" #include "atom.h" -#include "error.h" #include "force.h" #include "respa.h" #include "update.h" diff --git a/src/fix_nve_noforce.cpp b/src/fix_nve_noforce.cpp index aaac45adb0..27fcc49f13 100644 --- a/src/fix_nve_noforce.cpp +++ b/src/fix_nve_noforce.cpp @@ -14,7 +14,6 @@ #include "fix_nve_noforce.h" #include "atom.h" -#include "error.h" #include "respa.h" #include "update.h" diff --git a/src/fix_pair.cpp b/src/fix_pair.cpp index 360cee2d5a..5e5ccbf810 100644 --- a/src/fix_pair.cpp +++ b/src/fix_pair.cpp @@ -15,19 +15,12 @@ #include "fix_pair.h" #include "atom.h" -#include "dump.h" #include "error.h" #include "force.h" #include "fix.h" -#include "input.h" #include "memory.h" #include "pair.h" -#include "output.h" -#include "variable.h" #include "update.h" -#include "variable.h" - -#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/fix_store_global.cpp b/src/fix_store_global.cpp index 0d71deb1fa..cebf4f7690 100644 --- a/src/fix_store_global.cpp +++ b/src/fix_store_global.cpp @@ -13,7 +13,6 @@ #include "fix_store_global.h" -#include "atom.h" #include "comm.h" #include "error.h" #include "memory.h" diff --git a/src/fix_store_local.cpp b/src/fix_store_local.cpp index 74083257d0..d32f0e8178 100644 --- a/src/fix_store_local.cpp +++ b/src/fix_store_local.cpp @@ -14,7 +14,6 @@ #include "fix_store_local.h" #include "atom.h" -#include "comm.h" #include "error.h" #include "memory.h" #include "update.h" diff --git a/src/fix_store_peratom.cpp b/src/fix_store_peratom.cpp index d11cb7d8c1..6f5637e3f6 100644 --- a/src/fix_store_peratom.cpp +++ b/src/fix_store_peratom.cpp @@ -14,7 +14,6 @@ #include "fix_store_peratom.h" #include "atom.h" -#include "comm.h" #include "error.h" #include "memory.h" diff --git a/src/fix_update_special_bonds.cpp b/src/fix_update_special_bonds.cpp index b96b079846..46e7eac699 100644 --- a/src/fix_update_special_bonds.cpp +++ b/src/fix_update_special_bonds.cpp @@ -19,7 +19,6 @@ #include "force.h" #include "modify.h" #include "neigh_list.h" -#include "neighbor.h" #include "pair.h" #include diff --git a/src/fix_update_special_bonds.h b/src/fix_update_special_bonds.h index 722d8f5369..b211cbec64 100644 --- a/src/fix_update_special_bonds.h +++ b/src/fix_update_special_bonds.h @@ -23,7 +23,6 @@ FixStyle(UPDATE_SPECIAL_BONDS,FixUpdateSpecialBonds); #include "fix.h" #include -#include namespace LAMMPS_NS { diff --git a/src/image.cpp b/src/image.cpp index 8c503adf92..9587d4ca81 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -981,7 +981,6 @@ void Image::compute_SSAO() double minPeak = -1; double peakLen = 0.0; - int stepsTaken = 1; while ((small > 0 && ind <= end) || (small < 0 && ind >= end)) { if (ind < 0 || ind >= (width*height)) { break; @@ -1001,7 +1000,6 @@ void Image::compute_SSAO() ind += large; err -= 1.0; } - stepsTaken ++; } if (peakLen > 0) { diff --git a/src/imbalance_neigh.cpp b/src/imbalance_neigh.cpp index ade49dd8e4..40b7f6b249 100644 --- a/src/imbalance_neigh.cpp +++ b/src/imbalance_neigh.cpp @@ -17,8 +17,6 @@ #include "atom.h" #include "comm.h" #include "error.h" -#include "neigh_list.h" -#include "neigh_request.h" #include "neighbor.h" using namespace LAMMPS_NS; diff --git a/src/improper_hybrid.cpp b/src/improper_hybrid.cpp index b78e1ab5ca..9aa20d236e 100644 --- a/src/improper_hybrid.cpp +++ b/src/improper_hybrid.cpp @@ -20,7 +20,6 @@ #include "memory.h" #include "neighbor.h" -#include #include using namespace LAMMPS_NS; diff --git a/src/info.cpp b/src/info.cpp index 1e1e8122aa..cd1b2eddf6 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -63,7 +63,9 @@ #endif #if defined(__linux__) +#include #include +#include #endif namespace LAMMPS_NS { @@ -1185,11 +1187,10 @@ bool Info::has_accelerator_feature(const std::string &package, } if (category == "api") { #if defined(_OPENMP) - if (setting == "openmp") return true; + return setting == "openmp"; #else - if (setting == "serial") return true; + return setting == "serial"; #endif - return false; } } #endif @@ -1198,7 +1199,7 @@ bool Info::has_accelerator_feature(const std::string &package, if (category == "precision") { if (setting == "double") return true; else if (setting == "mixed") return true; - else if (setting == "single")return true; + else if (setting == "single") return true; else return false; } if (category == "api") { diff --git a/src/label_map.cpp b/src/label_map.cpp index e1cde7cae4..67b1ae480d 100644 --- a/src/label_map.cpp +++ b/src/label_map.cpp @@ -17,7 +17,6 @@ #include "comm.h" #include "error.h" #include "force.h" -#include "memory.h" #include diff --git a/src/lammps.cpp b/src/lammps.cpp index 5e9fed61b7..cc32578f22 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -527,7 +527,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : // warn against using I/O redirection in parallel runs if ((inflag == 0) && (universe->nprocs > 1)) error->warning(FLERR, "Using I/O redirection is unreliable with parallel runs. " - "Better use -in switch to read input file."); + "Better to use the -in switch to read input files."); utils::flush_buffers(this); } diff --git a/src/lattice.cpp b/src/lattice.cpp index 53f4996581..edb482cfac 100644 --- a/src/lattice.cpp +++ b/src/lattice.cpp @@ -53,14 +53,7 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) if (style == NONE) { if (narg != 2) error->all(FLERR,"Illegal lattice command: expected 2 arguments but found {}", narg); - // Domain creates a default lattice of style "none" - // before Force class is instantiated, just use atof() in that case - - if (force) - xlattice = ylattice = zlattice = utils::numeric(FLERR,arg[1],false,lmp); - else - xlattice = ylattice = zlattice = atof(arg[1]); - + xlattice = ylattice = zlattice = utils::numeric(FLERR,arg[1],false,lmp); if (xlattice <= 0.0) error->all(FLERR, "Invalid lattice none argument: {}", arg[1]); return; } diff --git a/src/modify.h b/src/modify.h index 994f8ad724..b508022461 100644 --- a/src/modify.h +++ b/src/modify.h @@ -17,7 +17,6 @@ #include "pointers.h" #include -#include namespace LAMMPS_NS { diff --git a/src/pair_zero.cpp b/src/pair_zero.cpp index 3e4785b2fb..c62479d1c4 100644 --- a/src/pair_zero.cpp +++ b/src/pair_zero.cpp @@ -21,7 +21,6 @@ #include "comm.h" #include "error.h" #include "memory.h" -#include "neigh_list.h" #include "neighbor.h" #include diff --git a/src/platform.cpp b/src/platform.cpp index 2d9c3aa6a8..861e3d7722 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -16,6 +16,8 @@ * the "utils" namespace with convenience and utility functions. */ #include "platform.h" + +#include "fmt/format.h" #include "text_file_reader.h" #include "utils.h" diff --git a/src/pointers.h b/src/pointers.h index 494daa8ffb..09efa49cbc 100644 --- a/src/pointers.h +++ b/src/pointers.h @@ -28,6 +28,7 @@ #include // IWYU pragme: export #include // IWYU pragma: export #include // IWYU pragma: export +#include // IWYU pragma: export #include "fmt/format.h" // IWYU pragma: export #include "lammps.h" // IWYU pragma: export diff --git a/src/random_mars.cpp b/src/random_mars.cpp index fc5418146a..8f1105e0d9 100644 --- a/src/random_mars.cpp +++ b/src/random_mars.cpp @@ -187,7 +187,7 @@ double RanMars::besselexp(double theta, double alpha, double cp) void RanMars::select_subset(bigint ntarget, int nmine, int *mark, int *next) { - int mode,index,oldindex,newvalue,nflip,which,niter; + int mode,index,oldindex,newvalue,nflip,which; int active[2],first[2]; int newactive[2],newfirst[2],newlast[2]; bigint nmark,nflipall; @@ -209,8 +209,6 @@ void RanMars::select_subset(bigint ntarget, int nmine, int *mark, int *next) if (nmine > 0) next[nmine-1] = -1; nmark = 0; - niter = 0; - while (nmark != ntarget) { // choose to ADD or SUBTRACT from current nmark @@ -285,13 +283,6 @@ void RanMars::select_subset(bigint ntarget, int nmine, int *mark, int *next) if (mode == ADD) nmark += nflipall; else if (mode == SUBTRACT) nmark -= nflipall; - - niter++; - - // DEBUG output of stats - - //if (comm->me == 0) printf("%d %ld %ld %g %ld\n", - // niter,nmark,nactiveall,thresh,nflipall); } } diff --git a/src/read_data.cpp b/src/read_data.cpp index 5317a4217a..9d9d7139a5 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -41,6 +41,7 @@ #include #include +#include #include using namespace LAMMPS_NS; diff --git a/src/reader_native.cpp b/src/reader_native.cpp index e2bc74d64a..3e7d01550d 100644 --- a/src/reader_native.cpp +++ b/src/reader_native.cpp @@ -19,6 +19,7 @@ #include "tokenizer.h" #include +#include #include using namespace LAMMPS_NS; diff --git a/src/region_ellipsoid.cpp b/src/region_ellipsoid.cpp index a84bb61242..9a3b77bd8f 100644 --- a/src/region_ellipsoid.cpp +++ b/src/region_ellipsoid.cpp @@ -16,7 +16,6 @@ #include "domain.h" #include "error.h" #include "input.h" -#include "update.h" #include "variable.h" #include diff --git a/src/reset_atoms_image.cpp b/src/reset_atoms_image.cpp index 5f02ced963..56a1bf9f99 100644 --- a/src/reset_atoms_image.cpp +++ b/src/reset_atoms_image.cpp @@ -25,7 +25,6 @@ #include "variable.h" #include -#include using namespace LAMMPS_NS; diff --git a/src/text_file_reader.h b/src/text_file_reader.h index a725a6f81b..cc62471f66 100644 --- a/src/text_file_reader.h +++ b/src/text_file_reader.h @@ -21,6 +21,8 @@ #include "tokenizer.h" // IWYU pragma: export #include +#include +#include namespace LAMMPS_NS { class TextFileReader { diff --git a/src/thermo.cpp b/src/thermo.cpp index 8dccceae8d..122463a25f 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -47,6 +47,7 @@ #include #include +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/timer.cpp b/src/timer.cpp index 23f060491e..5bc397714a 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -18,6 +18,7 @@ #include "fmt/chrono.h" #include +#include using namespace LAMMPS_NS; diff --git a/src/variable.cpp b/src/variable.cpp index bb45649208..c07e62648b 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -4529,7 +4529,7 @@ void Variable::peratom2global(int flag, char *word, double *vector, int nstride, error->one(FLERR,"Variable uses atom property that isn't allocated"); mine = atom->q[index]; } - else error->one(FLERR,"Invalid atom vector in variable formula"); + else error->one(FLERR,"Invalid atom vector {} in variable formula", word); } else mine = vector[index*nstride]; diff --git a/unittest/commands/test_kim_commands.cpp b/unittest/commands/test_kim_commands.cpp index 0868d20a8d..988b0db69a 100644 --- a/unittest/commands/test_kim_commands.cpp +++ b/unittest/commands/test_kim_commands.cpp @@ -307,17 +307,17 @@ TEST_F(KimCommandsTest, kim_param) ASSERT_THAT(variable->retrieve("shift"), StrEq("2")); - TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", + TEST_FAILURE(".*ERROR: Illegal variable name 'list' in 'kim param get'.*", command("kim param get cutoffs 1:3 list");); - TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", + TEST_FAILURE(".*ERROR: Illegal variable name 'list' in 'kim param get'.*", command("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 list");); - TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", + TEST_FAILURE(".*ERROR: Illegal variable name 'split' in 'kim param get'.*", command("kim param get cutoffs 1:3 split");); - TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", + TEST_FAILURE(".*ERROR: Illegal variable name 'split' in 'kim param get'.*", command("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 split");); - TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", + TEST_FAILURE(".*ERROR: Illegal variable name 'explicit' in 'kim param get'.*", command("kim param get cutoffs 1:3 explicit");); - TEST_FAILURE(".*ERROR: Illegal variable name in 'kim param get'.*", + TEST_FAILURE(".*ERROR: Illegal variable name 'explicit' in 'kim param get'.*", command("kim param get cutoffs 1:3 cutoffs_1 cutoffs_2 explicit");); TEST_FAILURE(".*ERROR: Wrong number of arguments in 'kim param get' " "command.\nThe LAMMPS '3' variable names or 'cutoffs " diff --git a/unittest/fortran/CMakeLists.txt b/unittest/fortran/CMakeLists.txt index f66b333db1..b534835a5e 100644 --- a/unittest/fortran/CMakeLists.txt +++ b/unittest/fortran/CMakeLists.txt @@ -21,20 +21,6 @@ if(CMAKE_Fortran_COMPILER) endif() get_filename_component(LAMMPS_FORTRAN_MODULE ${LAMMPS_SOURCE_DIR}/../fortran/lammps.f90 ABSOLUTE) - if(BUILD_MPI) - find_package(MPI REQUIRED) - if((NOT MPI_Fortran_FOUND) OR (NOT MPI_Fortran_HAVE_F77_HEADER)) - message(STATUS "Skipping Tests for the LAMMPS Fortran Module: no MPI support for Fortran") - return() - endif() - else() - add_library(fmpi_stubs STATIC mpi_stubs.f90) - get_filename_component(_tmp_fc ${CMAKE_Fortran_COMPILER} NAME) - if (_tmp_fc STREQUAL "flang") - target_link_libraries(fmpi_stubs PUBLIC gfortran) - endif() - add_library(MPI::MPI_Fortran ALIAS fmpi_stubs) - endif() add_library(flammps STATIC ${LAMMPS_FORTRAN_MODULE} keepstuff.f90) get_filename_component(_tmp_fc ${CMAKE_Fortran_COMPILER} NAME) @@ -42,66 +28,62 @@ if(CMAKE_Fortran_COMPILER) target_link_libraries(flammps PUBLIC gfortran) endif() - if(MPI_Fortran_HAVE_F90_MODULE) - add_executable(test_fortran_create wrap_create.cpp test_fortran_create.f90) - target_link_libraries(test_fortran_create PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain) - target_include_directories(test_fortran_create PRIVATE "${LAMMPS_SOURCE_DIR}/../fortran") - add_test(NAME FortranOpen COMMAND test_fortran_create) - else() - message(STATUS "Skipping FortranOpen test since no working F90 MPI module was found") - endif() + add_executable(test_fortran_create wrap_create.cpp test_fortran_create.f90) + target_link_libraries(test_fortran_create PRIVATE flammps lammps GTest::GTestMain) + target_include_directories(test_fortran_create PRIVATE "${LAMMPS_SOURCE_DIR}/../fortran") + add_test(NAME FortranOpen COMMAND test_fortran_create) add_executable(test_fortran_commands wrap_commands.cpp test_fortran_commands.f90) - target_link_libraries(test_fortran_commands PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain) + target_link_libraries(test_fortran_commands PRIVATE flammps lammps GTest::GTestMain) add_test(NAME FortranCommands COMMAND test_fortran_commands) add_executable(test_fortran_get_thermo wrap_get_thermo.cpp test_fortran_get_thermo.f90) - target_link_libraries(test_fortran_get_thermo PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain) + target_link_libraries(test_fortran_get_thermo PRIVATE flammps lammps GTest::GTestMain) add_test(NAME FortranGetThermo COMMAND test_fortran_get_thermo) add_executable(test_fortran_box wrap_box.cpp test_fortran_box.f90) - target_link_libraries(test_fortran_box PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain) + target_link_libraries(test_fortran_box PRIVATE flammps lammps GTest::GTestMain) add_test(NAME FortranBox COMMAND test_fortran_box) add_executable(test_fortran_properties wrap_properties.cpp test_fortran_properties.f90 test_fortran_commands.f90) - target_link_libraries(test_fortran_properties PRIVATE flammps lammps MPI::MPI_Fortran GTest::GMockMain) + target_link_libraries(test_fortran_properties PRIVATE flammps lammps GTest::GMockMain) add_test(NAME FortranProperties COMMAND test_fortran_properties) add_executable(test_fortran_extract_global wrap_extract_global.cpp test_fortran_extract_global.f90) - target_link_libraries(test_fortran_extract_global PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain) + target_link_libraries(test_fortran_extract_global PRIVATE flammps lammps GTest::GTestMain) add_test(NAME FortranExtractGlobal COMMAND test_fortran_extract_global) add_executable(test_fortran_extract_atom wrap_extract_atom.cpp test_fortran_extract_atom.f90) - target_link_libraries(test_fortran_extract_atom PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain) + target_link_libraries(test_fortran_extract_atom PRIVATE flammps lammps GTest::GTestMain) add_test(NAME FortranExtractAtom COMMAND test_fortran_extract_atom) add_executable(test_fortran_extract_compute wrap_extract_compute.cpp test_fortran_extract_compute.f90) - target_link_libraries(test_fortran_extract_compute PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain) + target_link_libraries(test_fortran_extract_compute PRIVATE flammps lammps GTest::GTestMain) add_test(NAME FortranExtractCompute COMMAND test_fortran_extract_compute) add_executable(test_fortran_extract_fix wrap_extract_fix.cpp test_fortran_extract_fix.f90) - target_link_libraries(test_fortran_extract_fix PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain) + target_link_libraries(test_fortran_extract_fix PRIVATE flammps lammps GTest::GTestMain) add_test(NAME FortranExtractFix COMMAND test_fortran_extract_fix) add_executable(test_fortran_extract_variable wrap_extract_variable.cpp test_fortran_extract_variable.f90) target_compile_definitions(test_fortran_extract_variable PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(test_fortran_extract_variable PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain) + target_link_libraries(test_fortran_extract_variable PRIVATE flammps lammps GTest::GTestMain) add_test(NAME FortranExtractVariable COMMAND test_fortran_extract_variable) add_executable(test_fortran_gather_scatter wrap_gather_scatter.cpp test_fortran_gather_scatter.f90) - target_link_libraries(test_fortran_gather_scatter PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain) + target_link_libraries(test_fortran_gather_scatter PRIVATE flammps lammps GTest::GTestMain) add_test(NAME FortranGatherScatter COMMAND test_fortran_gather_scatter) add_executable(test_fortran_create_atoms wrap_create_atoms.cpp test_fortran_create_atoms.f90) - target_link_libraries(test_fortran_create_atoms PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain) + target_link_libraries(test_fortran_create_atoms PRIVATE flammps lammps GTest::GTestMain) add_test(NAME FortranCreateAtoms COMMAND test_fortran_create_atoms) add_executable(test_fortran_configuration wrap_configuration.cpp test_fortran_configuration.f90 test_fortran_commands.f90) - target_link_libraries(test_fortran_configuration PRIVATE flammps lammps MPI::MPI_Fortran GTest::GMockMain) + target_link_libraries(test_fortran_configuration PRIVATE flammps lammps GTest::GMockMain) add_test(NAME FortranConfiguration COMMAND test_fortran_configuration) add_executable(test_fortran_neighlist wrap_neighlist.cpp test_fortran_neighlist.f90) - target_link_libraries(test_fortran_neighlist PRIVATE flammps lammps MPI::MPI_Fortran GTest::GMockMain) + target_link_libraries(test_fortran_neighlist PRIVATE flammps lammps GTest::GMockMain) add_test(NAME FortranNeighlist COMMAND test_fortran_neighlist) else() diff --git a/unittest/fortran/mpi_stubs.f90 b/unittest/fortran/mpi_stubs.f90 deleted file mode 100644 index 8601f436d2..0000000000 --- a/unittest/fortran/mpi_stubs.f90 +++ /dev/null @@ -1,20 +0,0 @@ -MODULE MPI - IMPLICIT NONE - PRIVATE - - INTEGER, PARAMETER :: MPI_COMM_WORLD=0 - INTEGER, PARAMETER :: MPI_SUCCESS=0 - - PUBLIC :: MPI_COMM_WORLD, MPI_SUCCESS, & - mpi_comm_split - -CONTAINS - - SUBROUTINE mpi_comm_split(comm,color,key,newcomm,ierr) - INTEGER, INTENT(in) :: comm,color,key - INTEGER, INTENT(out) :: newcomm,ierr - - newcomm = comm + 1 - ierr = 0 - END SUBROUTINE mpi_comm_split -END MODULE MPI diff --git a/unittest/fortran/test_fortran_create.f90 b/unittest/fortran/test_fortran_create.f90 index 4ea2a33cfe..fed67064f0 100644 --- a/unittest/fortran/test_fortran_create.f90 +++ b/unittest/fortran/test_fortran_create.f90 @@ -1,3 +1,20 @@ +MODULE MYMPI + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int + + IMPLICIT NONE + PRIVATE + PUBLIC :: lmp_comm_split + + INTERFACE + FUNCTION lmp_comm_split(color, key) BIND(C,name='create_mpi_comm_split') + IMPORT :: c_int + IMPLICIT NONE + INTEGER(c_int), VALUE, INTENT(IN) :: color, key + INTEGER(c_int) :: lmp_comm_split + END FUNCTION lmp_comm_split + END INTERFACE +END MODULE MYMPI + FUNCTION f_lammps_no_mpi_no_args() BIND(C, name="f_lammps_no_mpi_no_args") USE ISO_C_BINDING, ONLY: c_ptr USE liblammps @@ -25,35 +42,35 @@ END FUNCTION f_lammps_no_mpi_with_args FUNCTION f_lammps_open_no_args() BIND(C, name="f_lammps_open_no_args") USE ISO_C_BINDING, ONLY: c_ptr - USE MPI, ONLY: MPI_COMM_WORLD, mpi_comm_split + USE MYMPI, ONLY: lmp_comm_split USE liblammps USE keepstuff, ONLY: lmp,mycomm IMPLICIT NONE TYPE(c_ptr) :: f_lammps_open_no_args - INTEGER :: color, key, ierr + INTEGER :: color, key color = 1 key = 1 - CALL mpi_comm_split(MPI_COMM_WORLD, color, key, mycomm, ierr) + mycomm = lmp_comm_split(color, key) lmp = lammps(comm=mycomm) f_lammps_open_no_args = lmp%handle END FUNCTION f_lammps_open_no_args FUNCTION f_lammps_open_with_args() BIND(C, name="f_lammps_open_with_args") USE ISO_C_BINDING, ONLY: c_ptr - USE MPI, ONLY: MPI_COMM_WORLD, mpi_comm_split + USE MYMPI, ONLY: lmp_comm_split USE liblammps USE keepstuff, ONLY: lmp,mycomm IMPLICIT NONE TYPE(c_ptr) :: f_lammps_open_with_args - INTEGER :: color, key, ierr + INTEGER :: color, key CHARACTER(len=12), DIMENSION(4), PARAMETER :: args = & [ CHARACTER(len=12) :: 'liblammps', '-log', 'none', '-nocite' ] color = 2 key = 1 - CALL mpi_comm_split(MPI_COMM_WORLD, color, key, mycomm, ierr) + mycomm = lmp_comm_split(color, key) lmp = lammps(args,mycomm) f_lammps_open_with_args = lmp%handle END FUNCTION f_lammps_open_with_args diff --git a/unittest/fortran/wrap_create.cpp b/unittest/fortran/wrap_create.cpp index 04a62e4040..789e9fca6a 100644 --- a/unittest/fortran/wrap_create.cpp +++ b/unittest/fortran/wrap_create.cpp @@ -17,6 +17,14 @@ void f_lammps_close(); int f_lammps_get_comm(); } +// C wrapper to split MPI communicator w/o requiring a Fortran MPI lib +extern "C" int create_mpi_comm_split(int color, int key) +{ + MPI_Comm c_newcomm = MPI_COMM_NULL; + MPI_Comm_split(MPI_COMM_WORLD, color, key, &c_newcomm); + return MPI_Comm_c2f(c_newcomm); +} + TEST(open_no_mpi, no_args) { ::testing::internal::CaptureStdout(); diff --git a/unittest/fortran/wrap_gather_scatter.cpp b/unittest/fortran/wrap_gather_scatter.cpp index 9eb6082202..f200e91b48 100644 --- a/unittest/fortran/wrap_gather_scatter.cpp +++ b/unittest/fortran/wrap_gather_scatter.cpp @@ -208,11 +208,11 @@ TEST_F(LAMMPS_gather_scatter, scatter_atoms_subset_mask) TEST_F(LAMMPS_gather_scatter, gather_bonds) { - f_lammps_setup_gather_bonds(); + if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP(); + f_lammps_setup_gather_bonds(); #ifdef LAMMPS_BIGBIG - EXPECT_EQ(f_lammps_test_gather_bonds_big(), 1); + EXPECT_EQ(f_lammps_test_gather_bonds_big(), 1); #else - EXPECT_EQ(f_lammps_test_gather_bonds_small(), 1); + EXPECT_EQ(f_lammps_test_gather_bonds_small(), 1); #endif - };