| 1 | Information on chemical elements and their isotopes |
| 2 | |
| 3 | [](https://crates.io/crates/mendeleev) |
| 4 | [](https://gitlab.com/ygor.souza/mendeleev/-/commits/main) |
| 5 | [](https://docs.rs/mendeleev) |
| 6 | [](https://github.com/rust-secure-code/safety-dance/) |
| 7 | [](https://crates.io/crates/mendeleev) |
| 8 | |
| 9 | # Mendeleev |
| 10 | |
| 11 | Mendeleev is a crate containing all known chemical elements as an enum |
| 12 | and as a list, as well as methods that return some properties for each |
| 13 | of them. |
| 14 | |
| 15 | ### Example |
| 16 | |
| 17 | Get data on a specific element |
| 18 | |
| 19 | ```rust |
| 20 | use mendeleev::Element; |
| 21 | |
| 22 | let element = Element::Si; |
| 23 | assert_eq!(element.atomic_number(), 14); |
| 24 | assert_eq!(element.name(), "Silicon"); |
| 25 | assert_eq!(format!("{}", element.electronic_configuration()), "[Ne] 3s² 3p²"); |
| 26 | ``` |
| 27 | |
| 28 | ### Example |
| 29 | |
| 30 | Search the list of elements |
| 31 | |
| 32 | ```rust |
| 33 | use mendeleev::{Element, Kelvin}; |
| 34 | |
| 35 | // Find the element with the highest value for a given property |
| 36 | let highest_melting_point = Element::iter().reduce(|acc, e| { |
| 37 | core::cmp::max_by(acc, e, |e1, e2| { |
| 38 | e1.melting_point() |
| 39 | .unwrap_or(Kelvin(0.0)) |
| 40 | .total_cmp(&e2.melting_point().unwrap_or(Kelvin(0.0))) |
| 41 | }) |
| 42 | }); |
| 43 | assert_eq!(highest_melting_point, Some(Element::C)); |
| 44 | |
| 45 | // Iterate through the elements with no known year of discovery |
| 46 | let mut ancient_elements = Element::iter() |
| 47 | .filter(|e| matches!(e.year_discovered(), mendeleev::YearDiscovered::Ancient)); |
| 48 | assert_eq!(ancient_elements.next(), Some(Element::C)); |
| 49 | assert_eq!(ancient_elements.next(), Some(Element::Al)); |
| 50 | |
| 51 | // Find an element by name |
| 52 | let iron = Element::iter().find(|e| e.name().eq_ignore_ascii_case("iron")); |
| 53 | assert_eq!(iron, Some(Element::Fe)); |
| 54 | |
| 55 | ``` |
| 56 | |
| 57 | It also contains most of the known isotopes for each element (naturally |
| 58 | occurring, synthetic, or theoretical), accessible via a similar API as the |
| 59 | elements themselves. |
| 60 | |
| 61 | ## Available data |
| 62 | |
| 63 | ### Elements |
| 64 | |
| 65 | - Symbol |
| 66 | - Name (in American English) |
| 67 | - Atomic number |
| 68 | - Atomic radius |
| 69 | - Atomic weight |
| 70 | - RGB color in the CPK and Jmol conventions |
| 71 | - Position in the periodic table (period and group) |
| 72 | - Melting and boiling point |
| 73 | - Heat of fusion and evaporation |
| 74 | - Electronic configuration |
| 75 | - Discovery data (year, location, discoverers) |
| 76 | |
| 77 | ### Isotopes |
| 78 | |
| 79 | - Corresponding element |
| 80 | - Relative natural abundance on Earth |
| 81 | - Mass number |
| 82 | - Neutron number |
| 83 | |
| 84 | ## Features |
| 85 | |
| 86 | - No unsafe code |
| 87 | - No required dependencies |
| 88 | - Optional support for `serde` |
| 89 | - All properties are `const` or `'static` |
| 90 | - Compatible with no-std |
| 91 | - Most types implement `Display` |
| 92 | - No `build.rs` file. All the data is directly in the code |
| 93 | - Each of the available properties has its own file that can be excluded from |
| 94 | the build with a feature flag, to reduce binary size and compilation time |
| 95 | when not all properties are needed |
| 96 | - Numeric properties are accompanied by constants providing the range |
| 97 | of values they can take |
| 98 | - Documentation, tests, and examples |
| 99 | |
| 100 | ## Data sources |
| 101 | |
| 102 | The data from this crate comes from the following sources: |
| 103 | |
| 104 | - Density, electron affinity, and ionization energy: |
| 105 | - National Center for Biotechnology Information (2023). Periodic Table of |
| 106 | Elements. Retrieved April 15, 2023 from |
| 107 | <https://pubchem.ncbi.nlm.nih.gov/periodic-table/>. |
| 108 | |
| 109 | - Melting point, boiling point: |
| 110 | - PyPI package mendeleev, version 0.16.2. |
| 111 | <https://pypi.org/project/mendeleev/0.16.2/>. The data originally comes |
| 112 | from W.M. Haynes. CRC Handbook of Chemistry and Physics. CRC Press, 97th |
| 113 | edition, 2016. ISBN 9781498754293. |
| 114 | |
| 115 | - Other properties: |
| 116 | - PyPI package mendeleev, version 0.12.0. |
| 117 | <https://pypi.org/project/mendeleev/0.12.0/>. |
| 118 | |
| 119 | Note that this crate is not maintained by the same authors as the PyPI package. |
| 120 | |
| 121 | ## Contributing |
| 122 | |
| 123 | Unless you explicitly state otherwise, any contribution intentionally submitted |
| 124 | for inclusion in the work by you, as defined in the Apache-2.0 license, shall |
| 125 | be dual licensed as below, without any additional terms or conditions. |
| 126 | |
| 127 | ### License |
| 128 | |
| 129 | Licensed under either of |
| 130 | |
| 131 | - Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or |
| 132 | <https://www.apache.org/licenses/LICENSE-2.0>) |
| 133 | - MIT license ([LICENSE-MIT](LICENSE-MIT) or |
| 134 | <https://opensource.org/licenses/MIT>) |
| 135 | |
| 136 | at your option. |