convert a few more defines to static constexpr

This commit is contained in:
Axel Kohlmeyer
2024-02-05 23:57:41 -05:00
parent d1f1cf4012
commit 187a35d7b2
17 changed files with 60 additions and 76 deletions

View File

@ -21,6 +21,7 @@
#include "atom.h"
#include "comm.h"
#include "error.h"
#include "ewald_const.h"
#include "force.h"
#include "kspace.h"
#include "memory.h"
@ -35,14 +36,7 @@
using namespace LAMMPS_NS;
using namespace LJSPICAParms;
#define EWALD_F 1.12837917
#define EWALD_P 0.3275911
#define A1 0.254829592
#define A2 -0.284496736
#define A3 1.421413741
#define A4 -1.453152027
#define A5 1.061405429
using namespace EwaldConst;
/* ---------------------------------------------------------------------- */

View File

@ -17,25 +17,27 @@
------------------------------------------------------------------------- */
#include "pair_born_coul_long_cs.h"
#include <cmath>
#include "atom.h"
#include "force.h"
#include "neigh_list.h"
#include <cmath>
using namespace LAMMPS_NS;
#define EWALD_F 1.12837917
#define EWALD_P 9.95473818e-1
#define B0 -0.1335096380159268
#define B1 -2.57839507e-1
#define B2 -1.37203639e-1
#define B3 -8.88822059e-3
#define B4 -5.80844129e-3
#define B5 1.14652755e-1
static constexpr double EWALD_F = 1.12837917;
static constexpr double EWALD_P = 9.95473818e-1;
static constexpr double B0 = -0.1335096380159268;
static constexpr double B1 = -2.57839507e-1;
static constexpr double B2 = -1.37203639e-1;
static constexpr double B3 = -8.88822059e-3;
static constexpr double B4 = -5.80844129e-3;
static constexpr double B5 = 1.14652755e-1;
static constexpr double EPSILON = 1.0e-20;
#define EPS_EWALD 1.0e-6
#define EPS_EWALD_SQR 1.0e-12
static constexpr double EPS_EWALD = 1.0e-6;
static constexpr double EPS_EWALD_SQR = 1.0e-12;
/* ---------------------------------------------------------------------- */

View File

@ -24,18 +24,18 @@
using namespace LAMMPS_NS;
#define EWALD_F 1.12837917
#define EWALD_P 9.95473818e-1
#define B0 -0.1335096380159268
#define B1 -2.57839507e-1
#define B2 -1.37203639e-1
#define B3 -8.88822059e-3
#define B4 -5.80844129e-3
#define B5 1.14652755e-1
static constexpr double EWALD_F = 1.12837917;
static constexpr double EWALD_P = 9.95473818e-1;
static constexpr double B0 = -0.1335096380159268;
static constexpr double B1 = -2.57839507e-1;
static constexpr double B2 = -1.37203639e-1;
static constexpr double B3 = -8.88822059e-3;
static constexpr double B4 = -5.80844129e-3;
static constexpr double B5 = 1.14652755e-1;
static constexpr double EPSILON = 1.0e-20;
#define EPS_EWALD 1.0e-6
#define EPS_EWALD_SQR 1.0e-12
static constexpr double EPS_EWALD = 1.0e-6;
static constexpr double EPS_EWALD_SQR = 1.0e-12;
/* ---------------------------------------------------------------------- */

View File

@ -21,6 +21,7 @@
#include "atom.h"
#include "comm.h"
#include "error.h"
#include "ewald_const.h"
#include "force.h"
#include "kspace.h"
#include "memory.h"
@ -31,14 +32,7 @@
#include <cstring>
using namespace LAMMPS_NS;
#define EWALD_F 1.12837917
#define EWALD_P 0.3275911
#define A1 0.254829592
#define A2 -0.284496736
#define A3 1.421413741
#define A4 -1.453152027
#define A5 1.061405429
using namespace EwaldConst;
/* ---------------------------------------------------------------------- */

View File

@ -34,13 +34,12 @@
using namespace LAMMPS_NS;
using namespace MathConst;
#define EWALD_F 1.12837917
#define EWALD_P 0.3275911
#define A1 0.254829592
#define A2 -0.284496736
#define A3 1.421413741
#define A4 -1.453152027
#define A5 1.061405429
static constexpr double EWALD_P = 0.3275911;
static constexpr double A1 = 0.254829592;
static constexpr double A2 = -0.284496736;
static constexpr double A3 = 1.421413741;
static constexpr double A4 = -1.453152027;
static constexpr double A5 = 1.061405429;
/* ---------------------------------------------------------------------- */

View File

@ -39,8 +39,7 @@ using namespace LAMMPS_NS;
static constexpr double BUFFACTOR = 1.5;
static constexpr int BUFMIN = 1024;
static constexpr double EPSILON = 1.0e-6;
#define DELTA_PROCS 16
static constexpr int DELTA_PROCS = 16;
/* ---------------------------------------------------------------------- */

View File

