XMakemol Documentation

Matthew P. Hodges

Version: 5.15


XMakemol is an application for the visualization and manipulation of atomic, molecular, and other chemical systems. It is written in ANSI C and uses the Xlib library for rendering and also the Xt and LessTif toolkits for the user interface. XMakemol is only distributed under the GNU GENERAL PUBLIC LICENSE (Version 2, June 1991) which means that it is free in the sense that you have the freedom to obtain and modify the source and to redistribute it. A copy of the license should have been included in the distribution. You can download view it at http://www.gnu.org/copyleft/gpl.html.

XMakemol is principally a mouse-based application with menus and pop up dialog boxes with buttons, scrollbars etc. In addition, some dialogs have text fields which require information to be inputed from the keyboard. The main window of the application is split into menus at the top, the canvas in the middle and an area at the bottom in which messages appear.

The manual will cover invocation then all the menu entries then some miscellaneous features, mainly dealing with the methods of interacting with the system on the canvas.


Various options are available from the command line. These are as follows:

 Usage: xmakemol [options]
        -a          Switch off atoms
        -b          Switch off bonds
        -h          Switch on hydrogen bonds
        -c <colour> Set the canvas colour
        -e <colour> Set the bounding box colour
        -f <file>   Read file on startup (use '-f -' for STDIN)
        -G          Switch off GL rendering [If OpenGL support is compiled in]
        -u          Print usage information
        -v          Print version information

The -a, -b and -h options toggle the default behaviour and as such might be useful. The -c and -e options allow the user to control the background and bounding box colours in case the defaults are not liked (these may be named colours, e.g., "cadet blue", or hex triplets, e.g., "#5F9EA0"). The -f option allows a file to be specified to be read in on starting the program. The -u options echos the above text to standard output and the -v option prints the version and Copyright information. The -G option switches off rendering using OpenGL primitives, and is only available if support for OpenGL has been compiled in. As for any X application, other options can be specified, for example, -geometry.



The menu entries under File deal with the reading and writing of files and quitting the application.


Choose a file to be read by XMakemol. The file must be in XYZ syntax an example of which follows:

   1 Energy = -594.0315361957    
 Ar      0.86540     -0.41643      2.29667
 Ar     -1.78146     -2.11666      0.23641
 Ar      1.11998     -0.42506     -1.45518
 Ar     -1.52687      1.63520      0.24505
   2 Energy = -594.0315361957    
 Ar      0.86540     -0.41643      2.29667
 Ar     -1.78146     -2.11666      0.23641
 Ar      1.11998     -0.42506     -1.45518
 Ar     -1.52687      1.63520      0.24505

The file is set into "frames" of which there are two in the above example. The structure of each frame is as follows. The first line contains the number of atoms in the frame (M) and the second line contains a comment, which may be empty. The next M lines contain the type of atom followed by the three Cartesian coordinates; the length unit assumed is Angstrom. Note that details of each type of atom are held in the elements file (see below) which contains atomic masses radii and specified colours.

In addition to the basic syntax, it is possible to declare vectors (default maximum of three per atom):

 Water (axes on oxygen displayed using vectors)
 O    0.0  0.0  0.00 atom_vector 1 0 0 atom_vector 0 1 0 atom_vector 0 0 1
 H    0.77 0.0 -0.59
 H   -0.77 0.0 -0.59

and ellipses:

 All ellipses should look the same
 O    -4.0 0.0 0.0 ellipse 1.0 2.0 2.0  0.0 90.0  0.0
 O     0.0 0.0 0.0 ellipse 2.0 1.0 2.0  0.0 90.0 90.0
 O     4.0 0.0 0.0 ellipse 2.0 2.0 1.0  0.0  0.0  0.0

where the ellipse keyword must be followed by three numbers describing the x, y and z axis dimensions and three Euler angles (alpha, beta and gamma). The convention used for the Euler angles is: rotation of gamma about Z; rotation of beta about Y; rotation of alpha about Z, where X, Y and Z are global axes.


Revert to the saved version of the current file.


Choose a file to save coordinate data to. The following options are available:


Merge the current Cartesian coordinates with those in another file. The following options are available:


Choose a file to export data to. The following options are available for the non-OpenGL rendering:

The following options are available for the OpenGL rendering:

The following option is available for either type of rendering:


Convenient dialog to enable printing of PostScript rendering of the canvas (black and white, or colour).


Quit the application; no offers will be made to save any data under any circumstances.


The menu entries under Control provide a number of pop up dialogs for controlling various aspects of frames.


The frames dialog controls the animation of multiple-frame files. At the top, the frame number and corresponding comments are displayed. If the comment is empty, this is also indicated.

Next, there are a number of buttons which do the following:

The speed of the animation can be controlled with the scale bar marked with "Select speed".

If the "Centre each frame" button is activated, then when ever the frame is changed, the centre of mass is moved to the origin. This can be useful if an animation involved large displacements of the centre of mass resulting in the atoms leaving the field of view.

Finally, a frame can be selected by number in the "Select frame" text field.


