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):
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits