research python chemistry 12 June 2017

Chemical kinetics with python

Exploring chemical reaction kinetics with Python

Chemical reactions is what nearly all branches of chemistry are dealing with on daily basis. They provide a fundamental framework to express observable changes of matter in a quantitative manner.

\begin{align} A & \xrightarrow{k_1} B \\ A & \xrightarrow{k_2} C \\ \end{align}

leading to the set of kinetic equations

\begin{align} \frac{d[A]}{dt} &= -(k_1 + k_2) [A] \\ \frac{d[B]}{dt} &= k_1 [A] \\ \frac{d[C]}{dt} &= k_2 [A] \\ \end{align}

with a solution new

\begin{align} [A] &= [A]_{0} e^{-(k_1 + k_2)t} \\ [B] &= \frac{k_1}{k_1 + k_2} [A]_{0} \left(1 - e^{-(k_1 + k_2)t}\right) \\ [C] &= \frac{k_2}{k_1 + k_2} [A]_{0} \left(1 - e^{-(k_1 + k_2)t}\right) \\ \end{align}

in python

import numpy as np
import scipy as sp

def function(args):
    pass

or in fortran

use newmodule

write(*, *) "hello world"