# 3. Preparations¶

## 3.1. Python interpreter: ipython¶

In the following we are using ipython as our interactive Python interpreter 1. 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)

Start ipython:

ipython  --matplotlib


Inside ipython, load numpy

import numpy as np


as we will constantly make use of its capabilities.

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


Footnotes

1

If you do not have ipython installed then you can install it. If you are using the Conda installation):

conda install -n mdaenv ipython


and if you are using the Pip installation:

pip install --user ipython