10.9 The viewmol module
Keywords: viewmol

## 10.9 The `viewmol` module

`load`(filename)
  Loads a molecule into VIEWMOL. filename has to be a string containing the name (and path if necessary) of the file to load.

`save`(molecule, filename, format)
  Saves molecule molecule in the format format to file filename. molecule has to be a molecule object, filename a string giving the name of the file (including path, if appropriate) the molecule is to be saved to, and format a string describing the format in which the molecule is to be saved. format can be any of the strings given after the `output` keyword in `viewmolrc` (currently `car`, `arc`, `mol`, or `tm`).

`delete`(molecule)
  Deletes molecule molecule. molecule has to be a molecule object. Note: Molecules cannot be deleted using Python's `del` operator since Python works on VIEWMOL's data structures.

`getMolecules`()
  Returns a list of the molecules loaded into VIEWMOL.

`getLights`()
  Returns a list of the available lights.

`getLabels`()
  Returns a list of all labels known to VIEWMOL.

`model`([model])
  Sets or returns the model used to display molecules. model has to be one of the integer constants `WIREMODEL`, `STICKMODEL`, `BALLMODEL`, or `CPKMODEL` defined in the `viewmol` module to set the model to wire model, stick model, ball-and-stick model, and CPK model, respectively.

`drawingMode`([mode])
  Sets or returns the drawing mode for molecules. mode has to be one of the integer constants `DOT`, `LINE`, or `SURFACE` defined in the `viewmol` module to set the drawing mode correspondingly.

`projection`([projection])
  Sets or returns the projection. projection has to be one of the integer constants `ORTHO` or `PERSPECTIVE` defined in the `viewmol` module.

`sphereResolution`([resolution])
  Sets or returns the resolution for spheres and cylinders. resolution has to be an integer. Higher resolutions result in smoother looking spheres and cylinders.

`lineWidth`([width])
  Sets or returns the line width for wire model displays. width has to be an integer. If width is set to zero the line width is calculated based on the size of the window.

`groundColor`([red, green, blue])
  Sets or returns the color of the ground displayed if the projection is set to `PERSPECTIVE`. red, green, and blue are floats specifying the red, green, and blue components of the ground color. They have to be between 0.0 and 1.0. If the ground color is retrieved, a tupel with the red, green, and blue values is returned.

`backgroundColor`([red, green, blue])
  Sets or returns the color of the background. red, green, and blue are floats specifying the red, green, and blue components of the background color. They have to be between 0.0 and 1.0. If the background color is retrieved, a tupel with the red, green, and blue values is returned.

`labelAtoms`(status)
  Specifies whether atoms should be labeled. status is an integer set to one of the constants `ON` or `OFF` defined in the `viewmol` module.

`saveDrawing`(format, filename)
  Saves the drawing to file. format has to be one of the constants `TIFF`, `PNG`, `HPGL`, `POSTSCRIPT`, or `RAYTRACER` defined in the `viewmol` module, filename the name of the file the drawing is to be saved to.

`isosurface`([level])
  Sets or returns which isosurface to display for wave function related drawings. level has to be a double.

`showThermodynamics`([select])
  Displays the thermodynamics dialog. select is an integer specifying which tab to display. This integer has to be either the integer constant `REACTION` defined in the `viewmol` module or an integer between 1 and the number of molecule loaded. In the first case the reaction page is displayed, in all other cases the page for the corresponding molecule is shown.

`redraw`()
  Redraws the main window of VIEWMOL. Redraws are necessary to make changes visible performed using other methods of the `viewmol` module.

`getFramesPerSecond`()
  Returns the drawing speed of the last redraw of VIEWMOL's main window in frames per second.

`write`(string)
  Write string to the Python message dialog.

`registerMenuItem`(moduleName)
  Add moduleName to the ``Run script" menu.

`showWarnings`(warning)
  Controls the display of warning messages. warning is an integer set to one of the constants `ON` or `OFF` defined in the `viewmol` module. If warnings are turned off no dialog boxes requiring user interaction are displayed while a Python script is running.

`getWindowSize`()
  Returns a tupel containing the size of VIEWMOL's main window in pixels. The tupel consists of (width, height).

`quit`()
  Quits VIEWMOL.