Author: bugman Date: Mon May 19 12:09:17 2014 New Revision: 23232 URL: http://svn.gna.org/viewcvs/relax?rev=23232&view=rev Log: Expanded the structure.delete user function to add the 'verbosity' and 'spin_info' arguments. The verbosity argument, when set to zero, allows all output to be suppressed. The spin_info flag allows the deletion of spin and interatomic data to now be turned off, so that only 3D data is deleted. Modified: trunk/pipe_control/structure/main.py trunk/user_functions/structure.py Modified: trunk/pipe_control/structure/main.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=23232&r1=23231&r2=23232&view=diff ============================================================================== --- trunk/pipe_control/structure/main.py (original) +++ trunk/pipe_control/structure/main.py Mon May 19 12:09:17 2014 @@ -293,11 +293,15 @@ status.observers.result_file.notify() -def delete(atom_id=None): +def delete(atom_id=None, verbosity=1, spin_info=True): """Delete structural data. @keyword atom_id: The molecule, residue, and atom identifier string. This matches the spin ID string format. If not given, then all structural data will be deleted. @type atom_id: str or None + @keyword verbosity: The amount of information to print to screen. Zero corresponds to minimal output while higher values increase the amount of output. The default value is 1. + @type verbosity: int + @keyword spin_info: A flag which if True will cause all structural information in the spin containers and interatomic data containers to be deleted as well. If False, then only the 3D structural data will be deleted. + @type spin_info: bool """ # Test if the current data pipe exists. @@ -305,20 +309,27 @@ # Run the object method. if hasattr(cdp, 'structure'): - print("Deleting structural data from the current pipe.") + if verbosity: + print("Deleting structural data from the current pipe.") cdp.structure.delete(atom_id=atom_id) - else: + elif verbosity: print("No structures are present.") + # Skip the rest. + if not spin_info: + return + # Then remove any spin specific structural info. - print("Deleting all spin specific structural info.") + if verbosity: + print("Deleting all spin specific structural info.") for spin in spin_loop(selection=atom_id): # Delete positional information. if hasattr(spin, 'pos'): del spin.pos # Then remove any interatomic vector structural info. - print("Deleting all interatomic vectors.") + if verbosity: + print("Deleting all interatomic vectors.") for interatom in interatomic_loop(selection1=atom_id): # Delete bond vectors. if hasattr(interatom, 'vector'): Modified: trunk/user_functions/structure.py URL: http://svn.gna.org/viewcvs/relax/trunk/user_functions/structure.py?rev=23232&r1=23231&r2=23232&view=diff ============================================================================== --- trunk/user_functions/structure.py (original) +++ trunk/user_functions/structure.py Mon May 19 12:09:17 2014 @@ -426,6 +426,20 @@ desc_short = "atom ID string", desc = "The atom identification string.", can_be_none = True +) +uf.add_keyarg( + name = "verbosity", + default = 1, + py_type = "int", + desc_short = "verbosity level", + desc = "The amount of information to print out. Set to zero to silence the user function, or one to see all messages." +) +uf.add_keyarg( + name = "spin_info", + default = True, + py_type = "bool", + desc_short = "spin information flag", + desc = "A flag which if True will cause all structural information in the spin containers and interatomic data containers to be deleted as well. If False, then only the 3D structural data will be deleted." ) # Description. uf.desc.append(Desc_container())