Author: bugman Date: Wed Apr 9 14:04:59 2008 New Revision: 5495 URL: http://svn.gna.org/viewcvs/relax?rev=5495&view=rev Log: Bug fix for the SpinList.add_item() method. Unnumbered spins are allowed if the names are unique. 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=5495&r1=5494&r2=5495&view=diff ============================================================================== --- 1.3/data/mol_res_spin.py (original) +++ 1.3/data/mol_res_spin.py Wed Apr 9 14:04:59 2008 @@ -141,10 +141,17 @@ def add_item(self, spin_name=None, spin_num=None, select=True): """Function for appending an empty container to the list.""" - # Test if the spin number already exists. - for i in xrange(len(self)): - if self[i].num == spin_num: - raise RelaxError, "The spin number '" + `spin_num` + "' already exists." + # Test if the spin number (or name if unnumbered) already exists. + for i in xrange(len(self)): + # Spin number has been supplied. + if spin_num != None: + if self[i].num == spin_num: + raise RelaxError, "The spin number '" + `spin_num` + "' already exists." + + # No spin numbers. + else: + if self[i].name == spin_name: + raise RelaxError, "The unnumbered spin name '" + `spin_name` + "' already exists." # If no spin data exists, replace the empty first spin with this spin. if self.is_empty():