CoreNEURON
units.hpp
Go to the documentation of this file.
1 /*
2 # =============================================================================
3 # Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
4 #
5 # See top-level LICENSE file for details.
6 # =============================================================================
7 */
8 #pragma once
9 namespace coreneuron {
10 namespace units {
11 #if CORENEURON_USE_LEGACY_UNITS == 1
12 constexpr double faraday{96485.309};
13 constexpr double gasconstant{8.3134};
14 #else
15 /* NMODL translated MOD files get unit constants typically from
16  * share/lib/nrnunits.lib.in. But there were other source files that hardcode
17  * some of the constants. Here we gather a few modern units into a single place
18  * (but, unfortunately, also in nrnunits.lib.in). Legacy units cannot be
19  * gathered here because they can differ slightly from place to place.
20  *
21  * These come from https://physics.nist.gov/cuu/Constants/index.html.
22  * Termed the "2018 CODATA recommended values", they became available
23  * on 20 May 2019 and replace the 2014 CODATA set.
24  *
25  * See oc/hoc_init.c, nrnoc/eion.c, nrniv/kschan.h
26  */
27 namespace detail {
28 constexpr double electron_charge{1.602176634e-19}; // coulomb exact
29 constexpr double avogadro_number{6.02214076e+23}; // exact
30 constexpr double boltzmann{1.380649e-23}; // joule/K exact
31 } // namespace detail
32 constexpr double faraday{detail::electron_charge * detail::avogadro_number}; // 96485.33212...
33  // coulomb/mol
34 constexpr double gasconstant{detail::boltzmann * detail::avogadro_number}; // 8.314462618...
35  // joule/mol-K
36 #endif
37 } // namespace units
38 } // namespace coreneuron
coreneuron::units::faraday
constexpr double faraday
Definition: units.hpp:32
coreneuron::units::detail::boltzmann
constexpr double boltzmann
Definition: units.hpp:30
coreneuron::units::gasconstant
constexpr double gasconstant
Definition: units.hpp:34
coreneuron
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
Definition: corenrn_parameters.cpp:12
coreneuron::units::detail::electron_charge
constexpr double electron_charge
Definition: units.hpp:28
coreneuron::units::detail::avogadro_number
constexpr double avogadro_number
Definition: units.hpp:29