From fc6cea3042235282ea27d9625b342b481d843335 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 19 Jun 2019 11:16:53 +0200 Subject: [PATCH] better unitful --- src/DFControl.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/DFControl.jl b/src/DFControl.jl index 53b93cfc..7054d2bf 100644 --- a/src/DFControl.jl +++ b/src/DFControl.jl @@ -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 @@ -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} @@ -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")