[MMTK] Speeding Up Subset Energy Evaluation

Konrad Hinsen konrad.hinsen at cea.fr
Thu Mar 16 16:46:15 CET 2006

On Mar 16, 2006, at 16:27, Rocco Moretti wrote:

> for it. For example, on the single-processor machine I'm currently  
> working on, the initial calls to universe.energy() with residue- 
> sized groups takes about 13 sec each, whereas recalling with the  
> same objects takes less than 0.001 seconds each. Not bad if you're  
> recalling 99.9% of the time, but a killer if every call requires a  
> setup.

The setup code is slow for two reasons:
1) I never even considered optimizing it, because I assumed that  
nobody would care.
2) The force field and evaluator interfaces are very general and  

> At this point, I'm left with examining the evaluator setup code and  
> seeing if I can optimize anything for my particular situation. Any  
> hints?

Since the setup code is 100% Python, I suggest first using the Python  
profiler to find out what really slows your calculations down. Some  
stuff may be trivial to optimize - as I said, I never even looked at  

The module you will want to look at is MMTK.ForceFields.MMForceField,  
which contains most of the initialization code. The Amber force field  
merely adds the handling of the Amber parameter files.

Konrad Hinsen
Laboratoire Léon Brillouin, CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: konrad.hinsen at cea.fr

More information about the mmtk mailing list