Gelb Research Group at Washington University in St. Louis

home

people
publications
research
software
resources
facilities
course pages
positions
contact us




Molecular Graphics


We're interested in visualization software appropriate to molecular simulation research. This falls into two main categories:
  • Software for making high-quality pictures of molecules
  • Software for graphical representation of simulation data
Below are some thoughts and semi-tutorial information on these subjects. At this time, the "molecular graphics" section is much better developed.

High-quality Molecular Graphics

There are, in general, two ways of generating a picture of a snapshot of a molecular simulation. The first is using a rastering algorithm, which is the basis of the widely-available molecular visualization programs Rasmol and Raster3D, as well as the commercial renderer RenderMan from Pixar (used to make the "Toy Story" movies, among others). The quality of the output from rastering programs varies with the sophistication of the lighting and shading algorithms; the main advantage of this approach is that it is very fast. The Rasmol and Raster3D programs can each read several "standard" molecular configuration file formats, and output in various image formats. These codes are very heavily oriented towards biomolecular systems, and are not particularly suited to solid-state or condensed-matter simulations. (In fact, the vast bulk of molecular visualization software available today is oriented towards biomolecular systems.)

The second approach is to use ray-tracing, which is the source of most "photorealistic" computer-generated images nowadays. This method is computationally expensive. We have largely used the freely-available POV-Ray for this purpose.

In order to use a general-purpose rendering tool (POV-Ray, RenderMan, etc.) for molecular graphics one must convert the molecular configuration data into the description of a "scene". For old-fashioned ray-tracers such as POV-Ray, this means constructing a "scene file" in which the picture is described as a collection of primitive objects, light sources, and a camera with certain focal properties. RenderMan, along with others, adhere to something called the "RenderMan Interface", which is a sort of procedural language for describing and rendering a scene, much as "postscript" is a procedural language for putting words and pictures on a page and printing it. We have not extensively worked with this specification, but hope to in the future.

Molecular graphics with POV-Ray

POV-Ray scene files are plain-text descriptions of the picture to be drawn. To cast a molecular simulation in this form, what generally needs to be done is that:

  • Each atom gets represented by a sphere of some color, radius, and texture
  • Each bond gets represented by a cylinder of some color, radius, length, and texture
  • The simulation box frame can be drawn as a collection of thin cylinders and spheres
  • Some light sources must be specified
  • The camera position, angle, perspective, etc. are specified.
Then the scene can be ray-traced at various degrees of quality, and at various resolutions.

PovChem is the best developed freely-available tool for converting your simulation data into POV-Ray scene files. Also with a biomolecular bent, this one reads PDB files, generates scene files, and automatically renders them. It is available for Windows, Macintosh, and various Unix platforms.

If you really want to go for it, though, I recommend writing your own translator, as it is relatively simple and allows for unlimited flexibility. There are two programs in use here:

  • xyz2pov is a program that I wrote as an exercise in learning C++. It works pretty well, and you can download the source code by clicking here. For each scene, this program outputs both a ".pov" file, with the molecular stuff in it, and a ".inc" file, which contains the camera, lighting, and color/textural specifications.
  • topov is part of the lj2 suite which we developed for simulating multicomponent Lennard-Jones fluid mixtures. This translator is quite sophisticated, but is only functional within that set of programs and cannot deal with other input formats. Virtually all of the molecular graphics on this web-site were generated with topov, except where noted.
The following images are of the "dna.xyz" structure in the xyzpov distribution, using various different options to the program.

A picture using traditional ball-and-stick (e.g., bonds and atoms).

A picture using just bonds.

A picture using large spheres for atoms.

A picture using large spheres for atoms, with the standard "F_MetalE" finish on the atoms, which is quite reflective.

Gratuitous computer graphics

Its easy to get carried away. Here's a nice rendered image from one of my porous glass simulations (24-bit JPEG, 1024x1280, done with POV-ray) This is actually a snapshot of adsorption in a porous glass, with adsorbate particles colored by their instantaneous potential energy, and substrate particles a dark grey.

Making movies

There are lots of possible software solutions for making short movies of molecular simulations, or for animating rotating molecules, etc. While it is possible to write (or obtain) programs that can generate computer video "on-the-fly", the best movies are made by:
  1. Generating high-quality snapshot graphics for each frame
  2. Converting the series of frames into a video stream, preferably at the full rate of 30 frames per second.
This is time-consuming. To make one minute of good-quality video you need 1800 frames; at approximately one minute of CPU time for rendering each frame, this would take 30 hours. Luckily, this processes is totally parallelizable, and can be easily distributed over many computers. It also takes up a lot of disk space.

While the frames can be generated using free software like POV-Ray, converting them to high-quality video generally requires the purchase of some heavy software (and hardware, for analog-video output). You can use the free "mpeg_encode" program to make MPEG-1 videos, but the results aren't really very good. I have used Macintosh-based programs for this in the past, specifically software from Media 100, and "Media Cleaner Pro" from Terran. I am currently investigating the use of Apple's Final Cut Pro for this purpose.

The best export format that I have found so far for generally-playable animation of this type is the QuickTime "animation" codec, which is basically uncompressed. You get about 4 minutes of video into 300 Mb disk space at a frame size of 320x240; the data rate for playing this is too fast for a CDROM so it has to be on your hard drive.

It is likely that DVD-format encoding (that is, MPEG-2) will be a better solution in the long term. We do not yet have the necessary software for encoding DVD-video at this time, and the hardware necessary to master a single DVD-ROM is very expensive at the moment.

For some great movies made by Andrea Delapaz, an undergraduate in our laboratory, check out her visualizations of gases and other phases and visualizations of liquid-vapor phase separations.

Graphical Representation of Simulation Data

3D data sets

Although a great deal of effort has recently gone into the visualization and manipulation of 3D data sets, relatively little of this is directly applicable to molecular simulation work, unless one wants to view either electrostatic potential data (as output by programs like DelPhi) or one is using ab initio potentials and has 3D electron-density or wavefunction data.

More on other stuff later!



Department of Chemistry and Center for Materials Innovation
Washington University in St. Louis
Last modification: Fri Aug 17 18:46:16 2007
gelb@wustl.edu