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 program argon.py contains a simulation of liquid argon at constant temperature and pressure.
    • The program protein.py contains a simulation of a small (very small) protein in vacuum.
    • The program restart.py shows how the simulation started in protein.py can be continued.
    • The program 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 program snapshot.py shows how a trajectory can be built up step by step from arbitrary data.
    • The program dcd_import.py converts a trajectory in DCD format (used by the programs CHARMM, X-Plor, and NAMD) to MMTK’s format.
    • The program dcd_export.py converts an MMTK trajectory to DCD format (used by the programs CHARMM, X-Plor, and NAMD).
    • The program pdb_export.py converts an MMTK trajectory to a sequence of PDB files.
    • The program trajectory_average.py calculates an average structure from a trajectory.
    • The program trajectory_extraction.py reads a trajectory and writes a new one containing only a subset of the original universe.
    • The program view_trajectory.py shows an animation of a trajectory, provided that an external molecule viewer with animation is available.
    • The program calpha_trajectory.py shows how a much smaller Cα-only trajectory can be extracted from a trajectory containing one or more proteins.
    • The program fluctuations.py shows how to calculate atomic fluctuations from a trajectory file.
  • Normal mode examples
  • The program modes.py contains a standard normal mode calculation for a small protein.
  • The program constrained_modes.py contains a normal mode calculation for a small protein using a model in which each amino acid residue is rigid.
  • The program calpha_modes.py contains a normal mode calculation for a mid-size protein using a Cα model and an elastic network model.
  • The program harmonic_force_field.py contains a normal mode calculation for a protein using a detailed but still simple harmonic force field.
  • Protein examples
    • The program construction.py shows some more complex examples of protein construction from PDB files.
    • The program analysis.py demonstrates a few analysis techniques for comparing protein conformations.
  • DNA examples
    • The program construction.py contains the construction of a DNA strand with a ligand.
  • MPI examples (parallelization)
  • Molecular Dynamics integrators
    • The program md.py illustrates how Molecular Dynamics integrators can be implemented in Cython.
  • Langevin dynamics integrator
    • The programs 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.
  • Visualization examples
  • The program additional_objects.py describes the addition of custom graphics objects to the representation of a molecular system.
  • The program vector_field_chimera.py shows how to create a vector-field visualization of a normal mode using the graphics program Chimera for visualization. The program vector_field_vmd.py does the same but uses the graphics program VMD.
  • The program graphics_data.py shows how to use a fake graphics module to extract numerical values from a vector field object.
  • Micellaneous examples
    • The example charge_fit.py demonstrates fitting point charges to an electrostatic potential energy surface.
    • The program 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 program lattice.py constructs molecules placed on a lattice.
    • The program vector_field.py shows how vector fields can be used in the analysis and visualization of collective motions.

Previous topic

Glossary

Next topic

Module Reference

This Page