diff --git a/src/AMOEBA/amoeba_file.cpp b/src/AMOEBA/amoeba_file.cpp index 6bf961cdab..0b707047bf 100644 --- a/src/AMOEBA/amoeba_file.cpp +++ b/src/AMOEBA/amoeba_file.cpp @@ -34,14 +34,14 @@ enum{MUTUAL,OPT,TCG,DIRECT}; enum{NOFRAME,ZONLY,ZTHENX,BISECTOR,ZBISECT,THREEFOLD}; enum{GEAR,ASPC,LSQR}; -#define MAXLINE 65536 // crazy big for TORSION-TORSION section -#define MAX_TYPE_PER_GROUP 6 // max types per AMOEBA group -#define MAX_FRAME_PER_TYPE 32 // max multipole frames for any AMOEBA type +static constexpr int MAXLINE = 65536; // crazy big for TORSION-TORSION section +static constexpr int MAX_TYPE_PER_GROUP = 6; // max types per AMOEBA group +static constexpr int MAX_FRAME_PER_TYPE = 32; // max multipole frames for any AMOEBA type -#define DELTA_TYPE_CLASS 32 -#define DELTA_VDWL_PAIR 16 +static constexpr int DELTA_TYPE_CLASS = 32; +static constexpr int DELTA_VDWL_PAIR = 16; -#define BOHR 0.52917721067 // Bohr in Angstroms +static constexpr double BOHR = 0.52917721067; // Bohr in Angstroms // methods to read, parse, and store info from force field file diff --git a/src/AMOEBA/fix_amoeba_bitorsion.cpp b/src/AMOEBA/fix_amoeba_bitorsion.cpp index cb8c62819d..2a3618569f 100644 --- a/src/AMOEBA/fix_amoeba_bitorsion.cpp +++ b/src/AMOEBA/fix_amoeba_bitorsion.cpp @@ -32,10 +32,10 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; -#define BITORSIONMAX 6 // max # of BiTorsion terms stored by one atom -#define LISTDELTA 10000 -#define LB_FACTOR 1.5 -#define MAXLINE 1024 +static constexpr int BITORSIONMAX = 6; // max # of BiTorsion terms stored by one atom +static constexpr int LISTDELTA = 10000; +static constexpr double LB_FACTOR = 1.5; +static constexpr int MAXLINE = 1024; // spline weighting factors diff --git a/src/BOCS/fix_bocs.cpp b/src/BOCS/fix_bocs.cpp index 4918f8d879..58da1430b0 100644 --- a/src/BOCS/fix_bocs.cpp +++ b/src/BOCS/fix_bocs.cpp @@ -55,14 +55,14 @@ static const char cite_user_bocs_package[] = "}\n\n"; -#define DELTAFLIP 0.1 -#define TILTMAX 1.5 enum{NOBIAS,BIAS}; enum{NONE,XYZ,XY,YZ,XZ}; enum{ISO,ANISO,TRICLINIC}; -const int NUM_INPUT_DATA_COLUMNS = 2; // columns in the pressure correction file +static constexpr double DELTAFLIP = 0.1; +static constexpr double TILTMAX = 1.5; +static constexpr int NUM_INPUT_DATA_COLUMNS = 2; // columns in the pressure correction file /* ---------------------------------------------------------------------- NVT,NPH,NPT integrators for improved Nose-Hoover equations of motion diff --git a/src/DPD-REACT/fix_eos_table.cpp b/src/DPD-REACT/fix_eos_table.cpp index 36bbe4d478..9e17ab450e 100644 --- a/src/DPD-REACT/fix_eos_table.cpp +++ b/src/DPD-REACT/fix_eos_table.cpp @@ -24,7 +24,7 @@ #include -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/DPD-REACT/fix_eos_table_rx.cpp b/src/DPD-REACT/fix_eos_table_rx.cpp index f7afddc64f..24f57e399f 100644 --- a/src/DPD-REACT/fix_eos_table_rx.cpp +++ b/src/DPD-REACT/fix_eos_table_rx.cpp @@ -28,12 +28,12 @@ #include #include -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; #ifdef DBL_EPSILON - #define MY_EPSILON (10.0*DBL_EPSILON) +static constexpr double MY_EPSILON = 10.0*DBL_EPSILON; #else - #define MY_EPSILON (10.0*2.220446049250313e-16) +static constexpr double MY_EPSILON = 10.0*2.220446049250313e-16; #endif using namespace LAMMPS_NS; diff --git a/src/DPD-REACT/fix_rx.cpp b/src/DPD-REACT/fix_rx.cpp index cce88cf465..43ff5bfe0e 100644 --- a/src/DPD-REACT/fix_rx.cpp +++ b/src/DPD-REACT/fix_rx.cpp @@ -41,13 +41,13 @@ using namespace MathSpecial; enum{NONE,HARMONIC}; enum{LUCY}; -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; #ifdef DBL_EPSILON - #define MY_EPSILON (10.0*DBL_EPSILON) +static constexpr double MY_EPSILON = 10.0*DBL_EPSILON; #else - #define MY_EPSILON (10.0*2.220446049250313e-16) +static constexpr double MY_EPSILON = 10.0*2.220446049250313e-16; #endif #define SparseKinetics_enableIntegralReactions (true) diff --git a/src/DPD-REACT/pair_exp6_rx.cpp b/src/DPD-REACT/pair_exp6_rx.cpp index c6b831f84b..d2294442ac 100644 --- a/src/DPD-REACT/pair_exp6_rx.cpp +++ b/src/DPD-REACT/pair_exp6_rx.cpp @@ -31,13 +31,13 @@ using namespace LAMMPS_NS; using namespace MathSpecial; -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; #ifdef DBL_EPSILON - #define MY_EPSILON (10.0*DBL_EPSILON) +static constexpr double MY_EPSILON = 10.0*DBL_EPSILON; #else - #define MY_EPSILON (10.0*2.220446049250313e-16) +static constexpr double MY_EPSILON = 10.0*2.220446049250313e-16; #endif #define oneFluidApproxParameter (-1) diff --git a/src/DPD-REACT/pair_multi_lucy.cpp b/src/DPD-REACT/pair_multi_lucy.cpp index 89263dd445..9810039c8f 100644 --- a/src/DPD-REACT/pair_multi_lucy.cpp +++ b/src/DPD-REACT/pair_multi_lucy.cpp @@ -41,7 +41,7 @@ using MathConst::MY_PI; enum{NONE,RLINEAR,RSQ}; -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; static const char cite_pair_multi_lucy[] = "pair_style multi/lucy command: doi:10.1063/1.4942520\n\n" diff --git a/src/DPD-REACT/pair_multi_lucy_rx.cpp b/src/DPD-REACT/pair_multi_lucy_rx.cpp index 9620908531..e0ce3f62fb 100644 --- a/src/DPD-REACT/pair_multi_lucy_rx.cpp +++ b/src/DPD-REACT/pair_multi_lucy_rx.cpp @@ -43,12 +43,12 @@ using MathConst::MY_PI; enum{NONE,RLINEAR,RSQ}; -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; #ifdef DBL_EPSILON - #define MY_EPSILON (10.0*DBL_EPSILON) +static constexpr double MY_EPSILON = 10.0*DBL_EPSILON; #else - #define MY_EPSILON (10.0*2.220446049250313e-16) +static constexpr double MY_EPSILON = 10.0*2.220446049250313e-16; #endif #define oneFluidParameter (-1) diff --git a/src/INTEL/pair_snap_intel.cpp b/src/INTEL/pair_snap_intel.cpp index d91f0adc36..7cf5e00dcc 100644 --- a/src/INTEL/pair_snap_intel.cpp +++ b/src/INTEL/pair_snap_intel.cpp @@ -34,8 +34,8 @@ using namespace LAMMPS_NS; using namespace ip_simd; -#define MAXLINE 1024 -#define MAXWORD 3 +static constexpr int MAXLINE = 1024; +static constexpr int MAXWORD = 3; /* ---------------------------------------------------------------------- */ diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index ce550bf5da..a8887ab275 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -81,7 +81,7 @@ extern "C" { using namespace LAMMPS_NS; -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.cpp b/src/KOKKOS/pair_exp6_rx_kokkos.cpp index b4576db89a..3d3d9bf27f 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.cpp +++ b/src/KOKKOS/pair_exp6_rx_kokkos.cpp @@ -42,8 +42,8 @@ using namespace LAMMPS_NS; using namespace MathSpecialKokkos; -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; #ifdef DBL_EPSILON #define MY_EPSILON (10.0*DBL_EPSILON) diff --git a/src/ML-IAP/mliap_descriptor_snap.cpp b/src/ML-IAP/mliap_descriptor_snap.cpp index cec03fca76..1380c5c1ea 100644 --- a/src/ML-IAP/mliap_descriptor_snap.cpp +++ b/src/ML-IAP/mliap_descriptor_snap.cpp @@ -31,8 +31,8 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 -#define MAXWORD 3 +static constexpr int MAXLINE = 1024; +static constexpr int MAXWORD = 3; /* ---------------------------------------------------------------------- */ diff --git a/src/ML-IAP/mliap_descriptor_so3.cpp b/src/ML-IAP/mliap_descriptor_so3.cpp index 4f976f06be..59b54cfee7 100644 --- a/src/ML-IAP/mliap_descriptor_so3.cpp +++ b/src/ML-IAP/mliap_descriptor_so3.cpp @@ -30,8 +30,8 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 -#define MAXWORD 3 +static constexpr int MAXLINE = 1024; +static constexpr int MAXWORD = 3; /* ---------------------------------------------------------------------- */ diff --git a/src/ML-IAP/mliap_model.cpp b/src/ML-IAP/mliap_model.cpp index a93090d364..b23f02d343 100644 --- a/src/ML-IAP/mliap_model.cpp +++ b/src/ML-IAP/mliap_model.cpp @@ -26,8 +26,8 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 -#define MAXWORD 3 +static constexpr int MAXLINE = 1024; +static constexpr int MAXWORD = 3; /* ---------------------------------------------------------------------- */ diff --git a/src/ML-IAP/mliap_model_nn.cpp b/src/ML-IAP/mliap_model_nn.cpp index 6c039f9a07..685b0ce779 100644 --- a/src/ML-IAP/mliap_model_nn.cpp +++ b/src/ML-IAP/mliap_model_nn.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; /* ---------------------------------------------------------------------- */ diff --git a/src/ML-POD/fitpod_command.cpp b/src/ML-POD/fitpod_command.cpp index 87de65c3e2..9ffb057173 100644 --- a/src/ML-POD/fitpod_command.cpp +++ b/src/ML-POD/fitpod_command.cpp @@ -33,8 +33,7 @@ using namespace LAMMPS_NS; using MathSpecial::powint; -#define MAXLINE 1024 - +static constexpr int MAXLINE = 1024; static constexpr double SMALL = 1.0e-10; FitPOD::FitPOD(LAMMPS *_lmp) : Command(_lmp), podptr(nullptr) diff --git a/src/ML-POD/mlpod.cpp b/src/ML-POD/mlpod.cpp index f20498b50b..fba780bfae 100644 --- a/src/ML-POD/mlpod.cpp +++ b/src/ML-POD/mlpod.cpp @@ -35,7 +35,7 @@ using MathConst::MY_PI; using MathSpecial::cube; using MathSpecial::powint; -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; MLPOD::podstruct::podstruct() : twobody{4, 8, 6}, threebody{4, 8, 5, 4}, fourbody{0, 0, 0, 0}, pbc(nullptr), diff --git a/src/ML-RANN/pair_rann.cpp b/src/ML-RANN/pair_rann.cpp index f2948cbb43..aa3578f2c9 100644 --- a/src/ML-RANN/pair_rann.cpp +++ b/src/ML-RANN/pair_rann.cpp @@ -55,7 +55,7 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include "rann_fingerprint_radialscreenedspin.h" #include "rann_fingerprint_radialspin.h" -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; using namespace LAMMPS_NS; diff --git a/src/ML-SNAP/pair_snap.cpp b/src/ML-SNAP/pair_snap.cpp index 3029e9212d..245ff4acc4 100644 --- a/src/ML-SNAP/pair_snap.cpp +++ b/src/ML-SNAP/pair_snap.cpp @@ -29,8 +29,8 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 -#define MAXWORD 3 +static constexpr int MAXLINE = 1024; +static constexpr int MAXWORD = 3; /* ---------------------------------------------------------------------- */ diff --git a/src/PHONON/fix_phonon.cpp b/src/PHONON/fix_phonon.cpp index 6b5294d308..7787cefd6e 100644 --- a/src/PHONON/fix_phonon.cpp +++ b/src/PHONON/fix_phonon.cpp @@ -45,7 +45,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define MAXLINE 512 +static constexpr int MAXLINE = 512; enum{FORWARD=-1,BACKWARD=1}; diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 786f5bfe6e..e528ad30c7 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -77,11 +77,12 @@ static const char cite_fix_bond_react[] = " pages = {9953--9961}\n" "}\n\n"; -#define BIG 1.0e20 -#define DELTA 16 -#define MAXGUESS 20 // max # of guesses allowed by superimpose algorithm -#define MAXCONARGS 14 // max # of arguments for any type of constraint + rxnID -#define NUMVARVALS 5 // max # of keyword values that have variables as input + "fix bond/react: reacter.org doi:10.1016/j.polymer.2017.09.038, " +static constexpr double BIG = 1.0e20; +static constexpr int DELTA = 16; +static constexpr int MAXGUESS = 20; // max # of guesses allowed by superimpose algorithm +static constexpr int MAXCONARGS = 14; // max # of arguments for any type of constraint + rxnID +static constexpr int NUMVARVALS = 5; // max # of keyword values that have variables as input // various statuses of superimpose algorithm: // ACCEPT: site successfully matched to pre-reacted template diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index 11933164eb..5ab2a14137 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -36,9 +36,9 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define MAXLINE 256 -#define CHUNK 1024 -#define ATTRIBUTE_PERLINE 4 +static constexpr int MAXLINE = 256; +static constexpr int CHUNK = 1024; +static constexpr int ATTRIBUTE_PERLINE = 4; enum { DEFAULT, TERSE, VERBOSE }; diff --git a/src/SPIN/neb_spin.cpp b/src/SPIN/neb_spin.cpp index e7ef9ff7ea..de680cd1e7 100644 --- a/src/SPIN/neb_spin.cpp +++ b/src/SPIN/neb_spin.cpp @@ -62,10 +62,11 @@ static const char cite_neb_spin[] = "doi={10.1016/j.cpc.2015.07.001}\n" "}\n\n"; -#define MAXLINE 256 -#define CHUNK 1024 +static constexpr int MAXLINE = 256; +static constexpr int CHUNK = 1024; + // 8 attributes: tag, spin norm, position (3), spin direction (3) -#define ATTRIBUTE_PERLINE 8 +static constexpr int ATTRIBUTE_PERLINE = 8; /* ---------------------------------------------------------------------- */ diff --git a/src/angle_write.cpp b/src/angle_write.cpp index fb0e65ccf5..62e780b32e 100644 --- a/src/angle_write.cpp +++ b/src/angle_write.cpp @@ -35,7 +35,7 @@ using MathConst::DEG2RAD; using MathConst::RAD2DEG; static constexpr double epsilon = 6.5e-6; -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; /* ---------------------------------------------------------------------- */ void AngleWrite::command(int narg, char **arg) diff --git a/src/dihedral_write.cpp b/src/dihedral_write.cpp index 3d87591bcc..ace1de309d 100644 --- a/src/dihedral_write.cpp +++ b/src/dihedral_write.cpp @@ -35,7 +35,7 @@ using MathConst::DEG2RAD; using MathConst::RAD2DEG; static constexpr double epsilon = 6.5e-6; -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; /* ---------------------------------------------------------------------- */ void DihedralWrite::command(int narg, char **arg) diff --git a/src/molecule.cpp b/src/molecule.cpp index f83d8658df..59f84154db 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -31,11 +31,11 @@ using namespace LAMMPS_NS; -#define MAXLINE 256 -#define EPSILON 1.0e-7 -#define BIG 1.0e20 +static constexpr int MAXLINE = 1024; +static constexpr double EPSILON = 1.0e-7; +static constexpr double BIG = 1.0e20; -#define SINERTIA 0.4 // moment of inertia prefactor for sphere +static constexpr double SINERTIA = 0.4; // moment of inertia prefactor for sphere /* ---------------------------------------------------------------------- */ diff --git a/src/procmap.cpp b/src/procmap.cpp index 6fcea50315..37f1fa3889 100644 --- a/src/procmap.cpp +++ b/src/procmap.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; -#define MAXLINE 128 +static constexpr int MAXLINE = 128; /* ---------------------------------------------------------------------- */ diff --git a/src/universe.cpp b/src/universe.cpp index e743816d92..69e96aaa9e 100644 --- a/src/universe.cpp +++ b/src/universe.cpp @@ -21,7 +21,7 @@ using namespace LAMMPS_NS; -#define MAXLINE 256 +static constexpr int MAXLINE = 256; /* ---------------------------------------------------------------------- create & initialize the universe of processors in communicator