Author: bugman Date: Thu Nov 27 10:12:55 2008 New Revision: 8028 URL: http://svn.gna.org/viewcvs/relax?rev=8028&view=rev Log: Fix for the __atom_index() method. This is a partial fix for bug #12637 (https://gna.org/bugs/?12637). The struct_index of None is now handled. Modified: 1.3/generic_fns/structure/internal.py Modified: 1.3/generic_fns/structure/internal.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/internal.py?rev=8028&r1=8027&r2=8028&view=diff ============================================================================== --- 1.3/generic_fns/structure/internal.py (original) +++ 1.3/generic_fns/structure/internal.py Thu Nov 27 10:12:55 2008 @@ -123,11 +123,17 @@ @rtype: int """ - # Loop over the atoms. - for i in xrange(len(self.structural_data[struct_index].atom_num)): - # Return the index. - if self.structural_data[struct_index].atom_num[i] == atom_num: - return i + # Loop over the structures. + for i in xrange(self.num): + # Skip non-matching structures. + if struct_index != None and struct_index != i: + continue + + # Loop over the atoms. + for j in xrange(len(self.structural_data[i].atom_num)): + # Return the index. + if self.structural_data[i].atom_num[j] == atom_num: + return j # Should not be here, the PDB connect records are incorrect. warn(RelaxWarning("The atom number " + `atom_num` + " from the CONECT record cannot be found within the ATOM and HETATM records."))