Explosive Molecular Graphics Edited by Matthew M. Thomas 
As upperclassmen in an undergraduate chemical engineering course on transport phenomena in the early 1980s, my classmates and I were once regaled by our professor, who, having recently bludgeoned us with a difficult exam, felt the need to re-establish some measure of esprit de corps among the ranks. "Let me remind you," he barked, "that you are chemical engineers. The chemist starts with small amounts of nitric acid, sulfuric acid, and toluene. He mixes the acids with the toluene in a small flask under heat, producing, in successive stages, mononitrotoluene, dinitrotoluene, and finally trinitrotoluene - the explosive you know as TNT. He's sweating and fretting throughout this process: The acids are dangerous in themselves, the mixture is combustible under heat, and the risk grows as the TNT synthesis completion draws near. And with great relief at having survived such dangerous (though small-scale) work, the chemist then whisks his recipe off to you, the chemical engineer, who are tasked with making hundreds of pounds of a product 1) that was dangerous to make on the lab scale, and 2) whose danger scales in proportion to reactor size." We laughed. Those jittery chemists. They avoided not only large-scale TNT production responsibility but also our last exam. 
The overarching point of the class was that heat, mass, and momentum transfer effects play a large role in chemical reactor performance, and the chemical engineer must keep such effects under control if s/he is to design and run an efficient and safe reactor. The point of our professor (aside from reconciling and constructive levity) was that the chemical engineer is responsible for the scale-up, safety, and profitability of large-scale chemical production. The chemist is responsible for synthesizing the reaction needed to produce the chemical of interest - it is within the chemist's domain that toluene, the acids, and heat first merged to yield TNT. Despite inevitable differences and areas of rivalry between chemist and chemical engineer, they ultimately must collaborate in efficient chemical production. My undergraduate transport phenomena professor, degreed in both chemistry and chemical engineering, understood as much. 
Your reviewer, degreed in the latter but not in the former, nevertheless endeavors to examine tools useful primarily to chemists in this MathSource review. The tools of note illustrate the structure of chemical compounds, and they are of greater interest to the chemist because the chemist has direct responsibility for putting them together and breaking them apart. Of course, they should also be of interest to undergraduate organic chemistry students, be they bound for degrees in chemistry or in chemical engineering. Many such tools exist, but for this review, we'll look at two of them - one from MathSource, one not. The molecular visualization package from MathSource is MolecularGraphics.m; that not from MathSource is RasMol. In the following sections, we describe RasMol, describe MolecularGraphics.m, put both to use in illustrating the aforementioned TNT molecule, and finally summarize our findings in regard to these programs.

RasMol

