Expand description
A library for representing chemical compositions, managing elemental formulae and generating (coarse) isotopic patterns.
§Chemical Compositions
use chemical_elements::{ChemicalComposition, ElementSpecification};
let mut composition = ChemicalComposition::parse("H2O")?;
composition["C"] = 6;
composition["O"] = 6;
composition["H"] = 12;
assert!((composition.mass() - 180.06339).abs() < 1e-6);
§Isotopic Distributions
use chemical_elements::{ChemicalComposition, PROTON};
use chemical_elements::isotopic_pattern::isotopic_variants;
let composition = ChemicalComposition::parse("C34H53O15N7")?;
// Use the guessed number of peaks
let peaks = isotopic_variants(composition, 0, 1, PROTON);
for peak in peaks.iter() {
println!("{}", peak);
}
assert_eq!(peaks.len(), 6);
Modules§
- isotopic_
pattern - Implementations of isotopic pattern generator algorithms.
Structs§
- Chemical
Composition Map - Represents a collection of element-count pairs as found in a flat
chemical formula. Built atop
std::collections::HashMap
, and support addition and subtraction with other instances of the same type and multiplication by integers. - Chemical
Composition Vec - Represents a collection of element-count pairs as found in a flat
chemical formula. Built atop
std::collections::HashMap
, and support addition and subtraction with other instances of the same type and multiplication by integers. - Chemical
Elements - A helper data structure that encapsulates
a
PeriodicTable
, along with some pre-parsedElementSpecification
andChemicalComposition
instances for convenience. - Element
- A chemical element with known masses and isotopic frequency.
- Element
Specification - A hashable key referencing an element with a specific isotope
state.
element
is theElement
represented, andisotope
is the isotope number, though 0 means monoisotopic. - Isotope
- A known isotope of an element with a known number of neutrons, mass, and relative abundance
- Periodic
Table - A mapping connecting
Element
to its textual symbol.