mailr11384 - /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 29, 2010 - 16:11:
Author: bugman
Date: Thu Jul 29 16:11:51 2010
New Revision: 11384

URL: http://svn.gna.org/viewcvs/relax?rev=11384&view=rev
Log:
The align_tensor.display() user function now prints out the generalized 
degree of order (GDO) value.


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=11384&r1=11383&r2=11384&view=diff
==============================================================================
--- 1.3/generic_fns/align_tensor.py (original)
+++ 1.3/generic_fns/align_tensor.py Thu Jul 29 16:11:51 2010
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2009 Edward d'Auvergne                                  
 #
+# Copyright (C) 2003-2010 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -25,8 +25,9 @@
 
 # Python module imports.
 from copy import deepcopy
-from math import pi
+from math import pi, sqrt
 from numpy import arccos, dot, float64, linalg, zeros
+from numpy.linalg import norm
 from re import search
 import sys
 
@@ -417,6 +418,10 @@
         title = "# Geometric description."
         print("\n\n" + title + '\n' + '#'*len(title) + '\n')
 
+        # The GDO.
+        print("# Generalized degree of order (GDO).")
+        print("GDO = %-25.12e\n" % gdo(data.A))
+
         # Anisotropy.
         print("# Alignment tensor axial component (Aa = 3/2 * Azz, where Aii 
are the eigenvalues).")
         print("Aa = %-25.12e\n" % data.Aa)
@@ -525,6 +530,22 @@
         elif cdp.align_tensors.beta_sim[sim_index] <= cdp.align_tensors.beta 
- pi/2.0:
             cdp.align_tensors.alpha_sim[sim_index] = pi - 
cdp.align_tensors.alpha_sim[sim_index]
             cdp.align_tensors.beta_sim[sim_index] = 
cdp.align_tensors.beta_sim[sim_index] + pi
+
+
+def gdo(A):
+    """Calculate the generalized degree of order (GDO) for the given 
alignment tensor.
+
+    @param A:   The alignment tensor.
+    @type A:    rank-2, 3D numpy array
+    @return:    The GDO value.
+    @rtype:     float
+    """
+
+    # The matrix norm.
+    gdo = sqrt(3.0/2.0) *  norm(A)
+
+    # Return the GDO.
+    return gdo
 
 
 def get_tensor_index(tensor, pipe=None):




Related Messages


Powered by MHonArc, Updated Thu Jul 29 18:00:03 2010