mailr17278 - /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 - 10:50:
Author: bugman
Date: Wed Jul 18 10:50:09 2012
New Revision: 17278

URL: http://svn.gna.org/viewcvs/relax?rev=17278&view=rev
Log:
Fix for the Frame order _minimise_setup_pcs() method for how atomic positions 
are now stored.

This will always be a rank-2 array, even with a single position, and the 
method now handles this.


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=17278&r1=17277&r2=17278&view=diff
==============================================================================
--- branches/frame_order_testing/specific_fns/frame_order.py (original)
+++ branches/frame_order_testing/specific_fns/frame_order.py Wed Jul 18 
10:50:09 2012
@@ -723,11 +723,22 @@
             if not hasattr(spin, 'pcs'):
                 continue
 
-            # The position list.
-            if type(spin.pos[0]) in [float, float64]:
-                atomic_pos.append(spin.pos)
+            # A single atomic position.
+            if len(spin.pos) == 1:
+                atomic_pos.append(spin.pos[0])
+
+            # Average multiple atomic positions.
             else:
-                raise RelaxError("The spin '%s' contains more than one 
atomic position %s." % (spin_id, spin.pos))
+                # 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)))
+
+                # The average position.
+                ave_pos = zeros(3, float64)
+                for i in range(len(spin.pos)):
+                    ave_pos += spin.pos[i]
+
+                # Store.
+                atomic_pos.append(ave_pos)
 
         # Convert to numpy objects.
         atomic_pos = array(atomic_pos, float64)




Related Messages


Powered by MHonArc, Updated Wed Jul 18 11:20:02 2012