[MMTK] another HarmonicDihedralRestraint problem
Konrad Hinsen
hinsen at cnrs-orleans.fr
Tue Apr 28 08:27:01 UTC 2009
On 28.04.2009, at 00:47, Qadir Timerghazin wrote:
> I seem to have another problem with dihedral harmonic restraints -
> everything works perfectly if the angle is constrained at a value
> sufficiently far from 180. However, if the constraint is around
> 170-180 degrees then the integration routine goes crazy and eventually
> crashes. By the looks of it, this is somehow related to the
> constrained angle measurement becoming ambiguous: it switches from
> around -180 to +180 and back. This behaviour is fairly consistent for
> different systems. Below is an artificial example to demonstrate the
> problem.
Thanks for the report and the demonstration code! That one was easy
to fix, here is the patch if you want to apply it to your current
MMTK installation:
diff -r b80fa008e74d Src/bonded.c
--- a/Src/bonded.c Wed Apr 15 09:37:43 2009 +0200
+++ b/Src/bonded.c Tue Apr 28 10:23:55 2009 +0200
@@ -1,7 +1,7 @@
/* Low-level force field calculations: bonded interactions
*
* Written by Konrad Hinsen
- * last revision: 2008-1-28
+ * last revision: 2009-4-22
*/
#define NO_IMPORT
@@ -425,6 +425,9 @@
if (n == 0) {
phi = acos(cos_phi)*sign_phi;
dphi = phi-param[1];
+ dphi = fmod(dphi+2.*M_PI, 2.*M_PI);
+ if (dphi > M_PI)
+ dphi -= 2*M_PI;
e += param[3]*sqr(dphi);
}
else {
Konrad.
--
---------------------------------------------------------------------
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