3 releases

0.1.2 Dec 24, 2022
0.1.1 Dec 24, 2022
0.1.0 Dec 19, 2022

#791 in Math

Apache-2.0

295KB
11K SLoC

About

This is a Rust library for chemistry.

Installation

Usage

Here's some sample code that shows how you can get the atomic mass, boiling point, and density of hydrogen.

/* Note: These snippets are untested */

use periodic_table_rs::HYDROGEN;

fn main() {
    println!("{}", HYDROGEN.atomic_mass);
    println!("{}", HYDROGEN.boiling_point);
    println!("{}", HYDROGEN.density);
}
/* Or, you can do this. */

use periodic_table_rs::{Element, PERIODIC_TABLE};

fn main() {
    const HYDROGEN: Element = PERIODIC_TABLE[0];

    println!("{}", HYDROGEN.atomic_mass);
    println!("{}", HYDROGEN.boiling_point);
    println!("{}", HYDROGEN.density);
}

Documentation

The documentation for this project is in its crates.io page. Here's a quick link to it.

Additional information

The element data in this library primarily came from PubChem with some of its missing fields filled in by the data from the Royal Society of Chemistry.

The combined and parsed element data from both these sources is in this json file and you can use it in your own projects if all you need is the raw element data :D

Dependencies

~1.5MB
~38K SLoC