Skip to content
MilanSkocicPublic

Repository files navigation

DESCRIPTION
  codata is a Fortran library providing the fundamental physical constants
  published by CODATA. 
  It includes the 2022, 2018, 2014 and 2010 recommended values, 
  allowing applications to reproduce calculations based on specific 
  CODATA releases.
  
FEATURES
  It provides:
  - CODATA 2022 constants
  - CODATA 2018 constants
  - CODATA 2014 constants
  - CODATA 2010 constants
  - Native Fortran API
  - C interoperability API
  - Python bindings
  - Selection of an adjustment at compile time or at run time

SELECTING AN ADJUSTMENT
  There are two ways to reach a constant. Both are generated from the
  same source data, so they cannot disagree.

  Named symbols, selected at compile time. Every adjustment is available
  under year-suffixed names: BOHR_RADIUS_2010, BOHR_RADIUS_2014,
  BOHR_RADIUS_2018, BOHR_RADIUS_2022. These are parameters in Fortran and
  const objects in C, so they can be used in initialisation expressions
  and array bounds and are folded into the code by the compiler. The
  latest adjustment is additionally available without the suffix, as an
  alias meaning "current"; that alias changes value when a new adjustment
  is released, so pin to the year-suffixed name to reproduce a result.

  The runtime accessor, for when the adjustment is chosen by input, or
  when a program needs two adjustments at once -- reading a checkpoint
  written under an older adjustment while computing under a current one:

     codata_value(CODATA_2014, Q_BOHR_RADIUS)

  The adjustment is always an explicit argument; there is no global
  "current adjustment" to set. Quantity keys (CODATA_Q_* in C and Python,
  Q_* in Fortran) name a quantity independently of the adjustment, and
  their values never change when a new adjustment is added.

  The adjustments do not contain the same quantities: of 358 quantities,
  23 are absent from 2010 and 2014, 4 from 2018 and 3 from 2022. Use
  codata_defined(ds, q) to test. codata_value returns a quiet NaN for a
  quantity an adjustment does not contain, never 0.0.

  NIST also renames quantities: CODATA 2014's ELECTRIC_CONSTANT is
  VACUUM_ELECTRIC_PERMITTIVITY from 2018 on. Every renamed quantity is
  available under both spellings in every adjustment and shares one
  quantity key, so code written against either name works against all of
  them.

DOCUMENTATION 
  The API is written as POSIX-style man pages which are distributed with 
  the binaries. 
  
  PDF   https://milanskocic.github.io/codata/man/
  HTML  https://milanskocic.github.io/codata/index.html

INSTALLATION 
  See the INSTALL file.

NOTES FOR FORTRAN USERS
  The codata constants from the 2022 adjustment were integrated into the Fortran 
  standard library (stdlib).
  This library is complementary to the constants defined in the stdlib
  by providing older values for the constants.
  See https://github.com/fortran-lang/stdlib/releases/tag/v0.7.0.
  If your application only requires the latest CODATA values, the
  Fortran standard library may be sufficient. Use codata when you need
  access to historical CODATA releases or compatibility with older
  scientific results.
  
  To use codata within your fpm(1) (https://github.com/fortran-lang/fpm)
  project, add the following lines to your file:

     [dependencies]
     codata = { git="https://github.com/MilanSkocic/codata.git" }

  If you only need sources for the CODATA constants that can be 
  integrated directly into your project, you may be interested in the 
  following repository:
  https://github.com/vmagnin/fundamental_constants.

REFERENCES
  [1]P. J. Mohr, B. N. Taylor, and D. B. Newell, 
     “CODATA Recommended Values of the Fundamental Physical Constants: 2010,” 
     Review of Modern Physics, vol. 84, 2012.
  [2]P. J. Mohr, B. N. Taylor, and D. B. Newell, 
     “CODATA Recommended Values of the Fundamental Physical Constants: 2014,” 
     Journal of Physical and Chemical Reference Data, vol. 45, 2016.
  [3]P. J. Mohr, B. N. Taylor, and D. B. Newell, 
     “CODATA Recommended Values of the Fundamental Physical Constants: 2018,” 
     Review of Modern Physics, vol. 93, 2021.
  [4]P. Mohr, D. Newell, B. Taylor, and E. Tiesinga, 
     “CODATA Recommended Values of the Fundamental Physical Constants: 2022.” 
     Accessed: May 05, 2025. [Online]. Available: https://arxiv.org/abs/2409.03787
  [5]P. J. Mohr, D. B. Newell, B. N. Taylor, and E. Tiesinga, 
     “CODATA Recommended Values of the Fundamental Physical Constants: 2022,” 
     Reviews of Modern Physics, vol. 97, no. 2, p. 25002, Apr. 2025, doi: 10.1103/RevModPhys.97.025002.

LICENSE
  MIT

Releases

Packages

Contributors

Languages