Changes between Version 2 and Version 3 of Scripts/MMTK


Ignore:
Timestamp:
Sep 3, 2010, 1:17:36 PM (16 years ago)
Author:
Conrad Huang
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Scripts/MMTK

    v2 v3  
    1010}}}
    1111
    12 where ''molecule'' is a Chimera '''Molecule''' instance; ''atomMap'' is a dictionary whose keys are MMTK atoms and whose values are Chimera atoms; ''universe'' is a MMTK '''Universe''' instance; ''defaultCS'' is the default coordinate set index; and ''usePDBnames'' controls whether the conversion attempts to generate Protein Data Bank style atom names.  The default value for ''defaultCS'' is '''None''', which results in coordinate set numbering starting with zero.  The default value for ''usePDBnames'' is '''True'''.  The easiest way to see how '''MMTK2Molecule.convert''' may be used is through examples.  We We will describe two use cases: (a) visualizing normal modes results, and (b) monitoring energy minimization.
     12where ''molecule'' is a Chimera '''Molecule''' instance; ''atomMap'' is a dictionary whose keys are MMTK atoms and whose values are Chimera atoms; ''universe'' is a MMTK '''Universe''' instance; ''defaultCS'' is the default coordinate set index; and ''usePDBnames'' controls whether the conversion attempts to generate Protein Data Bank style atom names.  The default value for ''defaultCS'' is '''None''', which results in coordinate set numbering starting with zero.  The default value for ''usePDBnames'' is '''True'''.  The easiest way to see how '''MMTK2Molecule.convert''' may be used is through examples.  We We will describe two use cases: visualizing normal modes results, and monitoring molecular dynamics.
    1313
    14 For the first case, to visualize the results of the MMTK normal modes calculation example, we can create a Chimera trajectory of the molecule.  The trajectory represents a single normal mode and has four sequential steps (equilibrium position, positive extreme, equilibrium position, negative extreme).  When played, the trajectory will appear to oscillate between the two extremes.  For this example, we need two source files: [attachment:showNormalModes.py showNormalModes.py] and [attachment:NormalModesTable.py NormalModesTable.py].  [attachment:showNormalModes.py showNormalModes.py] consists of the MMTK sample normal mode code, followed by the lines:
     14== Visualizing Normal Modes ==
     15
     16To visualize the results of the MMTK normal modes calculation example, we can create a Chimera trajectory of the molecule.  The trajectory represents a single normal mode and has four sequential steps (equilibrium position, positive extreme, equilibrium position, negative extreme).  When played, the trajectory will appear to oscillate between the two extremes.  For this example, we need two source files: [attachment:showNormalModes.py showNormalModes.py] and [attachment:NormalModesTable.py NormalModesTable.py].  [attachment:showNormalModes.py showNormalModes.py] consists of the MMTK sample normal mode code, followed by the lines:
    1517
    1618{{{
     
    2123[attachment:NormalModesTable.py NormalModesTable.py] does all the work of the conversion from MMTK to Chimera, displaying the user interface, and updating trajectory coordinates when the user selects a different normal mode to display.
    2224
    23 For the second case, to follow the progress of a minimization run, we can create a Chimera molecule from the MMTK universe and update its atomic coordinates as minimization progresses.  To keep Chimera interactive, we can run the minimization in the background, and poll for atom coordinates changes every few display frames.  The example code is in [attachment:followMinimization.py followMinimization.py], which contains a mix of MMTK and Chimera code.
     25== Monitoring Molecular Dynamics ==
     26
     27To follow the progress of a molecular dynamics run, we can create a Chimera molecule from the MMTK universe and update its atomic coordinates as simulation progresses.  To keep Chimera interactive, we can run the simulation in the background, and poll for atom coordinates changes every few display frames.  The example code is in [attachment:followMD.py followMD.py], which contains a mix of MMTK and Chimera code.
     28
     29A more elaborate example, [attachment:plotMD.py plotMD.py], extends the previous example to include a plot of the system potential energy along with updating atomic coordinates.  The additional creates a '''matplotlib''' plot, and registers a callback function that is invoked whenever Chimera atomic coordinates are updated.  The arguments to the callback are (1) the MMTK universe, (2) a mapping from MMTK atoms to Chimera atoms, and (3) an MMTK state (which is '''None''' when the callback is invoked after the simulation ends).  The execution of plotMD.py is shown in [attachment:plotMD.mp4 plotMD.mp4].
     30
     31== Caveats ==
    2432
    2533There are a few caveats in using MMTK with Chimera:
    26  - The version of MMTK shipped with Chimera may not be the latest stable release.
     34 - The above examples are tested with a development version of MMTK dated September 1, 2010, and will only work with versions of Chimera built on that date or later.
    2735 - Use of MMTK threading with Chimera is not thoroughly tested.
    2836 - The code is intended as examples and may require modification for different applications.