# Practical use of the partition function in molecular simulations

In the second chapter of Understanding Molecular Simulation, Frenkel and Smit derive an equation for the partition function and the thermal average of the generic observable A, stating that these equations "are the starting point of virtually all classical simulations of many-body systems".

I understand the theoretical significance of the partition function, and I can see how, in theory, by knowing the partition function one would know the energy of the system, and if I'm not mistaken, also all the other thermodynamic quantities one could be interested in.

What leaves me confused is the practical use of the partition function in the computational chemist's work. I have some experience with running simulations with programs such as LAMMPS and GROMACS, and yet have never had a real first-hand encounter with the partition function. Is it used by the programs to compute the thermodynamic quantities they output? If so, would it be possible to provide a general description of how this is done?

• The partition function is impractical to compute, so the reason you never encounter it in simulation is because you can't work with it; the fact that the partition function is also the normalization constant for probabilities means that simulations have to work around this inconvenience instead. This is what motivates the use of Monte Carlo methods in simulation: you never have to work with absolute probabilities (hard to compute because of the partition function), but only their ratios (the partition function cancels out). Sep 21 at 19:14

The actual partition function is unimaginably formidable. For just $$N$$ point particles in a 3D box, it's already got $$3N$$ dimensions. If the box is length $$L$$, GROMACS would probably divide the box into a machine-precision grid and calculate the energy from $$\sim L \times 10^{10}$$ values in each dimension. The partition function would incorporate all of that information, the energy at each of those $$L \times 10^{30N}$$ points; even for two particles in a one unit box, that's already $$10^{60}$$.

When you speak of "the partition function" you're talking about the entire thermodynamic state of the system and all of its possible permutations. If we truly knew that function, we would be omniscient and could calculate anything about the system! Since we can't really calculate at the level of the entire partition function, we use simulations (MC and MD, etc.) to sample regions of interest (usually low-energy areas).

To a computational chemist, the partition function is most practical for its mathematical basis. It's the way to get from statistical mechanics (a bunch of particles moving around in a box) to actual thermodynamic properties (Helmholtz energy, pressure, etc.).

As a practical example, imagine you want to calculate the surface tension for some fluid interacting according to some potential function. Using LAMMPS or GROMACS, you can set up your vapor-liquid interface in the simulation box. Then by simply changing (perturbing) the simulation box shape and measuring the energy change, you can calculate the surface tension. The whole derivation of this method starts with the configuration integral of the partition function and then, via mathematical manipulation, eventually leads to the quantity we want to calculate and variables we can actually measure.

Test-area method - Gloor and Jackson, J. Chem. Phys. 123, 134703 (2005)

Free energy perturbation - Zwanzig, J. Chem. Phys. 22, 1420 (1954)

• But to your last point: is it used in practice in a quite direct way? if so, how? Sep 19 at 16:50
• @simulation_engine I have edited and hopefully addressed this now! Sep 19 at 19:43
• thanks for the edit, it did address my question more fully. it would be great if you could provide a couple additional examples that have to do with some other properties besides the surface tension. in any case i'll mark your answer as the accepted answer. Sep 20 at 7:03