## Sunday, September 23, 2012

### The chemical potentials are equal at equilibrium

This is Figure 10.1 from Dill and Bromberg's Molecular Driving Forces, which is my favorite book on statistical mechanics. It is a beautiful example from a beautiful book.

The chemical potential of a species is defined as the change in free energy with respect to the number of molecules of that species, when temperature, volume, and the number of other species are all kept constant:$$\mu_I=\left(\frac{\partial A}{\partial N_I}\right)_{V,T,N_{J\ne I}}$$Let's explore this for the simple four-bead polymer shown in the figure above.  In a previous post I derived the expression for the free energy:$$A=N\varepsilon_0 p_{uf}+TNk\left( p_f\ln(p_f)+p_{uf}\ln\left(\frac{p_{uf}}{4}\right) \right)\\A=\varepsilon_0 N_{uf}+Tk\left( N_f\ln\left(\frac{N_{f}}{N_{f}+N_{uf}}\right)+N_{uf}\ln\left(\frac{N_{uf}}{4(N_{f}+N_{uf})}\right)\right)$$Starting from the latter expression finding the chemical potentials for the folded and unfolded macrostates are: $$\mu_{f}=\left(\frac{\partial A}{\partial N_f}\right)_{V,T,N_{uf}}=kT\ln(p_f)$$ $$\mu_{uf}=\left(\frac{\partial A}{\partial N_{uf}}\right)_{V,T,N_{f}}=\varepsilon_0+kT\ln\left(\frac{p_{uf}}{4}\right)$$The free energy is the sum of the chemical potentials$$A=N_f\mu_f+N_{uf}\mu_{uf}$$Keeping in mind that $N_f=Np_f$ and $N_{uf}=Np_{uf}$ I hope it is obvious to you that this is true.

The chemical potentials are equal at equilibrium
If temperature and volume are constant the change in free energy is given by:$$dA=\mu_fdN_f+\mu_{uf}dN_{uf}$$At equilibrium $dA=0$ and the total number of particles is constant: $dN_f=-dN_{uf}$. Therefore$$\mu_f=\mu_{uf}$$which reduces to the Boltzmann equilibrium distribution:$$kT\ln(p_f)=\varepsilon_0+kT\ln\left(\frac{p_{uf}}{4}\right)\\ \frac{p_{uf}}{p_f}=e^{-( \varepsilon_0-kT\ln(4))/kT}$$The equilibrium constant
The ratio of probabilities is usually referred to as the equilibrium constant $K$:$$K=\frac{p_{uf}}{p_f}$$although it is usually written in terms of concentrations:$$K=\frac{p_{uf}}{p_f}=\frac{N_{uf}}{N_f}=\frac{N_{uf}/V}{N_{f}/V}=\frac{[uf]}{[f]}$$However, this is technically incorrect for two reasons.  One reason is that it doesn't work in general.  For example:$$\frac{p_ip_j}{p_k}\ne\frac{N_{i}/V N_{j}/V}{N_{k}/V}$$To get around this I write:$$K=\frac{[uf]/[c]^\ominus}{[f]/[c]^\ominus}$$where $[c]^\ominus$ is a standard state concentration, usually defined as 1 molar or 1 molal. Another reason is that when I use concentrations I assume that all polymer molecules are either folded or unfolded, whereas in real solutions some polymers might be stuck together.  To correct for this I introduce activity coefficients ($\gamma$) for the folded and unfolded state:$$K=\frac{\gamma_{uf}[uf]/[c]^\ominus}{\gamma_f[f]/[c]^\ominus}=\frac{a_{uf}}{a_f}$$In other words for real (i.e. non-ideal) solutions, the equilibrium constant must be written in terms of activities $(a)$ instead of concentrations

The standard chemical potential and the standard state
The general expression for the chemical potential of a macrostate is:$$\mu_{i}=\varepsilon_i +kT\ln\left(\frac{p_{i}}{g_i}\right)$$which can be rewritten as $$\mu_{i}=\mu_{i}^\ominus+ kT\ln(p_{i})\text{ where }\mu_{i}^\ominus=\varepsilon_i-kT\ln(g_i)$$ $\mu_{i}^\ominus$ is called the standard state chemical potential and is the chemical potential for $p_i=1$, i.e. for pure macrostate $i$, whereas $\mu_{i}$ is the chemical potential for macrostate $i$ in equilibrium with macrostate $j$.  Since the chemical potentials are equal at equilibrium, $\mu_i=\mu_j$ can be rearranged to give an expression for the equilibrium constant in terms of the standard state chemical potentials$$K=\frac{p_i}{p_j}=e^{-(\mu_i^\ominus-\mu_j^\ominus)/kT}$$However, in order to express $K$ in terms of something that resembles concentrations, namely activities,$$a_i=\gamma_i\frac{[i]}{[c]^\ominus},$$we define the chemical potential in terms of activities as well:$$\mu_{i}=\mu_{i}^\ominus+ kT\ln(a_{i})$$The standard state chemical potential is the chemical potential for a 1 M ideal solution of particles that don't bind each other: $a_i=1$, i.e. $[i]=[c]^\ominus$ and $\gamma_i=1$.

