Author: bugman Date: Mon Feb 18 12:05:01 2013 New Revision: 18477 URL: http://svn.gna.org/viewcvs/relax?rev=18477&view=rev Log: Fixes for the structure.delete user function. This can now handle no data being present, the spin and interatomic data containers are now have their structural data properly deleted, and printouts have been added so the user knows what has happened. Modified: trunk/generic_fns/structure/main.py Modified: trunk/generic_fns/structure/main.py URL: http://svn.gna.org/viewcvs/relax/trunk/generic_fns/structure/main.py?rev=18477&r1=18476&r2=18477&view=diff ============================================================================== --- trunk/generic_fns/structure/main.py (original) +++ trunk/generic_fns/structure/main.py Mon Feb 18 12:05:01 2013 @@ -31,6 +31,7 @@ # relax module imports. from generic_fns import molmol, relax_re +from generic_fns.interatomic import interatomic_loop from generic_fns.mol_res_spin import create_spin, exists_mol_res_spin_data, generate_spin_id, linear_ave, return_molecule, return_residue, return_spin, spin_loop from generic_fns import pipes from generic_fns.structure.api_base import Displacements @@ -105,19 +106,23 @@ pipes.test() # Run the object method. - cdp.structure.delete() + if hasattr(cdp, 'structure'): + print("Deleting all structural data from the current pipe.") + cdp.structure.delete() # Then remove any spin specific structural info. + print("Deleting all spin specific structural info.") for spin in spin_loop(): # Delete positional information. if hasattr(spin, 'pos'): del spin.pos + # Then remove any interatomic vector structural info. + print("Deleting all interatomic vectors.") + for interatom in interatomic_loop(): # Delete bond vectors. - if hasattr(spin, 'bond_vect'): - del spin.bond_vect - if hasattr(spin, 'xh_vect'): - del spin.xh_vect + if hasattr(interatom, 'vector'): + del interatom.vector def displacement(model_from=None, model_to=None, atom_id=None, centroid=None):