Generating the Animation

First we have to bring the gun to a reasonable temperature, and randomize away any unrealistic order we have left over from the way we loaded it. Convert the gun to BrennerAtom's (note that you'll need it to all be visible so you can select all of it) and save it as md/coord.d, then run it for 10 timesteps with thermostat 4, then 100 timesteps with thermostat 1 at 300 K.

Now generate the main result by running the simulation for 5000 timesteps with thermostat 4. You may want to run "top" in another window to check that the simulation is getting nearly all of the CPU time; both Fungimol and Netscape tend to take up significant amounts of CPU time and slow down the long simulation run. As described earlier, you can watch the movie as it is produced. This takes about 10 minutes on a 600 Mhz Pentium Pro.

All that remains is to convert the movie into an animated .gif file suitable for insertion into a web page. Start the movie playing as alluded to in the previous paragraph, and arrange the movie on the screen the way you want it to appear in the .gif file. The size of the Fungimol window will be the same as the default size of the image on the web page, so you'll probably want to shrink it down to much smaller than you would normally use. You may want to mark part of the barrel invisible. To mark half the barrel invisible without marking any of the projectile invisible, select half of the barrel when the projectile is not in the barrel.

To generate the .gif file, we write a .ppm file, then use an external utility to convert the .ppm file to a .gif file. The command for saving screen shots as a .ppm file is called "SaveMovie". It is not bound to any key, so we run it by using the command for executing any command, which is meta-semicolon. You'll want to start recording the movie just after it begins a repetition, so time your meta-semicolon carfully. Since we simulated 5000 timesteps and recorded a frame every 50 timesteps, the movie is 100 frames long. We aren't going to be able to press meta-colon at the first frame, so we'll write 95 frames to the .ppm file. The dialogue in the text window goes like this:

The configuration has these read/write fields:
Number  Field name          Field type  Field value
1       Command to execute  Action      DoNothing
Give the number of a field to edit, or press 0 to exit: 1
This slot implements the protocol Action.
The currently chosen factory is DoNothing.
Do you want to change the factory and reset to the new factory's
default configuration? y
The available factories are:
Number  Name
...
30      SaveMovie
...
What is the number of the factory you want? 30
Editing the configuration...
The configuration has these read/write fields:
Number  Field name                           Field type        Field value
1       Frames to skip between saved frames  Integer           0
2       Frames to write                      Positive Integer  1
3       PPM file name to write               String            Unspecified.ppm
Give the number of a field to edit, or press 0 to exit: 2
The old value of the slot is 1.
What do you want the new value to be? 95
The configuration has these read/write fields:
Number  Field name                           Field type        Field value
1       Frames to skip between saved frames  Integer           0
2       Frames to write                      Positive Integer  95
3       PPM file name to write               String            Unspecified.ppm
Give the number of a field to edit, or press 0 to exit: 3
The old value of the slot is Unspecified.ppm.
What do you want the new value to be? pic.ppm
The configuration has these read/write fields:
Number  Field name                           Field type        Field value
1       Frames to skip between saved frames  Integer           0
2       Frames to write                      Positive Integer  95
3       PPM file name to write               String            /tmp/pic.ppm
Give the number of a field to edit, or press 0 to exit: 0
The configuration has these read/write fields:
Number  Field name          Field type  Field value
1       Command to execute  Action      SaveMovie
Give the number of a field to edit, or press 0 to exit: 0
Finished writing to pic.ppm
The movie is recorded as it is displayed on the screen. The last line Finished writing to pic.ppm is printed when the writing is finished, which can happen when the 95 frames have been written or when Fungimol is exited.

If you want to decrease the temporal resolution, you can specify a nonzero value for the configuration slot Frames to skip between saved frames. For example, if you wanted to see every other frame in the result, then you would specify Frames to skip between saved frames as 1, and then specify half as many frames for the Frames to write slot.

At this point the movie is in the Portable Pixmap file pic.ppm. If you have ImageMagick installed, you can then use the convert command to convert this to an animated GIF:

$ convert -delay 10 -loop 1000000 pic.ppm bang.gif
Here -delay 10 means to delay 10/100 seconds between frames, and -loop 1000000 means the animation should loop essentially forever. Here is the result:

Copyright 2000 Tim Freeman <tim@infoscreen.com>