Finding the crystal structure

Here is a little sample of what I have been workng on. I made this applet in order to see the annealing process in action.

Applet goes here.

Work in progress. The source code For this applet, I have 15 atoms placed in a determined fashion on the blue grid area. They are hidden and can be revealed by pushing the SHOW button. When you push the ANNEAL button, the program starts.

The first "diffraction pattern" below the graph is for the OBJECTIVE atoms. The second one (bottom) shows the current diffraction pattern of the visible atoms.

To the right side is an area which represents the range at which TEST ATOMS can be placed. I haven't really developed this part too well yet.

Anyway, I sweep through the atoms 2000 times, Temperature is initially at 1/2 the cost per atom and decreases to 10. The program stops when Temp<10. At this point, click on the SHOW button to see the success of the annealing.

You can select an operation from the choice box in the top right corner in order to get one pattern to lie on top of another. You can also move all of the atoms by clicking and dragging in the blue area.

If you want to start over, click on the RESET button and then the ANNEAL button.

I find that if the final cost/atom =~20, then I have a reasonably good match. Atoms movements are determined by a multigrid resolution. At higher temperatures, the atoms take larger steps (32 pixels) and at the final lower temperatures, the atoms take finer steps (1 pixel).

I hope to implement the "levels" part of the multigrid method later, in order to allow more control by the user. The user can choose his own cooling scheme. It is also possible (maybe) to raise the temperature via a scrollbar.