Using Ortep for Visualization of Quantum Chemistry Results

A sample Ortep-generated image

ORTEP is a program for creating publication-quality illustrations of molecular geometries. Written in the 1960-ies, it has survived surprisingly well - drawings created with it can be seen in may research publications today. You can download your own copy of ORTEP from its home site at Oak Ridge National Laboratory.

The downside of being so old is its antiquated user interface: you need to carefully read the manual (over 100 pages) and then type long strings of formatted numbers. Several graphics programs have been created to ease this task, and you are encouraged to study these options. If you, however, want full control over the creation of the images, using numerical input is still the way to go.

ORTEP was designed for interpreting quite complicated crystallographic data. It can generate images of symmetry-equivalent atoms and groups, provide for non-orthogonal coordinate systems, work with probability ellipsoids, etc. While the crystallography people definitely need all these features, it makes creation of a simple input for existing Cartesian coordinates quite difficult.

The Problem Discussed Here

This web-page deals with the standard task in a quantum chemistry group of taking a molecule's XYZ coordinates and making a publishable-quality drawing out of it in Postscript format. For pre-viewing, the X-windows interface is assumed.

Before You Start

The following assumes Unix (Linux) environment. Please consult the manuals of the appropriate ports for non-unix systems.

You need to have the files libpgplot.a, grfont.dat, rgb.txt, pgxwin_server and the executable, ortep102.linuxelf (for Linux, pre-compiled files for other platforms are available). You need to set the environment variable PGPLOT_DIR to point to the location of the first four files, and the variable PGPLOT_DEV to the value "/xwin". I have the following in my .bash_profile for this purpose:

export PGPLOT_DIR=/home/toomas/soft/ortep
export PGPLOT_DEV=/xwin

C-shell and tcshell users may put the following into their .login:

setenv PGPLOT_DIR /home/toomas/soft/ortep
setenv PGPLOT_DEV /xwin

The Input File

It may be a good idea to start from an existing input file rather than build your own from scratch. A sample file used to generate the picture at the top of this page is available as an attachment (the bottom of this page).

I shall not explain all the fields or symbols which appear in the sample input lines. Copy them as they are in the examples. You can later read the manual in order to figure out what the true meaning of each specific digit is.

Almost all input is FORMATted! This means that specific numbers and characters must appear in specific columns in the input file. Ask someone who knows Fortran, or read a book about the language, if you need more information.

Line 1: a title. Does not show up on your drawing, so you may leave it blank.

This is a sample title. You may leave the title field blank.

Line 2: Description of the coordinate system. We use an orthogonal Cartesian coordinate system, which is described with three unit vectors and three 90-degree angles:

1 1.0      1.0      1.0     90.0     90.0     90.0

Line 3: symmetry. The crystallographic equivalent of C1 is described as:

1 x,y,z

If you have the coordinates of all your atoms available (i.e. no need to automatically generate symmetry-equivalent atoms), you may always describe your molecule as if it had C1 symmetry.

Lines 4 and onward: the atoms.
Two lines per atom:
Line A:Columns 1-6 of the first line are the label which is plotted to the final figure. It should be centered in the field (you have some control over placement of individual labels by not centering them here!)
Columns 7-27 can be left blank for our purposes.
The x,y,z coordinates go into columns 28-36, 37-45, 46-57, respectively.
Column 63 must contain a "2".
Line B: Place the radius of the atom (as plotted, in Angstroms) into columns 2-9. Put a "7" into column 63. Here is an example of a Gold atom:

  Au                        0.000329 0.501155 2.006588        2
  0.25                                                        7

For the last atom, put a "1" into the first column of the second line:

  H                        -0.620119-4.770799-0.989268        2
1 0.15                                                        7

Following the coordinate input, you are allowed to write comments into your input file. A comment line starts with a "#" in the first column. You can not put comments into the middle of a multi-line command. You can also not put comments between any of the lines described above.

# This is an example of a comment. Column counting is made easier by this:
#234567890 234567890 234567890 234567890 234567890 234567890 234567890

The rest of the file consists of "commands" to the plotting program. A command consists of a command number in columns 4-9 (right-justified), followed by parameters on the same and possibly the following lines. If some parameters appear on the subsequent lines, a format code (a digit 1-3) will appear in column 3 of the command line (i.e. in front of the command number).

