AtomicControl2 Progress Report
June 28, 2004
Edward Barnard, Elizabeth Hager, Harold Barnard
AtomicControl2 is the name of our whole project. It is the second version of our modeling project, the first being the one we did last summer. This program models crystals in two ways, using interactive Java3D imaging or OFF files. The main basics of how to represent crystal are controlled by the atomiccontrol.core project, while atomcontrol.gui handles the interactive modeling and atomiccontrol.OFF handles the production of OFF files. OFF files are ways of representing 3D geometry by a combination of polygons. Our program is able to read in OFF files and write OFF files or draw the crystal with Java3D. The program can model crystals from the existing library or new crystals that the user chooses by defining the atoms involved and the symmetry operations (defined by the space group to which the crystal belongs).
Table of Contents:- atomiccontrol.core
- atomiccontrol.OFF
- atomiccontrol.gui
- atomiccontrol.diffraction
atomiccontrol.core
Atomiccontrol.core project has all of the basic parts needed to model a crystal: the atoms, the bonds, the crystal, the element class, the main class which runs the project, the matrix class, the space group class, the transform class, the vertex class and a class to write OFF files.
Atom.java
Atom class holds the information about the atoms including their positions, atomic number and color. They are usually represented with spheres, but this may be changed. It is possible to change the color of the atoms, scale their size, and change their position. We have basically implemented everything necessary so far in the atom class, though we may later change how to organize the code and may add more information as necessary.Bond.java
Bond class can build bonds between the atoms. The user can select different bonds to turn on, depending on the length of the bonds or the types of atoms the bonds connect. The color of the bonds is also variable.This will help to display important distances and connections in a virtual ball-and-stick model of the crystal.
The bond class includes the basic information for creating bonds and getting their characteristics. However we still need to implement code that can sort bonds by their length and let the user decide which bonds to select based on their length and what atoms they connect.
Crystal.java
Crystal class can build a crystal using a defined unit cell, or by loading a crystal from on OFF file that the user provides. The unit cell is the "motif" of a crystal, the most basic part that is repeated in all directions.
We have included information about how to build a unit cell and how to read in the cells from an OFF file. The OFF file reading works well, but we need to define more information about how to repeat the unit cells to create the crystal.
Element.java
Element class holds the names of all of the atomic elements. It also includes arrays that hold the names of the elements, theirs masses, their default sizes, and their default colors.
We have completed the array of element names but we need to put in the other information about the masses, default sizes, and colors. This should not be difficult as we had most of this information last year.
Main.java
Main class runs the project. It can load OFF files or make a new crystal.
Currently this class is able to run the project but we will need to expand its capabilities and run the entire program, not just test cases.
Matrix.java
Matrix class works with the Space group class (see below). Space groups are defined by symmetry operations, which are defined by matrices that allow for linear transformations of sets of atoms. This class includes important functions for matrices such as accessing/setting elements, multiplying/adding matrices, etc.
Most of the elements necessary for this class are complete, and the rest simply have to be transferred from another file.
SpaceGroup.java
The Space group class allows the user to set the crystal to have a specific space group or get information about the space group. There are 230 space groups and they define the symmetry that exists in the crystal. Symmetry operations are defined by matrices that allow for linear transformations of sets of atoms.
This class has information about many of the important space groups and the necessary operations. However, we may need to add information about more space groups later.
The spacegroups can be defined by a set of Matrix rotations and translations that are applied to an atom's position. We store these in Transform objects. These transforms are of the form:
We get these transforms from a website that displays the transformations for all 230 spacegroups. This is the information on the program that generates these transforms:
+-----------------------------------------------------------------------------+ | P R O G R A M S E X I E | +-----------------------------------------------------------------------------+ | Calculation of Coordination Shells and Interatomic Distances | | Bernhard Rupp | | Version 5.4, Revision 04/11/97 |
An example of the useful parts of these files is shown below.
+-----------------------------------------------------------------------------+
| Space group F M 3 M , space group number 225, Laue class m-3m , z=192 |
+-----------------------------------------------------------------------------+
| Centrosymmetric space group (X,Y,Z) = (-X,-Y,-Z) |
| Bravais translation face centered |
| Translation vectors : (0,0,0), (1/2,1/2,0), (0,1/2,1/2), (1/2,0,1/2) |
+-----------------------------------------------------------------------------+
| 24 equipoint transformations (X)'=[R]*(X)+(T) : |
+-----------------------------------------------------------------------------+
| R(11) R(12) R(13) R(21) R(22) R(23) R(31) R(32) R(33) T(1) T(2) T(3) |
| 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.000 0.000 0.000 |
| 1.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 -1.0 0.000 0.000 0.000 |
|-1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 -1.0 0.000 0.000 0.000 |
|-1.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 1.0 0.000 0.000 0.000 |
...
...
Note: All coordinates are stored in lattice cordinates, and will be transformed to cartesian only when displayed, or converted to OFF files.
Transform.java
Transform class works with the matrix and space group classes (see above). It defines a rotation and translation that together combine to form the transformation; the groups of transformations then define the symmetry operations that apply to each space group.
Transform is currently a simple class but does what it needs to do. It may be expanded in the future.
Vertex.java
Vertex class describes vertices, or (x,y,z) positions. Vertices describe centers of atoms and vertices also define the two ends of a bond. The vertex class allows the user to set the position of an atom/bond and to get these positions. This class also does some of the trigonometric operations necessary for modeling, such as the dot product of two vertices, the addition of vertices and the scaling of vertices.
This class is fairly complete, though we will need to better define the operations and the information that is related to Java3D.
atomiccontrol.OFF
OFF (Object File Format) is a 3D geometry format that describes a set of polygons in 3D space.
It is defined and used by Geomview as a set of indexed vertices and n-sided polygons that refer to the indexed vertices.
OFF Format
[ST][C][N][4][n]OFF # Header keyword [Ndim] # Space dimension of vertices, present only if nOFF NVertices NFaces NEdges # NEdges not used or checked x[0] y[0] z[0] # Vertices, possibly with normals, # colors, and/or texture coordinates, in that order, # if the prefixesN,C,ST# are present. # If 4OFF, each vertex has 4 components, # including a final homogeneous component. # If nOFF, each vertex has Ndim components. # If 4nOFF, each vertex has Ndim+1 components. ... x[NVertices-1] y[NVertices-1] z[NVertices-1] # Faces # Nv = # vertices on this face # v[0] ... v[Nv-1]: vertex indices # in range 0..NVertices-1 Nv v[0] v[1] ... v[Nv-1] colorspec ... # colorspec continues past v[Nv-1] # to end-of-line; may be 0 to 4 numbers # nothing: default # integer: colormap index # 3 or 4 integers: RGB[A] values 0..255 # 3 or 4 floats: RGB[A] values 0..1
Originally we used this format because it seemed to be a simple way to store geometry data. We also found a java applet written in 1995 that could display OFF files in a web browser (link to applet). In fact we used the open source code from this applet and used it as our visualization object within the application
While the current visualization system does not need to use the OFF file format, we felt that it was good to keep the OFF functionality in the program to facilitate initial testing of crystals(using geomveiw) and to provide a method to show the crystals using the simple java applet
Polygon
This class defines a drawable OFF polygon. It stores a set of Vertex's that define the polygon. The polygon has the capability to be scaled and translated.OFFObject
This class defines a full OFF object. It stores a set of Polygons, and can convert between the OFF text file and the in-memory java object.This class can also combine multiple OFFOjbects together. This feature is useful in combining seperate OFF objects that define Atom geometry and making an off file that contains the entire crystal.
This class is currently functional, and all features have been implemented
atomiccontrol.gui
The GUI for the new version of AtomicControl is not yet built. The design from last year had two modes: building a crystal from a spacegroup, and loading a fully defined crystal. The capability this program will have, to build a crystal that is not in a built-in library, is a great asset that most similar crystal imaging programs do not include.
Old GUI
spacegroup building from old version
crystal loading from old version
The plan for the new GUI will have similar modes, but the crystal building part will be emphasized.
- Crystal Builder
- Spacegroup Information (name, lattice vectors, symmetries)
- Wycoff atom sites and occupying atoms, with the ability to add and remove atoms.
- Number of unit cells in each direction
- Visualization, see below
Visualization
A new visualization method is currently being written using Java3D. Java3D is rather simple to use 3D graphical API that acts much like a wrapper for OpenGL. It is capable of using OpenGL, Microsoft DirectX, or software rendering for its underlying render mechanism. This is a significant improvement over the java applet version used last year, which only produced non-shaded, non-perspective vector graphics. By using Java3D, we will now have a hardware-accellerated, interactive viewer.
So far we have set up a framework to display OFFObjects as well as a Crystal.
- The OFFview takes the OFFObject and displays each of its Polygons.
- The Crystalview displays the Crystal's Atoms as spheres in the correct (x,y,z) locations
atomiccontrol.diffraction
Harold is currently working on learning about and implementing a powder diffraction simulator that would take a Crystals built in the other parts of the program and produce a powder diffraction pattern similar to one that would be seen in lab.This would give the user a feel for the structure-diffraction pattern relationship. Marc Richard has offered to help us understand and implement this part of the program.I began by writing a program in MATLAB that that can builds a list of vectors that define the positions of the lattice points of a small uniform crystal in Cartesian coordinates. The crystal is defined by inputting the cell unit and specifying angles that the crystals planes are skewed.
Next I tried to make a program that could the diffracted angles at which intensity maxima would be. To do so, I wrote a program that numerically simulated crystallography with the Lauie geometry. This was done by treating each lattice point as an ideal point source that radiated a sinusoidal wave. It simulated the diffraction pattern that would be observed on a flat screen of a specified size and position by summing the contributions of each of the point sources at each point on the screen. This program did not account for the scattering potentials of the atoms and could not calculate the intensity of the maxima. This program was not able to accurately simulate diffraction because of the enormous number of calculations that are required to perform a simulation with adequate resolution.
Recently I have been trying to implement discrete Fourier transforms to accomplish the same task with out excessive calculations. The next step is to look into methods of simulating crystallography with powder samples, instead of the single crystal models I have worked on so far.
Harold Barnard