Expand description
Information on chemical elements and their isotopes
§Mendeleev
Mendeleev is a crate containing all known chemical elements as an enum and as a list, as well as methods that return some properties for each of them.
§Example
Get data on a specific element
use mendeleev::Element;
let element = Element::Si;
assert_eq!(element.atomic_number(), 14);
assert_eq!(element.name(), "Silicon");
assert_eq!(format!("{}", element.electronic_configuration()), "[Ne] 3s² 3p²");
§Example
Search the list of elements
use mendeleev::{Element, Kelvin};
// Find the element with the highest value for a given property
let highest_melting_point = Element::iter().reduce(|acc, e| {
core::cmp::max_by(acc, e, |e1, e2| {
e1.melting_point()
.unwrap_or(Kelvin(0.0))
.total_cmp(&e2.melting_point().unwrap_or(Kelvin(0.0)))
})
});
assert_eq!(highest_melting_point, Some(Element::W));
// Iterate through the elements with no known year of discovery
let mut ancient_elements = Element::iter()
.filter(|e| matches!(e.year_discovered(), mendeleev::YearDiscovered::Ancient));
assert_eq!(ancient_elements.next(), Some(Element::C));
assert_eq!(ancient_elements.next(), Some(Element::Al));
// Find an element by name
let iron = Element::iter().find(|e| e.name().eq_ignore_ascii_case("iron"));
assert_eq!(iron, Some(Element::Fe));
It also contains most of the known isotopes for each element (naturally occurring, synthetic, or theoretical), accessible via a similar API as the elements themselves.
§Available data
§Elements
- Symbol
- Name (in American English)
- Atomic number
- Atomic radius
- Atomic weight
- RGB color in the CPK and Jmol conventions
- Position in the periodic table (period and group)
- Melting and boiling point
- Heat of fusion and evaporation
- Electronic configuration
- Discovery data (year, location, discoverers)
§Isotopes
- Corresponding element
- Relative natural abundance on Earth
- Mass number
- Neutron number
- Half-life
§Features
- No unsafe code
- No required dependencies
- Optional support for
serde
- All properties are
const
or'static
- Compatible with no-std
- Most types implement
Display
- No
build.rs
file. All the data is directly in the code - Each of the available properties has its own file that can be excluded from the build with a feature flag, to reduce binary size and compilation time when not all properties are needed
- Numeric properties are accompanied by constants providing the range of values they can take
- Documentation, tests, and examples
§Data sources
The data available in this crate comes from the following sources:
-
Density, electron affinity, and ionization energy:
- National Center for Biotechnology Information (2023). Periodic Table of Elements. Retrieved April 15, 2023 from https://pubchem.ncbi.nlm.nih.gov/periodic-table/.
-
Other properties:
- PyPI package mendeleev, version 1.0.0. https://pypi.org/project/mendeleev/1.0.0/.
For the data sources used by the PyPI package, see https://mendeleev.readthedocs.io/en/latest/data.html
Note that this crate is not maintained by the same authors as the PyPI package.
§Contributing
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.
§License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Structs§
- Color
- A 24-bit color value stored as R, G, and B bytes
- Electronic
Configuration - The electronic configuration of an atom
- Electronvolt
- A value in electronvolts (eV).
- Gram
PerCubic Centimeter - A value in grams per cubic centimeter (g/cm³).
- Half
Life - An isotope’s half-life
- Kelvin
- A value in Kelvin (K).
- Kilo
Joule PerMole - A value in kilojoules per mole (kJ/mol).
- Percent
- A value in percent (%).
- Picometer
- A value in picometers (pm).
- Subshell
- A subshell (s, p, d, or f) in the electronic configuration
Enums§
- Atomic
Weight - The Standard Atomic Weight as defined by the CIAAW
- Element
- Each of the known chemical elements
- Group
- Each group in the periodic table
- Isotope
- Each theoretical or observed isotope of the known chemical elements
- Oxidation
State Category - The category of the oxidation state, to distinguish common and uncommon states
- Subshell
Label - Electron subshell type, based on the azimuthal quantum number ℓ
- Time
Unit - A unit of time
- Year
Discovered - The year in which an element was discovered, if known
Constants§
- ALL_
ELEMENTS - Array containing all elements, ordered by atomic number
- ALL_
GROUPS - Array containing all periodic table groups, ordered by group number
- ALL_
ISOTOPES - Array containing all isotopes, ordered by atomic number and then mass number
- ATOMIC_
NUMBER_ RANGE - Range from the minimum to the maximum atomic number across all elements
- ATOMIC_
RADIUS_ RANGE - Range from the minimum to the maximum atomic radius across all elements
- ATOMIC_
WEIGHT_ RANGE - Range from the minimum to the maximum atomic weight across all elements
- BOILING_
POINT_ RANGE - Range from the minimum to the maximum boiling point across all elements
- DENSITY_
RANGE - Range from the minimum to the maximum density across all elements
- ELECTRON_
AFFINITY_ RANGE - Range from the minimum to the maximum electron affinity across all elements
- EVAPORATION_
HEAT_ RANGE - Range from the minimum to the maximum evaporation heat across all elements
- FUSION_
HEAT_ RANGE - Range from the minimum to the maximum fusion heat across all elements
- IONIZATION_
ENERGY_ RANGE - Range from the minimum to the maximum ionization energy across all elements
- ISOTOPE_
MASS_ NUMBER_ RANGE - Range from the minimum to the maximum mass number across all isotopes
- ISOTOPE_
NATURAL_ ABUNDANCE_ RANGE - Range from the minimum to the maximum natural abundance across all isotopes
- ISOTOPE_
NEUTRON_ NUMBER_ RANGE - Range from the minimum to the maximum neutron number across all isotopes
- MELTING_
POINT_ RANGE - Range from the minimum to the maximum melting point across all elements
- N_
ELEMENTS - The total number of known chemical elements
- N_
GROUPS - The total number of groups in the periodic table
- N_
ISOTOPES - The total number of known isotopes across all elements
- N_
PERIODS - The total number of periods in the periodic table
- YEAR_
DISCOVERED_ RANGE - Range from the minimum to the maximum known year of discovery across all elements