This web app simulates the dynamics of simple atoms and molecules in a two-dimensional universe. The force between the atoms is weakly attractive at short distances, but strongly repulsive when they touch. Use the simulation to explore phases of matter, emergent behavior, irreversibility, and thermal effects at the nanoscale.
- Each atom in the simulation simply moves in response to the forces exerted by nearby atoms and the container walls, in accord with Newton’s laws of motion. The simulation code knows nothing about phase transformations or crystal structure or irreversibility, yet these high-level phenomena, and others, emerge from the microscopic physics.
- The force between the atoms is calculated from the Lennard-Jones formula (truncated at a distance of 3 molecular diameters). This is a reasonably accurate model of the interactions between noble gas atoms.
- The simulation approximates Newton’s laws using the Verlet algorithm with the indicated Time step. Using too large a time step can make the simulation inaccurate and sometimes even unstable (see below).
- The simulation uses a natural system of units, with the atomic diameter, the atomic mass, the depth of the Lennard-Jones potential, and Boltzmann’s constant all set equal to 1. For argon (for example), the unit of distance is 3.4 angstroms, the unit of mass is 40 atomic mass units, and the unit of energy is 0.012 electron-volts; the corresponding unit of time is then 2 picoseconds, the unit of velocity is 170 meters per second, and the unit of temperature is 140 kelvin.
- The walls exert a linear (spring) force on the molecules, with a spring constant of 50 in natural units.
- There’s an optional uniform downward force, controlled by the Gravity slider. The magnitude of this force, however, is not meant to be realistic. Earth’s gravitational constant is utterly negligible in the units used here (a little over 10−13 for argon).
The user interface:
- Press Start to start the simulation, or Step to step forward in time by a small amount. The Steps per frame slider controls both the speed of continuous running and the number of time steps in a “step”.
- The Faster and Slower buttons increase and decrease the speeds of all the atoms by 10%. Press them repeatedly for a greater effect, or use the +1% and −1% buttons for fine adjustments. The Freeze button sets all the speeds to zero. Using these buttons puts the system out of thermal equilibrium; it’s fun to then watch it try to equilibrate.
- Don’t expect the Reverse button to accurately run the motion backwards for long; the motion is almost always chaotic!
- The Box size slider changes the width of the container (in units of atomic diameters); since the container is always drawn to fill the same area on the screen, this setting also determines the scale (zoom level) of the image. When the simulation is running it limits the rate at which the box size can be changed.
- The statistics displayed below the image are time, total energy, temperature, and pressure. The temperature is computed from the average kinetic energy, so it isn’t accurate when there’s organized motion on a large scale. The temperature and pressure are averaged over time.
- Be sure to explore the Presets. (Thanks to John Mallinckrodt for inspiring several of the presets.)
- Sometimes the simulation becomes unstable, producing a runaway effect of exponentially increasing energy. This is a consequence of approximating the relations between position, velocity, and acceleration using small differences instead of derivatives. As long as Fixed isn’t checked, the simulation will try to reduce the time step as needed to keep the calculation stable. You may need to manually drag the time step slider back up from time to time. If the simulation becomes unstable, it will stop running and an alert box will appear. Do what it says.
- Yes, you can drag the atoms around with the mouse or other pointing mechanism (at least on traditional computers and iOS touch-screen devices). If you drag an atom outside the box when the simulation is paused, that atom is deleted. When the simulation is running, dragging an atom actually pulls it with a simulated elastic cord. Try it!
- When the atoms are colored By speed, the sequence of 20 colors is assigned linearly according to speed. The brightest color is used for all speeds greater than 3.0.
- You can artificially anchor one or more atoms in space. Choose Anchor from the Mouse/touch menu and then click/tap on the desired atom(s). A second click/tap unanchors an atom. Anchored atoms are drawn in light gray.
- You can also connect any two atoms together with a “bond” that creates a spring-like force between them (in addition to the Lennard-Jones force). The spring constant is 100 in natural units, and the equilibrium position is the same as for the Lennard-Jones force. Although this feature allows some interesting qualitative demonstrations, it is not realistic: Actual covalent bonds are thousands of times stiffer. To connect two atoms, choose Connect from the Mouse/touch menu. Then press on one atom, drag to another that’s nearby, and release. Click or tap on an atom to delete all its bonds. Use the Bonds menu to create bonds between all nearby pairs, or to delete all bonds. Bonds are drawn as thin gray lines.
- Finally, you can “fix the temperature” of an atom, causing it to move randomly as if it is in contact with a heat bath at a specified temperature. Choose Fix T from the Mouse/touch menu, then click on an atom and adjust the slider in the popup box to the desired temperature. The fixed-T atom will then be marked with a gray dot. (If the atom is part of a rigid solid, this feature has the side effect of exerting a drag force that impedes any macroscopic motion of the solid.)
- To get accurate temperature and pressure values, you should let the system equilibrate, then press the Reset stats button and wait for the values to stabilize.
- To see the coordinates and velocity of any atom, choose Select from the Mouse/touch menu and then click/tap on the atom. Click/tap on the atom again to keep it selected but hide the small data panel.
- This simulation was created by Daniel V. Schroeder, Physics Department, Weber State University.
- If you can’t see the graphics display or the slider controls, your browser is probably out of date.
- This simulation is computationally intensive! It typically performs hundreds of basic computations per atom per time step. Yet my personal computer can do this for a thousand atoms at a rate of two thousand time steps per second. As of this writing, the latest versions of all major browsers on traditional computers are quite fast (Opera and Chrome are fastest, followed by Firefox, and then by Safari and Internet Explorer). Performance on mobile devices and their browsers varies enormously.
- You are currently running version 1.0 of this simulation, last modified on August 6, 2014. The program still has a few glitches that I hope to fix eventually. I apologize for the lack of full support for certain touch-screen devices and browsers. I hope to improve touch-screen support in the future, but the lack of standardization makes this difficult.
Of related interest:
- Interactive Molecular Dynamics article (pdf), published in the American Journal of Physics 83 (3), 210-218 (2015), arXiv:1502.06169 [physics.ed-ph]. Here is a version of this simulation with an enhanced Presets menu to accompany the illustrations and selected exercises in the article. Here is a version of the exercises that includes specific directions and hints for use with this software.
- Older Java version of this simulation.
- Here's a rudimentary version, useful mainly for benchmarking.
- Other software I’ve written.
- Poster presentation mostly about the Java version of this simulation (pdf): original poster version; two-page handout version
- My scientific computing course, including a lab manual that tells you how to write a molecular dynamics simulation from scratch.
- Other educational MD software:
- Applets by D. Rapaport
- Open Source Physics applets
- Applet by David Wolff
- Virtual Molecular Dynamics Laboratory (free download from Boston University)
- Molecular Workbench and new HTML5 version
- PhET States of Matter simulation
- Atomic Microscope was a commercial MD simulation for Windows and Mac Classic. It no longer seems to be available, but there’s now a very similar iPad app called Atoms in Motion.
- Phun, the predecessor of Algodoo, inspired some of the features of this simulation.
“If, in some cataclysm, all of scientific knowledge were to be destroyed, and only one sentence passed on to the next generation of creatures, what statement would contain the most information in the fewest words? I believe it is the atomic hypothesis (or the atomic fact, or whatever you wish to call it) that all things are made of atoms—little particles that move around in perpetual motion, attracting each other when they are a little distance apart, but repelling upon being squeezed into one another. In that one sentence, you will see, there is an enormous amount of information about the world, if just a little imagination and thinking are applied.”