#[repr(u8)]pub enum Element {
Show 118 variants
H = 1,
He = 2,
Li = 3,
Be = 4,
B = 5,
C = 6,
N = 7,
O = 8,
F = 9,
Ne = 10,
Na = 11,
Mg = 12,
Al = 13,
Si = 14,
P = 15,
S = 16,
Cl = 17,
Ar = 18,
K = 19,
Ca = 20,
Sc = 21,
Ti = 22,
V = 23,
Cr = 24,
Mn = 25,
Fe = 26,
Co = 27,
Ni = 28,
Cu = 29,
Zn = 30,
Ga = 31,
Ge = 32,
As = 33,
Se = 34,
Br = 35,
Kr = 36,
Rb = 37,
Sr = 38,
Y = 39,
Zr = 40,
Nb = 41,
Mo = 42,
Tc = 43,
Ru = 44,
Rh = 45,
Pd = 46,
Ag = 47,
Cd = 48,
In = 49,
Sn = 50,
Sb = 51,
Te = 52,
I = 53,
Xe = 54,
Cs = 55,
Ba = 56,
La = 57,
Ce = 58,
Pr = 59,
Nd = 60,
Pm = 61,
Sm = 62,
Eu = 63,
Gd = 64,
Tb = 65,
Dy = 66,
Ho = 67,
Er = 68,
Tm = 69,
Yb = 70,
Lu = 71,
Hf = 72,
Ta = 73,
W = 74,
Re = 75,
Os = 76,
Ir = 77,
Pt = 78,
Au = 79,
Hg = 80,
Tl = 81,
Pb = 82,
Bi = 83,
Po = 84,
At = 85,
Rn = 86,
Fr = 87,
Ra = 88,
Ac = 89,
Th = 90,
Pa = 91,
U = 92,
Np = 93,
Pu = 94,
Am = 95,
Cm = 96,
Bk = 97,
Cf = 98,
Es = 99,
Fm = 100,
Md = 101,
No = 102,
Lr = 103,
Rf = 104,
Db = 105,
Sg = 106,
Bh = 107,
Hs = 108,
Mt = 109,
Ds = 110,
Rg = 111,
Cn = 112,
Nh = 113,
Fl = 114,
Mc = 115,
Lv = 116,
Ts = 117,
Og = 118,
}Expand description
Chemical element from the periodic table (Z = 1 through 118).
Each variant stores its atomic number in the repr(u8) discriminant, enabling
efficient storage and fast comparisons. The type provides accessors for atomic
mass, symbol, and atomic number, and implements FromStr for parsing element
symbols from molecular file formats.
§Examples
use dreid_forge::Element;
use std::str::FromStr;
let carbon = Element::C;
assert_eq!(carbon.symbol(), "C");
assert_eq!(carbon.atomic_number(), 6);
assert!((carbon.atomic_mass() - 12.011).abs() < 1e-3);
let parsed = Element::from_str("Fe").unwrap();
assert_eq!(parsed, Element::Fe);Variants§
H = 1
He = 2
Li = 3
Be = 4
B = 5
C = 6
N = 7
O = 8
F = 9
Ne = 10
Na = 11
Mg = 12
Al = 13
Si = 14
P = 15
S = 16
Cl = 17
Ar = 18
K = 19
Ca = 20
Sc = 21
Ti = 22
V = 23
Cr = 24
Mn = 25
Fe = 26
Co = 27
Ni = 28
Cu = 29
Zn = 30
Ga = 31
Ge = 32
As = 33
Se = 34
Br = 35
Kr = 36
Rb = 37
Sr = 38
Y = 39
Zr = 40
Nb = 41
Mo = 42
Tc = 43
Ru = 44
Rh = 45
Pd = 46
Ag = 47
Cd = 48
In = 49
Sn = 50
Sb = 51
Te = 52
I = 53
Xe = 54
Cs = 55
Ba = 56
La = 57
Ce = 58
Pr = 59
Nd = 60
Pm = 61
Sm = 62
Eu = 63
Gd = 64
Tb = 65
Dy = 66
Ho = 67
Er = 68
Tm = 69
Yb = 70
Lu = 71
Hf = 72
Ta = 73
W = 74
Re = 75
Os = 76
Ir = 77
Pt = 78
Au = 79
Hg = 80
Tl = 81
Pb = 82
Bi = 83
Po = 84
At = 85
Rn = 86
Fr = 87
Ra = 88
Ac = 89
Th = 90
Pa = 91
U = 92
Np = 93
Pu = 94
Am = 95
Cm = 96
Bk = 97
Cf = 98
Es = 99
Fm = 100
Md = 101
No = 102
Lr = 103
Rf = 104
Db = 105
Sg = 106
Bh = 107
Hs = 108
Mt = 109
Ds = 110
Rg = 111
Cn = 112
Nh = 113
Fl = 114
Mc = 115
Lv = 116
Ts = 117
Og = 118
Implementations§
Source§impl Element
impl Element
Sourcepub fn atomic_mass(&self) -> f64
pub fn atomic_mass(&self) -> f64
Returns the standard atomic mass in unified atomic mass units (Da).
Values are taken from IUPAC recommendations and are suitable for computing molecular masses in force field parameterization and simulation setup.
§Returns
Atomic mass as f64 in Daltons.
Sourcepub fn atomic_number(&self) -> u8
pub fn atomic_number(&self) -> u8
Returns the atomic number (Z) of this element.
The value ranges from 1 (hydrogen) to 118 (oganesson) and corresponds to the number of protons in the nucleus.
§Returns
Atomic number as u8.
Trait Implementations§
Source§impl Ord for Element
impl Ord for Element
Source§impl PartialOrd for Element
impl PartialOrd for Element
impl Copy for Element
impl Eq for Element
impl StructuralPartialEq for Element
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnsafeUnpin for Element
impl UnwindSafe for Element
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.