Skip to main content

Crate use_nuclear

Crate use_nuclear 

Source
Expand description

§use-nuclear

Small nuclear physics helpers for RustUse.

§Install

[dependencies]
use-nuclear = "0.0.1"

§Foundation

use-nuclear provides small scalar helpers for radioactive decay, activity, mass defect, binding energy, and simple nuclide number relationships.

Inputs are numeric SI-style values unless a function name explicitly refers to MeV or atomic mass units. The crate stays dependency-free and does not define a full unit system.

§Example

use use_nuclear::{
    activity, binding_energy_mev_from_mass_defect_u, DecayLaw, NuclideNumbers,
    ATOMIC_MASS_UNIT_MEV_C2,
};

let decay_law = DecayLaw::from_half_life(10.0).ok_or("expected valid half-life")?;
let remaining = decay_law
  .remaining_quantity(100.0, 10.0)
  .ok_or("expected valid remaining quantity")?;
let helium = NuclideNumbers::new(4, 2).ok_or("expected valid nuclide numbers")?;

assert!((remaining - 50.0).abs() < 1.0e-12);
assert_eq!(activity(2.0, 10.0), Some(20.0));
assert_eq!(helium.neutron_count(), 2);
assert_eq!(
    binding_energy_mev_from_mass_defect_u(1.0),
    Some(ATOMIC_MASS_UNIT_MEV_C2),
);

§When to use directly

Choose use-nuclear when you need reusable scalar formulas for decay, activity, or nuclear energy relationships without pulling in a larger chemistry or units model.

§Scope

  • Small scalar helpers for radioactive decay, activity, mass-energy equivalence, and simple nuclide-number relationships.
  • General constants belong in the top-level use-constants set.
  • Unit abstractions belong in the top-level use-units set.
  • Element symbols, atomic masses, and periodic-table concepts belong in use-chemistry.
  • Isotope databases, reactor simulation, radiation transport, dosimetry, and radiation safety tooling are out of scope.

§Status

use-nuclear is a pre-1.0 crate with a deliberately small API. Small nuclear physics helpers.

Modules§

prelude

Structs§

DecayLaw
Simple exponential-decay law parameterized by a decay constant.
NuclideNumbers
Mass and atomic numbers for a nuclide.

Constants§

ATOMIC_MASS_UNIT_MEV_C2
Atomic mass unit energy equivalent in mega-electron-volts per c^2.
JOULES_PER_MEV
Joules in one mega-electron-volt.
LN_2
Natural logarithm of 2 for half-life conversions and decay-law helpers.
SPEED_OF_LIGHT
Speed of light in vacuum in meters per second.

Functions§

activity
Computes activity from a decay constant and number of nuclei.
binding_energy_mev_from_mass_defect_u
Computes binding energy in mega-electron-volts from a mass defect in atomic mass units.
binding_energy_per_nucleon
Computes binding energy per nucleon.
decay_constant_from_half_life
Computes a decay constant from a half-life.
decayed_fraction_from_decay_constant
Computes the decayed fraction from a decay constant and elapsed time.
decayed_quantity_from_decay_constant
Computes the decayed quantity from an initial quantity, decay constant, and elapsed time.
elapsed_time_from_remaining_fraction
Computes elapsed time from a remaining fraction and decay constant.
energy_from_mass_defect_kg
Computes energy in joules from a mass defect in kilograms.
half_life_from_decay_constant
Computes a half-life from a decay constant.
is_valid_nuclide_numbers
Validates mass and atomic numbers for a simple nuclide representation.
joules_to_mev
Converts energy in joules to mega-electron-volts.
mass_defect_kg_from_energy
Computes mass defect in kilograms from energy in joules.
mean_lifetime
Computes the mean lifetime from a decay constant.
mev_to_joules
Converts energy in mega-electron-volts to joules.
neutron_count
Computes neutron count from mass number and atomic number.
nuclei_from_activity
Computes the number of nuclei from activity and decay constant.
nucleon_count
Computes nucleon count from proton and neutron counts.
remaining_fraction_from_decay_constant
Computes the remaining fraction from a decay constant and elapsed time.
remaining_fraction_from_half_life
Computes the remaining fraction from a half-life and elapsed time.
remaining_quantity_from_decay_constant
Computes the remaining quantity from an initial quantity, decay constant, and elapsed time.
remaining_quantity_from_half_life
Computes the remaining quantity from an initial quantity, half-life, and elapsed time.
specific_activity
Computes specific activity from activity and mass.