For many of projects I need specialized code that I could not find anywhere else. In the (faint) hope that my efforts might be useful to others as well and to allow anyone to reproduce my own results I make my software available here.

Release source code archives are found on this page. The source code history and current development version for most packages can be accessed directly via my git repositories at Please use the Issue Tracker associated with a package for feature requests and bug reports. Thanks!

The software accessible through this page is Copyright © 2001-2010 Oliver Beckstein and is made available under the terms of the GNU General Public License, unless otherwise noted in the package. Please see the files README and INSTALL which accompany each package, or the comments at the top of the files. If you require different licensing terms please contact me.

Hop[top][site menu]

Hydration network around CRBPII

Hop is a python package based on MDAnalysis to analyze solvation dynamics as outlined at Biophysics 2009 in the poster presentation Quantitative Analysis of Water Dynamics in and near Proteins, Oliver Beckstein, Naveen Michaud-Agrawal and Thomas B. Woolf, doi:10.1016/j.bpj.2008.12.3147.

The package will be made available here and on Inquiries for beta-testing can be directed to me. Beta-testers can file bugs and requests for enhancements through the Issue Tracker.

Lipidbook[top][site menu] is a public repository for force field parameters with a special emphasis on lipids, detergents, and similar molecules that are of interest when simulating biological membranes. It acts as a warehouse for parameter files that are supplied by the community.

Lipidbook is described in

Lipid in a box (Lipidbook logo)

MDAnalysis[top][site menu]

MDAnalysis is a versatile, object-oriented Python toolkit for analyzing Molecular Dynamics trajectories. It makes it easy to develop new tools that go beyond what is typically found in established packages. It can deal with a number of file formats, including Gromacs, CHARMM, LAMMPS, Amber, NAMD trajectories and coordinates, and PDB and PQR files.

It is hosted at, including Online Documentation, a source code repository, and the MDAnalysis Issue Tracker.

The paper on MDAnalysis explains the philosophy and general layout of the toolkit together with a number of examples:

Paper Errata

Note that the Python code in the online html version of the paper is useless because the crucial indentation of Python was not preserved in the conversion process. The PDF version is mostly correct although the final formatted version ended up with a few line breaks that are illegal in the Python syntax. The free PubmedCentral version (available April 2012), however, contains perfectly formatted Python code.

Corrected code is listed here (and on the MDAnalysis Paper Errata page) and can also be found in the examples that are part of the MDAnalysis package. If you find further problems then please let us know by filing an issue in the MDAnalysis Issue Tracker or contacting me by email.

page 4: Writing the coordinates of a selection
universe.selectAtoms("byres (resname SOL and around 3.5 protein)").write("solvation-shell.pdb")
page 5: Block average example
def blocked(universe, nblocks, analyze): 
    size = universe.trajectory.numframes/nblocks
    blocks = [] 
    for block in xrange(nblocks): 
        a = [] 
        for ts in u.trajectory[block*size:(block+1)*size]: 
    blockaverage = numpy.average(blocks) 
    blockstd = numpy.std(blocks) 
    return nblocks, size, blockaverage, blockstd
Radius of gyration analysis function
def rgyr(universe): 
    return universe.selectAtoms("protein").radiusOfGyration()
Time series analysis
data = universe.trajectory.correl(\
    MDAnalysis.collection, skip=10)
page 6: radial distribution function
The normaliation is not correct in the simplified example in the paper; use examples/ from the distribution.
Table 1
CHARMM has a way to calculate 3D densities using the COORdinates ANALysis ... IHIS facility. The table states incorrectly that CHARMM can not presently carry out this kind of calculations.

GromacsWrapper[top][site menu]

GromacsWrapper is a python framework for running the Gromacs tools from within python scripts. This is by no means revolutionary but it allows for better error handling than in, say, shell scripts. It also makes it feasible to modularize and re-use small building blocks. Finally, it makes for nice interactive use in ipython.

A source code repository is hosted at, which also contains the GromacsWrapper Issue Tracker for reports of bugs and feature requests.

gridcount[top][site menu]

water in a pore model, contoured at 0.01 bulk density

