convert defines into static constexpr

This commit is contained in:
Axel Kohlmeyer
2024-01-18 23:59:33 -05:00
parent 48e83b2298
commit 3ae4779c7f
29 changed files with 68 additions and 67 deletions

View File

@ -34,14 +34,14 @@ enum{MUTUAL,OPT,TCG,DIRECT};
enum{NOFRAME,ZONLY,ZTHENX,BISECTOR,ZBISECT,THREEFOLD}; enum{NOFRAME,ZONLY,ZTHENX,BISECTOR,ZBISECT,THREEFOLD};
enum{GEAR,ASPC,LSQR}; enum{GEAR,ASPC,LSQR};
#define MAXLINE 65536 // crazy big for TORSION-TORSION section static constexpr int MAXLINE = 65536; // crazy big for TORSION-TORSION section
#define MAX_TYPE_PER_GROUP 6 // max types per AMOEBA group static constexpr int 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 MAX_FRAME_PER_TYPE = 32; // max multipole frames for any AMOEBA type
#define DELTA_TYPE_CLASS 32 static constexpr int DELTA_TYPE_CLASS = 32;
#define DELTA_VDWL_PAIR 16 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 // methods to read, parse, and store info from force field file

View File

@ -32,10 +32,10 @@ using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
using namespace MathConst; using namespace MathConst;
#define BITORSIONMAX 6 // max # of BiTorsion terms stored by one atom static constexpr int BITORSIONMAX = 6; // max # of BiTorsion terms stored by one atom
#define LISTDELTA 10000 static constexpr int LISTDELTA = 10000;
#define LB_FACTOR 1.5 static constexpr double LB_FACTOR = 1.5;
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
// spline weighting factors // spline weighting factors

View File

@ -55,14 +55,14 @@ static const char cite_user_bocs_package[] =
"}\n\n"; "}\n\n";
#define DELTAFLIP 0.1
#define TILTMAX 1.5
enum{NOBIAS,BIAS}; enum{NOBIAS,BIAS};
enum{NONE,XYZ,XY,YZ,XZ}; enum{NONE,XYZ,XY,YZ,XZ};
enum{ISO,ANISO,TRICLINIC}; 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 NVT,NPH,NPT integrators for improved Nose-Hoover equations of motion

View File

@ -24,7 +24,7 @@
#include <cstring> #include <cstring>
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -28,12 +28,12 @@
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
#ifdef DBL_EPSILON #ifdef DBL_EPSILON
#define MY_EPSILON (10.0*DBL_EPSILON) static constexpr double MY_EPSILON = 10.0*DBL_EPSILON;
#else #else
#define MY_EPSILON (10.0*2.220446049250313e-16) static constexpr double MY_EPSILON = 10.0*2.220446049250313e-16;
#endif #endif
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -41,13 +41,13 @@ using namespace MathSpecial;
enum{NONE,HARMONIC}; enum{NONE,HARMONIC};
enum{LUCY}; enum{LUCY};
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
#define DELTA 4 static constexpr int DELTA = 4;
#ifdef DBL_EPSILON #ifdef DBL_EPSILON
#define MY_EPSILON (10.0*DBL_EPSILON) static constexpr double MY_EPSILON = 10.0*DBL_EPSILON;
#else #else
#define MY_EPSILON (10.0*2.220446049250313e-16) static constexpr double MY_EPSILON = 10.0*2.220446049250313e-16;
#endif #endif
#define SparseKinetics_enableIntegralReactions (true) #define SparseKinetics_enableIntegralReactions (true)

View File

@ -31,13 +31,13 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathSpecial; using namespace MathSpecial;
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
#define DELTA 4 static constexpr int DELTA = 4;
#ifdef DBL_EPSILON #ifdef DBL_EPSILON
#define MY_EPSILON (10.0*DBL_EPSILON) static constexpr double MY_EPSILON = 10.0*DBL_EPSILON;
#else #else
#define MY_EPSILON (10.0*2.220446049250313e-16) static constexpr double MY_EPSILON = 10.0*2.220446049250313e-16;
#endif #endif
#define oneFluidApproxParameter (-1) #define oneFluidApproxParameter (-1)

View File

@ -41,7 +41,7 @@ using MathConst::MY_PI;
enum{NONE,RLINEAR,RSQ}; enum{NONE,RLINEAR,RSQ};
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
static const char cite_pair_multi_lucy[] = static const char cite_pair_multi_lucy[] =
"pair_style multi/lucy command: doi:10.1063/1.4942520\n\n" "pair_style multi/lucy command: doi:10.1063/1.4942520\n\n"

View File

@ -43,12 +43,12 @@ using MathConst::MY_PI;
enum{NONE,RLINEAR,RSQ}; enum{NONE,RLINEAR,RSQ};
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
#ifdef DBL_EPSILON #ifdef DBL_EPSILON
#define MY_EPSILON (10.0*DBL_EPSILON) static constexpr double MY_EPSILON = 10.0*DBL_EPSILON;
#else #else
#define MY_EPSILON (10.0*2.220446049250313e-16) static constexpr double MY_EPSILON = 10.0*2.220446049250313e-16;
#endif #endif
#define oneFluidParameter (-1) #define oneFluidParameter (-1)

View File

