diff --git a/examples/reaxff/CHO/in.CHO.lg b/examples/reaxff/CHO/in.CHO.lg new file mode 100644 index 0000000000..56f1e61b1f --- /dev/null +++ b/examples/reaxff/CHO/in.CHO.lg @@ -0,0 +1,23 @@ +# REAX potential for CHO system +# ..... + +units real + +atom_style charge +read_data data.CHO + +pair_style reax/c lmp_control lgvdw yes +pair_coeff * * ffield.reax.lg H C O + +neighbor 2 bin +neigh_modify every 10 delay 0 check no + +fix 1 all nve +fix 2 all qeq/reax 1 0.0 10.0 1e-6 param.qeq +fix 3 all temp/berendsen 500.0 500.0 100.0 + +timestep 0.25 + +#dump 1 all atom 30 dump.reax.cho + +run 3000 diff --git a/examples/reaxff/water/in.minimize b/examples/reaxff/water/in.minimize new file mode 100644 index 0000000000..6923fa5465 --- /dev/null +++ b/examples/reaxff/water/in.minimize @@ -0,0 +1,31 @@ +# ACKS2 Water, CITE: Achtyl et al., Nat. Comm., 6 6539 (2015) + +boundary p p p +units real +atom_style charge + +read_data data.water + +variable x index 1 +variable y index 1 +variable z index 1 + +replicate $x $y $z + +pair_style reaxff NULL safezone 3.0 mincap 150 +pair_coeff * * acks2_ff.water O H +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +velocity all create 300.0 4928459 rot yes dist gaussian + +fix 1 all acks2/reaxff 1 0.0 10.0 1.0e-6 reaxff maxiter 1000 +fix 2 all nvt temp 300 300 50.0 + +timestep 0.5 +thermo 10 +thermo_style custom step temp press density vol + +minimize 0.0 0.0 10 100 + +run 20 diff --git a/purge-workflows.py b/purge-workflows.py new file mode 100755 index 0000000000..00ebf35fa8 --- /dev/null +++ b/purge-workflows.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +from yaml import load +import subprocess +try: + from yaml import CLoader as Loader +except ImportError: + from yaml import Loader + +runs = subprocess.check_output('gh api repos/lammps/lammps/actions/runs',shell=True) +data = load(runs,Loader=Loader) +while data['total_count'] > 3: + print('remaining: ', data['total_count']) + num=1 + for d in data['workflow_runs']: + print(num, d['id'],d['name'],d['run_number']) + num += 1 + if num > 4: + subprocess.call('gh api -X DELETE repos/lammps/lammps/actions/runs/' + str(d['id']), shell=True) + #print('gh api -X DELETE repos/lammps/lammps/actions/runs/' + str(d['id'])) + else: + print('skip') + runs = subprocess.check_output('gh api repos/lammps/lammps/actions/runs',shell=True) + data = load(runs,Loader=Loader) diff --git a/src/ADIOS/reader_adios.cpp b/src/ADIOS/reader_adios.cpp index ec87bc26cc..0fe82dd49f 100644 --- a/src/ADIOS/reader_adios.cpp +++ b/src/ADIOS/reader_adios.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; -#define SMALL 1.0e-6 +static constexpr double SMALL = 1.0e-6; namespace LAMMPS_NS { class ReadADIOSInternal { diff --git a/src/AMOEBA/amoeba_convolution.cpp b/src/AMOEBA/amoeba_convolution.cpp index ae3dbf16c4..69f37e25b0 100644 --- a/src/AMOEBA/amoeba_convolution.cpp +++ b/src/AMOEBA/amoeba_convolution.cpp @@ -48,11 +48,11 @@ enum{MPOLE_GRID,POLAR_GRID,POLAR_GRIDC,DISP_GRID,INDUCE_GRID,INDUCE_GRIDC}; #define SCALE 0 #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif /* ---------------------------------------------------------------------- diff --git a/src/AMOEBA/amoeba_multipole.cpp b/src/AMOEBA/amoeba_multipole.cpp index d0ae03401a..81e7763fe7 100644 --- a/src/AMOEBA/amoeba_multipole.cpp +++ b/src/AMOEBA/amoeba_multipole.cpp @@ -35,11 +35,11 @@ enum{FIELD,ZRSD,TORQUE,UFLD}; // reverse comm enum{VDWL,REPULSE,QFER,DISP,MPOLE,POLAR,USOLV,DISP_LONG,MPOLE_LONG,POLAR_LONG}; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif /* ---------------------------------------------------------------------- diff --git a/src/AMOEBA/angle_amoeba.cpp b/src/AMOEBA/angle_amoeba.cpp index e6ee7b579e..54fc3e9f9a 100644 --- a/src/AMOEBA/angle_amoeba.cpp +++ b/src/AMOEBA/angle_amoeba.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/AMOEBA/fix_amoeba_pitorsion.cpp b/src/AMOEBA/fix_amoeba_pitorsion.cpp index 445845c075..045a24c017 100644 --- a/src/AMOEBA/fix_amoeba_pitorsion.cpp +++ b/src/AMOEBA/fix_amoeba_pitorsion.cpp @@ -34,7 +34,7 @@ using namespace MathConst; #define PITORSIONMAX 6 // max # of PiTorsion terms stored by one atom #define LISTDELTA 8196 -#define LB_FACTOR 1.5 +static constexpr double LB_FACTOR = 1.5; /* ---------------------------------------------------------------------- */ diff --git a/src/AMOEBA/improper_amoeba.cpp b/src/AMOEBA/improper_amoeba.cpp index 32c31b0af9..46c2585d1f 100644 --- a/src/AMOEBA/improper_amoeba.cpp +++ b/src/AMOEBA/improper_amoeba.cpp @@ -28,8 +28,8 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/ASPHERE/compute_temp_asphere.cpp b/src/ASPHERE/compute_temp_asphere.cpp index 707938b2b9..7d5d6adce5 100644 --- a/src/ASPHERE/compute_temp_asphere.cpp +++ b/src/ASPHERE/compute_temp_asphere.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; enum{ROTATE,ALL}; -#define INERTIA 0.2 // moment of inertia prefactor for ellipsoid +static constexpr double INERTIA = 0.2; // moment of inertia prefactor for ellipsoid /* ---------------------------------------------------------------------- */ diff --git a/src/ASPHERE/fix_nve_asphere.cpp b/src/ASPHERE/fix_nve_asphere.cpp index f4080493c8..a5655b875c 100644 --- a/src/ASPHERE/fix_nve_asphere.cpp +++ b/src/ASPHERE/fix_nve_asphere.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define INERTIA 0.2 // moment of inertia prefactor for ellipsoid +static constexpr double INERTIA = 0.2; // moment of inertia prefactor for ellipsoid /* ---------------------------------------------------------------------- */ diff --git a/src/ASPHERE/fix_nve_line.cpp b/src/ASPHERE/fix_nve_line.cpp index d7adf0a963..4d7a691bdd 100644 --- a/src/ASPHERE/fix_nve_line.cpp +++ b/src/ASPHERE/fix_nve_line.cpp @@ -23,7 +23,7 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; -#define INERTIA (1.0/12.0) // moment of inertia prefactor for line segment +static constexpr double INERTIA = (1.0/12.0); // moment of inertia prefactor for line segment /* ---------------------------------------------------------------------- */ diff --git a/src/ASPHERE/pair_line_lj.cpp b/src/ASPHERE/pair_line_lj.cpp index 2d6dc557f3..3bfc10758c 100644 --- a/src/ASPHERE/pair_line_lj.cpp +++ b/src/ASPHERE/pair_line_lj.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/ASPHERE/pair_tri_lj.cpp b/src/ASPHERE/pair_tri_lj.cpp index 4fe999f039..b9cb2528ca 100644 --- a/src/ASPHERE/pair_tri_lj.cpp +++ b/src/ASPHERE/pair_tri_lj.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; -#define DELTA 20 +static constexpr int DELTA = 20; /* ---------------------------------------------------------------------- */ diff --git a/src/BODY/body_nparticle.cpp b/src/BODY/body_nparticle.cpp index 62e6ee802a..7a1dbaa0f0 100644 --- a/src/BODY/body_nparticle.cpp +++ b/src/BODY/body_nparticle.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-7 +static constexpr double EPSILON = 1.0e-7; enum{SPHERE,LINE,TRI}; // also in DumpImage /* ---------------------------------------------------------------------- */ diff --git a/src/BODY/body_rounded_polygon.cpp b/src/BODY/body_rounded_polygon.cpp index 2fb2a991f1..6a94f68a8e 100644 --- a/src/BODY/body_rounded_polygon.cpp +++ b/src/BODY/body_rounded_polygon.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-7 +static constexpr double EPSILON = 1.0e-7; enum{SPHERE,LINE}; // also in DumpImage /* ---------------------------------------------------------------------- */ diff --git a/src/BODY/body_rounded_polyhedron.cpp b/src/BODY/body_rounded_polyhedron.cpp index 1d11644618..bcc3495644 100644 --- a/src/BODY/body_rounded_polyhedron.cpp +++ b/src/BODY/body_rounded_polyhedron.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-7 +static constexpr double EPSILON = 1.0e-7; #define MAX_FACE_SIZE 4 // maximum number of vertices per face (for now) enum{SPHERE,LINE}; // also in DumpImage diff --git a/src/BODY/compute_body_local.cpp b/src/BODY/compute_body_local.cpp index 42afa13514..4a4a36bfae 100644 --- a/src/BODY/compute_body_local.cpp +++ b/src/BODY/compute_body_local.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; enum{ID,TYPE,INDEX}; diff --git a/src/BODY/fix_wall_body_polygon.cpp b/src/BODY/fix_wall_body_polygon.cpp index 6f0622cbf6..0920145eb2 100644 --- a/src/BODY/fix_wall_body_polygon.cpp +++ b/src/BODY/fix_wall_body_polygon.cpp @@ -43,9 +43,9 @@ enum {INVALID=0,NONE=1,VERTEX=2}; enum {FAR=0,XLO,XHI,YLO,YHI}; //#define _POLYGON_DEBUG -#define DELTA 10000 -#define EPSILON 1e-2 // dimensionless threshold (dot products, end point checks, contact checks) -#define BIG 1.0e20 +static constexpr int DELTA = 10000; +static constexpr double EPSILON = 1e-2; // dimensionless threshold (dot products, end point checks, contact checks) +static constexpr double BIG = 1.0e20; #define MAX_CONTACTS 4 // maximum number of contacts for 2D models #define EFF_CONTACTS 2 // effective contacts for 2D models diff --git a/src/BODY/fix_wall_body_polyhedron.cpp b/src/BODY/fix_wall_body_polyhedron.cpp index 4b28f6af72..035e814692 100644 --- a/src/BODY/fix_wall_body_polyhedron.cpp +++ b/src/BODY/fix_wall_body_polyhedron.cpp @@ -43,9 +43,9 @@ enum {INVALID=0,NONE=1,VERTEX=2}; enum {FAR=0,XLO,XHI,YLO,YHI,ZLO,ZHI}; //#define _POLYHEDRON_DEBUG -#define DELTA 10000 -#define EPSILON 1e-3 // dimensionless threshold (dot products, end point checks) -#define BIG 1.0e20 +static constexpr int DELTA = 10000; +static constexpr double EPSILON = 1e-3; // dimensionless threshold (dot products, end point checks) +static constexpr double BIG = 1.0e20; #define MAX_CONTACTS 4 // maximum number of contacts for 2D models #define EFF_CONTACTS 2 // effective contacts for 2D models diff --git a/src/BODY/pair_body_nparticle.cpp b/src/BODY/pair_body_nparticle.cpp index 9e1e640015..29ee06dbef 100644 --- a/src/BODY/pair_body_nparticle.cpp +++ b/src/BODY/pair_body_nparticle.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp index 24f38a6a0a..4b5a3c4f64 100644 --- a/src/BODY/pair_body_rounded_polygon.cpp +++ b/src/BODY/pair_body_rounded_polygon.cpp @@ -39,8 +39,8 @@ using namespace LAMMPS_NS; -#define DELTA 10000 -#define EPSILON 1e-3 // dimensionless threshold (dot products, end point checks, contact checks) +static constexpr int DELTA = 10000; +static constexpr double EPSILON = 1e-3; // dimensionless threshold (dot products, end point checks, contact checks) #define MAX_CONTACTS 4 // maximum number of contacts for 2D models #define EFF_CONTACTS 2 // effective contacts for 2D models diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index e261ff14d3..9eaed320fe 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -43,8 +43,8 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define DELTA 10000 -#define EPSILON 1e-3 // dimensionless threshold (dot products, end point checks, contact checks) +static constexpr int DELTA = 10000; +static constexpr double EPSILON = 1e-3; // dimensionless threshold (dot products, end point checks, contact checks) #define MAX_FACE_SIZE 4 // maximum number of vertices per face (same as BodyRoundedPolyhedron) #define MAX_CONTACTS 32 // for 3D models (including duplicated counts) diff --git a/src/BPM/bond_bpm_rotational.cpp b/src/BPM/bond_bpm_rotational.cpp index ffb0d9521d..85570385b4 100644 --- a/src/BPM/bond_bpm_rotational.cpp +++ b/src/BPM/bond_bpm_rotational.cpp @@ -28,7 +28,7 @@ #include #include -#define EPSILON 1e-10 +static constexpr double EPSILON = 1e-10; using namespace LAMMPS_NS; using MathConst::MY_SQRT2; diff --git a/src/BPM/bond_bpm_spring.cpp b/src/BPM/bond_bpm_spring.cpp index 37b79f93fb..28d17b408a 100644 --- a/src/BPM/bond_bpm_spring.cpp +++ b/src/BPM/bond_bpm_spring.cpp @@ -26,7 +26,7 @@ #include #include -#define EPSILON 1e-10 +static constexpr double EPSILON = 1e-10; using namespace LAMMPS_NS; diff --git a/src/BPM/fix_update_special_bonds.cpp b/src/BPM/fix_update_special_bonds.cpp index b6bf8b433f..5452366090 100644 --- a/src/BPM/fix_update_special_bonds.cpp +++ b/src/BPM/fix_update_special_bonds.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/BROWNIAN/fix_propel_self.cpp b/src/BROWNIAN/fix_propel_self.cpp index 8d97b828a9..e98f461b80 100644 --- a/src/BROWNIAN/fix_propel_self.cpp +++ b/src/BROWNIAN/fix_propel_self.cpp @@ -35,7 +35,7 @@ using namespace FixConst; enum { DIPOLE, VELOCITY, QUAT }; -#define TOL 1e-14 +static constexpr double TOL = 1e-14; /* ---------------------------------------------------------------------- */ diff --git a/src/CG-DNA/fix_nve_dot.cpp b/src/CG-DNA/fix_nve_dot.cpp index a9d288eb16..4fbf9bb9be 100644 --- a/src/CG-DNA/fix_nve_dot.cpp +++ b/src/CG-DNA/fix_nve_dot.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathExtra; -#define INERTIA 0.2 // moment of inertia prefactor for ellipsoid +static constexpr double INERTIA = 0.2; // moment of inertia prefactor for ellipsoid /* ---------------------------------------------------------------------- */ diff --git a/src/CG-DNA/fix_nve_dotc_langevin.cpp b/src/CG-DNA/fix_nve_dotc_langevin.cpp index 56436a3a98..8151cbe4fe 100644 --- a/src/CG-DNA/fix_nve_dotc_langevin.cpp +++ b/src/CG-DNA/fix_nve_dotc_langevin.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathExtra; -#define INERTIA 0.2 // moment of inertia prefactor for ellipsoid +static constexpr double INERTIA = 0.2; // moment of inertia prefactor for ellipsoid /* ---------------------------------------------------------------------- */ diff --git a/src/CG-SPICA/angle_spica.cpp b/src/CG-SPICA/angle_spica.cpp index 3f8a506ed2..45b28d812a 100644 --- a/src/CG-SPICA/angle_spica.cpp +++ b/src/CG-SPICA/angle_spica.cpp @@ -39,7 +39,7 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace LJSPICAParms; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/CLASS2/angle_class2.cpp b/src/CLASS2/angle_class2.cpp index c731a4d5c9..1dbaaf0568 100644 --- a/src/CLASS2/angle_class2.cpp +++ b/src/CLASS2/angle_class2.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/CLASS2/dihedral_class2.cpp b/src/CLASS2/dihedral_class2.cpp index d49d50f0e6..288fac2e92 100644 --- a/src/CLASS2/dihedral_class2.cpp +++ b/src/CLASS2/dihedral_class2.cpp @@ -32,8 +32,8 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define TOLERANCE 0.05 -#define SMALL 0.0000001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.0000001; /* ---------------------------------------------------------------------- */ diff --git a/src/CLASS2/improper_class2.cpp b/src/CLASS2/improper_class2.cpp index 1e172757b0..e2f5ffe01b 100644 --- a/src/CLASS2/improper_class2.cpp +++ b/src/CLASS2/improper_class2.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/COLVARS/ndx_group.cpp b/src/COLVARS/ndx_group.cpp index 1d24db3900..fff55e2580 100644 --- a/src/COLVARS/ndx_group.cpp +++ b/src/COLVARS/ndx_group.cpp @@ -27,7 +27,7 @@ using namespace LAMMPS_NS; #define BUFLEN 4096 -#define DELTA 16384 +static constexpr int DELTA = 16384; // read file until next section "name" or any next section if name == "" diff --git a/src/CORESHELL/pair_born_coul_dsf_cs.cpp b/src/CORESHELL/pair_born_coul_dsf_cs.cpp index 9e0ac11c78..9edcf2755d 100644 --- a/src/CORESHELL/pair_born_coul_dsf_cs.cpp +++ b/src/CORESHELL/pair_born_coul_dsf_cs.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define EPSILON 1.0e-20 +static constexpr double EPSILON = 1.0e-20; /* ---------------------------------------------------------------------- */ diff --git a/src/CORESHELL/pair_born_coul_long_cs.cpp b/src/CORESHELL/pair_born_coul_long_cs.cpp index 3a3dc39d69..c29bd5c31d 100644 --- a/src/CORESHELL/pair_born_coul_long_cs.cpp +++ b/src/CORESHELL/pair_born_coul_long_cs.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; #define B4 -5.80844129e-3 #define B5 1.14652755e-1 -#define EPSILON 1.0e-20 +static constexpr double EPSILON = 1.0e-20; #define EPS_EWALD 1.0e-6 #define EPS_EWALD_SQR 1.0e-12 diff --git a/src/CORESHELL/pair_born_coul_wolf_cs.cpp b/src/CORESHELL/pair_born_coul_wolf_cs.cpp index 4765e1575c..47241c0beb 100644 --- a/src/CORESHELL/pair_born_coul_wolf_cs.cpp +++ b/src/CORESHELL/pair_born_coul_wolf_cs.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define EPSILON 1.0e-20 +static constexpr double EPSILON = 1.0e-20; /* ---------------------------------------------------------------------- */ diff --git a/src/CORESHELL/pair_buck_coul_long_cs.cpp b/src/CORESHELL/pair_buck_coul_long_cs.cpp index 6b15e8dfe5..96203deae1 100644 --- a/src/CORESHELL/pair_buck_coul_long_cs.cpp +++ b/src/CORESHELL/pair_buck_coul_long_cs.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; #define B4 -5.80844129e-3 #define B5 1.14652755e-1 -#define EPSILON 1.0e-20 +static constexpr double EPSILON = 1.0e-20; #define EPS_EWALD 1.0e-6 #define EPS_EWALD_SQR 1.0e-12 diff --git a/src/CORESHELL/pair_coul_long_cs.cpp b/src/CORESHELL/pair_coul_long_cs.cpp index 5148ffda2d..6af9a30639 100644 --- a/src/CORESHELL/pair_coul_long_cs.cpp +++ b/src/CORESHELL/pair_coul_long_cs.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; #define B4 -5.80844129e-3 #define B5 1.14652755e-1 -#define EPSILON 1.0e-20 +static constexpr double EPSILON = 1.0e-20; #define EPS_EWALD 1.0e-6 #define EPS_EWALD_SQR 1.0e-12 diff --git a/src/CORESHELL/pair_coul_wolf_cs.cpp b/src/CORESHELL/pair_coul_wolf_cs.cpp index 5e15493aad..6deb66735b 100644 --- a/src/CORESHELL/pair_coul_wolf_cs.cpp +++ b/src/CORESHELL/pair_coul_wolf_cs.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define EPSILON 1.0e-20 +static constexpr double EPSILON = 1.0e-20; /* ---------------------------------------------------------------------- */ diff --git a/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp b/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp index 1cbddf0614..577bc2e6df 100644 --- a/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp +++ b/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; #define B4 -5.80844129e-3 #define B5 1.14652755e-1 -#define EPSILON 1.0e-20 +static constexpr double EPSILON = 1.0e-20; #define EPS_EWALD 1.0e-6 #define EPS_EWALD_SQR 1.0e-12 diff --git a/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp b/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp index 253ae440b0..d5fd66e382 100644 --- a/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp +++ b/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; #define B4 -5.80844129e-3 #define B5 1.14652755e-1 -#define EPSILON 1.0e-20 +static constexpr double EPSILON = 1.0e-20; #define EPS_EWALD 1.0e-6 #define EPS_EWALD_SQR 1.0e-12 diff --git a/src/DIELECTRIC/pppm_dielectric.cpp b/src/DIELECTRIC/pppm_dielectric.cpp index e308cb0826..41514b0846 100644 --- a/src/DIELECTRIC/pppm_dielectric.cpp +++ b/src/DIELECTRIC/pppm_dielectric.cpp @@ -36,17 +36,17 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; enum {REVERSE_RHO}; enum {FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif /* ---------------------------------------------------------------------- */ diff --git a/src/DIELECTRIC/pppm_disp_dielectric.cpp b/src/DIELECTRIC/pppm_disp_dielectric.cpp index 2c4de6ada1..cf548b2d49 100644 --- a/src/DIELECTRIC/pppm_disp_dielectric.cpp +++ b/src/DIELECTRIC/pppm_disp_dielectric.cpp @@ -35,7 +35,7 @@ using namespace MathConst; #define MAXORDER 7 #define OFFSET 16384 -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; #define LARGE 10000.0 #define EPS_HOC 1.0e-7 @@ -49,11 +49,11 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM, FORWARD_AD_PERATOM_NONE}; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif /* ---------------------------------------------------------------------- */ diff --git a/src/DPD-BASIC/pair_dpd.cpp b/src/DPD-BASIC/pair_dpd.cpp index 5771831e02..1f60074280 100644 --- a/src/DPD-BASIC/pair_dpd.cpp +++ b/src/DPD-BASIC/pair_dpd.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/DPD-BASIC/pair_dpd_ext.cpp b/src/DPD-BASIC/pair_dpd_ext.cpp index 623b16774c..da08e53a4a 100644 --- a/src/DPD-BASIC/pair_dpd_ext.cpp +++ b/src/DPD-BASIC/pair_dpd_ext.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/DPD-BASIC/pair_dpd_ext_tstat.cpp b/src/DPD-BASIC/pair_dpd_ext_tstat.cpp index 433bc54063..fe881d7bc5 100644 --- a/src/DPD-BASIC/pair_dpd_ext_tstat.cpp +++ b/src/DPD-BASIC/pair_dpd_ext_tstat.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/DPD-BASIC/pair_dpd_tstat.cpp b/src/DPD-BASIC/pair_dpd_tstat.cpp index ed659e7cc3..108177ed69 100644 --- a/src/DPD-BASIC/pair_dpd_tstat.cpp +++ b/src/DPD-BASIC/pair_dpd_tstat.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/DPD-MESO/pair_edpd.cpp b/src/DPD-MESO/pair_edpd.cpp index ed99a5eac1..b575956f71 100644 --- a/src/DPD-MESO/pair_edpd.cpp +++ b/src/DPD-MESO/pair_edpd.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; #define MIN(A,B) ((A) < (B) ? (A) : (B)) #define MAX(A,B) ((A) > (B) ? (A) : (B)) -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; static const char cite_pair_edpd[] = "pair edpd command: doi:10.1016/j.jcp.2014.02.003\n\n" diff --git a/src/DPD-MESO/pair_mdpd.cpp b/src/DPD-MESO/pair_mdpd.cpp index 767fddd7ac..de148189e0 100644 --- a/src/DPD-MESO/pair_mdpd.cpp +++ b/src/DPD-MESO/pair_mdpd.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; static const char cite_pair_mdpd[] = "pair mdpd command: doi:10.1063/1.4812366\n\n" diff --git a/src/DPD-MESO/pair_tdpd.cpp b/src/DPD-MESO/pair_tdpd.cpp index eac5bd1318..038b3c3cdc 100644 --- a/src/DPD-MESO/pair_tdpd.cpp +++ b/src/DPD-MESO/pair_tdpd.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; #define MIN(A,B) ((A) < (B) ? (A) : (B)) #define MAX(A,B) ((A) > (B) ? (A) : (B)) -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; static const char cite_pair_tdpd[] = "pair tdpd command: doi:10.1063/1.4923254\n\n" diff --git a/src/DPD-REACT/fix_shardlow.cpp b/src/DPD-REACT/fix_shardlow.cpp index 19f2c08a5f..747d2725b8 100644 --- a/src/DPD-REACT/fix_shardlow.cpp +++ b/src/DPD-REACT/fix_shardlow.cpp @@ -59,7 +59,7 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace random_external_state; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; #define EPSILON_SQUARED ((EPSILON) * (EPSILON)) static const char cite_fix_shardlow[] = diff --git a/src/DPD-REACT/pair_dpd_fdt.cpp b/src/DPD-REACT/pair_dpd_fdt.cpp index e6cab0e996..44920a6bda 100644 --- a/src/DPD-REACT/pair_dpd_fdt.cpp +++ b/src/DPD-REACT/pair_dpd_fdt.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/DPD-REACT/pair_dpd_fdt_energy.cpp b/src/DPD-REACT/pair_dpd_fdt_energy.cpp index d3371f465a..12d6dc5fb7 100644 --- a/src/DPD-REACT/pair_dpd_fdt_energy.cpp +++ b/src/DPD-REACT/pair_dpd_fdt_energy.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/DRUDE/pair_lj_cut_thole_long.cpp b/src/DRUDE/pair_lj_cut_thole_long.cpp index cfdf631eb9..a11fc691b1 100644 --- a/src/DRUDE/pair_lj_cut_thole_long.cpp +++ b/src/DRUDE/pair_lj_cut_thole_long.cpp @@ -46,7 +46,7 @@ using namespace MathConst; #define B4 -5.80844129e-3 #define B5 1.14652755e-1 -#define EPSILON 1.0e-20 +static constexpr double EPSILON = 1.0e-20; #define EPS_EWALD 1.0e-6 #define EPS_EWALD_SQR 1.0e-12 diff --git a/src/EFF/fix_langevin_eff.cpp b/src/EFF/fix_langevin_eff.cpp index a25b6ac837..72c368b612 100644 --- a/src/EFF/fix_langevin_eff.cpp +++ b/src/EFF/fix_langevin_eff.cpp @@ -37,8 +37,8 @@ using namespace FixConst; enum{NOBIAS,BIAS}; enum{CONSTANT,EQUAL,ATOM}; -#define SINERTIA 0.4 // moment of inertia prefactor for sphere -#define EINERTIA 0.2 // moment of inertia prefactor for ellipsoid +static constexpr double SINERTIA = 0.4; // moment of inertia prefactor for sphere +static constexpr double EINERTIA = 0.2; // moment of inertia prefactor for ellipsoid /* ---------------------------------------------------------------------- */ diff --git a/src/ELECTRODE/ewald_electrode.cpp b/src/ELECTRODE/ewald_electrode.cpp index 99266ed450..122708b97d 100644 --- a/src/ELECTRODE/ewald_electrode.cpp +++ b/src/ELECTRODE/ewald_electrode.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; /* ---------------------------------------------------------------------- */ diff --git a/src/ELECTRODE/fix_electrode_conp.cpp b/src/ELECTRODE/fix_electrode_conp.cpp index 1b6c0a37d4..9e2599ca8a 100644 --- a/src/ELECTRODE/fix_electrode_conp.cpp +++ b/src/ELECTRODE/fix_electrode_conp.cpp @@ -48,7 +48,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 1e-16 +static constexpr double SMALL = 1e-16; extern "C" { void dgetrf_(const int *M, const int *N, double *A, const int *lda, int *ipiv, int *info); diff --git a/src/ELECTRODE/fix_electrode_thermo.cpp b/src/ELECTRODE/fix_electrode_thermo.cpp index 52c0a3ce4c..f95aeac615 100644 --- a/src/ELECTRODE/fix_electrode_thermo.cpp +++ b/src/ELECTRODE/fix_electrode_thermo.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; #define NUM_GROUPS 2 -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; /* ----------------------------------------------------------------------- */ diff --git a/src/ELECTRODE/pppm_electrode.cpp b/src/ELECTRODE/pppm_electrode.cpp index 0ae3da6863..599d117463 100644 --- a/src/ELECTRODE/pppm_electrode.cpp +++ b/src/ELECTRODE/pppm_electrode.cpp @@ -48,18 +48,18 @@ using namespace MathSpecial; #define MAXORDER 7 #define OFFSET 16384 #define LARGE 10000.0 -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; #define EPS_HOC 1.0e-7 enum { REVERSE_RHO }; enum { FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM }; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif static const char cite_pppm_electrode[] = diff --git a/src/ELECTRODE/slab_dipole.cpp b/src/ELECTRODE/slab_dipole.cpp index d5f3eae7aa..27ec42a8b5 100644 --- a/src/ELECTRODE/slab_dipole.cpp +++ b/src/ELECTRODE/slab_dipole.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; /* ---------------------------------------------------------------------- Slab-geometry correction term to dampen inter-slab interactions between diff --git a/src/EXTRA-COMPUTE/compute_born_matrix.cpp b/src/EXTRA-COMPUTE/compute_born_matrix.cpp index 4eecbbfa14..2e674409d1 100644 --- a/src/EXTRA-COMPUTE/compute_born_matrix.cpp +++ b/src/EXTRA-COMPUTE/compute_born_matrix.cpp @@ -42,8 +42,7 @@ using namespace LAMMPS_NS; -#define BIG 1000000000 -#define SMALL 1e-16 +static constexpr double SMALL = 1e-16; // this table is used to pick the 3d rij vector indices used to // compute the 6 indices long Voigt stress vector diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index e1bc6bcd91..622ea839be 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; -#define SMALL 1.0e-10 +static constexpr double SMALL = 1.0e-10; /*----------------------------------------------------------------------------------- Contributing author: Olav Galteland (Norwegian University of Science and Technology) olav.galteland@ntnu.no diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 6c35b4ba07..718c10e611 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -39,7 +39,7 @@ using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; enum { X, Y, Z }; enum { TOTAL, CONF, KIN, PAIR, BOND, ANGLE, DIHEDRAL }; diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp index 41b5f64a67..676b0f5796 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp @@ -39,7 +39,7 @@ using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; enum { X, Y, Z }; enum { TOTAL, CONF, KIN, PAIR, BOND, ANGLE, DIHEDRAL }; diff --git a/src/EXTRA-COMPUTE/compute_stress_spherical.cpp b/src/EXTRA-COMPUTE/compute_stress_spherical.cpp index db20ab6706..983d31559d 100644 --- a/src/EXTRA-COMPUTE/compute_stress_spherical.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_spherical.cpp @@ -34,7 +34,7 @@ using namespace MathConst; using MathSpecial::cube; using MathSpecial::square; -#define SMALL 1.0e-10 +static constexpr double SMALL = 1.0e-10; /*----------------------------------------------------------------------------------- Contributing author: Olav Galteland (Norwegian University of Science and Technology) diff --git a/src/EXTRA-FIX/fix_ffl.cpp b/src/EXTRA-FIX/fix_ffl.cpp index 0a06707fbd..3039d338fc 100644 --- a/src/EXTRA-FIX/fix_ffl.cpp +++ b/src/EXTRA-FIX/fix_ffl.cpp @@ -43,7 +43,7 @@ enum {CONSTANT,EQUAL,ATOM}; enum {NO_FLIP, FLIP_RESCALE, FLIP_HARD, FLIP_SOFT}; //#define FFL_DEBUG 1 -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; /* syntax for fix_ffl: * fix nfix id-group ffl tau Tstart Tstop seed [flip_type] diff --git a/src/EXTRA-FIX/fix_filter_corotate.cpp b/src/EXTRA-FIX/fix_filter_corotate.cpp index c88969344a..12c41dba42 100644 --- a/src/EXTRA-FIX/fix_filter_corotate.cpp +++ b/src/EXTRA-FIX/fix_filter_corotate.cpp @@ -42,7 +42,7 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace FixConst; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; #define MASSDELTA 0.1 static const char cite_filter_corotate[] = diff --git a/src/EXTRA-FIX/fix_gle.cpp b/src/EXTRA-FIX/fix_gle.cpp index c5a6c974f6..a65b60377e 100644 --- a/src/EXTRA-FIX/fix_gle.cpp +++ b/src/EXTRA-FIX/fix_gle.cpp @@ -41,7 +41,7 @@ enum{CONSTANT,EQUAL,ATOM}; //#define GLE_DEBUG 1 -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; /* syntax for fix_gle: * fix nfix id-group gle ns Tstart Tstop seed amatrix [noneq cmatrix] [every nmts] diff --git a/src/EXTRA-FIX/fix_smd.cpp b/src/EXTRA-FIX/fix_smd.cpp index e19a605e71..a9dbfcc2d1 100644 --- a/src/EXTRA-FIX/fix_smd.cpp +++ b/src/EXTRA-FIX/fix_smd.cpp @@ -38,7 +38,7 @@ enum { SMD_NONE=0, SMD_CVEL=1<<2, SMD_CFOR=1<<3, SMD_AUTOX=1<<4, SMD_AUTOY=1<<5, SMD_AUTOZ=1<<6}; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-FIX/fix_tmd.cpp b/src/EXTRA-FIX/fix_tmd.cpp index e88007a29d..d96666fe50 100644 --- a/src/EXTRA-FIX/fix_tmd.cpp +++ b/src/EXTRA-FIX/fix_tmd.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; using namespace FixConst; #define CHUNK 1000 -#define MAXLINE 256 +static constexpr int MAXLINE = 256; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-FIX/fix_viscosity.cpp b/src/EXTRA-FIX/fix_viscosity.cpp index 94eab7f262..715c30afdd 100644 --- a/src/EXTRA-FIX/fix_viscosity.cpp +++ b/src/EXTRA-FIX/fix_viscosity.cpp @@ -32,7 +32,7 @@ using namespace FixConst; // needs to be big, but not so big that lose precision when subtract velocity -#define BIG 1.0e10 +static constexpr double BIG = 1.0e10; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/angle_cosine_delta.cpp b/src/EXTRA-MOLECULE/angle_cosine_delta.cpp index 71acca6001..51a53e1a96 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_delta.cpp +++ b/src/EXTRA-MOLECULE/angle_cosine_delta.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/angle_cosine_periodic.cpp b/src/EXTRA-MOLECULE/angle_cosine_periodic.cpp index 245a7b8d58..0b2a6d336d 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_periodic.cpp +++ b/src/EXTRA-MOLECULE/angle_cosine_periodic.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/angle_cosine_shift.cpp b/src/EXTRA-MOLECULE/angle_cosine_shift.cpp index ce9b4c4133..53ecb35eaf 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_shift.cpp +++ b/src/EXTRA-MOLECULE/angle_cosine_shift.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/angle_cosine_shift_exp.cpp b/src/EXTRA-MOLECULE/angle_cosine_shift_exp.cpp index a411ea3199..acca92c48e 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_shift_exp.cpp +++ b/src/EXTRA-MOLECULE/angle_cosine_shift_exp.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/angle_fourier.cpp b/src/EXTRA-MOLECULE/angle_fourier.cpp index c7eb3d4fe4..2c458c07cc 100644 --- a/src/EXTRA-MOLECULE/angle_fourier.cpp +++ b/src/EXTRA-MOLECULE/angle_fourier.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/angle_fourier_simple.cpp b/src/EXTRA-MOLECULE/angle_fourier_simple.cpp index 0ba890b273..6de7956ffa 100644 --- a/src/EXTRA-MOLECULE/angle_fourier_simple.cpp +++ b/src/EXTRA-MOLECULE/angle_fourier_simple.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.0001 +static constexpr double SMALL = 0.0001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/angle_quartic.cpp b/src/EXTRA-MOLECULE/angle_quartic.cpp index eaccdbe608..aade6b4534 100644 --- a/src/EXTRA-MOLECULE/angle_quartic.cpp +++ b/src/EXTRA-MOLECULE/angle_quartic.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/dihedral_cosine_shift_exp.cpp b/src/EXTRA-MOLECULE/dihedral_cosine_shift_exp.cpp index 7165cde1fd..36874ee934 100644 --- a/src/EXTRA-MOLECULE/dihedral_cosine_shift_exp.cpp +++ b/src/EXTRA-MOLECULE/dihedral_cosine_shift_exp.cpp @@ -30,8 +30,8 @@ using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/dihedral_fourier.cpp b/src/EXTRA-MOLECULE/dihedral_fourier.cpp index f9b4a0d13e..37e1ae8328 100644 --- a/src/EXTRA-MOLECULE/dihedral_fourier.cpp +++ b/src/EXTRA-MOLECULE/dihedral_fourier.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define TOLERANCE 0.05 +static constexpr double TOLERANCE = 0.05; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/dihedral_helix.cpp b/src/EXTRA-MOLECULE/dihedral_helix.cpp index 1d99de6ba9..0111da9f99 100644 --- a/src/EXTRA-MOLECULE/dihedral_helix.cpp +++ b/src/EXTRA-MOLECULE/dihedral_helix.cpp @@ -32,9 +32,9 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define TOLERANCE 0.05 -#define SMALL 0.001 -#define SMALLER 0.00001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; +static constexpr double SMALLER = 0.00001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp b/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp index 206ad4f3ad..4c3cd3be2c 100644 --- a/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp +++ b/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp @@ -30,8 +30,8 @@ using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/dihedral_quadratic.cpp b/src/EXTRA-MOLECULE/dihedral_quadratic.cpp index a7c0dc3eb1..1bef5956fa 100644 --- a/src/EXTRA-MOLECULE/dihedral_quadratic.cpp +++ b/src/EXTRA-MOLECULE/dihedral_quadratic.cpp @@ -32,9 +32,9 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define TOLERANCE 0.05 -#define SMALL 0.001 -#define SMALLER 0.00001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; +static constexpr double SMALLER = 0.00001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/dihedral_table_cut.cpp b/src/EXTRA-MOLECULE/dihedral_table_cut.cpp index ce0d431e7c..a06df279f3 100644 --- a/src/EXTRA-MOLECULE/dihedral_table_cut.cpp +++ b/src/EXTRA-MOLECULE/dihedral_table_cut.cpp @@ -47,8 +47,8 @@ static const char cite_dihedral_tablecut[] = /* ---------------------------------------------------------------------- */ -#define TOLERANCE 0.05 -#define SMALL 0.0000001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.0000001; // ------------------------------------------------------------------------ // The following auxiliary functions were left out of the diff --git a/src/EXTRA-MOLECULE/improper_cossq.cpp b/src/EXTRA-MOLECULE/improper_cossq.cpp index bd21fa12e7..864ec28927 100644 --- a/src/EXTRA-MOLECULE/improper_cossq.cpp +++ b/src/EXTRA-MOLECULE/improper_cossq.cpp @@ -32,8 +32,8 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/improper_distance.cpp b/src/EXTRA-MOLECULE/improper_distance.cpp index 18f6dd9a3f..acb962c4f0 100644 --- a/src/EXTRA-MOLECULE/improper_distance.cpp +++ b/src/EXTRA-MOLECULE/improper_distance.cpp @@ -30,8 +30,8 @@ using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/improper_fourier.cpp b/src/EXTRA-MOLECULE/improper_fourier.cpp index 295657b1b6..1db8b3697c 100644 --- a/src/EXTRA-MOLECULE/improper_fourier.cpp +++ b/src/EXTRA-MOLECULE/improper_fourier.cpp @@ -30,8 +30,8 @@ using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/improper_ring.cpp b/src/EXTRA-MOLECULE/improper_ring.cpp index 36d6277e46..8c570550e4 100644 --- a/src/EXTRA-MOLECULE/improper_ring.cpp +++ b/src/EXTRA-MOLECULE/improper_ring.cpp @@ -54,8 +54,8 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/GPU/fix_nve_asphere_gpu.cpp b/src/GPU/fix_nve_asphere_gpu.cpp index 481f44bb63..9b75964c79 100644 --- a/src/GPU/fix_nve_asphere_gpu.cpp +++ b/src/GPU/fix_nve_asphere_gpu.cpp @@ -35,7 +35,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define INERTIA 0.2 // moment of inertia prefactor for ellipsoid +static constexpr double INERTIA = 0.2; // moment of inertia prefactor for ellipsoid #define ME_qnormalize(q) \ { \ diff --git a/src/GPU/pair_born_coul_long_cs_gpu.cpp b/src/GPU/pair_born_coul_long_cs_gpu.cpp index 798caeb97a..d37f0c53e2 100644 --- a/src/GPU/pair_born_coul_long_cs_gpu.cpp +++ b/src/GPU/pair_born_coul_long_cs_gpu.cpp @@ -42,7 +42,7 @@ using namespace MathConst; #define B4 -5.80844129e-3 #define B5 1.14652755e-1 -#define EPSILON 1.0e-20 +static constexpr double EPSILON = 1.0e-20; #define EPS_EWALD 1.0e-6 #define EPS_EWALD_SQR 1.0e-12 diff --git a/src/GPU/pair_born_coul_wolf_cs_gpu.cpp b/src/GPU/pair_born_coul_wolf_cs_gpu.cpp index 9858015622..128863527c 100644 --- a/src/GPU/pair_born_coul_wolf_cs_gpu.cpp +++ b/src/GPU/pair_born_coul_wolf_cs_gpu.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define EPSILON 1.0e-20 +static constexpr double EPSILON = 1.0e-20; // External functions from cuda library for atom decomposition diff --git a/src/GPU/pair_coul_long_cs_gpu.cpp b/src/GPU/pair_coul_long_cs_gpu.cpp index 79c4c4ab7c..bbe50e4351 100644 --- a/src/GPU/pair_coul_long_cs_gpu.cpp +++ b/src/GPU/pair_coul_long_cs_gpu.cpp @@ -40,7 +40,7 @@ using namespace LAMMPS_NS; #define B4 -5.80844129e-3 #define B5 1.14652755e-1 -#define EPSILON 1.0e-20 +static constexpr double EPSILON = 1.0e-20; #define EPS_EWALD 1.0e-6 #define EPS_EWALD_SQR 1.0e-12 diff --git a/src/GPU/pair_dpd_gpu.cpp b/src/GPU/pair_dpd_gpu.cpp index e4657cf2eb..afbdedcd11 100644 --- a/src/GPU/pair_dpd_gpu.cpp +++ b/src/GPU/pair_dpd_gpu.cpp @@ -53,7 +53,7 @@ void dpd_gpu_compute(const int ago, const int inum_full, const int nall, double double *boxlo, double *prd); double dpd_gpu_bytes(); -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; //#define _USE_UNIFORM_SARU_LCG //#define _USE_UNIFORM_SARU_TEA8 diff --git a/src/GPU/pair_dpd_tstat_gpu.cpp b/src/GPU/pair_dpd_tstat_gpu.cpp index 4a7b05fd2c..6889a0e0b8 100644 --- a/src/GPU/pair_dpd_tstat_gpu.cpp +++ b/src/GPU/pair_dpd_tstat_gpu.cpp @@ -55,7 +55,7 @@ void dpd_tstat_gpu_update_coeff(int ntypes, double **host_a0, double **host_gamm double **host_sigma, double **host_cut); double dpd_tstat_gpu_bytes(); -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; //#define _USE_UNIFORM_SARU_LCG //#define _USE_UNIFORM_SARU_TEA8 diff --git a/src/GPU/pair_eam_gpu.cpp b/src/GPU/pair_eam_gpu.cpp index 155da43768..563b3f8284 100644 --- a/src/GPU/pair_eam_gpu.cpp +++ b/src/GPU/pair_eam_gpu.cpp @@ -29,7 +29,7 @@ #include -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; using namespace LAMMPS_NS; diff --git a/src/GPU/pair_edpd_gpu.cpp b/src/GPU/pair_edpd_gpu.cpp index 5bee0cadb8..b6ea6d9098 100644 --- a/src/GPU/pair_edpd_gpu.cpp +++ b/src/GPU/pair_edpd_gpu.cpp @@ -58,7 +58,7 @@ void edpd_gpu_get_extra_data(double *host_T, double *host_cv); void edpd_gpu_update_flux(void **flux_ptr); double edpd_gpu_bytes(); -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/GPU/pair_mdpd_gpu.cpp b/src/GPU/pair_mdpd_gpu.cpp index bebe1e9736..78861504ee 100644 --- a/src/GPU/pair_mdpd_gpu.cpp +++ b/src/GPU/pair_mdpd_gpu.cpp @@ -55,7 +55,7 @@ void mdpd_gpu_compute(const int ago, const int inum_full, const int nall, double void mdpd_gpu_get_extra_data(double *host_rho); double mdpd_gpu_bytes(); -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/GPU/pair_sw_gpu.cpp b/src/GPU/pair_sw_gpu.cpp index 7645218a85..ac604f3a74 100644 --- a/src/GPU/pair_sw_gpu.cpp +++ b/src/GPU/pair_sw_gpu.cpp @@ -49,8 +49,8 @@ void sw_gpu_compute(const int ago, const int nloc, const int nall, const int ln, const double cpu_time, bool &success); double sw_gpu_bytes(); -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/GPU/pair_tersoff_gpu.cpp b/src/GPU/pair_tersoff_gpu.cpp index 8610a3880c..c3c9e6cfab 100644 --- a/src/GPU/pair_tersoff_gpu.cpp +++ b/src/GPU/pair_tersoff_gpu.cpp @@ -54,8 +54,8 @@ void tersoff_gpu_compute(const int ago, const int nlocal, const int nall, const int &host_start, const double cpu_time, bool &success); double tersoff_gpu_bytes(); -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/GPU/pppm_gpu.cpp b/src/GPU/pppm_gpu.cpp index 1959f00865..b8b72b9327 100644 --- a/src/GPU/pppm_gpu.cpp +++ b/src/GPU/pppm_gpu.cpp @@ -42,7 +42,7 @@ using namespace MathConst; #define MAXORDER 7 #define OFFSET 16384 -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; #define LARGE 10000.0 #define EPS_HOC 1.0e-7 @@ -50,11 +50,11 @@ enum{REVERSE_RHO_GPU,REVERSE_RHO}; enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif // external functions from cuda library for atom decomposition diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index afdcc417c6..ced3003508 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -42,7 +42,7 @@ using namespace FixConst; using namespace MathConst; using namespace MathExtra; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; // XYZ PLANE need to be 0,1,2 diff --git a/src/INTEL/fix_nve_asphere_intel.cpp b/src/INTEL/fix_nve_asphere_intel.cpp index 7e429901a4..848afa20cc 100644 --- a/src/INTEL/fix_nve_asphere_intel.cpp +++ b/src/INTEL/fix_nve_asphere_intel.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define INERTIA 0.2 // moment of inertia prefactor for ellipsoid +static constexpr double INERTIA = 0.2; // moment of inertia prefactor for ellipsoid /* ---------------------------------------------------------------------- */ diff --git a/src/INTEL/pair_airebo_intel.cpp b/src/INTEL/pair_airebo_intel.cpp index 7bc2b3edb8..e4a807e2c4 100644 --- a/src/INTEL/pair_airebo_intel.cpp +++ b/src/INTEL/pair_airebo_intel.cpp @@ -635,7 +635,7 @@ namespace overloaded { #define CARBON 0 #define HYDROGEN 1 -#define TOL 1.0e-9 +static constexpr double TOL = 1.0e-9; template inline T fmin_nonan(T a, T b) { diff --git a/src/INTEL/pair_eam_intel.cpp b/src/INTEL/pair_eam_intel.cpp index 9c5d6da5e5..03e268bb68 100644 --- a/src/INTEL/pair_eam_intel.cpp +++ b/src/INTEL/pair_eam_intel.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; #define FC_PACKED1_T typename ForceConst::fc_packed1 #define FC_PACKED2_T typename ForceConst::fc_packed2 diff --git a/src/INTEL/pair_sw_intel.cpp b/src/INTEL/pair_sw_intel.cpp index fa62f499de..61c25692e9 100644 --- a/src/INTEL/pair_sw_intel.cpp +++ b/src/INTEL/pair_sw_intel.cpp @@ -52,8 +52,8 @@ using namespace LAMMPS_NS; #define FC_PACKED2_T typename ForceConst::fc_packed2 #define FC_PACKED3_T typename ForceConst::fc_packed3 -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/INTEL/pppm_disp_intel.cpp b/src/INTEL/pppm_disp_intel.cpp index 6dac9fad99..e87045a7fc 100644 --- a/src/INTEL/pppm_disp_intel.cpp +++ b/src/INTEL/pppm_disp_intel.cpp @@ -54,11 +54,11 @@ enum{FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM, FORWARD_AD_PERATOM_NONE}; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif /* ---------------------------------------------------------------------- */ diff --git a/src/INTEL/pppm_electrode_intel.cpp b/src/INTEL/pppm_electrode_intel.cpp index 4d8a0331b8..513290f2df 100644 --- a/src/INTEL/pppm_electrode_intel.cpp +++ b/src/INTEL/pppm_electrode_intel.cpp @@ -59,11 +59,11 @@ enum { FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM }; enum : bool { ELECTRODE = true, ELECTROLYTE = false }; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif static const char cite_pppm_electrode[] = diff --git a/src/INTEL/pppm_intel.cpp b/src/INTEL/pppm_intel.cpp index f67b3a89b3..de60b8f9cd 100644 --- a/src/INTEL/pppm_intel.cpp +++ b/src/INTEL/pppm_intel.cpp @@ -51,11 +51,11 @@ enum{REVERSE_RHO}; enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif /* ---------------------------------------------------------------------- */ diff --git a/src/INTERLAYER/pair_aip_water_2dm.cpp b/src/INTERLAYER/pair_aip_water_2dm.cpp index 6e2bf7228d..655fc9f695 100644 --- a/src/INTERLAYER/pair_aip_water_2dm.cpp +++ b/src/INTERLAYER/pair_aip_water_2dm.cpp @@ -29,9 +29,9 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 -#define DELTA 4 -#define PGDELTA 1 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; +static constexpr int PGDELTA = 1; static const char cite_aip_water[] = "aip/water/2dm potential doi/10.1021/acs.jpcc.2c08464\n" diff --git a/src/INTERLAYER/pair_drip.cpp b/src/INTERLAYER/pair_drip.cpp index 90773b4034..3e897b56fa 100644 --- a/src/INTERLAYER/pair_drip.cpp +++ b/src/INTERLAYER/pair_drip.cpp @@ -36,8 +36,8 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; #define HALF 0.5 // inline functions diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index 69896d7c0b..a3e3a833c3 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -39,8 +39,8 @@ using namespace LAMMPS_NS; using namespace InterLayer; -#define DELTA 4 -#define PGDELTA 1 +static constexpr int DELTA = 4; +static constexpr int PGDELTA = 1; static const char cite_ilp[] = "ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848\n" diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp index ad42ba1922..64e71f22fc 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp +++ b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp @@ -40,9 +40,9 @@ using namespace LAMMPS_NS; using namespace InterLayer; -#define MAXLINE 1024 -#define DELTA 4 -#define PGDELTA 1 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; +static constexpr int PGDELTA = 1; static const char cite_kc[] = "kolmogorov/crespi/full potential doi:10.1021/acs.nanolett.8b02848\n" diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_z.cpp b/src/INTERLAYER/pair_kolmogorov_crespi_z.cpp index d8f0d798e4..4ccbd28c02 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_z.cpp +++ b/src/INTERLAYER/pair_kolmogorov_crespi_z.cpp @@ -37,8 +37,8 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/INTERLAYER/pair_lebedeva_z.cpp b/src/INTERLAYER/pair_lebedeva_z.cpp index b38900ad14..d7b13ef821 100644 --- a/src/INTERLAYER/pair_lebedeva_z.cpp +++ b/src/INTERLAYER/pair_lebedeva_z.cpp @@ -39,8 +39,8 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/INTERLAYER/pair_saip_metal.cpp b/src/INTERLAYER/pair_saip_metal.cpp index bd327391a4..c6c107c980 100644 --- a/src/INTERLAYER/pair_saip_metal.cpp +++ b/src/INTERLAYER/pair_saip_metal.cpp @@ -33,9 +33,9 @@ using namespace LAMMPS_NS; using namespace InterLayer; -#define MAXLINE 1024 -#define DELTA 4 -#define PGDELTA 1 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; +static constexpr int PGDELTA = 1; static const char cite_saip[] = "saip/metal potential: doi:10.1021/acs.jctc.1c00622\n\n" diff --git a/src/KOKKOS/angle_charmm_kokkos.cpp b/src/KOKKOS/angle_charmm_kokkos.cpp index 8b41a93451..666002686c 100644 --- a/src/KOKKOS/angle_charmm_kokkos.cpp +++ b/src/KOKKOS/angle_charmm_kokkos.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/angle_class2_kokkos.cpp b/src/KOKKOS/angle_class2_kokkos.cpp index 8f77ab4c94..e831ae2283 100644 --- a/src/KOKKOS/angle_class2_kokkos.cpp +++ b/src/KOKKOS/angle_class2_kokkos.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/angle_cosine_kokkos.cpp b/src/KOKKOS/angle_cosine_kokkos.cpp index 189a156866..ec20c8fbda 100644 --- a/src/KOKKOS/angle_cosine_kokkos.cpp +++ b/src/KOKKOS/angle_cosine_kokkos.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/angle_harmonic_kokkos.cpp b/src/KOKKOS/angle_harmonic_kokkos.cpp index 1d8ada4bd9..d7be418326 100644 --- a/src/KOKKOS/angle_harmonic_kokkos.cpp +++ b/src/KOKKOS/angle_harmonic_kokkos.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/atom_vec_spin_kokkos.cpp b/src/KOKKOS/atom_vec_spin_kokkos.cpp index 72d38a731e..c6ee7c1d3b 100644 --- a/src/KOKKOS/atom_vec_spin_kokkos.cpp +++ b/src/KOKKOS/atom_vec_spin_kokkos.cpp @@ -35,7 +35,7 @@ using namespace LAMMPS_NS; -#define DELTA 10 +static constexpr int DELTA = 10; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/comm_kokkos.cpp b/src/KOKKOS/comm_kokkos.cpp index 2f1818e47f..4d527cc16b 100644 --- a/src/KOKKOS/comm_kokkos.cpp +++ b/src/KOKKOS/comm_kokkos.cpp @@ -36,9 +36,9 @@ using namespace LAMMPS_NS; -#define BUFFACTOR 1.5 -#define BUFMIN 10000 -#define BUFEXTRA 1000 +static constexpr double BUFFACTOR = 1.5; +static constexpr int BUFMIN = 10000; +static constexpr int BUFEXTRA = 1000; /* ---------------------------------------------------------------------- setup MPI and allocate buffer space diff --git a/src/KOKKOS/comm_tiled_kokkos.cpp b/src/KOKKOS/comm_tiled_kokkos.cpp index e3286a73f5..4549f53f70 100644 --- a/src/KOKKOS/comm_tiled_kokkos.cpp +++ b/src/KOKKOS/comm_tiled_kokkos.cpp @@ -20,11 +20,10 @@ using namespace LAMMPS_NS; -#define BUFFACTOR 1.5 -#define BUFFACTOR 1.5 -#define BUFMIN 1000 -#define BUFEXTRA 1000 -#define EPSILON 1.0e-6 +static constexpr double BUFFACTOR = 1.5; +static constexpr int BUFMIN = 1000; +static constexpr int BUFEXTRA = 1000; +static constexpr double EPSILON = 1.0e-6; #define DELTA_PROCS 16 diff --git a/src/KOKKOS/dihedral_charmm_kokkos.cpp b/src/KOKKOS/dihedral_charmm_kokkos.cpp index 70a74a4846..b385ec7f01 100644 --- a/src/KOKKOS/dihedral_charmm_kokkos.cpp +++ b/src/KOKKOS/dihedral_charmm_kokkos.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define TOLERANCE 0.05 +static constexpr double TOLERANCE = 0.05; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/dihedral_charmmfsw_kokkos.cpp b/src/KOKKOS/dihedral_charmmfsw_kokkos.cpp index 1caea90a74..aeb9b022a7 100644 --- a/src/KOKKOS/dihedral_charmmfsw_kokkos.cpp +++ b/src/KOKKOS/dihedral_charmmfsw_kokkos.cpp @@ -40,7 +40,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define TOLERANCE 0.05 +static constexpr double TOLERANCE = 0.05; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/dihedral_class2_kokkos.cpp b/src/KOKKOS/dihedral_class2_kokkos.cpp index 2d6032600b..59f5c18ee7 100644 --- a/src/KOKKOS/dihedral_class2_kokkos.cpp +++ b/src/KOKKOS/dihedral_class2_kokkos.cpp @@ -30,9 +30,9 @@ using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 -#define SMALLER 0.00001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; +static constexpr double SMALLER = 0.00001; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/dihedral_harmonic_kokkos.cpp b/src/KOKKOS/dihedral_harmonic_kokkos.cpp index 8ca0b368df..87e83a17fc 100644 --- a/src/KOKKOS/dihedral_harmonic_kokkos.cpp +++ b/src/KOKKOS/dihedral_harmonic_kokkos.cpp @@ -30,9 +30,9 @@ using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 -#define SMALLER 0.00001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; +static constexpr double SMALLER = 0.00001; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/dihedral_opls_kokkos.cpp b/src/KOKKOS/dihedral_opls_kokkos.cpp index 670faa9e84..ce7502b25a 100644 --- a/src/KOKKOS/dihedral_opls_kokkos.cpp +++ b/src/KOKKOS/dihedral_opls_kokkos.cpp @@ -30,9 +30,9 @@ using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 -#define SMALLER 0.00001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; +static constexpr double SMALLER = 0.00001; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/domain_kokkos.cpp b/src/KOKKOS/domain_kokkos.cpp index 6311d45a3f..d0af281a14 100644 --- a/src/KOKKOS/domain_kokkos.cpp +++ b/src/KOKKOS/domain_kokkos.cpp @@ -22,8 +22,8 @@ using namespace LAMMPS_NS; -#define BIG 1.0e20 -#define SMALL 1.0e-4 +static constexpr double BIG = 1.0e20; +static constexpr double SMALL = 1.0e-4; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp b/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp index 9c34908d08..5256b7f4a4 100644 --- a/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp +++ b/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define SMALL 0.0001 +static constexpr double SMALL = 0.0001; #define EV_TO_KCAL_PER_MOL 14.4 /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_dt_reset_kokkos.cpp b/src/KOKKOS/fix_dt_reset_kokkos.cpp index 6e7709ace1..83cdc5f26f 100644 --- a/src/KOKKOS/fix_dt_reset_kokkos.cpp +++ b/src/KOKKOS/fix_dt_reset_kokkos.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_eos_table_rx_kokkos.cpp b/src/KOKKOS/fix_eos_table_rx_kokkos.cpp index 309eaeeebf..9b8ac91569 100644 --- a/src/KOKKOS/fix_eos_table_rx_kokkos.cpp +++ b/src/KOKKOS/fix_eos_table_rx_kokkos.cpp @@ -25,7 +25,7 @@ #include #include "atom_masks.h" -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; #ifdef DBL_EPSILON #define MY_EPSILON (10.0*DBL_EPSILON) diff --git a/src/KOKKOS/fix_langevin_kokkos.cpp b/src/KOKKOS/fix_langevin_kokkos.cpp index 437dd9daef..89cf91130f 100644 --- a/src/KOKKOS/fix_langevin_kokkos.cpp +++ b/src/KOKKOS/fix_langevin_kokkos.cpp @@ -34,8 +34,8 @@ using namespace FixConst; enum{NOBIAS,BIAS}; enum{CONSTANT,EQUAL,ATOM}; -#define SINERTIA 0.4 // moment of inertia prefactor for sphere -#define EINERTIA 0.2 // moment of inertia prefactor for ellipsoid +static constexpr double SINERTIA = 0.4; // moment of inertia prefactor for sphere +static constexpr double EINERTIA = 0.2; // moment of inertia prefactor for ellipsoid /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp b/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp index 18d7af75a7..06485eb1cc 100644 --- a/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp +++ b/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp @@ -46,7 +46,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define SMALL 0.0001 +static constexpr double SMALL = 0.0001; #define EV_TO_KCAL_PER_MOL 14.4 /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_shake_kokkos.cpp b/src/KOKKOS/fix_shake_kokkos.cpp index 39f4f4d4fe..3e0bc69a51 100644 --- a/src/KOKKOS/fix_shake_kokkos.cpp +++ b/src/KOKKOS/fix_shake_kokkos.cpp @@ -43,7 +43,7 @@ using namespace MathConst; #define RVOUS 1 // 0 for irregular, 1 for all2all -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; #define MASSDELTA 0.1 /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_shardlow_kokkos.cpp b/src/KOKKOS/fix_shardlow_kokkos.cpp index 37ffd15cdf..cb35a63fcb 100644 --- a/src/KOKKOS/fix_shardlow_kokkos.cpp +++ b/src/KOKKOS/fix_shardlow_kokkos.cpp @@ -57,7 +57,7 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace random_external_state; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; #define EPSILON_SQUARED ((EPSILON) * (EPSILON)) /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_wall_gran_old.cpp b/src/KOKKOS/fix_wall_gran_old.cpp index 24daca5dc2..c6d82a8b52 100644 --- a/src/KOKKOS/fix_wall_gran_old.cpp +++ b/src/KOKKOS/fix_wall_gran_old.cpp @@ -45,8 +45,8 @@ using namespace MathConst; #define THREEQUARTERS 0.75 // 3/4 #define TWOPI 6.28318530717959 // 2*PI -#define BIG 1.0e20 -#define EPSILON 1e-10 +static constexpr double BIG = 1.0e20; +static constexpr double EPSILON = 1e-10; // XYZ PLANE need to be 0,1,2 diff --git a/src/KOKKOS/grid3d_kokkos.cpp b/src/KOKKOS/grid3d_kokkos.cpp index 87f2baff84..26882f20ca 100644 --- a/src/KOKKOS/grid3d_kokkos.cpp +++ b/src/KOKKOS/grid3d_kokkos.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; -#define DELTA 16 +static constexpr int DELTA = 16; /* ---------------------------------------------------------------------- NOTES: diff --git a/src/KOKKOS/improper_class2_kokkos.cpp b/src/KOKKOS/improper_class2_kokkos.cpp index f1ed6fdbc0..4b9a009df2 100644 --- a/src/KOKKOS/improper_class2_kokkos.cpp +++ b/src/KOKKOS/improper_class2_kokkos.cpp @@ -27,8 +27,8 @@ using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/improper_harmonic_kokkos.cpp b/src/KOKKOS/improper_harmonic_kokkos.cpp index 1d217461d0..a075238f22 100644 --- a/src/KOKKOS/improper_harmonic_kokkos.cpp +++ b/src/KOKKOS/improper_harmonic_kokkos.cpp @@ -28,8 +28,8 @@ using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/mliap_descriptor_so3_kokkos.cpp b/src/KOKKOS/mliap_descriptor_so3_kokkos.cpp index ff9e5d2aa6..6a9f62457f 100644 --- a/src/KOKKOS/mliap_descriptor_so3_kokkos.cpp +++ b/src/KOKKOS/mliap_descriptor_so3_kokkos.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; #define MAXWORD 3 /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/mliap_so3_kokkos.cpp b/src/KOKKOS/mliap_so3_kokkos.cpp index 1fb5ffb52e..3f6370a6fc 100644 --- a/src/KOKKOS/mliap_so3_kokkos.cpp +++ b/src/KOKKOS/mliap_so3_kokkos.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecialKokkos; -#define SMALL 1.0e-8 +static constexpr double SMALL = 1.0e-8; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/modify_kokkos.cpp b/src/KOKKOS/modify_kokkos.cpp index 8d8ffca671..26ee88ff51 100644 --- a/src/KOKKOS/modify_kokkos.cpp +++ b/src/KOKKOS/modify_kokkos.cpp @@ -21,7 +21,7 @@ using namespace LAMMPS_NS; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/nbin_kokkos.cpp b/src/KOKKOS/nbin_kokkos.cpp index e65cf4ecb7..fd8cf5771b 100644 --- a/src/KOKKOS/nbin_kokkos.cpp +++ b/src/KOKKOS/nbin_kokkos.cpp @@ -22,7 +22,7 @@ using namespace LAMMPS_NS; -#define SMALL 1.0e-6 +static constexpr double SMALL = 1.0e-6; #define CUT2BIN_RATIO 100 /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/neigh_bond_kokkos.cpp b/src/KOKKOS/neigh_bond_kokkos.cpp index b749590779..a36043be57 100644 --- a/src/KOKKOS/neigh_bond_kokkos.cpp +++ b/src/KOKKOS/neigh_bond_kokkos.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; #define BONDDELTA 10000 -#define LB_FACTOR 1.5 +static constexpr double LB_FACTOR = 1.5; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_dpd_ext_kokkos.cpp b/src/KOKKOS/pair_dpd_ext_kokkos.cpp index 7264877d70..3624208c6b 100644 --- a/src/KOKKOS/pair_dpd_ext_kokkos.cpp +++ b/src/KOKKOS/pair_dpd_ext_kokkos.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; template diff --git a/src/KOKKOS/pair_dpd_ext_tstat_kokkos.cpp b/src/KOKKOS/pair_dpd_ext_tstat_kokkos.cpp index dcf88d1763..9808c53856 100644 --- a/src/KOKKOS/pair_dpd_ext_tstat_kokkos.cpp +++ b/src/KOKKOS/pair_dpd_ext_tstat_kokkos.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; template diff --git a/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp b/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp index a0ee204aeb..dd1591bf4b 100644 --- a/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp +++ b/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_dpd_kokkos.cpp b/src/KOKKOS/pair_dpd_kokkos.cpp index 3db8a06f6d..5dca219cdf 100644 --- a/src/KOKKOS/pair_dpd_kokkos.cpp +++ b/src/KOKKOS/pair_dpd_kokkos.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; template diff --git a/src/KOKKOS/pair_dpd_tstat_kokkos.cpp b/src/KOKKOS/pair_dpd_tstat_kokkos.cpp index 9058c23628..78cc862ac0 100644 --- a/src/KOKKOS/pair_dpd_tstat_kokkos.cpp +++ b/src/KOKKOS/pair_dpd_tstat_kokkos.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; template diff --git a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp index f487b0c84e..9f0b1dd747 100644 --- a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp +++ b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp @@ -43,7 +43,7 @@ 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) diff --git a/src/KOKKOS/pair_sw_kokkos.cpp b/src/KOKKOS/pair_sw_kokkos.cpp index 93b3919795..294b451e7e 100644 --- a/src/KOKKOS/pair_sw_kokkos.cpp +++ b/src/KOKKOS/pair_sw_kokkos.cpp @@ -37,8 +37,8 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_vashishta_kokkos.cpp b/src/KOKKOS/pair_vashishta_kokkos.cpp index 8400807ec6..d2eb3036d6 100644 --- a/src/KOKKOS/pair_vashishta_kokkos.cpp +++ b/src/KOKKOS/pair_vashishta_kokkos.cpp @@ -36,8 +36,8 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pppm_kokkos.cpp b/src/KOKKOS/pppm_kokkos.cpp index baa85dc585..d1f3403f1f 100644 --- a/src/KOKKOS/pppm_kokkos.cpp +++ b/src/KOKKOS/pppm_kokkos.cpp @@ -42,18 +42,18 @@ using namespace MathSpecialKokkos; #define MAXORDER 7 #define OFFSET 16384 #define LARGE 10000.0 -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; #define EPS_HOC 1.0e-7 enum{REVERSE_RHO}; enum{FORWARD_IK,FORWARD_IK_PERATOM}; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/region_block_kokkos.cpp b/src/KOKKOS/region_block_kokkos.cpp index c53fae7b03..6d53514d19 100644 --- a/src/KOKKOS/region_block_kokkos.cpp +++ b/src/KOKKOS/region_block_kokkos.cpp @@ -18,7 +18,7 @@ using namespace LAMMPS_NS; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/ewald.cpp b/src/KSPACE/ewald.cpp index 93470c60ac..930cc68ba9 100644 --- a/src/KSPACE/ewald.cpp +++ b/src/KSPACE/ewald.cpp @@ -35,7 +35,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/ewald_dipole.cpp b/src/KSPACE/ewald_dipole.cpp index 7a3a1da8ff..e4982b1d56 100644 --- a/src/KSPACE/ewald_dipole.cpp +++ b/src/KSPACE/ewald_dipole.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/ewald_dipole_spin.cpp b/src/KSPACE/ewald_dipole_spin.cpp index c679e164f7..93821db9ba 100644 --- a/src/KSPACE/ewald_dipole_spin.cpp +++ b/src/KSPACE/ewald_dipole_spin.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/ewald_disp.cpp b/src/KSPACE/ewald_disp.cpp index 31149134ad..9c81b21448 100644 --- a/src/KSPACE/ewald_disp.cpp +++ b/src/KSPACE/ewald_disp.cpp @@ -38,7 +38,7 @@ using namespace MathConst; using namespace MathSpecial; using namespace MathExtra; -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; //#define DEBUG diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index 041a5d5242..56b09962d1 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -38,7 +38,7 @@ using namespace MathConst; #define MAX_LEVELS 10 #define OFFSET 16384 -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; enum{REVERSE_RHO,REVERSE_AD,REVERSE_AD_PERATOM}; enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM}; diff --git a/src/KSPACE/msm_cg.cpp b/src/KSPACE/msm_cg.cpp index 4a8daedf10..ec2f46d262 100644 --- a/src/KSPACE/msm_cg.cpp +++ b/src/KSPACE/msm_cg.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; #define OFFSET 16384 -#define SMALLQ 0.00001 +static constexpr double SMALLQ = 0.00001; enum{REVERSE_RHO,REVERSE_AD,REVERSE_AD_PERATOM}; enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM}; diff --git a/src/KSPACE/pair_coul_streitz.cpp b/src/KSPACE/pair_coul_streitz.cpp index bd7fd20656..6d79a7d8de 100644 --- a/src/KSPACE/pair_coul_streitz.cpp +++ b/src/KSPACE/pair_coul_streitz.cpp @@ -35,8 +35,8 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define DELTA 4 -#define PGDELTA 1 +static constexpr int DELTA = 4; +static constexpr int PGDELTA = 1; #define MAXNEIGH 24 /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index ac516ff18c..6feea0bf88 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -48,18 +48,18 @@ using namespace MathSpecial; #define MAXORDER 7 #define OFFSET 16384 #define LARGE 10000.0 -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; #define EPS_HOC 1.0e-7 enum{REVERSE_RHO}; enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/pppm_cg.cpp b/src/KSPACE/pppm_cg.cpp index 845abe0078..907b47ec7c 100644 --- a/src/KSPACE/pppm_cg.cpp +++ b/src/KSPACE/pppm_cg.cpp @@ -35,15 +35,15 @@ using namespace LAMMPS_NS; using namespace MathConst; #define OFFSET 16384 -#define SMALLQ 0.00001 +static constexpr double SMALLQ = 0.00001; enum{REVERSE_RHO}; enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; #ifdef FFT_SINGLE -#define ZEROF 0.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; #else -#define ZEROF 0.0 +static constexpr FFT_SCALAR ZEROF = 0.0; #endif /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/pppm_dipole.cpp b/src/KSPACE/pppm_dipole.cpp index e0d13f2b9a..2fa761a55e 100644 --- a/src/KSPACE/pppm_dipole.cpp +++ b/src/KSPACE/pppm_dipole.cpp @@ -43,18 +43,18 @@ using namespace MathSpecial; #define MAXORDER 7 #define OFFSET 16384 #define LARGE 10000.0 -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; #define EPS_HOC 1.0e-7 enum{REVERSE_MU}; enum{FORWARD_MU,FORWARD_MU_PERATOM}; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/pppm_dipole_spin.cpp b/src/KSPACE/pppm_dipole_spin.cpp index e96378180a..a60666cd21 100644 --- a/src/KSPACE/pppm_dipole_spin.cpp +++ b/src/KSPACE/pppm_dipole_spin.cpp @@ -38,18 +38,18 @@ using namespace MathConst; #define MAXORDER 7 #define OFFSET 16384 #define LARGE 10000.0 -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; #define EPS_HOC 1.0e-7 enum{REVERSE_MU}; enum{FORWARD_MU,FORWARD_MU_PERATOM}; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index a738db98d2..64e3fbf847 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -42,7 +42,7 @@ using namespace MathConst; #define MAXORDER 7 #define OFFSET 16384 -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; #define LARGE 10000.0 #define EPS_HOC 1.0e-7 @@ -56,11 +56,11 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM, FORWARD_AD_PERATOM_NONE}; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/pppm_disp_tip4p.cpp b/src/KSPACE/pppm_disp_tip4p.cpp index c5ed2f26d6..da4d8b6aa5 100644 --- a/src/KSPACE/pppm_disp_tip4p.cpp +++ b/src/KSPACE/pppm_disp_tip4p.cpp @@ -32,11 +32,11 @@ using namespace MathConst; #define OFFSET 16384 #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif /* ---------------------------------------------------------------------- */ @@ -490,7 +490,7 @@ void PPPMDispTIP4P::fieldforce_c_peratom() Fix handling of TIP4P dipole compared to PPPMDisp::slabcorr ------------------------------------------------------------------------- */ -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; void PPPMDispTIP4P::slabcorr(int /*eflag*/) { diff --git a/src/KSPACE/pppm_stagger.cpp b/src/KSPACE/pppm_stagger.cpp index d44f2428c8..9a36acc88a 100644 --- a/src/KSPACE/pppm_stagger.cpp +++ b/src/KSPACE/pppm_stagger.cpp @@ -40,11 +40,11 @@ enum{REVERSE_RHO}; enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/pppm_tip4p.cpp b/src/KSPACE/pppm_tip4p.cpp index 730b604d7a..128149ccaa 100644 --- a/src/KSPACE/pppm_tip4p.cpp +++ b/src/KSPACE/pppm_tip4p.cpp @@ -32,11 +32,11 @@ using namespace MathConst; #define OFFSET 16384 #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif /* ---------------------------------------------------------------------- */ @@ -483,7 +483,7 @@ void PPPMTIP4P::fieldforce_peratom() Fix handling of TIP4P dipole compared to PPPMDisp::slabcorr ------------------------------------------------------------------------- */ -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; void PPPMTIP4P::slabcorr() { diff --git a/src/MACHDYN/fix_smd_adjust_dt.cpp b/src/MACHDYN/fix_smd_adjust_dt.cpp index d2728f1042..30006ec7cc 100644 --- a/src/MACHDYN/fix_smd_adjust_dt.cpp +++ b/src/MACHDYN/fix_smd_adjust_dt.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ diff --git a/src/MACHDYN/fix_smd_tlsph_reference_configuration.cpp b/src/MACHDYN/fix_smd_tlsph_reference_configuration.cpp index b236952e60..72ad76eccd 100644 --- a/src/MACHDYN/fix_smd_tlsph_reference_configuration.cpp +++ b/src/MACHDYN/fix_smd_tlsph_reference_configuration.cpp @@ -48,7 +48,7 @@ using namespace FixConst; using namespace SMD_Kernels; using namespace SMD_Math; -#define DELTA 16384 +static constexpr int DELTA = 16384; #define INSERT_PREDEFINED_CRACKS false diff --git a/src/MACHDYN/fix_smd_wall_surface.cpp b/src/MACHDYN/fix_smd_wall_surface.cpp index facc03d471..3753b64f52 100644 --- a/src/MACHDYN/fix_smd_wall_surface.cpp +++ b/src/MACHDYN/fix_smd_wall_surface.cpp @@ -32,8 +32,8 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace Eigen; using namespace std; -#define DELTA 16384 -#define EPSILON 1.0e-6 +static constexpr int DELTA = 16384; +static constexpr double EPSILON = 1.0e-6; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_airebo.cpp b/src/MANYBODY/pair_airebo.cpp index 129b9d2218..13d2b97433 100644 --- a/src/MANYBODY/pair_airebo.cpp +++ b/src/MANYBODY/pair_airebo.cpp @@ -41,8 +41,8 @@ using namespace LAMMPS_NS; using namespace MathSpecial; -#define TOL 1.0e-9 -#define PGDELTA 1 +static constexpr double TOL = 1.0e-9; +static constexpr int PGDELTA = 1; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_comb.cpp b/src/MANYBODY/pair_comb.cpp index 126544ddc5..0fa38474ee 100644 --- a/src/MANYBODY/pair_comb.cpp +++ b/src/MANYBODY/pair_comb.cpp @@ -43,8 +43,8 @@ using namespace MathConst; using namespace MathExtra; using namespace MathSpecial; -#define DELTA 4 -#define PGDELTA 1 +static constexpr int DELTA = 4; +static constexpr int PGDELTA = 1; #define MAXNEIGH 24 /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index a6a6ed37fd..f98cc43608 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -43,8 +43,8 @@ using namespace MathConst; using namespace MathExtra; using namespace MathSpecial; -#define DELTA 4 -#define PGDELTA 1 +static constexpr int DELTA = 4; +static constexpr int PGDELTA = 1; #define MAXNEIGH 24 /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_eam.cpp b/src/MANYBODY/pair_eam.cpp index a3d4257cc2..a2fff8fb55 100644 --- a/src/MANYBODY/pair_eam.cpp +++ b/src/MANYBODY/pair_eam.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_eam_cd.cpp b/src/MANYBODY/pair_eam_cd.cpp index 1746435fad..798292eb1d 100644 --- a/src/MANYBODY/pair_eam_cd.cpp +++ b/src/MANYBODY/pair_eam_cd.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 // This sets the maximum line length in EAM input files. +static constexpr int MAXLINE = 1024; // This sets the maximum line length in EAM input files. PairEAMCD::PairEAMCD(LAMMPS *lmp, int _cdeamVersion) : PairEAM(lmp), PairEAMAlloy(lmp), cdeamVersion(_cdeamVersion) diff --git a/src/MANYBODY/pair_edip.cpp b/src/MANYBODY/pair_edip.cpp index 974dc9ab84..4d7d47c36f 100644 --- a/src/MANYBODY/pair_edip.cpp +++ b/src/MANYBODY/pair_edip.cpp @@ -39,8 +39,8 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; #define GRIDDENSITY 8000 #define GRIDSTART 0.1 diff --git a/src/MANYBODY/pair_edip_multi.cpp b/src/MANYBODY/pair_edip_multi.cpp index 00be0ad829..2f8e9ca9c8 100644 --- a/src/MANYBODY/pair_edip_multi.cpp +++ b/src/MANYBODY/pair_edip_multi.cpp @@ -38,8 +38,8 @@ using namespace LAMMPS_NS; using namespace MathExtra; -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; static const char cite_pair_edip[] = "pair edip/multi: doi:10.1103/PhysRevB.86.144118, doi:10.1088/0953-8984/22/3/035802\n\n" diff --git a/src/MANYBODY/pair_extep.cpp b/src/MANYBODY/pair_extep.cpp index 755b4d0132..bcebbd3e72 100644 --- a/src/MANYBODY/pair_extep.cpp +++ b/src/MANYBODY/pair_extep.cpp @@ -37,9 +37,9 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathExtra; -#define MAXLINE 1024 -#define DELTA 4 -#define PGDELTA 1 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; +static constexpr int PGDELTA = 1; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index 1fd98b80f0..471896851a 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathExtra; -#define DELTA 4 +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_gw_zbl.cpp b/src/MANYBODY/pair_gw_zbl.cpp index 5e61778c68..da1ff557ad 100644 --- a/src/MANYBODY/pair_gw_zbl.cpp +++ b/src/MANYBODY/pair_gw_zbl.cpp @@ -32,8 +32,8 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index ed085c4b98..1e19363212 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -33,9 +33,9 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 -#define TOL 1.0e-9 -#define PGDELTA 1 +static constexpr int MAXLINE = 1024; +static constexpr double TOL = 1.0e-9; +static constexpr int PGDELTA = 1; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_local_density.cpp b/src/MANYBODY/pair_local_density.cpp index 71a7e658d2..444f56f291 100644 --- a/src/MANYBODY/pair_local_density.cpp +++ b/src/MANYBODY/pair_local_density.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; static const char cite_pair_local_density[] = "pair_style local/density command: doi:10.1063/1.4958629, doi:10.1021/acs.jpcb.7b12446\n\n" diff --git a/src/MANYBODY/pair_meam_spline.cpp b/src/MANYBODY/pair_meam_spline.cpp index 1c17f434f2..b952330c04 100644 --- a/src/MANYBODY/pair_meam_spline.cpp +++ b/src/MANYBODY/pair_meam_spline.cpp @@ -440,7 +440,7 @@ void PairMEAMSpline::coeff(int narg, char **arg) } } -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; void PairMEAMSpline::read_file(const char* filename) { diff --git a/src/MANYBODY/pair_meam_sw_spline.cpp b/src/MANYBODY/pair_meam_sw_spline.cpp index 3e3e813c5b..e02625c598 100644 --- a/src/MANYBODY/pair_meam_sw_spline.cpp +++ b/src/MANYBODY/pair_meam_sw_spline.cpp @@ -384,7 +384,7 @@ void PairMEAMSWSpline::coeff(int narg, char **arg) set coeffs for one or more type pairs ------------------------------------------------------------------------- */ -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; void PairMEAMSWSpline::read_file(const char* filename) { diff --git a/src/MANYBODY/pair_nb3b_harmonic.cpp b/src/MANYBODY/pair_nb3b_harmonic.cpp index 5bc930c186..51e554694c 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.cpp +++ b/src/MANYBODY/pair_nb3b_harmonic.cpp @@ -34,8 +34,8 @@ using namespace LAMMPS_NS; using MathConst::MY_PI; -#define DELTA 4 -#define SMALL 0.001 +static constexpr int DELTA = 4; +static constexpr double SMALL = 0.001; static const char *substyle[] = {"nb3n/harmonic", "nb3b/screened"}; diff --git a/src/MANYBODY/pair_nb3b_screened.cpp b/src/MANYBODY/pair_nb3b_screened.cpp index d66945d563..9480ae9f15 100644 --- a/src/MANYBODY/pair_nb3b_screened.cpp +++ b/src/MANYBODY/pair_nb3b_screened.cpp @@ -20,7 +20,7 @@ #include -#define SMALL 0.001 +static constexpr double SMALL = 0.001; using namespace LAMMPS_NS; diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index 03ef6cb49f..cc0b225a78 100644 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -38,8 +38,8 @@ using namespace LAMMPS_NS; using namespace MathExtra; -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_sw.cpp b/src/MANYBODY/pair_sw.cpp index 540fd8772c..18b642967c 100644 --- a/src/MANYBODY/pair_sw.cpp +++ b/src/MANYBODY/pair_sw.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; -#define DELTA 4 +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_sw_angle_table.cpp b/src/MANYBODY/pair_sw_angle_table.cpp index 21f1967c0d..8e605caebd 100644 --- a/src/MANYBODY/pair_sw_angle_table.cpp +++ b/src/MANYBODY/pair_sw_angle_table.cpp @@ -39,7 +39,7 @@ using MathConst::DEG2RAD; using MathConst::MY_PI; using MathConst::RAD2DEG; -#define DELTA 4 +static constexpr int DELTA = 4; enum { LINEAR, SPLINE }; diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index c7c45bc865..e3c8c83416 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -40,7 +40,7 @@ using namespace MathConst; using namespace MathSpecial; using namespace MathExtra; -#define DELTA 4 +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_tersoff_mod.cpp b/src/MANYBODY/pair_tersoff_mod.cpp index 010ff8df87..f4ae623bae 100644 --- a/src/MANYBODY/pair_tersoff_mod.cpp +++ b/src/MANYBODY/pair_tersoff_mod.cpp @@ -35,7 +35,7 @@ using namespace MathConst; using namespace MathExtra; using namespace MathSpecial; -#define DELTA 4 +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_tersoff_mod_c.cpp b/src/MANYBODY/pair_tersoff_mod_c.cpp index bdec854c41..e7fef3ccfa 100644 --- a/src/MANYBODY/pair_tersoff_mod_c.cpp +++ b/src/MANYBODY/pair_tersoff_mod_c.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; -#define DELTA 4 +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_tersoff_table.cpp b/src/MANYBODY/pair_tersoff_table.cpp index 325542f97e..48b99794a6 100644 --- a/src/MANYBODY/pair_tersoff_table.cpp +++ b/src/MANYBODY/pair_tersoff_table.cpp @@ -39,8 +39,8 @@ using namespace LAMMPS_NS; using MathConst::MY_PI; -#define MAXLINE 1024 -#define DELTA 4 +static constexpr int MAXLINE = 1024; +static constexpr int DELTA = 4; #define GRIDSTART 0.1 #define GRIDDENSITY_FCUTOFF 5000 diff --git a/src/MANYBODY/pair_tersoff_zbl.cpp b/src/MANYBODY/pair_tersoff_zbl.cpp index daf2718cb1..9c4dabc219 100644 --- a/src/MANYBODY/pair_tersoff_zbl.cpp +++ b/src/MANYBODY/pair_tersoff_zbl.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; -#define DELTA 4 +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_threebody_table.cpp b/src/MANYBODY/pair_threebody_table.cpp index 57f7021816..20b26edbfa 100644 --- a/src/MANYBODY/pair_threebody_table.cpp +++ b/src/MANYBODY/pair_threebody_table.cpp @@ -35,7 +35,7 @@ using namespace LAMMPS_NS; using MathConst::MY_PI; -#define DELTA 4 +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_vashishta.cpp b/src/MANYBODY/pair_vashishta.cpp index 531f15d263..79df1f36d7 100644 --- a/src/MANYBODY/pair_vashishta.cpp +++ b/src/MANYBODY/pair_vashishta.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; -#define DELTA 4 +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- */ diff --git a/src/MC/fix_bond_break.cpp b/src/MC/fix_bond_break.cpp index 6589f93e23..bb3e725c96 100644 --- a/src/MC/fix_bond_break.cpp +++ b/src/MC/fix_bond_break.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define DELTA 16 +static constexpr int DELTA = 16; /* ---------------------------------------------------------------------- */ diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index adecc9f252..8922bde55f 100644 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -34,8 +34,8 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; -#define BIG 1.0e20 -#define DELTA 16 +static constexpr double BIG = 1.0e20; +static constexpr int DELTA = 16; /* ---------------------------------------------------------------------- */ diff --git a/src/MC/fix_charge_regulation.cpp b/src/MC/fix_charge_regulation.cpp index a828f276ea..aded277fe6 100644 --- a/src/MC/fix_charge_regulation.cpp +++ b/src/MC/fix_charge_regulation.cpp @@ -68,7 +68,7 @@ enum{CONSTANT,EQUAL}; // parsing input variables // large energy value used to signal overlap #define MAXENERGYSIGNAL 1.0e100 #define MAXENERGYTEST 1.0e50 -#define SMALL 0.0000001 +static constexpr double SMALL = 0.0000001; #define NA_RHO0 0.602214 // Avogadro's constant times reference concentration (N_A * mol / liter) [nm^-3] /* ---------------------------------------------------------------------- */ diff --git a/src/MC/fix_mol_swap.cpp b/src/MC/fix_mol_swap.cpp index a47cf039d1..f496d4a9c5 100644 --- a/src/MC/fix_mol_swap.cpp +++ b/src/MC/fix_mol_swap.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ diff --git a/src/MEAM/pair_meam.cpp b/src/MEAM/pair_meam.cpp index 2f095754af..c8932d9a31 100644 --- a/src/MEAM/pair_meam.cpp +++ b/src/MEAM/pair_meam.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; static const int nkeywords = 22; static const char *keywords[] = { diff --git a/src/MESONT/pair_mesocnt.cpp b/src/MESONT/pair_mesocnt.cpp index 521c8c5f60..cb7ee0b938 100644 --- a/src/MESONT/pair_mesocnt.cpp +++ b/src/MESONT/pair_mesocnt.cpp @@ -43,9 +43,9 @@ using namespace MathExtra; using MathConst::MY_2PI; using MathConst::MY_PI; -#define MAXLINE 1024 +static constexpr int MAXLINE = 1024; #define SELF_CUTOFF 3 -#define SMALL 1.0e-6 +static constexpr double SMALL = 1.0e-6; #define SWITCH 1.0e-4 #define RHOMIN 10.0 diff --git a/src/MISC/pair_agni.cpp b/src/MISC/pair_agni.cpp index 8597e5db93..79a3c03fb4 100644 --- a/src/MISC/pair_agni.cpp +++ b/src/MISC/pair_agni.cpp @@ -47,7 +47,7 @@ static const char cite_pair_agni[] = " year = {2019},\n" "}\n\n"; -#define MAXLINE 10240 +static constexpr int MAXLINE = 10240; #define MAXWORD 40 /* ---------------------------------------------------------------------- */ diff --git a/src/MISC/pair_srp.cpp b/src/MISC/pair_srp.cpp index ddcfb92e9c..31f5b85760 100644 --- a/src/MISC/pair_srp.cpp +++ b/src/MISC/pair_srp.cpp @@ -47,8 +47,8 @@ Please contact Timothy Sirk for questions (tim.sirk@us.army.mil). using namespace LAMMPS_NS; -#define SMALL 1.0e-10 -#define BIG 1e10 +static constexpr double SMALL = 1.0e-10; +static constexpr double BIG = 1e10; #define ONETWOBIT 0x40000000 static const char cite_srp[] = diff --git a/src/ML-IAP/mliap_so3.cpp b/src/ML-IAP/mliap_so3.cpp index 72ca466ab3..bfdde4b968 100644 --- a/src/ML-IAP/mliap_so3.cpp +++ b/src/ML-IAP/mliap_so3.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; -#define SMALL 1.0e-8 +static constexpr double SMALL = 1.0e-8; /* ---------------------------------------------------------------------- */ diff --git a/src/MOFFF/angle_class2_p6.cpp b/src/MOFFF/angle_class2_p6.cpp index bfa6a068f5..39dec0d9d6 100644 --- a/src/MOFFF/angle_class2_p6.cpp +++ b/src/MOFFF/angle_class2_p6.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/MOFFF/angle_cosine_buck6d.cpp b/src/MOFFF/angle_cosine_buck6d.cpp index dbdf39292e..0ab9cbbf1f 100644 --- a/src/MOFFF/angle_cosine_buck6d.cpp +++ b/src/MOFFF/angle_cosine_buck6d.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/MOFFF/improper_inversion_harmonic.cpp b/src/MOFFF/improper_inversion_harmonic.cpp index 817b35332a..cc9bd8ad94 100644 --- a/src/MOFFF/improper_inversion_harmonic.cpp +++ b/src/MOFFF/improper_inversion_harmonic.cpp @@ -35,8 +35,8 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/angle_table.cpp b/src/MOLECULE/angle_table.cpp index c5e65be402..b1984a6918 100644 --- a/src/MOLECULE/angle_table.cpp +++ b/src/MOLECULE/angle_table.cpp @@ -38,8 +38,8 @@ using MathConst::RAD2DEG; enum { LINEAR, SPLINE }; -#define SMALL 0.001 -#define TINY 1.E-10 +static constexpr double SMALL = 0.001; +static constexpr double TINY = 1.E-10; /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/bond_table.cpp b/src/MOLECULE/bond_table.cpp index 4068e98e8d..67cd3769ca 100644 --- a/src/MOLECULE/bond_table.cpp +++ b/src/MOLECULE/bond_table.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; enum { NONE, LINEAR, SPLINE }; -#define BIGNUM 1.0e300 +static constexpr double BIGNUM = 1.0e300; /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/pair_hbond_dreiding_lj.cpp b/src/MOLECULE/pair_hbond_dreiding_lj.cpp index 496e368452..28985c3a88 100644 --- a/src/MOLECULE/pair_hbond_dreiding_lj.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_lj.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; #define CHUNK 8 /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/pair_hbond_dreiding_morse.cpp b/src/MOLECULE/pair_hbond_dreiding_morse.cpp index 7ec2db073d..b3e3584ccc 100644 --- a/src/MOLECULE/pair_hbond_dreiding_morse.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_morse.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; #define CHUNK 8 /* ---------------------------------------------------------------------- */ diff --git a/src/MOLFILE/reader_molfile.cpp b/src/MOLFILE/reader_molfile.cpp index 441a152ad9..43154d658b 100644 --- a/src/MOLFILE/reader_molfile.cpp +++ b/src/MOLFILE/reader_molfile.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; typedef MolfileInterface MFI; using namespace MathConst; -#define SMALL 1.0e-6 +static constexpr double SMALL = 1.0e-6; // true if the difference between two floats is "small". // cannot use fabsf() since it is not fully portable. diff --git a/src/OPENMP/angle_charmm_omp.cpp b/src/OPENMP/angle_charmm_omp.cpp index 9eb91bcb27..bb5dcca0da 100644 --- a/src/OPENMP/angle_charmm_omp.cpp +++ b/src/OPENMP/angle_charmm_omp.cpp @@ -28,7 +28,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/angle_class2_omp.cpp b/src/OPENMP/angle_class2_omp.cpp index 300f8f2b3c..9480d2ebfb 100644 --- a/src/OPENMP/angle_class2_omp.cpp +++ b/src/OPENMP/angle_class2_omp.cpp @@ -28,7 +28,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/angle_cosine_delta_omp.cpp b/src/OPENMP/angle_cosine_delta_omp.cpp index 98b6a7ac56..cc8370d053 100644 --- a/src/OPENMP/angle_cosine_delta_omp.cpp +++ b/src/OPENMP/angle_cosine_delta_omp.cpp @@ -28,7 +28,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/angle_cosine_omp.cpp b/src/OPENMP/angle_cosine_omp.cpp index 1985633c38..e4e32bd769 100644 --- a/src/OPENMP/angle_cosine_omp.cpp +++ b/src/OPENMP/angle_cosine_omp.cpp @@ -28,7 +28,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/angle_cosine_periodic_omp.cpp b/src/OPENMP/angle_cosine_periodic_omp.cpp index 48532c8f6c..4abe7bd692 100644 --- a/src/OPENMP/angle_cosine_periodic_omp.cpp +++ b/src/OPENMP/angle_cosine_periodic_omp.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; using namespace MathSpecial; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/angle_cosine_shift_exp_omp.cpp b/src/OPENMP/angle_cosine_shift_exp_omp.cpp index 5831f59fab..c131efd839 100644 --- a/src/OPENMP/angle_cosine_shift_exp_omp.cpp +++ b/src/OPENMP/angle_cosine_shift_exp_omp.cpp @@ -28,7 +28,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/angle_cosine_shift_omp.cpp b/src/OPENMP/angle_cosine_shift_omp.cpp index 020f7583ff..47fed634aa 100644 --- a/src/OPENMP/angle_cosine_shift_omp.cpp +++ b/src/OPENMP/angle_cosine_shift_omp.cpp @@ -28,7 +28,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/angle_cosine_squared_omp.cpp b/src/OPENMP/angle_cosine_squared_omp.cpp index 9d98455fe4..f14af0b3e4 100644 --- a/src/OPENMP/angle_cosine_squared_omp.cpp +++ b/src/OPENMP/angle_cosine_squared_omp.cpp @@ -28,7 +28,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/angle_dipole_omp.cpp b/src/OPENMP/angle_dipole_omp.cpp index 3a8099ac73..338c63e42e 100644 --- a/src/OPENMP/angle_dipole_omp.cpp +++ b/src/OPENMP/angle_dipole_omp.cpp @@ -29,7 +29,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/angle_fourier_omp.cpp b/src/OPENMP/angle_fourier_omp.cpp index 0c85264342..27d5f62595 100644 --- a/src/OPENMP/angle_fourier_omp.cpp +++ b/src/OPENMP/angle_fourier_omp.cpp @@ -28,7 +28,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/angle_fourier_simple_omp.cpp b/src/OPENMP/angle_fourier_simple_omp.cpp index a8f234918b..ad63fa0862 100644 --- a/src/OPENMP/angle_fourier_simple_omp.cpp +++ b/src/OPENMP/angle_fourier_simple_omp.cpp @@ -28,7 +28,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define SMALL 0.0001 +static constexpr double SMALL = 0.0001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/angle_harmonic_omp.cpp b/src/OPENMP/angle_harmonic_omp.cpp index e83146a3ad..5d779fbe21 100644 --- a/src/OPENMP/angle_harmonic_omp.cpp +++ b/src/OPENMP/angle_harmonic_omp.cpp @@ -28,7 +28,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/angle_quartic_omp.cpp b/src/OPENMP/angle_quartic_omp.cpp index bb9a9837d2..7c1d1b4a17 100644 --- a/src/OPENMP/angle_quartic_omp.cpp +++ b/src/OPENMP/angle_quartic_omp.cpp @@ -28,7 +28,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/angle_spica_omp.cpp b/src/OPENMP/angle_spica_omp.cpp index 728e2ff435..f1dd7d40b5 100644 --- a/src/OPENMP/angle_spica_omp.cpp +++ b/src/OPENMP/angle_spica_omp.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; using namespace LJSPICAParms; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/angle_table_omp.cpp b/src/OPENMP/angle_table_omp.cpp index d75bd8a694..11436723b1 100644 --- a/src/OPENMP/angle_table_omp.cpp +++ b/src/OPENMP/angle_table_omp.cpp @@ -29,7 +29,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/dihedral_charmm_omp.cpp b/src/OPENMP/dihedral_charmm_omp.cpp index e78a3e8919..42fbea419f 100644 --- a/src/OPENMP/dihedral_charmm_omp.cpp +++ b/src/OPENMP/dihedral_charmm_omp.cpp @@ -30,8 +30,8 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/dihedral_class2_omp.cpp b/src/OPENMP/dihedral_class2_omp.cpp index 8ec39ceee8..ffcdf4fa1a 100644 --- a/src/OPENMP/dihedral_class2_omp.cpp +++ b/src/OPENMP/dihedral_class2_omp.cpp @@ -29,8 +29,8 @@ #include "omp_compat.h" using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.0000001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.0000001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp b/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp index 106db995c4..4032f9a13d 100644 --- a/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp +++ b/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp @@ -29,8 +29,8 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/dihedral_fourier_omp.cpp b/src/OPENMP/dihedral_fourier_omp.cpp index aae1eec559..34a145a06d 100644 --- a/src/OPENMP/dihedral_fourier_omp.cpp +++ b/src/OPENMP/dihedral_fourier_omp.cpp @@ -29,7 +29,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define TOLERANCE 0.05 +static constexpr double TOLERANCE = 0.05; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/dihedral_harmonic_omp.cpp b/src/OPENMP/dihedral_harmonic_omp.cpp index 8737c61cdd..f8df7dd41e 100644 --- a/src/OPENMP/dihedral_harmonic_omp.cpp +++ b/src/OPENMP/dihedral_harmonic_omp.cpp @@ -29,8 +29,8 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/dihedral_helix_omp.cpp b/src/OPENMP/dihedral_helix_omp.cpp index d778285974..64ba0b9af5 100644 --- a/src/OPENMP/dihedral_helix_omp.cpp +++ b/src/OPENMP/dihedral_helix_omp.cpp @@ -31,9 +31,9 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define TOLERANCE 0.05 -#define SMALL 0.001 -#define SMALLER 0.00001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; +static constexpr double SMALLER = 0.00001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/dihedral_multi_harmonic_omp.cpp b/src/OPENMP/dihedral_multi_harmonic_omp.cpp index d3f4447d08..57c4b77565 100644 --- a/src/OPENMP/dihedral_multi_harmonic_omp.cpp +++ b/src/OPENMP/dihedral_multi_harmonic_omp.cpp @@ -29,8 +29,8 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/dihedral_nharmonic_omp.cpp b/src/OPENMP/dihedral_nharmonic_omp.cpp index f9a3f1328d..34e54f6c7c 100644 --- a/src/OPENMP/dihedral_nharmonic_omp.cpp +++ b/src/OPENMP/dihedral_nharmonic_omp.cpp @@ -29,8 +29,8 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/dihedral_opls_omp.cpp b/src/OPENMP/dihedral_opls_omp.cpp index fbdc408c4d..ccfd2ea42c 100644 --- a/src/OPENMP/dihedral_opls_omp.cpp +++ b/src/OPENMP/dihedral_opls_omp.cpp @@ -29,9 +29,9 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 -#define SMALLER 0.00001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; +static constexpr double SMALLER = 0.00001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/dihedral_quadratic_omp.cpp b/src/OPENMP/dihedral_quadratic_omp.cpp index 43d97da5f2..52b7c331fd 100644 --- a/src/OPENMP/dihedral_quadratic_omp.cpp +++ b/src/OPENMP/dihedral_quadratic_omp.cpp @@ -31,9 +31,9 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define TOLERANCE 0.05 -#define SMALL 0.001 -#define SMALLER 0.00001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; +static constexpr double SMALLER = 0.00001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/dihedral_table_omp.cpp b/src/OPENMP/dihedral_table_omp.cpp index 7405ae4a13..db90e32e6b 100644 --- a/src/OPENMP/dihedral_table_omp.cpp +++ b/src/OPENMP/dihedral_table_omp.cpp @@ -34,8 +34,8 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathExtra; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; // -------------------------------------------- // ------- Calculate the dihedral angle ------- diff --git a/src/OPENMP/ewald_omp.cpp b/src/OPENMP/ewald_omp.cpp index ee2963659a..fc32efd3c0 100644 --- a/src/OPENMP/ewald_omp.cpp +++ b/src/OPENMP/ewald_omp.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/fix_nh_sphere_omp.cpp b/src/OPENMP/fix_nh_sphere_omp.cpp index 93a674cbce..e5c1c24783 100644 --- a/src/OPENMP/fix_nh_sphere_omp.cpp +++ b/src/OPENMP/fix_nh_sphere_omp.cpp @@ -28,7 +28,7 @@ using namespace FixConst; enum{NOBIAS,BIAS}; -#define INERTIA 0.4 // moment of inertia prefactor for sphere +static constexpr double INERTIA = 0.4; // moment of inertia prefactor for sphere typedef struct { double x,y,z; } dbl3_t; diff --git a/src/OPENMP/fix_nve_sphere_omp.cpp b/src/OPENMP/fix_nve_sphere_omp.cpp index be3fc8d147..8c65a0df6a 100644 --- a/src/OPENMP/fix_nve_sphere_omp.cpp +++ b/src/OPENMP/fix_nve_sphere_omp.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathExtra; -#define INERTIA 0.4 // moment of inertia prefactor for sphere +static constexpr double INERTIA = 0.4; // moment of inertia prefactor for sphere enum{NONE,DIPOLE}; enum{NODLM,DLM}; diff --git a/src/OPENMP/improper_class2_omp.cpp b/src/OPENMP/improper_class2_omp.cpp index b7387ea75a..38a2f12f5e 100644 --- a/src/OPENMP/improper_class2_omp.cpp +++ b/src/OPENMP/improper_class2_omp.cpp @@ -29,8 +29,8 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/improper_cossq_omp.cpp b/src/OPENMP/improper_cossq_omp.cpp index 3bfc86bcab..4ccc0d730a 100644 --- a/src/OPENMP/improper_cossq_omp.cpp +++ b/src/OPENMP/improper_cossq_omp.cpp @@ -29,8 +29,8 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/improper_cvff_omp.cpp b/src/OPENMP/improper_cvff_omp.cpp index 310806d872..b7fe9ffb03 100644 --- a/src/OPENMP/improper_cvff_omp.cpp +++ b/src/OPENMP/improper_cvff_omp.cpp @@ -29,8 +29,8 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/improper_fourier_omp.cpp b/src/OPENMP/improper_fourier_omp.cpp index b70e3fb0ac..000bc02066 100644 --- a/src/OPENMP/improper_fourier_omp.cpp +++ b/src/OPENMP/improper_fourier_omp.cpp @@ -29,8 +29,8 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/improper_harmonic_omp.cpp b/src/OPENMP/improper_harmonic_omp.cpp index d17fe9407d..12c2699663 100644 --- a/src/OPENMP/improper_harmonic_omp.cpp +++ b/src/OPENMP/improper_harmonic_omp.cpp @@ -29,8 +29,8 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/improper_ring_omp.cpp b/src/OPENMP/improper_ring_omp.cpp index 899727c685..366d03e02d 100644 --- a/src/OPENMP/improper_ring_omp.cpp +++ b/src/OPENMP/improper_ring_omp.cpp @@ -31,8 +31,8 @@ using namespace LAMMPS_NS; using namespace MathSpecial; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/improper_umbrella_omp.cpp b/src/OPENMP/improper_umbrella_omp.cpp index e5d03863df..50c1ce4676 100644 --- a/src/OPENMP/improper_umbrella_omp.cpp +++ b/src/OPENMP/improper_umbrella_omp.cpp @@ -29,8 +29,8 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/msm_cg_omp.cpp b/src/OPENMP/msm_cg_omp.cpp index 6904830fed..551ab285a2 100644 --- a/src/OPENMP/msm_cg_omp.cpp +++ b/src/OPENMP/msm_cg_omp.cpp @@ -39,7 +39,7 @@ using namespace LAMMPS_NS; #define OFFSET 16384 -#define SMALLQ 0.00001 +static constexpr double SMALLQ = 0.00001; enum{REVERSE_RHO,REVERSE_AD,REVERSE_AD_PERATOM}; enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM}; diff --git a/src/OPENMP/pair_airebo_omp.cpp b/src/OPENMP/pair_airebo_omp.cpp index 0872678518..9f992aefda 100644 --- a/src/OPENMP/pair_airebo_omp.cpp +++ b/src/OPENMP/pair_airebo_omp.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; using namespace MathSpecial; -#define TOL 1.0e-9 +static constexpr double TOL = 1.0e-9; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/pair_dpd_ext_omp.cpp b/src/OPENMP/pair_dpd_ext_omp.cpp index f900512e26..9c53984b68 100644 --- a/src/OPENMP/pair_dpd_ext_omp.cpp +++ b/src/OPENMP/pair_dpd_ext_omp.cpp @@ -28,7 +28,7 @@ #include "omp_compat.h" using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/pair_dpd_ext_tstat_omp.cpp b/src/OPENMP/pair_dpd_ext_tstat_omp.cpp index b55a9d39c6..41234dbcc9 100644 --- a/src/OPENMP/pair_dpd_ext_tstat_omp.cpp +++ b/src/OPENMP/pair_dpd_ext_tstat_omp.cpp @@ -28,7 +28,7 @@ #include "omp_compat.h" using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/pair_dpd_omp.cpp b/src/OPENMP/pair_dpd_omp.cpp index f267bde1b0..c4226b5f9d 100644 --- a/src/OPENMP/pair_dpd_omp.cpp +++ b/src/OPENMP/pair_dpd_omp.cpp @@ -27,7 +27,7 @@ #include "suffix.h" using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/pair_dpd_tstat_omp.cpp b/src/OPENMP/pair_dpd_tstat_omp.cpp index 2396bf5756..86ecd86528 100644 --- a/src/OPENMP/pair_dpd_tstat_omp.cpp +++ b/src/OPENMP/pair_dpd_tstat_omp.cpp @@ -28,7 +28,7 @@ #include "omp_compat.h" using namespace LAMMPS_NS; -#define EPSILON 1.0e-10 +static constexpr double EPSILON = 1.0e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp b/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp index e7ba4d72c6..b0f6dcfb5b 100644 --- a/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp +++ b/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp b/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp index 99e2d2c5b1..0e43e2a037 100644 --- a/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp +++ b/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/pair_lj_cut_thole_long_omp.cpp b/src/OPENMP/pair_lj_cut_thole_long_omp.cpp index 1ad97a4416..8fdea2ce6d 100644 --- a/src/OPENMP/pair_lj_cut_thole_long_omp.cpp +++ b/src/OPENMP/pair_lj_cut_thole_long_omp.cpp @@ -43,7 +43,7 @@ using namespace MathConst; #define B4 -5.80844129e-3 #define B5 1.14652755e-1 -#define EPSILON 1.0e-20 +static constexpr double EPSILON = 1.0e-20; #define EPS_EWALD 1.0e-6 #define EPS_EWALD_SQR 1.0e-12 diff --git a/src/OPENMP/pair_soft_omp.cpp b/src/OPENMP/pair_soft_omp.cpp index 0be8c80dcf..309d11a6f9 100644 --- a/src/OPENMP/pair_soft_omp.cpp +++ b/src/OPENMP/pair_soft_omp.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 1.0e-4 +static constexpr double SMALL = 1.0e-4; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/pair_tersoff_zbl_omp.cpp b/src/OPENMP/pair_tersoff_zbl_omp.cpp index cefa89665a..524d7fe509 100644 --- a/src/OPENMP/pair_tersoff_zbl_omp.cpp +++ b/src/OPENMP/pair_tersoff_zbl_omp.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; -#define DELTA 4 +static constexpr int DELTA = 4; /* ---------------------------------------------------------------------- Fermi-like smoothing function diff --git a/src/OPENMP/pppm_cg_omp.cpp b/src/OPENMP/pppm_cg_omp.cpp index 4c751a16f7..e5b871c26e 100644 --- a/src/OPENMP/pppm_cg_omp.cpp +++ b/src/OPENMP/pppm_cg_omp.cpp @@ -39,11 +39,11 @@ using namespace MathConst; using namespace MathSpecial; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif #define EPS_HOC 1.0e-7 diff --git a/src/OPENMP/pppm_disp_omp.cpp b/src/OPENMP/pppm_disp_omp.cpp index 24bf2d9564..aa9fa93f14 100644 --- a/src/OPENMP/pppm_disp_omp.cpp +++ b/src/OPENMP/pppm_disp_omp.cpp @@ -39,11 +39,11 @@ using namespace LAMMPS_NS; using namespace MathConst; #ifdef FFT_SINGLE -#define ZEROF 0.0f -#define ONEF 1.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; +static constexpr FFT_SCALAR ONEF = 1.0f; #else -#define ZEROF 0.0 -#define ONEF 1.0 +static constexpr FFT_SCALAR ZEROF = 0.0; +static constexpr FFT_SCALAR ONEF = 1.0; #endif #define OFFSET 16384 diff --git a/src/OPENMP/pppm_disp_tip4p_omp.cpp b/src/OPENMP/pppm_disp_tip4p_omp.cpp index ab6342a047..5220ea9d4b 100644 --- a/src/OPENMP/pppm_disp_tip4p_omp.cpp +++ b/src/OPENMP/pppm_disp_tip4p_omp.cpp @@ -38,9 +38,9 @@ using namespace LAMMPS_NS; using namespace MathConst; #ifdef FFT_SINGLE -#define ZEROF 0.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; #else -#define ZEROF 0.0 +static constexpr FFT_SCALAR ZEROF = 0.0; #endif #define OFFSET 16384 diff --git a/src/OPENMP/pppm_omp.cpp b/src/OPENMP/pppm_omp.cpp index 86e65da101..348032d20d 100644 --- a/src/OPENMP/pppm_omp.cpp +++ b/src/OPENMP/pppm_omp.cpp @@ -39,9 +39,9 @@ using namespace MathConst; using namespace MathSpecial; #ifdef FFT_SINGLE -#define ZEROF 0.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; #else -#define ZEROF 0.0 +static constexpr FFT_SCALAR ZEROF = 0.0; #endif #define EPS_HOC 1.0e-7 diff --git a/src/OPENMP/pppm_tip4p_omp.cpp b/src/OPENMP/pppm_tip4p_omp.cpp index 66ce44b5ef..cd2a98e896 100644 --- a/src/OPENMP/pppm_tip4p_omp.cpp +++ b/src/OPENMP/pppm_tip4p_omp.cpp @@ -40,9 +40,9 @@ using namespace MathConst; using namespace MathSpecial; #ifdef FFT_SINGLE -#define ZEROF 0.0f +static constexpr FFT_SCALAR ZEROF = 0.0f; #else -#define ZEROF 0.0 +static constexpr FFT_SCALAR ZEROF = 0.0; #endif #define EPS_HOC 1.0e-7 diff --git a/src/ORIENT/fix_orient_bcc.cpp b/src/ORIENT/fix_orient_bcc.cpp index 2d801b0bdc..25fec2e606 100644 --- a/src/ORIENT/fix_orient_bcc.cpp +++ b/src/ORIENT/fix_orient_bcc.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; -#define BIG 1000000000 +static constexpr int BIG = 1000000000; static const char cite_fix_orient_bcc[] = "fix orient/bcc command: doi:10.1016/j.commatsci.2016.02.016\n\n" diff --git a/src/ORIENT/fix_orient_fcc.cpp b/src/ORIENT/fix_orient_fcc.cpp index cdb3fd689d..78a8485278 100644 --- a/src/ORIENT/fix_orient_fcc.cpp +++ b/src/ORIENT/fix_orient_fcc.cpp @@ -35,7 +35,7 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; -#define BIG 1000000000 +static constexpr int BIG = 1000000000; static const char cite_fix_orient_fcc[] = "fix orient/fcc command: doi:10.1038/nmat1559\n\n" diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index 55199a7191..6ae21f652c 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -42,9 +42,9 @@ using namespace LAMMPS_NS; using namespace FixConst; #define MAXBODY 2 // currently 2 since only linear chains allowed -#define DELTA 128 -#define TOLERANCE 1.0e-6 -#define EPSILON 1.0e-7 +static constexpr int DELTA = 128; +static constexpr double TOLERANCE = 1.0e-6; +static constexpr double EPSILON = 1.0e-7; static const char cite_fix_poems[] = "fix poems command: doi:10.1016/j.ijnonlinmec.2008.04.003\n\n" diff --git a/src/PTM/ptm_convex_hull_incremental.cpp b/src/PTM/ptm_convex_hull_incremental.cpp index 25ff54c787..d4a8047e3d 100644 --- a/src/PTM/ptm_convex_hull_incremental.cpp +++ b/src/PTM/ptm_convex_hull_incremental.cpp @@ -20,7 +20,7 @@ namespace ptm { #define VISIBLE 1 #define INVISIBLE 2 #define BOTH 3 -#define TOLERANCE 1E-8 +static constexpr double TOLERANCE = 1E-8; static double norm_squared(double *p) { diff --git a/src/REPLICA/fix_hyper_local.cpp b/src/REPLICA/fix_hyper_local.cpp index d0cfc4bb01..08249eb64b 100644 --- a/src/REPLICA/fix_hyper_local.cpp +++ b/src/REPLICA/fix_hyper_local.cpp @@ -39,7 +39,7 @@ using namespace FixConst; #define DELTABIAS 16 #define COEFFINIT 1.0 #define FCCBONDS 12 -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; enum{STRAIN,STRAINDOMAIN,BIASFLAG,BIASCOEFF}; enum{IGNORE,WARN,ERROR}; diff --git a/src/RIGID/compute_rigid_local.cpp b/src/RIGID/compute_rigid_local.cpp index bd0db29d20..ea45389e7b 100644 --- a/src/RIGID/compute_rigid_local.cpp +++ b/src/RIGID/compute_rigid_local.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; enum{ID,MOL,MASS,X,Y,Z,XU,YU,ZU,VX,VY,VZ,FX,FY,FZ,IX,IY,IZ, TQX,TQY,TQZ,OMEGAX,OMEGAY,OMEGAZ,ANGMOMX,ANGMOMY,ANGMOMZ, diff --git a/src/SMTBQ/pair_smtbq.cpp b/src/SMTBQ/pair_smtbq.cpp index 4f924a6fca..134419a4dc 100644 --- a/src/SMTBQ/pair_smtbq.cpp +++ b/src/SMTBQ/pair_smtbq.cpp @@ -70,10 +70,10 @@ using namespace MathConst; using namespace MathExtra; using namespace MathSpecial; -#define MAXLINE 2048 +static constexpr int MAXLINE = 2048; #define MAXTOKENS 2048 -#define DELTA 4 -#define PGDELTA 1 +static constexpr int DELTA = 4; +static constexpr int PGDELTA = 1; #define MAXNEIGH 24 static constexpr char SMTBQ_SEPARATORS[] = "' \t\n\r"; diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index e96321a7a3..8d629dc96c 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -52,12 +52,12 @@ enum { BIG_MOVE, SRD_MOVE, SRD_ROTATE }; enum { CUBIC_ERROR, CUBIC_WARN }; enum { SHIFT_NO, SHIFT_YES, SHIFT_POSSIBLE }; -#define EINERTIA 0.2 // moment of inertia prefactor for ellipsoid +static constexpr double EINERTIA = 0.2; // moment of inertia prefactor for ellipsoid #define ATOMPERBIN 30 -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; #define VBINSIZE 5 -#define TOLERANCE 0.00001 +static constexpr double TOLERANCE = 0.00001; #define MAXITER 20 static const char cite_fix_srd[] = diff --git a/src/UEF/dump_cfg_uef.cpp b/src/UEF/dump_cfg_uef.cpp index d72225b238..7ac7a4d12b 100644 --- a/src/UEF/dump_cfg_uef.cpp +++ b/src/UEF/dump_cfg_uef.cpp @@ -27,8 +27,8 @@ using namespace LAMMPS_NS; #define UNWRAPEXPAND 10.0 -#define ONEFIELD 32 -#define DELTA 1048576 +static constexpr int ONEFIELD = 32; +static constexpr int DELTA = 1048576; /* ---------------------------------------------------------------------- * base method is mostly fine, just need to find the FixNHUef diff --git a/src/VTK/dump_vtk.cpp b/src/VTK/dump_vtk.cpp index f16c8a9bb1..12fc4ad1ea 100644 --- a/src/VTK/dump_vtk.cpp +++ b/src/VTK/dump_vtk.cpp @@ -93,8 +93,8 @@ enum{X,Y,Z, // required for vtk, must come first enum{LT,LE,GT,GE,EQ,NEQ,XOR}; enum{VTK,VTP,VTU,PVTP,PVTU}; // file formats -#define ONEFIELD 32 -#define DELTA 1048576 +static constexpr int ONEFIELD = 32; +static constexpr int DELTA = 1048576; #if (VTK_MAJOR_VERSION < 5) || (VTK_MAJOR_VERSION > 9) #error This code has only been tested with VTK 5, 6, 7, 8, and 9 diff --git a/src/YAFF/angle_cross.cpp b/src/YAFF/angle_cross.cpp index 46833b7f74..d3e127e935 100644 --- a/src/YAFF/angle_cross.cpp +++ b/src/YAFF/angle_cross.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/YAFF/angle_mm3.cpp b/src/YAFF/angle_mm3.cpp index af199f6fe9..3ff7df1653 100644 --- a/src/YAFF/angle_mm3.cpp +++ b/src/YAFF/angle_mm3.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/YAFF/improper_distharm.cpp b/src/YAFF/improper_distharm.cpp index 27516fa416..53658a1377 100644 --- a/src/YAFF/improper_distharm.cpp +++ b/src/YAFF/improper_distharm.cpp @@ -31,8 +31,8 @@ using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/YAFF/improper_sqdistharm.cpp b/src/YAFF/improper_sqdistharm.cpp index 1cd8515d9a..e85f8e4c25 100644 --- a/src/YAFF/improper_sqdistharm.cpp +++ b/src/YAFF/improper_sqdistharm.cpp @@ -31,8 +31,8 @@ using namespace LAMMPS_NS; -#define TOLERANCE 0.05 -#define SMALL 0.001 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/atom.cpp b/src/atom.cpp index c08df16614..75d3a645ad 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -48,9 +48,9 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define DELTA 1 -#define EPSILON 1.0e-6 -#define MAXLINE 256 +static constexpr int DELTA = 1; +static constexpr double EPSILON = 1.0e-6; +static constexpr int MAXLINE = 256; /* ---------------------------------------------------------------------- one instance per AtomVec style in style_atom.h diff --git a/src/comm.cpp b/src/comm.cpp index a6ac1c4bc8..1293dd3d6d 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -42,7 +42,7 @@ using namespace LAMMPS_NS; -#define BUFEXTRA 1024 +static constexpr int BUFEXTRA = 1024; enum{ONELEVEL,TWOLEVEL,NUMA,CUSTOM}; enum{CART,CARTREORDER,XYZ}; diff --git a/src/comm_brick.cpp b/src/comm_brick.cpp index 08d372187e..cf38271029 100644 --- a/src/comm_brick.cpp +++ b/src/comm_brick.cpp @@ -35,9 +35,9 @@ using namespace LAMMPS_NS; -#define BUFFACTOR 1.5 -#define BUFMIN 1024 -#define BIG 1.0e20 +static constexpr double BUFFACTOR = 1.5; +static constexpr int BUFMIN = 1024; +static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index f2d91c07fa..6c44af686f 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -36,10 +36,9 @@ using namespace LAMMPS_NS; -#define BUFFACTOR 1.5 -#define BUFFACTOR 1.5 -#define BUFMIN 1024 -#define EPSILON 1.0e-6 +static constexpr double BUFFACTOR = 1.5; +static constexpr int BUFMIN = 1024; +static constexpr double EPSILON = 1.0e-6; #define DELTA_PROCS 16 diff --git a/src/compute.cpp b/src/compute.cpp index d47d1d5292..d6ac382151 100644 --- a/src/compute.cpp +++ b/src/compute.cpp @@ -26,8 +26,8 @@ using namespace LAMMPS_NS; -#define DELTA 4 -#define BIG MAXTAGINT +static constexpr int DELTA = 4; +static constexpr double BIG = MAXTAGINT; // allocate space for static class instance variable and initialize it diff --git a/src/compute_angle_local.cpp b/src/compute_angle_local.cpp index 3600562664..3e8b15fd64 100644 --- a/src/compute_angle_local.cpp +++ b/src/compute_angle_local.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define DELTA 10000 +static constexpr int DELTA = 10000; enum{THETA,ENG,VARIABLE}; diff --git a/src/compute_bond_local.cpp b/src/compute_bond_local.cpp index f2603e8cdd..143539d435 100644 --- a/src/compute_bond_local.cpp +++ b/src/compute_bond_local.cpp @@ -31,8 +31,8 @@ using namespace LAMMPS_NS; -#define DELTA 10000 -#define EPSILON 1.0e-12 +static constexpr int DELTA = 10000; +static constexpr double EPSILON = 1.0e-12; enum{DIST,DX,DY,DZ,VELVIB,OMEGA,ENGTRANS,ENGVIB,ENGROT,ENGPOT,FORCE,FX,FY,FZ,VARIABLE,BN}; diff --git a/src/compute_dihedral_local.cpp b/src/compute_dihedral_local.cpp index a6bcbccf00..6543c06d20 100644 --- a/src/compute_dihedral_local.cpp +++ b/src/compute_dihedral_local.cpp @@ -30,8 +30,8 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define DELTA 10000 -#define SMALL 0.001 +static constexpr int DELTA = 10000; +static constexpr double SMALL = 0.001; enum{PHI,VARIABLE}; diff --git a/src/compute_erotate_sphere.cpp b/src/compute_erotate_sphere.cpp index b020fc4e0e..d2f907fc55 100644 --- a/src/compute_erotate_sphere.cpp +++ b/src/compute_erotate_sphere.cpp @@ -20,7 +20,7 @@ using namespace LAMMPS_NS; -#define INERTIA 0.4 // moment of inertia prefactor for sphere +static constexpr double INERTIA = 0.4; // moment of inertia prefactor for sphere /* ---------------------------------------------------------------------- */ diff --git a/src/compute_erotate_sphere_atom.cpp b/src/compute_erotate_sphere_atom.cpp index 3ec0f402a8..41819143b4 100644 --- a/src/compute_erotate_sphere_atom.cpp +++ b/src/compute_erotate_sphere_atom.cpp @@ -23,7 +23,7 @@ using namespace LAMMPS_NS; -#define INERTIA 0.4 // moment of inertia prefactor for sphere +static constexpr double INERTIA = 0.4; // moment of inertia prefactor for sphere /* ---------------------------------------------------------------------- */ diff --git a/src/compute_group_group.cpp b/src/compute_group_group.cpp index 31bbc81597..afc825ac3c 100644 --- a/src/compute_group_group.cpp +++ b/src/compute_group_group.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; enum { OFF, INTER, INTRA }; diff --git a/src/compute_improper_local.cpp b/src/compute_improper_local.cpp index 48070a4f7c..a58f4f4d0d 100644 --- a/src/compute_improper_local.cpp +++ b/src/compute_improper_local.cpp @@ -28,9 +28,9 @@ using namespace LAMMPS_NS; using namespace MathConst; -#define DELTA 10000 +static constexpr int DELTA = 10000; -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */ diff --git a/src/compute_omega_chunk.cpp b/src/compute_omega_chunk.cpp index 3c345ab7a4..1a8852b144 100644 --- a/src/compute_omega_chunk.cpp +++ b/src/compute_omega_chunk.cpp @@ -23,7 +23,7 @@ using namespace LAMMPS_NS; -#define EPSILON 1.0e-6 +static constexpr double EPSILON = 1.0e-6; /* ---------------------------------------------------------------------- */ diff --git a/src/compute_pair_local.cpp b/src/compute_pair_local.cpp index 5dad405bc3..88991f7481 100644 --- a/src/compute_pair_local.cpp +++ b/src/compute_pair_local.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; enum { DIST, ENG, FORCE, FX, FY, FZ, PN, DX, DY, DZ }; enum { TYPE, RADIUS }; diff --git a/src/compute_property_grid.cpp b/src/compute_property_grid.cpp index 17f9689bf6..6e316de3f8 100644 --- a/src/compute_property_grid.cpp +++ b/src/compute_property_grid.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; enum { LOW, CTR }; enum { UNSCALED, SCALED }; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/compute_property_local.cpp b/src/compute_property_local.cpp index 87517a3e05..64f3859117 100644 --- a/src/compute_property_local.cpp +++ b/src/compute_property_local.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; enum { NONE, NEIGH, PAIR, BOND, ANGLE, DIHEDRAL, IMPROPER }; enum { TYPE, RADIUS }; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/compute_reduce.cpp b/src/compute_reduce.cpp index b296804248..ee94c2d9a7 100644 --- a/src/compute_reduce.cpp +++ b/src/compute_reduce.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; //---------------------------------------------------------------- diff --git a/src/compute_reduce_chunk.cpp b/src/compute_reduce_chunk.cpp index 51781eac7b..9ba0e30a8d 100644 --- a/src/compute_reduce_chunk.cpp +++ b/src/compute_reduce_chunk.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; enum { SUM, MINN, MAXX }; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ diff --git a/src/domain.cpp b/src/domain.cpp index 3627af26cf..4445ee83ca 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -42,8 +42,8 @@ using namespace LAMMPS_NS; -#define BIG 1.0e20 -#define SMALL 1.0e-4 +static constexpr double BIG = 1.0e20; +static constexpr double SMALL = 1.0e-4; #define DELTAREGION 4 #define BONDSTRETCH 1.1 diff --git a/src/dump.cpp b/src/dump.cpp index 03326bb65e..c735a4a60d 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -216,21 +216,21 @@ void Dump::init() index = proclist = nullptr; irregular = nullptr; if ((has_id == 0) && (me == 0)) - error->warning(FLERR,"Dump {} includes no atom IDs and is not sorted by ID. This may complicate " - "post-processing tasks or visualization", id); + error->warning(FLERR,"Dump {} includes no atom IDs and is not sorted by ID. " + "This may complicate post-processing tasks or visualization", id); } if (sort_flag) { if (multiproc > 1) error->all(FLERR, - "Cannot sort dump when 'nfile' or 'fileper' keywords are set to non-default values"); + "Cannot sort dump when 'nfile' or 'fileper' keywords have non-default values"); if (sortcol == 0 && atom->tag_enable == 0) error->all(FLERR,"Cannot sort dump on atom IDs with no atom IDs defined"); if (sortcol && sortcol > size_one) - error->all(FLERR,"Dump sort column is invalid"); + error->all(FLERR,"Dump sort column index {} is invalid", sortcol); if ((sortcol != 0) && (has_id == 0) && (me == 0)) - error->warning(FLERR,"Dump {} includes no atom IDs and is not sorted by ID. This may complicate " - "post-processing tasks or visualization", id); + error->warning(FLERR,"Dump {} includes no atom IDs and is not sorted by ID. " + "This may complicate post-processing tasks or visualization", id); if (nprocs > 1 && irregular == nullptr) irregular = new Irregular(lmp); diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index 2d047dc0a0..cda200156f 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; #define ONELINE 256 -#define DELTA 1048576 +static constexpr int DELTA = 1048576; /* ---------------------------------------------------------------------- */ diff --git a/src/dump_cfg.cpp b/src/dump_cfg.cpp index a64507dc16..a541c1e5a2 100644 --- a/src/dump_cfg.cpp +++ b/src/dump_cfg.cpp @@ -30,8 +30,8 @@ using namespace LAMMPS_NS; #define UNWRAPEXPAND 10.0 -#define ONEFIELD 32 -#define DELTA 1048576 +static constexpr int ONEFIELD = 32; +static constexpr int DELTA = 1048576; /* ---------------------------------------------------------------------- */ diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index c4f505d9f0..ed70c7413d 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -47,8 +47,8 @@ enum{ID,MOL,PROC,PROCP1,TYPE,ELEMENT,MASS, COMPUTE,FIX,VARIABLE,IVEC,DVEC,IARRAY,DARRAY}; enum{LT,LE,GT,GE,EQ,NEQ,XOR}; -#define ONEFIELD 32 -#define DELTA 1048576 +static constexpr int ONEFIELD = 32; +static constexpr int DELTA = 1048576; /* ---------------------------------------------------------------------- */ diff --git a/src/dump_grid.cpp b/src/dump_grid.cpp index 8e3a2977cf..4c89b05739 100644 --- a/src/dump_grid.cpp +++ b/src/dump_grid.cpp @@ -35,8 +35,8 @@ using namespace LAMMPS_NS; enum {COMPUTE,FIX}; -#define ONEFIELD 32 -#define DELTA 1048576 +static constexpr int ONEFIELD = 32; +static constexpr int DELTA = 1048576; /* ---------------------------------------------------------------------- */ diff --git a/src/dump_image.cpp b/src/dump_image.cpp index ba7e36eb0b..ed4fc8dff4 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -49,7 +49,7 @@ using namespace LAMMPS_NS; using MathConst::DEG2RAD; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; enum{NUMERIC,ATOM,TYPE,ELEMENT,ATTRIBUTE}; enum{SPHERE,LINE,TRI}; // also in some Body and Fix child classes diff --git a/src/dump_local.cpp b/src/dump_local.cpp index 9695e152b2..8d546634b6 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -27,8 +27,8 @@ using namespace LAMMPS_NS; -#define ONEFIELD 32 -#define DELTA 1048576 +static constexpr int ONEFIELD = 32; +static constexpr int DELTA = 1048576; /* ---------------------------------------------------------------------- */ diff --git a/src/dump_xyz.cpp b/src/dump_xyz.cpp index 241ec1c059..2d12de62a8 100644 --- a/src/dump_xyz.cpp +++ b/src/dump_xyz.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; #define ONELINE 128 -#define DELTA 1048576 +static constexpr int DELTA = 1048576; /* ---------------------------------------------------------------------- */ diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index 4503ad56f4..a92efcdacd 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -35,7 +35,7 @@ enum { SCALAR, VECTOR, WINDOW }; enum { DEFAULT, GLOBAL, PERATOM, LOCAL }; enum { IGNORE, END, EXTRA }; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : diff --git a/src/fix_ave_histo_weight.cpp b/src/fix_ave_histo_weight.cpp index 181aa2a79d..7a5458bd3d 100644 --- a/src/fix_ave_histo_weight.cpp +++ b/src/fix_ave_histo_weight.cpp @@ -38,7 +38,7 @@ enum { DEFAULT, GLOBAL, PERATOM, LOCAL }; enum { IGNORE, END, EXTRA }; enum { SINGLE, VALUE }; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ diff --git a/src/fix_bond_history.cpp b/src/fix_bond_history.cpp index cae9dc744d..2d344e24fc 100644 --- a/src/fix_bond_history.cpp +++ b/src/fix_bond_history.cpp @@ -27,8 +27,8 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define LB_FACTOR 1.5 -#define DELTA 8192 +static constexpr double LB_FACTOR = 1.5; +static constexpr int DELTA = 8192; /* ---------------------------------------------------------------------- */ diff --git a/src/fix_deposit.cpp b/src/fix_deposit.cpp index 4a9c5aa9da..d8ea665149 100644 --- a/src/fix_deposit.cpp +++ b/src/fix_deposit.cpp @@ -42,7 +42,7 @@ using namespace MathConst; enum{ATOM,MOLECULE}; enum{DIST_UNIFORM,DIST_GAUSSIAN}; -#define EPSILON 1.0e6 +static constexpr double EPSILON = 1.0e6; /* ---------------------------------------------------------------------- */ diff --git a/src/fix_dt_reset.cpp b/src/fix_dt_reset.cpp index ba69d17718..ea364657c6 100644 --- a/src/fix_dt_reset.cpp +++ b/src/fix_dt_reset.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ diff --git a/src/fix_move.cpp b/src/fix_move.cpp index 53009495b1..80e10c4d3d 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -42,7 +42,7 @@ using namespace MathConst; enum { LINEAR, WIGGLE, ROTATE, VARIABLE, TRANSROT }; enum { EQUAL, ATOM }; -#define INERTIA 0.2 // moment of inertia prefactor for ellipsoid +static constexpr double INERTIA = 0.2; // moment of inertia prefactor for ellipsoid /* ---------------------------------------------------------------------- */ diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 562ca51c29..51f9904f63 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -42,7 +42,7 @@ using namespace FixConst; #define DELTAFLIP 0.1 #define TILTMAX 1.5 -#define EPSILON 1.0e-6 +static constexpr double EPSILON = 1.0e-6; enum{NOBIAS,BIAS}; enum{NONE,XYZ,XY,YZ,XZ}; diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp index f252134aa9..cc95fc93f3 100644 --- a/src/fix_restrain.cpp +++ b/src/fix_restrain.cpp @@ -38,9 +38,9 @@ using MathConst::DEG2RAD; enum{BOND,LBOUND,ANGLE,DIHEDRAL}; -#define TOLERANCE 0.05 -#define SMALL 0.001 -#define DELTA 1 +static constexpr double TOLERANCE = 0.05; +static constexpr double SMALL = 0.001; +static constexpr int DELTA = 1; /* ---------------------------------------------------------------------- */ diff --git a/src/fix_spring.cpp b/src/fix_spring.cpp index 3a14ec8de1..93c1f7867d 100644 --- a/src/fix_spring.cpp +++ b/src/fix_spring.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define SMALL 1.0e-10 +static constexpr double SMALL = 1.0e-10; enum{TETHER,COUPLE}; diff --git a/src/fix_spring_chunk.cpp b/src/fix_spring_chunk.cpp index 3deedcffac..f42572b190 100644 --- a/src/fix_spring_chunk.cpp +++ b/src/fix_spring_chunk.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define SMALL 1.0e-10 +static constexpr double SMALL = 1.0e-10; /* ---------------------------------------------------------------------- */ diff --git a/src/fix_store_local.cpp b/src/fix_store_local.cpp index d32f0e8178..8deac03d79 100644 --- a/src/fix_store_local.cpp +++ b/src/fix_store_local.cpp @@ -21,7 +21,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define DELTA 1024 +static constexpr int DELTA = 1024; /* ---------------------------------------------------------------------- */ diff --git a/src/fix_thermal_conductivity.cpp b/src/fix_thermal_conductivity.cpp index b8d051df9b..dd674a0506 100644 --- a/src/fix_thermal_conductivity.cpp +++ b/src/fix_thermal_conductivity.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define BIG 1.0e10 +static constexpr double BIG = 1.0e10; /* ---------------------------------------------------------------------- */ diff --git a/src/grid2d.cpp b/src/grid2d.cpp index d39b7b4a78..ea6e8e4123 100644 --- a/src/grid2d.cpp +++ b/src/grid2d.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; -#define DELTA 16 +static constexpr int DELTA = 16; static constexpr int OFFSET = 16384; diff --git a/src/grid3d.cpp b/src/grid3d.cpp index 6ca8f7895c..4ce1978660 100644 --- a/src/grid3d.cpp +++ b/src/grid3d.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; -#define DELTA 16 +static constexpr int DELTA = 16; static constexpr int OFFSET = 16384; diff --git a/src/group.cpp b/src/group.cpp index f841f9d95a..a586c33ed9 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -46,7 +46,7 @@ static constexpr double EPSILON = 1.0e-6; enum{NONE,TYPE,MOLECULE,ID}; enum{LT,LE,GT,GE,EQ,NEQ,BETWEEN}; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- initialize group memory diff --git a/src/image.cpp b/src/image.cpp index 3133723b32..a06147dab6 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -46,7 +46,7 @@ using MathConst::MY_PI4; #define NCOLORS 140 #define NELEMENTS 109 -#define EPSILON 1.0e-6 +static constexpr double EPSILON = 1.0e-6; enum{NUMERIC,MINVALUE,MAXVALUE}; enum{CONTINUOUS,DISCRETE,SEQUENTIAL}; diff --git a/src/imbalance_neigh.cpp b/src/imbalance_neigh.cpp index 40b7f6b249..8d4a17976b 100644 --- a/src/imbalance_neigh.cpp +++ b/src/imbalance_neigh.cpp @@ -21,7 +21,7 @@ using namespace LAMMPS_NS; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* -------------------------------------------------------------------- */ diff --git a/src/imbalance_time.cpp b/src/imbalance_time.cpp index 4e16ae3e1f..cf2153011b 100644 --- a/src/imbalance_time.cpp +++ b/src/imbalance_time.cpp @@ -19,7 +19,7 @@ using namespace LAMMPS_NS; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* -------------------------------------------------------------------- */ diff --git a/src/input.cpp b/src/input.cpp index 4d5ef8bee1..d196fd5c3c 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -55,7 +55,7 @@ using namespace LAMMPS_NS; #define DELTALINE 256 -#define DELTA 4 +static constexpr int DELTA = 4; // maximum nesting level of input files static constexpr int LMP_MAXFILE = 16; diff --git a/src/irregular.cpp b/src/irregular.cpp index b571c35445..0c1ecc21a9 100644 --- a/src/irregular.cpp +++ b/src/irregular.cpp @@ -36,9 +36,9 @@ static int compare_standalone(const void *, const void *); static int compare_standalone(const int, const int, void *); #endif -#define BUFFACTOR 1.5 -#define BUFMIN 1024 -#define BUFEXTRA 1024 +static constexpr double BUFFACTOR = 1.5; +static constexpr int BUFMIN = 1024; +static constexpr int BUFEXTRA = 1024; /* ---------------------------------------------------------------------- */ diff --git a/src/kspace.cpp b/src/kspace.cpp index 583df478e7..7d51c46ea8 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; -#define SMALL 0.00001 +static constexpr double SMALL = 0.00001; /* ---------------------------------------------------------------------- */ diff --git a/src/lattice.cpp b/src/lattice.cpp index edb482cfac..fa50a9ea94 100644 --- a/src/lattice.cpp +++ b/src/lattice.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; -#define BIG 1.0e30 +static constexpr double BIG = 1.0e30; /* ---------------------------------------------------------------------- */ diff --git a/src/modify.cpp b/src/modify.cpp index 427c4e259b..ba04c5969a 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -33,8 +33,8 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define DELTA 4 -#define BIG 1.0e20 +static constexpr int DELTA = 4; +static constexpr double BIG = 1.0e20; // template for factory function: // there will be one instance for each style keyword in the respective style_xxx.h files diff --git a/src/nbin_multi.cpp b/src/nbin_multi.cpp index 0a0f1557de..15c089bee7 100644 --- a/src/nbin_multi.cpp +++ b/src/nbin_multi.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; -#define SMALL 1.0e-6 +static constexpr double SMALL = 1.0e-6; #define CUT2BIN_RATIO 100 /* ---------------------------------------------------------------------- */ diff --git a/src/nbin_standard.cpp b/src/nbin_standard.cpp index 68cc860dbe..08ff537d71 100644 --- a/src/nbin_standard.cpp +++ b/src/nbin_standard.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; -#define SMALL 1.0e-6 +static constexpr double SMALL = 1.0e-6; #define CUT2BIN_RATIO 100 /* ---------------------------------------------------------------------- */ diff --git a/src/neigh_list.cpp b/src/neigh_list.cpp index 2d91eebdef..4bdd58eead 100644 --- a/src/neigh_list.cpp +++ b/src/neigh_list.cpp @@ -23,7 +23,7 @@ using namespace LAMMPS_NS; -#define PGDELTA 1 +static constexpr int PGDELTA = 1; /* ---------------------------------------------------------------------- */ diff --git a/src/neighbor.cpp b/src/neighbor.cpp index ad99ffd972..43d3120690 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -61,7 +61,7 @@ using namespace NeighConst; #define EXDELTA 1 #define DELTA_PERATOM 64 -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; enum{NONE,ALL,PARTIAL,TEMPLATE}; diff --git a/src/ntopo.cpp b/src/ntopo.cpp index 752a8f95a6..a6c7a199e2 100644 --- a/src/ntopo.cpp +++ b/src/ntopo.cpp @@ -22,8 +22,8 @@ using namespace LAMMPS_NS; -#define LB_FACTOR 1.5 -#define DELTA 10000 +static constexpr double LB_FACTOR = 1.5; +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/ntopo_angle_all.cpp b/src/ntopo_angle_all.cpp index f6ed1cc277..593750c7b7 100644 --- a/src/ntopo_angle_all.cpp +++ b/src/ntopo_angle_all.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/ntopo_angle_partial.cpp b/src/ntopo_angle_partial.cpp index 4ab56465b7..277621f0bd 100644 --- a/src/ntopo_angle_partial.cpp +++ b/src/ntopo_angle_partial.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/ntopo_angle_template.cpp b/src/ntopo_angle_template.cpp index 51f4b0f726..982ef90a9d 100644 --- a/src/ntopo_angle_template.cpp +++ b/src/ntopo_angle_template.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/ntopo_bond_all.cpp b/src/ntopo_bond_all.cpp index 8e2fd1adfd..7e051744e2 100644 --- a/src/ntopo_bond_all.cpp +++ b/src/ntopo_bond_all.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/ntopo_bond_partial.cpp b/src/ntopo_bond_partial.cpp index e2d4944b9c..4df72f9ab8 100644 --- a/src/ntopo_bond_partial.cpp +++ b/src/ntopo_bond_partial.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/ntopo_bond_template.cpp b/src/ntopo_bond_template.cpp index 865fddc12d..c8f4bc51d8 100644 --- a/src/ntopo_bond_template.cpp +++ b/src/ntopo_bond_template.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/ntopo_dihedral_all.cpp b/src/ntopo_dihedral_all.cpp index 216952d9c6..9f62cda07d 100644 --- a/src/ntopo_dihedral_all.cpp +++ b/src/ntopo_dihedral_all.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/ntopo_dihedral_partial.cpp b/src/ntopo_dihedral_partial.cpp index 3e7a4526d5..98246b7b4f 100644 --- a/src/ntopo_dihedral_partial.cpp +++ b/src/ntopo_dihedral_partial.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/ntopo_dihedral_template.cpp b/src/ntopo_dihedral_template.cpp index e2ffe7be4c..2cc41f4a8f 100644 --- a/src/ntopo_dihedral_template.cpp +++ b/src/ntopo_dihedral_template.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/ntopo_improper_all.cpp b/src/ntopo_improper_all.cpp index ee08ddb834..2786fdbfa8 100644 --- a/src/ntopo_improper_all.cpp +++ b/src/ntopo_improper_all.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/ntopo_improper_partial.cpp b/src/ntopo_improper_partial.cpp index 039da2c915..559a7b3d7d 100644 --- a/src/ntopo_improper_partial.cpp +++ b/src/ntopo_improper_partial.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/ntopo_improper_template.cpp b/src/ntopo_improper_template.cpp index 401fb986d9..79712f4ed1 100644 --- a/src/ntopo_improper_template.cpp +++ b/src/ntopo_improper_template.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; -#define DELTA 10000 +static constexpr int DELTA = 10000; /* ---------------------------------------------------------------------- */ diff --git a/src/output.cpp b/src/output.cpp index cff2e68107..1f6ba295eb 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; -#define DELTA 1 +static constexpr int DELTA = 1; #define EPSDT 1.0e-6 enum {SETUP, WRITE, RESET_DT}; diff --git a/src/rcb.cpp b/src/rcb.cpp index a42be9b02a..8f18a5335c 100644 --- a/src/rcb.cpp +++ b/src/rcb.cpp @@ -22,8 +22,8 @@ using namespace LAMMPS_NS; #define MYHUGE 1.0e30 -#define TINY 1.0e-6 -#define DELTA 16384 +static constexpr double TINY = 1.0e-6; +static constexpr int DELTA = 16384; // prototypes for non-class functions diff --git a/src/reader_native.cpp b/src/reader_native.cpp index 92409389ef..ae59ca6805 100644 --- a/src/reader_native.cpp +++ b/src/reader_native.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 // max line length in dump file +static constexpr int MAXLINE = 1024; // max line length in dump file /* ---------------------------------------------------------------------- */ diff --git a/src/reader_xyz.cpp b/src/reader_xyz.cpp index c3e7d0ed99..22b6df0cb9 100644 --- a/src/reader_xyz.cpp +++ b/src/reader_xyz.cpp @@ -23,7 +23,7 @@ using namespace LAMMPS_NS; -#define MAXLINE 1024 // max line length in dump file +static constexpr int MAXLINE = 1024; // max line length in dump file /* ---------------------------------------------------------------------- */ diff --git a/src/replicate.cpp b/src/replicate.cpp index e0fd5b0e3d..b27304a2a0 100644 --- a/src/replicate.cpp +++ b/src/replicate.cpp @@ -28,8 +28,8 @@ using namespace LAMMPS_NS; -#define LB_FACTOR 1.1 -#define EPSILON 1.0e-6 +static constexpr double LB_FACTOR = 1.1; +static constexpr double EPSILON = 1.0e-6; /* ---------------------------------------------------------------------- */ diff --git a/src/reset_atoms_id.cpp b/src/reset_atoms_id.cpp index a6382e6aee..196bb84a32 100644 --- a/src/reset_atoms_id.cpp +++ b/src/reset_atoms_id.cpp @@ -39,7 +39,7 @@ static int compare_coords(const int, const int, void *); #endif #define PERBIN 10 -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ diff --git a/src/thermo.cpp b/src/thermo.cpp index 1c4e25dcb0..3d8b419991 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -93,7 +93,7 @@ static constexpr char id_press[] = "thermo_press"; static constexpr char id_pe[] = "thermo_pe"; static char fmtbuf[512]; -#define DELTA 8 +static constexpr int DELTA = 8; /* ---------------------------------------------------------------------- */ diff --git a/src/variable.cpp b/src/variable.cpp index fe6eba39d9..f4ab1c1dae 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -50,7 +50,7 @@ using namespace MathConst; #define VARDELTA 4 #define MAXLEVEL 4 -#define MAXLINE 256 +static constexpr int MAXLINE = 256; #define CHUNK 1024 #define MAXFUNCARG 6 diff --git a/src/velocity.cpp b/src/velocity.cpp index 421c494553..32774c0c30 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -39,7 +39,7 @@ enum{UNIFORM,GAUSSIAN}; enum{NONE,CONSTANT,EQUAL,ATOM}; #define WARMUP 100 -#define SMALL 0.001 +static constexpr double SMALL = 0.001; /* ---------------------------------------------------------------------- */