mailr25986 - in /branches/frame_order_cleanup: ./ lib/structure/internal/object.py


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

Header


Content

Posted by edward on September 23, 2014 - 21:37:
Author: bugman
Date: Tue Sep 23 21:37:01 2014
New Revision: 25986

URL: http://svn.gna.org/viewcvs/relax?rev=25986&view=rev
Log:
Merged revisions 25985 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r25985 | bugman | 2014-09-23 21:36:33 +0200 (Tue, 23 Sep 2014) | 9 lines
  
  Massive speed up of the internal structural object add_model() method.
  
  This speeds up the structure.add_model user function, as well as many 
internal relax operations on
  the structural object.  Instead of using the copy.deepcopy() function to 
duplicate an already
  existing structural model, now new molecule container objects are created 
and then the individual
  elements of the original molecule container data lists are copied one by 
one.  This avoids copying a
  lot of internal Python junk and hence the copying operation is now orders 
of magnitude faster.
........

Modified:
    branches/frame_order_cleanup/   (props changed)
    branches/frame_order_cleanup/lib/structure/internal/object.py

Propchange: branches/frame_order_cleanup/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Sep 23 21:37:01 2014
@@ -1 +1 @@
-/trunk:1-25983
+/trunk:1-25985

Modified: branches/frame_order_cleanup/lib/structure/internal/object.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/structure/internal/object.py?rev=25986&r1=25985&r2=25986&view=diff
==============================================================================
--- branches/frame_order_cleanup/lib/structure/internal/object.py       
(original)
+++ branches/frame_order_cleanup/lib/structure/internal/object.py       Tue 
Sep 23 21:37:01 2014
@@ -1141,7 +1141,26 @@
                     break
 
         # Duplicate all data from the MolList object down.
-        model.mol = deepcopy(model_from.mol)
+        for mol_index in range(len(model_from.mol)):
+            # Create a new molecule container.
+            model.mol.add_item(mol_name=model_from.mol[mol_index].mol_name, 
mol_cont=MolContainer())
+            mol = model.mol[mol_index]
+            mol_from = model_from.mol[mol_index]
+
+            # Loop over the atomic data.
+            for i in range(len(mol_from.atom_num)):
+                mol.atom_num.append(mol_from.atom_num[i])
+                mol.atom_name.append(mol_from.atom_name[i])
+                mol.bonded.append(mol_from.bonded[i])
+                mol.chain_id.append(mol_from.chain_id[i])
+                mol.element.append(mol_from.element[i])
+                mol.pdb_record.append(mol_from.pdb_record[i])
+                mol.res_name.append(mol_from.res_name[i])
+                mol.res_num.append(mol_from.res_num[i])
+                mol.seg_id.append(mol_from.seg_id[i])
+                mol.x.append(mol_from.x[i])
+                mol.y.append(mol_from.y[i])
+                mol.z.append(mol_from.z[i])
 
         # Return the model.
         return self.structural_data[-1]




Related Messages


Powered by MHonArc, Updated Wed Sep 24 09:40:05 2014