[MMTK] MMTK - Implementing Shifted Leonard Jones potential

Konrad Hinsen hinsen at cnrs-orleans.fr
Thu Jun 10 13:50:42 CEST 2004

On Jun 9, 2004, at 19:48, Peter wrote:

> Clearly, if using a cutoff radius then there is a discontinuity in the
> potential at the cutoff point (r = r_cutoff).

Indeed. There is also a discontinuity in the gradients, which is more 
important for most algorithms. However, at 1/r^6 (energy) and 1/r^7 
(gradients), this rarely causes noticeable problems.

> I would like to use a continuous "Truncated Leonard Jones potential", 
> or
> "Shifted Leonard Jones potential" defined as follows:
> V_SLJ(r) = V_LJ(r) - V_LJ(r_cutoff)

Plus a similar shift for the forces, right?

> The Leonard Jones potential seems to be defined in 3 python files and
> two C files,
> MMTK\ForceFields\__init__.py
> MMTK\ForceFields\LennardJonesFF.py
> MMTK\ForceFields\NonBondedInteractions.py
> Src\MMTK_forcefield.c
> Src\nonbonded.c    (does actual potential calculation)
> The existing LJ forcefield is also tied into the AMBER94 Forcefield.

There are three layers in the force field stuff:

1) The C layer (MMTK_forcefield.c and nonbonded.c)
2) The generic Python layer (NonBondedInteractions.py)
3) The end-user force fields (LennardJonesFF.py and MMForceField.py, 
which is the base class for Amber94Forcefield)

> How would you suggest I go about adding the "Shifted Leonard Jones
> potential" to MMTK?
> (a) Editing the above files to include it, based on the existing LJ 
> code
> (b) Implement it independently of the existing LJ forcefield, basing 
> the
> module structure on the Harmonic Oscillator example forcefield.
If you want to use a pure Lennard-Jones system (i.e. LennardJonesFF), 
then it doesn't matter much except from the point of view of code 
distribution. If you want to use it together with other terms, than (a) 
is the only viable solution, as Lennard-Jones interactions are 
calculated inside the same loop as electrostatic interactions for 
efficiency reasons.

The only place where calculations are done is nonboded.c (check the 
macro pair_term). The other files only need to be modified to pass on 
some additional parameter.

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: hinsen at llb.saclay.cea.fr

More information about the mmtk mailing list