use ::Nuclide::{Nuclide,ChemElement,Isotope}; //use ::Nuclide::ChemElement; /* Nuclide does not have a standard atomic weight for the elements however it can be trivially computed for a sample given a list of the nuclides known to exist and a vector of the distribution ratios Note that this has been superseded by Jan-Grimo's addition of NuclideFraction and the Element enums */ fn standard_atomic_mass(isos: &[Nuclide], dist: &[f64]) -> f64{ let mut mass = 0f64; for i in 0..isos.len(){ mass+=isos[i].am()*dist[i]; } mass } 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[..])); let error_values = vec!["B-17","N-23","Ne-17","Ne-31","Mg-21","Mg-34","Mg-37", "Al-26","K-31","Cr-43","Mn-46","Co-58","Se-63","Kr-67","Rb-92","Ba-114", "Ac-225","Th-226","Th-228","Th-230","Th-232","Pa-230","Pa-231","Pa-236","Pa-238", "U-228","U-230","U-232","U-233","U-234","U-235","U-236","U-238","Np-229", "Np-236","Np-237","Pu-229","Pu-235","Pu-236","Pu-237","Pu-238","Pu-240"]; for i in error_values{ println!("{}", Nuclide::new(i).unwrap().decay_string()); } }