# Why does thermodynamic integration work?

Brief introduction: Thermodynamic integration is a neat computational method used mainly for computing free energy differences between target and reference states of classical many-body systems, such as gases and liquids. The key idea is the following: free energy is a thermal quantity (i.e. not expressible as averages of phase space coordinates) and thus not measurable as such in any experimental or numerical way. But free energy derivatives can of course be measured, e.g., in the canonical ensemble the derivative of the Helmholtz free energy with respect to the volume gives us the pressure, which is measurable both experimentally and numerically. Being able to compute such derivatives, one then uses thermodynamic integration methods to compute free energy differences along reversible paths (in the plane of any tuple of natural variables) that connect a reference state of the system (i.e., one for which the free energy is actually known) to a target desired state (whose free energy we want to compare with the reference state). All this sounds so far rather natural, but the trick in thermodynamic integration and maybe its strength lies in the fact that as long as we want to compute things numerically and thus not bound by experimental limitations, one is not limited to physical paths, instead any parameter $\lambda$ in the free energy can be used (as a dynamic variable) to perform the thermodynamic integration, as long as the function (potential energy or free energy) admits a derivative with respect to the chosen variable. One generally expresses this method as follows:

We parametrize the potential energy of the system w.r.t any parameter $\lambda$ be it a physical one or not, then havign two states in mind, state (1) being the reference (obtained when $\lambda = 0$) and state (2) the target state (obtaied when $\lambda = 1$) whose free energy we are interested in, we write: $$U(\lambda) = (1-\lambda)U_1 + \lambda U_2 \tag{(1)}$$

then for example if we take the parametrized Helmholtz free energy $F(\lambda),$ the free energy difference can be shown to be:

$$F_{\lambda=1} - F_{\lambda=0} = \int_{\lambda=0}^{\lambda=1} d\lambda \left\langle \frac{\partial U(\lambda)}{\partial \lambda} \right\rangle_{\lambda} \tag{(2)}$$

where $\langle \rangle_{\lambda}$ is an ensemble average over the system with the potential energy function $U(\lambda).$ The claim often made in literature is that, such thermodynamic integrations are valid using any function $U(\lambda)$ as long as it is differentiable and satisfies the boundary conditions (for the reference and target states).

Question: Purely from a conceptual point of view, I have no idea what is going on here. How is it possible that we can just parametrize the free energy/potential energy by non-physical parameters and still manage to correctly gauge the free energy difference correctly between two physical states of a system? Intuitively, I would have expected that if the thermodynamic integration method is performed using non-physical parameters, then one would get nonsense, meaning predicting the wrong equilibrium configurations as an example. But somehow all this is possible and commonly used in computational physics. I'm just trying to understand why this method can work so flexibly.

• What non physical parameters? Can you give an example? The question is so generic that it is quite difficult to begin with. – user115350 Apr 12 '17 at 20:00

Some mathematical statements then an intuition statement:

### Mathematical

We often use parameterizations like this to mathematically represent a continuous motion from one point to the next, for instance when discussing convex spaces, in which we say a space is convex if all points between any two given points are also in the set (in the language of the wiki page, convex if the vector $\lambda u_i+(1-\lambda) u_j$ is also in the space, for any vectors $u_i$ and $u_j$ in the space; satisfied by a sphere, but not by a donut).

Similarly, the parameterization here is simply a way to represent traveling through a space, in this case a space of possible states. The "nonphysical" parameter $\lambda$ isn't introducing new physics any more than my above analogy means the space of a sphere is in any way physically changed by our mathematical wandering through the space of a sphere. The reason this works is that you're wandering through a continuously changing energy landscape, which brings me to...

### Intuition

For state variables like energy, as long as you wander from one state to another, keeping track of your progress as you go (more on that below), you can find your new energy from your old, just like with the traveling analogy already discussed.

The nuance is that if you, say, travel from one city to another city directly North, you might take a path that veers a bit east before coming back west to arrive at its destination. You might say, doesn't that increase my total distance traveled? Yes, but any travel east cancels any travel west. Similarly, going through this space of states with varying energies, any increases along the path cancel any decreases along the path, and you can arrive at the total energy difference between your initial and final states. Now you can see why we need this path to be differentiable with respect to $\lambda$: we can't allow discontinuous jumps.

So in conclusion, we don't really care about the nature of the path, since any funny deviations from point A to point B will cancel. $\lambda$ is just the mathematical parameter that allows us to continuously follow our path and ensure we end where we want to go.

• Thank you very much, very understandable! Just to be sure, then the fact that these "energy deviations" perfectly end up cancelling out follows from both the linearity of the parametrization and the differentiability, right? – user929304 Apr 23 '17 at 21:17
• Actually, regardless of how $\lambda$ appears in the parameterization, the important thing is that energy is a scalar, so any positive change will be canceled by any negative change by definition. This would break if it were not a differentiable function, I'm not sure off the top of my head what linearity would get you... – JDR Apr 23 '17 at 23:28

I will preface this by saying that I have not heard of what you are describing in such a generic context. But I do not think it applies to every thermodynamic variable, rather it applies to only those that are path independent such as state variables. It would not apply to path dependent variables such as heat and work (which may be path independent if the process is reversible).

You have many constraints on what parameterizations you may use. It must satisfy the boundary conditions -- this is very important. State variables describe what is happening at equilibrium. Equilibrium means (broadly speaking) that there are not more changes occurring to the system. So the only values that are important are the end-points. This is why your parameterized function must match at the end points of the integration. And because it is only important at the end points, it doesn't matter how you get there. You'll get to the same equilibrium.

Maybe a real world analogy would help. I live in Atlanta and I want to get to New York City. My current state is Atlanta -- I am at equilibrium here. My future state will be New York City. I will be at equilibrium there.

I can choose to drive on the interstates. That's one path. I can also take back roads the whole way, that's another path. I can fly. Maybe I fly direct, or maybe I need to connect in Charlotte, or Dallas, or Chicago. Those are all different paths. So I can parameterize my transport many different ways. But because all of my parameterizations start in Atlanta and end in NYC, they are all valid integrals to move my state function (location) from one endpoint to the other.

And it should be obvious why work or heat is path dependent and cannot be parameterized this way. The amount of time and energy consumed in fuel is vastly different depending on my path. So those are not state functions and the parametization is critical to getting the correct measurements of those.

But my start and end states? Not important how I moved between them, just that all my paths begin and end where they need to. And we know the difference in miles between Atlanta and NYC, so we know the difference between the two equilibrium points. How far apart they really are is independent of how I decided to travel between them.

• Dear tpg, thank you for this answer. I really like your analogy. Following the same analogy, I have one question specially regarding your last paragraph as there was suddenly a quick jump to the conclusion. How are we able to determine the actual distance between Atlanta and NYC when we are taking arbitrary paths of all sorts of lengths between them? Please note that we do not know the actual distance between NYC and Atlanta a priori, the same way we don't know the free energy difference $\Delta F$ between our reference state and target state. – user929304 Apr 14 '17 at 16:23
• @user929304 It is known indirectly through the requirement that your boundary conditions on $U(\lambda)$ match the unknown states. That is why I said there are very precise requirements on the definition of $\lambda$. If you know how the state changes with respect to your path (the derivative), then the integral of your derivative is the function itself. But it only works for state variables because the path you choose doesn't matter. – tpg2114 Apr 14 '17 at 16:38
• It is definitely a point I need to clarify in my answer... I'll think on it and try to come up with a decent explanation and tie it back to the analogy. – tpg2114 Apr 14 '17 at 16:39