Molecular weight

Functions to calculate molecular weight of an element, compound, or gas mixture. Note that mole fractions must sum to one otherwise an error is raised.

chemics.molecular_weight(formula)[source]

Molecular weight.

Tokenize a molecular formula to determine total molecular weight. Calculation is based on atomic weight values from IUPAC [1].

Parameters:

formula (str) – Molecular formula or element

Returns:

mw (float) – Molecular weight of the formula or element in g/mol

Examples

>>> cm.molecular_weight('C')
12.011...
>>> cm.molecular_weight('CH4')
16.04...
>>> cm.molecular_weight('(NH4)2SO4')
132.13...

References