As of this April 1998 writing, the background on RasMol could be found via the World-Wide Web at URL http://www.glaxowellcome.co.uk/software/history.html. Designed to allow for molecular visualization, especially within biochemistry, the RasMol software was spurred by the advent of new graphics workstations at the end of the 1980s. These new workstations stored a screen image as a raster (a grid of pixels, each with its own color), which allowed for the representation of solids and flat surfaces, but which were deficient in depth representation. The development of RasMol (RASter display of MOLecules) was intended to address the strengths and deficiencies of the new raster displays, while giving biochemists a new tool for molecular analysis. Beginning as an undergraduate project in ray tracing algorithms and parallel processing, RasMol matured at the University of Edinburgh in the early 1990s, and in 1993, the decision was made to give RasMol away through the Internet. The U.K. company Glaxo Wellcome, makers of Zantac ulcer medication and other drugs good for what ails you, has sponsored RasMol development since January 1994. The RasMol history web page claims RasMol to be the most popular 3-D molecular graphics viewer now available, with over 15,000 sites running the software, and with versions available on Macintosh, PC, UNIX, VMS, Cray, and other platforms. 
The prime mover behind RasMol is Roger A. Sayle, who had been affiliated with Glaxo Wellcome and the University of Edinburgh at least through 1994 (the last copyright year of RasMol material on the Glaxo Wellcome site). The web site offering RasMol details is at URL http://www.glaxowellcome.co.uk/software/rasmol/. One problem with said site: It purports to offer RasMol software and the accompanying documentation via anonymous FTP from server ftp://ftp.dcs.ed.ac.uk/pub/rasmol, but early April 1998 server searches evoked howls of "Unknown Host" from at least one FTP software package. Not to worry: Freeware with RasMol's popularity is also available from a myriad of other sites, including URL http://wunmr.wustl.edu/EduDev/Ferritin/rasdir.html. This site offers RasMol version 2.6-ucb, developed by Marco Molinaro of the Univ. of California Regents/ModularCHEM Consortium. In addition to explicit downloading instructions, this site also offers helpful instructions on setting up your Netscape browser to use RasMol. It is RasMol version 2.6-ucb, running on Windows 95, that we review. 
RasMol comprises two screens - a smaller screen labeled RasMol Molecules, and a larger screen labeled RasMol Version 2.6. The smaller screen offers a 2×3 grid of buttons, which allow alteration of molecule orientation on the larger screen, and which provide information about said molecule. These six buttons are labeled Distance, Angle, Dihedral, Rotate Molecule, Rotate All, and Rotate Bond. Below this button grid is a check-box, labeled Keep Labels on Screen. Checking this box displays atom identity, bond distance, bond angle, and other information on the larger screen. A "Molecules Loaded" sub-screen displays the names of the PDB files whose molecules are displayed on the larger screen. The PDB files provide atom identification and coordinate information; more about these files in due course. The larger screen displays the molecule and offers seven top-level menus: File, Edit, Display, Colours (RasMol is a U.K.-originated package through and through), Options, Export, and Help. The File menu offers standard options (Open, Information, Close, Print, Print Setup, Exit), as does the Edit menu (Select All, Cut, Copy, Paste, Delete). The Display, Colours, and Options menus offer a combined 23 functions to alter the appearance of the molecule, or of atoms and bond linkages within the molecule. The Export menu allows the molecule graphic to be exported into BMP, GIF, EPSF, PPM, or RAST format; the Help menu offers RasMol information and the user manual. One look at these screens reveals that RasMol wasn't written over a fortnight. 
In addition to the web pages and sites already listed, there are other sites hosting RasMol-related documentation. Foremost among these, perhaps, is the "RasMol Home Page" at URL http://www.umass.edu/microbio/rasmol/. This web page offers links to much RasMol information, generated by host Univ. of Massachusetts - Amherst as well as other organizations. Amherst-generated material includes the "RasMol Quick Start" introduction to RasMol, links to PDB file sources, a description of the PDB format, and links to a number of RasMol tutorials and papers. As of December 1996, Eric Martz (emartz@microbio.umass.edu) ran the Amherst site. Gale Rhodes of the University of Southern Maine Department of Chemistry (rhodes@usm.maine.edu) offers a very good RasMol tutorial, available from URL http://macweb.acs.usm.maine.edu/chemistry/GR/GraphicsGallery/RasTut.html as of April 1998 and dated 01 November 1997. RasMol is capable of much more than that indicated by its seven menus; the Rhodes tutorial covers advanced topics such as RasMol commands and scripts. 
RasMol (its large screen, in particular) uses PDB format files to generate and display molecular images. PDB stands for the Protein Data Bank, established in 1971 and maintained at the Brookhaven National Laboratory in New York. These ASCII-based atomic coordinate files contain one record for each atom in a given molecule; a record lists the atom name, the chain in the molecule to which the atom belongs, the Cartesian coordinates specifying atom position within the molecule, and other information. The coordinates are often determined through x-ray diffraction or nuclear magnetic resonance. The pdb.htm page within the Amherst "RasMol Home Page" cited above contains detailed information about the PDB format. Likewise, the whereget.htm page within the Amherst site contains links to a vast number of PDB file repositories. If you want atomic coordinate files for use with RasMol (or, for that matter, for the MolecularGraphics.m package to be discussed), these repositories are for you. Their untethered availability, from many reputable sources, represents the best that the Internet has to offer. 

RasMol Sticks version of TNT 

RasMol Ball & Stick version of TNT 

RasMol Spacefill version of TNT

MolecularGraphics.m

