pub struct Zai { /* private fields */ }
Expand description
Nuclide identifier ZAI
.
Z
: atomic number / proton number / nuclear charge numberA
: mass number / nucleon numberI
: isomeric state number / nuclear energy state / metastable state level
§Examples
use nkl::core::{Element, Zai};
// From atomic/mass/isomeric-state numbers
let h1 = Zai::new(1, 1, 0);
// From standard name
let h1 = Zai::from_name("H1").unwrap();
// From id
let h1 = Zai::from_id(10010).unwrap();
assert_eq!(h1.atomic_number(), 1);
assert_eq!(h1.mass_number(), 1);
assert_eq!(h1.isomeric_state_number(), 0);
assert_eq!(h1.element(), Element::Hydrogen)
Implementations§
Source§impl Zai
impl Zai
Sourcepub fn new(
atomic_number: u32,
mass_number: u32,
isomeric_state_number: u32,
) -> Self
pub fn new( atomic_number: u32, mass_number: u32, isomeric_state_number: u32, ) -> Self
Creates a new nuclide identifier (ZAI) from specified numbers.
§Parameters
atomic_number
: atomic numberZ
mass_number
: mass numberA
isomeric_state_number
: isomeric state numberI
§Examples
use nkl::core::Zai;
// H1 -> Z = 1, A = 1, I = 0
let protium = Zai::new(1, 1, 0);
// H2 -> Z = 1, A = 2, I = 0
let deuterium = Zai::new(1, 2, 0);
// H3 -> Z = 1, A = 3, I = 0
let tritium = Zai::new(1, 3, 0);
§Panics
Panics if
atomic_number
∉[1, 118]
- number of nucleons is less than number of protons (
mass_number < atomic_number
) mass_number >= 1000
isomeric_state_number >= 10
Sourcepub fn from_name(name: &str) -> Option<Self>
pub fn from_name(name: &str) -> Option<Self>
Creates a new nuclide identifier from nuclide’s name.
§Format
- Ground state nuclide:
XxAAA
- Metastable nuclide:
XxAAAmI
with:
Xx
: one or two letter element’s symbol (seeElement
)AAA
: one to three (inclusive) digit(s) mass numberI
: one digit isomeric state number
§Returns
Some(zai)
ifname
is a conformant nuclide’s nameNone
otherwise
§Examples
use nkl::core::Zai;
// H1 -> Z = 1, A = 1, I = 0
assert_eq!(Zai::from_name("H1"), Some(Zai::new(1, 1, 0)));
// U235 -> Z = 92, A = 235, I = 0
assert_eq!(Zai::from_name("U235"), Some(Zai::new(92, 235, 0)));
// Pu239 -> Z = 94, A = 239, I = 0
assert_eq!(Zai::from_name("Pu239"), Some(Zai::new(94, 239, 0)));
// Am242 -> Z = 95, A = 242, I = 0
assert_eq!(Zai::from_name("Am242"), Some(Zai::new(95, 242, 0)));
// Am242m1 -> Z = 95, A = 242, I = 1
assert_eq!(Zai::from_name("Am242m1"), Some(Zai::new(95, 242, 1)));
// Am242m1 -> Z = 95, A = 242, I = 2
assert_eq!(Zai::from_name("Am242m2"), Some(Zai::new(95, 242, 2)));
Sourcepub fn from_id(id: u32) -> Option<Self>
pub fn from_id(id: u32) -> Option<Self>
Creates a new nuclide identifier from nuclide’s id.
§Format
ID = Z × 10000 + A × 10 + I
with:
Z
: atomic numberA
: mass numberI
: isomeric state number
§Returns
Some(zai)
ifid
is a conformant nuclide’s idNone
otherwise
§Examples
use nkl::core::Zai;
// H1 -> Z = 1, A = 1, I = 0
assert_eq!(Zai::from_id(10010), Some(Zai::new(1, 1, 0)));
// U235 -> Z = 92, A = 235, I = 0
assert_eq!(Zai::from_id(922350), Some(Zai::new(92, 235, 0)));
// Pu239 -> Z = 94, A = 239, I = 0
assert_eq!(Zai::from_id(942390), Some(Zai::new(94, 239, 0)));
// Am242 -> Z = 95, A = 242, I = 0
assert_eq!(Zai::from_id(952420), Some(Zai::new(95, 242, 0)));
// Am242m1 -> Z = 95, A = 242, I = 1
assert_eq!(Zai::from_id(952421), Some(Zai::new(95, 242, 1)));
// Am242m2 -> Z = 95, A = 242, I = 2
assert_eq!(Zai::from_id(952422), Some(Zai::new(95, 242, 2)));
Sourcepub fn atomic_number(&self) -> u32
pub fn atomic_number(&self) -> u32
Returns atomic number Z
.
§Examples
use nkl::core::Zai;
let zai = Zai::new(1, 2, 0);
assert_eq!(zai.atomic_number(), 1);
Sourcepub fn mass_number(&self) -> u32
pub fn mass_number(&self) -> u32
Returns mass number A
.
§Examples
use nkl::core::Zai;
let zai = Zai::new(1, 2, 0);
assert_eq!(zai.mass_number(), 2);
Sourcepub fn isomeric_state_number(&self) -> u32
pub fn isomeric_state_number(&self) -> u32
Returns isomeric state number I
.
§Examples
use nkl::core::Zai;
let zai = Zai::new(1, 2, 0);
assert_eq!(zai.isomeric_state_number(), 0);
Sourcepub fn id(&self) -> u32
pub fn id(&self) -> u32
Returns nuclide ID
.
§Format
Nuclide ID is given by:
ID = Z × 10000 + A × 10 + I
with:
Z
: atomic numberA
: mass numberI
: isomeric state number
§Examples
use nkl::core::Zai;
let h1 = Zai::new(1, 1, 0);
assert_eq!(h1.id(), 10010);
let u235 = Zai::new(92, 235, 0);
assert_eq!(u235.id(), 922350);
let am242m1 = Zai::new(95, 242, 1);
assert_eq!(am242m1.id(), 952421);
let am242m2 = Zai::new(95, 242, 2);
assert_eq!(am242m2.id(), 952422);
Sourcepub fn protons(&self) -> u32
pub fn protons(&self) -> u32
Sourcepub fn neutrons(&self) -> u32
pub fn neutrons(&self) -> u32
Returns number of neutrons N = A - Z
.
§Examples
use nkl::core::Zai;
let tritium = Zai::new(1, 3, 0);
assert_eq!(tritium.neutrons(), 2);
Sourcepub fn nucleons(&self) -> u32
pub fn nucleons(&self) -> u32
Sourcepub fn as_tuple(&self) -> (u32, u32, u32)
pub fn as_tuple(&self) -> (u32, u32, u32)
Converts ZAI
to (Z, A, I)
tuple.
§Examples
use nkl::core::Zai;
let zai = Zai::new(1, 2, 0);
assert_eq!(zai.as_tuple(), (1, 2, 0));
Sourcepub fn into_tuple(self) -> (u32, u32, u32)
pub fn into_tuple(self) -> (u32, u32, u32)
Converts ZAI
into (Z, A, I)
tuple.
§Examples
use nkl::core::Zai;
let zai = Zai::new(1, 2, 0);
assert_eq!(zai.into_tuple(), (1, 2, 0));
Sourcepub fn is_ground_state(&self) -> bool
pub fn is_ground_state(&self) -> bool
Returns true
if the nuclide identifier isomeric state I
is 0
.
§Examples
use nkl::core::Zai;
let tc99 = Zai::new(43, 99, 0);
assert!(tc99.is_ground_state());
Sourcepub fn is_metastable_state(&self) -> bool
pub fn is_metastable_state(&self) -> bool
Returns true
if the nuclide identifier isomeric state I
is not 0
.
§Examples
use nkl::core::Zai;
let tc99m1 = Zai::new(43, 99, 1);
assert!(tc99m1.is_metastable_state());
Trait Implementations§
Source§impl Ord for Zai
impl Ord for Zai
Source§impl PartialOrd for Zai
impl PartialOrd for Zai
impl Copy for Zai
impl Eq for Zai
impl StructuralPartialEq for Zai
Auto Trait Implementations§
impl Freeze for Zai
impl RefUnwindSafe for Zai
impl Send for Zai
impl Sync for Zai
impl Unpin for Zai
impl UnwindSafe for Zai
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