Code Examples
One of the best ways to learn how to use a new tool is to look at
examples. The examples given in this manual were adapted from
real-life MMTK applications. They are also contained in the
MMTK distribution (directory “Examples”) for direct use and modification.
The example molecules, system sizes, parameters, etc.,
were chosen to reduce execution time as much as possible, in order to
enable you to run the examples interactively step by step to see how
they work. If you plan to modify an example program for your own use,
don’t forget to check all parameters carefully to make sure that you
obtain reasonable results.
- Molecular Dynamics examples
- The file
argon.py
contains a simulation of liquid argon at constant temperature and
pressure.
- The file
protein.py
contains a simulation of a small (very small) protein in vacuum.
- The file
restart.py
shows how the simulation started in
protein.py
can be continued.
- The file
solvation.py
contains the solvation of a protein by water molecules.
- Monte-Carlo examples
- The program
backbone.py
generates an ensemble of backbone configuration (C-alpha atoms only)
for a protein.
- Trajectory examples
- The file
snapshot.py
shows how a trajectory can be built up step by step from arbitrary
data.
- The file
dcd_import.py
converts a trajectory in DCD format (used by the programs CHARMM,
X-Plor, and NAMD) to MMTK’s format.
- The file
dcd_export.py
converts an MMTK trajectory to DCD format (used by the programs CHARMM,
X-Plor, and NAMD).
- The file
trajectory_average.py
calculates an average structure from a trajectory.
- The file
trajectory_extraction.py
reads a trajectory and writes a new one containing only a subset of the
original universe.
- The file
view_trajectory.py
shows an animation of a trajectory, provided that an external molecule
viewer with animation is available.
- The file
calpha_trajectory.py
shows how a much smaller Cα-only trajectory can be extracted from
a trajectory containing one or more proteins.
- The file
modes.py
contains a standard normal mode calculation for a small protein.
- The file
constrained_modes.py
contains a normal mode calculation for a small protein using a model
in which each amino acid residue is rigid.
- The file
calpha_modes.py
contains a normal mode calculation for a mid-size protein using a
Cα model and an elastic network model.
- The file
harmonic_force_field.py
contains a normal mode calculation for a protein using a detailed
but still simple harmonic force field.
- Protein examples
- The file
construction.py
shows some more complex examples of protein construction from PDB files.
- The file
analysis.py
demonstrates a few analysis techniques for comparing protein
conformations.
- DNA examples
- The file
construction.py
contains the construction of a DNA strand with a ligand.
- Forcefield examples
- Electric field term
- Harmonic oscillator term
- MPI examples (parallelization)
- Molecular Dynamics integrators
- The file md.py
illustrates how Molecular Dynamics integrators can be implemented
in Cython.
- Langevin dynamics integrator
- The files
LangevinDynamics.py
and MMTK_langevinmodule.c
implement a simple integrator for Langevin dynamics. It is meant as an
example of how to write integrators etc. in C,
but of course it can also be used directly.
- The file
additional_objects.py
describes the addition of custom graphics objects to the representation
of a molecular system.
- Micellaneous examples
- The example
charge_fit.py
demonstrates fitting point charges to an electrostatic potential
energy surface.
- The file
construct_from_pdb.py
shows how a universe can be built from a PDB file in such a way that
the internal atom ordering is compatible. This is important for exchanging
data with other programs.
- The file
lattice.py
constructs molecules placed on a lattice.
- The file
vector_field.py
shows how vector fields can be used in the analysis and visualization
of collective motions.