Author: bugman Date: Thu Oct 23 14:56:54 2014 New Revision: 26383 URL: http://svn.gna.org/viewcvs/relax?rev=26383&view=rev Log: Fix for the structure.delete user function for molecule metadata once no more data exists. This relates to bug #22861 (https://gna.org/bugs/?22861), the chain IDs in the structure.write_pdb user function PDB files are incorrect after calling structure.delete. The metadata, when it exists, is now deleted for the molecule once no more data is present. Modified: trunk/lib/structure/internal/object.py Modified: trunk/lib/structure/internal/object.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/structure/internal/object.py?rev=26383&r1=26382&r2=26383&view=diff ============================================================================== --- trunk/lib/structure/internal/object.py (original) +++ trunk/lib/structure/internal/object.py Thu Oct 23 14:56:54 2014 @@ -1619,6 +1619,17 @@ for k in range(len(mol.bonded[j])): mol.bonded[j][k] -= 1 + # Reset the metadata if nothing remains. + if mol.atom_num == []: + if hasattr(mol, 'file_name'): + del mol.file_name + if hasattr(mol, 'file_path'): + del mol.file_path + if hasattr(mol, 'file_mol_num'): + del mol.file_mol_num + if hasattr(mol, 'file_model'): + del mol.file_model + # Nothing more to do. if not len(del_res_nums): return