CODATA Releases

The CODATA task group on fundamental constants publishes updated recommended values every four years. AtomicAndPhysicalConstants.jl ships constants from every release since 2002 and lets you choose which one to use at runtime.

Supported releases

ReleaseNotes
2002earliest supported; six quantities are NaN (see Quantities missing from a release)
2006two quantities are NaN (see Quantities missing from a release)
2010first release that tabulates every quantity the package uses
2014
2018
2022most recent, so the default

Checking the active release

using AtomicAndPhysicalConstants
RELEASE_YEAR   # Int – the currently active release year

Changing the release

using AtomicAndPhysicalConstants

set_release(year = "2014")
# [ Info: The default CODATA release is now 2014.
#         Restart your Julia session for this change to take effect.

The setting is stored via Preferences.jl and persists across Julia sessions until changed again.

Restart required

Constants are resolved at package load time, so a Julia session restart is required for the new release to take effect.

Unsupported releases

Only the years listed under Supported releases above are valid. If the stored preference points at an unsupported release (for example after hand-editing LocalPreferences.toml), the package raises an error at load time listing the valid options rather than silently falling back to the default.

The default release

With no release set, the package uses the most recent release it ships, currently 2022. When a newer release is added to the package, it becomes the default for every environment that has not set one.

set_release() with no argument removes the setting, so the environment goes back to following the most recent release:

set_release()
# [ Info: The CODATA release now follows the most recent one, currently 2022.
#         Restart your Julia session for this change to take effect.

Setting a year explicitly, including the current most recent one, pins it: set_release(year = "2022") keeps 2022 after a newer release is added.

Direct access to release structs

Each release is also exported as a named CODATA_release struct. You can inspect or use individual values without changing the global default:

CODATA2018.M_ELECTRON    # electron mass from the 2018 release
CODATA2014.C_LIGHT       # speed of light from the 2014 release

Constants not in CODATA

The pion masses (M_PION_0, M_PION_CHARGED) are not published in any CODATA release. Each release carries the values from the Particle Data Group (PDG) Review of Particle Physics edition of the same year.

ReleasePDG editionM_PION_0 (MeV/c²)M_PION_CHARGED (MeV/c²)
20022002134.9766 ± 0.0006139.57018 ± 0.00035
20062006134.9766 ± 0.0006139.57018 ± 0.00035
20102010134.9766 ± 0.0006139.57018 ± 0.00035
20142014134.9766 ± 0.0006139.57018 ± 0.00035
20182018134.9770 ± 0.0005139.57061 ± 0.00024
20222022134.9768 ± 0.0005139.57039 ± 0.00018

The table shows the rounded Summary Table numbers. The stored values are PDG's fit values, which carry more digits (for example CODATA2022.M_PION_0 == 1.349768277676847e8 eV/c²), so they differ from the rounded numbers well within the quoted uncertainty.

CLASSICAL_RADIUS_FACTOR is derived rather than tabulated: it is computed as R_ELECTRON * M_ELECTRON from the active release. It is therefore not a field of the CODATA_release structs — CODATA2018.CLASSICAL_RADIUS_FACTOR does not exist, only the exported top-level constant.

Constants that differ from the tabulated release value

G_NEUTRON_NUCLEAR_MAGNETON, G_DEUTERON_NUCLEAR_MAGNETON, G_HELION_NUCLEAR_MAGNETON, and G_TRITON_NUCLEAR_MAGNETON are pulled from the NIST/CODATA tables and are measured in terms of the nuclear magneton $\mu_N = e\hbar/2m_p$. APC converts them to G_NEUTRON, G_DEUTERON, G_HELION, and G_TRITON so that the gyromagnetic anomaly $a = (g_q-2)/2$ comes out correct. For example:

G_DEUTERON == CODATA2022.G_DEUTERON_NUCLEAR_MAGNETON * M_DEUTERON / M_PROTON   # active release

The magnetic moments MU_PROTON_SI, MU_ELECTRON_SI, … , hold the CODATA values in SI units (J/T), which are converted to the exported MU_* constants (without a _SI suffix) in eV/T. The permittivity and permeability work the same way: EPS_0_SI (F/m) and MU_0_SI (N/A²) become the exported EPS_0 in 1/(eV·m) and MU_0 in eV·s²/m.

Quantities missing from a release

Every value in a CODATA<year>.jl file is the one NIST tabulates for that release. Where a release does not tabulate a quantity, the field is NaN rather than a value borrowed from another release:

ReleaseFields that are NaN
2002M_TRITON, MU_HELION_SI, MU_TRITON_SI, G_DEUTERON_NUCLEAR_MAGNETON, G_HELION_NUCLEAR_MAGNETON, G_TRITON_NUCLEAR_MAGNETON
2006MU_HELION_SI, G_HELION_NUCLEAR_MAGNETON
2010 and laternone

The 2002 and 2006 tables list only the shielded helion magnetic moment, which is a different quantity, so it is not used in place of MU_HELION_SI.

The NaN carries through to everything computed from the field when that release is active. With 2002 active, for example, G_DEUTERON, G_HELION, and G_TRITON are NaN (each is the nuclear-magneton value times a mass ratio), and so are the mass of the triton species and the magnetic moments and g-factors of the helion and triton species. With 2006 active, the helion's magnetic moment and g-factor are NaN.

How the values are taken from the NIST tables

The release files are generated by update/update_constants.jl (see Regenerating the tabulated data). All masses and energies are stored in eV (eV/c² for masses). NIST does not tabulate particle masses in eV, so each mass is read from its "mass energy equivalent in MeV" row and the decimal point is moved six places. That shift is exact: the stored mass is NIST's published number, not the product of two rounded quantities.

The 2002 and 2006 tables have no row for the elementary charge alone. E_CHARGE for those releases is read from the electron volt–joule relationship, which is the same number because 1 eV = e × 1 J/C.