mailr6797 - /1.3/generic_fns/angles.py


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

Header


Content

Posted by edward on July 07, 2008 - 16:07:
Author: bugman
Date: Mon Jul  7 15:19:06 2008
New Revision: 6797

URL: http://svn.gna.org/viewcvs/relax?rev=6797&view=rev
Log:
Fixes for the ellipsoid_frame() function.


Modified:
    1.3/generic_fns/angles.py

Modified: 1.3/generic_fns/angles.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/angles.py?rev=6797&r1=6796&r2=6797&view=diff
==============================================================================
--- 1.3/generic_fns/angles.py (original)
+++ 1.3/generic_fns/angles.py Mon Jul  7 15:19:06 2008
@@ -71,7 +71,7 @@
 
 
 def ellipsoid_frame():
-    """Function for calculating the spherical angles of the XH vector in the 
ellipsoid frame."""
+    """Calculate the spherical angles of the bond vector in the ellipsoid 
frame."""
 
     # Alias the current data pipe.
     cdp = ds[ds.current_pipe]
@@ -79,22 +79,28 @@
     # Get the unit vectors Dx, Dy, and Dz of the diffusion tensor axes.
     Dx, Dy, Dz = diffusion_tensor.unit_axes()
 
-    # Loop over the sequence.
-    for i in xrange(len(cdp.mol[0].res)):
+    # Spin loop.
+    for spin, mol_name, res_num, res_name in spin_loop(full_info=True):
         # Test if the vector exists.
-        if not hasattr(cdp.mol[0].res[i], 'xh_vect'):
-            print "No angles could be calculated for residue '" + 
`cdp.mol[0].res[i].num` + " " + cdp.mol[0].res[i].name + "'."
+        if not hasattr(spin, 'bond_vect'):
+            # Get the spin id string.
+            spin_id = generate_spin_id(mol_name, res_num, res_name, 
spin.num, spin.name)
+
+            # Throw a warning.
+            warn(RelaxWarning("No angles could be calculated for the spin " 
+ `spin_id` + "."))
+
+            # Skip the spin.
             continue
 
         # dz and dx direction cosines.
-        dz = dot(Dz, cdp.mol[0].res[i].xh_vect)
-        dx = dot(Dx, cdp.mol[0].res[i].xh_vect)
+        dz = dot(Dz, spin.bond_vect)
+        dx = dot(Dx, spin.bond_vect)
 
         # Calculate the polar angle theta.
-        cdp.mol[0].res[i].theta = acos(dz)
+        spin.theta = acos(dz)
 
         # Calculate the azimuthal angle phi.
-        cdp.mol[0].res[i].phi = acos(dx / sin(cdp.mol[0].res[i].theta))
+        spin.phi = acos(dx / sin(spin.theta))
 
 
 def spheroid_frame():
@@ -106,7 +112,7 @@
     # Loop over the sequence.
     for spin, mol_name, res_num, res_name in spin_loop(full_info=True):
         # Test if the vector exists.
-        if not hasattr(spin, 'xh_vect'):
+        if not hasattr(spin, 'bond_vect'):
             # Get the spin id string.
             spin_id = generate_spin_id(mol_name, res_num, res_name, 
spin.num, spin.name)
 
@@ -117,7 +123,7 @@
             continue
 
         # Calculate alpha.
-        spin.alpha = acos(dot(cdp.diff_tensor.Dpar_unit, spin.xh_vect))
+        spin.alpha = acos(dot(cdp.diff_tensor.Dpar_unit, spin.bond_vect))
 
 
 def wrap_angles(angle, lower, upper):




Related Messages


Powered by MHonArc, Updated Mon Jul 07 17:00:31 2008