[MMTK] modes to numpy arrays

Konrad Hinsen research at khinsen.fastmail.net
Mon Sep 5 12:15:41 UTC 2011

On 5 Sep, 2011, at 11:49 , Ramon Crehuet wrote:

> Thanks for your help. I finally used numpy.asarray() as it is a clearer representation of the modes. By the way, is there any example that projects a trajectory onto the normal modes? I think it is simple to code but I was a bit worried about performance. That's why I am asking if there is already something implemented.

There is some mode projection code in MMTK.Tools.TrajectoryViewer (look at line 973), but it isn't particularly optimized. It does


for each mode and each step in the trajectory, starting from EnergeticModes and thus avoiding the mass-weighting issues inherent to VibrationalModes.

For performance, assuming that you have a long trajectory but a not too large set of normal modes, the best solution is what you probably do already: make an array containing the selected modes and calculate the dot product with each step in the trajectory. In principle you can also eliminate the loop over the steps, but this will require enormous amounts of memory for real-life systems.

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: research AT khinsen DOT fastmail DOT net

More information about the mmtk mailing list