gridcount is an analysis tool for Gromacs that creates 3D (number) densities from molecular dynamics trajectories. Typically, this is used to look at the density of water or ions near proteins or in channels and pores (left: water density in a model pore, contoured at 0.01 of the bulk density, and right radially averaged density). The package consists of two programs, g_ri3Dc and a_ri3Dc.
water in a pore model, contoured at 0.01 bulk density g_ri3Dc counts occurrences of molecules on a 3D grid over a MD trajectory. A typical application is to choose the water index group as the molecules to be counted. This creates (after proper normalisation) a 3D density map. The map is written in a system-independent (xdr) grid file for once and all.
The grid file is read in by a_ri3Dc, a simple analysis and converter tool. At the moment it is mainly useful to calculate cylindrical and slice averages and convert the density map into gOpenMol's plt format, which can also be read by VMD (from version 1.8.2 onwards). Alternatively, it also outputs the whole grid in ASCII format. 1D graphs can be displayed with xmgrace and for 2D data, parameter and data files are written, which are suitable for xfarbe.
a_gridcalc (in version 1.1) can average densities generated with g_ri3Dc (and provides framework code for further grid manipulations).

If you want to access densities in Python then you can install my GridDataFormats package, which can read the gOpenMol plt files and makes data available as NumPy arrays. (GridDataFormats can also be found on PyPi/GridDataFormats so you can simply install it with easy_install GridDataFormats or pip install GridDataFormats.)

The source code repository is at You can download the latest development version from there, too. Please file bug reports and feature requests through the gridcount Issue Tracker.

When you use gridcount please cite


