From 3a2a9e6a9d5a16a71da548328a2ff7dabe4edbef Mon Sep 17 00:00:00 2001 From: fspanier Date: Fri, 28 Sep 2018 22:12:59 +0200 Subject: [PATCH] Added physconst to the katrin git --- src/physconst/makefile | 1 + src/physconst/makefile2 | 27 +++++++++++++ src/physconst/physconst.H | 76 +++++++++++++++++++++++++++++++++++++ src/physconst/physconst.cpp | 49 ++++++++++++++++++++++++ 4 files changed, 153 insertions(+) create mode 100644 src/physconst/makefile create mode 100644 src/physconst/makefile2 create mode 100644 src/physconst/physconst.H create mode 100644 src/physconst/physconst.cpp diff --git a/src/physconst/makefile b/src/physconst/makefile new file mode 100644 index 0000000..6e4d103 --- /dev/null +++ b/src/physconst/makefile @@ -0,0 +1 @@ +include $(HOMEBASE)/src/makeinclude/first.mak diff --git a/src/physconst/makefile2 b/src/physconst/makefile2 new file mode 100644 index 0000000..666cb8d --- /dev/null +++ b/src/physconst/makefile2 @@ -0,0 +1,27 @@ +include $(HOMEBASE)/src/makeinclude/include.mak + +OFLAGS = $(X_OFLAGS) -DPWD="\"$(PWD)"\" $(X_OPENMP) +LOADLIBES = -llogquant -lphysconst +CXXFLAGS = $(OFLAGS) $(X_INC) + +all: libphysconst.a + +physconst.o: physconst.H physconst.cpp + +libphysconst.a: physconst.o + + +install: install_headers install_lib + +install_lib: libphysconst.a + mkdir -p $(X_LIB_DIR) + $(INSTALL) -m $(MOD_DATA) $^ $(X_LIB_DIR) + +install_headers: physconst.H + mkdir -p $(X_INC_DIR) + $(INSTALL) -m $(MOD_DATA) $^ $(X_INC_DIR) + +clean: + -rm $(X_LIB_DIR)/libphysconst.a + -rm libphysconst.a physconst.o + diff --git a/src/physconst/physconst.H b/src/physconst/physconst.H new file mode 100644 index 0000000..71d3e43 --- /dev/null +++ b/src/physconst/physconst.H @@ -0,0 +1,76 @@ +#ifndef PHYS_H +#define PHYS_H + +#include + +// The default is (Gaussian) CGS units +class PhysicalConstants { + public: + PhysicalConstants(){}; + + static const double me; // Electron mass (g) + static const double mp; // Proton mass (g) + static const double mm; // Myon mass (g) + static const double mpi0; // Mass of uncharged pion (g) + static const double e; // Elementary charge (statcoulomb) + static const double c; // Speed of light (cm/s) + static const double eps0; // Permitivity of vacuum + static const double mu0; // Permeability of vacuum + static const double thomcs; // Thomson cross section (cm^2) + static const double h; // Planck constant (erg sec) + static const double hbar; // reduced Planck constant (erg sec) + static const double k; // Boltzmann constant (erg / K) + static const double r0; // Classical electron radius / Thomson scattering length (cm) + static const double G; // Gravitational constant cm^3/(g sec^2) + static const double taumu; // mittlere Myon Lebensaduer +}; + +// Constants in SI +class PhysicalConstantsSI { + public: + PhysicalConstantsSI(){}; + + static const double me; // Electron mass (kg) + static const double mp; // Proton mass (kg) + static const double mm; // Myon mass (kg) + static const double mpi0; // Mass of uncharged pion (kg) + static const double e; // Elementary charge (C) + static const double c; // Speed of light (m/s) + static const double eps0; // Permitivity of vacuum (F / m) + static const double mu0; // Permeability of vacuum (H / m) + static const double thomcs; // Thomson cross section (m^2) + static const double h; // Planck constant (J s) + static const double hbar; // reduced Planck constant (J s) + static const double k; // Boltzmann constant (J / K) + static const double r0; // Classical electron radius / Thomson scattering length (m) + static const double G; // Gravitational constant m^3/(kg s^2) + static const double taumu; // mittlere Myon Lebensaduer +}; + +// Natural Units with e = c = k = me = 1 (Stoney units) +class PhysicalConstantsnorm { + public: + PhysicalConstantsnorm(){}; + + static const double me; // Electron mass + static const double mp; // Proton mass + static const double mm; // Myon mass + static const double mpi0; // Mass of uncharged pion + static const double e; // Elementary charge + static const double c; // Speed of light + static const double eps0; // Permitivity of vacuum + static const double mu0; // Permeability of vacuum + static const double thomcs; // Thomson cross section + static const double h; // Planck constant + static const double hbar; // reduced Planck constant + static const double k; // Boltzmann constant + static const double r0; // Classical electron radius + static const double G; // Gravitational constant + static const double taumu; // mittlere Myon Lebensaduer + + // l = e^2 / c^2 me + // t = e^2 / c^3 me + // T = = me c^2 / k +}; + +#endif diff --git a/src/physconst/physconst.cpp b/src/physconst/physconst.cpp new file mode 100644 index 0000000..c4d6fdc --- /dev/null +++ b/src/physconst/physconst.cpp @@ -0,0 +1,49 @@ +#include "physconst.H" + +const double PhysicalConstants::me = 9.1094e-28; // g +const double PhysicalConstants::mp = 1.6726231e-24; // g +const double PhysicalConstants::mm = 1.88353148e-25; // g +const double PhysicalConstants::mpi0 = 2.406175207e-25; // g +const double PhysicalConstants::e = 4.8032068e-10;// statC / electro static unit +const double PhysicalConstants::c = 29979245800.;// cm/s +const double PhysicalConstants::eps0 = 1; +const double PhysicalConstants::mu0 = 1; +const double PhysicalConstants::thomcs = 6.65245e-25; // cm^2 +const double PhysicalConstants::h = 6.6260755e-27; // erg s +const double PhysicalConstants::hbar = 1.054572669e-27; // erg s +const double PhysicalConstants::k = 1.380658e-16; // erg/Kelvin +const double PhysicalConstants::r0 = 2.8179e-13; // cm +const double PhysicalConstants::G = 6.67428e-8; // Gravitationskonstante cm^3/(g sec^2) +const double PhysicalConstants::taumu = 2.1969811e-6; // mittlere Myon Lebensaduer s + +const double PhysicalConstantsSI::me = 9.1094e-31; // kg +const double PhysicalConstantsSI::mp = 1.6726e-27; // kg +const double PhysicalConstantsSI::mm = 1.88353148e-28; // kg +const double PhysicalConstantsSI::mpi0 = 2.406176e-28; // kg +const double PhysicalConstantsSI::e = 1.6022e-19; // C +const double PhysicalConstantsSI::c = 299792458.;// m/s +const double PhysicalConstantsSI::eps0 = 8.854187817620e-12; // F/m; +const double PhysicalConstantsSI::mu0 = 1.2566370614e-6; // H / m +const double PhysicalConstantsSI::thomcs = 6.65245e-29; // m^2 +const double PhysicalConstantsSI::h = 6.6260755e-34; // J s +const double PhysicalConstantsSI::hbar = 1.054572669e-34; // J s +const double PhysicalConstantsSI::k = 1.380658e-23; // J / K +const double PhysicalConstantsSI::r0 = 2.8179e-15; // m +const double PhysicalConstantsSI::G = 6.67428e-11; // m^3/(kg s^2) +const double PhysicalConstantsSI::taumu = 2.1969811e-6; // mittlere Myon Lebensaduer s + +const double PhysicalConstantsnorm::me = 1; +const double PhysicalConstantsnorm::mp = 1836.15; +const double PhysicalConstantsnorm::mm = 206.88; +const double PhysicalConstantsnorm::mpi0 = 264.14; +const double PhysicalConstantsnorm::e = 1; +const double PhysicalConstantsnorm::c = 1; +const double PhysicalConstantsnorm::eps0 = .07957747154594766788; +const double PhysicalConstantsnorm::mu0 = 12.56637061435917295376; +const double PhysicalConstantsnorm::thomcs = 3.488e43; +const double PhysicalConstantsnorm::h = 861.022579738; +const double PhysicalConstantsnorm::hbar = 137.035999679; +const double PhysicalConstantsnorm::k = 1; +const double PhysicalConstantsnorm::r0 = 2.0405e21; +const double PhysicalConstantsnorm::G = 1; +const double PhysicalConstantsnorm::taumu = 9.73630645E59; // mittlere Myon Lebensaduer \ No newline at end of file