The crystal lattice viewer

Stuart Lynn (, the School of Physics at the University of Edinburgh.


The crystal lattice viewer is a visualization tool that allows you to see what the unit cell for a body centered, face centered or primitive crystal with any basis would look like.

Underlying Physics
This applet is designed to help you understand and visualize the conventions that exist for describing the structure of crystals. It is limited to using a cube as a unit cell, the frame on which everything else is plotted. To describe a crystal structure we need to know what pattern of atoms repeats itself (the basis) and where these repeating units are to be placed (lattice points). For the cube unit cell we can have many different combinations of lattice points but this applet only concentrates on body centered, face centered and primitive types.

Primitive lattices have lattice points at each corner of the unit cell

Face centered lattices have lattice points at each corner of the unit cell and also in the center of each of the cubes faces.

Body centered lattices have lattice points at each corner of the unit cell and one in the center of the cube.
No matter which of these arrangements of lattice points we still need to specify what the pattern of atoms is at each point to describe the structure. To do this each atom in the basis has a coordinate with relative to a lattice point, x,y,z. These are relative to the length of the side of the unit cube, so for example a atom that sits halfway along the cube in the x direction from its lattice point would have coordinate (0.5,0,0). This basis is repeated at each of the lattice points to build up the structure of the crystal.

  1. Try experimenting with different combinations of lattice types and basis' to convince yourself that this description system is versatile
  2. Find some crystal specifications in textbooks or from your lecturers and try and create them using the applet

To use the applet, you require a web browser which a java plugin later than 1.2 (note it has not been tested with 1.2 - only 1.3.1 and 1.4), for example the latest JRE from Sun or Apple's JDK on Mac OS-X. You can also use the AppletViewer provided with your chosen JRE/JDK.

It is not recommended that you use a remote X-session to run this applet as it draws to the screen a lot and the resulting lag makes the animation jerky.


Unpack the applet - if it came with a group of other applets from the School of Physics at the University of Edinburgh, it should be in the crystal subdirectory. Inside the crystal directory should be some java code, classes and a number of html files, including an index.html which should contain links to this documentation, JavaDoc for the simulator and some pages with example configurations of the applet.


The provided html files give you some example configurations of the applet. You can set the size of this applet as usual. Below is an example html file which embeds a tabbed 800 pixels by 600 pixels version of the applet.

<title> Crystal lattice applet </title>
        code ="out.class"
       	name= "Crystal lattice"


How the applet is used is up to the user - it could be used in lectures, embedded in online course material or any other use that could be conceived.

Known Bugs

  1. There exits a glitch in Graphics2D on OS-X which will occasionally blank all controls on the screen. If this happens simply minimize the window and then maximize it again.
  2. There are a few combinations of changes you can make to the lattice which confuses the program in to placing the atoms in the wrong place. If this happens simply restart the applet and try entering the crystal parameters again

Additional Documentation

There is complete JavaDoc for the classes in this applet in the "javadoc" subdirectory of the applet directory.