Skip to content

Commit

Permalink
better unitful
Browse files Browse the repository at this point in the history
  • Loading branch information
louisponet committed Jun 19, 2019
1 parent 6995916 commit fc6cea3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/DFControl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ module DFControl
using Parameters

@reexport using Unitful
Unitful.register(@__MODULE__);
import Unitful: Length, @unit, FreeUnits, unit

Unitful.register(@__MODULE__)
Base.eltype(::Type{Length{T}}) where T = T
@unit Ang "Ang" Angstrom 1e-1u"nm" false
@unit e₀ "eₒ" ElementaryCharge 1.602176620898e-19*u"C" false
Expand All @@ -23,6 +23,8 @@ module DFControl
@unit Eₕ "Eₕ" HartreeEnergy 1u"me*e₀^4*kₑ^2/(1ħ^2)" true
@unit Ry "Ry" RydbergEnergy 0.5Eₕ true

const localunits = Unitful.basefactors


@inline function StaticArrays._inv(::StaticArrays.Size{(3,3)}, A::SMatrix{3,3, LT}) where {LT<:Length}

Expand Down Expand Up @@ -93,6 +95,8 @@ module DFControl
function __init__()
@require Juno = "e5e0dc1b-0480-54bc-9374-aad01c23163d" include("display/printing_juno.jl")
init_defaults(default_file)
merge!(Unitful.basefactors, localunits)
Unitful.register(@__MODULE__)
end

const pythonpath = Sys.iswindows() ? joinpath(depsdir, "python2", "python") : joinpath(dirname(@__DIR__), "deps", "python2", "bin", "python")
Expand Down

0 comments on commit fc6cea3

Please sign in to comment.