week ending PRL 113, 238304 (2014) PHYSICAL REVIEW LETTERS 5 DECEMBER 2014

Full Canonical Information from Grand-Potential Density-Functional Theory

Daniel de las Heras and Matthias Schmidt* Theoretische Physik II, Physikalisches Institut, Universität Bayreuth, D-95440 Bayreuth, Germany (Received 17 September 2014; published 5 December 2014) We present a general and formally exact method to obtain the canonical one-body density distribution and the canonical free energy from direct decomposition of classical density functional results in the grand ensemble. We test the method for confined one-dimensional hard-core particles for which the exact grand potential density functional is explicitly known. The results agree to within high accuracy with those from exact methods and our Monte Carlo many-body simulations. The method is relevant for treating finite systems and for dynamical density functional theory.

DOI: 10.1103/PhysRevLett.113.238304 PACS numbers: 82.70.Dd, 05.70.-a, 71.15.Mb, 82.35.-x

Classical density functional theory (DFT) [1–3] forms an Further interest in a canonical description originates essential tool for the investigation of a broad spectrum of from the highly successful dynamical DFT for Brownian simple [4] and complex systems [5] in soft condensed dynamics [1,10]. Here the time evolution via the underly- matter. While DFT was shown to describe a broad range ing Brownian many-body dynamics is intrinsically particle of the occurring phenomena, typically the investigated conserving, and should, hence, be more appropriately systems contain at least one large spatial dimension, such modeled canonically than, as is usually done, grand that a can be performed, where the canonically. volume V → ∞ and the number of particles N → ∞ upon Previous efforts to construct a canonical DFT were keeping the mean particle density N=V ¼ const. based, e.g., on adding a correction term to the grand Evans [1] and Mermin [3] originally formulated the potential functional [11] in order to suppress the density exact variational principle of DFT using the grand ensem- fluctuations. In Ref. [6], González et al. expressed the ble, where N fluctuates and the μ, the canonical density distribution via a series expansion in volume V, and the absolute T constitute the powers of the inverse average number of particles. By independent thermodynamic variables. The equilibrium truncating the series, they could obtain rather accurate thermodynamic grand potential Ω0ðμ;V;TÞ generalizes canonical profiles from grand canonical DFT in a system of to a grand potential functional Ωð½ρ; μ;V;TÞ of the one- confined hard spheres. The method was subsequently body density distribution ρðrÞ, where r indicates position. applied to a system of one-dimensional rods [12]. The Within the variational theory, ρðrÞ forms the trial field formal extension of the DFT formalism to the canonical which is a priori unknown. For a given thermodynamic ensemble can be based on the Mermin-Evans argument state at μ, V, and T it is the equilibrium grand canonical [13] or on Levy’s constrained search method [14]. density distribution ρ0ðrÞ which minimizes Ω [1,3]. Hence, In this Letter we present a general and formally exact at the minimum method to obtain the canonical one-body density distribu- tion and the canonical partition function using a given δΩð½ρ; μ;T;VÞ ¼ 0: ð Þ grand canonical density functional. The method is based δρðrÞ 1 μ ρ0ðrÞ on decomposing the smooth variation with of the grand canonical quantities into the underlying discrete, Evaluating the functional at ρ0ðrÞ yields the thermody- N-dependent canonical quantities. In order to demonstrate namic grand potential, Ω½ρ0¼Ω0. the validity of the method we consider the one-dimensional Both ensembles, grand canonical and canonical, are system of confined hard particles. As Percus’ (grand) free equivalent in the thermodynamic limit and the differences energy functional for this system is exact, we obtain the between them can be negligible if N ≳ 102. Nevertheless, exact canonical density profiles and the exact canonical there are many interesting systems where the number of partition functions for each discrete value of N. particles is small and the occurring structuring depends In detail, we consider N one-dimensional hard rods of nontrivially on N. Examples are the confinement of hard length σ confined between two parallel walls that are spheres in spherical cavities [6], isolated colloidal clusters separated by a distance h. The interaction between a with ∼10 particles [7], spherical colloids confined in particle and each wall is also hard core; i.e., the particles adaptive two-dimensional cavities [8], and the formation cannot penetrate the walls. We compute the grand canonical of domain walls in two-dimensional confined anisotropic density profiles ρ0ðx; μÞ, where x is the space variable, particles [9]. using the exact grand canonical density functional [15].

