mailr17279 - /branches/frame_order_testing/specific_fns/frame_order.py


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

Header


Content

Posted by edward on July 18, 2012 - 11:03:
Author: bugman
Date: Wed Jul 18 11:03:46 2012
New Revision: 17279

URL: http://svn.gna.org/viewcvs/relax?rev=17279&view=rev
Log:
Fix for the frame order _minimise_setup_rdcs() method for handling multiple 
unit vectors.


Modified:
    branches/frame_order_testing/specific_fns/frame_order.py

Modified: branches/frame_order_testing/specific_fns/frame_order.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/specific_fns/frame_order.py?rev=17279&r1=17278&r2=17279&view=diff
==============================================================================
--- branches/frame_order_testing/specific_fns/frame_order.py (original)
+++ branches/frame_order_testing/specific_fns/frame_order.py Wed Jul 18 
11:03:46 2012
@@ -730,7 +730,7 @@
             # Average multiple atomic positions.
             else:
                 # First throw a warning to tell the user what is happening.
-                warn(RelaxWarning("Averaging the %s atomic positions for the 
spin '%s'." % (len(spin.pos), spin_id)))
+                warn(RelaxWarning("Averaging the %s atomic positions for the 
PCS for the spin '%s'." % (len(spin.pos), spin_id)))
 
                 # The average position.
                 ave_pos = zeros(3, float64)
@@ -780,11 +780,26 @@
             if not self._check_rdcs(interatom, spin1, spin2):
                 continue
 
-            # Add the vectors.
+            # A single unit vector.
             if arg_check.is_float(interatom.vector[0], raise_error=False):
-                unit_vect.append([interatom.vector])
+                unit_vect.append(interatom.vector)
+
+            # A single unit vector.
+            elif len(interatom.vector) == 1:
+                unit_vect.append(interatom.vector[0])
+
+            # Average multiple unit vectors.
             else:
-                unit_vect.append(interatom.vector)
+                # First throw a warning to tell the user what is happening.
+                warn(RelaxWarning("Averaging the %s unit vectors for the RDC 
for the spin pair '%s' and '%s'." % (len(interatom.vector), 
interatom.spin_id1, interatom.spin_id2)))
+
+                # The average position.
+                ave_vector = zeros(3, float64)
+                for i in range(len(interatom.vector)):
+                    ave_vector += interatom.vector[i]
+
+                # Store.
+                unit_vect.append(ave_vector)
 
             # Gyromagnetic ratios.
             g1 = return_gyromagnetic_ratio(spin1.isotope)




Related Messages


Powered by MHonArc, Updated Wed Jul 18 11:40:01 2012