Introduction to Chempy in Python
ChemPy is a python package designed mainly to solve problems in analytical, physical and inorganic Chemistry. It is a free, open-source Python toolkit for chemistry, chemical engineering, and materials science applications.
ChemPy includes classes for representing substances, reactions, and systems of reactions. It also includes well-established formulae from physical chemistry, as well as analytic solutions to some differential equations commonly encountered in chemical kinetics.
Its intended audience is primarily researchers and engineers who need to perform modeling work. But since the intermediate representations of, e.g., ODE systems and systems of non-linear equations are available symbolically, ChemPy may also be used in an educational setting.
Installation: ChemPy can be installed by running the following script in the Command Prompt / Terminal:
pip install chempy
Here are some examples of the application of the ChemPy module :
Example 1 : Printing a list of elements with their mass.
Atomic No. Name Symbol Mass 1 Helium He 4.002602 2 Lithium Li 6.94 3 Beryllium Be 9.0121831 4 Boron B 10.81 5 Carbon C 12.011 6 Nitrogen N 14.007 7 Oxygen O 15.999 8 Fluorine F 18.998403163 9 Neon Ne 20.1797 10 Sodium Na 22.98976928
Example 2 : Let us see how to represent chemical reactions in ChemPy. Consider the formation of water. In the reaction, 2 H2 molecules combine with an O2 molecule to form 2 H2 molecules. In ChemPy the reaction will be created using the Reaction() function of the chempy.chemistry module.
2 H2 + O2 -> 2 H2O 3