mailr27373 - /trunk/lib/structure/internal/selection.py


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

Header


Content

Posted by edward on January 29, 2015 - 19:27:
Author: bugman
Date: Thu Jan 29 19:27:18 2015
New Revision: 27373

URL: http://svn.gna.org/viewcvs/relax?rev=27373&view=rev
Log:
Fix for the new Internal_selection.count_atoms() internal structural object 
selection method.

The method was previously returning the total number of molecules, not the 
total number of atoms in
the selection.


Modified:
    trunk/lib/structure/internal/selection.py

Modified: trunk/lib/structure/internal/selection.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/structure/internal/selection.py?rev=27373&r1=27372&r2=27373&view=diff
==============================================================================
--- trunk/lib/structure/internal/selection.py   (original)
+++ trunk/lib/structure/internal/selection.py   Thu Jan 29 19:27:18 2015
@@ -69,7 +69,17 @@
     def count_atoms(self):
         """Return the number of atoms in the selection."""
 
-        return len(self._atom_indices)
+        # No data.
+        if self._atom_indices == []:
+            return 0
+
+        # Sum the atoms of all molecules.
+        sum = 0
+        for mol_index in self._mol_indices:
+            sum += len(self._atom_indices[mol_index])
+
+        # Return the sum.
+        return sum
 
 
     def loop(self):




Related Messages


Powered by MHonArc, Updated Thu Jan 29 19:40:03 2015