mailr11166 - in /1.3/maths_fns: pcs.py rdc.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on April 28, 2010 - 18:53:
Author: bugman
Date: Wed Apr 28 18:53:08 2010
New Revision: 11166

URL: http://svn.gna.org/viewcvs/relax?rev=11166&view=rev
Log:
Another fix for the huge bug identified in r11163.

This is for the PCS part - this was also using equal weights for all states 
set to pN!


Modified:
    1.3/maths_fns/pcs.py
    1.3/maths_fns/rdc.py

Modified: 1.3/maths_fns/pcs.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/maths_fns/pcs.py?rev=11166&r1=11165&r2=11166&view=diff
==============================================================================
--- 1.3/maths_fns/pcs.py (original)
+++ 1.3/maths_fns/pcs.py Wed Apr 28 18:53:08 2010
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2008 Edward d'Auvergne                                       
 #
+# Copyright (C) 2008, 2010 Edward d'Auvergne                                 
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -83,21 +83,17 @@
     # No weights given.
     if weights == None:
         pc = 1.0 / N
-
-    # Loop over the structures.
+        weights = [pc] * N
+
+    # Missing last weight.
+    if len(weights) < N:
+        pN = 1.0 - sum(weights, axis=0)
+        weights = weights.tolist()
+        weights.append(pN)
+
+    # Back-calculate the PCS.
     for c in xrange(N):
-        # The given weights.
-        if weights != None:
-            # Missing last weight.
-            if len(weights) < N: 
-                pc = 1.0 - sum(weights, axis=0)
-
-            # Given weight.
-            else:
-                pc = weights[c]
-
-        # Back-calculate the PCS.
-        val = val + pc * dj[c] * dot(vect[c], dot(A, vect[c]))
+        val = val + weights[c] * dj[c] * dot(vect[c], dot(A, vect[c]))
 
     # Return the average PCS.
     return val
@@ -149,21 +145,17 @@
     # No weights given.
     if weights == None:
         pc = 1.0 / N
-
-    # Loop over the structures.
+        weights = [pc] * N
+
+    # Missing last weight.
+    if len(weights) < N:
+        pN = 1.0 - sum(weights, axis=0)
+        weights = weights.tolist()
+        weights.append(pN)
+
+    # Back-calculate the PCS gradient element.
     for c in xrange(N):
-        # The given weights.
-        if weights != None:
-            # Missing last weight.
-            if len(weights) < N: 
-                pc = 1.0 - sum(weights, axis=0)
-
-            # Given weight.
-            else:
-                pc = weights[c]
-
-        # Back-calculate the PCS gradient element.
-        grad = grad + pc * dj[c] * dot(vect[c], dot(dAi_dAmn, vect[c]))
+        grad = grad + weights[c] * dj[c] * dot(vect[c], dot(dAi_dAmn, 
vect[c]))
 
     # Return the average PCS gradient element.
     return grad

Modified: 1.3/maths_fns/rdc.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/maths_fns/rdc.py?rev=11166&r1=11165&r2=11166&view=diff
==============================================================================
--- 1.3/maths_fns/rdc.py (original)
+++ 1.3/maths_fns/rdc.py Wed Apr 28 18:53:08 2010
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2008 Edward d'Auvergne                                       
 #
+# Copyright (C) 2008, 2010 Edward d'Auvergne                                 
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #




Related Messages


Powered by MHonArc, Updated Wed Apr 28 20:00:02 2010