@ -34,8 +34,8 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace ip_simd; using namespace ip_simd;
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
#define MAXWORD 3 static constexpr int MAXWORD = 3;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -81,7 +81,7 @@ extern "C" {
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -42,8 +42,8 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathSpecialKokkos; using namespace MathSpecialKokkos;
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
#define DELTA 4 static constexpr int DELTA = 4;
#ifdef DBL_EPSILON #ifdef DBL_EPSILON
#define MY_EPSILON (10.0*DBL_EPSILON) #define MY_EPSILON (10.0*DBL_EPSILON)

View File

@ -31,8 +31,8 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
#define MAXWORD 3 static constexpr int MAXWORD = 3;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -30,8 +30,8 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
#define MAXWORD 3 static constexpr int MAXWORD = 3;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -26,8 +26,8 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
#define MAXWORD 3 static constexpr int MAXWORD = 3;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -28,7 +28,7 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -33,8 +33,7 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using MathSpecial::powint; using MathSpecial::powint;
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
static constexpr double SMALL = 1.0e-10; static constexpr double SMALL = 1.0e-10;
FitPOD::FitPOD(LAMMPS *_lmp) : Command(_lmp), podptr(nullptr) FitPOD::FitPOD(LAMMPS *_lmp) : Command(_lmp), podptr(nullptr)

View File

@ -35,7 +35,7 @@ using MathConst::MY_PI;
using MathSpecial::cube; using MathSpecial::cube;
using MathSpecial::powint; using MathSpecial::powint;
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
MLPOD::podstruct::podstruct() : MLPOD::podstruct::podstruct() :
twobody{4, 8, 6}, threebody{4, 8, 5, 4}, fourbody{0, 0, 0, 0}, pbc(nullptr), twobody{4, 8, 6}, threebody{4, 8, 5, 4}, fourbody{0, 0, 0, 0}, pbc(nullptr),

View File

@ -55,7 +55,7 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
#include "rann_fingerprint_radialscreenedspin.h" #include "rann_fingerprint_radialscreenedspin.h"
#include "rann_fingerprint_radialspin.h" #include "rann_fingerprint_radialspin.h"
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -29,8 +29,8 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
#define MAXWORD 3 static constexpr int MAXWORD = 3;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -45,7 +45,7 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
#define MAXLINE 512 static constexpr int MAXLINE = 512;
enum{FORWARD=-1,BACKWARD=1}; enum{FORWARD=-1,BACKWARD=1};

View File

@ -77,11 +77,12 @@ static const char cite_fix_bond_react[] =
" pages = {9953--9961}\n" " pages = {9953--9961}\n"
"}\n\n"; "}\n\n";
#define BIG 1.0e20 "fix bond/react: reacter.org doi:10.1016/j.polymer.2017.09.038, "
#define DELTA 16 static constexpr double BIG = 1.0e20;
#define MAXGUESS 20 // max # of guesses allowed by superimpose algorithm static constexpr int DELTA = 16;
#define MAXCONARGS 14 // max # of arguments for any type of constraint + rxnID static constexpr int MAXGUESS = 20; // max # of guesses allowed by superimpose algorithm
#define NUMVARVALS 5 // max # of keyword values that have variables as input 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: // various statuses of superimpose algorithm:
// ACCEPT: site successfully matched to pre-reacted template // ACCEPT: site successfully matched to pre-reacted template

View File

@ -36,9 +36,9 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;
#define MAXLINE 256 static constexpr int MAXLINE = 256;
#define CHUNK 1024 static constexpr int CHUNK = 1024;
#define ATTRIBUTE_PERLINE 4 static constexpr int ATTRIBUTE_PERLINE = 4;
enum { DEFAULT, TERSE, VERBOSE }; enum { DEFAULT, TERSE, VERBOSE };

View File

@ -62,10 +62,11 @@ static const char cite_neb_spin[] =
"doi={10.1016/j.cpc.2015.07.001}\n" "doi={10.1016/j.cpc.2015.07.001}\n"
"}\n\n"; "}\n\n";
#define MAXLINE 256 static constexpr int MAXLINE = 256;
#define CHUNK 1024 static constexpr int CHUNK = 1024;
// 8 attributes: tag, spin norm, position (3), spin direction (3) // 8 attributes: tag, spin norm, position (3), spin direction (3)
#define ATTRIBUTE_PERLINE 8 static constexpr int ATTRIBUTE_PERLINE = 8;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -35,7 +35,7 @@ using MathConst::DEG2RAD;
using MathConst::RAD2DEG; using MathConst::RAD2DEG;
static constexpr double epsilon = 6.5e-6; static constexpr double epsilon = 6.5e-6;
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void AngleWrite::command(int narg, char **arg) void AngleWrite::command(int narg, char **arg)

View File

@ -35,7 +35,7 @@ using MathConst::DEG2RAD;
using MathConst::RAD2DEG; using MathConst::RAD2DEG;
static constexpr double epsilon = 6.5e-6; static constexpr double epsilon = 6.5e-6;
#define MAXLINE 1024 static constexpr int MAXLINE = 1024;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void DihedralWrite::command(int narg, char **arg) void DihedralWrite::command(int narg, char **arg)

View File

@ -31,11 +31,11 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define MAXLINE 256 static constexpr int MAXLINE = 1024;
#define EPSILON 1.0e-7 static constexpr double EPSILON = 1.0e-7;
#define BIG 1.0e20 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
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -33,7 +33,7 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define MAXLINE 128 static constexpr int MAXLINE = 128;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -21,7 +21,7 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define MAXLINE 256 static constexpr int MAXLINE = 256;
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
create & initialize the universe of processors in communicator create & initialize the universe of processors in communicator