mailr9246 - /1.3/generic_fns/align_tensor.py


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

Header


Content

Posted by edward on July 15, 2009 - 20:25:
Author: bugman
Date: Wed Jul 15 20:25:23 2009
New Revision: 9246

URL: http://svn.gna.org/viewcvs/relax?rev=9246&view=rev
Log:
The matrix_angles() function now avoids NaN problems through arccos of 
numbers > 1.


Modified:
    1.3/generic_fns/align_tensor.py

Modified: 1.3/generic_fns/align_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/align_tensor.py?rev=9246&r1=9245&r2=9246&view=diff
==============================================================================
--- 1.3/generic_fns/align_tensor.py (original)
+++ 1.3/generic_fns/align_tensor.py Wed Jul 15 20:25:23 2009
@@ -824,10 +824,15 @@
 
         # Second loop.
         for j in xrange(tensor_num):
-            # Skip the diagonal and arccos problems.
-            if i != j:
-                # The angle (in rad).
-                cdp.align_tensors.angles[i, j] = arccos(dot(matrix[i], 
matrix[j]))
+            # Dot product.
+            delta = dot(matrix[i], matrix[j])
+
+            # Check.
+            if delta > 1:
+                delta = 1
+
+            # The angle (in rad).
+            cdp.align_tensors.angles[i, j] = arccos(delta)
 
             # Print out the angles in degrees.
             sys.stdout.write("%8.1f" % (cdp.align_tensors.angles[i, 
j]*180.0/pi))




Related Messages


Powered by MHonArc, Updated Wed Jul 15 22:00:04 2009