impl crate::Element {
#[allow(clippy::too_many_lines)]
#[must_use]
pub fn standard_atomic_weight(&self) -> f64 {
match self {
Self::H => 1.008,
Self::He => 4.002602,
Self::Li => 6.94,
Self::Be => 9.0121831,
Self::B => 10.81,
Self::C => 12.011,
Self::N => 14.007,
Self::O => 15.999,
Self::F => 18.998,
Self::Ne => 20.1797,
Self::Na => 22.99,
Self::Mg => 24.305,
Self::Al => 26.9815385,
Self::Si => 28.085,
Self::P => 30.973761998,
Self::S => 32.06,
Self::Cl => 35.45,
Self::Ar => 39.948,
Self::K => 39.0983,
Self::Ca => 40.078,
Self::Sc => 44.955908,
Self::Ti => 47.867,
Self::V => 50.9415,
Self::Cr => 51.9961,
Self::Mn => 54.938044,
Self::Fe => 55.845,
Self::Co => 58.933194,
Self::Ni => 58.6934,
Self::Cu => 63.546,
Self::Zn => 65.38,
Self::Ga => 69.723,
Self::Ge => 72.63,
Self::As => 74.921595,
Self::Se => 78.971,
Self::Br => 79.904,
Self::Kr => 83.798,
Self::Rb => 85.4678,
Self::Sr => 87.62,
Self::Y => 88.90584,
Self::Zr => 91.224,
Self::Nb => 92.90637,
Self::Mo => 95.95,
Self::Tc => 97.90721,
Self::Ru => 101.07,
Self::Rh => 102.9055,
Self::Pd => 106.42,
Self::Ag => 107.8682,
Self::Cd => 112.414,
Self::In => 114.818,
Self::Sn => 118.71,
Self::Sb => 121.76,
Self::Te => 127.6,
Self::I => 126.90447,
Self::Xe => 131.293,
Self::Cs => 132.90545196,
Self::Ba => 137.327,
Self::La => 138.90547,
Self::Ce => 140.116,
Self::Pr => 140.90766,
Self::Nd => 144.242,
Self::Pm => 144.91276,
Self::Sm => 150.36,
Self::Eu => 151.964,
Self::Gd => 157.25,
Self::Tb => 158.92535,
Self::Dy => 162.5,
Self::Ho => 164.93033,
Self::Er => 167.259,
Self::Tm => 168.93422,
Self::Yb => 173.045,
Self::Lu => 174.9668,
Self::Hf => 178.49,
Self::Ta => 180.94788,
Self::W => 183.84,
Self::Re => 186.207,
Self::Os => 190.23,
Self::Ir => 192.217,
Self::Pt => 195.084,
Self::Au => 196.966569,
Self::Hg => 200.592,
Self::Tl => 204.38,
Self::Pb => 207.2,
Self::Bi => 208.9804,
Self::Po => 209.0,
Self::At => 210.0,
Self::Rn => 222.0,
Self::Fr => 223.0,
Self::Ra => 226.0,
Self::Ac => 227.0,
Self::Th => 232.0377,
Self::Pa => 231.03588,
Self::U => 238.02891,
Self::Np => 237.0,
Self::Pu => 244.0,
Self::Am => 243.0,
Self::Cm | Self::Bk => 247.0,
Self::Cf => 251.0,
Self::Es => 252.0,
Self::Fm => 257.0,
Self::Md => 258.0,
Self::No => 259.0,
Self::Lr => 262.0,
Self::Rf => 267.0,
Self::Db => 268.0,
Self::Sg => 271.0,
Self::Bh => 274.0,
Self::Hs => 269.0,
Self::Mt => 276.0,
Self::Ds | Self::Rg => 281.0,
Self::Cn => 285.0,
Self::Nh => 286.0,
Self::Fl => 289.0,
Self::Mc => 288.0,
Self::Lv => 293.0,
Self::Ts | Self::Og => 294.0,
}
}
}
#[cfg(test)]
mod tests {
use strum::IntoEnumIterator;
#[test]
fn test_standard_atomic_weight() {
for element in crate::Element::iter() {
let weight = element.standard_atomic_weight();
assert!(weight > 0.0, "Standard atomic weight should be positive for {element:?}");
}
}
}