## 6.2 The Main Window

The program displays the molecule according to the coordinates in the main window. Following manipulations are possible (cf. Figure):

- Holding down the left mouse button and moving the mouse horizontally
  This rotates the molecule, the view point, or a light source around the y axis.
- Holding down the left mouse button and moving the mouse vertically
  This rotates the molecule, the view point, or a light source around the x axis.
- Holding down the middle mouse button and moving the mouse horizontally
  This rotates the molecule, the view point, or a light source around the z axis.

- Holding down one of the shift keys and the left mouse button and moving the mouse
  This moves (translates) the molecule or an annotation.
- Holding down one of the shift keys and the middle button and moving the mouse
  The scaling of the molecule is changed.
- Pressing the cursor keys for moving up or down
  The scaling of the molecule is changed. By pressing the molecule will be enlarged and by pressing the molecule will be made smaller.

- Clicking on an atom with the left mouse button
  This selects this atom, you will hear a beep. If you have clicked on one atom and then pressed the right mouse button, the average of all bond lengths at this atom is displayed. If you have clicked on two atoms and then pressed the right mouse button, the distance between these two atoms is displayed. If you have clicked on three atoms and then pressed the right mouse button, the angle between these three atoms is displayed. If you have clicked on four atoms and then pressed the right mouse button, the torsion angle between these four atoms is displayed. To delete the displayed values use either the `Geometry` menu items or repeat the steps above. Clicking with the left mouse button on an atom may also be necessary for setting or selecting some atom specific values (vide infra).
- Holding down one of the shift keys and clicking on a molecule with the left mouse button
  The molecule is selected. The window title will show the name of this molecule. All subsequent translations/rotations act only on this molecule.
