Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-07 08:34:56

0001 //------------------------------ -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file celeritas/Constants.hh
0006 //! \brief Mathematical, numerical, and physical constants
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Config.hh"
0011 
0012 #include "corecel/Constants.hh"
0013 #include "corecel/Types.hh"
0014 
0015 #include "Units.hh"
0016 
0017 namespace celeritas
0018 {
0019 //---------------------------------------------------------------------------//
0020 /*!
0021  * Mathematical, numerical, and physical constants.
0022  *
0023  * Some of the physical
0024  * constants listed here are *exact* numerical values: see \citet{si-2019,
0025  * https://www.bipm.org/en/publications/si-brochure} for definition of
0026  * constants and how they relate to the different units.
0027  *
0028  * Celeritas            | CLHEP                   | Notes
0029  * -------------------- | ---------------------   | ------------
0030  * a0_bohr              | Bohr_radius             | Bohr radius
0031  * alpha_fine_structure | fine_structure_const    | |
0032  * atomic_mass          | amu                     | Not the same as 1/avogadro
0033  * eps_electric         | epsilon0                | Vacuum permittivity
0034  * h_planck             | h_Planck                | |
0035  * k_boltzmann          | k_Boltzmann             | |
0036  * mu_magnetic          | mu0                     | Vacuum permeability
0037  * na_avogadro          | Avogadro                | [1/mol]
0038  * r_electron           | classic_electr_radius   | Classical electron radius
0039  * kcd_luminous         | [none]                  | Lumens per Watt
0040  * lambdabar_electron   | electron_Compton_length | Reduced Compton wavelength
0041  * stable_decay_constant| [none]                  | Decay for a stable particle
0042  *
0043  * In the CLHEP unit system, the value of the constant \c e_electron is defined
0044  * to be 1 and \c coulomb is derivative from that. To avoid floating point
0045  * arithmetic issues that would lead to the "units" and "constants" having
0046  * different values for it, a special case redefines the value for CLHEP.
0047  *
0048  * Some experimental physical constants are derived from the other physical
0049  * constants, but for consistency and clarity they are presented numerically
0050  * with the units provided in the CODATA 2018 dataset. The \c Constants.test.cc
0051  * unit tests compare the numerical value against the derivative values inside
0052  * the celeritas unit system. All experimental values include the final
0053  * (usually two) imprecise digits; their precision is usually on the order of
0054  * \f$ 10^{-11} \f$.
0055  */
0056 namespace constants
0057 {
0058 //---------------------------------------------------------------------------//
0059 
0060 #define CELER_ICRT inline constexpr Constant
0061 
0062 //!@{
0063 //! \name Physical constants with exact value as defined by SI
0064 CELER_ICRT c_light = Constant{299792458.} * units::meter / units::second;
0065 CELER_ICRT h_planck = Constant{6.62607015e-34} * units::joule * units::second;
0066 #if CELERITAS_UNITS != CELERITAS_UNITS_CLHEP
0067 CELER_ICRT e_electron = Constant{1.602176634e-19} * units::coulomb;
0068 #endif
0069 CELER_ICRT k_boltzmann = Constant{1.380649e-23} * units::joule / units::kelvin;
0070 CELER_ICRT na_avogadro{6.02214076e23};
0071 CELER_ICRT kcd_luminous{683};
0072 //!@}
0073 
0074 #if CELERITAS_UNITS == CELERITAS_UNITS_CLHEP
0075 //! Special case for CLHEP: electron charged is unity by definition
0076 CELER_ICRT e_electron{1};
0077 #endif
0078 
0079 //!@{
0080 //! \name Exact derivative constants
0081 CELER_ICRT hbar_planck{h_planck / (2 * pi)};
0082 //!@}
0083 
0084 //!@{
0085 //! \name Experimental physical constants from CODATA 2018
0086 CELER_ICRT a0_bohr = Constant{5.29177210903e-11} * units::meter;
0087 CELER_ICRT alpha_fine_structure = Constant{7.2973525693e-3};
0088 CELER_ICRT atomic_mass = Constant{1.66053906660e-24} * units::gram;
0089 CELER_ICRT electron_mass = Constant{9.1093837015e-28} * units::gram;
0090 CELER_ICRT proton_mass = Constant{1.67262192369e-24} * units::gram;
0091 CELER_ICRT eps_electric = Constant{8.8541878128e-12} * units::farad
0092                           / units::meter;
0093 CELER_ICRT mu_magnetic = Constant{1.25663706212e-6} * units::newton
0094                          / (units::ampere * units::ampere);
0095 CELER_ICRT r_electron = Constant{2.8179403262e-15} * units::meter;
0096 CELER_ICRT rinf_rydberg = Constant{10973731.568160} / units::meter;
0097 CELER_ICRT eh_hartree = Constant{4.3597447222071e-18} / units::meter;
0098 CELER_ICRT lambdabar_electron = Constant{3.8615926796e-13} * units::meter;
0099 //!@}
0100 
0101 //!@{
0102 //! \name Other constants
0103 inline constexpr int stable_decay_constant{0};
0104 //!@}
0105 
0106 #undef CELER_ICRT
0107 
0108 //---------------------------------------------------------------------------//
0109 }  // namespace constants
0110 }  // namespace celeritas