Chemical potential and Helmholtz free energy (source code)

= Chemical potential and Helmholtz free energy
{title2=$\mu_{\rm m}=(\partial F/\partial n)_{T,V}$}

Rigid compartments impose a different constraint: fixed <volume (thermodynamics)> rather than fixed <pressure>. With <Helmholtz free energy> $F=U-TS$,
$$
dF=-S\,dT-p\,dV+\sum_i\mu_{{\rm m},i}\,dn_i,
\qquad
\mu_{{\rm m},i}=\left(\frac{\partial F}{\partial n_i}\right)_{T,V,n_{j\ne i}}.
$$
This follows immediately by differentiating $F=U-TS$ in the <chemical potential> differential above. It expresses the same <chemical potential> through the <thermodynamic potential> appropriate to fixed <temperature> and <volume (thermodynamics)>.

Consider a <closed system> consisting of two rigid compartments of equal <volume (thermodynamics)> $V$, maintained at a common fixed <temperature> $T$. A valve permits exchange of the same <ideal gas>; the partition stays in place. Initially $n_A=9\,\mathrm{mol}$ and $n_B=3\,\mathrm{mol}$, with conserved total <amount of substance> $n_{\rm tot}=12\,\mathrm{mol}$. These are macroscopic <moles>, modeled continuously, not twelve individual particles. By the <ideal gas law>, $p_B/p_A=n_B/n_A=1/3$, so initially
$$
\mu_{{\rm m},B}-\mu_{{\rm m},A}=-RT\ln3.
$$
At $300\,\mathrm K$ with the stipulated $R$, this is approximately $-2740.311\,\mathrm{J\,mol^{-1}}$, favoring transfer from A to B.

At fixed $T$ and equal $V$, integrating the ideal-gas <chemical potential> gives the total <Helmholtz free energy>, up to a term independent of the allocation,
$$
F_{\rm total}
=RT\left[n_A\ln\frac{n_A}{n_{\rm ref}}+n_B\ln\frac{n_B}{n_{\rm ref}}-n_{\rm tot}\right]+C.
$$
Here $n_{\rm ref}$ is a positive reference <amount of substance>; any omitted common term linear in $n_A+n_B$ is constant along this exchange. Let $x=n_A/n_{\rm tot}$ be the <dimensionless> fraction in A. The relative <Helmholtz free energy> then takes the particularly simple form
$$
\frac{F_{\rm total}(x)-F_{\rm total}(1/2)}{n_{\rm tot}RT}
=x\ln x+(1-x)\ln(1-x)+\ln2.
$$
Its <derivative> along the allowed transfer and its second <derivative> are
$$
\frac{dF_{\rm total}}{dn_A}
=\mu_{{\rm m},A}-\mu_{{\rm m},B}
=RT\ln\frac{x}{1-x},
\qquad
\frac{d^2F_{\rm total}}{dn_A^2}
=RT\left(\frac{1}{n_A}+\frac{1}{n_B}\right)>0.
$$
Thus the <Helmholtz free energy> is a strictly <convex function> of the allocation for positive amounts. Its unique minimum has $x=1/2$, or $n_A=n_B=6\,\mathrm{mol}$, and equal <chemical potentials>. Initially its excess above this minimum is $n_{\rm tot}RT[\tfrac34\ln(3/2)+\tfrac14\ln(1/2)]\simeq3915.474\,\mathrm J$ at $300\,\mathrm K$. Relaxation decreases the total <Helmholtz free energy> by this amount in the model; the final <pressures> are also equal because both compartments have the same <volume (thermodynamics)>.

\Image[/chemical-potential-particle-transfer.png]
{title=<Chemical potential> differences are slopes of the total <Helmholtz free energy>}
{description=Two equal rigid compartments at fixed <temperature> start with $9\,\mathrm{mol}$ and $3\,\mathrm{mol}$ of the same <ideal gas>, and reach $6\,\mathrm{mol}$ each after exchange. Lower left: the <dimensionless> excess <Helmholtz free energy>. Lower right: its <derivative> with respect to the allocation, divided by $RT$, equals the <chemical potential> difference divided by $RT$. The horizontal variable is $x=n_A/n_{\rm tot}$.}

The beautiful connection is that the direction of matter exchange and the slope of a <free energy> curve are the same calculation. The <entropy> gained by redistributing the <ideal gas> makes equal allocation favorable here. As with <chemical equilibrium>, a <free energy> minimum identifies the favored state, while transport properties determine how quickly it is reached. The fixed-<temperature>, fixed-<pressure> <Gibbs free energy> criterion is summarized in <Chemistry 2e by Paul Flowers and others/16.4 Free Energy>; the rigid experiment instead uses <Helmholtz free energy>.