AtomicAndPhysicalConstants.jl

Stable Dev Build Status

AtomicAndPhysicalConstants.jl provides fundamental physical constants and particle data drawn from official CODATA releases (2002 – 2022). Values are expressed in units natural to accelerator and atomic physics (eV, eV/c², eV·s, eV/T, …).

Installation

using Pkg
Pkg.add("AtomicAndPhysicalConstants")

Quick start

using AtomicAndPhysicalConstants

# ── physical constants ──────────────────────────────────────────────
C_LIGHT    # 2.99792458e8  m/s
H_PLANCK   # 4.135667696e-15  eV·s
M_ELECTRON # 510998.95069  eV/c²

# ── particle species ────────────────────────────────────────────────
e    = Species("electron")
p    = Species("proton")
h    = Species("H")          # neutral hydrogen, abundance-averaged mass
he3  = Species("#3He")       # neutral helium-3
hion = Species("H+")         # singly-ionised hydrogen
antip = Species("anti-proton")

# ── accessor functions ───────────────────────────────────────────────
massof(e)                    # 510998.95069  eV/c²
massof(h, AMU=true)          # mass in atomic mass units
chargeof(hion)               # 1.0  (units of e)
spinof(e)                    # 0.5  ħ
g_spin(e)                    # 2.00231930436092  (unsigned; signed=true for -2.0023…)
gyromagnetic_anomaly(e)      # ≈ 0.00115965…  = (|g| - 2)/2
momentof(p)                  # magnetic dipole moment  eV/T
iso_of(he3)                  # 3  (mass number)

Species fields are read only through these accessors — e.mass raises an error on purpose. See Accessing species parameters for the complete list, the unit-switching keyword arguments, and what each accessor returns for species that do not carry the property.

Package overview

TopicDescription
SpeciesConstructing and querying particle species
ConstantsExported physical constants
CODATA ReleasesSwitching between CODATA release years
API ReferenceComplete docstring index
InternalsData sources, storage format, and maintainer scripts