Package prompt :: Module molmol
[hide private]
[frames] | no frames]

Source Code for Module prompt.molmol

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2004 Edward d'Auvergne                                        # 
  4  #                                                                             # 
  5  # This file is part of the program relax.                                     # 
  6  #                                                                             # 
  7  # relax is free software; you can redistribute it and/or modify               # 
  8  # it under the terms of the GNU General Public License as published by        # 
  9  # the Free Software Foundation; either version 2 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # relax is distributed in the hope that it will be useful,                    # 
 13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 15  # GNU General Public License for more details.                                # 
 16  #                                                                             # 
 17  # You should have received a copy of the GNU General Public License           # 
 18  # along with relax; if not, write to the Free Software                        # 
 19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
 20  #                                                                             # 
 21  ############################################################################### 
 22   
 23  import sys 
 24   
 25  import help 
 26   
 27   
28 -class Molmol:
29 - def __init__(self, relax):
30 # Help. 31 self.__relax_help__ = \ 32 """Class for interfacing with Molmol.""" 33 34 # Add the generic help string. 35 self.__relax_help__ = self.__relax_help__ + "\n" + help.relax_class_help 36 37 # Place relax in the class namespace. 38 self.__relax__ = relax
39 40
41 - def clear_history(self):
42 """Function for clearing the Molmol command history.""" 43 44 # Function intro text. 45 if self.__relax__.interpreter.intro: 46 text = sys.ps3 + "molmol.clear_history()" 47 print text 48 49 # Execute the functional code. 50 self.__relax__.generic.molmol.clear_history()
51 52
53 - def command(self, command):
54 """Function for executing a user supplied Molmol command. 55 56 Example 57 ~~~~~~~ 58 59 relax> molmol.command("InitAll yes") 60 """ 61 62 # Function intro text. 63 if self.__relax__.interpreter.intro: 64 text = sys.ps3 + "molmol.command(" 65 text = text + "command=" + `command` + ")" 66 print text 67 68 # The command argument. 69 if type(command) != str: 70 raise RelaxStrError, ('command', command) 71 72 # Execute the functional code. 73 self.__relax__.generic.molmol.write(command=command)
74 75
76 - def view(self, run=None):
77 """Function for viewing the collection of molecules extracted from the PDB file. 78 79 Keyword Arguments 80 ~~~~~~~~~~~~~~~~~ 81 82 run: The name of the run which the PDB belongs to. 83 84 85 Example 86 ~~~~~~~ 87 88 relax> molmol.view('m1') 89 relax> molmol.view(run='pdb') 90 """ 91 92 # Function intro text. 93 if self.__relax__.interpreter.intro: 94 text = sys.ps3 + "molmol.view(" 95 text = text + "run=" + `run` + ")" 96 print text 97 98 # The run argument. 99 if type(run) != str: 100 raise RelaxStrError, ('run', run) 101 102 # Execute the functional code. 103 self.__relax__.generic.molmol.view(run=run)
104