mailr5485 - /1.3/data/mol_res_spin.py


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

Header


Content

Posted by edward on April 09, 2008 - 11:19:
Author: bugman
Date: Wed Apr  9 11:17:14 2008
New Revision: 5485

URL: http://svn.gna.org/viewcvs/relax?rev=5485&view=rev
Log:
Updated the MoleculeList.add_item() method.


Modified:
    1.3/data/mol_res_spin.py

Modified: 1.3/data/mol_res_spin.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/data/mol_res_spin.py?rev=5485&r1=5484&r2=5485&view=diff
==============================================================================
--- 1.3/data/mol_res_spin.py (original)
+++ 1.3/data/mol_res_spin.py Wed Apr  9 11:17:14 2008
@@ -440,13 +440,18 @@
 
 
     def add_item(self, mol_name=None, select=True):
-        """Function for appending an empty container to the list."""
+        """Append an empty MoleculeContainer to the MoleculeList."""
+
+        # Test if the molecule name already exists.
+        for i in xrange(len(self)):
+            if self[i].name == mol_name:
+                raise RelaxError, "The molecule '" + `mol_name` + "' already 
exists in the sequence."
 
         # If no molecule data exists, replace the empty first molecule with 
this molecule (just a renaming).
         if self[0].name == None and len(self[0].res) == 1 and 
len(self[0].res[0].spin) == 1:
             self[0].name = mol_name
             self[0].select = select
 
-        # Append the molecule.
+        # Otherwise append an empty MoleculeContainer.
         else:
             self.append(MoleculeContainer(mol_name, select))




Related Messages


Powered by MHonArc, Updated Wed Apr 09 11:20:11 2008