In most introductory textbooks on molecular dynamics simulations the authors usually tell us how the connection between micro and macro is established using the partition function. Knowing the partition function of a particular thermodynamic ensemble basically tells us everything about the thermodynamic (macro) properties. For instance, in the canonical ensemble the expected value of internal energy is $$<E>=\frac{\sum_i E_i e^{-E_i/kT}}{Z}$$ where $Z$ is the partition function and the summation is taken over all micro-states of the system.

But nobody actually calculates the partition function, instead, for ergodic ensembles we simply calculate the temporal average $$<E>=\frac{1}{\tau} \sum_t E_t$$ which gives us the thermodynamic macro-version of the observable.

So why do authors bother and devote a whole chapter to this particular topic, involving the principle of maximum entropy to obtain $Z$ instead of just referring to the ergodic hypothesis?

Is there some important link I've missed or any actual utilization of the partition function?

edit: I can see how this could be useful in monte-carlo simulations where you do sample the phase-space directly. But how is $Z$ supposed to be helpful in case of dynamical simulations.


1 Answer 1


Not all quantities of interest can be expressed simply as time averages, or averages over the sampled configurations, in molecular simulations (whether using Monte Carlo or molecular dynamics). Calculation of free energies and entropies, in particular, need to be approached in an indirect way, sometimes using enhanced simulation methods. The free energy $F$ is directly related to the partition function $Z$ (in the canonical ensemble) and similarly the entropy $S$ is directly related to the density of states $W$ (in the microcanonical ensemble).

Examples of these enhanced sampling methods are metadynamics and statistical temperature molecular dynamics, both involving modified molecular dynamics algorithms, as well as flat-histogram sampling of various kinds (such as the Wang-Landau algorithm or multicanonical sampling) in Monte Carlo. These methods give, in principle, a route to $W$ or $Z$, even though in practice there are some limitations.

More generally, even if we don't calculate the partition function itself, we can calculate free energy differences between quite similar systems (for example, nearby temperatures, or molecules differing by some feature) by properly implementing standard simulation techniques and using techniques such as histogram reweighting (based on measuring probability distributions of the energy, for instance). In these cases, though, it is important to understand how the properties of the two systems are related, and this involves a basic grounding in statistical mechanics, including the partition function.

Finally, the expressions inside these computer programs for calculating properties such as the pressure, the heat capacity etc, are derived using statistical mechanics. The writers of those programs have not necessarily anticipated every possible property that you might be interested in: but if you have read the introductory material on statistical mechanics, you might be able to insert the necessary routines yourself.

So, indeed the partition function is not usually calculated in standard Monte Carlo or molecular dynamics simulations, but it is introduced in most textbooks because statistical mechanics underpins everything that we calculate in those simulations.

  • $\begingroup$ Thanks for your answer. Even though I still think that the partition functionl in principle allows you to compute any thermodynanmic quantitiy you like, I agree with the essence of what you say. The ergodic hypothesis tells us, that we can approximate the ensemble-average with a time-average, but statistical mechanics tells us, that in some cases, like free energy it's highly unlikely that this will work because we will undersample high-energy phase-space regions and those regions contribute a lot to the average value. $\endgroup$
    – OD IUM
    Commented Apr 5, 2019 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.