The commands section is always begin with a 201 command, which initiates plotting:


Next, you define your paper size and viewing distance from the origin using a 301 command:

      301   7.0       8.0     25.0      0.5

In this example the drawing will be at most 7 inches wide, 8 inches tall, with 0.5 inch margins, and the projection assumes 25.0 inch viewing distance. Use a "0.0" viewing distance for infinity (parallel projection).

You may want to gain additional perspective by adding a 303 command:

      303   0.005

I do not like the effect it produces, but you might. Usually I omit it.

The 401 command specifies, which atoms to plot. We usually plot all atoms, which is achieved by:

      401   155501 -XX55501

Replace XX with your number of atoms. The last item is a negative value; move the minus sign appropriately, while keeping the "55501" part in columns 23-27.

You may want to rotate the molecule to gain a better view. This is accomplished with a 502 command:

      502        3    180.0        2     20.0        1     30.0

where the "1", "2", "3" are x, y, z axes, respectively, and the rotation angle is given in degrees. The rotations are performed one by one in the order specified. In this example the molecule is first turned upside down around the "z" axis, then turned 20 degrees around "y", and finally 30 degrees around "x". If one or two rotations are enough, leave the rest of the line blank. Omit this command if no rotations are required. You may add additional "502" commands if it takes more than three rotations to achieve a specific effect.

The scale of the drawing is defined by the 603 command, which also specifies that the image should be centered in the rectangle defined above (in "301"). The parameter in columns 28-36 defines the scale in "inches per Angstrom". For medium-sized molecules I have used

      603                       0.5

Next you will need to specify hidden lines removal instructions. These are given by a 1001 command followed by the same parameters as for the "802" described below. You may originally omit the "1001" and fill it in later, after you have finished the "802" down the road.

  2  1001
          1 11  1 26  3   1.30  2.45  0.05

The shape of the atoms is specified with a 700-series command. The classical ORTEP cut-out spheres are made by a "701". The empty circles which may be better suited for quantum chemistry are obtained with a "704". Have a look at page 47 of the manual for other alternatives. In the "7XX" line you also specify the size and placement of labels. The three numbers are font height, x-displacement, and y-displacement, respectively. Experiments are needed to achieve the best results. The sample input at the bottom of this page contains hints on how to use different placements for labels on different atoms.

      701                                       0.1      0.2     0.2

Chemical bonds can be specified with a 802 command. Since the parameters come on the next line, a "2" precedes the command code. You will need to specify, which atoms to consider as origins of bonds, which as targets, bond style, what are the typical bond lengths, and what is the diameter of the cylinder that represents the bond. In this example, there were 26 atoms in the molecule, of those 12-26 were hydrogens. There are no H-H bonds, so hydrogens were specified only in the target list, but not in the origin list.

  2   802
          1 11  1 26  3   1.30  2.45  0.05

This means that all combinations of atoms 1-11 with any of atoms 1-26 should be considered as candidates for bond placement. Those atom pairs which are in the distance range of 1.30 - 2.45 angstroms of each other are considered bonded, and a "style 3" bond with 0.05 A diameter is drawn between them. No spurious H-H bonds are generated since atoms 12-26 are not considered as origins.

Once you have achieved the correct values for the "802" command, duplicate the parameter list into the "1001" command which needs to precede the "701".

Finally, you will need to terminate plotting and the whole input file by the combination of 202 and -1 commands:


Do not write anything into the lines following the "-1" line or the ORTEP program will not terminate properly.

Running the ORTEP program itself is pretty straightforward and I do not think any specific instructions will be needed. Always restart the program anew when making a Postscript file - the "Save as Postscript" option after X-window visualization seems to omit the "502" rotations.

Once again, a complete example is available below for studying and modification. The sample image at the top of this page was generated with this input, and then converted to GIF for web display. This and several other similar images were published in: P. Pyykkö and T. Tamm, Organometallics, 1998, 17, 4842-4852. Larger examples of similar images are available in: T. Tamm and P. Pyykkö, Theor. Chem. Acc, 2000, 103, 399-408.

Toomas Tamm,
Feb 19, 2012, 3:19 AM