[MMTK] Change the number of frames in normal modes visualization

Konrad Hinsen hinsen at cnrs-orleans.fr
Mon Nov 12 16:14:49 UTC 2007

On 12.11.2007, at 14:37, Ramon Crehuet wrote:

> NormalModes.mode.view is a practical way of visualizing normal  
> modes. But I would like MMTK to use more frames when generating the  
> normal mode trajectory that is sent to the visualization software.  
> Is that possible in a simple way?

What do you want to change exactly? Do you want to repeat the frames  
to view several periods, or add intermediate steps for better spatial  

Anyway, the solution is very similar in both cases. The view() method  
ends up calling the function Visualization.viewMode(). Changing this  
function lets you specify whatever you want. An example (untested!):

import MMTK.Visualization

def myViewMode(mode, factor=1., subset=None, label=None):
     universe = mode.universe
     if subset is None:
         subset = universe
     conf = universe.configuration()
     frames = 2*[conf, conf+factor*mode, conf, conf-factor*mode]
     MMTK.Visualization.viewSequence(subset, frames, 1, label)

MMTK.Visualization.viewMode = myViewMode

This particular patch will show two periods of the mode. It should be  
straightforward to adapt it to what you want.

Konrad Hinsen
Centre de Biophysique Moléculaire, CNRS Orléans
Synchrotron Soleil - Division Expériences
Saint Aubin - BP 48
91192 Gif sur Yvette Cedex, France
Tel. +33-1 69 35 97 15
E-Mail: hinsen at cnrs-orleans.fr

More information about the mmtk mailing list