Particle Types

ChargedParticles.jl provides a flexible type system for representing various types of particles commonly encountered in plasma physics.

Type Hierarchy

The package uses a exhaustive type hierarchy:
AbstractParticle
├── AbstractChargeParticle
│   ├── Particle
│   └── SParticle
├── AbstractFermion
│   ├── AbstractLepton
│   │   ├── Electron
│   │   └── Muon
│   └── AbstractQuark
│   └── Neutron
│   └── ...
└── CustomParticle
  • AbstractParticle: Base abstract type for all particles
  • AbstractChargeParticle: Particles that could carry an electric charge.
  • Particle: Physically meaningful particle type (for ions where symbol encodes the actual type of the particle)
  • SParticle: Type-parameterized particle type for memory-efficient representation
  • CustomParticle: Custom particle type for user-defined particles (where symbol is just a label)

SParticle: Type-Parameterized Implementation

SParticle is a memory-efficient, type-parameterized implementation of a particle. Unlike Particle which stores particle properties as runtime values, SParticle encodes these properties in its type parameters:

# Type parameters encode charge number (z), atomic number (Z), and mass number (A)
SParticle{z,Z,A}

Memory Efficiency

SParticle is a zero-size type, meaning it requires no runtime memory allocation. This makes it particularly efficient for large-scale simulations where memory usage is critical:

# Compare memory usage
sizeof(SParticle{1,2,3}()), sizeof(Particle(:He, 1, 3))
(0, 24)

However, it's less flexible than Particle when properties are dynamic or numerous or are determined at runtime.

Particle Properties

Each particle (Particle) has the following properties:

  • Symbol (symbol::Symbol): Chemical symbol or particle identifier

    • Regular elements: :Fe, :He, etc.
    • Elementary particles: :e (electron), (muon)
    • Special particles: :n (neutron)
  • Charge Number (charge_number::Int): Number of elementary charges

    • Positive for cations: +1, +2, etc.
    • Negative for anions: -1, -2, etc.
    • Zero for neutral atoms/particles
  • Mass Number (mass_number::Int): Total number of nucleons

    • For isotopes: sum of protons and neutrons
    • For elementary particles: 0
    • For regular elements: most abundant isotope

Other properties derived from the above:

  • Mass (mass::Unitful.Mass): Particle mass

    • Calculated from the particle's symbol and mass number
    • Elementary particles: predefined constants (me, mμ, etc.)
    • Atoms and ions: looked up from isotope data
  • Charge (q) (charge\q::Unitful.Charge): Particle charge

  • Atomic Number (Z) (atomic_number\Z::Int): Number of protons in the particle

  • Element (element::Element): Element associated with the particle

Accessing particle properties could be done using functions {property_name}(particle) or dot notation particle.{property_name}. Functions are preferred for performance.

e = electron()
e.mass, mass(e)
(9.1093837015e-31 kg, 9.1093837015e-31 kg)

More properties (fields) about the element could be found in the Mendeleev.jl. These fields could be accessed by particle.element.{field_name} or element(particle).{field_name}.

p = particle("Fe")
@show propertynames(p.element);
104-element Vector{Symbol}:
 :abundance_crust
 :abundance_sea
 :annotation
 :appearance
 :atomic_mass
 :atomic_number
 :atomic_radius
 :atomic_radius_rahm
 :atomic_volume
 :atomic_weight
 ⋮
 :vdw_radius_bondi
 :vdw_radius_dreiding
 :vdw_radius_mm3
 :vdw_radius_rt
 :vdw_radius_truhlar
 :vdw_radius_uff
 :wikipedia
 :xpos
 :ypos
p.element
Iron (Fe), number 26:
categorytransition metal
atomic mass55.845 u
natural isotopes((5.845000000000001% ⁵⁴Fe m=53.939609 u ), (91.754% ⁵⁶Fe m=55.934936 u ), (2.119% ⁵⁷Fe m=56.935393 u ), (0.28200000000000003% ⁵⁸Fe m=57.933274 u ))
density7.87 g/cm³
molar heat cap.25.1 J/mol⋅K
melting point1811.15 K
boiling point3134.15 K
phaseSolid
shells[2, 8, 14, 2]
e⁻-configuration1s² 2s² 2p⁶ 3s² 3p⁶ 4s² 3d⁶
appearancelustrous metallic with a grayish tinge
summaryIron is a chemical element with symbol Fe (from Latin:ferrum) and atomic number 26. It is a metal in the first transition series. It is by mass the most common element on Earth, forming much of Earth's outer and inner core.
CAS identifier7439-89-6
spectral imagehttps://en.wikipedia.org/wiki/File:Iron_Spectrum.jpg
discovered byKnown to the ancients.
wikipediahttps://en.wikipedia.org/wiki/Iron
NIST webbookhttps://webbook.nist.gov/cgi/inchi/InChI%3D1S/Fe
Iron_Spectrum.jpg

Supported Particle Categories

Elementary Particles

# Electron
e = electron()
println("Electron: charge = $(charge(e)), mass = $(mass(e))")

# Muon
μ = particle("mu-")
println("Muon: charge = $(charge(μ)), mass = $(mass(μ))")
Electron: charge = -1.602176634e-19 C, mass = 9.1093837015e-31 kg
Muon: charge = -1.602176634e-19 C, mass = 1.8835316244145244e-28 kg

Atoms and Ions

# Neutral atom
fe = particle("Fe")
println("Iron: Z = $(atomic_number(fe)), A = $(mass_number(fe))")

# Positive ion
fe3 = particle("Fe3+")
println("Iron(III): charge = $(charge(fe3))")

# Negative ion
h_minus = particle("H-")
println("Hydride: charge = $(charge(h_minus))")
Iron: Z = 26, A = 56
Iron(III): charge = 4.806529901999999e-19 C
Hydride: charge = -1.602176634e-19 C

Isotopes

# Neutral isotope
fe56 = particle("Fe-56")
println("Fe-56: A = $(mass_number(fe56))")

# Charged isotope
he4_2plus = particle("He2+", mass_numb=4)
println("He-4(2+): Z = $(atomic_number(he4_2plus)), A = $(mass_number(he4_2plus))")
Fe-56: A = 56
He-4(2+): Z = 2, A = 4

Special Particles

# Alpha particle
α = particle("alpha")
println("Alpha: Z = $(atomic_number(α)), A = $(mass_number(α))")

# Deuteron
d = particle("D+")
println("Deuteron: A = $(mass_number(d))")

# Triton
t = particle("T+")
println("Triton: A = $(mass_number(t))")
Alpha: Z = 2, A = 4
Deuteron: A = 2
Triton: A = 3