# Calculation of free energy from potential and kinetic energy

I am having trouble understanding how (and even whether it's possible) to get free energy from kinetic and potential energy.

I have run molecular dynamics simulations (NPT ensemble, CP2K software), but this is a basic thermodynamics question. There's a results file called "energy." The file contains energy-related output: temperature, kinetic and potential energy, and a "conserved" quantity.

(The "conserved quantity" is the sum of the kinetic and potential energies and also the thermostat energies).

From courses a long time ago and reading I have done online, I know that

kinetic energy + potential energy = total energy


I think "total energy" would be the internal energy. It would be great if someone could please confirm/debunk that--I don't know if the situation is distinct for distinct ensembles, for example. Whatever the case, I don't know how it relates to the free energy. I would like to know if I have enough information to calculate the free energy.

If anyone could please point me in the right direction, I would appreciate it. I can't find anything online and maybe that's because I don't even know where to start looking.

• This question might fit better on Matter Modeling SE, though you should include what program you are using. Jul 14 '20 at 14:08
• @Tyberius, thanks. I'll look for that forum. If it is not OK to leave this question up, please feel free to let me know.
– NTS
Jul 14 '20 at 14:10
• The question is fine here, I just think you might have better luck with this sort of question there (here is the link). If you do wind up moving your question there, make sure to delete it here. The SE network generally discourages having the same question posted multiple places. Jul 14 '20 at 14:20
• Thanks. I did try posting it there and it won't post for some reason. There are no errors. So I guess I'll leave it here.
– NTS
Jul 14 '20 at 14:23
• Since the Gibbs free energy is G=H-TS, you would need to know the entropy of the system. Other than that it looks like you should be able to compute the enthalpy as H=E+pV, so that G=E+pV-TS. I agree, internal energy is the total energy here. As @Tyberius suggested it might be a good idea to include the software you are using. Jul 14 '20 at 16:04

The sum of the potential and kinetic energies is the internal energy, E (or U).

However, you don't necessarily need to know the entropy to calculate the free energy. If you perform an equilibrium molecular dynamics simulation, you can derive the free energy from the equilibrium constant.

See, for instance: https://onlinelibrary.wiley.com/doi/full/10.1002/jcc.21776

If you are modeling a constant T and V system, where there is no work done, the equilibrium constant would give you the Helmholtz free energy:

$$\Delta A = - R T ln K^{'}_{eq}$$

where A = E - TS

If you are modeling a constant T and p system, where you have no non-pV-work, the equilibrium constant would give you the Gibbs free energy:

$$\Delta G = - R T ln K^{''}_{eq}$$

where G = H - TS = E + pV - TS

The reason for this is that, at constant T and V, with no work term, minimizing A_sys corresponds to a maximization of S_univ, and thus determines the equilibrium condition. By contrast, at constant T and p, with pV-work only, minimizing G_sys corresponds to a maximization of S_univ, and thus determines the equilibrium condition.

I've marked the equilibrium constants as prime and double-prime to indicate that these would be numerically different.

• This is very interesting and helpful. Thanks. I thought about it today and now think I understand what's going on. I asked my question because information on the software I'm using indicates that I can't calculate the free energy (Gibbs or Helmholtz) without providing a further constraint (on the species present and their reactions) and re-running my simulations. I couldn't figure out why such a constraint would be necessary. From what you said, it's because I have multiple Keq associated with multiple species and need to determine the Keqs accurately to get accurate free energy.
– NTS
Jul 15 '20 at 20:52