chembox.chembox

Module Contents

Functions

get_elements(molecule)

Convert a chemical molecule into its constituent elements with its respective counts as a dictionary.

is_valid(→ bool)

Check if the given string of a chemical molecule is chemically valid

get_molec_props(molecule)

Returns a dataframe with various atomic properties of each element in the molecule

get_combustion_equation(molecule)

Returns a dataframe with a balanced combustion equation for the given molecule.

Attributes

DATA_FOLDER

chembox.chembox.DATA_FOLDER
chembox.chembox.get_elements(molecule: str)[source]

Convert a chemical molecule into its constituent elements with its respective counts as a dictionary.

Parameters:

molecule (str) – Chemical molecule.

Returns:

The dictionary of each chemical elements with its molecular weight and count.

Return type:

dictionary

Examples

>>> from chembox import get_elements
>>> get_elements('(C2H4)5')
{'H': 20, 'C': 10}
>>> get_elements('Al2(SO4)3')
{'O': 12, 'S': 3, 'Al': 2}
chembox.chembox.is_valid(molecule: str) bool[source]

Check if the given string of a chemical molecule is chemically valid

Parameters:

molecule (str) – Input chemical molecule

Returns:

is_valid – True if the chemical molecule is valid and false otherwise

Return type:

bool

Examples

>>> from chembox.chembox import is_valid
>>> is_valid('CH')
False
chembox.chembox.get_molec_props(molecule: str)[source]

Returns a dataframe with various atomic properties of each element in the molecule

Parameters:

molecule (str) – Input chemical molecule as a string ready to be parsed

Returns:

reduced_df – A pandas dataframe containing the properties of the molecule.

Return type:

dataframe

Examples

>>> from chembox import get_molec_props
>>> get_molec_props('CH4')
| Symbol |   Name   | AtomicNumber | AtomicMass | Density(g/cm3) | AtomicRadius(pm) |    Config        | ShellConfig | OxiStates |
|   C        |  Carbon      |       6          |   12.011   |     2.26700    |       67.0       | [He] 2s2 2p2 |    2,4,,,,, | -4,-3,-2,-1,0,1,2,3,4 |
|   H        | Hydrogen     |       1          |    1.008   |     0.00009    |       53.0       |      1s1     |     1,,,,,, | 1 |
chembox.chembox.get_combustion_equation(molecule: str)[source]

Returns a dataframe with a balanced combustion equation for the given molecule.

Parameters:

molecule (str) – Input chemical molecule as a string ready to be parsed

Returns:

comb_df – A dataframe containing the balanced coefficients of the combustion equation relating to the molecule.

Return type:

dataframe

Examples

>>> from chembox.chembox import get_combustion_equation
>>> get_combustion_equation('C5H12')
| C5H12 | O2 | CO2 | H2O |
|   1   |  8 |  5  |  6  |