Recently I joined a company where close to 60% of the employees have PhD, mostly in computational chemistry. It seems that the chemists have a better grasp on thermodynamics and statistical mechanics than me because to me,

• thermodynamics is multi-variable calculus
• statistical mechanics is information theory,

but to them the thermodynamic quantities are experimental quantities thus they have intuitions.

In this post, I will try to summarize the basics of thermodynamics. Due to my limited experience, I find not much content in it (maybe I will keep expanding it in the future). However, there are two very interesting topics

• phase transition
• nonequilibrium thermodynamics

The first one shows how one can use calculus to study discontinuous phenomena. The second one interests me because I know very little about it. Maybe I will write something about them in the future.

three (plus one) thermodynamics laws

The thermodynamics laws are empirical postulates. Although there are some justifications from statistical mechanics (for the second law for example), I like to see them as results of experimental failure to design perpetual machines: depending on the law they violate, the perpetual machines are classified as the first or second kind.

• The first law is energy conservation: the energy loss in the system must be transformed to some work. In case we cannot identify all the work done to the externals, we call the missing part heat.

• The second law concerns energy conversion: if the system (i.e., the machine) exchanges heat with only one heat source, it is not possible to extract heat from the heat source without changing the system’s state (postulate of Lord Kelvin).

• The third law provides a reference point for entropy.

There is also a zeroth law which essentially defines temperature.

basic mathematical tools

The somewhat confusing part of thermodynamics is that the state variables are not all independent. For example, if we can find an equation of state for the system

$$f(P, V, T) = 0$$,

then only two of the three state variables are independent. In the presence of multiple phases and components, one can apply Gibbs’ phase rule to determine the number of independent variables.

To deal with inter-dependent variables, three tools from calculus are of great help:

They can be used to derive magic equations like

$\left(\frac{\partial P}{\partial V}\right)_T \left(\frac{\partial V}{\partial T}\right)_P \left(\frac{\partial T}{\partial P}\right)_V = -1$

Note that this equality does not rely on the system being ideal gas.

Another useful tool from calculus is Lagrange multiplier because often times we are interested in minimizing the free energy with some constraints.

Finally, if we know the equilibrium situation, then perturbation theory can be used to study near-equilibrium phenomenon.

thermodynamic potentials

Combining the first and second law of thermodynamics, we have

$dU = TdS - PdV + \mu dN$

Often thermodynamic potentials are introduced to deal with different situations

$A = U - TS \\ H=U+PV \\ G=U-TS +PV$

The corresponding differential forms are

$dA=-PdV-SdT+\mu dN \\ dH=TdS+VdP+\mu dN \\ dG=VdP-SdT+\mu dN$

In situations where the particle number does not change, the last term drops.

As you can see, it’s a bit tricky to remember the plus/minus signs and the variables being varied for each thermodynamic potential. Fortunately, there is a trick in Kerson Huang’s book

The trick is a square diagram. The chemical potentials are at the sides of the square and the varying quantities are at the corner. Partial derivatives of the chemical potentials with respect to the corner quantity gives rise to the corner quantity at the diagonal. The sign of the partial derivative is given by the direction of the arrow.

I incline to think of these thermodynamic potentials as ‘energy’ as in ‘energy minimization’ and smaller the ‘energy’ the better. In practice, one is given two situations and has to decide which situation wins. I will illustrate this point using a drug discovery example in the next section.

a toy model of protein-ligand binding

In medicinal chemistry (chemistry for medicines), ligand is the fancy word for molecule and drug is the fancy word for molecule that binds to some specific location (binding site) of a protein molecule. After binding, the geometric shape of the protein changes, thus its function changes (structure determines function). In most cases, protein-ligand binding is not strong: no chemical reaction occurs and no chemical bond is formed.

The relevant energy scales are

Thus to determine whether a ligand is a drug, i.e, whether it binds to a site, we need to compare the thermodynamic potential of the binding and unbound states. For simplicity I will use the Helmholtz free energy as an example. Then there are only two quantities to worry about: internal energy and entropy. Their effect on the free energy is opposite as they have opposite signs in the free energy definition. (Temperature is not of concern since human body temperature variation is small.) The smaller the internal energy is better, and the bigger the entropy is better. Note that the bigger the entropy, the more states/configurations are available, thus the more likely the situation becomes.

The binding state has lower internal energy because of the formation of hydrogen bonds, and other interactions. On the other hand, the binding state has lower entropy than the unbound state: if we use the key (ligand) - lock (protein) analogy, there is only one key-in-the-lock configuration whereas there are infinite configurations when the key is out of the lock. Thus whether a ligand binds depends on the subtle competition between the two effects.