Author: bugman Date: Thu Oct 8 12:30:16 2009 New Revision: 9657 URL: http://svn.gna.org/viewcvs/relax?rev=9657&view=rev Log: Created the structure.delete() user function for deleting all structural information from the cdp. Modified: 1.3/generic_fns/structure/api_base.py 1.3/generic_fns/structure/internal.py 1.3/generic_fns/structure/main.py 1.3/prompt/structure.py Modified: 1.3/generic_fns/structure/api_base.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/api_base.py?rev=9657&r1=9656&r2=9657&view=diff ============================================================================== --- 1.3/generic_fns/structure/api_base.py (original) +++ 1.3/generic_fns/structure/api_base.py Thu Oct 8 12:30:16 2009 @@ -181,6 +181,13 @@ raise RelaxImplementError + def delete(self): + """Prototype method stub for deleting all structural data from the current data pipe.""" + + # Raise the error. + raise RelaxImplementError + + def from_xml(self, str_node, dir=None, id=None): """Recreate the structural object from the XML structural object node. Modified: 1.3/generic_fns/structure/internal.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/internal.py?rev=9657&r1=9656&r2=9657&view=diff ============================================================================== --- 1.3/generic_fns/structure/internal.py (original) +++ 1.3/generic_fns/structure/internal.py Thu Oct 8 12:30:16 2009 @@ -32,7 +32,7 @@ from warnings import warn # relax module imports. -from api_base import Base_struct_API +from api_base import Base_struct_API, ModelList from data.relax_xml import fill_object_contents, xml_to_object from generic_fns import pipes, relax_re from generic_fns.mol_res_spin import Selection @@ -567,6 +567,20 @@ return data + def delete(self): + """Delete all the structural information.""" + + # Print out. + print("Deleting the following structural data:\n") + print(self.structural_data) + + # Delete the structural data. + del self.structural_data + + # Initialise the empty model list. + self.structural_data = ModelList() + + def load_pdb(self, file_path, read_mol=None, set_mol_name=None, read_model=None, set_model_num=None, verbosity=False): """Method for loading structures from a PDB file. Modified: 1.3/generic_fns/structure/main.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/main.py?rev=9657&r1=9656&r2=9657&view=diff ============================================================================== --- 1.3/generic_fns/structure/main.py (original) +++ 1.3/generic_fns/structure/main.py Thu Oct 8 12:30:16 2009 @@ -41,6 +41,13 @@ +def delete(): + """Simple function for deleting all structural data.""" + + # Run the object method. + cdp.structure.delete() + + def load_spins(spin_id=None, str_id=None, combine_models=True, ave_pos=False): """Load the spins from the structural object into the relax data store. Modified: 1.3/prompt/structure.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/structure.py?rev=9657&r1=9656&r2=9657&view=diff ============================================================================== --- 1.3/prompt/structure.py (original) +++ 1.3/prompt/structure.py Thu Oct 8 12:30:16 2009 @@ -204,6 +204,33 @@ generic_fns.structure.geometric.create_vector_dist(length=length, symmetry=symmetry, file=file, dir=dir, force=force) + def delete(self): + """Delete all structural information from the current data pipe. + + Description + ~~~~~~~~~~~ + + This function will delete all the structural information. + + + Example + ~~~~~~~ + + Simply type: + + relax> structure.delete() + + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "structure.delete()" + print(text) + + # Execute the functional code. + generic_fns.structure.main.delete() + + def load_spins(self, spin_id=None, combine_models=True, ave_pos=True): """Load spins from the structure into the relax data store.