mailr24400 - 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 July 02, 2014 - 11:54:
Author: bugman
Date: Wed Jul  2 11:54:17 2014
New Revision: 24400

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

........
  r24399 | bugman | 2014-07-02 11:46:40 +0200 (Wed, 02 Jul 2014) | 5 lines
  
  The internal structural object add_molecule() and has_molecule() methods 
are now model specific.
  
  This allows for finer control of structural object.
........

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 Wed Jul  2 11:54:17 2014
@@ -1 +1 @@
-/trunk:1-24397
+/trunk:1-24399

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=24400&r1=24399&r2=24400&view=diff
==============================================================================
--- branches/frame_order_cleanup/lib/structure/internal/object.py       
(original)
+++ branches/frame_order_cleanup/lib/structure/internal/object.py       Wed 
Jul  2 11:54:17 2014
@@ -1141,21 +1141,22 @@
         return self.structural_data[-1]
 
 
-    def add_molecule(self, name=None):
+    def add_molecule(self, model_num=None, name=None):
         """Add a new molecule to the store.
 
-        @keyword name:          The molecule identifier string.
-        @type name:             str
+        @keyword model_num: The optional model to add the molecule to.  If 
not supplied, the molecule will be added to all models.
+        @type model_num:    None or int
+        @keyword name:      The molecule identifier string.
+        @type name:         str
         """
 
         # Add a model if necessary.
         if len(self.structural_data) == 0:
             self.add_model()
 
-        # Loop over the models.
-        for i in range(len(self.structural_data)):
-            # Add the molecule.
-            self.structural_data[i].mol.add_item(mol_name=name, 
mol_cont=MolContainer())
+        # Add the molecule to each model.
+        for model in self.model_loop(model=model_num):
+            model.mol.add_item(mol_name=name, mol_cont=MolContainer())
 
 
     def are_bonded(self, atom_id1=None, atom_id2=None):
@@ -1737,13 +1738,15 @@
                     return mol
 
 
-    def has_molecule(self, name=None):
+    def has_molecule(self, model_num=None, name=None):
         """Check if the molecule name exists.
 
-        @param name:    The molecule name.
-        @type name:     str
-        @return:        True if the molecule exists, False otherwise.
-        @rtype:         bool
+        @keyword model_num: The optional model to check.  If not supplied, 
the molecule will be searched for across all models.
+        @type model_num:    None or int
+        @param name:        The molecule name.
+        @type name:         str
+        @return:            True if the molecule exists, False otherwise.
+        @rtype:             bool
         """
 
         # No models.
@@ -1751,7 +1754,7 @@
             return False
 
         # Loop over the models.
-        for model_cont in self.model_loop():
+        for model_cont in self.model_loop(model=model_num):
             # Loop over the molecules.
             for mol in model_cont.mol:
                 # Matching molecule.




Related Messages


Powered by MHonArc, Updated Wed Jul 02 12:00:02 2014