0031-9007=14=113(23)=238304(5) 238304-1 © 2014 American Physical Society week ending PRL 113, 238304 (2014) PHYSICAL REVIEW LETTERS 5 DECEMBER 2014

The minimization is performed using a standard conjugate canonical profile for N ¼ 1, cf. Fig. 1(a), which is constant gradient method (see, e.g., Ref. [16] for details about the within the allowed region (0.5σ ≤ x ≤ h − 0.5σ). However, implementation). As a reference we use benchmark results the corresponding grand canonical profile with N¯ ¼ 1 for canonical density profiles ρNðxÞ from our canonical exhibits clear structuring due to the combination of under- Monte Carlo (MC) simulations, where we first equilibrate lying canonical profiles. the system by performing 106 MC steps and then run First we describe how to obtain the canonical partition 8 10 10 –10 steps to obtain the density profiles. functions ZNðV;TÞ from the grand canonical DFT. The In order to illustrate the differences between canonical grand partition function of a given system is and grand canonical ensembles we show, in Fig. 1, density profiles for a pore with h=σ ¼ 4.9. The values of μ in the X∞ Ξðμ;V;TÞ¼ eβμNZ ðV;TÞ; ð Þ grand ensemble are chosen such that the resulting average N 4 total number N¯ of particles equals their (integer) number N¼0 N in the corresponding canonical system. In both grand where β ¼ 1=kBT, with kB being the Boltzmann constant. canonical and canonical ensembles the number of particles Note that in a closed system of hard cores, such as the can be calculated via the spatial integrals of the corre- present one, the sum truncates at a maximal number of sponding density profiles: particles, N . The thermodynamic grand potential is Z max ¯ NðμÞ¼ dxρ0ðx; μÞ; ð2Þ Ω0ðμ;V;TÞ¼−kBT ln Ξðμ;V;TÞ: ð5Þ V Z Combining Eqs. (4) and (5), we find N ¼ dxρNðxÞ: ð3Þ V X∞ βμN exp½−βΩ0ðμ;V;TÞ − 1 ¼ e ZNðV;TÞ; ð6Þ Because of the hard-core nature of the confined system, the N¼1 N ¼ 4 maximal number of particles is max for the chosen value of h. The density profiles in both ensembles are where the partition function of the empty state is Z0 ¼ 1 strikingly different from each other, as is exemplified by the (which only affects the normalization of the grand canoni- cal partition function, and therefore an unimportant additive x / σ x / σ constant in the grand potential). Equation (6) can be 0 123 4 0 123 4 rewritten as (a) (b) 0.3 0.8 X∞ 0.6 1 ¼ cNðμ;T;Ω0ÞZN; ð7Þ σ 0.2 σ N¼1 (x) (x) ρ 0.4 ρ

0.1 0.2 with

