Description of the Calculations
Previous  Top  Next

It is impossible to give a complete description of the calculation methods, but some account of the procedures should be helpful to guide the use of the program.

Locating Atoms, Bonds, Polyhedra and Vectors

If crystallographic symmetry is present, symmetry operations in the form given in the International Tables for X-ray Crystallography are converted to matrices. For non-crystallographic symmetry (e.g. pentagonal, icosahedral) the matrices, generated by the auxilliary program SYMGRP, are read in directly. The atom coordinates are multiplied by these matrices, and translations are added if there are screw axes or glide planes in the space group, to find all the atoms in the unit cell or molecule. The coordinates of the atoms are then converted to a Cartesian system if necessary.

If the structure is a molecule, then no further location of atoms is necessary, but for polymers or crystals, the lattice translations must be applied, subject to one of several types of boundary. In some cases, especially for polymers, it may be sufficient to take all atoms in unit cells related to the initial one by specified numbers of lattice translations in each of the three crystal or polymer axis directions — one or two of the translations may be disabled, leading to two- or one-dimensional polymers, respectively.

For crystals a more general and powerful method of determining the structure boundaries is by means of crystal faces. The crystal faces are specified by their standard Miller-Bravais indices (the reciprocals of the intercepts on the three crystal axes), and by a central distance, which is the perpendicular distance from the center of coordinates to the face. If the crystal has symmetry, this can used in specifying faces; i.e. only one face of each symmetry-equivalent set, or form, need be entered. Symmetry equivalents of the faces are derived similar to that used for atoms. However, if desired the symmetry used in the generation of faces can be lower than that used in the generation of atoms.

A special case of boundary faces is a slice, which is a slab of the structure bounded by a given face and its negative, with a thickness determined by the crystallographic interplanar or d-spacing — the limits to the extent of the structure in the two dimensions parallel to the given face are arbitrary and may be specified.

To identify the the corners and edges defined by the crystal faces, all possible intersections of triplets of faces are located; those which are further from the center than any face are rejected as crystal corners. Edges are defined by pairs of corners which have two faces in common.

Atoms within the specified face boundaries are simply those which are not at a positive distance from any face. Starting with atoms in the central unit cell (fractional coordinates 0 to 1), lattice translations are added or subtracted until all possible atoms have been tested for inclusion. The algorithm which does this is rather complex, as finding the starting and ending unit-cell limits for the atoms search in the general case of face boundaries is not trivial.

If coordination polyhedra are to be shown, the atoms involved must be located. ATOMS will identify all polyhedra consisting of specified types of ligands within a given distance of a central atom. The ligand atom locations (points) form the corners of opaque polyhedra. Edges and faces of each polyhedron must be identified, which requires some rather complex calculations. Because of possible variation in coordination number, data on corners, edges and faces of polyhedra must be packed into special arrays, and unpacked each time they are used.

In the Thermal Ellipsoids Model mode, at the start of the calculation the temperature factors for each input atom are converted to the principal axes of a thermal ellipsoid. During generation of the atoms within boundaries, the number of the symmetry matrix used is saved, to be used later in plotting.

If atomic vectors are present, they are represented by pseudo-atoms (at the ends of the vectors) and by pseudo-bonds. This simplifies the geometric relations for plotting in 2D Drawing modes. These pseudo-atoms and pseudo-bonds are generated in a special loop.

The atom locations, identity of bonds and data on polyhedra if present, constitute a "permanent'' set of parameters for each structure. The atom coordinates may be rotated in any of several ways to obtain a suitable view.

Plotting - 2D Drawing modes

Whenever a drawing is made for the screen, dot-matrix plotter or pen plotter, the actual elements which appear in the drawing, that is arcs of circles representing spherical atoms and lines representing bonds and polyhedra, must be recalculated, since their interrelations depend on the viewing angle. Each polyhedron must be examined to classify edges as to whether they are front, back or boundary.

For screen or dot-matrix drawings, the procedure is somewhat simplified since it is possible to blank out or draw over elements which lie underneath others. The atoms, polyhedra and bonds are sorted according to their height, or distance from the viewer. The elements are then plotted in sequence from the most distant to the nearest. Atoms are represented in the sorting process by their centers, bonds by their midpoints, and polyhedra by the central atom. This sorting process is a simplification of the true relationships, and conceivably could lead to error, but only if the bonds are unusually long. In fact the drawing method relies on displaying only normal chemical bonds, not arbitrary connections between atoms. If desired, atom labels are drawn during the process of plotting atoms from back to front.

If crystal edges are also shown, the "back'' edges, i.e. those that would be invisible in an opaque crystal, are plotted before the atoms, bonds, etc., and the "front'' edges are plotted after. Sorting the crystal edges is not practicable because of their length. There is no attempt to solve for interpenetration relations of edges with atoms, bonds or polyhedra and errors will usually result if the edges are not completely outside the structure.

For pen plots actual blanking or overlaying is impossible, and it is necessary when drawing a given element to consider every other element which lies higher (closer to the observer), find all the possible intersections and remove the segments which are obscured. Insofar as possible, intersections of structure elements (bonds and atoms, polyhedra) are considered as intersections of two-dimensional figures (circles, lines, ellipses), rather than computing the intersections in three dimensions and then finding the projections. One approximation which is made here is to represent ellipses (which only arise as junctions of atoms and stick bonds, and junctions of interpenetrating atoms, and thus cannot overlie other elements) by means of line segments for purposes of locating intersections; they are actually drawn as ellipses, but slight errors in locations of intersections involving ellipses may occasionally result.