A MathSource response to RasMol is the /Applications/Chemistry/0205-164 item, entitled Molecular Graphics Package 1.0, by David Nordfors. The package itself is the 13 kB MolecularGraphics.m package; accompanying it is the 2 kB DemoMolecularGraphics.m demonstration file. These items are dated June 1993, and evidently were written while author Nordfors was in Heidelberg, Germany. The URL for Nordfors' web page is http://www.pi.se/nordfors/homepeng.html: We can infer from its contents that Nordfors wrote MolecularGraphics.m while serving an NFR (Swedish natural science research council) postdoctoral fellowship in the theoretical chemistry department at Heidelberg (September 1991 - October 1993). A RasMol FTP mirror site is in Heidelberg; one wonders if Nordfors had encountered RasMol before writing MolecularGraphics.m. Nordfors took a doctorate in molecular quantum physics from Uppsala University (Uppsala, Sweden) in April 1990. He now serves (as of the 18 January 1998 web-page date) as a program manager for research in the Foundation for Knowledge and Competence Development. He lists his current email address as David.Nordfors@kks.se. Another Mathematica package written by Nordfors, PerturbationTheory.m (3 kB), is also available through his web site. 
The MolecularGraphics.m package begins with a Heidelberg-based email address for David Nordfors, which is clearly outdated in light of Nordfors' recent web site information. The package then displays a note, warning users not to include MolecularGraphics.m in any commercial products without permission from the author, and not to remove the note from the package. MolecularGraphics.m, within the BeginPackage[ ] primitive, establishes Needs[ ] for eight other Mathematica packages, all of which are available through MathSource (more on these shortly). Usage statements for package commands DrawNuclei, DrawBonds, DrawMolecule, and the rest are present, with the DrawBonds usage statement containing an error: Instead of "DrawBonds," this statement cites "DrawNuclei." The package then defines a large number of options for the commands, and defines lists of atomic, covalent, and default radii (the likes of which can be found in chemistry texts such as Dickerson et al [1979], and in standard chemistry reference works such as Dean [1985] and Lide [1997]; Pauling [1945] puts these lists in context). Here is the MolecularGraphics.m coloring scheme: hydrogen is turquoise; carbon is light gray; nitrogen is green; oxygen is red; all of these colors are defined using the RGBColor[ ] primitive. (By contrast, RasMol offers the standard CPK [Corey Pauling Kultin] scheme under its Colours menu: carbon is gray and oxygen is red, but hydrogen is white and nitrogen is blue.) Finally, MolecularGraphics.m defines its DrawNuclei, DrawBonds, DrawMolecule, and other commands. Other than its usage statements and its version of the "Do Not Remove Under Penalty Of Law" tag found on your sofa cushions, this package is free and clear of anything even remotely resembling documentation. 
As noted above, MolecularGraphics.m needs eight other packages. These eight are Roman E. Maeder's Filter Options (/Enhancements/Language/0201-249), John Novak's Plots of 3D Vector Field (/Enhancements/Graphics/3D/0200-585), Maeder's Graphics with Platonic Polyhedra (/Enhancements/Geometry/0200-596), Maeder's Shapes of Common 3D Solids (/Enhancements/Geometry/0200-608), Wolfram Research Inc.'s Colors (/Enhancements/Graphics/General/0200-462), Bruce K. Sawhill's and the late Jerry B. Keiper's Three-Dimensional Vector Analysis (/Enhancements/Algebraic/0200-136), WRI's Chemical Elements (/Applications/DataTables/0200-787... see the MathSource review in the Fall 1995 issue of this journal), and WRI's 2D and 3D Rotations (/Enhancements/Geometry/0200-439). As the parenthetical expressions indicate, these packages are available through MathSource. If you send your web browser to http://www.mathsource.com these days, you will find that 1) MathSource searches are making use of the Harvest Information Discovery and Access System (URL harvest.transarc.com), and 2) MathSource searches now differentiate between old (<= Mathematica version 2.2) and new (>= 3.0) items - all eight packages just cited now fit the former category. Given Mathematica's approaching 10th anniversary, the old/new break is a logical move by Wolfram Research, but be aware that you now need to make two MathSource searches instead of just one to explore thoroughly the MathSource universe. 
Though free from documentation, MolecularGraphics.m nevertheless has a related demonstration package, which is the 2 kB DemoMolecularGraphics.m package (also by David Nordfors). As is the main package, so it is that the demonstration package is untainted by the presence of documentation. DemoMolecularGraphics.m first loads the main package into Mathematica, then defines one of two alternate 6×4 lists named "atoms." Between these two alternate lists, only the first columns differ: One version contains the likes of "C," "N," and "H;" the other, the likes of integers 6, 7, and 1. The user is left to figure out that C, N, and H are the symbols for carbon, nitrogen, and hydrogen atoms, while 6, 7, and 1 are the atomic numbers for these three atoms, respectively. Similarly, the user is left to deduce that the second, third, and fourth columns are the x, y, and z atomic coordinates of each atom within a molecule defined by list "atoms." DemoMolecularGraphics.m then defines a "displacementvectors list," and uses the "atoms" list to show off commands DrawNuclei[ ], DrawBonds[ ], DrawMolecule[ ], DrawVectors[ ], and DrawDistortion[ ]. From the graphics created by the demonstration package, it appears that "atoms" is a truncated PDB-like atomic coordinate file for the methaniminonium ion, CH2NH2+; the six rows in "atoms" represented one carbon atom, one nitrogen atom, and four hydrogen atoms. (So goes your reviewer's best guess.) DrawNuclei[ ] shows only the six atoms in the ion (without bonds); DrawBonds[ ] shows only the five bonds (a cylinder represents both single and double bonds); DrawMolecule[ ] combines atoms and bonds; DrawVectors[ ] shows displacement vectors alone; DrawDistortion[ ] combines atoms, bonds, and displacement vectors. Octahedra or spheres can represent atoms in these graphics; the color scheme is as noted above.

A TNT-based Assessment

Having worked his way through the documentation-free MathSource-resident package on molecular visualization, your flustered reviewer now wishes to demonstrate it (and RasMol) on a molecule a bit more complex than the aforementioned methaniminonium ion. Given his preceding prose, he somehow deems 2, 4, 6 - trinitrotoluene an appropriate molecule for the demonstrations. Note in his subsequent prose that he intends not to synthesize said molecule, though he could quote from references licit [Parker, 1993, p. 693] and less licit [The Rocker's (Metallibashers Inc.) recipe at URL http://members.tripod.com/~PHREAKERLORD/tnt.htm, as of April 1998] on the synthesis, were he so inclined - and forget not the lecture he heard fifteen-odd years ago. 
To begin, we need a PDB file for 2, 4, 6 - TNT, and we find it in one of the repositories linked to the Amherst "RasMol Home Page." At the Okanagan University College Chemistry Department in Kelowna, British Columbia, Dr. Dave Woodcock's Nitro Derivatives page (URL http://www.sci.ouc.bc.ca/chem/molecule/nitro.htm) contains a link to the PDB file we want. So we get this 21-atom tnt.pdb file and put it to work with RasMol version 2.6-ucb, with the Keep Labels on Screen check-box filled, and the Colours menu-item CPK selected. Figure 1 is the result from Display menu-item Sticks; Figure 2, that from menu-item Ball & Stick; Figure 3, that from Spacefill. In these gray-scale figures, the darkest shade represents oxygen, the dark shade represents nitrogen, the light shade represents carbon, and the lightest shade represents hydrogen. "O" and "N" labels denote the oxygen and nitrogen atoms. Note the nitro (NO2) groups on the second, fourth, and sixth benzene-ring carbon atoms, and the methyl (CH3) group on the first such carbon atom. Using our mouse and its left and right buttons, we can rapidly translate or rotate the large-screen RasMol 2, 4, 6 - TNT rendering as we see fit; we can also manipulate portions of the molecule, or find information about segments of the molecule. 
We next load MolecularGraphics.m and its eight attendant packages. Using Dr. Woodcock's tnt.pdb file as a template, we then create a 21×4 list named "tnt." The atomic numbers in the "tnt" record have a one-to-one correspondence to the atoms in tnt.pdb; these atomic numbers are in the first column of the "tnt" list. Columns 2-4 of "tnt" are the atomic coordinates of each 2, 4, 6 - TNT atom - also taken directly from tnt.pdb. Having created the "tnt" list, we submit it to DrawNuclei[ ], DrawBonds[ ], and DrawMolecule[ ]. While Mathematica computes and renders, we hold our breath: Will MolecularGraphics.m treat the atomic coordinates of each atom as RasMol does? Need the sequence of atomic records differ from RasMol to MolecularGraphics.m? Would any glitches demand further guidance-free alternation in the transformation from tnt.pdb to the "tnt" list? The resulting Mathematica notebook shows the "tnt" list, and output from DrawNuclei[tnt], DrawBonds[tnt], and DrawMolecule[tnt, 3d-options], in which "3d-options" are option settings for the Plot3D[ ] primitive. (In color, the oxygen atoms are red, the nitrogen atoms green, the carbon gray, and the hydrogen turquoise.) DrawNuclei[tnt] puts the atoms where we expect them (in light of Figures 1-3); DrawBonds[ ] does likewise with the bonds; DrawMolecules[tnt, 3d-options] does both. Readers, we are in luck: For all of its profound documentation deficiencies, the MolecularGraphics.m commands work well on minimally modified PDB-type atomic coordinate files. You should thus be able to start with any PDB file, and get reasonable results with MolecularGraphics.m. Can you replace "should thus be" with "are" in the preceding sentence? That is your homework.

tnt = {{6,1.183,-0.757,-0.174},
       {6,1.212,0.643,-0.175},
       {6,0.015,1.368,-0.204},
       {6,-1.211,0.693,-0.232},
       {6,-1.240,-0.706,-0.231},
       {6,-0.043,-1.431,-0.201},
       {7,-0.071,-2.771,-0.200},
       {8,1.126,-3.496,-0.171},
       {8,-1.297,-3.446,-0.228},
       {7,2.386,1.289,-0.148},
       {8,2.415,2.689,-0.150},
       {8,3.583,0.564,-0.119},
       {7,-2.357,1.387,-0.260},
       {8,-3.583,0.713,-0.288},
       {8,-2.328,2.787,-0.262},
       {6,0.047,2.894,-0.206},
       {1,2.107,-1.316,-0.150},
       {1,-2.187,-1.227,-0.252},
       {1,0.995,3.237,-0.619},
       {1,-0.059,3.260,0.816},
       {1,-0.773,3.273,-0.816}}

DrawNuclei[tnt]

DrawBonds[tnt]

DrawMolecule[tnt,
  ViewPoint -> {0.842, -2.638, 1.945},
  Boxed -> False, PlotLabel -> "TNT"]

Summary

It is exhaustive work to grapple with MolecularGraphics.m without a manual, and, of course, MolecularGraphics.m has no documentation other than usage statements, let alone a full-blown user's manual. The RasMol user manual, by contrast, is available in several languages, including English, French, and Thai, and has the content to justify the many translations. So it occurs when one package is written by a post-doc bound for his homeland after a tour of duty abroad, while the other is supported by one of the foremost multinational biopharmaceutical corporations now in business. RasMol also has a large following that befits a capability-rich freeware package; MolecularGraphics.m has not only a lesser following but also a tie to a larger package that is assuredly not freeware. There are strengths in MolecularGraphics.m: its proportioned size differences in its atoms (rendered octahedrally, spherically, or otherwise) are matched only by the Spacefill option in RasMol; it has, in DrawVectors[ ] and DrawDistortion[ ], commands apparently unmatched by RasMol. Neither RasMol nor MolecularGraphics.m offers differing representations for single, double, and triple bonds between atoms. Nonetheless, as one might expect, RasMol is the superior package. If you know of a student struggling through an organic chemistry or biochemistry course, tell him or her about RasMol. If you know of such a student who has much time on his/her hands and a predisposition to Mathematica, tell him/her about MolecularGraphics.m.

References

Dean, J. A., editor (1985). Lange's Handbook of Chemistry, 13th edition. McGraw-Hill, New York. 
Dickerson, R. E., Gray, H. B., and Haight JR., G. P. (1979). Chemical Principles, 3rd edition. Benjamin/Cummings Publishing Company, Menlo Park, California. 
Lide, D. R., editor (1997). CRC Handbook of Chemistry and Physics, 78th edition. CRC Press, Boca Raton, Florida. 
Parker, S. P., editor (1993). McGraw-Hill Encyclopedia of Chemistry, 2nd edition. McGraw-Hill, New York. 
Pauling, L. (1945). The Nature of the Chemical Bond. Cornell University Press, Ithaca, New York.

About the Author

Matthew M. Thomas completed his doctorate in chemical engineering at Washington University in St. Louis, in December 1995. The batch chemical process quality control aspects of that work are meticulously explained in the October 1997 issue of the AIChE Journal, with a related news item in the Chemical Engineering Progress issue from the same month. 
thomas@wuche2.wustl.edu