Giter Club home page Giter Club logo

atomicandphysicalconstants.jl's Introduction

AtomicAndPhysicalConstants

Build Status

AtomicAndPhysicalConstants is a package which provides numerical constants and simulation-ready objects for tracking through an accelerator lattice, as well as other possible scenarios. It includes information about a number of hadrons and fundamental particles, listed below; also included is detailed information about every isotope of every atomic element documented by NIST.

The numerical constants are:

  • c_light: speed of light
  • h_planck: Planck's constant
  • h_bar_planck: Planck's constant / 2pi
  • mu_0_vac: vacuum permeability
  • eps_0_vac: vacuum permittivity
  • fine_structure: fine structure constant
  • N_avogadro: Avogadro's constant
  • m_electron: electron mass
  • r_e: electron radius
  • anom_mag_moment_electron: anomalous magnetic moment of the electron
  • m_proton: proton mass
  • r_p: proton radius
  • anom_mag_moment_proton: anomalous magnetic moment of the proton
  • m_neutron: neutron mass
  • anom_mag_moment_neutron: anomalous magnetic moment of the neutron
  • m_muon: muon mass
  • anom_mag_moment_muon: anomalous magnetic moment of the muon
  • m_helion: Helion (He3 nucleus) mass
  • anom_mag_moment_He3: anomalous magnetic moment of the helion
  • m_deuteron: deuteron mass
  • anom_mag_moment_deuteron: anomalous magnetic moment of the deuteron
  • m_pion_0: mass of a neutral pion
  • m_pion_charged: mass of a charged pion
  • kg_per_amu: mass conversion factor between kg and dalton
  • eV_per_amu: mass conversion factor between eV/c^2 and dalton

Subatomic particles included with information about charge, mass, anomalous magnetic moment, and spin are:

  • photon
  • pion0
  • pion+
  • pion-
  • muon
  • antimuon
  • electron
  • positron
  • proton
  • anti-proton
  • neutron
  • anti-neutron
  • deuteron
  • anti-deuteron

In addition, a collection of all the isotopes documented by NIST is included. Values may be updated with setIsos()

atomicandphysicalconstants.jl's People

Contributors

rot4te avatar lllx125 avatar davidsagan avatar

Watchers

 avatar Eremey Valetov avatar  avatar

Forkers

lllx125

atomicandphysicalconstants.jl's Issues

`setunits` changes the unit system.

After the unit system has been set, my feeling is that setunits should not change the unit system unless unitsystem is explicitly set. For example:

julia> setunits(:CGS)
julia> setunits(time = :us)   # This will reset the units system to the default!

Changing units

We need to add functionality to change the units of all the constants to any other common unit.
The plan is to have all the constants stored in consistent units, (base eV), and use conversion to create temporary copies of the units in local memory. Since this total a few hundred Float64 objects, it won't take up more than a few kB

Changing units in a consistent fashion

Per David, there is no need to change the units of constants that are only used 'under the hood' which is to say, in the simulation.
This means that we don't need a global constants: instead, we want functions like mass_of(), or velocity_of(), which take in an object and return a number for viewing, rather than for computation.

I've added a new type to ParticleTypes.jl that has name, charge, mass, spin, and anomalous magnetic moment attributes. A good
(and extremely simple) task is to write a function for each numeric attribute that takes in the TrackedSpecies object and a unit type, and if possible returns the attribute in the requested units.
After this, there should be a collection of functions that handle all the dimensionful constants in PhysicalConstants.jl that are not associated directly to particles, eg c_light and h_planck.

It turns out the desired functionality is way simpler than what you were trying to do earlier... whoopsie.

Constants units

One thing that is desired is the ability to specify the units for the constants. before the constants are instantiated.

massof and chargeof calculation speed

massof and chargeof functions use conversion factors current_units.charge.conversion and current_units.mass.conversion. This is potentially computationally slow. Better would be to have current_units.charge_conversion and current_units.mass_conversion which are can be defined to have definite types.

Warning when `using AtomicAndPhysicalConstants`

Julia version 1.10.0:

