Nuclide/
traits.rs

1use crate::particle::Particle;
2use crate::decay::decayimpl::DecayMode;
3
4/// General chemical element properties
5pub trait ChemElement: Clone{
6    /// Atomic number
7    fn atomic_num(&self) -> u64;
8    /// Atomic mass in Daltons
9    fn am(&self) -> f64;
10    /// Electron affinity in kj/mol
11    fn electron_affinity(&self) -> f64;    
12    ///Returns the ionization energies for all known levels. Values are in kj/mol
13    fn ionization_energies(&self, level: usize) -> Option<f64>;
14    /// Returns Oganov-Tantardini values, the current best evaluation
15    fn electronegativity(&self) -> f64;
16    /// Mullikan electronegativity
17    fn mullikan_en(&self) -> f64;
18    /// Allen electronegativity
19    fn allen_en(&self) -> f64;
20    /// Pauling electronegativity
21    fn pauling_en(&self) -> f64;
22    /// Covalent radii of the first three bonds
23    fn covalent_radii(&self, bond: usize) -> Option<f64>;
24    /// Ionic radii
25    fn ionic_radii(&self) -> f64;
26    /// Van der Waal radius in crystalline structure
27    fn vdr_crystal(&self) -> f64;
28    /// Van der Waal radius in isolated atoms
29    fn vdr_isolated(&self) -> f64;
30    
31}
32
33/// Nuclear properties that vary between isotopes
34pub trait Isotope: ChemElement{
35
36    /// Mass defect or the difference between the empirical mass and the mass of the constituents, in Daltons
37    fn mass_deficit(&self) -> f64;
38    
39    /// Binding energy in MeV
40    fn binding_energy(&self) -> f64;
41    
42    /// Half-life of nuclide/isomer in seconds. TotalDecay mode returns the half-life, all other modes return  the partial half-life 
43    /// # Nan
44    /// Particle is unstable but the selected decay mode is not supported
45    /// # Inf
46    /// Particle is stable
47    fn half_life<T: DecayMode>(&self) -> f64;
48    
49    /// The mean lifetime of nuclide in seconds
50    fn mean_lifetime<T: DecayMode>(&self) -> f64;
51    
52    /// Returns the probable decay modes as a string
53    fn decay_string(&self) -> String;
54    
55    /// Returns the daughter with decay energy
56    fn daughter_energetic<T: DecayMode>(&mut self) -> (f64, Vec<Particle>);
57    
58    /// Returns the daughter nuclide 
59    /// # None
60    /// If nuclide has not been observed to decay by the mode, returns None
61    fn daughter<T: DecayMode>(&self) -> Option<Self>;
62    
63    /// Returns the daughter nuclide,regardless of whether it has been observed 
64    /// # None
65    /// If impossible to decay by the provided mode
66    fn daughter_theoretical<T: DecayMode>(&self) -> Option<Self>;
67    
68    /// Probability of the provided Decay mode being taken
69    /// # NAN
70    /// If Decay Mode is not observed return NAN
71    fn branching_ratio<T: DecayMode>(&self) -> f64;
72    
73    /// Decay constant in seconds of nuclide/isomer. TotalDecay mode returns the decay constant, all other modes return  the partial decay constant 
74    /// # Nan
75    /// Particle is unstable but the selected decay mode is not supported
76    /// # Inf
77    /// Particle is stable
78    fn decay_constant<T: DecayMode>(&self) -> f64;
79    
80    /// Returns the probability of the nuclide to decay after the time in seconds provided
81    fn decay_probability<T: DecayMode>(&self, time: f64) -> f64;
82    
83    /// Checks if nuclide probably decay in the selected time.
84    fn decay_time<T: DecayMode>(&self, time: f64) -> bool;
85
86    /// Continously performs decay throughout the time selected, collecting all particles into a vector with decay energies.
87    fn decay<T: DecayMode>(&mut self, time: f64) -> (f64, Vec<Particle>);
88    
89    /// Q-value (total energy) of a nuclear decay, regardless of whether it is observed
90    /// # NAN
91    /// Returns NAN if this decay mode results in a nonexistent nuclide
92    fn decay_q<T: DecayMode>(&self) -> f64;
93}