Crates.io | castep-periodic-table |
lib.rs | castep-periodic-table |
version | 0.5.2 |
source | src |
created_at | 2022-11-04 08:15:13.801554 |
updated_at | 2024-12-10 09:16:19.437343 |
description | Periodic-table-like database for relevant usage in CASTEP |
homepage | https://github.com/TonyWu20/castep-periodic-table |
repository | https://github.com/TonyWu20/castep-periodic-table |
max_upload_size | |
id | 704932 |
size | 75,439 |
A periodic table for use in CASTEP, written in rust.
Example Element
:
Element {
symbol: "C",
atomic_number: 6_u8,
lcao: 2_u8,
mass: 12.0109996796,
potential: "C_00PBE.usp",
spin: 0_u8,
}
extern crate castep_periodic_table as cpt;
use cpt::element::Element;
use cpt::data::ELEMENT_TABLE;
// Lookup element "Co" by symbol
let cobalt: &Element = ELEMENT_TABLE.get_by_symbol("Co").unwrap();
// Lookup element by atomic_number
let oxygen = ELEMENT_TABLE.get_by_atomic_number(8_u8).unwrap();
// Get fields
let lcao_cobalt: u8 = cobalt.lcao();
let mass_cobalt: f64 = cobalt.mass();
let spin: u8 = cobalt.spin();
let potential: &str = cobalt.potential();
// Iterator
// ELEMENT_TABLE.iter()...
Currently the crate only include C, H, O, transition metals and Lanthanides due to personal interest. It can be updated by modifying the element_table.yaml
and generate a new data.rs
with the provided method in ElementYamlTable
.