# How do you calculate the "true" chemical potential in classical density functional theory?

In classical density functional theory, one traditionally calculates the chemical potential by taking the variational derivative, $$$$\mu_{i} = \frac{\delta F}{\delta \rho_{i}}\tag{1}$$$$ of the Helmholtz free energy $$$$F[\rho] = \int d\textbf{r} f(\rho, \nabla \rho, ...) \textrm{.}\tag{2}$$$$

However, this is not directly analogous to the chemical potential in classical thermodynamics. In the latter theory, the chemical potential is defined as a partial derivative with respect to the number of moles, $$$$\hat{\mu}_{i} = \frac{\partial A}{\partial n_{i}}$$$$ where $$A$$ is the homogeneous Helmholtz free energy analogous to $$F$$. Importantly, $$n_{i}$$ is an extensive quantity (e.g. $$n_{i} = \rho_{i} V$$, where $$V$$ is the system volume). This means that $$\mu_{i}$$, defined in DFT is actually analogous to the derivative $$$$\mu_{i} = \frac{\partial A}{\partial \rho_{i}}\tag{3}$$$$

How then does one obtain the actual analogue, $$$$\hat{\mu}_{i} = \frac{\delta F}{\delta n_{i}}\tag{4}$$$$ to the traditional chemical potential? Is this generalization correct? If so, how does one go about computing such a quantity when the number of moles $$n_{i}$$ is now itself a functional of the density, $$$$n_{i} = \int d\textbf{r} \rho_{i}(\textbf{r})\tag{5}$$$$

Aside:

• It is clear that $$\partial A/\partial \rho_{i}$$ is related to the difference between chemical potentials for an incompressible, multicomponent system, e.g. http://dx.doi.org/10.1103/PhysRevE.83.061602. Because of this, it is sometimes called an "exchange" chemical potential, e.g. https://doi.org/10.1039/C6SM02839J.
• There is also a connection between the exchange chemical potentials and the osmotic pressure, $$\pi = \partial A/\partial V$$. It is not clear to me how one can calculate the osmotic pressure from a functional either, since it is also an extensive quantity.

Related:

• +10. Great first question! We hope to see more of you!!! May 30 '20 at 22:17
• Can we calculate "true" (thermodynamic sense) chemical potential from functionals directly? Free energy is defined on ensembles, and chemical potential is just the molar free energy (G, not F) of NpT ensembles. Most DFT I saw is not on NpT ensembles or any other ensembles, and applied only on electrons via Born Oppenheimer approximation, with a separate classical approximation for the nuclear movement. Also, why is n extrinsic (sorry, I have never seen used the "extrinsic" term applied in thermodynamics)?
– Greg
Jun 1 '20 at 5:47
• I think we are talking about different DFT's here. I'm talking about classical DFT: en.wikipedia.org/wiki/Density_functional_theory which is very much concerned with thermodynamics. So (i) Yes, we can define a true chemical potential and (ii) Yes, one can define a chemical potential using the Helmholtz free energy (NVT ensemble). "Extrinsic" was a mistake; I meant to say "extensive" (edited).
– Doug
Jun 2 '20 at 21:32

Seeing that this question has gathered attention but no replies, I will give it a stab. Note that I am not an expert on DFT or functional calculus, so take this with a grain of salt. As usual, suggestions to the post will be welcome!

Using an approach I saw here, we can use a chain rule and obtain the following:

$$\frac{\delta F[\rho(\boldsymbol{r})]}{\delta n_i[\rho_i(\boldsymbol{r})]} = \int \frac{\frac{\delta F[\rho(\boldsymbol{r})]}{\delta \rho(\boldsymbol{r})}}{\frac{\delta n_i[\rho_i(\boldsymbol{r})]}{\delta \rho(\boldsymbol{r})}} d\boldsymbol{r} = \int \frac{\frac{\delta F[\rho(\boldsymbol{r})]}{\delta \rho_i(\boldsymbol{r})}}{\frac{\delta n_i[\rho_i(\boldsymbol{r})]}{\delta \rho_i(\boldsymbol{r})}} d\boldsymbol{r}\tag{1}$$

where the last equality stems from the fact that the integrand will vanish for any $$\rho_k, k\neq i$$. It is straightforward to see that:

$$\frac{\delta n_i[\rho_i(\boldsymbol{r})]}{\delta \rho_i(\boldsymbol{r})} = 1\tag{2}$$ so the above integral reduces to:

$$\frac{\delta F[\rho(\boldsymbol{r})]}{\delta n_i[\rho_i(\boldsymbol{r})]} = \int \frac{\delta F[\rho(\boldsymbol{r})]}{\delta \rho_i(\boldsymbol{r})} d\boldsymbol{r}\tag{3}$$

which is what I assume you mean by writing $$\frac{\partial F}{\partial \rho_i}$$, since this will be a function of $$\boldsymbol{r}$$, unless you integrate over it, and coordinate-dependent chemical potentials don't make much sense to me! Also, note that the functional derivative is only equal to $$\frac{\partial f}{\partial \rho_i}$$ if your free energy functional doesn't depend on any derivatives of the density. In this case, you will need higher-order terms as well.

Edit: I will give the osmotic pressure a try as well, but this will definitely need to be checked for some non-obvious errors. Use at your own discretion.

You can express $$\frac{\delta F[\rho(\boldsymbol{r})]}{\delta V}$$ as $$\frac{\delta F[\rho(\boldsymbol{sr})]}{\delta s^3}\Big|_{s=1} = \frac{1}{3s^2}\frac{\delta F[\rho(s\boldsymbol{r})]}{\delta s}\Big|_{s=1}$$ for some scaling factor $$s$$. In this case, the chain rule tells us that:

\begin{align}\frac{1}{3s^2}\frac{\delta F[\rho(s\boldsymbol{r})]}{\delta s}\Bigg|_{s=1} &= \frac{1}{3s^2} \int \frac{\delta F[\rho(s\boldsymbol{r})]}{\delta \rho(s\boldsymbol r)} \frac{\partial \rho(s\boldsymbol{r})}{\partial s} d(s\boldsymbol{r})\Bigg|_{s=1}\tag{4}\\ &= \frac{1}{3} \int \frac{\delta F[\rho(\boldsymbol{r})]}{\delta \rho(\boldsymbol{r})} (\nabla\rho(\boldsymbol{r})\cdot\boldsymbol{r}) d\boldsymbol{r}\tag{5} \end{align}

• What a beautiful answer! I'm quite surprised that I don't recall ever seeing it before! It was not even written at a time when the site was extremely busy. Dec 28 '20 at 2:02