[MMTK] implementing new force field

Konrad Hinsen hinsen at cnrs-orleans.fr
Thu Nov 8 11:11:53 UTC 2007

On Nov 8, 2007, at 2:54, Olivier Delaire wrote:

> I have been looking in to the Python and C force-field classes, but
> these are rather intimidating. Presently, it seems to me that the
> nonbonded.c file could be extended to treat that kind of force-field,
> but I am unsure wether assumptions in other places in the package will
> break if I try to modify it... Also, I am not entirely sure wether I
> should start with the 'bonded' or 'nonbonded' types of force fields.

As a general rule, I don't recommend modifying any of MMTK's files.  
It is preferable to keep additional force field terms outside of  
MMTK. Of course, you can still start from a copy of an MMTK file if  
you prefer.

Another point to consider is that your force field resembles neither  
the bonded nor the nonbonded term in MMTK. You would not necessarily  
gain much from using either one as a starting point.

I suggest that you start with an analysis of what needs to be  
calculated and where the required information comes from. Every force  
field term in MMTK has to do two things:

1) Calculate the energy and gradients (plus second derivatives if you  
need them) for a given atom configuration using a set of parameters.

2) Calculate the parameters from the universe and its contents.

The first part is executed frequently and should therefore be written  
in C or Pyrex. The second part (logically the first one) is executed  
only once and can very well be implemented in Python.

My suggestion is to start writing the Python part. Once you have all  
the required parameters, the structure of the C/Pyrex code for the  
energy calculation is usually quite clear.

In your application, I suspect that the force field parameters are  
the lattice parameters (which define the equilibrium positions of all  
atoms) plus the Taylor expansion coefficients per atom type. However,  
you might simplify the evaluation code (at the cost of using more  
memory) by precalculating the equilibrium positions from the lattice  

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