Examples

Some commented example applications are provided ready-to-run with MMTK. New users are advised to study them and use them as a guideline for writing their own applications.

Standard tasks

The file dynamics.py shows how to produce a dynamics trajectory, a basic task in molecular modelling. First the system (in this case a single molecule in vacuum) is constructed and velocities at a low temperature are assigned. An equilibration step, consisting of dynamics integration with frequent velocity rescaling to a steadily increasing temperature, is followed by a production step in which a trajectory file is written. At the end the trajectory file is reopened and some information from it is printed.

The file solvent.py contains a more realistic and non-trivial application, which would already be difficult with some modelling programs. It constructs an equilibrated periodic water box from scratch. First a water box with a much lower density is constructed, with the molecules placed at random locations. A few minimization steps help to separate molecules that might be unreasonably close, and a standard equlibration step follows. Then the box is compressed in small steps until it reaches the correct volume. At each compression step, the center-of-mass positions of all molecules are scaled down by 5%, then a few minimization steps remove bad contacts, and an equilibration run reestablishes equilibrium. At the end the system is saved in a file for later reuse.

The file modes.py shows a typical normal mode calculation: minimization up to convergence followed by the normal mode calculation. In the end the frequencies are printed.

The file snapshot.py demonstrates how a trajectory can be assembled by explicitly writing individual configurations to it.

The file view_trajectory.py is not just an example, but a useful utility program. It takes the name of an MMTK trajectory file as an argument and shows an animation of it. Optional parameters indicate the first and last configuration and the number of configurations between two frames. No further input is nececssary, since MMTK trajectories contain everything necessary!

More specialized or complicated applications

This is where MMTK really shows its strengths. Study any of the applications below and consider how you would achieve the same goals with other tools!

The file protein_construction.py shows how non-standard protein models can be constructed from PDB files.

The file protein_analysis.py demonstrates typical analysis operations on protein conformations. To run it, you need the PDB entries 4q21 and 6q21. Put them into a directory called PDB and located anywhere on your MMTKPATH.

The file constrained_modes.py shows the test of an approximation: how does the imposition of mechanical constraints change the normal modes of a molecule? In the example the constraints are rigidity of each individual residue, which is a very drastic (and not very good) approximation. This is shown by comparing frequencies and atomic displacements with those of the full normal modes.


Table of contents