### Java Simulations for Statistical and Thermal Physics

The following programs were written for the Statistical and Thermal Physics curriculum development project and are part of the Open Source Physics project. The programs are released under the GNU General Public License. The source code is freely available for download.

You can run these programs as applets in a browser or download the Launcher as a stand-alone application (recommended). The Launcher (a jar file) includes all the STP programs. You can also download most of the individual simulations.

The goal of the simulations and calculations is to illustrate some of the fundamental concepts in statistical mechanics. They can be used as standalone programs or in conjunction with a text such as Harvey Gould and Jan Tobochnik, Statistical and Thermal Physics: With Computer Applications, Princeton University Press (2010). The text is also available online as a pdf file.

1. Approach to equilibrium. Explore some of the qualitative properties of macroscopic systems.
   - Particles in a box. A Monte Carlo simulation of noninteracting particles initially confined to one half of the box.
   - Three partitions. A molecular dynamics simulation of a Lennard-Jones fluid initially confined in the middle third of the simulation cell.
   - Two partitions. A molecular dynamics simulation of a Lennard-Jones fluid initially confined to one half of the simulation cell.
2. An ideal thermometer. Why is an extra degree of freedom, the demon, an ideal thermometer?
   - Ideal gas. The demon exchanges energy with an ideal gas. Illustrates that the demon can be interpreted as a thermometer.
   - Einstein solid. The demon exchanges energy with an Einstein solid. Illustrates a universal property of the demon.
   - Lennard-Jones fluid. Simulation shows the relation of the temperature as determined by the demon and the mean kinetic energy per particle.
3. Sensitivity to initial conditions. A molecular dynamics simulation of a Lennard-Jones system in a specially prepared state.
4. Random walks. What happens to a drunken sailor?
   - 1D random walk. One-dimensional random walk (fixed step length).
   - 1D random walk. One-dimensional random walk (variable step length).
   - 2D random walk. Two-dimensional random walk.
   - Self-avoiding walk. A Monte Carlo simulation using an enrichment algorithm.
5. Multiple coin toss. Monte Carlo simulation of the statistical properties of the outcome of the tosses of many coins.
6. Binomial distribution. The plots illustrate how the width and relative width depend on N, the number of noninteracting spins.
7. Central limit theorem. A demonstration of the probability distribution of a random additive process.
8. Monte Carlo estimation. Estimation of the area under a curve using the "hit or miss" method.
9. A simple multiplicative random process. The simulation illustrates the importance of rare events.
10. Boltzmann probability. A Monte Carlo simulation using the Metropolis algorithm of an ideal classical gas in one dimension in equilibrium with a heat bath.
11. Simple thermal interaction. The number of states of two Einstein solids that can exchange energy. What quantity becomes equal?
12. The number of states for two Einstein solids that can exchange particles. What quantity becomes equal?
13. Einstein solid in equilibrium with a heat bath. A simulation of an Einstein solid using the Metropolis algorithm.
14. Entropy and temperature. Calculation of the entropy of two Einstein solids that can exchange energy.
15. Thermal equilibrium. A molecular dynamics simulation of two solids in thermal contact. What quantity becomes the same in thermal equilibrium?
16. Lennard-Jones fluid. A molecular dynamics or Monte Carlo simulation of a liquid in two dimensions. The output includes the mean pressure, temperature, heat capacity, and the radial distribution function.
17. Hard disks. A molecular dynamics or Monte Carlo simulation of hard disks. The output includes the mean pressure, the mean free path, and the mean collision time.
18. Ising model.
    - 1D Ising model. A Monte Carlo simulation of the one-dimensional Ising model. The output includes the mean energy and heat capacity.
    - 2D Ising model. A Monte Carlo simulation of the two-dimensional Ising model. The output includes the mean energy, heat capacity, and the susceptibility.
    - Simulation of the Ising antiferromagnet on a square lattice.
    - Simulation of the Ising antiferromagnet on an hexagonal lattice.
    - Mean-field solution. Plot of the numerical solutions of the usual self-consistent equation and the corresponding free energy.
    - Density of states of the 2D Ising model. A Monte Carlo estimation of the density of states using the Wang-Landau algorithm.
    - Partition function of the 2D Ising model. A Monte Carlo estimate of the partition function using a novel algorithm.
    - Hysteresis. Simulation of hysteresis in the two-dimensional Ising model.
19. Ideal gas integrals
    - Ideal Bose gas. Calculation of the chemical potential for an ideal Bose gas as a function of temperature for fixed density.
    - Ideal Fermi gas. Calculation of the chemical potential of an ideal Fermi gas as a function of temperature for fixed density. The calculated chemical potential is used to determine the mean energy.
20. Number of states of a particle in a box. A comparison of the actual number of states to the asymptotic expression.
21. Second virial coefficient. A calculation of the temperature-dependence of the second virial coefficient for the Lennard-Jones potential.
22. Generalized demon algorithm. A generalization of the demon algorithm that yields the chemical potential as well as the temperature.
23. Diffusive equilibrium. A simulation of a lattice gas with different chemical potentials.
24. Chemical potential. An estimation of the chemical potential of a Lennard-Jones fluid using the Widom insertion method
25. Potts model. Application of the Wang-Landau algorithm to the q-state Potts model.
26. XY or planar model. A simulation of the two-dimensional XY model. See the development of vortices below the Kosterlitz-Thouless transition.
27. Fermi-Pasta-Ulam problem. Simulation of a chain of oscillators coupled by anharmonic springs.
28. Percolation. Illustration of the nature of the geometrical phase transition for site percolation on a square lattice.
29. Renormalization group. Demonstration of the renormalization group method for site percolation.
30. Quantum Monte Carlo. A Monte Carlo simulation of an ideal quantum gas in one, two, or three dimensions.
31. Diffusion on a lattice. A simple Monte Carlo simulation of particles on a lattice with a maximum of one particle per site.

The programs were developed by Kipton Barros, Ranjit Chacko, Joshua Gould, Harvey Gould, Natali Gulbahce, Peter Sibley, Jan Tobochnik, and Hui Wang. The Open Source Physics Java code library is described in Wolfgang Christian, Open Source Physics: A User's Guide with Examples, © Addison-Wesley (2007).

Updated 12 January 2015.