0 0 exp½βμN þ βΩ0ðμÞ 2 (c) (d) cNðμ;T;Ω0Þ¼ ; ð8Þ 4 1 − exp½βΩ0ðμÞ 1.5 3 Ω Z σ σ where we have suppressed the dependence of 0 and N on (x) (x) 1 V T ρ ρ 2 and in the notation. Given a grand canonical DFT, minimizing the functional for given values of μ, V, and T 0.5 1 yields results for Ω0ðμÞ. This enables us to calculate the c N 0 0 coefficients N for each according to Eq. (8).By 0123401234 μ x / σ x / σ repeating the procedure for different values of we obtain a set of linear equations, cf. Eq. (7), where the only FIG. 1 (color online). Scaled density profiles ρðxÞσ as a unknown variables are the canonical partition functions x=σ function of in the (black symbols) ZN. Numerically, solving this set of linear equations yields and in the (red lines) obtained with results for the ZN. In Fig. 2, we show the numerically canonical MC simulation and the exact grand canonical DFT, obtained canonical partition functions for the one- respectively. The pore width is h=σ ¼ 4.9. The canonical number of particles N equals the average grand canonical number of dimensional system as a function of the wall separation N¯ N ¼ 1 N ¼ 2 N ¼ 3 h. We compare these results with the analytic expression for particles in cases (a) ; (b) ; (c) .In N (d) N ¼ 4 and N¯ ≈ 3.95. Note that N¯ ¼ 4 corresponds to the the partition function [17], ZN ¼ (ðh − NσÞ=Λ) =N!, limit μ → ∞ that cannot be achieved by numerical minimization where Λ is the (irrelevant) thermal wavelength that we of the functional. have set as Λ ¼ σ. The agreement is perfect.

238304-2 week ending PRL 113, 238304 (2014) PHYSICAL REVIEW LETTERS 5 DECEMBER 2014 3 (a) 4

3

Z1 2 N 2

Z2 N

Z 1

Z3 1 0 -4 -2 0 2 4 6 Z4 βµ Z 5 (b) 1 0 12345 6 σ p p h / 0 3 p p p 4 1 2 N

FIG. 2 (color online). Canonical partition functions ZN for a p 0.5 range of particle numbers N ¼ 1–5 (as indicated) of a system of one-dimensional hard particles confined between hard walls as a function of the scaled wall separation distance h=σ. The lines 0 represent the analytic solution. The symbols indicate the numeri- -4 -2 0246 cal results for the partition functions obtained from decomposi- βµ tion of the exact grand canonical DFT results. (c) 1 p p 0 4 p 3 In order to further demonstrate the validity of the p p 1 2 N¯ ðμÞ N method, we have computed the equation of state p 0.5 using three different approaches: (i) minimizing the grand canonical DFT at different μ and obtaining N¯ ðμÞ as the space integral of the (grand canonical) density distribution, 0 see Eq. (2), (ii) using the obtained results for ZN to compute 01234 the grand canonical partition function via Eq. (4) and then N using the thermodynamic relation (d) 1 p ∂ Ξ 0 p N¯ ðμÞ¼ ln ; ð Þ 23 ∂ðβμÞ 9 V;T p p N p 3 p p 16 20 p 0.5 7 12 and (iii) as an average in the grand canonical ensemble

X∞ N¯ ðμÞ¼ p ðμÞN; ð Þ 0 N 10 0 5 10 15 20 25 N¼0 N where FIG. 3 (color online). (a) Average number of particles N¯ as a function of the scaled chemical potential βμ in a pore with h=σ ¼ ZN 4.9 calculated with three different methods. The lines lie on top of pNðμÞ¼expðβμNÞ ; ð11Þ ΞðμÞ each other. (b) Probability pN of finding N ¼ 0–4 (as indicated) particles in a pore with h=σ ¼ 4.9 as a function of βμ. (c) pN as a N¯ is the probability of finding N particles at given value of μ. function of the average number of particles inside the pore. p N ¼ 0–25 N¯ h=σ ¼ The results are shown in Fig. 3(a). The three curves lie on (d) N, with , as a function of in a pore with 25.9 and a parabolic external potential. top of each other. In Figs. 3(b) and 3(c) we show the ¯ probabilities pN as a function of μ and N, respectively. As expected the probability of finding N particles is maximal grand canonical ensembles can be observed at higher at the value of the chemical potential for which N¯ ðμÞ¼N. values of N. At high values of μ almost only the state with four particles The method remains valid in the presence of an external contributes to the grand canonical state because states potential. As an example, we show in Fig. 3(d) pN as a with N>4 are not allowed. Actually, in the limit μ → ∞ function of N¯ in a pore with h=σ ¼ 25.9 and a parabolic ¯ βV ðxÞ¼0 05ðx − h=2Þ2σ−2 the grand canonical state with N ¼ 4 is the same as the external potential ext . . canonical state with N ¼ 4 [cf. Fig. 1(d)] in this pore. Next we decompose the one-body grand canonical However, in wider pores differences between canonical and distribution function into one-body canonical distribution