- Pressing the right mouse button without clicking on an atom before
  A menu will appear. The menu contains the following topics (the key combination in parentheses can be used as a shortcut in the English version):
  - Molecule ...
    A submenu is provided with the following topics:
    - Load molecule ...
      Brings up a file selection box to load a molecule.
    - Save molecule ...
      Brings up a format selection dialog and a file selection box to save the currently selected molecule to file. Output formats are supported through external filters (similar to the input filters) and can be installed using options in the `viewmolrc` file (cf. p. ). Coordinates and bond information are passed to the corresponding output filter which writes the file. Currently, the only output formats provided are Accelrys car-files, MDL mol-files, and TURBOMOLE.
    - Delete molecule ...
      Deletes the currently selected molecule.
    - New molecule ...
      Brings up the molecule editor and starts the building of a new molecule (cf. p. ).
    - Modify molecule ...
      Brings up the molecule editor to modify an existing molecule (cf. p. ).
  - Select molecule
    Provides a submenu with the names of all molecules currently loaded and an item `All` and can be used to change the currently selected molecule. Other possibilities to select a molecule consist of clicking on the molecule (preferably while holding the shift key down) or pressing the `Tab` key, which cycles through all entries in the `Select molecule` submenu.
  - Wire model (Alt+W)
    The molecule will be drawn with lines. This is the default.
  - Stick model (Alt+T)
    The molecule will be drawn with sticks.
  - Ball and stick model (Alt+A)
    The molecule will be drawn with balls and sticks.
  - CPK model (Alt+C)
    The molecule will be drawn with CPKs.
  - Geometry ...
    A submenu is provided with the following topics:
    - Clear all (Ctrl+A)
      If this topic is selected all labels of bond lengths, bond angles, and torsion angles are deleted.
    - Clear last (Ctrl+L)
      If this topic is selected the label of a bond length, bond angle, or torsion angle created last is deleted.
    - Undo geometry change (Ctrl+U)
      If this topic is selected, the last geometry change (cf. p. ) is reversed. All geometry changes are buffered in the undo buffer and can be reversed one by one by repeatedly using this menu item. Geometry changes can also be reversed through the molecule editor.

    Figure 2: The dialog box for setting options for bonds.

  - Bond types ...
    Brings up the dialog box shown in the Figure.
    - single only
      All bonds are drawn as single bonds.
    - multiple
      VIEWMOL determines the bond order for each bond considering connectivity and elements only (only the following elements are used in the determination of bond orders: H, C, N, O, F, Si, P, S, Cl, Ge, Br, I). VIEWMOL then draws bonds with the corresponding bond order. Bond orders can also be changed in the molecule editor.
    - conjugated
      VIEWMOL determines bond orders as for the ``multiple" option. It then determines whether multiple bonds are conjugated and draws them as such. This is the default, but can be overwritten using resources (see p. ).
    - Show hydrogen bonds
      This button toggles the display of hydrogen bonds. Hydrogen bonds are determined automatically by VIEWMOL based on a distance threshold.
    - Threshold for hydrogen bonds [Ang]
      This slider can be used to set the distance threshold for the automatic determination of hydrogen bonds. A hydrogen bond is shown if the distance between a hydrogen atom and another atom is larger than the sum of their radii, but smaller than this threshold. The default is 2 Å.
    - Scale radius for all atoms by
      This menu and the slider beneath it can be used to scale the Van der Waals radius for an element. Since the Van der Waals radius determines the connectivity of the atoms in the molecule, changing it will also change the connectivity. The option menu can be used to select which element to scale and the slider allows to set the scaling factor.
  - Wave function ... (Alt+V)
    The dialog box shown in the Figure is presented. This topic is only available with the outputs of electronic structure programs (such as TURBOMOLE, GAUSSIAN, or MOPAC), and even then only if either MO coefficients and basis functions or a grid with an orbital could be read in. If TURBOMOLE output is used and the point group of the molecule in `$symmetry` is not C1, TURBOMOLE's moloch program must be available (vide supra, p. ) and only basis functions, occupied MO's, and electron densities can be drawn in this case. Since TURBOMOLE can handle up to g functions and GAUSSIAN can handle up to f functions the same limitations apply to VIEWMOL.

    If any wave function related drawing is displayed and the grid resolution is changed the drawing disappears and the recalculation has to be explicitly demanded by selecting this menu item again, since large molecules require significant time for the recalculation.

    Figure 3: The dialog box for setting options for wave function related topics.

    At the top of this dialog box are five buttons which can be used to select the property which shall be shown.
    - All off
      This topic disables the drawing of any wave function related topic. This is the default.
    - Basis function
      This topic allows drawing of basis functions. After selecting it and closing the wave function dialog VIEWMOL prompts for an atom in its main window. Clicking on an atom with the left mouse button will present a dialog box with all basis functions centered on this atom. After selecting one of these basis functions and pressing the OK button the corresponding basis function will be drawn.
    - Basis function in MO
      This topic allows drawing of basis functions multiplied by the corresponding coefficient in a molecular orbital. This topic works similar to the previous one, except that the menu will show the MO coefficients in front of all basis functions. If no molecular orbital has been selected in the MO energy diagram window a warning message will be displayed.
    - Molecular orbital
      This topic allows the drawing of a molecular orbital. If no molecular orbital has been selected in the MO energy diagram window a warning message will be displayed.
    - Electron density
      This topic allows the drawing of the total electron density.
    If grids have been read in there will be additional buttons to select one of these grids. If no basis functions and MO coefficients have been read in, but grids only the buttons to select a grid and the ``All off" button are displayed (cf. right screenshot in Fig. 3).

    Next to these buttons there is a slider which can be used to select the value of the isosurface used to draw the property selected. Following this slider another three buttons allow the selection of the interpolation method used in drawing the property.

    - None
      No interpolation is done. The resulting drawing normally has a lot of edges.
    - Linear
      A linear interpolation is done between grid points. This gives a much smoother surface.
    - Logarithmic
      A logarithmic interpolation is done between grid points. This improves the quality of drawing further.
    The default is linear, but this can be overwritten in the resource file (vide infra, p. ). Following is another slider with can be used to set the resolution of the grid. As higher the number selected here as finer the grid and as smoother the resulting surface, but the calculation time goes with the third power of this number. Default is 20, but this can be overwritten in the resource file (vide infra, p. ). At the bottom of the dialog box is a toggle button which can be used to turn automatic recalculation of MOs etc. on whenever the energy level is changed. Since these calculations can be quite time consuming, this button is off by default, but this can be overwritten in the resource file (vide infra, p. ).
  - Energy level diagram (Alt+E)
    A new window will appear which shows the calculated energies of the MOs in an energy level diagram. This topic is only available using DMOL, GAMESS, GAUSSIAN 9X, MOPAC, or TURBOMOLE outputs. In TURBOMOLE outputs either the data group `$scfmo` or the data groups `$uhfmo_alpha` and `$uhfmo_beta` must be available.
  - Optimization history (Alt+O)
    A diagram is plotted in a second window which shows the energies and gradient norms of the geometry optimization. With the cursor keys for moving to the left and to the right one can see how the geometry optimization works. Alternatively, the red cross can be dragged with the mouse.
  - Show forces (Alt+F)
    The calculated forces acting on the atoms are drawn as arrows. This topic is not available using DISCOVER outputs. The topic is also not available, if no forces were found for the current coordinates.
  - Spectrum (Alt+S)
    A new window will appear which shows the calculated spectrum for the molecule. This topic is only available if a force constants calculation has been performed.
  - Thermodynamics (Alt+Y)

    Figure 4: The dialog box for handling thermodynamics calculations.

    The dialog box shown in the Figure is displayed. On the top of this dialog box a number of tabs can be found. All tabs except the last one allow to select the display of thermodynamical data for one of the molecules loaded in VIEWMOL. The last tab will display thermodynamical data for one or more defined reactions among the molecules loaded.

    The screen for a molecule shows the title of that molecule on top. Underneath the molecular mass (in g/mol), the symmetry number, and either the rotational constants (for molecules in cm-1) or the density (for solids in g/cm3) are displayed on the left hand side. On the right hand side there is a popup menu which allows the user to select whether this molecule should be a reactant or a product in a reaction, or whether it is not involved in a reaction at all. The last item in this popup menu, `All reactions`, will force VIEWMOL to determine a linear independent set of possible reactions between all molecules where this item has been selected.

    The remainder of the screen shows thermodynamical data for the molecule. On the left hand side there are a number of buttons which can be used to select which contributions (translation, pV, rotation, vibration) to include in the total which is used to calculate thermodynamical data for a reaction. The enthalphy, entropy, Gibbs energy, and heat capacity are listed to the right, split into contributions from translation, pV, rotation, and vibration.

    The screen for reactions (not shown) shows the reaction equation on top. Underneath the values of reaction enthalphy, entropy, Gibbs energy, heat capacity, and the (decadic) logarithm of the equilibrium constant are listed. The electronic and statistical-mechanic contributions to the reaction enthalphy are listed separately.

    At the bottom all screens share a popup menu for selecting the units to be used (Joules, calories, or thermochemical calories) and two sliders. The top slider can be used to select the temperature at which the thermodynamical data are to be calculated, the bottom slider serves the same purpose for the pressure.

  - Unit cell (Alt+N)

    Figure 5: The dialog box for modifying the unit cell.

    The dialog box shown in the Figure is displayed. The first button on the left, `visible`, allows to turn the display of the unit cell on or off. The three sliders on the left hand side can be used to increase or decrease the number of unit cells displayed in each crystallographic direction. By default between one and five unit cells can be selected.

    The first button on the right, `Show Miller plane`, allows to turn the display of Miller planes on or off. The three sliders underneath this button can be used to select the Miller plane to be displayed. By default, all combinations between -5 and 5 for the Miller indices are possible.

  - Show ellipsoid of inertia (Alt+I)
    The display of the ellipsoid of inertia is toggled.
  - Drawing modes ... (Alt+M)

    Figure 6: The dialog box for setting options for drawing style.

    The dialog box shown in the Figure is provided:
    - with dots
      Drawing of sticks, balls, CPKs and/or molecular orbitals is done as a dot cloud.
    - with lines
      Drawing of sticks, balls, CPKs and/or molecular orbitals is done with meshes.
    - with surface
      Drawing of sticks, balls, CPKs and/or molecular orbitals is done with an opaque surface which has the properties defined in the `viewmolrc` file (these properties hold for sticks as well as for balls or CPKs).
    - Lines while rotating
      If this option is selected the drawing of the molecule will be done with lines during translations and rotations. This speeds up movements on low-end graphics systems. The default is off, but this can be changed in the resource file.
    - Orthographic projection
      The molecule is drawn using an orthographic projection.
    - Perspective projection
      The molecule is drawn using a perspective projection. This kind of projection resembles more closely the way the human eye perceives things.
    - Move molecule
      If this button is selected all translations and rotations carried out with the mouse act on the currently selected molecule.
    - Move view point
      If this button is selected all translations and rotations carried out with the mouse act on the viewpoint. This option is only available if perspective projection is used. Moving the view point allows the user to move into a molecule.
    - Move light 1
      If this button is selected all translations and rotations carried out with the mouse act on light 1.
    - Move light 2
      If this button is selected all translations and rotations carried out with the mouse act on light 2.
    - Lights on/off, Light 1
    - Lights on/off, Light 2
      These two button can be used to switch lights on and off. Lights have only an effect if the drawing mode is ``with surface" and either the stick, ball-and-stick, or CPK model is selected.
    - Resolution of spheres
      The number of polygons used for the drawing of sticks, balls and/or CPKs is changed. A higher value makes the surfaces more smoothly looking, but also decreases drawing speed. A lower value makes the surfaces rougher looking, but increases drawing speed.
    - Line width
      The line width used for drawing the molecule as wire frame model can be selected. A value of 0 means dynamic determination of the line width based on the size of the window. This value is the default.
  - Ground color (Alt+G)
    The color editor appears in a separate window which can be used to change the color of the ground if perspective drawing is enabled (see description of the color editor below, p. ).
  - Background color (Alt+B)
    The color editor appears in a separate window which can be used to change the background color of the window (see description of the color editor below, p. ).
  - Label atoms (Alt+L)
    The atoms are labeled with atom symbols from input files. A number counting the atoms according to their order in the input is concatenated to the symbol.
  - Annotate (Ctrl+N)
    Annotations can be created in the main window using this topic. After selecting this topic the cursor turns into a text input cursor. Clicking at any point in the main window now allows to enter an arbitrary text string. Pressing <return> ends the annotation function. Existing annotations can be edited by simply clicking on them or deleted by deleting all characters in the string. Annotations can be moved in the same way as the molecule can be moved: hold a shift key down, click on the annotation and move the mouse. Annotations support the clipboard, i. e. annotations can be cut and pasted between applications.
  - Run script
    This topic pops up a second menu which can contain any number of items each representing an installed Python script. At least one entry is always present `Select ...` which allows the user to run arbitrary Python scripts.
    - Select ... (Ctrl+R)
      A file selection box is displayed which allows the selection of a Python script to be run within VIEWMOL.
  - Save drawing (Alt+D)

    Figure 7: The dialog box for setting options to save a drawing

    The dialog box shown in the Figure is provided which can be used to set file formats, file names and other options for writing the drawing to a file.
    - TIFF
      The current drawing of the molecule is written out as a TIFF file. The ``TIFF compression" menu permits the selection of a compression algorithm. If normal modes are animated while this option is selected a series of 20 TIFF files will be written out, each containing a single frame of the animation. If the optimization history is animated when this option is selected one TIFF file will be written for each conformation of the molecule encountered in the optimization.
    - PNG
      The current drawing of the molecule is written out as a PNG file. The ``Background transparent" check box allows to create a PNG file with a transparent background. If normal modes are animated while this option is selected a series of 20 PNG files will be written out, each containing a single frame of the animation. If the optimization history is animated when this option is selected one PNG file will be written for each conformation of the molecule encountered in the optimization. By using standard image manipulation tools available on the Internet it is possible to generate a video file (MPEG) from these TIFF or PNG files which can be included in multimedia documents (vide infra, p. ).
    - HPGL
      The current drawing of the molecule is written out as a HPGL file for plotting on a plotter or a laser printer. This topic is not available if the drawing is done with sticks, balls, or CPKs and surfaces or when animations are running.
    - PostScript
      The current drawing of the molecule is written out as a PostScript file. If this topic is selected while the drawing is done with sticks, balls, or CPKs and surfaces a PostScript file containing a bitmap is created. Such a file can become rather large (the size depends on the size of the window) and it is not resolution independent which can result in artefacts on printing.
    - Povray
      The current drawing of the molecule is written out as an input file for POVRAY 3.5. This topic is only available if the drawing is done with sticks, balls, or CPKs. If molecular orbitals are drawn this topic is only available if the MO is drawn with a surface. If normal modes are animated while this option is selected a series of 20 input files for POVRAY will be written out, each containing a single frame of the animation.
    - Landscape
    - Portrait
      The orientation of the drawing on the page can be chosen if the drawing is written out as either a HPGL or a Postscript file.
    - TIFF compression
      Can be used to select the compression mode for TIFF files. Due to a software patent on the LZW compression algorithm this compression cannot be provided.
    - Background transparent
      If a PNG file is to be written this check box can be used to specify a transparent background.
    - File
      The name for the file to be generated.
    - Select
      Brings up a file selection box to select the name for the file to be generated.
    - Paper size
      Can be used to select the paper size for HPGL and PostScript outputs.
    - Paper width in mm
    - Paper height in mm
      Input user defined paper width and height. Only available if ``Paper size" is set to ``User defined".
  - Help/Manual (Alt+H)
    This topic opens a window with the VIEWMOL manual. It requires that the file `viewmol.html` can be accessed in the location `$VIEWMOLPATH/doc`.
  - Configuration ...

    Figure 8: The dialog box for setting configuration options.

    The dialog box shown in the Figure is provided. At the top of this dialog the language VIEWMOL uses in its interface can be selected. VIEWMOL loads its language specific data from files `Viewmol` from the directory `$VIEWMOLPATH/locale/X` where `X` stands for a language identifier. The four text input fields can be used to specify the location of helper programs VIEWMOL needs for some of its operations. If the corresponding program was found in the path the dialog box will already show the correct information. If the programs specified here need file names as parameters, put `%s` as a place holder for the file name in the command.

    A the bottom is a button `Save` which allows the information entered in this dialog as well as some other settings to be stored as resources in `$HOME/.Xdefaults`. The following settings are saved: position and size of all open windows, window colors, selected model, selected drawing mode, selected bond type, setting of ``lines while rotating", selected interpolation mode, resolution of spheres, line width, selected isosurface, selected resolution for density of states, setting of ``automatic recalculation", paper size, and hydrogen bond threshold. Note: On Linux the setting of resources is kept across different invocations of the program. Saving the configuration and restarting VIEWMOL will therefore apparently not work. To get rid of the old resource settings issue the command `xrdb -remove` `$HOME/.Xdefaults` or log out and in again.

  - Quit Viewmol (Q)
    This quits the program.