The animate dialog allows a frame to be rotated by a specified angle by a specified number of times about a specified axis. The animation is started with the "Start" button and can be stopped with the "Stop" button. An indication of the progress of the animation is given in the message area. Such animations can be saved by clicking on the "Save" button followed by selecting a filename; the default type is XYZ, which saves the coordinates for each frame of the animation. With XPM support, an option to save each frame to an XPM file exists.


The Measure dialog shows the distances and angles between selected atoms. Atoms are selected and deselected using [mouse-3] and a selected atom is indicated on the canvas by being stippled. Up to four atoms can be pushed on to and popped off the stack. The selections can be cleared using the "Unselect all atoms" button. Each selected atom is labelled A-D and these labels also appear on the canvas. The atom number is also displayed in the dialog.


The perspective dialog contains two scale bars: the "Alter scale" simply controls the size at which atoms, bonds and so on are drawn and the "Choose depth" scale allows the depth of field to be varied. If the "Toggle depth" button is not activated, then there is no variation in the atom size with depth. The settings can be chosen to "Act on all frames" or to "Act on current frame".


The menu entries under Edit provide a number of pop up dialogs which can alter both the properties of atoms and bonds.


From this dialog, the visibility of each atom can be toggled, i.e., you can directly control whether or not an atom is displayed on the canvas. Individual atoms can be selected using Shift + [Mouse-3] and all invisible atoms can (temporarily) be shown with Shift + [Mouse-1]. In addition the visibility of groups of atoms can be toggled with buttons labelled for example "Toggle H atoms", "Invert selection" and "Reselect all". Each of these can work for:

(Note that rectangular regions can be drawn with Control + [Mouse-1].)

If all frames contain the same number of atoms, then the "Propagate visibilities to all frames" allows changes to apply to all frames.


Scale bars and text widgets are available to translate the selected atoms in the X, Y and Z directions, and to rotate the selected atoms about the X, Y and Z axes. As for the selection of the visible atoms, each can be toggled with Control + [Mouse-3] when the Edit->Positions dialog is open. Groups of atoms can be selected in the same way as outlined above. When an atom is not selected it is drawn with a cross-hair (not OpenGL rendering) and its position cannot be changed.

Scale coordinates

This dialog allows the atom (and vector) coordinates to be scaled by a constant factor. Internally, the program uses Angstrom for the unit of length, and a pre-defined Bohr to Angstrom factor is available, allowing convenient conversion for input files that have the coordinates in Bohr. An Angstrom to Bohr factor is available for the reverse transformation.

Atom and bond sizes

In this dialog, the size of the atoms and bonds as displayed on the canvas can be varied. There are scale bars for the atomic radius, the bond width and the hydrogen bond width. Note that the sizes of the atoms as displayed on the canvas also depend on the covalent or van der Waals radii as set in the external elements file (see below) which is read when the first file is opened.

Bond factors

These two scale bars allow some control over which atoms are considered to be bonded or H-bonded. The algorithm which determines this information from the Cartesian coordinates uses the sum of the covalent radii of pairs of atoms. Increasing the default values will lead to more bonds and decreasing the default value will lead to fewer bonds. If a system is split into molecules (see the molecule keyword below), separate factors for intermolecular and intramolecular bonds can be specified.

Vector display

The vector rendering works better with OpenGL rendering, and this is recommended at present. Some customization of how the vectors look is possible.

Bounding Box

With this dialog, the way that the bounding box is determined can be chosen. If you choose "automatically", XMakemol draws a cuboid which encapsulates all visible atoms. The faces are parallel to the xy, yz and xz planes. If "from file" is chosen, the minimum and maximum coordinates of the bounding box are read from the input file. The input fields allow you to adjust the size of the automatic bounding box.

The visibility of the bounding box can be toggled via the "Bounding Box" item in the View menu.

This dialog is only available if a file is loaded.

Element properties

This dialog allows the convenient editing of the default element properties (colour, covalent/van der Waals radii). These can be saved, in which case the changes will be used for future XMakemol sessions.

GL rendering

If OpenGL support has been compiled in, then this dialog will be present. Firstly, it allows the switching of rendering between the X and OpenGL primitives. Secondly, it allows the customization of some of the OpenGL rendering.

The customizations which can currently be made are:


The Track menu controls the behaviour of the mouse on the canvas and also allows some general transformations to be made to the atomic coordinates. The current mouse bindings can be found in the Help menu.

Rotate about local COM

If this is selected, the mouse on the canvas will control rotations of the atoms about the local centre of mass i.e. that defined by the selected atoms.

Rotate about origin

If this is selected, the mouse on the canvas will control rotations of the atoms about the global origin.


This moves the centre of mass of the system to the origin.

Original orientation

Restore the original orientation (i.e., realign axes).

Original position

Restore the original position of the atoms (i.e., remove any displacements made to the centre of mass).

Reflect x coordinates

Reflects the atomic coordinates about the yz plane.

Reflect y coordinates

Reflects the atomic coordinates about the xz plane.

Reflect z coordinates

Reflects the atomic coordinates about the xy plane.

