# Module MMTK.Visualization

This module provides visualization of chemical objects and animated visualization of normal modes and sequences of configurations, including trajectories. Visualization depends on external visualization programs. On Unix systems, these programs are defined by environment variables. Under Windows NT, the system definitions for files with extension "pdb" and "wrl" are used.

A viewer for PDB files can be defined by the environment variable `PDBVIEWER`. For showing a PDB file, MMTK will execute a command consisting of the value of this variable followed by a space and the name of the PDB file.

A viewer for VRML files can be defined by the environment variable `VRMLVIEWER`. For showing a VRML file, MMTK will execute a command consisting of the value of this variable followed by a space and the name of the VRML file.

Since there is no standard for launching viewers for animation, MMTK supports only two programs: VMD and XMol. MMTK detects these programs by inspecting the value of the environment variable `PDBVIEWER`. This value must be the file name of the executable, and must give "vmd" or "xmol" after stripping off an optional directory specification.

## Functions

- view()

  Equivalent to object.view(parameters).

- viewTrajectory()

  Launches an external viewer with animation capabilities to display the configurations from first to last in increments of step in trajectory. The trajectory can be specified by a MMTK.Trajectory.Trajectory object or by a string which is interpreted as the file name of a trajectory file. An optional parameter subset can specify an object which is a subset of the universe contained in the trajectory, in order to restrict visualization to this subset.

- viewSequence()

  Launches an external viewer with animation capabilities to display object in the configurations given in conf_list, which can be any sequence of configurations, including the variable "configuration" from a MMTK.Trajectory.Trajectory object. If periodic is 1, the configurations will be repeated periodically, provided that the external viewers supports this operation.

## Class Viewable: Any viewable chemical object

This class is a mix-in class that defines a general visualization method for all viewable objects, i.e. chemical objects (atoms, molecules, etc.), collections, and universes.

Methods:

- graphicsObjects(**options)

  Returns a list of graphics objects that represent the object for which the method is called. All options are specified as keyword arguments:

  configuration

    the configuration in which the objects are drawn (default: the current configuration)

  model

    a string specifying one of several graphical representations ("wireframe", "tube", "ball_and_stick"). Default is "wireframe".

  ball_radius

    the radius of the balls representing the atoms in a ball-and-stick model, default: 0.03

  stick_radius

    the radius of the sticks representing the bonds in a ball-and-stick or tube model, default: 0.02 for the tube model, 0.01 for the ball-and-stick model

  graphics_module

    the module in which the elementary graphics objects are defined (default: Scientific.Visualization.VRML)

  color_values

    a MMTK.ParticleScalar object that defines a value for each atom which defines that atom's color via the color scale object specified by the option color_scale. If no value is given for color_values, the atoms' colors are taken from the attribute `color` of each atom object (default values for each chemical element are provided in the chemical database).

  color_scale

    an object that returns a color object (as defined in the module Scientific.Visualization.Color) when called with a number argument. Suitable objects are defined by Scientific.Visualization.Color.ColorScale and Scientific.Visualization.Color.SymmetricColorScale. The object is used only when the option color_values is specified as well. The default is a blue-to-red color scale that covers the range of the values given in color_values.

  color

    a color name predefined in the module Scientific.Visualization.Color. The corresponding color is applied to all graphics objects that are returned.