For perspective drawings, the atom locations (and crystal corners if present) are projected from a given perspective distance onto a plane passing through the center of the structure. Overlay relationships with other elements (for pen plots) are then determined on the basis of circular projections for spherical atoms, again making calculations in two dimensions as much as possible. This is not true perspective, but the difference is not likely to be noticed unfavorably in the normal case. In fact, when true perspective is used and the drawing is viewed at other than the (scaled) perspective distance specified in making the projection, the distortion of the projected atom shapes from circles can be very disturbing - this can be verified in 3D Drawing modes.

For shading of atoms, the given illumination vector and the number of shading zones are used to set up outlines for each zone, consisting of circle and ellipse segments. The angle with the illumination vector gives a shade for each zone. The zones need to be set up only once for a given illumination vector, since all atoms are identical except for scaling by the radius. Zones can also be set up for stick bonds, but since the bonds make various angles with the illumination vector, the shade can only be determined at plot time. For polyhedra, the shade of each face is determined at plot time.

In the Thermal Ellipsoid Model mode, at plot time, atoms are sorted and plotted from back to front as for ball-and-stick, but as each atom is drawn the principal axes are transformed using the appropriate symmetry matrix, and the ellipsoid is drawn. Bonds are located in the same way as for standard ball-and-stick, but because the algorithm for finding the intersection of stick bonds with ellipsoids is completely different from that used for spheres, thermal ellipsoids and ball-and-stick cannot be intermixed.
Atomic vectors, which are represented as pseudo-bonds, are in fact drawn much like normal bonds, except that cones (arrowheads) are substituted for the atom on the positive end of the vector (if it is two-ended) for all types of display and output aside from pen plots.

Plotting - 3D Modes.

In this type of drawing, the surfaces of three dimensional objects such as spheres and cylinders are converted to an assemblage of planar polygons. Then each polygon is drawn essentially independently pixel by pixel. The critical difference with 2D Drawing modes is that a depth buffer is used in 3D imaging. This is an array of integers, one for each pixel in the display or output (or that portion which is currently being drawn, when banding is being used). Each element, representing a pixel, holds the relative x coordinate (in the ATOMS observer coordinate system - this is more often the z-axis and the buffer may be called the z-buffer) of the foremost object or polygon. The color for this object is retained in the color buffer, which is a similar array representing pixels; this array is actually the image itself. Whenever a polygon is drawn, each pixel which it contains is compared against the depth buffer; if the x coordinate of the pixel is greater, or closer to the observer than what is in that element of the depth buffer, the color for this pixel in the new polygon replaces the value in the color buffer. That is, the depth buffer keeps track of the front surface of the drawing, and ensures that only this front surface (not any hidden surfaces) are kept in the color buffer or image itself.

Typically, each corner of each polygon is assigned a vector normal, which is not the same as the normal to the polygon itself. For example for a sphere the normals are simply directed from the center outward through the corners of the polygons (triangles). Color is assigned to each corner according to the light equation (see 3D Lighting in the Input2 Menu), and interpolating between the corners at each pixel gives a smooth curved appearance, rather than a collection of flat polyhedra.

When translucency is in effect, it is necessary to blend the color of a new object with what is already in the color buffer. It is normally necessary to plot translucent objects in sequence from back to front, although opaque objects in the same drawing do not have to be sorted. Translucency always requires increased plotting time.

The "double buffer" method is normally used, the "color buffer" being kept in an area of memory and then copied to the screen memory when the drawing is completed. This is usually faster than drawing directly to the screen.

The 2D Drawing mode of ATOMS does not use a depth buffer: the atoms, bonds and polyhedra are sorted from back to front and drawn in that order. When necessary, the intersections of objects are solved analytically and only the required portions of each are drawn.

Using a depth buffer has the advantages that it is not necessary to solve analytically for intersections, nor to sort the objects with respect to depth. This may save considerable time, especially for complex drawings, since the time for sorting tends to increase exponentially with the number of objects. Since analytical solution of intersections is not necessary, it is possible to place essentially any objects into the drawing. in any location. This overcomes the problem in ATOMS 2D Drawing modes of sometimes-incorrect drawing of crystal edges or unit-cell edges which intersect with atoms, bonds and polyhedra. The 3D method allows more complex shading and lighting effects, such as specular highlights and multiple light sources. It also allows translucent objects. For a completely 3-dimensional image, on a computer which has sufficient memory, the 3D Drawing modes are superior to 2D Drawing modes.

However, there are disadvantages to the 3D method. The 3D method is not very suitable for black-and-white drawings, which typically are simplified, showing mutual intersections of atoms with bonds and polyhedra as lines or curves; such intersections simply are not drawn in the 3D method. Because printers have much higher resolution than the screen, this causes even higher memory requirements, and for reasonable sized printed drawings it may be necessary to do the printing in bands or segments.

ATOMS itself uses "Immediate mode" to draw atoms, bonds, etc. - that is, it draws each object and then discards the memory associated with that object. On the other hand, many 3D applications, especially the standard viewers for VRML and 3DMF files, use "Retained mode". In this mode every vertex of every object is read into memory before drawing. This allows simple drawings to be redrawn and rotated rapidly, but it may take a long time to load large drawings initially and uses enormous amounts of memory (typically 16 MB for 300 atoms in a ball-and-stick model).

3D files (VRML, and 3DMF for Macintosh) contain the locations and material properties (especially color) of such common objects as spheres, cylinders, disks and lines, and their orientation where appropriate. Polyhedra are represented as assemblages of polygons. The viewers for these files then use methods similar to those used by ATOMS to draw the objects.