julia> using AtomicAndPhysicalConstants
Precompiling AtomicAndPhysicalConstants
Info Given AtomicAndPhysicalConstants was explicitly requested, output will be shown live
┌ Warning: Replacing docs for AtomicAndPhysicalConstants.Particle :: Union{} in module AtomicAndPhysicalConstants
└ @ Base.Docs docs/Docs.jl:243
┌ Warning: Replacing docs for AtomicAndPhysicalConstants.Particle :: Union{} in module AtomicAndPhysicalConstants
└ @ Base.Docs docs/Docs.jl:243
WARNING: Method definition (::Type{AtomicAndPhysicalConstants.Particle})(AbstractString, Int32, Float64, Float64, Float64) in module AtomicAndPhysicalConstants at /Users/dcs16/.julia/dev/AtomicAndPhysicalConstants/src/ParticleTypes.jl:28 overwritten on the same line (check for duplicate calls to include).
ERROR: Method overwriting is not permitted during Module precompilation. Use __precompile__(false) to opt-out of precompilation.
? AtomicAndPhysicalConstants
[ Info: Precompiling AtomicAndPhysicalConstants [5c0d271c-5419-4163-b387-496237733d8b]
┌ Warning: Replacing docs for AtomicAndPhysicalConstants.Particle :: Union{} in module AtomicAndPhysicalConstants
└ @ Base.Docs docs/Docs.jl:243
┌ Warning: Replacing docs for AtomicAndPhysicalConstants.Particle :: Union{} in module AtomicAndPhysicalConstants
└ @ Base.Docs docs/Docs.jl:243
WARNING: Method definition (::Type{AtomicAndPhysicalConstants.Particle})(AbstractString, Int32, Float64, Float64, Float64) in module AtomicAndPhysicalConstants at /Users/dcs16/.julia/dev/AtomicAndPhysicalConstants/src/ParticleTypes.jl:28 overwritten on the same line (check for duplicate calls to include).
ERROR: Method overwriting is not permitted during Module precompilation. Use __precompile__(false) to opt-out of precompilation.
[ Info: Skipping precompilation since precompile(false). Importing AtomicAndPhysicalConstants [5c0d271c-5419-4163-b387-496237733d8b].
┌ Warning: Replacing docs for AtomicAndPhysicalConstants.Particle :: Union{} in module AtomicAndPhysicalConstants
└ @ Base.Docs docs/Docs.jl:243
┌ Warning: Replacing docs for AtomicAndPhysicalConstants.Particle :: Union{} in module AtomicAndPhysicalConstants
└ @ Base.Docs docs/Docs.jl:243
┌ Warning: Replacing docs for AtomicAndPhysicalConstants.Particle :: Union{} in module AtomicAndPhysicalConstants
└ @ Base.Docs docs/Docs.jl:243
┌ Warning: Replacing docs for AtomicAndPhysicalConstants.SubatomicSpecies :: Union{} in module AtomicAndPhysicalConstants
└ @ Base.Docs docs/Docs.jl:243
┌ Warning: Replacing docs for AtomicAndPhysicalConstants.AtomicSpecies :: Union{} in module AtomicAndPhysicalConstants
└ @ Base.Docs docs/Docs.jl:243

File Syntax

Anyone object to eliminating tabs and using two spaces per indent?

Anti-atoms

Needed is a way to define antiatoms. My suggestion is to use an "anti_" prefix like "anti_He" rather than something like "He_bar" as not intuitive. Something like "antiHe" looks too jumbled.

Also a function antiparticle(particle) is helpful.

Note: The massof function when calculating the mass needs to take into account that for an anti-atom the nucleus is surrounded by positrons and not electrons.

anomalous dipole moment

find references for the dipole moment of a proton, a neutron, a deuteron, and He3 from PDG. Write a code to pull down the measured moment and get the anomalous part of it, returning a vector.

using statements should be consolodated

  • The using statements should all be in one place (EG: AtomicAndPhysicalConstants.jl).
  • Is Dates package even used?
  • Dates is not in the dependency list so when I try using AtomicAndPhysicalConstants I get a load error.

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.