Author: bugman Date: Tue May 20 18:48:02 2008 New Revision: 6169 URL: http://svn.gna.org/viewcvs/relax?rev=6169&view=rev Log: Updated the atom_connect() method to handle multiple models. 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=6169&r1=6168&r2=6169&view=diff ============================================================================== --- 1.3/generic_fns/structure/internal.py (original) +++ 1.3/generic_fns/structure/internal.py Tue May 20 18:48:02 2008 @@ -336,21 +336,27 @@ struct.z.append(pos[2]) - def atom_connect(self, index1=None, index2=None): + def atom_connect(self, index1=None, index2=None, model=None): """Method for connecting two atoms within the data structure object. This method will append index2 to the array at bonded[index1] and vice versa. - @param index1: The index of the first atom. - @type index1: int - @param index2: The index of the second atom. - @type index2: int - """ - - # Update the bonded array structure. - self.structural_data.bonded[index1].append(index2) - self.structural_data.bonded[index2].append(index1) + @keyword index1: The index of the first atom. + @type index1: int + @keyword index2: The index of the second atom. + @type index2: int + """ + + # Loop over the models. + for struct in self.structural_data: + # Skip non-matching models. + if model != None and model != struct.model: + continue + + # Update the bonded array structure. + struct.bonded[index1].append(index2) + struct.bonded[index2].append(index1) def load_pdb(self, file_path, model=None, verbosity=False):