2025.1.18-1 • Published 12 months ago

@mat3ra/periodic-table v2025.1.18-1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
12 months ago

npm version PyPI version License: Apache

Periodic Table

Data about chemical elements arranged in JSON format. The module also contains modules for accessing data in both Python and JavaScript/TypeScript.

1. Installation

1.1. JavaScript

The package can be installed from NPM as follow:

npm install @mat3ra/periodic-table

1.2. Python

pip install mat3ra-periodic-table

2. Usage

2.1. JavaScript

import {PERIODIC_TABLE, ChemicalElement} from "@mat3ra/periodic-table";

console.log(PERIODIC_TABLE.H);

const li = new ChemicalElement("Li");
console.log(li.atomicRadiusIn("bohr"));

2.2. Python

from mat3ra.periodic_table import PERIODIC_TABLE
from mat3ra.periodic_table.bonds import ELEMENT_BONDS
from mat3ra.periodic_table.colors import ELEMENT_COLORS

assert PERIODIC_TABLE["H"]["name"] == "Hydrogen"
assert PERIODIC_TABLE["H"]["atomic_radius_pm"] == 25

bond = next(b for b in ELEMENT_BONDS if b["elements"] == ["H", "O"])
assert bond["energy"]["value"] == 4.75721615
assert bond["energy"]["units"] == "eV"
assert bond["length"]["value"] == 0.96
assert bond["length"]["units"] == "angstrom"

assert ELEMENT_COLORS["H"] == "#FFFFFF"  # white

3. Atomic Properties

4. Notes

  • Colors are in CPK convention

5. Contributions

This repository is an open-source work-in-progress and we welcome contributions.

6. ToDos

  • Add pre-commit hook to run python build_modules.py before commit

7. Links

  1. Periodic table original source: GPeriodic, Open source Linux software: link