## Thursday, September 20, 2012

### Computational Chemistry Course - Optimization Techniques part 3

Another video I made for the Computational Chemistry course. This is the third in the series relative to the Optimization techniques module. It is a simple presentation captured with ScreenFlow and my voice over. The water vibrational modes were computed with MolCalc, screencasted and inserted into the presentation.

## Wednesday, September 19, 2012

### FragIt paper is out

The FragIt paper is out!

Development is ongoing but get the latest version here or give it a spin on a small protein on our online version (we are getting a larger computer so you can fragment larger molecules online)

## Sunday, September 16, 2012

### The free energy is lowest at equilibrium

This is Figure 10.1 from Dill and Bromberg's Molecular Driving Forces, which is my favorite book on statistical mechanics. It is a beautiful example from a beautiful book.

A system is at equilibrium when its free energy is a minimum
$$dA=0$$ Here I use the Helmholtz free energy $$A=U-TS$$ but the same is true for the Gibbs free energy. Let's explore this for the simple four-bead polymer shown in the figure above. Since I have already defined the probabilities of the folded ($p_f$) and unfolded ($p_{uf}$) macrostates in a previous post it is easiest to start with the expression for the internal energy ($U$) and entropy ($S$) in terms if probabilities. $$U=N\left<\varepsilon\right>=N\sum_i^{\begin{array}{ c }\text{micro} \\ \text{states} \\ \end{array}} \varepsilon_ip_i$$ $$S=-Nk\left<ln(p)\right>=-Nk\sum_i^{\begin{array}{ c }\text{micro} \\ \text{states} \\ \end{array}} p_i\ln(p_i)$$This results in $$U=N\varepsilon_0 p_{uf}\text{ and }S=-Nk\left( p_f\ln(p_f)+p_{uf}\ln\left(\frac{p_{uf}}{4}\right) \right)$$Combining these two terms and using the fact that probabilities must sum to 1 ($p_f+p_{uf}=1$), the free energy can be written as $$A=N\varepsilon_0 (1-p_{f})+TNk\left( p_f\ln(p_f)+(1-p_{f})\ln\left(\frac{(1-p_{f})}{4}\right) \right)$$This allows me to plot $A$ as a function of $p_f$, using $T$ = 298.15 K, $N=N_A$, and $N_A\varepsilon_0=2.5$ kJ/mol
As you can see, the free energy is a minimum when the probability of the folded state is about 0.4  or 0.407 to be more precise - precisely the value predicted by the Boltzmann distribution: $p_f=1/q$.

The total entropy is a maximum at equilibrium
This figure shows the internal energy and entropy contributions to the free energy as function on $p_f$.

When seeing this plot for the first time many people are surprised that the entropy is not a maximum (i.e. $-TS$ is not a minimum) at equilibrium.  Does this simple system violate the second law of thermodynamics? No! I am plotting the entropy of the system and not the total entropy that the second law refers to.  The total entropy is indeed a maximum at equilibrium:$$dA_{\text{system}}=0\\dU_{\text{system}}-TdS_{\text{system}}=0\\-\frac{dU_{\text{system}}}{T}+dS_{\text{system}}=0\\ \frac{dq_{\text{surroundings}}}{T}+dS_{\text{system}}=0\\ dS_{\text{surroundings}}+dS_{\text{system}}=0\\dS_{\text{total}}=0$$ Increasing the number of molecules in the unfolded state requires energy ($U$ increases at $p_f$ decreases) and this energy has to come from somewhere.  It is transferred to the system from the surroundings at heat: $$dq_{\text{surroundings}}=-dU_{\text{system}}$$and this lowers the entropy of the surroundings by$$dS_{\text{surroundings}}=\frac{dq_{\text{surroundings}}}{T}$$The entropy of the system is highest ($-TS$ is lowest) when $p_f=\frac{1}{5}$, i.e. when all microstates are equally populated because this leads to the highest multiplicity ($W_{\text{system}}$):$$S_{\text{system}}=k\ln\left(\frac{N!}{N_f!N_{uf1}!N_{uf2}!N_{uf3}!N_{uf4}!}\right)$$

