An extension of Unitful.jl for working with atomic units
Author sostock
17 Stars
Updated Last
1 Year Ago
Started In
September 2018


PkgEval CI codecov

This package extends the Unitful.jl package to facilitate working with atomic units.


This package provides three functions that enable easy conversion from and to Hartree atomic units:

  • aunit(x) returns the appropriate atomic unit for x, where x can be a Unitful.Quantity, Unitful.Units, or Unitful.Dimensions:
    julia> aunit(2.3u"cm")
    julia> aunit(u"T")
    ħ a₀^-2 e^-1
  • auconvert can be used to convert from and to atomic units. It has two methods:
    • auconvert(x::Unitful.Quantity) converts a quantity to the appropriate atomic unit:
      julia> auconvert(13.6u"eV")
      0.499790781587053 Eₕ
      julia> auconvert(20u"nm")
      377.94522492515404 a₀
    • auconvert(u::Unitful.Units, x::Number) interprets x as a quantity in atomic units and converts it to the unit u:
      julia> auconvert(u"eV", 1)  # convert 1 Eₕ to eV
      27.211386246088992 eV
      julia> auconvert(u"m", 1)   # convert 1 a₀ to m
      5.29177210903e-11 m
  • austrip(x::Unitful.Quantity) converts a quantity to the appropriate atomic unit and then strips the units. This is equivalent to Unitful.ustrip(auconvert(x)):
    julia> austrip(13.6u"eV")
    julia> austrip(20u"nm")

Defined units

The package defines the following atomic units (suffixed with _au), from which all other atomic units are derived:

Furthermore, this package defines some units that are not atomic units, but are common in atomic physics: