mailr9031 - /1.3/generic_fns/pcs.py


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

Header


Content

Posted by edward on April 29, 2009 - 10:41:
Author: bugman
Date: Wed Apr 29 10:41:43 2009
New Revision: 9031

URL: http://svn.gna.org/viewcvs/relax?rev=9031&view=rev
Log:
Fixed a bug introduced at r9023.

The spin position was being assumed to be a list of numpy arrays, but in some 
cases it was simply a
numpy array.


Modified:
    1.3/generic_fns/pcs.py

Modified: 1.3/generic_fns/pcs.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/pcs.py?rev=9031&r1=9030&r2=9031&view=diff
==============================================================================
--- 1.3/generic_fns/pcs.py (original)
+++ 1.3/generic_fns/pcs.py Wed Apr 29 10:41:43 2009
@@ -25,7 +25,7 @@
 
 # Python module imports.
 from copy import deepcopy
-from numpy import float64, zeros
+from numpy import float64, ndarray, zeros
 
 # relax module imports.
 from generic_fns.mol_res_spin import exists_mol_res_spin_data, 
generate_spin_id_data_array, return_spin, spin_index_loop, spin_loop
@@ -166,14 +166,20 @@
     # Get the positions.
     centre = zeros(3, float64)
     num_pos = 0
-    for spin in spin_loop(atom_id):
+    for spin, spin_id in spin_loop(atom_id, return_id=True):
         # No atomic positions.
         if not hasattr(spin, 'pos'):
             continue
 
+        # Spin position list.
+        if type(spin.pos) == list or type(spin.pos) == ndarray:
+            pos_list = [spin.pos]
+        else:
+            pos_list = spin.pos
+
         # Loop over the model positions.
-        for pos in spin.pos:
-            centre = centre + pos
+        for pos in pos_list:
+            centre = centre + array(pos)
             num_pos = num_pos + 1
 
     # No positional information!




Related Messages


Powered by MHonArc, Updated Wed Apr 29 11:00:05 2009