# Can I compute the free energy difference in (temporally) nearby micro-states using the Zwanzig equation for Free Energy Perturbation?

I wanted to understand the Free Energy Perturbation in an NVT ensemble. Wikipedia explains it as: $$\tag{1} \Delta F = F_1 - F_0 = -\kappa T \ln \left<\exp\left( \frac{-(E_1-E_0)}{\kappa T}\right) \right>.$$ Can I compute the above for micro-states separated by 50 timesteps? How do I deal with the average in that case: what is the strategy to actually compute it?

As I have previously discussed with you, there is no such thing as frame-wise free energies, so the premise of your question is flawed. With this in mind, I think it would actually be useful to tell something about what FEP can do.

FEP is used to calculate the free energy difference between two macrostates with corresponding Hamiltonians $$H_0(x)$$ and $$H_1(x)$$ where $$x$$ denotes all phase space variables (you can also perturb the number of particles, the box volume and even work in other ensembles, but I am not going to deal with these cases here to keep it simple). Note that when we talk about different Hamiltonians, we mean different functional forms, not different values. This means that for the same phase space point $$x$$, the difference in these Hamiltonians $$\Delta H(x)$$ is in general not zero. Then, the Zwanzig equation tells you that you can calculate the free energies between the two macrostates using the identity:

$$e^{-\beta \Delta F} = \left_0\tag{1}$$

The expectation value can also be written as an integral, just to make it more clear:

$$\left_0 \equiv \int_{V} e^{-\beta \Delta H(x)} p_0(x) dx\tag{2}$$

where $$p_0(x)$$ is the normalised Boltzmann distribution for ensemble 0:

$$p_0(x) \equiv \frac{e^{-\beta H_0(x)}}{Z_0}\tag{3}$$

This basically means that you can in principle calculate the free energy between the two macrostates simply by sampling only one of them (which is what you do by running MD). After you obtain the structures from ensemble 0, then you can evaluate $$e^{-\beta \Delta H(x)}$$ for each one of them, and the average of these will eventually converge to $$e^{-\beta \Delta F}$$. Note that at the end of that, you are still calculating an ensemble average between the macrostates, and the microstates you get are simply a tool to get more datapoints for your free energy estimator.

I guess this is the point where I have to note that the theory of this is sound and simple enough to understand but the primary problem with the Zwanzig equation is that you can have very quick decrease in sampling efficiency once your Hamiltonians become even slightly different. In these cases, it is advisable to introduce additional intermediate Hamiltonians, so that the variance in the exponential terms is manageable for each simulation.

I am not going to go into more detail about the practicalities, though, because I suspect that you don't actually need FEP for your application, judging by your previous questions. Since FEP is only relevant if you are trying to calculate free energy difference between two Hamiltonians, I will reiterate that if you want to calculate the effective free energy between different regions of phase space with the same Hamiltonian, then you need methods that calculate potentials of mean force (PMFs), such as umbrella sampling, metadynamics, etc, that need you to define a reaction coordinate.

• @Godzilla can you explain what is the difference between a macrostate, a microstate and a configuration at a timestep ? I am finding it hard to understand everything you say because of a lack of clarity on these Aug 1, 2020 at 4:23
• A configuration is a particular set of coordinates, a microstate is all the information contained in a single frame (e.g. coordinates, velocities, instantaneous number of particles, instantaneous volume), and a macrostate only depends on macroscopic observables, such as temperature, entropy, volume, pressure, number of particles, chemical potential. The macrostate variables are averaged over all possible microstates, so for example each microstate has its own instantaneous temperature, but the macrostate has a single average temperature over all microstates. Aug 1, 2020 at 6:35
• The free energy is a function only of the macroscopic variables, so it's a statistical concept that can't be applied to microstates, since it is independent of instantaneous quantities. You could, however, define a free energy over a region in phase space, so for example you can find the free energy profile over a reaction coordinate, or a set of reaction coordinates. There are many more things to say about that, so I think that you should do some reading on statistical mechanics, because it will definitely clear some things up for you. Otherwise, MD will make no sense to you. Aug 1, 2020 at 6:43
• @Godzilla123 in the absence of a CV to identify phase space, if I can cluster microstates to identify different phases spaces, what should be the method followed for calculating the free energy (since I still can't use the reciprocal of the bias) ? Aug 1, 2020 at 15:35
• A pre-requisite for all of this is Statistical Mechanics. And, a necessary pre-requisite for Statistical Mechanics is thermodynamcs. To jump right to Free Energy Perturbation is to risk never truly understanding what is going on, ever. Aug 3, 2020 at 19:51