1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
|
.. _Examples:
.. |C_alpha| replace:: C\ :sub:`α`
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.
.. _Example-MolecularDynamics:
- Molecular Dynamics examples
- The program
:doc:`argon.py <Examples/MolecularDynamics/argon.py>`
contains a simulation of liquid argon at constant temperature and
pressure.
- The program
:doc:`protein.py <Examples/MolecularDynamics/protein.py>`
contains a simulation of a small (very small) protein in vacuum.
- The program
:doc:`restart.py <Examples/MolecularDynamics/restart.py>`
shows how the simulation started in
:doc:`protein.py <Examples/MolecularDynamics/protein.py>`
can be continued.
- The program
:doc:`solvation.py <Examples/MolecularDynamics/solvation.py>`
contains the solvation of a protein by water molecules.
.. _Example-MonteCarlo:
- Monte-Carlo examples
- The program
:doc:`backbone.py <../Examples/MonteCarlo/backbone.py>`
generates an ensemble of backbone configuration (C-alpha atoms only)
for a protein.
.. _Example-Trajectories:
- Trajectory examples
- The program
:doc:`snapshot.py <../Examples/Trajectories/snapshot.py>`
shows how a trajectory can be built up step by step from arbitrary
data.
- The program
:doc:`dcd_import.py <../Examples/Trajectories/dcd_import.py>`
converts a trajectory in DCD format (used by the programs CHARMM,
X-Plor, and NAMD) to MMTK's format.
- The program
:doc:`dcd_export.py <../Examples/Trajectories/dcd_export.py>`
converts an MMTK trajectory to DCD format (used by the programs CHARMM,
X-Plor, and NAMD).
- The program
:doc:`pdb_export.py <../Examples/Trajectories/pdb_export.py>`
converts an MMTK trajectory to a sequence of PDB files.
- The program
:doc:`trajectory_average.py <../Examples/Trajectories/trajectory_average.py>`
calculates an average structure from a trajectory.
- The program
:doc:`trajectory_extraction.py <../Examples/Trajectories/trajectory_extraction.py>`
reads a trajectory and writes a new one containing only a subset of the
original universe.
- The program
:doc:`view_trajectory.py <../Examples/Trajectories/view_trajectory.py>`
shows an animation of a trajectory, provided that an external molecule
viewer with animation is available.
- The program
:doc:`calpha_trajectory.py <../Examples/Trajectories/calpha_trajectory.py>`
shows how a much smaller |C_alpha|-only trajectory can be extracted from
a trajectory containing one or more proteins.
- The program
:doc:`fluctuations.py <../Examples/Trajectories/fluctuations.py>`
shows how to calculate atomic fluctuations from a trajectory file.
.. _Example-NormalModes:
- Normal mode examples
- The program
:doc:`modes.py <../Examples/NormalModes/modes.py>`
contains a standard normal mode calculation for a small protein.
- The program
:doc:`constrained_modes.py <../Examples/NormalModes/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
:doc:`calpha_modes.py <../Examples/NormalModes/calpha_modes.py>`
contains a normal mode calculation for a mid-size protein using a
|C_alpha| model and an elastic network model.
- The program
:doc:`harmonic_force_field.py <../Examples/NormalModes/harmonic_force_field.py>`
contains a normal mode calculation for a protein using a detailed
but still simple harmonic force field.
.. _Example-Proteins:
- Protein examples
- The program
:doc:`construction.py <../Examples/Proteins/construction.py>`
shows some more complex examples of protein construction from PDB files.
- The program
:doc:`analysis.py <../Examples/Proteins/analysis.py>`
demonstrates a few analysis techniques for comparing protein
conformations.
.. _Example-DNA:
- DNA examples
- The program
:doc:`construction.py <../Examples/DNA/construction.py>`
contains the construction of a DNA strand with a ligand.
.. _Example-Forcefield:
- Forcefield examples
- Electric field term
- A pure Python implementation (rather slow in general, but
tolerable for a simple term like this one) is given in
:doc:`Python/ElectricField.py <../Examples/Forcefield/ElectricField/Python/ElectricField.py>`.
- A more efficient implementation has the evaluation code written
in Cython (:doc:`Cython/MMTK_electric_field.pyx
<../Examples/Forcefield/ElectricField/Cython/MMTK_electric_field.pyx>`)
while the bookkeeping part remains in Python (:doc:`Cython/ElectricField.py <../Examples/Forcefield/ElectricField/Cython/ElectricField.py>`).
- Harmonic oscillator term
- A pure Python implementation (rather slow in general, but
tolerable for a simple term like this one) is given in
:doc:`Python/HarmonicOscillatorFF.py <../Examples/Forcefield/HarmonicOscillator/Python/HarmonicOscillatorFF.py>`.
- A more efficient implementation has the evaluation code written
in Cython (:doc:`Cython/MMTK_harmonic_oscillator.pyx
<../Examples/Forcefield/HarmonicOscillator/Cython/MMTK_harmonic_oscillator.pyx>`)
while the bookkeeping part remains in Python (:doc:`Cython/HarmonicOscillatorFF.py <../Examples/Forcefield/HarmonicOscillator/Cython/HarmonicOscillatorFF.py>`).
.. _Example-MPI:
- MPI examples (parallelization)
- The program :doc:`md.py <../Examples/MPI/md.py>`
contains a parallelized version of :doc:`solvation.py <../Examples/MolecularDynamics/solvation.py>`.
.. _Example-MDIntegrator:
- Molecular Dynamics integrators
- The program :doc:`md.py <../Examples/MDIntegrator/VelocityVerlet.pyx>`
illustrates how Molecular Dynamics integrators can be implemented
in Cython.
.. _Example-LangevinDynamics:
- Langevin dynamics integrator
- The programs
:doc:`LangevinDynamics.py <../Examples/LangevinDynamics/LangevinDynamics.py>`
and :doc:`MMTK_langevinmodule.c <../Examples/LangevinDynamics/MMTK_langevin.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.
.. _Example-Visualization:
- Visualization examples
- The program
:doc:`additional_objects.py <../Examples/Visualization/additional_objects.py>`
describes the addition of custom graphics objects to the representation
of a molecular system.
- The program
:doc:`vector_field_chimera.py <../Examples/Visualization/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
:doc:`vector_field_vmd.py <../Examples/Visualization/vector_field_vmd.py>`
does the same but uses the graphics program VMD.
- The program
:doc:`graphics_data.py <../Examples/Visualization/graphics_data.py>`
shows how to use a fake graphics module to extract numerical values
from a vector field object.
.. _Example-Miscellaneous:
- Micellaneous examples
- The example
:doc:`charge_fit.py <../Examples/Miscellaneous/charge_fit.py>`
demonstrates fitting point charges to an electrostatic potential
energy surface.
- The program
:doc:`construct_from_pdb.py <../Examples/Miscellaneous/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
:doc:`lattice.py <../Examples/Miscellaneous/lattice.py>`
constructs molecules placed on a lattice.
- The program
:doc:`vector_field.py <../Examples/Miscellaneous/vector_field.py>`
shows how vector fields can be used in the analysis and visualization
of collective motions.
|