Move M_PI definition to math/units.h
[alexxy/gromacs.git] / api / legacy / include / gromacs / math / units.h
index cb9686108a2eca89ddd6cd96b3535ea5bd3ef78a..c0cde6fb11fb0c35f3f51bcc8851756696fd27cc 100644 (file)
  * be anywhere else in the code.
  */
 
+#ifndef M_PI
+#    define M_PI 3.14159265358979323846
+#endif
+
+#ifndef M_PI_2
+#    define M_PI_2 1.57079632679489661923
+#endif
+
+#ifndef M_2PI
+#    define M_2PI 6.28318530717958647692
+#endif
+
+#ifndef M_SQRT2
+#    define M_SQRT2 sqrt(2.0)
+#endif
+
+#ifndef M_1_PI
+#    define M_1_PI 0.31830988618379067154
+#endif
+
+#ifndef M_FLOAT_1_SQRTPI /* used in GPU kernels */
+/* 1.0 / sqrt(M_PI) */
+#    define M_FLOAT_1_SQRTPI 0.564189583547756f
+#endif
+
+#ifndef M_1_SQRTPI
+/* 1.0 / sqrt(M_PI) */
+#    define M_1_SQRTPI 0.564189583547756
+#endif
+
+#ifndef M_2_SQRTPI
+/* 2.0 / sqrt(M_PI) */
+#    define M_2_SQRTPI 1.128379167095513
+#endif
+
 namespace gmx
 {
 
@@ -99,6 +134,8 @@ constexpr double c_hartree2Kj     = ((2.0 * c_rydberg * c_planck * c_speedOfLigh
 constexpr double c_bohr2Nm        = 0.0529177210903; /* nm^-1, NIST 2018 CODATA */
 constexpr double c_hartreeBohr2Md = (c_hartree2Kj * c_avogadro / c_bohr2Nm);
 
+constexpr double c_rad2Deg = 180.0 / M_PI;
+constexpr double c_deg2Rad = M_PI / 180.0;
 } // namespace gmx
 
 /* The four basic units */