chembox
usage¶
To use chembox
in a project, import all chembox
libraries:
from chembox.chembox import *
get_elements
function¶
The first step into calculating any chemical formulas is to get all fundamental chemistry elements. The get_elements
function extracts all fundamental elements from an input chemistry molecule and results in a dictionary of the composed elements and their counts.
# One substance combination
get_elements('(C2H4)5')
{'H': 20, 'C': 10}
# Two substance combination
get_elements('Al2(SO4)3')
{'O': 12, 'S': 3, 'Al': 2}
# Multiple of single substances
get_elements('LiH2')
{'H': 2, 'Li': 1}
is_valid
function¶
is_valid
function checks whether the given chemistry molecule is chemically valid based on periodic table.
# Calcium carbonate (a common salt)
is_valid('Al2(SO4)3')
True
# Sodium hydroxide (a common base)
is_valid('NaOH')
True
# Carbonic acid (a common acid)
is_valid('H2CO3')
True
get_molec_props
function¶
get_molec_props
function returns a dataframe with various atomic properties of each element in the molecule
get_molec_props('NaOH')
Symbol | Name | AtomicNumber | AtomicMass | Density(g/cm3) | AtomicRadius(pm) | Config | ShellConfig | OxiStates | |
---|---|---|---|---|---|---|---|---|---|
0 | H | Hydrogen | 1 | 1.008000 | 0.000090 | 53.0 | 1s1 | 1,,,,,, | 1 |
1 | O | Oxygen | 8 | 15.999000 | 0.001429 | 48.0 | [He] 2s2 2p4 | 2,6,,,,, | -2 |
2 | Na | Sodium | 11 | 22.989769 | 0.971000 | 190.0 | [Ne] 3s1 | 2,8,1,,,, | 1 |
get_molec_props('CaCl3')
Symbol | Name | AtomicNumber | AtomicMass | Density(g/cm3) | AtomicRadius(pm) | Config | ShellConfig | OxiStates | |
---|---|---|---|---|---|---|---|---|---|
0 | Ca | Calcium | 20 | 40.078 | 1.540000 | 194.0 | [Ar] 4s2 | 2,8,8,2,,, | 2 |
1 | Cl | Chlorine | 17 | 35.450 | 0.003214 | 79.0 | [Ne] 3s2 3p5 | 2,8,7,,,, | -1,1,3,5,7 |
get_molec_props('Al2(SO4)3(C2H4)5')
Symbol | Name | AtomicNumber | AtomicMass | Density(g/cm3) | AtomicRadius(pm) | Config | ShellConfig | OxiStates | |
---|---|---|---|---|---|---|---|---|---|
0 | Al | Aluminium | 13 | 26.981538 | 2.698000 | 118.0 | [Ne] 3s2 3p1 | 2,8,3,,,, | 3 |
1 | C | Carbon | 6 | 12.011000 | 2.267000 | 67.0 | [He] 2s2 2p2 | 2,4,,,,, | -4,-3,-2,-1,0,1,2,3,4 |
2 | H | Hydrogen | 1 | 1.008000 | 0.000090 | 53.0 | 1s1 | 1,,,,,, | 1 |
3 | O | Oxygen | 8 | 15.999000 | 0.001429 | 48.0 | [He] 2s2 2p4 | 2,6,,,,, | -2 |
4 | S | Sulfur | 16 | 32.060000 | 2.067000 | 88.0 | [Ne] 3s2 3p4 | 2,8,6,,,, | -2,2,4,6 |
get_combustion_equation
function¶
get_combustion_equation
function returns a dataframe with a balanced combustion equation for the given molecule.
get_combustion_equation('C2H4')
C2H4 | O2 | CO2 | H2O | |
---|---|---|---|---|
0 | 1 | 3 | 2 | 2 |
get_combustion_equation('C4H6')
C4H6 | O2 | CO2 | H2O | |
---|---|---|---|---|
0 | 2 | 11 | 8 | 6 |
get_combustion_equation('C5H12')
C5H12 | O2 | CO2 | H2O | |
---|---|---|---|---|
0 | 1 | 8 | 5 | 6 |