pub struct Nuclide { /* private fields */ }Expand description
Efficient representation of nuclide
Implementations§
Source§impl Nuclide
impl Nuclide
Sourcepub fn new(input: &str) -> Option<Nuclide>
pub fn new(input: &str) -> Option<Nuclide>
Initializes a new Nuclide from a string representation. Currently the input must be of the form {Symbol}-{Nucleon count}
use ::Nuclide::Nuclide;
let u235 = Nuclide::new("U-235").unwrap();
assert_eq!(u235.to_string(),"U-235");Examples found in repository?
20fn main(){
21let hydro = vec![Nuclide::new("H-1").unwrap(), Nuclide::new("H-2").unwrap(), Nuclide::new("H-3").unwrap()];
22let distr = vec![0.9998,0.000156,1E-18];
23 println!("The standard atomic mass of hydrogen is {:?} ", standard_atomic_mass(&hydro[..], &distr[..]));
24
25let error_values = vec!["B-17","N-23","Ne-17","Ne-31","Mg-21","Mg-34","Mg-37",
26"Al-26","K-31","Cr-43","Mn-46","Co-58","Se-63","Kr-67","Rb-92","Ba-114",
27"Ac-225","Th-226","Th-228","Th-230","Th-232","Pa-230","Pa-231","Pa-236","Pa-238",
28"U-228","U-230","U-232","U-233","U-234","U-235","U-236","U-238","Np-229",
29"Np-236","Np-237","Pu-229","Pu-235","Pu-236","Pu-237","Pu-238","Pu-240"];
30
31for i in error_values{
32 println!("{}", Nuclide::new(i).unwrap().decay_string());
33}
34
35}More examples
28fn main(){
29
30 let protium = Nuclide::new("H-1").unwrap();
31 let deuterium = Nuclide::new("H-2").unwrap();
32 let tritium = Nuclide::new("H-3").unwrap();
33 let oxy = Nuclide::new("O-16").unwrap();
34 let h_oxy = Nuclide::new("O-18").unwrap();
35
36 let potable = Water::new(oxy, protium, protium);
37 let hdo = Water::new(oxy, deuterium, protium);
38 let heavy_water = Water::new(oxy, deuterium, deuterium);
39 let tritiated_water = Water::new(oxy, tritium, tritium);
40 let super_heavy_water = Water::new(h_oxy, deuterium, deuterium);
41
42 println!("Some masses of different types of \"water\" \n ");
43 println!("Regular water H2O : {} daltons", potable.mass());
44 println!("Semi-heavy water HDO : {} daltons", hdo.mass());
45 println!("heavy water D2O : {} daltons", heavy_water.mass());
46 println!("Tritiated water T2O : {} daltons", tritiated_water.mass());
47 println!("Super heavy water D2O-18 : {} daltons", super_heavy_water.mass());
48
49}Sourcepub fn from_nucleons_unchecked(protons: usize, neutrons: usize) -> Self
pub fn from_nucleons_unchecked(protons: usize, neutrons: usize) -> Self
In : proton, neutron Out: Nuclide
Sourcepub fn from_nucleons(protons: usize, neutrons: usize) -> Option<Self>
pub fn from_nucleons(protons: usize, neutrons: usize) -> Option<Self>
In: proton, neutron Returns None if the Nuclide doesn’t exist
Sourcepub fn assign(idx: usize) -> Self
pub fn assign(idx: usize) -> Self
Construct a nuclide from the unique index. Avoid direct use as no checks are performed to ensure that it is valid
Sourcepub fn create(z: usize, n: usize) -> (f64, f64)
pub fn create(z: usize, n: usize) -> (f64, f64)
Returns the approximate mass and binding energy of a nuclide, theorectical or real, using the DZ-10 mass model.
Sourcepub fn nuclide_index(&self) -> usize
pub fn nuclide_index(&self) -> usize
Returns the underlying unique value. Can be used in conjunction with “assign” and “change” to rapidly create or convert nuclides without decay
Sourcepub fn element_name(&self) -> String
pub fn element_name(&self) -> String
Returns the element name.
Sourcepub fn proton_neutron(&self) -> (usize, usize)
pub fn proton_neutron(&self) -> (usize, usize)
Returns the proton and neutron count
Sourcepub fn neutron_separation(&self) -> f64
pub fn neutron_separation(&self) -> f64
Approximate neutron separation energy
Sourcepub fn proton_separation(&self) -> f64
pub fn proton_separation(&self) -> f64
Approximate proton separation energy
Sourcepub fn isotope_list(&self) -> Vec<Self>
pub fn isotope_list(&self) -> Vec<Self>
returns a vector of all isotopes of the element
Sourcepub fn mirror(&self) -> Option<Self>
pub fn mirror(&self) -> Option<Self>
Returns the nuclide (if it exists) that has swapped proton-neutron count
Sourcepub fn list() -> Vec<Self>
pub fn list() -> Vec<Self>
Produces an iterator of all nuclides sorted by atomic number, e.g all hydrogen isotopes, all helium isotopes, …
Sourcepub fn isobar_list(&self) -> Vec<Self>
pub fn isobar_list(&self) -> Vec<Self>
Produces a list of all nuclides that share the same atomic number as the selected nuclide
Sourcepub fn isotone_list(&self) -> Vec<Self>
pub fn isotone_list(&self) -> Vec<Self>
Produces a list of nuclides that share the same number of neutrons
Sourcepub fn spin_parity(&self) -> (i8, i8)
pub fn spin_parity(&self) -> (i8, i8)
Returns the isospin and parity in the form of a i8 pair, one of which is negatively signed for - parity
Trait Implementations§
Source§impl ChemElement for Nuclide
impl ChemElement for Nuclide
Source§fn mullikan_en(&self) -> f64
fn mullikan_en(&self) -> f64
Returns the Mullikan, or absolute, electronegativity in kj/mol
Source§fn pauling_en(&self) -> f64
fn pauling_en(&self) -> f64
Pauling Electronegativity. A poor fit for experimental values, however it is here for completeness
Source§fn covalent_radii(&self, bond: usize) -> Option<f64>
fn covalent_radii(&self, bond: usize) -> Option<f64>
Radius in Single-double-and-triple covalent bonds
Source§fn atomic_num(&self) -> u64
fn atomic_num(&self) -> u64
Source§fn electron_affinity(&self) -> f64
fn electron_affinity(&self) -> f64
Source§fn ionization_energies(&self, level: usize) -> Option<f64>
fn ionization_energies(&self, level: usize) -> Option<f64>
Source§fn electronegativity(&self) -> f64
fn electronegativity(&self) -> f64
Source§fn ionic_radii(&self) -> f64
fn ionic_radii(&self) -> f64
Source§fn vdr_crystal(&self) -> f64
fn vdr_crystal(&self) -> f64
Source§fn vdr_isolated(&self) -> f64
fn vdr_isolated(&self) -> f64
Source§impl Isotope for Nuclide
impl Isotope for Nuclide
Source§fn decay_constant<T: DecayMode>(&self) -> f64
fn decay_constant<T: DecayMode>(&self) -> f64
Approximation of decay constant
Source§fn decay_time<T: DecayMode>(&self, time: f64) -> bool
fn decay_time<T: DecayMode>(&self, time: f64) -> bool
Returns true if the nuclide would have decayed in the time given. The nuclide remains unchanged
Source§fn decay_string(&self) -> String
fn decay_string(&self) -> String
Returns the probable decay modes as a string
Source§fn decay_q<T: DecayMode>(&self) -> f64
fn decay_q<T: DecayMode>(&self) -> f64
Q-value (total energy) of a nuclear decay, regardless of whether it is observed
§NAN
Returns NAN if this decay mode results in a nonexistent nuclide
Source§fn decay<T: DecayMode>(&mut self, time: f64) -> (f64, Vec<Particle>)
fn decay<T: DecayMode>(&mut self, time: f64) -> (f64, Vec<Particle>)
Returns the name and isotope number of the nuclide
use ::Nuclide::{Nuclide, Isotope,::decay::TotalDecay};
let mut uranium = "U-238".parse::<Nuclide>().unwrap();
// total particle energy of the nuclide and vector of decay particles
let (particle_energy,particle_vector) = uranium.decay::<TotalDecay>(5E+20);
// final nuclide in the U-238 decay series
assert_eq!(uranium.to_string(), "Pb-206");