238304-3 week ending PRL 113, 238304 (2014) PHYSICAL REVIEW LETTERS 5 DECEMBER 2014 (a) ρ 4 4 of hard rods for which the exact grand canonical free energy functional is known. Therefore, the results for canonical 3 partition functions and for the canonical density profiles are

σ ρ 3 (numerically) exact. If one starts with an approximate grand (x)

N 2

ρ ensemble free energy functional, the resulting canonical ρ 1 2 partition functions and profiles will be also approximative. ρ Their accuracy will depend on the quality of the starting 1 0 grand canonical DFT. Hence, the present method can also 01234 x / σ be used to test the accuracy of a grand canonical DFT by decomposition and comparing the resulting canonical pro- (b) files to those obtained in simulations (or experiments). The set of linear equations that we have used to find 0.8 the canonical partition sums, cf. Eq. (7), requires as an

σ input the grand potential. Alternatively, we can combine

(x) Eqs. (4) and (10), resulting in ρ Canonical profile N=20 0.6 X∞ βμN ¯ Grand canonical profile N=20 e ½N − NðμÞZN ¼ 0: ð13Þ N¼0 0 2.5 5 7.5 10 12.5 x / σ ¯ In order to find ZN using Eq. (13) one only needs N as FIG. 4 (color online). Scaled canonical density profiles ρNðxÞσ a function of μ. Thus, this might constitute a suitable obtained by MC simulation (black symbols) and using the grand method to obtain ZN in grand canonical simulations (or canonical decomposition (red lines) of the exact grand canonical experiments). DFT for: (a) N ¼ 1–4 in a pore with h=σ ¼ 4.9, and (b) N ¼ 20 Furthermore, the direct decomposition method might be h=σ ¼ 25 9 in a pore with . with a parabolic external potential used to accelerate the numerical minimization of grand βV ðxÞ¼0 05ðx − h=2Þ2σ−2 ext . . The dashed green line in (b) is canonical DFT for finite systems as follows: (i) minimize the grand canonical profile for N¯ ¼ 20. Only the left half of the the DFT for a given set of values of the chemical potential; profiles are shown in (b). (ii) obtain the canonical partition functions and density profiles; (iii) use ZN and the canonical profiles to straight- functions. Using Eqs. (2), (3), and (10) allows us to express forwardly obtain the grand canonical potential and density the grand canonical one-body distribution as a linear profiles for any value of chemical potential. This decom- combination of canonical distributions: position-recomposition scheme might be also applied to obtain grand canonical states at very high chemical X∞ potential; this is a regime that is difficult to access by ρ0ðx; μÞ¼ pNðμÞρNðxÞ: ð12Þ N¼0 direct minimization of the functional. In order to decom- pose the functional one only needs a range in μ to which all All terms in the above expression are known except for the the canonical states contribute. For example, in the pore canonical density profiles. Analogous to the case of the with h=σ ¼ 4.9, the range 0 ≤ βμ ≤ 2 [see Fig. 3(b)]is partition function above, these can be obtained by solving a enough to find all the canonical partition sums and density set of linear equations, where the unknown quantities are profiles in the pore. Once these are known we can the canonical profiles, ρNðxÞ. This procedure applies recompose the canonical profiles and obtain the limit locally, i.e., for each value of x. The results are plotted μ → ∞ that corresponds to a pore with N ¼ 4. in Fig. 4, where we compare with the canonical profiles From a numerical point of view the decomposition obtained from MC simulations. The agreement is excellent scheme is a local, “postprocessing” routine, which does and demonstrates that one indeed is able to decompose the neither depend on the complexity of the functional nor on grand canonical density profiles into the exact canonical that of the external potential. It consists of solving a set of ∼N density profiles. While in wide pores the differences linear equations with max unknowns (at each space between canonical and grand canonical profiles are small point). Even for the simple functional used here, this or even negligible at intermediate packing fractions, sig- procedure is therefore much faster than the DFT minimi- nificant differences can be observed at high packing zation routine. However, as the values of the coefficients cN fractions, see Fig. 4(b) for an example case. in Eq. (8) vary over many orders of magnitude, systems N ≳ 50 To summarize, we have developed a method to obtain the with max become increasingly difficult to treat with canonical partition functions and the canonical one-body the standard solution methods that we use here. The use of density distributions, using a given grand canonical DFT. higher than double precision numerics might alleviate this We have applied the method to a one-dimensional system problem. An alternative, in particular for systems where

