Skip to content

Commit

Permalink
Merge pull request #96 from bmad-sim/new-setunits
Browse files Browse the repository at this point in the history
New setunits
  • Loading branch information
DavidSagan authored Nov 4, 2024
2 parents 8def8d3 + ea482c7 commit 87b4fa9
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 242 deletions.
12 changes: 5 additions & 7 deletions src/AtomicAndPhysicalConstants.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ using JSON
using Reexport
@reexport using Unitful

include("units_definition.jl")
include("physical_constants.jl")
include("atomic_isotopes.jl")
include("subatomic_species.jl")
Expand All @@ -17,13 +18,10 @@ include("update_iso_masses.jl")
include("particle_functions.jl")
include("set_units.jl")

export setunits, printunits
export PARTICLE_PHYSICS, MKS, CGS
export mass, charge
export c_light, m_electron, m_proton, m_neutron, m_muon, m_helion, m_deuteron, m_pion_0, m_pion_charged
export r_e, e_charge, h_planck, mu_0_vac, eps_0_vac
export kg_per_amu, eV_per_amu, N_avogadro, fine_structure, classical_radius_factor, r_p, h_bar_planck, kg_per_eV, eps_0_vac
export mu_deuteron, mu_electron, mu_helion, mu_muon, mu_neutron, mu_proton, mu_triton
export setunits
export ACCELERATOR, MKS, CGS
export massof, chargeof
export C_LIGHT, H_PLANCK, H_BAR_PLANCK, R_E, R_P, E_CHARGE, MU_0_VAC, EPS_0_VAC, CLASSICAL_RADIUS_FACTOR, FINE_STRUCTURE, N_AVOGADRO
export SubatomicSpecies
export AtomicSpecies
export SUBATOMIC_SPECIES
Expand Down
22 changes: 4 additions & 18 deletions src/physical_constants.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,6 @@
# Constants pulled from the NIST table of
# the 2022 CODATA release

const __b_e_charge = 1.602176634e-19 * u"C"
# elementary charge [C]
const __b_N_avogadro = 6.02214076e23
# Avogadro's constant: Number / mole (exact)

module NewUnits
using Unitful
AA = parentmodule(NewUnits)
@unit e "e" elementary_charge AA.__b_e_charge false
@unit amu "amu" Amu (1 / (AA.__b_N_avogadro)) * u"g" false
end

Unitful.register(NewUnits);
using .NewUnits

function __init__()
Unitful.register(NewUnits)
end


# Format is:
Expand Down Expand Up @@ -49,6 +31,10 @@ const __b_mu_0_vac = 1.25663706127e-6 * u"N/A^2"
# Vacuum permeability in [N/A^2] (newtons per ampere squared)


const __b_e_charge = 1.602176634e-19 * u"C"
# elementary charge [C]
const __b_N_avogadro = 6.02214076e23
# Avogadro's constant: Number / mole (exact)



Expand Down
Loading

0 comments on commit 87b4fa9

Please sign in to comment.