IPython adds Web Interface to Python Programs or HowTo Run AICCM (ab initio Cyclic Cluster Model) from a Webbrowser

This December, the long awaited version 0.12 of IPython [1], an interactive Python shell has been released. The major highlight of this release is the IPython Notebook, an interactive Python
interface running in the browser, that connects to a running IPython Kernel. In principle, this adds a web interface to every Python program. To understand how amazing this is, just imagine how much it costs to develop a professional web interface for an application, called Notebooks. The only thing you need is the Tornado Web Server [2].
I will quickly demonstrate how to install Tornado and IPython and then show how to run a Python program from the web interface by running a quantum chemical calculation  with AICCM.
AICCM (ab initio Cyclic Cluster Model) [3] is an open source, object oriented,
educational quantum chemical program written in Python with C extensions. It is developed by me and my colleagues in the group of Prof. Bredow at the Mulliken Center for Theoretical Chemistry at the University of Bonn. In the following HowTo it is assumed that AICCM is installed on your system. For download and installation instructions on AICCM please go to the AICCM website.
1. Installation of Tornado:
– Get the latest version (2.1.1) of Tornado from the Tornado website.
wget https://github.com/downloads/facebook/tornado/tornado-2.1.1.tar.gz
– Then unpack and install it.
tar -zxvf tornado-2.1.1.tar.gz
cd tornado-2.1.1
python setup.py clean config build install –home=$HOME

– If you haven’t already done so, you need to add lib/python to your PYTHONPATH.

export PYTHONPATH=”$HOME/lib/python:$PYTHONPATH”

To make this permanent, add this line to your .bashrc or .zshrc, depending on the shell you use.

2. Installation of IPython
– Get IPython 0.12
wget http://archive.ipython.org/release/0.12/ipython-0.12.tar.gz
– Install IPython

tar -zxvf ipython-0.12.tar.gz
cd  ipython-0.12
python setup.py clean config build install –home=$HOME

3. Start IPython with enabled web interface
ipython notebook
IPython starts a webbrowser displaying the dash board where all Notebooks are listed.

Click on new Notebook. A new window opens where you can enter your Python code.

4. Running a calculation
A minimal input for AICCM calculating the Hartree-Fock total energy of the Nitrogen molecule is:

import ase
import aiccm
molecule = ase.Atoms(‘2N’, [(0., 0., 0.), (0., 0., 1.1)])
calc_AICCM = aiccm.aseinterface.AICCM()
molecule.set_calculator(calc_AICCM)
e_molecule = molecule.get_potential_energy()
print ‘Total Energy: %5.2f Hartree’ % e_molecule

Copy and paste this into the shell into the browser. The code is executed by pressing CTRL+ENTER.

If the session is saved it appears in your IPython dashboard after you hit the reload button!

This is awesome! A big thanks to the developers of IPython!

[1] http://ipython.org
[2] http://www.tornadoweb.org
[3] http://aiccm.de

2 Replies to “IPython adds Web Interface to Python Programs or HowTo Run AICCM (ab initio Cyclic Cluster Model) from a Webbrowser”

Leave a Reply to michael@peintinger.com Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.