Skip to content

Latest commit

 

History

History
75 lines (61 loc) · 3 KB

README.md

File metadata and controls

75 lines (61 loc) · 3 KB

UnitfulAtomic

PkgEval CI codecov

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

Functions

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")
    a₀
    
    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")
    0.499790781587053
    
    julia> austrip(20u"nm")
    377.94522492515404

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: