mailr2697 - in /branches/tensor_pdb: generic_fns/molmol.py prompt/molmol.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward . dauvergne on October 29, 2006 - 07:14:
Author: bugman
Date: Sun Oct 29 07:14:07 2006
New Revision: 2697

URL: http://svn.gna.org/viewcvs/relax?rev=2697&view=rev
Log:
Implemented the 'molmol.command()' user function.

The user function did previously exist, but it hadn't been implemented in the 
generic code.  The
user function was calling the wrong function 'self.write' in 
'generic_fns/molmol.py'.


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=2697&r1=2696&r2=2697&view=diff
==============================================================================
--- branches/tensor_pdb/generic_fns/molmol.py (original)
+++ branches/tensor_pdb/generic_fns/molmol.py Sun Oct 29 07:14:07 2006
@@ -37,6 +37,20 @@
         """Function for clearing the Molmol command history."""
 
         self.command_history = ""
+
+
+    def command(self, run, command):
+        """Function for sending Molmol commands to the program pipe."""
+
+        # Arguments.
+        self.run = run
+
+        # Test if the run exists.
+        if not self.run in self.relax.data.run_names:
+            raise RelaxNoRunError, self.run
+
+        # Pass the command to Molmol.
+        self.pipe_write(command)
 
 
     def create_macro(self):

Modified: branches/tensor_pdb/prompt/molmol.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/prompt/molmol.py?rev=2697&r1=2696&r2=2697&view=diff
==============================================================================
--- branches/tensor_pdb/prompt/molmol.py (original)
+++ branches/tensor_pdb/prompt/molmol.py Sun Oct 29 07:14:07 2006
@@ -56,8 +56,23 @@
         self.__relax__.generic.molmol.clear_history()
 
 
-    def command(self, command):
+    def command(self, run=None, command=None):
         """Function for executing a user supplied Molmol command.
+
+        Keyword Arguments
+        ~~~~~~~~~~~~~~~~~
+
+        run:  The name of the run.
+
+        command:  The Molmol command to execute.
+
+
+        Description
+        ~~~~~~~~~~~
+
+        This user function allows you to pass Molmol commands to the 
program.  This can be useful
+        for automation or scripting.
+
 
         Example
         ~~~~~~~
@@ -68,15 +83,20 @@
         # Function intro text.
         if self.__relax__.interpreter.intro:
             text = sys.ps3 + "molmol.command("
-            text = text + "command=" + `command` + ")"
-            print text
+            text = text + "run=" + `run`
+            text = text + ", command=" + `command` + ")"
+            print text
+
+        # The run name.
+        if type(run) != str:
+            raise RelaxStrError, ('run', run)
 
         # The command argument.
         if type(command) != str:
             raise RelaxStrError, ('command', command)
 
         # Execute the functional code.
-        self.__relax__.generic.molmol.write(command=command)
+        self.__relax__.generic.molmol.command(run=run, command=command)
 
 
     def macro_exec(self, run=None, data_type=None, style="classic", 
colour_start=None, colour_end=None, colour_list=None):




Related Messages


Powered by MHonArc, Updated Sun Oct 29 07:40:05 2006