[MMTK] HarmonicDihedralRestraint problems

Konrad Hinsen hinsen at cnrs-orleans.fr
Wed Apr 15 07:41:34 UTC 2009

On 08.04.2009, at 18:25, Qadir Timerghazin wrote:

> In fact, there are _two_ water molecules in my example, so there are 6
> atoms. The constrain is defined with:
> universe[0].H1, universe[0].O, universe[1].O, universe[1].H1 - note
> [0] and [1] indexes.

Ah, I see - that's in fact due to a bug in MMTK. Your script has two  
assignments to universe.molecule. The second one should overwrite the  
first one so that there is only one molecule in the end. I fixed this  
bug, so your water script will not work with future MMTK releases.  
You should use different attributes for each molecule:

	universe.mol1 = Molecule('water')
	universe.mol2 = Molecule('water')

or use anonymous molecules:


> FF modification file, which is inconvenient to post. Below is a
> protein example, which segfaults with the dihedral constraint.

That was in fact a trivial typo that was easy to fix. The fix will be  
in future releases, but you can apply the attached patch file to your  
current release as well.

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

diff -r 45a5e9e687bb MMTK/ForceFields/Restraints.py
--- a/MMTK/ForceFields/Restraints.py	Tue Apr 14 14:40:20 2009 +0200
+++ b/MMTK/ForceFields/Restraints.py	Wed Apr 15 09:28:58 2009 +0200
@@ -163,7 +163,7 @@
          params = self.evaluatorParameters(universe, subset1, subset2,
          assert len(params) == 1
-        indices = Numeric.array([params[:4]])
-        parameters = Numeric.array([params[4:]])
+        indices = Numeric.array([params[0][:4]])
+        parameters = Numeric.array([params[0][4:]])
          return [CosineDihedralTerm(universe._spec, indices,  

More information about the mmtk mailing list