mailr15134 - in /branches/frame_order_testing/generic_fns/structure: api_base.py internal.py scientific.py


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

Header


Content

Posted by edward on January 03, 2012 - 17:42:
Author: bugman
Date: Tue Jan  3 17:42:23 2012
New Revision: 15134

URL: http://svn.gna.org/viewcvs/relax?rev=15134&view=rev
Log:
Redesigned the model looping in the atom_loop() and base_vectors() API 
methods to fix a bug.

The models are now looped over in numerical order, rather than the order they 
were loaded or
created.  This reverts to the original behaviour of the main line.


Modified:
    branches/frame_order_testing/generic_fns/structure/api_base.py
    branches/frame_order_testing/generic_fns/structure/internal.py
    branches/frame_order_testing/generic_fns/structure/scientific.py

Modified: branches/frame_order_testing/generic_fns/structure/api_base.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/structure/api_base.py?rev=15134&r1=15133&r2=15134&view=diff
==============================================================================
--- branches/frame_order_testing/generic_fns/structure/api_base.py (original)
+++ branches/frame_order_testing/generic_fns/structure/api_base.py Tue Jan  3 
17:42:23 2012
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2008-2011 Edward d'Auvergne                                  
 #
+# Copyright (C) 2008-2012 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -1120,6 +1120,15 @@
             # Append an empty ModelContainer.
             self.append(ModelContainer(model_num))
 
+        # Store the model indices.
+        if not hasattr(self, 'model_indices'):
+            self.model_indices = {}
+        self.model_indices[model_num] = len(self) - 1
+
+        # The sorted model numbers.
+        self.model_list = self.model_indices.keys()
+        self.model_list.sort()
+
 
     def is_empty(self):
         """Method for testing if this ModelList object is empty.

Modified: branches/frame_order_testing/generic_fns/structure/internal.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/structure/internal.py?rev=15134&r1=15133&r2=15134&view=diff
==============================================================================
--- branches/frame_order_testing/generic_fns/structure/internal.py (original)
+++ branches/frame_order_testing/generic_fns/structure/internal.py Tue Jan  3 
17:42:23 2012
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2011 Edward d'Auvergne                                  
 #
+# Copyright (C) 2003-2012 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -745,7 +745,8 @@
                                 continue
 
                             # Alias.
-                            mol2 = self.structural_data[j].mol[mol_index]
+                            model_index = 
self.structural_data.model_indices[self.structural_data.model_list[j]]
+                            mol2 = 
self.structural_data[model_index].mol[mol_index]
 
                             # Some sanity checks.
                             if mol2.atom_num[i] != atom_num:
@@ -769,7 +770,8 @@
                                 continue
 
                             # Alias.
-                            mol2 = self.structural_data[j].mol[mol_index]
+                            model_index = 
self.structural_data.model_indices[self.structural_data.model_list[j]]
+                            mol2 = 
self.structural_data[model_index].mol[mol_index]
 
                             # Append the position.
                             pos.append([mol2.x[i], mol2.y[i], mol2.z[i]])
@@ -835,7 +837,10 @@
         model = self.structural_data[0]
 
         # Loop over the molecules.
-        for mol in model.mol:
+        for mol_index in range(len(model.mol)):
+            # Alias.
+            mol = model.mol[mol_index]
+
             # Skip non-matching molecules.
             if mol_name and mol_name != mol.mol_name:
                 continue
@@ -862,6 +867,10 @@
                     # A single model.
                     if model_num != None and self.structural_data[j].num != 
model_num:
                         continue
+
+                    # Alias the molecule.
+                    model_index = 
self.structural_data.model_indices[self.structural_data.model_list[j]]
+                    mol = self.structural_data[model_index].mol[mol_index]
 
                     # Get the atom bonded to this 
model/molecule/residue/atom.
                     bonded_num, bonded_name, element, pos, attached_name, 
warnings = self._bonded_atom(attached_atom, index, mol)

Modified: branches/frame_order_testing/generic_fns/structure/scientific.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/structure/scientific.py?rev=15134&r1=15133&r2=15134&view=diff
==============================================================================
--- branches/frame_order_testing/generic_fns/structure/scientific.py 
(original)
+++ branches/frame_order_testing/generic_fns/structure/scientific.py Tue Jan  
3 17:42:23 2012
@@ -243,7 +243,8 @@
                                     continue
 
                                 # Alias.
-                                mol2 = self.structural_data[j].mol[mol_index]
+                                model_index = 
self.structural_data.model_indices[self.structural_data.model_list[j]]
+                                mol2 = 
self.structural_data[model_index].mol[mol_index]
 
                                 # The residue.
                                 if mol2.mol_type != 'other':




Related Messages


Powered by MHonArc, Updated Tue Jan 03 18:40:02 2012