Some technical stuff you can skip if you want
Another reason you might think $S_{\text{system}}$ should be a maximum at equilibrium is that  the Boltzmann distribution is derived by maximizing the entropy:$$\frac{\partial S}{\partial N_i}=0\text{ for }i=1,2,3.,..$$However, what is actually maximized is a Lagrangian function: $$L=S+\alpha \left( N-\sum_i^{\begin{array}{ c }\text{micro} \\ \text{states} \\ \end{array}}N_i \right)-\beta \left( U-\sum_i^{\begin{array}{ c }\text{micro} \\ \text{states} \\ \end{array}}\varepsilon_i N_i \right)$$that conserves the number of particles ($N$) and the internal energy ($U$).  Because of the latter requirement $$\frac{\partial L}{\partial N_i}=0\text{ for }i=1,2,3.,..$$ maximizes $S_{\text{total}}$ rather than $S_{\text{system}}$ because it is only the total internal energy that is conserved: $$dU_{\text{system}}+dU_{\text{surroundings}}=0$$

## Sunday, September 9, 2012

### Microstates, macrostates, and the Boltzmann distribution

This is Figure 10.1 from Dill and Bromberg's Molecular Driving Forces, which is my favorite book on statistical mechanics. It is a beautiful example from a beautiful book.

The Boltzmann distribution says that, at equilibrium, the probability of being in a microstate (also sometimes referred to as an energy state) is $$p_i=\frac{e^{-\varepsilon_i/kT}}{q}\text{ where }q=\sum_i^{\begin{array}{ c }\text{micro} \\ \text{states} \\ \end{array}} e^{-\varepsilon_i/kT}﻿$$ Let's apply this formula to the simple four-bead polymer example shown in the figure above. Each of the five conformations represents a microstate.  There is one low-energy conformation with a bead-bead contact and four higher-energy conformations where the bead-bead contact is lost.  Because higher energy conformations have a common feature (the lack of bead-bead contact) and the same energies we group them into one common macrostate (a state comprised of more than one microstate).  I'll refer to this macrostate at the "unfolded" state and the to ground state the "folded" state.

According to the Boltzmann distribution  the probability of the folded state is $$p_f=\frac{1}{q}\text{ where }q=1+4e^{-\varepsilon_0/kT}$$ The probability is the unfolded state is the sum of the (equal) probabilities of being in one of the four unfolded microstates $$p_{uf}=p_{uf1}+p_{uf2}+p_{uf3}+p_{uf4}=\frac{4e^{-\varepsilon_0/kT}}{q}$$
This figure shows a plot of the probabilities of the folded and unfolded state, together with the probability of being in one of the four unfolded microstates, as a function of temperature and for $N_A\varepsilon_0=2.5$ kJ/mol.  The polymer can be said to unfold at 217 Kelvin where the unfolded state starts to become more probable than the folded state.

Why does the polymer unfold beyond 217 K?
Answer 1. The plot shows that if there is only one unfolded microstate then the polymer would never unfold (i.e. unfolded state would never be more probable than the folded state).  Therefore, the polymer unfolds because there are more unfolded microstates than folded microstates (4 compared to 1).

Answer 2. The number of microstates with the same energy is known as the degeneracy, so one can also say that the polymer unfolds because the unfolded state has a higher degeneracy than the folded state (4 compared to 1).

Answer 3.  The ratio of probabilities can be written as $$\frac{p_{uf}}{p_f}=4e^{-\varepsilon_0/kT}=e^{-( \varepsilon_0-kT\ln(4))/kT}$$The latter form clearly shows that the unfolded state will become more probable for temperatures were $T(k\ln(4))\gt\varepsilon_0$.  The similarly of $k\ln(4)$ to the entropy $S=k\ln(W)$ is no accident.  The entropy of the unfolded state is given by $$S_{uf}=k\ln\left(\frac{N_{uf}!}{N_{uf1}!N_{uf2}!N_{uf3}!N_{uf4}!}\right)$$where $N_{uf1}=N_{uf2}=N_{uf3}=N_{uf4}=\frac{1}{4}N_{uf}$ is the number of polymers in each of the unfolded microstates.  For large $N_{uf}$, where Stirling's approximation [$x!\approx(x/e)^x$] holds, it is easy to show that this expression reduces to $$S_{uf}=N_{uf}k\ln(4)$$So one can also say that the polymer unfolds because the unfolded state has a higher entropy than the folded state.

A simulation of the unfolding of a slightly longer polymer can be found here