The Lennard-Jones simulator

Stuart Lynn (s.lynn@sms.ed.ac.uk), the School of Physics at the University of Edinburgh.



Introduction

This applet simulates a Lennard-Jones interacting substance. In the Lennard-Jones model each particle is considered a point mass that interacts with other particles via a long range attraction short range repulsive force. The simulation can be set up with different densities and initial energies and the motion of the particles investigated. Cooling of the sample can also be introduced so that transition from gas to liquid to solid can be observed. At each stage the radial distribution function of the substance, which gives a plot of the mean number of particles as a function of the distance from a reference particle (and so gives a measure of the order/disorder of the substance) can be observed.

Underlying Physics
The model this applet simulates was proposed as an improvement to the ideal gas. Unlike the ideal gas model particles can interact and exchange energy and interact through the .This applet simulates a Lennard-Jones interacting substance. In the Lennard-Jones model each particle is considered a point mass that interacts with other particles via a long range attraction short range repulsive force. Lennard-Jones potential. This potential is a good model for many substances as it describes the long range attractions (ie van der wals forces) and short range hard sphere repulsion from like charges in the nucleus.

Exercises
  1. Experiment with different initial densities and energies, try to see how the particles arrange themselves about each other. Is it the same for high and low limits?
  2. Again experiment with different settings but this time turn on the RDF display and try and spot different behaviors of the radial distribution function.
  3. Set up the simulation with the highest density and with a medium energy. Start the simulation off and note both the behavior of the particles and the RDF. Now turn on cooling and watch what happens to both the particles and the RDF over time. Do the particles become more or less ordered with time and how is this reflected in the RDF?
  4. After a long time with cooling on pick one particle and count the number of surrounding particles it has. Do all the particles have the same number of surrounding particles? If this simulation was in 3D instead of 2D how would this number change? (hint think about having another 2D layer above and below the screen)
Requirements

To use the Lennard-Jones simulator 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.
As this applet involves a lot of calculations per second, older computers may have some trouble running it at a useable speed. If this is the case reduce the density in the simulation and try again.

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.

Installation

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 Lennard-Jones subdirectory. Inside the 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.

Usage

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 600 pixels by 500 pixels version of the applet.

<html>
<head>
<title> Lennard-Jones simulator applet </title>
</head>
<body>
<applet
        
        code ="output.class"
       	name= "Lennard-Jones"
        width="600"        height="500"
        hspace="0"
        vspace="0"
        align="middle"

	
</applet>
</body>
</html>


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.
XP


Known Bugs

  1. There may be a graphical glitch in Graphics2D on OS-X.
  2. The integrator which predicts the motion of the particles can sometimes go a bit funny as errors accumulate, this can sometimes result in the particles speeding up when they shouldn't. This effect normally does not effect the overall simulation

Additional Documentation

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