Author: bugman Date: Mon Jan 12 14:21:18 2009 New Revision: 8411 URL: http://svn.gna.org/viewcvs/relax?rev=8411&view=rev Log: Shifted __atom_index() from the Internal class to the MolContainer. Modified: branches/multi_structure/generic_fns/structure/internal.py Modified: branches/multi_structure/generic_fns/structure/internal.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_structure/generic_fns/structure/internal.py?rev=8411&r1=8410&r2=8411&view=diff ============================================================================== --- branches/multi_structure/generic_fns/structure/internal.py (original) +++ branches/multi_structure/generic_fns/structure/internal.py Mon Jan 12 14:21:18 2009 @@ -109,34 +109,6 @@ self.structural_data[struct_index] = str else: self.structural_data.append(str) - - - def __atom_index(self, atom_num, struct_index): - """Find the atom index corresponding to the given atom number. - - @param atom_num: The atom number to find the index of. - @type atom_num: int - @param struct_index: The index of the structural container to extract the atom index - from. - @type struct_index: int - @return: The atom index corresponding to the atom. - @rtype: int - """ - - # 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.")) def __bonded_atom(self, attached_atom, index, struct_index): @@ -1181,6 +1153,34 @@ self.z = [] + def __atom_index(self, atom_num, struct_index): + """Find the atom index corresponding to the given atom number. + + @param atom_num: The atom number to find the index of. + @type atom_num: int + @param struct_index: The index of the structural container to extract the atom index + from. + @type struct_index: int + @return: The atom index corresponding to the atom. + @rtype: int + """ + + # 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.")) + + def __parse_pdb_record(self, record): """Parse the PDB record string and return an array of the corresponding atomic information.