From 3e2b004d216e9b6dfceab78afa889657a4f3f754 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 17 Dec 2020 16:01:26 -0500 Subject: [PATCH] more use of constexpr --- src/MANYBODY/pair_comb.h | 2 +- src/MANYBODY/pair_comb3.h | 2 +- src/MANYBODY/pair_gw.h | 2 +- src/MANYBODY/pair_gw_zbl.h | 2 +- src/MANYBODY/pair_nb3b_harmonic.h | 2 +- src/MANYBODY/pair_sw.h | 2 +- src/MANYBODY/pair_tersoff.h | 2 +- src/MANYBODY/pair_tersoff_mod.h | 2 +- src/MANYBODY/pair_tersoff_mod_c.h | 2 +- src/MANYBODY/pair_tersoff_zbl.h | 2 +- src/MANYBODY/pair_vashishta.h | 2 +- src/RIGID/rigid_const.h | 20 ++++++++++---------- src/USER-MISC/pair_tersoff_table.h | 2 +- src/pair_coul_streitz.h | 2 +- src/text_file_reader.h | 2 +- 15 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/MANYBODY/pair_comb.h b/src/MANYBODY/pair_comb.h index 7a3d279033..f809dfaf0e 100644 --- a/src/MANYBODY/pair_comb.h +++ b/src/MANYBODY/pair_comb.h @@ -38,7 +38,7 @@ class PairComb : public Pair { virtual double yasu_char(double *, int &); double enegtot; - static const int NPARAMS_PER_LINE = 49; + static constexpr int NPARAMS_PER_LINE = 49; protected: struct Param { diff --git a/src/MANYBODY/pair_comb3.h b/src/MANYBODY/pair_comb3.h index 567859127b..b1c216fee6 100644 --- a/src/MANYBODY/pair_comb3.h +++ b/src/MANYBODY/pair_comb3.h @@ -37,7 +37,7 @@ class PairComb3 : public Pair { virtual double combqeq(double *, int &); double enegtot; - static const int NPARAMS_PER_LINE = 74; + static constexpr int NPARAMS_PER_LINE = 74; protected: // general potential parameters diff --git a/src/MANYBODY/pair_gw.h b/src/MANYBODY/pair_gw.h index 77ff5c0399..2dbf3dcf84 100644 --- a/src/MANYBODY/pair_gw.h +++ b/src/MANYBODY/pair_gw.h @@ -34,7 +34,7 @@ class PairGW : public Pair { void init_style(); double init_one(int, int); - static const int NPARAMS_PER_LINE = 17; + static constexpr int NPARAMS_PER_LINE = 17; protected: struct Param { diff --git a/src/MANYBODY/pair_gw_zbl.h b/src/MANYBODY/pair_gw_zbl.h index 95129c4eb8..de344e94f7 100644 --- a/src/MANYBODY/pair_gw_zbl.h +++ b/src/MANYBODY/pair_gw_zbl.h @@ -29,7 +29,7 @@ class PairGWZBL : public PairGW { PairGWZBL(class LAMMPS *); ~PairGWZBL() {} - static const int NPARAMS_PER_LINE = 21; + static constexpr int NPARAMS_PER_LINE = 21; private: double global_a_0; // Bohr radius for Coulomb repulsion diff --git a/src/MANYBODY/pair_nb3b_harmonic.h b/src/MANYBODY/pair_nb3b_harmonic.h index 0267b6d0e2..b68974e15f 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.h +++ b/src/MANYBODY/pair_nb3b_harmonic.h @@ -34,7 +34,7 @@ class PairNb3bHarmonic : public Pair { double init_one(int, int); void init_style(); - static const int NPARAMS_PER_LINE = 6; + static constexpr int NPARAMS_PER_LINE = 6; protected: struct Param { diff --git a/src/MANYBODY/pair_sw.h b/src/MANYBODY/pair_sw.h index 441b1c0303..4fdc538430 100644 --- a/src/MANYBODY/pair_sw.h +++ b/src/MANYBODY/pair_sw.h @@ -34,7 +34,7 @@ class PairSW : public Pair { virtual double init_one(int, int); virtual void init_style(); - static const int NPARAMS_PER_LINE = 14; + static constexpr int NPARAMS_PER_LINE = 14; struct Param { double epsilon,sigma; diff --git a/src/MANYBODY/pair_tersoff.h b/src/MANYBODY/pair_tersoff.h index 8ebbc83544..eb29cc227d 100644 --- a/src/MANYBODY/pair_tersoff.h +++ b/src/MANYBODY/pair_tersoff.h @@ -34,7 +34,7 @@ class PairTersoff : public Pair { virtual void init_style(); double init_one(int, int); - static const int NPARAMS_PER_LINE = 17; + static constexpr int NPARAMS_PER_LINE = 17; protected: diff --git a/src/MANYBODY/pair_tersoff_mod.h b/src/MANYBODY/pair_tersoff_mod.h index 2cdbae9518..4f1d7a12a6 100644 --- a/src/MANYBODY/pair_tersoff_mod.h +++ b/src/MANYBODY/pair_tersoff_mod.h @@ -30,7 +30,7 @@ class PairTersoffMOD : public PairTersoff { PairTersoffMOD(class LAMMPS *); ~PairTersoffMOD() {} - static const int NPARAMS_PER_LINE = 20; + static constexpr int NPARAMS_PER_LINE = 20; protected: virtual void read_file(char *); diff --git a/src/MANYBODY/pair_tersoff_mod_c.h b/src/MANYBODY/pair_tersoff_mod_c.h index bad5f988be..4949cb76db 100644 --- a/src/MANYBODY/pair_tersoff_mod_c.h +++ b/src/MANYBODY/pair_tersoff_mod_c.h @@ -29,7 +29,7 @@ class PairTersoffMODC : public PairTersoffMOD { PairTersoffMODC(class LAMMPS *lmp) : PairTersoffMOD(lmp) {}; ~PairTersoffMODC() {} - static const int NPARAMS_PER_LINE = 21; + static constexpr int NPARAMS_PER_LINE = 21; protected: void read_file(char *); diff --git a/src/MANYBODY/pair_tersoff_zbl.h b/src/MANYBODY/pair_tersoff_zbl.h index be3f496b62..42483b7d89 100644 --- a/src/MANYBODY/pair_tersoff_zbl.h +++ b/src/MANYBODY/pair_tersoff_zbl.h @@ -29,7 +29,7 @@ class PairTersoffZBL : public PairTersoff { PairTersoffZBL(class LAMMPS *); ~PairTersoffZBL() {} - static const int NPARAMS_PER_LINE = 21; + static constexpr int NPARAMS_PER_LINE = 21; protected: double global_a_0; // Bohr radius for Coulomb repulsion diff --git a/src/MANYBODY/pair_vashishta.h b/src/MANYBODY/pair_vashishta.h index bd250d328a..19a8e01cd9 100644 --- a/src/MANYBODY/pair_vashishta.h +++ b/src/MANYBODY/pair_vashishta.h @@ -34,7 +34,7 @@ class PairVashishta : public Pair { double init_one(int, int); void init_style(); - static const int NPARAMS_PER_LINE = 17; + static constexpr int NPARAMS_PER_LINE = 17; struct Param { double bigb,gamma,r0,bigc,costheta; diff --git a/src/RIGID/rigid_const.h b/src/RIGID/rigid_const.h index 3aae988197..b345a6b9dc 100644 --- a/src/RIGID/rigid_const.h +++ b/src/RIGID/rigid_const.h @@ -33,21 +33,21 @@ namespace LAMMPS_NS { TORQUE = 1<<8 }; - static const double TOLERANCE = 1.0e-6; - static const double EPSILON = 1.0e-7; - static const double BIG = 1.0e20; + static constexpr double TOLERANCE = 1.0e-6; + static constexpr double EPSILON = 1.0e-7; + static constexpr double BIG = 1.0e20; // moment of inertia prefactor for sphere - static const double SINERTIA = 0.4; + static constexpr double SINERTIA = 0.4; // moment of inertia prefactor for ellipsoid - static const double EINERTIA = 0.2; + static constexpr double EINERTIA = 0.2; // moment of inertia prefactor for line segment - static const double LINERTIA = 1.0/12.0; + static constexpr double LINERTIA = 1.0/12.0; - static const int MAXLINE = 1024; - static const int CHUNK = 1024; - static const int DELTA_BODY = 10000; - static const int ATTRIBUTE_PERBODY = 20; + static constexpr int MAXLINE = 1024; + static constexpr int CHUNK = 1024; + static constexpr int DELTA_BODY = 10000; + static constexpr int ATTRIBUTE_PERBODY = 20; } } diff --git a/src/USER-MISC/pair_tersoff_table.h b/src/USER-MISC/pair_tersoff_table.h index faa704191c..d63a5be5a6 100644 --- a/src/USER-MISC/pair_tersoff_table.h +++ b/src/USER-MISC/pair_tersoff_table.h @@ -43,7 +43,7 @@ class PairTersoffTable : public Pair { void init_style(); double init_one(int, int); - static const int NPARAMS_PER_LINE = 17; + static constexpr int NPARAMS_PER_LINE = 17; protected: struct Param { diff --git a/src/pair_coul_streitz.h b/src/pair_coul_streitz.h index d5a4a2de5c..2f62846212 100644 --- a/src/pair_coul_streitz.h +++ b/src/pair_coul_streitz.h @@ -36,7 +36,7 @@ class PairCoulStreitz : public Pair { double memory_usage(); virtual void *extract(const char *, int &); - static const int NPARAMS_PER_LINE = 6; + static constexpr int NPARAMS_PER_LINE = 6; protected: struct Param { diff --git a/src/text_file_reader.h b/src/text_file_reader.h index 0b90304911..0da21e4581 100644 --- a/src/text_file_reader.h +++ b/src/text_file_reader.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS class TextFileReader { std::string filename; std::string filetype; - static const int MAXLINE = 1024; + static constexpr int MAXLINE = 1024; char line[MAXLINE]; FILE *fp;