# Classical Molecular Dynamics Simulations: Who cares about partition functions?

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 $$=\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 $$=\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.

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.