Table Of Contents

Previous topic

Installing MDAnalysis

Next topic

Basics

This Page

Preparations

Python interpreter

In the following we are using ipython as our interactive Python interpreter. It has a number of very useful features:

  • use the interactive help (command? or command??)

  • TAB completion, e.g. MDAnalysis.U<TAB> will autocomplete to MDAnalysis.Universe.

    MDAnalysis.Universe.<TAB> will show all methods and attributes.

  • quick plotting with matplotlib (and array manipulations with numpy)

  • notebook mode (future versions of this tutorial will likely be provided as ipython notebooks): ipython notebook --matplotlib=inline

Start ipython:

ipython  --matplotlib

Inside ipython, load numpy

import numpy as np

as we will constantly make use of its capabilities.

Loading MDAnalysis

MDAnalysis is primarily a library that provides means to work with particle-based simulation trajectories (including single frames such as PDB files). As such, it is mainly used

  1. in scripts
  2. for interactive use

In both cases, we always import the module MDAnalysis at the top level:

import MDAnalysis

(Not all sub-modules are imported automatically; for instance, analysis modules such as MDAnalysis.analysis.rms have to be imported explicitly.)

MDAnalysis comes with a bunch of test files and trajectories. One is a trajectory of the enzyme adenylate kinase that samples a transition from a closed to an open conformation [Beckstein2009], which we will use as an example throughout the tutorial. The topology file (CHARMM PSF format) and trajectory (CHARMM DCD format) can be loaded into the variables PSF and DCD:

from MDAnalysis.tests.datafiles import PSF, DCD