Author: bugman Date: Thu May 22 17:21:26 2014 New Revision: 23341 URL: http://svn.gna.org/viewcvs/relax?rev=23341&view=rev Log: Merged revisions 23340 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r23340 | bugman | 2014-05-22 17:21:05 +0200 (Thu, 22 May 2014) | 11 lines Important bug fix for the structure.delete user function when multiple models are present. This is to fix bug #22070 (https://gna.org/bugs/index.php?22070), the failure of the structure.superimpose user function after deleting atoms with structure.delete. The problem is that structure.delete was removing the atoms from the first model but none of the others. This is because it was using the structural object atom_loop() method to find the atoms to be deleted, but this method operates on the first model. So when the second model is reached, the atoms are already gone. ........ Modified: branches/frame_order_cleanup/ (props changed) branches/frame_order_cleanup/lib/structure/internal/object.py Propchange: branches/frame_order_cleanup/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Thu May 22 17:21:26 2014 @@ -1 +1 @@ -/trunk:1-23338 +/trunk:1-23340 Modified: branches/frame_order_cleanup/lib/structure/internal/object.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/structure/internal/object.py?rev=23341&r1=23340&r2=23341&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/structure/internal/object.py (original) +++ branches/frame_order_cleanup/lib/structure/internal/object.py Thu May 22 17:21:26 2014 @@ -1532,6 +1532,12 @@ if atom_id: sel_obj = Selection(atom_id) + # Loop over the atoms and find the indices of the atoms to delete. + indices = [] + for i in self.atom_loop(atom_id=atom_id, index_flag=True): + indices.append(i) + indices.reverse() + # Loop over the models. del_res_nums = [] for model in self.model_loop(): @@ -1543,16 +1549,10 @@ if sel_obj and not sel_obj.contains_mol(mol.mol_name): continue - # Loop over the atoms. - indices = [] - for i in self.atom_loop(atom_id=atom_id, model_num=model.num, index_flag=True): - indices.append(i) - # Generate a residue data dictionary for the metadata trimming (prior to atom deletion). res_data = self._residue_data(res_nums=mol.res_num, res_names=mol.res_name) # Loop over the reverse indices and pop out the data. - indices.reverse() for i in indices: mol.atom_num.pop(i) mol.atom_name.pop(i)