mailr18852 - /trunk/generic_fns/structure/api_base.py


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

Header


Content

Posted by edward on March 18, 2013 - 13:56:
Author: bugman
Date: Mon Mar 18 13:56:17 2013
New Revision: 18852

URL: http://svn.gna.org/viewcvs/relax?rev=18852&view=rev
Log:
The MolList.add_item() structural API method now returns the added molecule 
container.

This is used by the pack_structs() method to alias the molecule, and will be 
required when structure
merging is implemented.


Modified:
    trunk/generic_fns/structure/api_base.py

Modified: trunk/generic_fns/structure/api_base.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/generic_fns/structure/api_base.py?rev=18852&r1=18851&r2=18852&view=diff
==============================================================================
--- trunk/generic_fns/structure/api_base.py (original)
+++ trunk/generic_fns/structure/api_base.py Mon Mar 18 13:56:17 2013
@@ -562,14 +562,14 @@
                 if merge:
                     mol = model.mol.merge_item(mol_name=set_mol_name[j], 
mol_cont=data_matrix[i][j])
                 else:
-                    model.mol.add_item(mol_name=set_mol_name[j], 
mol_cont=data_matrix[i][j])
+                    mol = model.mol.add_item(mol_name=set_mol_name[j], 
mol_cont=data_matrix[i][j])
 
                 # Set the molecule name and store the structure file info.
-                model.mol[-1].mol_name = set_mol_name[j]
-                model.mol[-1].file_name = file_name
-                model.mol[-1].file_path = file_path
-                model.mol[-1].file_mol_num = orig_mol_num[j]
-                model.mol[-1].file_model = orig_model_num[i]
+                mol.mol_name = set_mol_name[j]
+                mol.file_name = file_name
+                mol.file_path = file_path
+                mol.file_mol_num = orig_mol_num[j]
+                mol.file_model = orig_model_num[i]
 
 
     def rotate(self, R=None, origin=None, model=None, atom_id=None):
@@ -1324,10 +1324,12 @@
     def add_item(self, mol_name=None, mol_cont=None):
         """Append the given MolContainer instance to the MolList.
 
-        @keyword mol_name:     The molecule number.
+        @keyword mol_name:         The molecule number.
         @type mol_name:        int
         @keyword mol_cont:     The data structure for the molecule.
         @type mol_cont:        MolContainer instance
+        @return:                The new molecule container.
+        @rtype:                 MolContainer instance
         """
 
         # If no molecule data exists, replace the empty first molecule with 
this molecule (just a renaming).
@@ -1346,6 +1348,9 @@
 
             # Set the name.
             self[-1].mol_name = mol_name
+
+        # Return the container.
+        return self[-1]
 
 
     def is_empty(self):




Related Messages


Powered by MHonArc, Updated Mon Mar 18 14:20:02 2013