## Thursday, December 5, 2013

### Compiling Open Babel with Python bindings

Use the commands below to compile Open Babel with python bindings:

git clone git://github.com/openbabel/openbabel.git
cd openbabel
mkdir build
cd build
cmake -DRUN_SWIG=ON -DPYTHON_BINDINGS=ON \
-DCMAKE_INSTALL_PREFIX=/opt/openbabel  -DENABLE_TESTS=ON ..
make
make test
sudo make install

Export these variables to use your newly compiled Open Babel:

export PYTHONPATH=/opt/openbabel/lib/python2.7/site-packages:\$PYTHONPATH export LD_LIBRARY_PATH=/opt/openbabel/lib:\$LD_LIBRARY_PATH
export PATH=/opt/openbabel/bin:\$PATH ## Wednesday, December 4, 2013 ### Constraint optimization in Python with Open Babel This post is just a quick post to show, how you can optimize molecules with harmonic constraints in Python with Open Babel. This requires Open Babel to be compiled with Python SWIG-bindings. There are three types of constraints, distances, angles and torsions. Here is a gist that might help get you started. Acknowledgements: Kasper Thofte pretty much wrote the above gist back in the days. ## Saturday, November 9, 2013 ### My best, fastest and awesomest way of including matplotlib in Latex If you use this post you will accomplish the following: 1. Be able Include loss-less vector graphics in your Latex document (good). 2. Be able to select text inside figures with mouse (awesome). 3. Compile your latex document with figures faster (probably). 4. Make your files smaller and of higher quality (mostly). 5. That's it. The rest is up to you! I see many people still using .eps files from matplotlib in their otherwise nicely formatted Latex document. Forget this. From this post on we use matplotlib figures in .pdf format. It works exactly as with .eps or .png or what else you might be using: Let's also use pdflatex for compiling (just replace the latex command): andersx@awesome:~/my_paper$ pdflatex mypaper.tex


This will also compile much faster than standard latex (using, say, .png-files), since you are now including something that is already in pdf-format.

Last two steps are (1) to save your file as a .pdf-file and (2) autocrop the white borders (loss-less). Step one is accomplished using standard matplotlib/pylab/etc. syntax. The 2nd part is done using a tool called pdfcrop (which is already included in you have latex installed). I prefer to call pdfcrop from within the Python script to avoid having to run more than one command each time I make a new figure.
The above is some boilerplate code. The result is:

andersx@awesome:~/my_paper$python my_figure.py PDFCROP 1.33, 2012/02/01 - Copyright (c) 2002-2012 by Heiko Oberdiek. ==> 1 page written on my_file.pdf'. andersx@awesome:~/my_paper$`

Now you have a beautifully formatted pdf-file to include in  your latex document.

I might edit this post later with a bit of bling and YOLO/swag just to give it the attractive combination of vitality and glamour it deserves.

## Monday, October 28, 2013

### Hybrid RHF/MP2 geometry optimizations with the Effective Fragment Molecular Orbital Method

This is a short post on a paper we are submitting to PLOS ONE. It is of course already (and have been for quite some time) available from arXiv:

========================================================================

Anders S. Christensen, Casper Steinmann, Dmitri G. Fedorov, Jan H. Jensen
The frozen domain Effective Fragment Molecular Orbital method (PLoS ONE (2013) 8(4):e60602) is extended to allow for the treatment of a single fragment at the MP2 level of theory. The approach is applied to the conversion of chorismate to phrephenate by chorismate mutase, where the substrate is treated at the MP2 level of theory while the rest of the system is treated at the RHF level. MP2 geometry optimization is found to lower the barrier by up to 3.5 kcal/mol compared to RHF optimzations and ONIOM energy refinement and leads to smoother convergence with respect to basis set for the reaction profile. For double zeta basis sets the increase in CPU time relative to RHF is roughly a factor of two.
========================================================================

Short summary:

We present a new layering scheme for fragment based calculations in GAMESS using the Fragment Molecular Orbital (FMO) and Effective Fragment Molecular Orbital (EFMO), in which the molecular system is divided into four parts - see figure below.

We are then able to optimize the geometry of a reaction complex (H in Fig. 1) in chorismate mutase at the MP2 level while simultaneously optimizing the geometry of the surrounding environment (A in Fig. 1) which is in turn embedded into a polarizable domain (b in Fig. 1) with frozen geometry, which in turn is embedded inside a non-polarizable, frozen-geometry domain (F. in Fig. 1).

We are treating the system at the MP2 level on the reaction complex and Hartree-Fock level on the rest of the system. As an example we calculate the reaction path of conversion of chorismate to prephenate in chorismate mutase.
The increase in computational load is rougly a factor of two, compared to a Hartree-Fock-only calculation.

The method will be available with a new keyword, but the final name is yet to be decided. There will be a blog post on this later if/when I get this in the official GAMESS distribution.

Figure 1: F denotes the frozen domain (green); b denotes the polarizable domain (blue); A denotes the active domain (red); H 2 A denotes fragment H, for which the MP2 energy and gradients are evaluated (yellow).