238304-4 week ending PRL 113, 238304 (2014) PHYSICAL REVIEW LETTERS 5 DECEMBER 2014 there is no restriction on the maximum number of particles, [3] N. D. Mermin, Phys. Rev. 137, A1441 (1965). 144 consists of truncating the coefficients cN beyond a given [4] J. F. Lutsko, Adv. Chem. Phys. , 1 (2010). value of N. This applies provided that the chemical [5] J. Wu and Z. Li, Annu. Rev. Phys. Chem. 58,85 potentials selected for the decomposition are such that the (2007). truncated coefficients are sufficiently small. However, care [6] A. González, J. A. White, F. L. Román, S. Velasco, and R. 79 must be taken in order to not introduce truncation artifacts. Evans, Phys. Rev. Lett. , 2466 (1997). Besides the partition sum and one-body density profiles, [7] G. Meng, N. Arkus, M. P. Brenner, and V. N. Manoharan, Science 327, 560 (2010). the decomposition method applies to all further grand [8] I. Williams, E. C. Oguz, R. L. Jack, P. Bartlett, H. Löwen, ensemble averages. This includes, in particular, canonical and C. P. Royall, J. Chem. Phys. 140, 104907 (2014). two-body correlation functions, to be obtained from the [9] D. de las Heras and E. Velasco, Soft Matter 10, 1758 (usual) grand ensemble results (e.g., within DFT from the (2014). Ornstein-Zernike or test-particle routes, or, alternatively, [10] U. M. B. Marconi and P. Tarazona, J. Chem. Phys. 110, from liquid state integral equation theories). The avail- 8032 (1999). ability of such canonical results (for finite systems) offers [11] J. A. White, A. González, F. L. Román, and S. Velasco, the exciting possibility to shed further light on the canoni- Phys. Rev. Lett. 84, 1220 (2000). cal version of the Ornstein-Zernike equation, as developed [12] S.-C. Kim, J. Chem. Phys. 110, 12265 (1999). by Ramshaw [18], Hernando, and Blum [14], and White [13] W. S. B. Dwandaru and M. Schmidt, Phys. Rev. E 83, and González [19]. Furthermore, our method offers the 061133 (2011). 13 possibility to study ensemble differences in solvation [14] J. A. Hernando and L. Blum, J. Phys. Condens. Matter , phenomena [1]. We have stayed away from phase tran- L577 (2001). [15] J. K. Percus, J. Stat. Phys. 15, 505 (1976). sitions where multiple solutions might occur. [16] P. Tarazona, J. Cuesta, and Y. Martínez-Ratón, Lect. Notes Phys. 753, 247 (2008). [17] L. Tonks, Phys. Rev. 50, 955 (1936). *Matthias.Schmidt@uni‑bayreuth.de [18] J. D. Ramshaw, Mol. Phys. 41, 219 (1980). [1] R. Evans, Adv. Phys. 28, 143 (1979). [19] J. A. White and A. González, J. Phys. Condens. Matter 14, [2] R. Evans, Fundamentals of Inhomogeneous Fluids (CRC 11907 (2002). Press, New York, 1992), pp. 85–175.

238304-5