Author: bugman Date: Sun Oct 29 04:13:38 2006 New Revision: 2689 URL: http://svn.gna.org/viewcvs/relax?rev=2689&view=rev Log: Fixed the transposed spheroidal rotation matrix. The spheroidal rotation matrix returned from the data structure 'self.relax.data.diff[run].rotation' was incorrect. Instead of the true rotation matrix, the transpose of the matrix was being returned. As the spheroidal rotation matrix was transposed whereas the ellipsoidal rotation matrix was correct (the spherical rotation matrix was the identity matrix, so no problem there), the maths for generating the PDB geometric object representing the diffusion tensor was causing problems. Now all three geometric objects - sphere, spheroid, and ellipsoid - should be correctly generated. Modified: branches/tensor_pdb/data.py branches/tensor_pdb/generic_fns/pdb.py Modified: branches/tensor_pdb/data.py URL: http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/data.py?rev=2689&r1=2688&r2=2689&view=diff ============================================================================== --- branches/tensor_pdb/data.py (original) +++ branches/tensor_pdb/data.py Sun Oct 29 04:13:38 2006 @@ -217,9 +217,9 @@ The rotation matrix required to shift from the diffusion tensor frame to the PDB frame is equal to - | cos(theta) * cos(phi) cos(theta) * sin(phi) -sin(theta) | - R = | -sin(phi) cos(phi) 0 |. - | sin(theta) * cos(phi) sin(theta) * sin(phi) cos(tehta) | + | cos(theta) * cos(phi) -sin(phi) sin(theta) * cos(phi) | + R = | cos(theta) * sin(phi) cos(phi) sin(theta) * sin(phi) |. + | -sin(theta) 0 cos(theta) | Ellipsoidal diffusion @@ -262,9 +262,9 @@ R = | Dx_unit Dy_unit Dz_unit |, - | Dx_unit[0] Dy_unit[0] Dz_unit[0] | + | Dx_unit[0] Dy_unit[0] Dz_unit[0] | = | Dx_unit[1] Dy_unit[1] Dz_unit[1] |. - | Dx_unit[2] Dy_unit[2] Dz_unit[2] | + | Dx_unit[2] Dy_unit[2] Dz_unit[2] | """ # All tensor types. @@ -339,9 +339,9 @@ # The diffusion tensor (within the structural frame). if name == 'tensor' and self.type == 'spheroid': - # Rotation (R^T . tensor . R). + # Rotation (R . tensor . R^T). R = self.rotation - return dot(transpose(R), dot(self.tensor_diag, R)) + return dot(R, dot(self.tensor_diag, transpose(R))) # The rotation matrix. if name == 'rotation' and self.type == 'spheroid': @@ -350,15 +350,15 @@ # First row of the rotation matrix. rotation[0, 0] = cos(self.theta) * cos(self.phi) - rotation[0, 1] = cos(self.theta) * sin(self.phi) - rotation[0, 2] = -sin(self.theta) + rotation[1, 0] = cos(self.theta) * sin(self.phi) + rotation[2, 0] = -sin(self.theta) # Second row of the rotation matrix. - rotation[1, 0] = -sin(self.phi) + rotation[0, 1] = -sin(self.phi) rotation[1, 1] = cos(self.phi) # Replace the last row of the rotation matrix with the Dpar unit vector. - rotation[2] = self.Dpar_unit + rotation[:, 2] = self.Dpar_unit # Return the tensor. return rotation Modified: branches/tensor_pdb/generic_fns/pdb.py URL: http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/generic_fns/pdb.py?rev=2689&r1=2688&r2=2689&view=diff ============================================================================== --- branches/tensor_pdb/generic_fns/pdb.py (original) +++ branches/tensor_pdb/generic_fns/pdb.py Sun Oct 29 04:13:38 2006 @@ -21,7 +21,7 @@ ############################################################################### from math import sqrt, cos, pi, sin -from Numeric import Float64, arccos, dot, transpose, zeros +from Numeric import Float64, arccos, dot, zeros from os import F_OK, access from re import compile import Scientific.IO.PDB @@ -309,7 +309,7 @@ ###################### # Print out. - print "Creating the vector distribution." + print "Creating the vector distribution.\n" # Increment value. inc = 20 @@ -328,7 +328,7 @@ atom_id = 'T' + `i` + 'P' + `j` # Rotate the vector into the diffusion frame. - vector = dot(transpose(self.relax.data.diff[self.run].rotation), vectors[index]) + vector = dot(self.relax.data.diff[self.run].rotation, vectors[index]) # Set the length of the vector to its diffusion rate within the diffusion tensor geometric object. vector = dot(self.relax.data.diff[self.run].tensor, vector)