@ -35,10 +35,8 @@
using namespace LAMMPS_NS;
using namespace FixConst;
enum{NONE,XYZ,XY,YZ,XZ};
enum{ISO,ANISO,TRICLINIC};
#define MAX_LIFO_DEPTH 2 // 3 box0 arrays in *.h dimensioned to this
enum { NONE, XYZ, XY, YZ, XZ };
enum { ISO, ANISO, TRICLINIC };
/* ---------------------------------------------------------------------- */

View File

@ -52,11 +52,12 @@ class FixBoxRelax : public Fix {
double vmax, pv2e, pflagsum;
int kspace_flag;
int current_lifo; // LIFO stack pointer
double boxlo0[2][3]; // box bounds at start of line search
double boxhi0[2][3];
double boxtilt0[2][3]; // xy,xz,yz tilts at start of line search
double ds[6]; // increment in scale matrix
static constexpr int MAX_LIFO_DEPTH = 2;
int current_lifo; // LIFO stack pointer
double boxlo0[MAX_LIFO_DEPTH][3]; // low box bounds at start of line search
double boxhi0[MAX_LIFO_DEPTH][3]; // high box bounds at start of line search
double boxtilt0[MAX_LIFO_DEPTH][3]; // xy,xz,yz tilts at start of line search
double ds[6]; // increment in scale matrix
int scaleyz; // 1 if yz scaled with lz
int scalexz; // 1 if xz scaled with lz

View File

@ -702,7 +702,7 @@ static const double fm_exp2_p[] = {
};
/* double precision constants */
#define FM_DOUBLE_LOG2OFE 1.4426950408889634074
static constexpr double FM_DOUBLE_LOG2OFE = 1.4426950408889634074;
double MathSpecial::exp2_x86(double x)
{

View File

@ -25,7 +25,7 @@ using namespace LAMMPS_NS;
// EPS_ENERGY = minimum normalization for energy tolerance
#define EPS_ENERGY 1.0e-8
static constexpr double EPS_ENERGY = 1.0e-8;
/* ---------------------------------------------------------------------- */

View File

@ -38,7 +38,7 @@ using namespace LAMMPS_NS;
// EPS_ENERGY = minimum normalization for energy tolerance
#define EPS_ENERGY 1.0e-8
static constexpr double EPS_ENERGY = 1.0e-8;
/* ---------------------------------------------------------------------- */

View File

@ -42,13 +42,12 @@ using namespace LAMMPS_NS;
// EMACH = machine accuracy limit of energy changes (1.0e-8)
// EPS_QUAD = tolerance for quadratic projection
#define ALPHA_MAX 1.0
#define ALPHA_REDUCE 0.5
#define BACKTRACK_SLOPE 0.4
#define QUADRATIC_TOL 0.1
//#define EMACH 1.0e-8
static constexpr double ALPHA_MAX = 1.0;
static constexpr double ALPHA_REDUCE = 0.5;
static constexpr double BACKTRACK_SLOPE = 0.4;
static constexpr double QUADRATIC_TOL = 0.1;
static constexpr double EMACH = 1.0e-8;
#define EPS_QUAD 1.0e-28
static constexpr double EPS_QUAD = 1.0e-28;
/* ---------------------------------------------------------------------- */

View File

@ -28,8 +28,7 @@ using namespace LAMMPS_NS;
// EPS_ENERGY = minimum normalization for energy tolerance
#define EPS_ENERGY 1.0e-8
static constexpr double EPS_ENERGY = 1.0e-8;
static constexpr int DELAYSTEP = 5;
/* ---------------------------------------------------------------------- */

View File

@ -24,7 +24,7 @@ using namespace LAMMPS_NS;
// EPS_ENERGY = minimum normalization for energy tolerance
#define EPS_ENERGY 1.0e-8
static constexpr double EPS_ENERGY = 1.0e-8;
/* ---------------------------------------------------------------------- */

View File

@ -27,7 +27,7 @@
using namespace LAMMPS_NS;
static constexpr double SMALL = 1.0e-6;
#define CUT2BIN_RATIO 100
static constexpr double CUT2BIN_RATIO = 100.0;
/* ---------------------------------------------------------------------- */

View File

@ -25,7 +25,7 @@
using namespace LAMMPS_NS;
static constexpr double SMALL = 1.0e-6;
#define CUT2BIN_RATIO 100
static constexpr double CUT2BIN_RATIO = 100.0;
/* ---------------------------------------------------------------------- */

View File

@ -33,13 +33,12 @@
using namespace LAMMPS_NS;
using namespace MathConst;
#define EWALD_F 1.12837917
#define EWALD_P 0.3275911
#define A1 0.254829592
#define A2 -0.284496736
#define A3 1.421413741
#define A4 -1.453152027
#define A5 1.061405429
static constexpr double EWALD_P = 0.3275911;
static constexpr double A1 = 0.254829592;
static constexpr double A2 = -0.284496736;
static constexpr double A3 = 1.421413741;
static constexpr double A4 = -1.453152027;
static constexpr double A5 = 1.061405429;
/* ---------------------------------------------------------------------- */