Author: bugman Date: Sun Oct 29 07:37:48 2006 New Revision: 2698 URL: http://svn.gna.org/viewcvs/relax?rev=2698&view=rev Log: Created the user function 'molmol.ribbon()'. This function applies the Molmol ribbon style and is equivalent to clicking on 'ribbon' in the Molmol side menu. Modified: branches/tensor_pdb/generic_fns/molmol.py branches/tensor_pdb/prompt/molmol.py Modified: branches/tensor_pdb/generic_fns/molmol.py URL: http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/generic_fns/molmol.py?rev=2698&r1=2697&r2=2698&view=diff ============================================================================== --- branches/tensor_pdb/generic_fns/molmol.py (original) +++ branches/tensor_pdb/generic_fns/molmol.py Sun Oct 29 07:37:48 2006 @@ -169,6 +169,27 @@ self.command_history = self.command_history + command + "\n" + def ribbon(self, run=None): + """Apply the Molmol ribbon style.""" + + # Arguments. + self.run = run + + # Test if the run exists. + if not self.run in self.relax.data.run_names: + raise RelaxNoRunError, self.run + + # Calculate the protons. + self.pipe_write("CalcAtom 'H'") + self.pipe_write("CalcAtom 'HN'") + + # Calculate the secondary structure. + self.pipe_write("CalcSecondary") + + # Execute the ribbon macro. + self.pipe_write("XMacStand ribbon.mac") + + def view(self, run=None): """Function for running Molmol.""" Modified: branches/tensor_pdb/prompt/molmol.py URL: http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/prompt/molmol.py?rev=2698&r1=2697&r2=2698&view=diff ============================================================================== --- branches/tensor_pdb/prompt/molmol.py (original) +++ branches/tensor_pdb/prompt/molmol.py Sun Oct 29 07:37:48 2006 @@ -77,7 +77,9 @@ Example ~~~~~~~ - relax> molmol.command("InitAll yes") + To reinitialise the Molmol instance for the run 'aic', type: + + relax> molmol.command("aic", "InitAll yes") """ # Function intro text. @@ -197,6 +199,48 @@ # Execute the functional code. self.__relax__.generic.molmol.macro_exec(run=run, data_type=data_type, style=style, colour_start=colour_start, colour_end=colour_end, colour_list=colour_list) + + def ribbon(self, run=None): + """Apply the Molmol ribbon style. + + Keyword Arguments + ~~~~~~~~~~~~~~~~~ + + run: The name of the run. + + + Description + ~~~~~~~~~~~ + + This function applies the Molmol ribbon style. To do this, the following commands are + executed: + + CalcAtom 'H' + CalcAtom 'HN' + CalcSecondary + XMacStand ribbon.mac + + + Example + ~~~~~~~ + + To apply the ribbon style to the PDB file loaded for the run 'final', type: + + relax> molmol.ribbon("final") + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "molmol.ribbon(" + text = text + "run=" + `run` + ")" + print text + + # The run name. + if type(run) != str: + raise RelaxStrError, ('run', run) + + # Execute the functional code. + self.__relax__.generic.molmol.ribbon(run=run) def view(self, run=None):