elements_rs/isotopes/
most_abundant_isotope.rs

1//! Submodule implementing the `most_abundant_isotope` method for the `Element`
2//! enumeration
3
4use crate::isotopes::MostAbundantIsotope;
5
6impl crate::Element {
7    /// Returns the most common isotope of the element.
8    #[must_use]
9    #[allow(clippy::too_many_lines)]
10    pub fn most_abundant_isotope(&self) -> super::Isotope {
11        match self {
12            Self::H => super::Isotope::H(super::HydrogenIsotope::most_abundant_isotope()),
13            Self::He => super::Isotope::He(super::HeliumIsotope::most_abundant_isotope()),
14            Self::Li => super::Isotope::Li(super::LithiumIsotope::most_abundant_isotope()),
15            Self::Be => super::Isotope::Be(super::BerylliumIsotope::most_abundant_isotope()),
16            Self::B => super::Isotope::B(super::BoronIsotope::most_abundant_isotope()),
17            Self::C => super::Isotope::C(super::CarbonIsotope::most_abundant_isotope()),
18            Self::N => super::Isotope::N(super::NitrogenIsotope::most_abundant_isotope()),
19            Self::O => super::Isotope::O(super::OxygenIsotope::most_abundant_isotope()),
20            Self::F => super::Isotope::F(super::FluorineIsotope::most_abundant_isotope()),
21            Self::Ne => super::Isotope::Ne(super::NeonIsotope::most_abundant_isotope()),
22            Self::Na => super::Isotope::Na(super::SodiumIsotope::most_abundant_isotope()),
23            Self::Mg => super::Isotope::Mg(super::MagnesiumIsotope::most_abundant_isotope()),
24            Self::Al => super::Isotope::Al(super::AluminiumIsotope::most_abundant_isotope()),
25            Self::Si => super::Isotope::Si(super::SiliconIsotope::most_abundant_isotope()),
26            Self::P => super::Isotope::P(super::PhosphorusIsotope::most_abundant_isotope()),
27            Self::S => super::Isotope::S(super::SulfurIsotope::most_abundant_isotope()),
28            Self::Cl => super::Isotope::Cl(super::ChlorineIsotope::most_abundant_isotope()),
29            Self::Ar => super::Isotope::Ar(super::ArgonIsotope::most_abundant_isotope()),
30            Self::K => super::Isotope::K(super::PotassiumIsotope::most_abundant_isotope()),
31            Self::Ca => super::Isotope::Ca(super::CalciumIsotope::most_abundant_isotope()),
32            Self::Sc => super::Isotope::Sc(super::ScandiumIsotope::most_abundant_isotope()),
33            Self::Ti => super::Isotope::Ti(super::TitaniumIsotope::most_abundant_isotope()),
34            Self::V => super::Isotope::V(super::VanadiumIsotope::most_abundant_isotope()),
35            Self::Cr => super::Isotope::Cr(super::ChromiumIsotope::most_abundant_isotope()),
36            Self::Mn => super::Isotope::Mn(super::ManganeseIsotope::most_abundant_isotope()),
37            Self::Fe => super::Isotope::Fe(super::IronIsotope::most_abundant_isotope()),
38            Self::Co => super::Isotope::Co(super::CobaltIsotope::most_abundant_isotope()),
39            Self::Ni => super::Isotope::Ni(super::NickelIsotope::most_abundant_isotope()),
40            Self::Cu => super::Isotope::Cu(super::CopperIsotope::most_abundant_isotope()),
41            Self::Zn => super::Isotope::Zn(super::ZincIsotope::most_abundant_isotope()),
42            Self::Ga => super::Isotope::Ga(super::GalliumIsotope::most_abundant_isotope()),
43            Self::Ge => super::Isotope::Ge(super::GermaniumIsotope::most_abundant_isotope()),
44            Self::As => super::Isotope::As(super::ArsenicIsotope::most_abundant_isotope()),
45            Self::Se => super::Isotope::Se(super::SeleniumIsotope::most_abundant_isotope()),
46            Self::Br => super::Isotope::Br(super::BromineIsotope::most_abundant_isotope()),
47            Self::Kr => super::Isotope::Kr(super::KryptonIsotope::most_abundant_isotope()),
48            Self::Rb => super::Isotope::Rb(super::RubidiumIsotope::most_abundant_isotope()),
49            Self::Sr => super::Isotope::Sr(super::StrontiumIsotope::most_abundant_isotope()),
50            Self::Y => super::Isotope::Y(super::YttriumIsotope::most_abundant_isotope()),
51            Self::Zr => super::Isotope::Zr(super::ZirconiumIsotope::most_abundant_isotope()),
52            Self::Nb => super::Isotope::Nb(super::NiobiumIsotope::most_abundant_isotope()),
53            Self::Mo => super::Isotope::Mo(super::MolybdenumIsotope::most_abundant_isotope()),
54            Self::Tc => super::Isotope::Tc(super::TechnetiumIsotope::most_abundant_isotope()),
55            Self::Ru => super::Isotope::Ru(super::RutheniumIsotope::most_abundant_isotope()),
56            Self::Rh => super::Isotope::Rh(super::RhodiumIsotope::most_abundant_isotope()),
57            Self::Pd => super::Isotope::Pd(super::PalladiumIsotope::most_abundant_isotope()),
58            Self::Ag => super::Isotope::Ag(super::SilverIsotope::most_abundant_isotope()),
59            Self::Cd => super::Isotope::Cd(super::CadmiumIsotope::most_abundant_isotope()),
60            Self::In => super::Isotope::In(super::IndiumIsotope::most_abundant_isotope()),
61            Self::Sn => super::Isotope::Sn(super::TinIsotope::most_abundant_isotope()),
62            Self::Sb => super::Isotope::Sb(super::AntimonyIsotope::most_abundant_isotope()),
63            Self::Te => super::Isotope::Te(super::TelluriumIsotope::most_abundant_isotope()),
64            Self::I => super::Isotope::I(super::IodineIsotope::most_abundant_isotope()),
65            Self::Xe => super::Isotope::Xe(super::XenonIsotope::most_abundant_isotope()),
66            Self::Cs => super::Isotope::Cs(super::CaesiumIsotope::most_abundant_isotope()),
67            Self::Ba => super::Isotope::Ba(super::BariumIsotope::most_abundant_isotope()),
68            Self::La => super::Isotope::La(super::LanthanumIsotope::most_abundant_isotope()),
69            Self::Ce => super::Isotope::Ce(super::CeriumIsotope::most_abundant_isotope()),
70            Self::Pr => super::Isotope::Pr(super::PraseodymiumIsotope::most_abundant_isotope()),
71            Self::Nd => super::Isotope::Nd(super::NeodymiumIsotope::most_abundant_isotope()),
72            Self::Pm => super::Isotope::Pm(super::PromethiumIsotope::most_abundant_isotope()),
73            Self::Sm => super::Isotope::Sm(super::SamariumIsotope::most_abundant_isotope()),
74            Self::Eu => super::Isotope::Eu(super::EuropiumIsotope::most_abundant_isotope()),
75            Self::Gd => super::Isotope::Gd(super::GadoliniumIsotope::most_abundant_isotope()),
76            Self::Tb => super::Isotope::Tb(super::TerbiumIsotope::most_abundant_isotope()),
77            Self::Dy => super::Isotope::Dy(super::DysprosiumIsotope::most_abundant_isotope()),
78            Self::Ho => super::Isotope::Ho(super::HolmiumIsotope::most_abundant_isotope()),
79            Self::Er => super::Isotope::Er(super::ErbiumIsotope::most_abundant_isotope()),
80            Self::Tm => super::Isotope::Tm(super::ThuliumIsotope::most_abundant_isotope()),
81            Self::Yb => super::Isotope::Yb(super::YtterbiumIsotope::most_abundant_isotope()),
82            Self::Lu => super::Isotope::Lu(super::LutetiumIsotope::most_abundant_isotope()),
83            Self::Hf => super::Isotope::Hf(super::HafniumIsotope::most_abundant_isotope()),
84            Self::Ta => super::Isotope::Ta(super::TantalumIsotope::most_abundant_isotope()),
85            Self::W => super::Isotope::W(super::TungstenIsotope::most_abundant_isotope()),
86            Self::Re => super::Isotope::Re(super::RheniumIsotope::most_abundant_isotope()),
87            Self::Os => super::Isotope::Os(super::OsmiumIsotope::most_abundant_isotope()),
88            Self::Ir => super::Isotope::Ir(super::IridiumIsotope::most_abundant_isotope()),
89            Self::Pt => super::Isotope::Pt(super::PlatinumIsotope::most_abundant_isotope()),
90            Self::Au => super::Isotope::Au(super::GoldIsotope::most_abundant_isotope()),
91            Self::Hg => super::Isotope::Hg(super::MercuryIsotope::most_abundant_isotope()),
92            Self::Tl => super::Isotope::Tl(super::ThalliumIsotope::most_abundant_isotope()),
93            Self::Pb => super::Isotope::Pb(super::LeadIsotope::most_abundant_isotope()),
94            Self::Bi => super::Isotope::Bi(super::BismuthIsotope::most_abundant_isotope()),
95            Self::Po => super::Isotope::Po(super::PoloniumIsotope::most_abundant_isotope()),
96            Self::At => super::Isotope::At(super::AstatineIsotope::most_abundant_isotope()),
97            Self::Rn => super::Isotope::Rn(super::RadonIsotope::most_abundant_isotope()),
98            Self::Fr => super::Isotope::Fr(super::FranciumIsotope::most_abundant_isotope()),
99            Self::Ra => super::Isotope::Ra(super::RadiumIsotope::most_abundant_isotope()),
100            Self::Ac => super::Isotope::Ac(super::ActiniumIsotope::most_abundant_isotope()),
101            Self::Th => super::Isotope::Th(super::ThoriumIsotope::most_abundant_isotope()),
102            Self::Pa => super::Isotope::Pa(super::ProtactiniumIsotope::most_abundant_isotope()),
103            Self::U => super::Isotope::U(super::UraniumIsotope::most_abundant_isotope()),
104            Self::Np => super::Isotope::Np(super::NeptuniumIsotope::most_abundant_isotope()),
105            Self::Pu => super::Isotope::Pu(super::PlutoniumIsotope::most_abundant_isotope()),
106            Self::Am => super::Isotope::Am(super::AmericiumIsotope::most_abundant_isotope()),
107            Self::Cm => super::Isotope::Cm(super::CuriumIsotope::most_abundant_isotope()),
108            Self::Bk => super::Isotope::Bk(super::BerkeliumIsotope::most_abundant_isotope()),
109            Self::Cf => super::Isotope::Cf(super::CaliforniumIsotope::most_abundant_isotope()),
110            Self::Es => super::Isotope::Es(super::EinsteiniumIsotope::most_abundant_isotope()),
111            Self::Fm => super::Isotope::Fm(super::FermiumIsotope::most_abundant_isotope()),
112            Self::Md => super::Isotope::Md(super::MendeleviumIsotope::most_abundant_isotope()),
113            Self::No => super::Isotope::No(super::NobeliumIsotope::most_abundant_isotope()),
114            Self::Lr => super::Isotope::Lr(super::LawrenciumIsotope::most_abundant_isotope()),
115            Self::Rf => super::Isotope::Rf(super::RutherfordiumIsotope::most_abundant_isotope()),
116            Self::Db => super::Isotope::Db(super::DubniumIsotope::most_abundant_isotope()),
117            Self::Sg => super::Isotope::Sg(super::SeaborgiumIsotope::most_abundant_isotope()),
118            Self::Bh => super::Isotope::Bh(super::BohriumIsotope::most_abundant_isotope()),
119            Self::Hs => super::Isotope::Hs(super::HassiumIsotope::most_abundant_isotope()),
120            Self::Mt => super::Isotope::Mt(super::MeitneriumIsotope::most_abundant_isotope()),
121            Self::Ds => super::Isotope::Ds(super::DarmstadtiumIsotope::most_abundant_isotope()),
122            Self::Rg => super::Isotope::Rg(super::RoentgeniumIsotope::most_abundant_isotope()),
123            Self::Cn => super::Isotope::Cn(super::CoperniciumIsotope::most_abundant_isotope()),
124            Self::Nh => super::Isotope::Nh(super::NihoniumIsotope::most_abundant_isotope()),
125            Self::Fl => super::Isotope::Fl(super::FleroviumIsotope::most_abundant_isotope()),
126            Self::Mc => super::Isotope::Mc(super::MoscoviumIsotope::most_abundant_isotope()),
127            Self::Lv => super::Isotope::Lv(super::LivermoriumIsotope::most_abundant_isotope()),
128            Self::Ts => super::Isotope::Ts(super::TennessineIsotope::most_abundant_isotope()),
129            Self::Og => super::Isotope::Og(super::OganessonIsotope::most_abundant_isotope()),
130        }
131    }
132}
133
134#[cfg(test)]
135mod tests {
136    use strum::IntoEnumIterator;
137
138    use crate::isotopes::ElementVariant;
139
140    #[test]
141    fn test_most_abundant_isotope() {
142        for element in crate::Element::iter() {
143            let isotope = element.most_abundant_isotope();
144            // Verify that the returned isotope belongs to the correct element
145            assert_eq!(
146                isotope.element(),
147                element,
148                "Most abundant isotope for {element:?} should belong to the same element",
149            );
150            // Note: Some elements like Tc have no naturally occurring isotopes,
151            // so we don't check for isotopic composition here
152        }
153    }
154}