How We Did Crystal Structures

The C++ program, written by Andrew Schultz, used to create the .xyz crystal structure files is available here. chem.h and vector.h are also available.

Setup

The program reads the coordinates for the unit cell from a file and reproduces it. The unit cell must be rectangular and must have one corner at the origin. The other corner is defined by the user. Atoms with coordinates equal to 0 must be omitted as these are duplicated elsewhere in the cell. The program compensates for this. The user is asked for the coordinates opposite the origin, the expansion ratio (if needed. see this for more information), and the number of duplications in each direction.

The program calculates the number of atoms that will be in the final structure compensating for those atoms omitted from the original unit cell. If x, y and z are the coordinates of an atom, and cx, cy and cz are the coordinates of the unit cell corner opposite the origin, then the coordinates X, Y and Z of a position it occupies in the structure would be calculated using the formulas:

X=x+i*cx
Y=y+j*cy
Z=z+k*cy

where i, j and k can range from -1 to the number of duplications in the x, y or z direction. -1 is included so that atoms with coordinates of 0, which are omitted from the unit cell are included in the final structure. This also produces some atoms whose coordinates in the structure are negative. These are not included in final crystal structure.

HTML

This sections assumes a basic knowledge of HTML.
The atoms we used in the unit cells are of varying elements for two reasons. First, the different elements are displayed as different colors. Second, it is possible to cause certain elements to disappear at the push of a button. The following code is used in our page to display the crystal structure:
<embed src="rcry.xyz" width=500 height=500 script="set boundbox on 
restrict elemno=1
spacefill 125" align=left 
display3D=spacefill name="crystal">
This code is used in the same page to cause the face centered cubic structure to appear:
<embed align=absmiddle type="application/x-spt" width=25 height=25 
button=push target="crystal" script="
restrict not (elemno=3 or elemno=7)
spacefill 125">
Back to the index