bacon_sci/
constants.rs

1/* This file is part of bacon.
2 * Copyright (c) Wyatt Campbell.
3 *
4 * See repository LICENSE for information.
5 */
6
7#![allow(non_upper_case_globals)]
8// Important values of note taken from SciPy
9// Values taken from CODATA
10// https://physics.nist.gov/cuu/Constants/index.html
11
12/// Speed of light in a vacuum, m/s
13pub const c: f64 = 299_792_458.0;
14
15/// Permittivity of free space, ε₀, F/
16pub const permittivity: f64 = 8.854_187_812_8e-12;
17pub const permittivity_uncertainty: f64 = 0.000_000_001_3e-12;
18
19/// Permeability of free space, μ₀, N/A^2
20pub const permeability: f64 = 1.256_637_062_12e-6;
21pub const permeability_uncertainty: f64 = 0.000_000_000_19e-6;
22
23/// Plank constant, h, J
24pub const h: f64 = 6.626_070_15e-34;
25
26/// Reduced plank constant, ħ, J s
27pub const h_bar: f64 = 1.054_571_817e-34;
28
29/// Newtonian gravitational constant, G, m^3 / kg s^2
30pub const G: f64 = 6.674_30e-11;
31pub const G_uncertainty: f64 = 0.000_15e-11;
32
33/// Gravitational acceleration on Earth's surface, m / s^2
34pub const g: f64 = 9.806_65;
35
36/// Elementary charge, e, C
37pub const e_charge: f64 = 1.602_176_634e-19;
38
39/// Molar gas constant, R, J / mol K
40pub const R: f64 = 8.314_462_618;
41
42/// Fine structure constant, α, unitless
43pub const fine_structure: f64 = 7.297_352_569_3e-3;
44pub const fine_structure_uncertainty: f64 = 0.000_000_001_1e-3;
45
46/// Avogadro constant, N_A, 1/ mol
47pub const avogadro: f64 = 6.022_140_76e23;
48
49/// Boltzmann constant, k, J/K
50pub const boltzmann: f64 = 1.380_649e-23;
51
52/// Stefan-Boltzmann constant, σ, W / m^2 K^4
53pub const stefan_boltzmann: f64 = 5.670_374_419e-8;
54
55/// Wien displacement law constant, b, wavelength, m K
56pub const wien: f64 = 2.897_771_955e-3;
57
58/// Wien displacement law constant, b', frequency, Hz /K
59pub const wien_frequency: f64 = 5.878_925_757e10;
60
61/// Rydberg constant, R_inf, 1/m
62pub const rydberg: f64 = 10_973_731.568_16;
63pub const rydberg_uncertainty: f64 = 0.000_021;
64
65/// Mass of an electron, kg
66pub const electron_mass: f64 = 9.109_383_701_5e-31;
67pub const electron_mass_uncertainty: f64 = 0.000_000_002_8e-31;
68
69/// Mass of an proton kg
70pub const proton_mass: f64 = 1.672_621_923_69e-27;
71pub const proton_mass_uncertainty: f64 = 0.000_000_000_51e-27;
72
73/// Mass of an neutron kg
74pub const neutron_mass: f64 = 1.674_927_498_04e-27;
75pub const neutron_mass_uncertainty: f64 = 0.000_000_000_95e-27;
76
77/// NIST CODATA. Maps a string of a value name to a triplet
78/// containing an f64 of its value, an f64 of its uncertainty,
79/// and a string of its units
80#[allow(clippy::inconsistent_digit_grouping)]
81pub static CODATA: phf::Map<&'static str, (f64, f64, &'static str)> =
82    include!(concat!(env!("OUT_DIR"), "/codata.rs"));