UnitfulAtomic.jl
UnitfulAtomic.jl copied to clipboard
An extension of Unitful.jl for working with atomic units
UnitfulAtomic
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 forx
, wherex
can be aUnitful.Quantity
,Unitful.Units
, orUnitful.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)
interpretsx
as a quantity in atomic units and converts it to the unitu
: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 toUnitful.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:
-
me_au
(printed asmₑ
): the electron rest mass. -
e_au
(printed ase
): the elementary charge. -
ħ_au
(printed asħ
): the reduced Planck constant. -
k_au
(printed ask
): the Boltzmann constant. -
a0_au
(printed asa₀
): the Bohr radius. The aliasbohr
can be used instead ofa0_au
. -
Eh_au
(printed asEₕ
): the Hartree energy. The aliashartree
can be used instead ofEh_au
.
Furthermore, this package defines some units that are not atomic units, but are common in atomic physics:
-
Ry
: the Rydberg energyRy = h*c*R∞ = Eₕ/2
, see Rydberg constant. -
μ_N
: the nuclear magneton.