Git Product home page Git Product logo

unitfulatomic.jl's Introduction

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:

unitfulatomic.jl's People

Contributors

sostock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

thomasple

unitfulatomic.jl's Issues

LoadError: UndefVarError: @u_str not defined

I tried this package on windows 10 with Julia 1.6.0 and it returns an error
julia> using UnitfulAtomic
julia> aunit(2.3u"cm")
LoadError: UndefVarError: @u_str not defined

Jan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.