gridcount-gmx4.5-1.4 (2011-01-19)
Updated for use with Gromacs 4.5 (compiles with Gromacs 4.5.3). Function was not tested extensively—please provide feedback! This release is available from the git repository in the gromacs_4.5 branch. Get the code with git:
git clone -b gromacs_4.5
Alternatively, download a tarball of the repository snapshot: gridcount-gmx4.5-1.4.tar.gz.
gridcount-gmx4.0-1.3a (2010-10-13)
gridcount-gmx4.0-1.2 (2010-08-05)
gridcount-gmx4.0-1.1 (2010-03-03)
gridcount-gmx4.0-1.0 (2010-02-18)
gridcount-1.1.3 (2008-05-08)
compiles with Gromacs 3.3.3 (tested on Mac OS X). (Sorry, I don't have the time to make versions properly backward compatible with older Gromacs versions. Just email me if you have problems.) Try gridcount-1.1.3.tar.gz with Gromacs 3.3.3.
gridcount-1.1.1 (2007-05-16)
version was quickly modified to compile with Gromacs 3.3.1 (tested on Mac OS X). Because it uses gmx_fatal() instead of fatal_error() it probably won't compile with older Gromacs versions (pre 3.3 I imagine). Try the 1.1.1 version gridcount-1.1.1.tar.gz with Gromacs 3.3.1.
gridcount-1.0.1 (2006-01-10)
version of these programs were compiled and tested with Gromacs 3.1.4 and Gromacs 3.2.1 under Red Hat 8.0 Linux and Debian Linux. Download the 1.0.1 version as gridcount-1.0.1.tar.bz2 [42 kB] (compiles with Gromacs 3.2.1) or from the Gromacs contributions page (probably slightly outdated 1.0 version).
>See the list of gridcount releases for the appropriate sources or the gridcount download page on github.

g_count and g_flux[top][site menu]

g_count and g_flux are simple Gromacs tools that are primarily useful to characterize movement of water inside a cylindrical region. This can be the pore of an ion channel or a carbon nanotube. g_count returns statistics about how many atoms of a certain type (for instance, water oxygens) occupied the region of interest. g_flux calculates the flux through a cylindrical region. g_zcoord is a dumb piece of code that just prints z-coordinates of atoms in a cylindrical region; it should be easy enough to add additional functionality.

g_flux is more sophisticated than g_count and gives more detailed information but you are encouraged to check that the reported results agree with what you can see in your system. For instance, get the indices of translocating particles and then track them in a trajectory viewer such as VMD.

Detailed documentation can be found in the help functions for each program (run it with -h). Background information (slighly outdated for the current g_count-gmx4.5 release) can be found in the appendix (pdf) of my thesis.

A source code repository is hosted at, which also contains the g_count Issue Tracker for reports of bugs and feature requests.

When you use g_flux/g_count please cite


g_count-gmx4.0-6 (2010-12-03)
g_count-gmx4.5 (2009-07-22)
g_count-gmx4.4 (2009-07-02)
g_count-gmx4.3 (2009-06-24)
g_count-gmx4.2 (2009-06-15)
g_count-0.3 (2009-01-19)
g_count-0.2 (2008-01-14)
Updated to run with Gromacs 3.x
g_count-0.1 (2006-01-10)
Initial released version.

Earlier versions of g_count are functionally identical to g_count-0.3 but compile against earlier versions of Gromacs. See the README.

> g_count-gmx4.0-6.tar.bz2 should compile against Gromacs 4.x (tested with 4.0.7) or g_count-0.3.tar.bz2 for Gromacs 3.3.3 (but note that in this version g_flux acts as if the cylinder had an infinite radius).

gmx_rescue64[top][site menu]

gmx_rescue is a small program, which originated on the gmx-l mailing list. It was cleaned up by Marc Baaden. It allows one to read accross errors in xtc trajectory files, eg when gmxcheck complains Fatal error: Magic Number Error in XTC file (read 0, should be 1995) or similarly, Reading frame ... Floating point exception. gmx_rescue64 is a modified version, which can cope with large files on Linux (> 2GB). The strategy to salvage the good frames is simple:

  1. Read up to the last known good frame and extract the frames with trjconv.
  2. Then use gmx_rescue64 to get all the frames after the broken ones.
  3. gmxcheck the new fragment. If more errors come up, repeat with 1.
  4. Finally, trjcat all xtc segments that you accumulated.

Note, that this will leave holes in your xtc where your atoms will appear to jump. That might or might not severly influence your subsequent analysis.

> Download gmx_rescue64-1.3.tar.gz [9 kB] (just gmx_recue64), or the whole package gmx_rescue.tgz from Marc Baaden's download page, or from the Gromacs contributions page (the gmx_rescue_LFS package, but it might contain an older version of gmx_rescue64).

Parts of gmx_rescue is © 2003 Marc Baaden; parts of gmx_rescue64 is © 2003 Marc Baaden, 2004 Oliver Beckstein.

gromacsified wham[top][site menu]

Apply this patch to Alan Grossfield's wham code so that it can be used with the pdo.gz files that are output by Gromacs' umbrella sampling code. There are two versions of the patch. The older one works for Alan's 1.x code base, the newer one is based on his 2.0.2 release. Note that my patch only applies to the 1D-wham code; the 2D-wham is unchanged.

Download the appropriate patch and do the following (for the new 2.0.2 wham)

mkdir wham_gmx
cd wham_gmx
tar -zxvf ../wham-release-2.0.2.tgz
bunzip2 -c ../gromacsified_wham_2.0.2-ob1.diff.bz2 | patch -p0
This should apply cleanly without problems (just make sure to execute the patch command in the directory in which the directories `wham', `wham-2d', `nr' , `doc' appear). Then compile the 1d-wham that can read pdo.gz files:
cd wham
make PREFIX=${HOME} install

The last line will install the wham binary under ~/bin/wham. Just running wham without arguments will give you usage information.

wham requires a so-called meta data file as input. The script in the scripts/ directory automatically creates this file from a list of pdo (or pdo.gz) files. There's also a program for testing the code in extras/fakepmf; see wham/README.txt and the source code for details.

>Download the patch gromacsified_wham_2.0.2-ob1.diff.bz2 for the latest wham release 2.0.2 (or the deprecated gromacsified_wham_1.x.diff.bz2)

Python code[top][site menu]

Some packages that are required for other packages (such as RecSQL) can be automatically installed from this directory with Easy Install:
easy_install -f PACKAGE_NAME
Typically, these packages are also hosted on PyPI and therefore a simple
easy_install PACKAGE_NAME
should be tried first.
> Browse the Python code directory.

scriptlets[top][site menu]

A number of bash functions and shell or perl scripts that I use and haven't seen somewhere else (but then again, I didn't look too hard...). Feel free to take what you need but remember that it DOES NOT COME WITH ANY WARRANTY, NEITHER EXPLICITLY NOR IMPLICITLY IMPLIED. Documentation is provided through standard usage notes (try -h or --help) and of course through, erm, self-documenting source.

> Browse the scriptlets directory for something useful.

unsorted Gromacs code[top][site menu]

Direct access to my Gromacs code download directory; maybe you find something useful. Good luck!

> Browse the Gromacs code directory.
Last modified: 2011-06-13 by Oliver Beckstein

Valid HTML 4.01! Valid CSS! Made with Cascading
Style Sheets