next up previous
Next: Thermodynamic Integration Up: Free Energy Methods Previous: Free Energy Methods


Excess Chemical Potential via the Widom Method

We recall that the free energy of the canonical ensemble, termed the Helmholtz free energy and denoted $F$ in F&S, is defined by

$\displaystyle F$ $\textstyle =$ $\displaystyle -k_BT \ln Q\left(N,V,T\right)$ (201)
  $\textstyle =$ $\displaystyle -k_BT \ln\left(\left\{\frac{V^N}{\Lambda^{3N}N!}\right\} \left\{V...
...bf r}^N \exp\left[-\beta\mathscr{U}\left({\bf r}^N\right)\right]\right\}\right)$ (202)
  $\textstyle =$ $\displaystyle -k_BT\ln\left(\frac{V^N}{\Lambda^{3N}N!}\right) - k_BT\ln\left(\int d{\bf s}^N \exp\left[-\beta\mathscr{U}\left({\bf s}^N;L\right)\right]\right)$ (203)
  $\textstyle \equiv$ $\displaystyle F_{\rm id}\left(N,V,T\right) + F_{\rm ex}\left(N,V,T\right)$ (204)

Here, $F_{\rm id}$ is the ``ideal gas'' free energy, and $F_{\rm ex}$ is the ``excess'' free energy.

The chemical potential is defined as the change in free energy upon addition of a particle:

\begin{displaymath}
\mu = \frac{\partial F}{\partial N}_{VT}
\end{displaymath} (205)

For large $N$,

$\displaystyle \mu$ $\textstyle =$ $\displaystyle -k_BT \ln\left(Q_{N+1}/Q_N\right)$ (206)
  $\textstyle =$ $\displaystyle -k_BT\ln\left(\frac{V/\Lambda^d}{N+1}\right) - k_BT\ln\left(
\fra...
...cr{U}\left({\bf s}^{N};L\right)\right]
\end{displaymath}\end{minipage}}}\right)$ (207)
  $\textstyle =$ $\displaystyle \mu_{\rm id}\left(\rho\right) + \mu_{\rm ex}$ (208)

which defines the excess chemical potential, $\mu_{\rm ex}$. We see that we can express the quotient of configurational integrals in $\mu_{\rm ex}$ as an integration of the ensemble average of $\Delta\mathscr{U} \equiv \mathscr{U}\left({\bf s}^{N+1}\right) -
\mathscr{U}\left({\bf s}^N\right)$ over ${\bf s}_{N+1}$, the scaled coordinates of the $(N+1)$'th particle, or ``test'' particle:
\begin{displaymath}
\mu_{\rm ex} = -k_BT \ln \int d{\bf s}_{N+1}\left<\exp\left(-\beta\Delta\mathscr{U}\right)\right>_N
\end{displaymath} (209)

This equation implies that we can measure $\mu_{\rm ex}$ by performing a brute force sampling of $\exp\left(-\beta\Delta\mathscr{U}\right)$ in an otherwise normal NVT MC simulation. That is, we can at frequent intervals in a normal MC program ``create'' a test particle with a position sampled uniformly in the box, compute $\mathscr{U}\left({\bf
s}^{N+1}\right) - \mathscr{U}\left({\bf s}^N\right)$, and accumulate $\exp\left(-\beta\Delta\mathscr{U}\right)$. This is the Widom method.

The code mclj_widom.c implements the Widom method for the Lennard-Jones fluid in an NVT simulation. Below is a code fragment for sampling $\Delta\mathscr{U}$ using the Lennard-Jones pair potential (Eq. 83):

  rx[N]=(gsl_rng_uniform(r)-0.5)*L;
  ry[N]=(gsl_rng_uniform(r)-0.5)*L;
  rz[N]=(gsl_rng_uniform(r)-0.5)*L;

  for (j=0;j<N;j++) {
    dx  = rx[N]-rx[j];
    dy  = ry[N]-ry[j];
    dz  = rz[N]-rz[j];
    r2  = dx*dx + dy*dy + dz*dz;
    r6i = 1.0/(r2*r2*r2);
    du += 4*(r6i*r6i - r6i);
  }

The particle with index $N$ is assumed to be the ``test particle''; the other particles are labeled $0$ to $N-1$. In the first bit, the position of the test particle is generated as a uniformly random location inside a cubic box of side length $L$. Then we loop over the particles $0$ to $N-1$ and accumulate $\Delta\mathscr{U}$.

Using the code mclj_widom.c, we can measure $\mu_{\rm
ex}\left(\rho,T\right)$. Figure 7.1 in F&S reports results of $\mu_{\rm ex}\left(\rho,2.0\right)$ using the Widom method for $\rho
\in \left\{0.4,0.5,0.6,0.7\right\}$, and compares to results from Grand canonical simulations. Just for fun, I repeat this exercise for $T$ = 3.0. The $\mu VT$ simulations were carried out using the code of Case Study 9 of F&S, first discussed in Sec. 6.1. Here, simulations of 40,000 MC cycles were performed at each state point for which the ideal gas pressure, $P_{\rm id}$ of the bath is chosen from 0.016, 0.032, 0.064, 0.128, 0.15, 0.20, 0.25, 0.50, 0.75, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, and the maximum displacement was 0.33 for all runs. Each run has a 100-cycle equilibration, after which it is sampled every 2 steps. The system contains $N$ = 108 particles. For the Widom method, I considered densities $\rho \in \left\{0.4, 0.5, 0.6, 0.7,
0.8\right\}$. The system is equilibrated for 100 MC cycles, and is then sampled every two cycles for another 40,000 cycles, using a constant maximum displacement of 0.4. Below is a plot of $\mu_{\rm ex}$ vs. $rho$ at $T$ = 3.0:

portrait
$\mu ^{ex}$ vs. $rho$ for the Lennard-Jones fluid at $T$ = 3.0 computed using a grand canonical $\mu $VT Monte Carlo simulation and a NVT simulation with the Widom sampling method. $N$ = 108.
Clearly, I have not taken pains to make sure the two methods agree exactly. It is indeed unclear from the text what these pains might be. But the results agree relatively well, and we might think that, given more cycles in both cases, or by using the same maximum displacement, we would converge to the same answer using both techniques. (Is this so, or have I left a bug in one of my codes...? Perhaps one of you will find out...)

It would be useful to know how to determine which of these apparently competing methods is best for computing $\mu_{\rm ex}$. They are both similar in computational requirements (this is not further qualified here; if someone wants to make this comparison, he or she is welcome to do this as a project). On the one hand, we have an inherent limitation of the grand canonical simulation: one cannot specify the system density exactly; rather it is an observable with some mean and fluctuations. The Widom method does allow one to specify the density precisely, and in this regard, it is probably more trustworthy in computing $\mu_{\rm ex}$. On the other hand, the Widom method suffers the limitation that it is not generally applicable to systems with any potential energy function. For example, for hard-sphere systems, the Widom method would always predict that $\mu_{\rm ex}$ is 0, a clearly nonsensical answer. The ``overlapping distribution method'' of Bennett, discussed in Section 7.2.3 of F&S, offers a means to overcome this particular limitation. We do not cover this method in lecture, but you are encouraged to explore the overlapping distribution method on your own (maybe as a project) using the code for Case Study 15 from book's website.


next up previous
Next: Thermodynamic Integration Up: Free Energy Methods Previous: Free Energy Methods
cfa22@drexel.edu