mailr2685 - /branches/tensor_pdb/data.py


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

Header


Content

Posted by edward . dauvergne on October 29, 2006 - 04:02:
Author: bugman
Date: Sun Oct 29 04:01:57 2006
New Revision: 2685

URL: http://svn.gna.org/viewcvs/relax?rev=2685&view=rev
Log:
Added the rotation matrix as an attribute of the diffusion tensor data 
structure.

The calculation of the diffusion tensor data structure 
'self.relax.data.diff[run].tensor' has been
simplified.  Rather than replicating the calculation of the diagonalised 
diffusion tensor, it uses
the 'tensor_diag' data structure.  The 'rotation' data structure is also used.


Modified:
    branches/tensor_pdb/data.py

Modified: branches/tensor_pdb/data.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/data.py?rev=2685&r1=2684&r2=2685&view=diff
==============================================================================
--- branches/tensor_pdb/data.py (original)
+++ branches/tensor_pdb/data.py Sun Oct 29 04:01:57 2006
@@ -291,6 +291,10 @@
             # Return the tensor.
             return tensor
 
+        # The rotation matrix.
+        if name == 'rotation' and self.type == 'sphere':
+            return identity(3, Float64)
+
 
         # Spheroidal diffusion.
         #######################
@@ -335,14 +339,14 @@
 
         # The diffusion tensor (within the structural frame).
         if name == 'tensor' and self.type == 'spheroid':
-            # Initialise the tensor and the rotation matrix.
-            tensor = zeros((3, 3), Float64)
+            # Rotation (R^T . tensor . R).
+            R = self.rotation
+            return dot(transpose(R), dot(self.tensor_diag, R))
+
+        # The rotation matrix.
+        if name == 'rotation' and self.type == 'spheroid':
+            # Initialise the rotation matrix.
             rotation = identity(3, Float64)
-
-            # Populate the diagonal elements.
-            tensor[0, 0] = self.Dper
-            tensor[1, 1] = self.Dper
-            tensor[2, 2] = self.Dpar
 
             # First row of the rotation matrix.
             rotation[0, 0] = cos(self.theta) * cos(self.phi)
@@ -356,11 +360,8 @@
             # Replace the last row of the rotation matrix with the Dpar unit 
vector.
             rotation[2] = self.Dpar_unit
 
-            # Rotation (R^T . tensor . R).
-            tensor = dot(transpose(rotation), dot(tensor, rotation))
-
             # Return the tensor.
-            return tensor
+            return rotation
 
 
         # Ellipsoidal diffusion.
@@ -433,14 +434,14 @@
 
         # The diffusion tensor (within the structural frame).
         if name == 'tensor' and self.type == 'ellipsoid':
-            # Initialise the tensor and the rotation matrix.
-            tensor = zeros((3, 3), Float64)
+            # Rotation (R . tensor . R^T).
+            R = self.rotation
+            return dot(R, dot(self.tensor_diag, transpose(R)))
+
+        # The rotation matrix.
+        if name == 'rotation' and self.type == 'ellipsoid':
+            # Initialise the rotation matrix.
             rotation = identity(3, Float64)
-
-            # Populate the diagonal elements.
-            tensor[0, 0] = self.Dx
-            tensor[1, 1] = self.Dy
-            tensor[2, 2] = self.Dz
 
             # First column of the rotation matrix.
             rotation[:, 0] = self.Dx_unit
@@ -451,12 +452,8 @@
             # Third column of the rotation matrix.
             rotation[:, 2] = self.Dz_unit
 
-            # Rotation (R . tensor . R^T).
-            tensor = dot(rotation, dot(tensor, transpose(rotation)))
-
             # Return the tensor.
-            return tensor
-
+            return rotation
 
         # The attribute asked for does not exist.
         raise AttributeError, name




Related Messages


Powered by MHonArc, Updated Sun Oct 29 04:20:05 2006