mailr22052 - /trunk/lib/structure/internal/models.py


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

Header


Content

Posted by edward on January 27, 2014 - 20:42:
Author: bugman
Date: Mon Jan 27 20:42:01 2014
New Revision: 22052

URL: http://svn.gna.org/viewcvs/relax?rev=22052&view=rev
Log:
Another optimisation for the internal structural object for large numbers of 
models.

The ModelList.add_item() method no longer loops over all models to check if a 
model is already
present, instead using the new current_models list.


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

Modified: trunk/lib/structure/internal/models.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/structure/internal/models.py?rev=22052&r1=22051&r2=22052&view=diff
==============================================================================
--- trunk/lib/structure/internal/models.py (original)
+++ trunk/lib/structure/internal/models.py Mon Jan 27 20:42:01 2014
@@ -75,9 +75,8 @@
         # Otherwise append an empty ModelContainer.
         else:
             # Test if the model number already exists.
-            for i in range(len(self)):
-                if self[i].num == model_num:
-                    raise RelaxError("The model '" + repr(model_num) + "' 
already exists.")
+            if model_num in self.current_models:
+                raise RelaxError("The model '" + repr(model_num) + "' 
already exists.")
 
             # Append an empty ModelContainer.
             self.append(ModelContainer(model_num))




Related Messages


Powered by MHonArc, Updated Mon Jan 27 22:00:01 2014