Invert through centre

Invert all coordinates through the origin.


The View menu controls what is displayed on the canvas.


Toggle whether or not atoms are displayed.


Toggle whether or not bonds are displayed. Bonds can be formed between any two types of atom.


Toggle whether or not hydrogen bonds are displayed. Hydrogen bonds can be formed between any hydrogen and any non-hydrogen atoms.


Toggle whether or not vectors are displayed.

Atom numbers

Toggle whether of not the atom numbers are displayed for each atom. These correspond to the order in which the atoms were read in.

Atom symbols

Toggle whether or not the atomic symbols are displayed for each atom.


Toggle whether or not a set of axes (x,y,z) are displayed on the canvas. These correspond to a local axis set which before any rotations is parallel to the global axes (X,Y,Z). (not OpenGL rendering)

Bounding box

If enabled, a cuboid is drawn which encapsulates all visible atoms. The faces are parallel to the xy, yz and xz planes.


If enabled, this reduces the amount of drawing done on the canvas while the system is being rotated or translated. This can be useful for large systems for which the normal interactive response is slow.



Displays the version and Copyright information.


Gives a pointer to the online documentation.


This dialog gives a list of actions which the mouse has on the canvas.


Details how to report bugs.


The elements file

The elements file is an external file, the location of which must be specified in the Makefile before building. The head of the elements file (past the copyright information) looks like this:

 ! Z     Symbol       Mass        Colour          Cov rad         VdW rad
   1     H            1.008       White           0.300           1.000
   2     HE           4.003       Pink            0.310           1.400

The first entry is the atomic number. The second entry is a label corresponding to what should be written in an input file (note that comparison is not case sensitive). The third entry is the atomic mass. The fourth entry is the colour which is used to paint the atom (and bonds) on the canvas. The final two entries are covalent and van der Waals radii; if there is no van der Waals radius for a given atom a value of zero should be used.

The xmake_anim.pl script

This script which is distributed with the source can be used to merge a group of XPM files produced for an animation into a single file:

Usage: xmake_anim.pl [options] prefix
       -c                (clean up files)
       -d <delay>        (in 1/100th seconds)
       -l <no_loops>     (0 for infinite)
       -o <output>

Other input file options

Examples of the XYZ syntax have been given above. The atom_vector and ellipse keywords have also been described. Several other keywords are available for use in input files:

Periodic systems

There is limited support for dealing with periodic systems. This example shows how to use the available features:


Na 0.0 0.0 0.0 crystal_origin   0.0 0.0 0.0 crystal_images 5 5 5
Cl 2.5 2.5 2.5 crystal_vector 1 5.0 0.0 0.0 crystal_vector 2 0.0 5.0 0.0 crystal_vector 3 0.0 0.0 5.0

Here, a two atom unit cell is defined, and a 5x5x5 slab is defined to be rendered by the crystal_images keyword. Three vectors are defined by the crystal_vector keyword, and these define the cell vectors. If the origin of the crystal isn't at the origin itself, an offset can be specified with the crystal_origin keyword.

Customized rendering modes

It is possible to render different groups of atoms with different rendering modes when OpenGL rendering is in use with lighting switched on. The syntax is:

Water molecule inside Buckminster Fullerene
C  1.22650000   0.00000000   3.31450000  render_tube
C  0.37900000   1.16640000   3.31450000


C  2.33370000  -2.58660000  -0.59480000
O  0.00000000   0.00000000   0.00000000  render_ball_and_stick
H  0.76923955   0.00000000  -0.59357141
H -0.76923955   0.00000000  -0.59357141

where the first 60 atoms will be rendered as "Tubes", and the final three as "Balls and Sticks". Note, that if this type of input is used, then the specifications override the normal "Tubes" or "Ball and Stick" choice that can be made, and these buttons (described above) will have no effect.

Customized bounding box

You can specify a custom bounding box, which can be shown instead of the automatically-determined one. This is done using the bbox_xyz keyword. It takes the minimum and maximum coordinates of the bounding box as parameters, in the following order: xmin, xmax, ymin, ymax, zmin, zmax. For example,

Custom bounding box around water molecule
O  0.00000000   0.00000000   0.00000000
H  0.76923955   0.00000000  -0.59357141  bbox_xyz -1.0 1.0 -0.5 0.5 -1.0 0.5
H -0.76923955   0.00000000  -0.59357141

draws a box around a water molecule. As you can see, bbox_xyz does not have to be associated with the first atom. If this keyword is given in the input file, the bounding box will automatically be made visible after the file is loaded. Via the "Bounding Box" item in the "Edit" menu you can select which bounding box is shown and also modify the size of the automatically-determined one. If you give the bounding box data in the first frame, it will be reused in all frames, unless other data is specified. This feature is, for example, useful if you want to visualize results of computer simulations of bulk systems, with the bounding box representing your simulation box.

Specifying molecules

The molecule keyword can be used on an input line to signify the start of a new molecule (this is implied for the first one). At present, the only feature that exploits this is the choice of separate values for intermolecular and intramolecular bond and H-bond factors.