Skip to main content

An easy-to-use library that quickly performs chemistry calculations.

Project description

chemlib

⚗️🔬👨‍🔬🧪
Chemistry Library

A pure Python package that supports a variety of functions pertaining to the vast field of chemistry.



Installation

Use the Python Package Installer (PyPI):

$ pip install -U chemlib

Features

  • Properties of all Elements
  • Compounds
    • Formula
    • Molar Mass
    • Percentage Composition by Mass
    • Stoichiometric Amounts
    • Oxidation States/Numbers
  • Empirical Formulae
    • Empirical Formula by Percentage Composition
    • Combustion Analysis of Hydrocarbons
  • Aqueous Solutions
    • Solute
    • Molarity (mol/L)
    • Stoichiometric Amounts
    • Dilutions
  • Chemical Reactions
    • Formula
    • Balancing the Equation
    • Combustion Reactions
    • Stoichiometric Amounts
    • Limiting Reagent
  • Electrochemistry
    • Galvanic (Voltaic) Cells
      • Anode, Cathode, Cell Potential, Diagram
    • Electrolysis
  • Quantum Mechanics
    • Electromagnetic Waves
      • Frequency, Wavelength, Energy per photon
    • Energy in nth Hydrogen Orbital
    • Rydberg Equation

Galvanic Cell Diagrams

Zn-Cu Galvanic Cell

Elements

>>> from chemlib import Element

>>> boron = Element('B')   #Declare Element from its symbol

>>> boron.properties
{'AtomicNumber': 5.0, 'Element': 'Boron', 'Symbol': 'B', 'AtomicMass': 10.811, 'Neutrons': 6.0, 'Protons': 5.0, 'Electrons': 5.0, 'Period': 2.0, 'Group': 13.0, 'Phase': 'solid', 'Radioactive': False, 'Natural': True, 'Metal': False, 'Nonmetal': False, 'Metalloid': True, 'Type': 'Metalloid', 'AtomicRadius': '1.2', 'Electronegativity': 2.04, 'FirstIonization': '8.298', 'Density': '2.34', 'MeltingPoint': '2573.15', 'BoilingPoint': '4200', 'Isotopes': 6.0, 'Discoverer': 'Gay-Lussac', 'Year': '1808', 'SpecificHeat': '1.026', 'Shells': 2.0, 'Valence': 3.0, 'Config': '[He] 2s2 2p1', 'MassNumber': 11.0}

>>> boron.AtomicMass
10.811

Compounds

>>> from chemlib import Compound

>>> nitric_acid = Compound("HNO3")

>>> nitric_acid.occurences
{'H': 1, 'N': 1, 'O': 3}

>>> nitric_acid.molar_mass()
63.01

>>> nitric_acid.percentage_by_mass('O')  #Get percentage composition by mass of a constituent element of choice
76.174

Stoichiometric conversions with compounds

Accepted inputs: grams, moles, and molecules

>>> from chemlib import Compound

>>> water = Compound('H2O')

>>> water.formula
'H₂O₁'

>>> water.get_amounts(grams = 2)
{'Compound': 'H₂O₁', 'Grams': 2, 'Moles': 0.111, 'Molecules': 6.685e+22}

>>> water.get_amounts(moles = 1)
{'Compound': 'H₂O₁', 'Grams': 18.01, 'Moles': 1, 'Molecules': 6.02e+23}

>>> water.get_amounts(molecules = 1.0e+24)
{'Compound': 'H₂O₁', 'Grams': 29.917, 'Moles': 1.6611, 'Molecules': 1e+24}

Balancing Chemical Reactions

>>> from chemlib import Compound, Reaction

>>> H2 = Compound('H2')
>>> O2 = Compound('O2')
>>> H2O = Compound('H2O')
>>> r = Reaction(reactants = [H2, O2], products = [H2O])

>>> r.formula
'1H₂ + 1O₂ --> 1H₂O₁'

>>> r.is_balanced
False

>>> r.balance()

>>> r.formula
'2H₂ + 1O₂ --> 2H₂O₁'

>>> r.is_balanced
True

Citing

If you use chemlib in your scientific work, please consider citing:

| H. R. Ambethkar, chemlib - A Python chemistry library , 2020-- . Available at: https://github.com/harirakul/chemlib.

The reference in the BibLaTeX format:

@software{chemlib2020,
   author = {Ambethkar, Hari},
   title = {{chemlib} -- A Python chemistry library},
   url = {https://github.com/harirakul/chemlib},
   version = {2.1.9},
   date = {2020--},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chemlib-2.2.3.tar.gz (102.8 kB view details)

Uploaded Source

Built Distribution

chemlib-2.2.3-py3-none-any.whl (100.4 kB view details)

Uploaded Python 3

File details

Details for the file chemlib-2.2.3.tar.gz.

File metadata

  • Download URL: chemlib-2.2.3.tar.gz
  • Upload date:
  • Size: 102.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for chemlib-2.2.3.tar.gz
Algorithm Hash digest
SHA256 d2630ae340630fccca2797eb61ad1db3b1d585b6806fda2d88418c9a5d5a90f7
MD5 f99d51eb415c288fb1221d5bf9bb83b8
BLAKE2b-256 5ee19aa3f9ede34605e0c00e96a13140577d72fd943c9cf10b9a2a1b5f478997

See more details on using hashes here.

File details

Details for the file chemlib-2.2.3-py3-none-any.whl.

File metadata

  • Download URL: chemlib-2.2.3-py3-none-any.whl
  • Upload date:
  • Size: 100.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for chemlib-2.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 185fdbb8f4cb3ade718b936c1c82ea6cc986a6f70d1cb0ee6b092ae5adb45d34
MD5 db4175bc01dd54c746d0985775e251b0
BLAKE2b-256 e5bb07a30ffd9ee295944b41cb0e9b49e37a24471b29ad6dca1560b75dd1a12e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page