Struct Nuclide::Nuclide

source ·
pub struct Nuclide { /* private fields */ }
Expand description

Efficient representation of nuclide

Implementations§

source§

impl Nuclide

source

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;
        use ::Nuclide::Atom;
          
        let u235 = Nuclide::new("U-235").unwrap();
        assert_eq!(u235.to_string(),"U-235");
Examples found in repository?
examples/standard_atomic_mass.rs (line 19)
18
19
20
21
22
23
fn main(){
let hydro = vec![Nuclide::new("H-1").unwrap(), Nuclide::new("H-2").unwrap(), Nuclide::new("H-3").unwrap()];
let distr = vec![0.9998,0.000156,1E-18];
 println!("The standard atomic mass of hydrogen is {:?} ", standard_atomic_mass(&hydro[..], &distr[..]));

}
More examples
Hide additional examples
examples/molecule.rs (line 30)
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
fn main(){
  
  let protium = Nuclide::new("H-1").unwrap();
  let deuterium = Nuclide::new("H-2").unwrap();
  let tritium = Nuclide::new("H-3").unwrap();
  let oxy = Nuclide::new("O-16").unwrap();
  let h_oxy = Nuclide::new("O-18").unwrap(); 
  
  let potable = Water::new(oxy, protium, protium);
  let hdo = Water::new(oxy, deuterium, protium);
  let heavy_water = Water::new(oxy, deuterium, deuterium);
  let tritiated_water = Water::new(oxy, tritium, tritium);
  let super_heavy_water = Water::new(h_oxy, deuterium, deuterium);

  println!("Some masses of different types of \"water\" \n ");
  println!("Regular water H2O : {} daltons", potable.mass());
  println!("Semi-heavy water HDO : {} daltons", hdo.mass());
  println!("heavy water D2O : {} daltons", heavy_water.mass());
  println!("Tritiated water T2O : {} daltons", tritiated_water.mass());
  println!("Super heavy water D2O-18 : {} daltons", super_heavy_water.mass());

}
source

pub fn from_nucleons_unchecked(z: usize, n: usize) -> Self

In : proton, neutron Out: Nuclide

source

pub fn from_nucleons(z: usize, n: usize) -> Option<Self>

In: proton, neutron

None

Returns None if the Nuclide doesn’t exist

source

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

source

pub fn change(&mut self, idx: usize)

Transforms a nuclide from the unique index.

source

pub fn create(z: usize, n: usize) -> (f64, f64)

Returns the approximate mass and binding energy of a nuclide, theorectical or real, using the Bethe-Weizacker liquid-drop approximation.

source

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

source

pub fn isotope(&self) -> (usize, usize)

Returns the atomic number and the nucleon count

source

pub fn element_name(&self) -> String

Returns the element name.

source

pub fn proton_neutron(&self) -> (usize, usize)

Returns the proton and neutron count

source

pub fn neutron_separation(&self) -> f64

Approximate neutron separation energy

source

pub fn proton_separation(&self) -> f64

Approximate proton separation energy

source

pub fn isotope_list(&self) -> Vec<Self>

returns a vector of all isotopes of the element

source

pub fn mirror(&self) -> Option<Self>

Returns the nuclide (if it exists) that has swapped proton-neutron count

source

pub fn list() -> Vec<Self>

Produces a vector of all nuclides sorted by atomic number, e.g all hydrogen isotopes, all helium isotopes, …

source

pub fn isobar_list(&self) -> Vec<Self>

Produces a list of all nuclides that share the same atomic number as the selected nuclide

source

pub fn isotone_list(&self) -> Vec<Self>

Produces a list of nuclides that share the same number of neutrons

source

pub fn branching_ratio<T: DecayMode>(&self) -> f64

Probability of the provided Decay mode being taken

NAN

If Decay Mode is not observed return NAN

source

pub fn daughter_theoretical<T: DecayMode>(&self) -> Option<Self>

Returns the daughter nuclide, regardless of whether it has been observed

None

If the decay result is not a known nuclide, returns None

source

pub fn decay_probability<T: DecayMode>(&self, time: f64) -> f64

Trait Implementations§

source§

impl Atom for Nuclide

source§

fn am(&self) -> f64

Returns the atomic mass in daltons

source§

fn am_kg(&self) -> f64

Returns the atomic mass in kilograms

source§

fn mass_deficit_ev(&self) -> f64

Mass deficit as MeV

source§

fn binding_energy(&self) -> f64

Returns the binding energy. Utilizing the mass model

source§

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

source§

fn electron_affinity(&self) -> f64

Returns electron affinity

source§

fn ionization_energies(&self, level: usize) -> Option<f64>

Returns the ionization energies for all known levels. Values are in kj/mol.

source§

fn electronegativity(&self) -> f64

Returns the thermochemical electronegativity as calculated by Oganov and Tantardini. Currently the best predictor of experimental values

source§

fn mullikan_en(&self) -> f64

Returns the Mullikan, or absolute, electronegativity in kj/mol

source§

fn allen_en(&self) -> f64

Allen Electronegativity

source§

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>

Radius in Single-double-and-triple covalent bonds

source§

fn ionic_radii(&self) -> f64

ionic radii

source§

fn vdr_crystal(&self) -> f64

Returns the Van Der Waal radius in crystalline structures. Values are in meters.

source§

fn vdr_isolated(&self) -> f64

Returns the Van Der Waal radius of isolated atoms

source§

fn half_life<T: DecayMode>(&self) -> f64

Half-life in seconds

source§

fn decay_constant<T: DecayMode>(&self) -> f64

Approximation of decay constant

source§

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_mode(&self) -> String

Returns the probable decay modes as a string

source§

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>)

Returns the name and isotope number of the nuclide

use ::Nuclide::{Atom,Nuclide};
use ::Nuclide::decay::TotalDecay;
let mut uranium = Nuclide::new("U-238").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");
source§

fn atomic_num(&self) -> u64

Atomic number
source§

fn mass_deficit(&self) -> f64

Mass defect or the difference between the empirical mass and the mass of the constituents, in Daltons
source§

fn mass_deficit_kg(&self) -> f64

source§

fn mass_deficit_j(&self) -> f64

Mass defect in Joules
source§

fn binding_energy_j(&self) -> f64

source§

fn electron_affinity_ev(&self) -> f64

Electron affinity in MeV
source§

fn ionization_energies_ev(&self, level: usize) -> Option<f64>

Returns the ionization energies for all known levels. Values are in MeV
source§

fn mean_lifetime<T: DecayMode>(&self) -> f64

The mean lifetime of nuclide/isomer
source§

fn decay_probability<T: DecayMode>(&self, time: f64) -> f64

Returns the probability of the nuclide to decay after the time in seconds provided
source§

fn daughter_energetic<T: DecayMode>(&mut self) -> (f64, Vec<Particle>)

source§

fn daughter<T: DecayMode>(&self) -> Option<Self>

Returns the daughter nuclide Read more
source§

impl Clone for Nuclide

source§

fn clone(&self) -> Nuclide

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Nuclide

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Nuclide

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for Nuclide

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq<Nuclide> for Nuclide

source§

fn eq(&self, other: &Nuclide) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Nuclide

source§

impl Eq for Nuclide

source§

impl StructuralEq for Nuclide

source§

impl StructuralPartialEq for Nuclide

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.