Force density functional theory in- and out-of-equilibrium

When a fluid is subject to an external field, as is the case near an interface or under spatial confinement, then the density becomes spatially inhomogeneous. Although the one-body density provides much useful information, a higher level of resolution is provided by the two-body correlations. These give a statistical description of the internal microstructure of the fluid and enable calculation of the average interparticle force, which plays an essential role in determining both the equilibrium and dynamic properties of interacting fluids. We present a theoretical framework for the description of inhomogeneous (classical) many-body systems, based explicitly on the two-body correlation functions. By consideration of local Noether-invariance against spatial distortion of the system we demonstrate the fundamental status of the Yvon-Born-Green (YBG) equation as a local force-balance within the fluid. Using the inhomogeneous Ornstein-Zernike equation we show that the two-body correlations are density functionals and, thus, that the average interparticle force entering the YBG equation is also a functional of the one-body density. The force-based theory we develop provides an alternative to standard density functional theory for the study of inhomogeneous systems both in- and out-of-equilibrium. We compare force-based density profiles to the results of the standard potential-based (dynamical) density functional theory. In equilibrium, we confirm both analytically and numerically that the standard approach yields profiles that are consistent with the compressibility pressure, whereas the force-density functional gives profiles consistent with the virial pressure. For both approaches we explicitly prove the hard-wall contact theorem that connects the value of the density profile at the hard-wall with the bulk pressure. The structure of the theory offers deep insights into the nature of correlation in dense and inhomogeneous systems.

Introduction
============

The analysis of spatial inhomogeneity is a primary means to characterize a wide range of self-organized and complex states of matter @hansen2013. Representative examples of systems and effects with inherent position-dependence cover a wide range of soft matter @evans2019physicsToday [@nagel2017], including hydrophobic solvation in complex environments @levesque2012jcp, desorption of water at short and long length scales @jeanmairet2013jcp, liquids at hydrophobic and hydrophilic substrates characterized by wetting and drying surface phase diagrams @evans2019pnas [@evans2015prl], critical drying of liquids @evans2016prl, solvent-mediated forces between nanonscopic solutes @chacko2017, electrolyte aqueous solutions near a solid surface @martinjimenez2017natCom, layering in liquids @hernandez-munoz2019, the structure of liquid-vapor interfaces @muscatello2017 [@tschopp2020] and locally resolved density fluctuations @evans2019pnas [@evans2015prl; @evans2016prl; @chacko2017; @eckert2020auxiliaryFields].

Obtaining a systematic understanding of the physics that emerges in such systems can be achieved by using microscopically resolved correlation functions. In particular the one-body density profile captures a broad spectrum of behaviours, from strong oscillations in dense liquids, where molecular packing effects dominate @levesque2012jcp [@martinjimenez2017natCom; @hernandez-munoz2019; @muscatello2017; @eckert2020auxiliaryFields], to pronounced drying layers near hydrophobic substrates when approaching bulk evaporation @jeanmairet2013jcp [@evans2019pnas; @evans2015prl; @evans2016prl; @chacko2017]. Effects such as these can be induced by walls or other external influence, which typically is modelled by a position-dependent external potential $V_{\text{ext}}({{\mathbf r}})$. The physical relationship of the external potential with the density profile $\rho({{\mathbf r}}')$ is often viewed in a causal way, such that a change in the external potential at some position ${{\mathbf r}}$ will create a density response in the system @hansen2013. In general this response will not only occur at the same position, but also, mediated by the interparticle interactions, at positions ${{\mathbf r}}'$ further away. Near a surface phase transition @evans2019pnas [@evans2015prl] the associated length-scale can become very large.

On a formal level, $V_{\text{ext}}({{\mathbf r}})$ and $\rho({{\mathbf r}}')$ form a pair of conjugate variables within the variational framework of classical density functional theory (DFT) @evans1979 [@evans1992; @evans2016; @hansen2013]. DFT is based on the existence of a generating (free energy) functional. Its nontrivial contribution, the intrinsic excess free energy functional, $F_{\text{exc}}[\rho]$, originates from the interparticle interactions. Due to inherent coupling of the degrees of freedom of the many-body system, exact expressions for this quantity do not exist except for rare special cases. Approximations are thus required for most applications. Minimizing the grand potential functional, $\Omega[\rho]$, typically by numerically solving the associated Euler-Lagrange (EL) equation, then gives results for the spatial structure and the thermodynamics of the inhomogeneous system under consideration. The EL equation can be viewed as a condition of local chemical equilibrium throughout the system @evans1979. Here the local chemical potential consists of three physically distinct contributions: a trivial ideal gas term, an excess (over ideal) term which arises from the interparticle interactions and an external contribution.

An analogous point of view, which at first sight seems to be based on quite different physical intuition, is that of a force balance relationship. As an equilibrium system is on average at rest, the total local force must vanish at each point in space. This is a classical result obtained by Yvon @yvon1935, Born and Green @born1946 (YBG) and it forms an exact property (sum-rule). Within computer simulation methodology, working on the level of force distributions has recently received a boost through the introduction of smart sampling strategies. 'Use the force' @rotenberg2020 constitutes a new paradigm for obtaining data with significantly reduced statistical noise @borgis2013 [@delasheras2018forceSampling; @purohit2019], as compared to direct sampling via simple counting of events. Force distributions naturally generalize to nonequilibrium, where the equilibrium ensemble average is replaced by a dynamical average over the corresponding set of states, e.g. for overdamped Brownian dynamics @delasheras2018velocityGradient [@delasheras2020fourForces]. For quantum systems, the locally resolved force-balance relationship was recently addressed for dynamical situations @tarantino2021 [@tchenkoue2019]. On a fundamental level it is apparent that out-of-equilibrium, it is forces, rather than potentials, that play the central role in determining the particle motion. A dynamical theory based on potentials will clearly be incapable of treating nonconservative forces and can also be expected to break down whenever the microstructure of the system deviates strongly from that of equilibrium. These difficulties present a fundamental limitation to the usefulness of existing dynamical density functional (DDFT) approaches @evans1979 [@marconi99; @archer_evans] and have served to motivate development of the force-based power functional theory (PFT) @schmidt2013pft [@schmidt2021pft].

Focusing on equilibrium, the YBG derivation conventionally rests on formally integrating the full $N$-body equilibrium distribution over $N\!-\!1$ spatial degrees of freedom @yvon1935 [@born1946; @hansen2013]. The one-body density is thus expressed in terms of an integral of the two-body density. In contrast, DFT is closed on the one-body level (using the EL equation) and hence neither requires consideration of the two-body level, nor does it permit to systematically incorporate such information. In this paper we present a theoretical density functional approach, which accounts explicitly for the interparticle forces and enables calculation of the one-body density for inhomogeneous fluids both in- and out-of-equilibrium.

Roadmap
=======

In the following we give an overview to guide the reader through the main results and concepts presented in this work. We begin, in subsection \[noether\], by developing the Noether theorem for the invariance of the grand potential under spatial distortions, as characterized by a vector displacement field ${{\boldsymbol \epsilon}}({{\mathbf r}})$. Expressing the grand potential as a functional of ${{\boldsymbol \epsilon}}({{\mathbf r}})$ leads to the variational condition, $$\frac{\delta \Omega[{{\boldsymbol \epsilon}}]}{\delta {{\boldsymbol \epsilon}}({{\mathbf r}})}\Big|_{{{\boldsymbol \epsilon}}({{\mathbf r}})=0}
=\,0,$$ which generates the following force-balance (YBG) relation $$\begin{gathered}
-k_B T \, \nabla_{{{\mathbf r}}_1}\ln\big(\rho({{\mathbf r}}_1)\big) - \nabla_{{{\mathbf r}}_1}V_{\text{ext}}({{\mathbf r}}_1) \\
- \int d {{\mathbf r}}_2 \frac{{\rho^{(2)}}({{\mathbf r}}_1, {{\mathbf r}}_2)}{\rho({{\mathbf r}}_1)} \nabla_{{{\mathbf r}}_1} \phi(|{{\mathbf r}}_1 - {{\mathbf r}}_2|) = 0,\end{gathered}$$ where the subscripted position variables ${{\mathbf r}}_1$ and ${{\mathbf r}}_2$ play the role of a fixed point in space, ${{\mathbf r}}_1$, and a 'field point' which is integrated over, ${{\mathbf r}}_2$. The two-body density and pair interaction potential are indicated by ${\rho^{(2)}}$ and $\phi$, respectively ($k_B$ denotes the Boltzmann constant and $T$ is the absolute temperature). Our variational derivation highlights the fundamental status of the YBG equation, which we then take as a starting point for a self-consistent approach to determining the one-body density and can be written without approximation in the following form $$\rho({{\mathbf r}}_1) = {\rm e}^{\beta \left(\mu -V_{\text{ext}}({{\mathbf r}}_1)\right) + c_{\text{f}}^{(1)}({{\mathbf r}}_1)},$$ where $\mu$ is the chemical potential, $\beta\!=\!(k_BT)^{-1}$ and the contribution $- k_BT c_{\text{f}}^{(1)}({{\mathbf r}}_1)$, acts as an effective external field arising from interparticle interactions. In subsection \[forceDFT\], we introduce the concept that the two-body correlation functions are functionals of the one-body density and we then use this to reinterpret the YBG equation as a <span>*closed*</span> integral equation for the one-body density. This leads us to the definition $$c_{\text f}^{(1)}({{\mathbf r}}_1) \equiv -\nabla_{{{\mathbf r}}_1}^{-1} \cdot \int d {{\mathbf r}}_2 \frac{{\rho^{(2)}}({{\mathbf r}}_1, {{\mathbf r}}_2;[\rho])}{\rho({{\mathbf r}}_1)} \nabla_{{{\mathbf r}}_1} \beta\phi(|{{\mathbf r}}_1 - {{\mathbf r}}_2|)\,,$$ in which the interparticle forces appear explicitly via $\nabla_{{{\mathbf r}}_1}\phi$. The integral operator $\nabla_{{{\mathbf r}}_1}^{-1}$ is defined in the main text and the square brackets indicate a functional dependence. An essential feature of our approach is that we have a computationally feasible scheme to evaluate the inhomogeneous density functional ${\rho^{(2)}}({{\mathbf r}}_1, {{\mathbf r}}_2;[\rho])$, which then leads to a closed, self-consistent 'force-DFT'.

In subsection \[potentialDFT\], our force-based approach is contrasted with the standard DFT methodology (referred to in this work as potential-DFT) in which the grand potential is expressed as a functional of the one-body density and satisfies the variational condition, $$\frac{\delta\Omega[\rho]}{\delta\rho({{\mathbf r}})}
\Big|_{\rho({{\mathbf r}})=\rho_0({{\mathbf r}})}
=\,0,$$ where $\rho_0({{\mathbf r}})$ is the equilibrium density profile (the subscript will be omitted in the following). This leads to the well-known EL equation $$\ln\rho({{\mathbf r}}) - \beta\left(\mu - V_{\text{ext}}({{\mathbf r}})\right) 
- c_{\text p}^{(1)}({{\mathbf r}})=0,$$ which can be expressed in the following alternative form $$\rho({{\mathbf r}}) = {\rm e}^{\beta \left(\mu -V_{\text{ext}}({{\mathbf r}})\right) + c_{\text{p}}^{(1)}({{\mathbf r}})},$$ where the function $c^{(1)}_{\text p}$ is defined as a functional derivative of the excess Helmholtz free energy, $$c_{\text p}^{(1)}({{\mathbf r}})=-\frac{\delta \beta F_{\text{exc}}[\rho]}{\delta\rho({{\mathbf r}})}.$$ In contrast to the force-DFT, the potential-DFT involves only one-body functions. We thus require only a single vector position, ${{\mathbf r}}$, as an independent variable and there is no need to employ additional subscripts. The EL equation is the potential-DFT analogue of the YBG equation arising from invariance with respect to spatial distortions. If the free energy and the two-body density functionals are known only approximately, then the two approaches to DFT will lead in general to different density profiles for a given external field. This allows for deep insight into the inner workings of DFT. Subsection \[potentialDFT\] is intended primarily for readers who are less familiar with the details of potential-DFT.

In potential-DFT the well-used contact theorem predicts that the contact density at a hard planar wall is equal to $\beta P^{\,\text{c}}$, where $P^{\,\text{c}}$ is the compressibility pressure, see Reference @hansen2013 for its definition. For the force-DFT we find that the equivalent result links the contact density to $\beta P^{\,\text{v}}$, where $P^{\,\text{v}}$ is the virial pressure. In subsections \[virial\_contact\] and \[compressibility\_contact\], we prove the corresponding contact theorem for both approaches. These sum-rules are exact and hold within any reasonable approximation scheme. If the reader is prepared to accept these assertions without proof, then both of these subsections can be passed-over on a first reading of the manuscript.

As mentioned previously, in order to implement the force-DFT, we require a feasible method to obtain the density functional ${\rho^{(2)}}({{\mathbf r}}_1,{{\mathbf r}}_2;[\rho])$. Therefore, from that point onwards we will rely on approximation schemes. In subsections \[HS-FMT\] and \[implementation\], we recall the fundamental measure theory (FMT) for hard-spheres and provide information about the numerical implementation. The FMT generates an explicit expression for the two-body direct correlation function, $c^{(2)}({{\mathbf r}}_1,{{\mathbf r}}_2;[\rho])$, as a functional of the one-body density. The two-body direct correlation function, now uniquely determined by the one-body density, can be used as input to the inhomogeneous Ornstein-Zernike (OZ) equation, $$\begin{aligned}
h^{}({{\mathbf r}}_1,{{\mathbf r}}_2) = c^{(2)}({{\mathbf r}}_1,{{\mathbf r}}_2) \!+\! 
\int\! d{{\mathbf r}}_3\, h^{}({{\mathbf r}}_1,{{\mathbf r}}_3)\rho({{\mathbf r}}_3) c^{(2)}({{\mathbf r}}_3,{{\mathbf r}}_2),\end{aligned}$$ which is then a linear integral equation for determination of the total correlation function, $h$. By self-consistent solution of the OZ equation we obtain $h$ for any given one-body density; $h$ is thus a density functional. It has been shown that the inhomogeneous OZ equation can be numerically solved to high accuracy both in planar and spherical geometry @tschopp2020 [@tschopp2021; @attard]. Using the relation $$\rho^{(2)}({{\mathbf r}}_1, {{\mathbf r}}_2) = \rho({{\mathbf r}}_1) \rho({{\mathbf r}}_2) \bigg(h({{\mathbf r}}_1, {{\mathbf r}}_2) +1\bigg)$$ then gives a clear self-consistent scheme to determine $\rho^{(2)}$ as a functional of the one-body density. In subsection \[hardwall\_numerics\], we show numerical results for the equilibrium density of hard-spheres at a hard-wall using both force- and potential-DFT, and validate the analytical predictions for the contact density. This demonstrates explicitly that the presented framework is not merely formal, but that it forms a concrete numerical scheme for the systematic study of inhomogeneous fluids.

In section \[dynamics\], we consider nonequilibrium systems subject to overdamped Brownian dynamics and show how the force-DFT allows calculation of the time-dependent density, $\rho({{\mathbf r}},t)$. We argue that the force-DFT provides the most natural starting point for the development of a dynamical theory for the density, as it is the forces which are responsible for moving the particles. Conservation of particle number dictates that the density obeys the continuity equation $$\frac{\partial \rho({\mathbf}{r}_1,t)}{\partial t} = - \nabla_{{\mathbf}{r}_1} \cdot {\mathbf}{j}({\mathbf}{r}_1,t),$$ where ${\mathbf}{j}({\mathbf}{r}_1,t)$ is the current, which needs to be specified to have a closed theory.

In subsection \[forceDDFT\], we describe the force-DDFT, which is based on the following exact expression for the current $$\begin{gathered}
{\mathbf}{j}({\mathbf}{r}_1,t) \!=\! -D_0 \, \rho({\mathbf}{r}_1,t) \Bigg( \nabla_{{\mathbf}{r}_1} \ln(\rho({\mathbf}{r}_1,t))
+ \nabla_{{\mathbf}{r}_1} \beta V_{\text{ext}}({\mathbf}{r}_1) \\
+ \int d {\mathbf}{r}_2 \, \frac{\rho^{(2)}({\mathbf}{r}_1,{\mathbf}{r}_2,t)}{\rho({\mathbf}{r}_1,t)} \nabla_{{\mathbf}{r}_1} 
\beta \phi(|{{\mathbf r}}_1-{{\mathbf r}}_2|) \Bigg),\end{gathered}$$ where $D_0$ is the diffusion coefficient. Using the previously described equilibrium functional for ${\rho^{(2)}}$ yields a closed adiabatic theory for the one-body density. At each time-step the integral term is explicitly evaluated to obtain the average force due to interparticle interactions. In contrast, the familiar potential-DDFT, recalled in subsection \[potentialDDFT\], employs only one-body functions. The current in this case is given by $$\begin{gathered}
\!\!\!\!{\mathbf}{j}({\mathbf}{r},t) \!=\! -D_0 \, \rho({\mathbf}{r},t)
\nabla_{{\mathbf}{r}}\Bigg( \ln(\rho({\mathbf}{r},t))
+ \beta V_{\text{ext}}({\mathbf}{r})
-  c^{(1)}_{\text{p}}({\mathbf}{r},t) \Bigg). \end{gathered}$$ In subsection \[numericaltrap\], we employ the FMT to generate numerical results for the density relaxation in a harmonic-trap and we compare the predictions of the force-DDFT with those of the potential-DDFT. This demonstrates that our force-based theory provides a firm basis for developing a systematic understanding of nonequilibrium phenomena. Finally, in section \[conclusions\], we draw our conclusions and give an outlook for future work.

Equilibrium theory
==================

Force-balance generated by Noether's theorem {#noether}
--------------------------------------------

We begin our development of force-DFT by starting with the microscopic Hamiltonian and using invariance arguments. Let us consider a classical system of $N$-particles described by position coordinates ${{\mathbf r}}_1,\ldots,{{\mathbf r}}_N\equiv {{\mathbf r}}^N$ and momenta ${{\bf p}}_1,\ldots,{{\bf p}}_N\equiv
{{\bf p}}^N$. The Hamiltonian $H$ has the standard form consisting of kinetic, internal and external potential energy contributions according to $$\begin{aligned}
  H &= \sum_{i=1}^N \frac{{{\bf p}}_i^2}{2m}
  + U_N({{\mathbf r}}^N) + \sum_{i=1}^N V_{\text{ext}}({{\mathbf r}}_i).
  \label{EQhamiltonianFDFT}\end{aligned}$$ Here $m$ indicates the particle mass, $U_N$ denotes the total interparticle interaction potential and $V_{\text{ext}}$ is an external one-body field.

We consider a canonical transformation on phase-space, parameterized by a vector field ${{\boldsymbol \epsilon}}({{\mathbf r}})$ that describes a spatial displacement ('distortion') at position ${{\mathbf r}}$. The transformation affects both coordinates and momenta and is given by $$\begin{aligned}
  {{\mathbf r}}_i &\to {{\mathbf r}}_i+{{\boldsymbol \epsilon}}({{\mathbf r}}_i) \equiv {{\mathbf r}}'_i,
  \label{EQcanonicalTransformationCoordinates}\\
    {{\bf p}}_i &\to {{\bf p}}_i- \nabla_{{{\mathbf r}}_i}{{\boldsymbol \epsilon}}({{\mathbf r}}_i) \cdot {{\bf p}}_i
    \equiv {{\bf p}}'_i,
  \label{EQcanonicalTransformationMomenta}\end{aligned}$$ where the primes indicate the new phase-space variables and $\nabla_{{{\mathbf r}}_i}$ denotes differentiation with respect to ${{{\mathbf r}}_i}$. We consider the displacement field ${{\boldsymbol \epsilon}}({{\mathbf r}})$ and its gradient to be small.

The change in phase space variables affects the Hamiltonian and renders it functionally dependent on the displacement field, $H\!\to\! H[{{\boldsymbol \epsilon}}]$. Inserting transformations and into equation and expanding in the displacement field to linear order yields $$\begin{aligned}
  H[{{\boldsymbol \epsilon}}] &= H_0 -
  \sum_{i=1}^N \frac{{{\bf p}}_i{{\bf p}}_i}{m}:\nabla_{{{\mathbf r}}_i}{{\boldsymbol \epsilon}}({{\mathbf r}}_i)
  \notag\\&\quad
  +\sum_{i=1}^N {{\boldsymbol \epsilon}}({{\mathbf r}}_i)\cdot\nabla_{{{\mathbf r}}_i}
  \big(U_N({{\mathbf r}}^N)+V_{\text{ext}}({{\mathbf r}}_i)\big),
  \label{EQhamiltonianTransformedFDFT}\end{aligned}$$ where $H_0\!=\!H[{{\boldsymbol \epsilon}}\!=\!0]$ is the original Hamiltonian as given in equation . The colon indicates the contraction ${{\bf p}}_i{{\bf p}}_i\!:\!\nabla_{{{\mathbf r}}_i}{{\boldsymbol \epsilon}}({{\mathbf r}}_i)\!=\!
\sum_{\alpha,\gamma}p_{i\alpha}p_{i\gamma}\nabla_{r_{i\gamma}}
\epsilon_{\alpha}$, where Greek indices indicate Cartesian components.

Turning to a statistical description, the grand potential, $\Omega_0\!=\!\Omega[{{\boldsymbol \epsilon}}\!=\!0]$, and the grand partition sum, $\Xi_0\!=\!\Xi[{{\boldsymbol \epsilon}}\!=\!0]$, of the original system are given respectively by $$\begin{aligned}
  \Omega_0 &= -k_BT \ln \Xi_0\,,
  \label{EQgrandPotentialFDFT}\\
  \Xi_0 &= {{\rm Tr}\,}{\rm e}^{-\beta (H_0 - \mu N)}.
  \label{EQpartitionSumFDFT}\end{aligned}$$ In the grand canonical ensemble the trace is defined as ${{\rm Tr}\,}\!=\!
\sum_{N=0}^\infty (h^{3N}N!)^{-1} \int d{{\mathbf r}}_1\ldots d{{\mathbf r}}_N
d{{\bf p}}_1\ldots d{{\bf p}}_N$, with $h$ indicating the Planck constant @hansen2013.

The transformed Hamiltonian, $H[{{\boldsymbol \epsilon}}]$, can be used to define a correspondingly transformed grand potential functional, $\Omega[{{\boldsymbol \epsilon}}]\!=\! -k_BT \ln \left({{\rm Tr}\,}{\rm
  e}^{-\beta(H[{{\boldsymbol \epsilon}}]-\mu N)}\right)$. To linear order in ${{\boldsymbol \epsilon}}({{\mathbf r}})$ the functional Taylor expansion of $\Omega[{{\boldsymbol \epsilon}}]$ is given by $$\begin{aligned}
  \Omega[{{\boldsymbol \epsilon}}] = \; &\Omega_0
  +\int d{{\mathbf r}}\,
 \frac{\delta \Omega[{{\boldsymbol \epsilon}}]}{\delta{{\boldsymbol \epsilon}}({{\mathbf r}})}
 \Big|_{{{\boldsymbol \epsilon}}({{\mathbf r}})= 0}\!\!\cdot{{\boldsymbol \epsilon}}({{\mathbf r}}).
 \label{EQomegaTaylorExpansionFDFT}\end{aligned}$$ The functional derivative in can be calculated as follows $$\begin{aligned}
  \frac{\delta \Omega[{{\boldsymbol \epsilon}}]}{\delta{{\boldsymbol \epsilon}}({{\mathbf r}})}
  &=
  -\frac{k_BT}{\Xi[{{\boldsymbol \epsilon}}]}{{\rm Tr}\,}\frac{\delta}{\delta{{\boldsymbol \epsilon}}({{\mathbf r}})}
       {\rm e}^{-\beta(H[{{\boldsymbol \epsilon}}]-\mu N)}
  \notag\\&=
  -\frac{k_BT}{\Xi[{{\boldsymbol \epsilon}}]}{{\rm Tr}\,}{\rm e}^{-\beta(H[{{\boldsymbol \epsilon}}]-\mu N)}
  \Bigg(\!-\beta\frac{\delta H[{{\boldsymbol \epsilon}}]}{\delta {{\boldsymbol \epsilon}}({{\mathbf r}})}\Bigg)
  \notag\\&=
  {{\rm Tr}\,}\Psi \frac{\delta H[{{\boldsymbol \epsilon}}]}{\delta{{\boldsymbol \epsilon}}({{\mathbf r}})},
  \label{EQdeltaOmegaAsAverage}\end{aligned}$$ where we have identified $\Psi\!=\!{\rm
  e}^{-\beta(H[{{\boldsymbol \epsilon}}]-\mu N)}/\Xi[{{\boldsymbol \epsilon}}]$ as the grand ensemble probability distribution. Notably the form constitutes a grand ensemble average of $\delta H[{{\boldsymbol \epsilon}}]/\delta
{{\boldsymbol \epsilon}}({{\mathbf r}})$. Formally, the average is taken in the displaced system, but we will find the form to be sufficient to calculate averages with respect to the original, undisplaced distribution. Using equation and thus retaining only the lowest relevant order in ${{\boldsymbol \epsilon}}({{\mathbf r}})$ we obtain $$\begin{aligned}
\label{EQdeltaHdeltaEps}
  \frac{\delta H[{{\boldsymbol \epsilon}}]}{\delta {{\boldsymbol \epsilon}}({{\mathbf r}})} &=
  \sum_{i=1}^N 
\Big(  
  -\frac{{{\bf p}}_i{{\bf p}}_i}{m} \cdot \nabla_{{{\mathbf r}}_i} \delta({{\mathbf r}}-{{\mathbf r}}_i)
  \\ &\qquad\qquad
+ \delta({{\mathbf r}}-{{\mathbf r}}_i) \nabla_{{{\mathbf r}}_i}
\big(
 U_N({{\mathbf r}}^N) + V_{\text{ext}}({{\mathbf r}}_i)
\big)
\Big).
\notag \end{aligned}$$ Here we have used the fundamental rule of functional differentiation $\delta {{\boldsymbol \epsilon}}({{\mathbf r}})/\delta {{\boldsymbol \epsilon}}({{\mathbf r}}')\!=\!\delta({{\mathbf r}}-{{\mathbf r}}') {\mathbbm 1}$, where $\delta(\cdot)$ indicates the (three-dimensional) Dirac distribution, and ${\mathbbm 1}$ denotes the $3\!\times\! 3$ unit matrix. Using equation inside of the average , carrying out the phase-space integrals, evaluating at $\rm {{\boldsymbol \epsilon}}({{\mathbf r}})= 0$ and multiplying by $-1$ yields $$\begin{aligned}
  -\frac{\delta \Omega[{{\boldsymbol \epsilon}}]}{\delta {{\boldsymbol \epsilon}}({{\mathbf r}})}
  \Big|_{\rm {{\boldsymbol \epsilon}}({{\mathbf r}})= 0}
  \!\!=-k_BT \nabla_{{{\mathbf r}}} \rho({{\mathbf r}})
  +{{\bf F}}_{\text{int}}({{\mathbf r}}) 
  - \rho({{\mathbf r}}) \nabla_{{{\mathbf r}}} V_{\text{ext}}({{\mathbf r}}),
  \label{EQdeltaOmegaAsForcesFDFT}\end{aligned}$$ where the one-body density profile is defined as the average $\rho({{\mathbf r}})\!=\!{{\rm Tr}\,}\Psi \sum_i\delta({{\mathbf r}}-{{\mathbf r}}_i)$ and the internal force density is given by ${{\bf F}}_{\text{int}}({{\mathbf r}})\!=\!-{{\rm Tr}\,}\Psi \sum_i
\delta({{\mathbf r}}-{{\mathbf r}}_i)\nabla_{{{\mathbf r}}_i} U_N({{\mathbf r}}^N)$. Furthermore the ideal diffusion force density $-k_BT\nabla_{{{\mathbf r}}}\rho({{\mathbf r}})$ follows from carrying out the phase-space momentum integrals explicitly or, alternatively, using the equipartition theorem ${{\rm Tr}\,}\Psi {{\bf p}}_i \partial H/\partial
{{\bf p}}_i\!=\!k_BT \,{\mathbbm 1}$. The spatial gradients in emerge by exploiting $\nabla_{{{\mathbf r}}}\,\delta({{\mathbf r}}-{{\mathbf r}}_i)\!=\!-\nabla_{{{\mathbf r}}_i}\delta({{\mathbf r}}-{{\mathbf r}}_i)$. The right-hand side of represents the sum of the position-resolved average one-body force densities of ideal, interparticle and external origin.

Using the transformations and one can easily verify that the differential volume elements for coordinates and momenta follow to linear order in ${{\boldsymbol \epsilon}}$ as $$\begin{aligned}
d{{\mathbf r}}_i &\to  (1+\nabla_{{{\mathbf r}}_i}\cdot{{\boldsymbol \epsilon}}({{\mathbf r}}_i))d{{\mathbf r}}_i  \equiv d{{\mathbf r}}'_i, \\
d{{\bf p}}_i &\to  (1-\nabla_{{{\mathbf r}}_i}\cdot{{\boldsymbol \epsilon}}({{\mathbf r}}_i))d{{\bf p}}_i \equiv d{{\bf p}}'_i.\end{aligned}$$ We thus see that for each particle $d{{\mathbf r}}_id{{\bf p}}_i=d{{\mathbf r}}'_i d{{\bf p}}'_i$ holds to linear order in ${{\boldsymbol \epsilon}}$ and, therefore, for the entire phase-space $\Pi_{i=1}^N d{{\mathbf r}}_id{{\bf p}}_i \!=\! \Pi_{i=1}^Nd{{\mathbf r}}'_i d{{\bf p}}'_i$, as befits a canonical transformation (see Appendix \[canonical\]).

As the transformation is also time-independent, the Hamiltonian, the partition sum and the grand potential are invariant. It follows that $$\begin{aligned}
  \Omega[{{\boldsymbol \epsilon}}] &= \Omega_0.
  \label{EQomegaEpsEqualsOmega}\end{aligned}$$ The linear term in the functional Taylor expansion thus vanishes and it does so irrespective of the form of ${{\boldsymbol \epsilon}}({{\mathbf r}})$. The functional derivative itself must therefore vanish, $$\frac{\delta \Omega[{{\boldsymbol \epsilon}}]}{\delta {{\boldsymbol \epsilon}}({{\mathbf r}})}\Big|_{{{\boldsymbol \epsilon}}({{\mathbf r}})=0}
=\,0,$$ from which we can conclude that $$\begin{aligned}
  -k_BT \nabla_{{{\mathbf r}}} \rho({{\mathbf r}}) + {{\bf F}}_{\text{int}}({{\mathbf r}}) 
  - \rho({{\mathbf r}}) \nabla_{{{\mathbf r}}} V_{\text{ext}}({{\mathbf r}}) &= 0,
  \label{EQforceDensityBalance}\end{aligned}$$ which is an equilibrium force density relationship @schmidt2021pft.

When considering systems interacting via a pair potential $\phi$, the internal potential energy has the form $U_N({{\mathbf r}}^N) \!=\! \sum_{i<j}
\phi(|{{\mathbf r}}_i-{{\mathbf r}}_j|)$. The internal force density can then be written as $$\begin{aligned}
  {{\bf F}}_{\text{int}}({{\mathbf r}}_1)=-\int d{{\mathbf r}}_2
  \rho^{(2)}({{\mathbf r}}_1,{{\mathbf r}}_2)\nabla_{{{\mathbf r}}_1}\phi_{12},
  \label{EQforceIntegral}\end{aligned}$$ where the two-body density is defined microscopically as $\rho^{(2)}({{\mathbf r}}_1,{{\mathbf r}}_2)\!=\!{{\rm Tr}\,}\Psi
\sum'_{ij} \delta({{\mathbf r}}_1-{{\mathbf r}}_i) \delta({{\mathbf r}}_2-{{\mathbf r}}_j)$, with the prime on the summation indicating the omission of the terms with $i=j$, and we indicate the pair interaction potential by the shorthand $\phi_{12}\!=\!\phi(|{{\mathbf r}}_1-{{\mathbf r}}_2|)$. We have relabelled ${{\mathbf r}}\!\to\!{{\mathbf r}}_1$ to give clarity to equations involving two-body functions. Using the explicit form in the force density relationship and rearranging yields $$\begin{gathered}
\label{YBG}
-k_B T \nabla_{{{\mathbf r}}_1}\big(\ln\rho({{\mathbf r}}_1)\big) - \nabla_{{{\mathbf r}}_1}V_{\text{ext}}({{\mathbf r}}_1) \\
- \int d {{\mathbf r}}_2 \frac{{\rho^{(2)}}({{\mathbf r}}_1, {{\mathbf r}}_2)}{\rho({{\mathbf r}}_1)} \nabla_{{{\mathbf r}}_1} \phi_{12} = 0 ,\end{gathered}$$ which is the explicit form of the first member of the YBG hierarchy @hansen2013 [@mcquarrie]. We have thus shown that equation arises from a variational principle on the grand potential. It is hence of no lesser status than the EL equation of potential-DFT, to be discussed in subsection \[potentialDFT\].

Force-DFT {#forceDFT}
---------

The YBG equation , which has been derived using Noether invariance in the previous subsection, has the appealing feature that it explicitly contains the interparticle pair interaction, $\phi_{12}$. We thus take the YBG equation as a fundamental starting point for describing the equilibrium state. The third term in equation , which gives the mean interparticle interaction force at the point ${{\mathbf r}}_1$, is not written as the gradient of a potential. However, as an equilibrium system is conservative by construction we can formally rewrite it as a potential force using the inverse of the gradient $$\begin{gathered}
\label{star}
\int d {{\mathbf r}}_2 \frac{{\rho^{(2)}}({{\mathbf r}}_1, {{\mathbf r}}_2)}{\rho({{\mathbf r}}_1)} \nabla_{{{\mathbf r}}_1} \phi_{12}
\\=
\nabla_{{{\mathbf r}}_1} \bigg( \nabla_{{{\mathbf r}}_1}^{-1} \cdot \int d {{\mathbf r}}_2 \frac{{\rho^{(2)}}({{\mathbf r}}_1, {{\mathbf r}}_2)}{\rho({{\mathbf r}}_1)} \nabla_{{{\mathbf r}}_1} \phi_{12} \bigg),\end{gathered}$$ where $\nabla_{{{\mathbf r}}_1}^{-1} \!=\! \frac{1}{4\pi} \int d {{\mathbf r}}_2 \frac{({{\mathbf r}}_1-{{\mathbf r}}_2)}{|{{\mathbf r}}_1-{{\mathbf r}}_2|^3}$ is an integral operator (see e.g. @delasheras2018forceSampling [@rotenberg2020]). We thus <span>*define*</span> a scalar one-body function $c_{\text f}^{(1)}$ according to $$\label{def c1}
c_{\text f}^{(1)}({{\mathbf r}}_1) \equiv -\nabla_{{{\mathbf r}}_1}^{-1} \cdot \int d {{\mathbf r}}_2 \frac{{\rho^{(2)}}({{\mathbf r}}_1, {{\mathbf r}}_2)}{\rho({{\mathbf r}}_1)} \nabla_{{{\mathbf r}}_1} \beta\phi_{12}.$$ Although we employ the notation usually reserved for the one-body direct correlation function, equation originates here from a quite different, but arguably more intuitive and fundamental way of thinking. We can thus re-express the YBG equation in the following form $$\nabla_{{{\mathbf r}}_1} \bigg( -k_B T \ln\rho({{\mathbf r}}_1) - V_{\text{ext}}({{\mathbf r}}_1) + k_B T c_{\text f}^{(1)}({{\mathbf r}}_1) \bigg) = 0.$$ Equilibrium implies that the term in parentheses is equal to a constant, which leads to $$\label{EL force}
\rho({{\mathbf r}}_1) = {\rm e}^{\beta \left(\mu -V_{\text{ext}}({{\mathbf r}}_1)\right) + c_{\text f}^{(1)}({{\mathbf r}}_1)}.$$ In contrast to standard potential-DFT here the function $c_{\text f}^{(1)}$ is simply defined by equation and is generated directly from an explicit integral over the pair interaction force. Combining equations and yields $$\begin{aligned}
\label{main_forceDFT}
\rho({{\mathbf r}}_1) = \exp&\Bigg(\beta \left(\mu-V_{\text{ext}}({{\mathbf r}}_1)\right) 
\\
&- \nabla_{{{\mathbf r}}_1}^{-1} \cdot \int d {{\mathbf r}}_2 \frac{{\rho^{(2)}}({{\mathbf r}}_1, {{\mathbf r}}_2;[\rho])}{\rho({{\mathbf r}}_1)} \nabla_{{{\mathbf r}}_1} \beta\phi_{12}\Bigg),
\notag\end{aligned}$$ which is the central equation of force-DFT. Given an explicit expression for the two-body density as a functional of the one-body density, ${\rho^{(2)}}\!\equiv\!{\rho^{(2)}}({{\mathbf r}}_1,{{\mathbf r}}_2;[\rho])$, equation enables calculation of $\rho({{\mathbf r}}_1)$ for any given external potential.

Potential-DFT {#potentialDFT}
-------------

The standard implementation of DFT (referred to in this work as potential-DFT) is based on the grand potential density functional, $\Omega[\rho]$, given by $$\Omega[\rho] = F_{\text{id}}[\rho]  + F_{\text{exc}}[\rho]  - \int d{{\mathbf r}}(\mu-V_{\text{ext}}({{\mathbf r}})) \rho({{\mathbf r}}),$$ where $\beta F_{\text{id}}[\rho]\!=\!\int d{{\mathbf r}}\rho({{\mathbf r}})\big( \ln(\rho({{\mathbf r}}))-1\big)$ is the ideal gas contribution with the thermal wavelength set equal to unity. Variational minimization of the grand potential $$\frac{\delta \Omega[\rho]}{\delta \rho({{\mathbf r}})} = 0,$$ generates the EL equation, $$\label{EL potential}
\rho({{\mathbf r}}) = {\rm e}^{\beta \left(\mu -V_{\text{ext}}({{\mathbf r}})\right) + c^{(1)}_{\text{p}}({{\mathbf r}})}.$$ The function $c^{(1)}_{\text{p}}$ is defined to be the first functional derivative of the excess (over ideal) Helmholtz free energy with respect to the density @evans1979 [@hansen2013], $$\label{c1 potential}
c_{\text p}^{(1)}({{\mathbf r}})=-\frac{\delta \beta F_{\text{exc}}[\rho]}{\delta\rho({{\mathbf r}})}.$$ This function $c^{(1)}_{\text{p}}$, which is now the familiar one-body direct correlation function, is the first member of a hierarchy of correlation functions generated by successive functional differentiation of $F_{\text{exc}}$ with respect to the density. For situations in which all quantities are known exactly the definition given in equation is equivalent to that of equation . Even though the EL equation has the same structure as equation , these are conceptually different and have distinct origins. The potential-DFT is constructed using only one-body functions and the average interaction force is generated by taking the gradient of $c^{(1)}_{\text{p}}$. This should be contrasted with the force-DFT, which works on the two-body level, in which the interaction force is calculated by explicit spatial integration of the pair-interaction, see equation .

If both the one-body direct correlation function and the two-body density are generated from the same, exact free energy functional, then both the potential- and force-DFT implementations will yield the same average interaction force and thus the same density profiles. This will not be the case when using an approximate free energy functional and differences can be expected. The special case of a hard-wall substrate enables the degree of consistency between these two routes to be examined analytically and this will be the focus of the following two subsections \[virial\_contact\] and \[compressibility\_contact\] (which can be skipped if the reader is more interested in the numerical predictions of potential- and force-DFT, which are presented in subsection \[hardwall\_numerics\]). Route-dependency will also turn out to be highly relevant for the dynamical versions of potential- and force-DFT, as shown later in section \[dynamics\].

Virial contact theorem {#virial_contact}
----------------------

Before we proceed to investigate the virial route version of the contact theorem, we recall the very general and well-known version of it, namely that $\rho_{\text{w}}\!=\! \beta P$, which relates the density of a fluid at a planar hard-wall, $\rho_{\text{w}}$, to the corresponding bulk pressure, $P$. This can be proven without the need to specify by which method the one-body density is obtained. We provide a general proof of this in Appendix \[general\_contact\]. When used in potential-DFT studies it is always implicitly assumed that the relevant pressure is that of the compressibility route, which we prove is indeed the case in the next subsection. For the force-DFT we prove here that the relevant bulk pressure is that of the virial route. The ability to access these two routes for inhomogeneous systems offers both the possibility of new insight into the formal structure of DFT and a useful tool for constructing approximate functionals.

Let us focus now on the virial contact theorem. The force-DFT is generated by the YBG equation . We begin by spatially integrating it over the system volume $V$ to obtain $$\begin{aligned}
 &- \int d{{\mathbf r}}_1 \, \rho({{\mathbf r}}_1) \nabla_{{{\mathbf r}}_1} \beta V_\text{ext}({{\mathbf r}}_1) \label{eq:ybg} \\
&\quad= \int d{{\mathbf r}}_1 \,  \nabla_{{{\mathbf r}}_1} \rho({{\mathbf r}}_1) + \int d{{\mathbf r}}_1 \int d{{\mathbf r}}_2 \, {\rho^{(2)}}({{\mathbf r}}_1,{{\mathbf r}}_2) \nabla_{{{\mathbf r}}_1} \beta \phi_{12}. \nonumber\end{aligned}$$ Exploiting the planar symmetry imposed by the hard-wall allows to simplify the density, $\rho({{\mathbf r}}_1)\!=\!\rho(z_1)$, the external potential $V_\text{ext}({{\mathbf r}}_1) \!=\! V_\text{ext}(z_1)$ and the spatial derivative $\nabla_{{{\mathbf r}}_1} \!=\! {\mathbf}{e}_z \, d/dz_1 $, where ${\mathbf}{e}_z$ is the unit vector normal to the wall and pointing away from it (see Figure \[sketch\_geometry\] for illustration). The ideal contribution, i.e. the first term on the right-hand side of equation , can then be rewritten as $$\begin{aligned}
 \int d{{\mathbf r}}_1 \, \nabla_{{{\mathbf r}}_1} \rho({{\mathbf r}}_1)  =  A\!\! \int_{-\infty}^\infty d z_1 \, \frac{d \rho(z_1)}{d z_1} {\mathbf}{e}_z =   A \rho_{\text{b}} {\mathbf}{e}_z, \label{eq:id}\end{aligned}$$ where $A \!=\! \int dx \int dy$ indicates the area of the hard-wall. In the second equality of we used that the density reaches a bulk value for large values of $z_1$, $ \rho(z_1 \!\to\! \infty)\!=\!\rho_{\text{b}}$, and vanishes inside the hard-wall, $\rho(z_1 \!\to\! - \infty)\!=\!0$. The external contribution, i.e. the left-hand side of equation , becomes $$\begin{aligned}
- \!\! \int \!\!d{{\mathbf r}}_1 \, \rho({{\mathbf r}}_1) \nabla_{{{\mathbf r}}_1} \beta V_\text{ext}({{\mathbf r}}_1)&\!=\! 
-A\!\!\int_{-\infty}^\infty \!\!\!\!d z_1 \, \rho(z_1) \frac{d \beta V_\text{ext}(z_1)}{d z_1} {\mathbf}{e}_z 
\notag\\ 
&= A \rho_{\text{w}}\, {\mathbf}{e}_z. \label{eq:ext}\end{aligned}$$ In deriving equation we used that the derivative of the hard-wall external potential yields a (negative) delta distribution at the wall. To obtain this result it is useful to rewrite the density as $\rho(z_1)\!=\!n(z_1) \exp(-\beta V_\text{ext}(z_1))$, where $n(z_1)$ is a continuous function of $z_1$. The second term on the right-hand side of arises from the internal interparticle interactions and it is related to the global internal force, ${\mathbf}{F}_\text{int}^\text{\,o}$. Noether's theorem @hermann2021noether states that the global internal force vanishes in a closed system. As the semi-infinite system with a planar hard-wall is open, one has to take boundary contributions into account @hermann2021noether. The boundary terms corresponding to the $x$- and $y$-axis cancel due to the planar symmetry. The wall contribution, $z_1\!\to\! -\infty$, vanishes as there are no particles inside the hard-wall. (We refer the reader to Figure \[sketch\_geometry\] to help visualize the situation for the following analysis.)

The remaining bulk boundary term, $z_1\!\to\!\infty$, can be treated by considering the force contributions between a particle inside a chosen integration volume and a particle outside of it. The force contributions where both particles are within the integration volume vanish for pair potential-type interparticle interactions, due to Newton's third law (*actio equals reactio*). We choose the volume to be bounded from the right (positive values of $z$) by a virtual-plane parallel to the hard-wall and deep inside the bulk phase. Therefore and because of the assumed finite interparticle interaction range the integrand and thus the two-body density, ${\rho^{(2)}}({{\mathbf r}}_1,{{\mathbf r}}_2)$, reduces to its bulk expression, ${\rho^{(2)}}_{\text{b}}(|{{\mathbf r}}_1-{{\mathbf r}}_2|)$, at locations beyond this virtual separation plane. These considerations yield the following simplifications of the global internal force $$\begin{aligned}
- \beta {\mathbf}{F}_\text{int}^{\text{\,o}} &= \int d{{\mathbf r}}_1 \int d {{\mathbf r}}_2 \; {\rho^{(2)}}({{\mathbf r}}_1,{{\mathbf r}}_2) \nabla_{{{\mathbf r}}_1} \beta \phi_{12}  
\notag\\
&= \int_\text{I} d {{\mathbf r}}_1 \int_\text{II} d{{\mathbf r}}_2 \; {\rho^{(2)}}_{\text{b}}(r_{12}) \nabla_{{{\mathbf r}}_1} \beta \phi_{12} 
\notag\\
&= \rho_{\text{b}}^2\int_\text{I} d {{\mathbf r}}_1 \int_\text{II} d {{\mathbf r}}_2 \; g(r_{12}) \frac{d \beta \phi_{12}}{d r_{12}} \cos\theta {\mathbf}{e}_z, 
\label{eq:int}\end{aligned}$$ where $r_{12}\!=\!|{{\mathbf r}}_1-{{\mathbf r}}_2|$. The subscript I on the integral denotes the integration volume with $z$-coordinate reaching from minus infinity to the volume boundary and II indicates the outside region at large $z$-values. To obtain the last relation in equation we use the identity ${\rho^{(2)}}_{\text{b}}(r_{12}) \!=\! \rho_{\text{b}}^2 \, g(r_{12})$, where $g$ is the pair correlation function. The interparticle interaction force simplifies to $\nabla_{{{\mathbf r}}_1} \phi(|{{\mathbf r}}_1-{{\mathbf r}}_2|)  \!=\! {\mathbf}{e}_z\cos(\theta)  d \phi(r_{12})/ d r_{12}$ due to the planar symmetry, where $\theta$ indicates the angle between the $z$-axis and the difference vector ${{\mathbf r}}_1-{{\mathbf r}}_2$.

\[t\]<span>0.4</span>

(wall upper pt) at (-3,4.2); (wall lower pt) at (-3,-1.2); (wall size) at (-1,5.395); (ez) at (-2.5,-0.5); (z) at (0.6,1.5); (rsph) at (1.4,2.175); (I) at (0.5,-1.2); (II) at (1.5,-1.2); (dashed wall upper pt) at (1,4.2); (dashed wall lower pt) at (1,-1.2); (dashed wall upper cross) at (1,3.55); (dashed wall lower cross) at (1,1.5); (arc cross) at (2.28,1.5); (origine arc) at (0,-0.785); (origine arc) arc (-90:90:2.285); (2.05,2.5) circle (8pt); (particle 1) at (0,1.5) <span>1</span>; (particle 2) at (2.05,2.5) <span>2</span>; (ez) node\[above\] <span>${{\bf e}}_{z}$</span>; (z) node\[below\] <span>$\tilde{z}$</span>; (rsph) node\[above\] <span>$r_{12}$</span>; (I) node\[above\] <span>I</span>; (II) node\[above\] <span>II</span>; (particle 1) – (particle 2); (-3,-0.5) – (-2,-0.5); (particle 1) – (dashed wall upper cross); (particle 1) – (dashed wall lower cross); (dashed wall lower cross) – (arc cross); (dashed wall upper pt) – (dashed wall lower pt); (wall lower pt) – (wall upper pt); (wall lower pt) rectangle ++(wall size); ;

We employ two different coordinate systems for each of the integration regions. For region I we use Cartesian coordinates, where $\tilde{z}$ measures the distance to the volume boundary. The integral over region II involves only the relative coordinate between the inside and outside regions. We express this integral in spherical coordinates, where the polar angle $\theta$ varies only between $0$ and $\tilde{\theta}\!=\!\arccos(\tilde{z}/r_{12})$ to ensure that the second coordinate remains within region II. The $z$-component of equation is given by $$\begin{aligned}
&2 \pi A \rho_{\text{b}}^{2} \int_0^\infty \!\!\!dr_{12} \;  r_{12}^2 \,g(r_{12}) \frac{d \phi(r_{12})}{d r_{12}} \!
\int_0^{r_{12}} \!\!\!d\tilde{z}\! \int_{0}^{\tilde{\theta}}\!\!\! d \theta \, \sin\theta \cos\theta 
\notag\\
&= 2 \pi A \rho_{\text{b}}^2 \int_0^\infty \!\!\!d r_{12} \;  r_{12}^2 \,g(r_{12}) \frac{d \phi(r_{12})}{d r_{12}} \!\int_0^{r_{12}} \!\!\!d\tilde{z} \; \frac{1}{2}\left(1-\frac{\tilde{z}^2}{r_{12}^2} \right)  
\notag\\
&= \frac{2\pi}{3} A \rho_{\text{b}}^2 \int_0^\infty \!\!\!d r_{12} \; r_{12}^3 \,g(r_{12}) \frac{d \phi(r_{12})}{d r_{12}} . \label{eq:z}\end{aligned}$$ Inserting equations , and into the $z$-component of equation gives $$\begin{aligned}
\label{P virial}
\rho_{\text{w}}  &=  \rho_{\text{b}} - \frac{2 \pi}{3} \rho_{\text{b}}^2 \int_0^\infty d r_{12} \;  r_{12}^3 \,g(r_{12}) \frac{d \beta \phi(r_{12})}{d r_{12}} \notag\\
&= \beta P_{\text{id}} + \beta P_{\, \text{exc}}^{\, \text{v}} 
\quad= \beta P^{\, \text{v}},\end{aligned}$$ where we have identified the standard expression @hansen2013 for the virial pressure $P^{\rm v}$. We have thus proven the contact theorem relevant to the force-DFT, namely, that if one uses force-DFT to calculate the density profile at a hard-wall, then the contact density will correspond to the reduced virial pressure, $\beta P^{\, \text{v}}$. Note that the derivation of the corresponding contact theorem in two dimensions can be done similarly.

Compressibility contact theorem {#compressibility_contact}
-------------------------------

The virial contact theorem derived above follows naturally from the forces acting within the system. In contrast the compressibility contact theorem, based on the one-body direct correlation function, is more formal and requires therefore more involved manipulations of the fundamental equations to arrive at the desired result. Although the contact theorem is a result frequently cited in the literature, there is to our knowledge no calculation which shows explicitly that the wall contact density from potential-DFT is given by the reduced pressure from the *compressibility* route. Since potential-DFT is generated by the EL equation , our proof begins by taking its gradient, which yields $$\begin{gathered}
\label{comp_contact_thm_eq1}
\nabla_{{{\mathbf r}}_1} \rho({{\mathbf r}}_1) + \rho({{\mathbf r}}_1) \nabla_{{{\mathbf r}}_1} \beta V_{\text{ext}}({{\mathbf r}}_1) \\
-  \rho({{\mathbf r}}_1) \nabla_{{{\mathbf r}}_1} c^{(1)}_{\text{p}}({{\mathbf r}}_1) = 0.\end{gathered}$$ The following simple identity from the product rule of differentiation $$\begin{gathered}
\nabla_{{{\mathbf r}}_1} \left(\rho({{\mathbf r}}_1) c^{(1)}_{\text{p}}({{\mathbf r}}_1)\right) \\
= c^{(1)}_{\text{p}}({{\mathbf r}}_1) \nabla_{{{\mathbf r}}_1}\rho({{\mathbf r}}_1) + \rho({{\mathbf r}}_1) \nabla_{{{\mathbf r}}_1} c^{(1)}_{\text{p}}({{\mathbf r}}_1), \end{gathered}$$ allows us then to rewrite in the following alternative form $$\begin{gathered}
\label{comp_contact_thm_eq2}
\nabla_{{{\mathbf r}}_1} \rho({{\mathbf r}}_1) + \rho({{\mathbf r}}_1) \nabla_{{{\mathbf r}}_1} \beta V_{\text{ext}}({{\mathbf r}}_1) \\
-  \nabla_{{{\mathbf r}}_1} \left(\rho({{\mathbf r}}_1) c^{(1)}_{\text{p}}({{\mathbf r}}_1)\right) + c^{(1)}_{\text{p}}({{\mathbf r}}_1) \nabla_{{{\mathbf r}}_1}\rho({{\mathbf r}}_1) = 0.\end{gathered}$$ Equation involves only the one-body direct correlation function, $c^{(1)}_{\text{p}}$, defined in its standard form by equation . However, the bulk compressibility pressure is typically expressed in terms of the two-body direct correlation function, $c^{(2)}$. Therefore, we seek to re-express $\rho({{\mathbf r}}_1) c^{(1)}_{\text{p}}({{\mathbf r}}_1)$ using the method of 'functional line integration' @line_integration. By re-integrating the functional derivative of $\rho({{\mathbf r}}_1)c^{(1)}_{\text{p}}({{\mathbf r}}_1)$ with respect to the density we obtain the formal result $$\begin{gathered}
\rho({{\mathbf r}}_1) c^{(1)}_{\text{p}}({{\mathbf r}}_1) \\
= \int d{{\mathbf r}}_2 \int_{0}^{\rho({{\mathbf r}}_2)} d\rho'({{\mathbf r}}_2) \left.\frac{\delta \Big(\rho({{\mathbf r}}_1) c^{(1)}_{\text{p}}({{\mathbf r}}_1)\Big)}{\delta \rho({{\mathbf r}}_2)}\right|_{\rho({{\mathbf r}}_2)=\rho'({{\mathbf r}}_2)},
\notag\end{gathered}$$ where at each spatial point ${{\mathbf r}}_2$ we integrate from an empty system (zero density) up to the density of interest, $\rho({{\mathbf r}}_2)$. Evaluation of the functional derivative then yields $$\begin{aligned}
\begin{split}
\rho({{\mathbf r}}_1) c^{(1)}_{\text{p}}({{\mathbf r}}_1) \!&=\!\! \begin{aligned}[t] \int d{{\mathbf r}}_2 \int_{0}^{\rho({{\mathbf r}}_2)} \!\! d\rho'({{\mathbf r}}_2) \Big( 
\rho'({{\mathbf r}}_1) c^{(2)}({{\mathbf r}}_1, {{\mathbf r}}_2 ; [\rho'])
\Big. \\ \Big.
 + \delta({{\mathbf r}}_1-{{\mathbf r}}_2) c^{(1)}_{\text{p}}({{\mathbf r}}_1; [\rho'])  \Big)  \end{aligned} \notag \\
&=\!\!
\begin{aligned}[t]
\int d{{\mathbf r}}_2 \int_{0}^{\rho({{\mathbf r}}_2)} \!\! d\rho'({{\mathbf r}}_2) \rho'({{\mathbf r}}_1) c^{(2)}({{\mathbf r}}_1, {{\mathbf r}}_2 ; [\rho']) \\
+ \int_{0}^{\rho({{\mathbf r}}_1)} \!\! d\rho'({{\mathbf r}}_1) c^{(1)}_{\text{p}}({{\mathbf r}}_1; [\rho']). 
\end{aligned}
\end{split}\end{aligned}$$ This result can be substituted into to give $$\begin{aligned}
\label{comp_contact_thm_eq3}
0 &= \nabla_{{{\mathbf r}}_1} \rho({{\mathbf r}}_1) \;+\; \rho({{\mathbf r}}_1) \nabla_{{{\mathbf r}}_1} \beta V_{\text{ext}}({{\mathbf r}}_1) \;+\; c^{(1)}_{\text{p}}({{\mathbf r}}_1) \nabla_{{{\mathbf r}}_1}\rho({{\mathbf r}}_1) \notag\\
& \quad -  \int d{{\mathbf r}}_2 \int_{0}^{\rho({{\mathbf r}}_2)} d\rho'({{\mathbf r}}_2) \nabla_{{{\mathbf r}}_1} \Big(\rho'({{\mathbf r}}_1) c^{(2)}({{\mathbf r}}_1, {{\mathbf r}}_2 ; [\rho'])\Big) \notag\\
& \quad -  \nabla_{{{\mathbf r}}_1} \int_{0}^{\rho({{\mathbf r}}_1)} d\rho'({{\mathbf r}}_1) c^{(1)}_{\text{p}}({{\mathbf r}}_1; [\rho']).\end{aligned}$$ We henceforth specialize to external fields which impose a planar geometry, such that the density profile and the two-body correlation functions exhibit cylindrical symmetry. As pointed out above, for the case of a planar hard-wall located at $z\!=\!0$ the density only varies in the $z$-direction, $\rho({{\mathbf r}})\!=\!\rho(z)$. Equation can then be integrated to yield $$\begin{gathered}
\label{comp_contact_thm_eq4}
\rho_{\text{b}} - \rho_{\text w} =\\
 \overbrace{ \int d{{\mathbf r}}_2 \int_{0}^{\rho(z_2)} d\rho'(z_2) \rho'_{\text{b}} c^{(2)}(z_1\!=\!\infty, z_2, r_2; [\rho'])}^{\text{A}} 
\\
+\underbrace{ \int_{0}^{\rho_{\text{b}}} d\rho'_{\text{b}} c^{(1)}_{\text{p}, \text{b}}(\rho'_{\text{b}})}_{\text{B}} - \underbrace{\int_{-\infty}^{\infty} dz_1 c^{(1)}_{\text{p}}(z_1) \frac{d}{dz_1}\rho(z_1)}_{\text{C}},\end{gathered}$$ where we have used $ \rho(z_1 \!\to\! \infty)\!=\!\rho_{\text{b}}$ and $\rho(z_1 \!\to\! - \infty)\!=\!0$, as in equation . To connect this expression with the bulk compressibility pressure we analyze each of the three terms labelled A, B and C in equation separately.

: Having $z_1\!\rightarrow\!\infty$ as an argument of the two-body correlation function $c^{(2)}$ (which is of finite range) has the consequence that only bulk values contribute to the integral over the coordinate labelled $2$, thus $$\begin{aligned}
\quad \text{Term A} &=  \int_{0}^{\rho_{\text{b}}} d\rho'_{\text{b}} \, \rho'_{\text{b}} \int d{{\mathbf r}}_{12} \, c^{(2)}_{\text{b}}(r_{12}; [\rho'_{\text{b}}]) \\
&=  \int_{0}^{\rho_{\text{b}}} d\rho'_{\text{b}} \, \rho'_{\text{b}} \tilde{c}^{(2)}_{\text{b}}(q\!=\!0; \rho'_{\text{b}}) \\
&= - \beta P_{\, \text{exc}}^{\, \text{c}},\end{aligned}$$ where $\tilde{c}^{(2)}_{\text{b}}(q\!=\!0)$ is the Fourier transform of the two-body direct correlation function in the zero wavevector limit. The second equality gives the well-known integral giving the excess (over ideal) pressure in the compressibility route, $P_{\text{exc}}^{\,\text{c}}$, see Reference @luchko.

: This term does not require further manipulation and it can be given a clear physical interpretation. By identifying the bulk one-body direct correlation function, $c^{(1)}_{\text{p}, \text{b}}$, with the excess reduced chemical potential, $\mu_{\text{exc}}$, it follows that $$\begin{aligned}
 \int_{0}^{\rho_{\text{b}}} d\rho'_{\text{b}} c^{(1)}_{\text{p}, \text{b}}(\rho'_{\text{b}}) &= -\int_{0}^{\rho_{\text{b}}} d\rho'_{\text{b}}\, \beta \mu_{\text{exc}}(\rho'_{\text{b}}) \\
&= - \int_{0}^{\rho_{\text{b}}} d\rho'_{\text{b}} \,\beta \frac{\partial f_{\text{exc}}}{\partial \rho'_{\text{b}}} \\
&= - \beta f_{\text{exc}}(\rho_{\text{b}}),\end{aligned}$$ where $f_{\text{exc}}\!=\!F_{\text{exc}}/V$ is the bulk excess Helmholtz free energy per unit volume.

: Using that $c^{(1)}_{\text{p}}$ evaluated at a bulk density becomes position independent, $$\begin{aligned}
- \int_{-\infty}^{\infty} dz_1  \frac{d \rho(z_1)}{dz_1} c^{(1)}_{\text{p}}(z_1) &= - \int_{0}^{\rho_{\text{b}}} d\rho'_{\text{b}} c^{(1)}_{\text{p}}(z_1; [\rho'_{\text{b}}]) \\
&= - \int_{0}^{\rho_{\text{b}}} d\rho'_{\text{b}} c^{(1)}_{\text{p},\text{b}}(\rho'_{\text{b}}) \\
&= \quad \,\, \text{Term B}.\end{aligned}$$

Terms B and C cancel out and we finally get $$\begin{aligned}
\label{P compressibility}
\rho_{\text w} &= \rho_{\text{b}} - \int_{0}^{\rho_{\text{b}}} d\rho'_{\text{b}} \, \rho'_{\text{b}} \tilde{c}^{(2)}_{\text{b}}(q\!=\!0; \rho'_{\text{b}}) 
\notag\\
&= \beta P_{\text{id}} + \beta P_{\, \text{exc}}^{\, \text{c}} 
\quad= \beta P^{\, \text{c}}.\end{aligned}$$ We have thus proven the contact theorem for the compressibility route, namely, that if one uses equation to calculate the density profile at a hard-wall, then the contact density will correspond to the reduced compressibility pressure, $\beta P^{\, \text{c}}$.

So far all our definitions and analytical considerations were not constrained to any specific system. However, at this point, in order to implement these general frameworks and show numerical results, we will focus on a particular simple model.

Hard-sphere FMT {#HS-FMT}
---------------

We now specialize to the minimal fluid model, which we take to be hard-spheres of radius $R$ in three dimensions. The force-DFT approach is in no way restricted to this particular system. Hard-spheres simply provide a convenient test-case for which FMT gives an accurate approximation to the excess Helmholtz free energy functional, $$\begin{aligned}
\label{ros_fe}
\beta F_{\text{exc}}[\,\rho\,] = \int d{{\mathbf r}}_1 \; \Phi \left( \left\lbrace n_{\alpha}({{\mathbf r}}_1) \right\rbrace  \right).\end{aligned}$$ The original Rosenfeld formulation of FMT @rosenfeld89 employs the following reduced excess free energy density $$\Phi = - n_0 \ln(1-n_3) + \frac{n_1 n_2 - {\bf n}_1 \cdot {\bf n}_2}{1-n_3} + \frac{n_2^3 
- 3 n_2 {\bf n}_2 \cdot {\bf n}_2}{24 \pi (1-n_3)^2}.$$ The weighted densities are generated by convolution $$\label{n_alpha_ros_fe}
n_{\alpha}({{\mathbf r}}_1) = \int d{{\mathbf r}}_2 \; \rho({{\mathbf r}}_2)\, \omega_{\alpha}({{\mathbf r}}_1-{{\mathbf r}}_2),$$ where the weight functions, $\omega_{\alpha}$, are characteristic of the geometry of the spheres. Of the six weight functions, four are scalars $$\begin{aligned}
\omega_3({{\mathbf r}})&=\Theta(R-r), \hspace*{0.5cm}
\omega_2({{\mathbf r}})=\delta(R-r), \notag\\
\omega_1({{\mathbf r}})&=\frac{\delta(R-r)}{4\pi R}, \hspace*{0.51cm}
\omega_0({{\mathbf r}})=\frac{\delta(R-r)}{4\pi R^2}, \notag\end{aligned}$$ and two are vectors (indicated by bold indices) $$\begin{aligned}
\omega_{\bold 2}({{\mathbf r}})&={{\mathbf}{e}}_{{{\mathbf r}}}\,\delta(R-r),\hspace*{0.5cm}
\omega_{\bold 1}({{\mathbf r}})={{\mathbf}{e}}_{{{\mathbf r}}}\frac{\delta(R-r)}{4\pi R},
\notag\end{aligned}$$ where ${{\mathbf}{e}}_{{{\mathbf r}}}={{\mathbf r}}/r$ is a unit vector.

Applying the definition for $c_{\text{p}}^{(1)}$ to the free energy generates the following approximate form for the one-body direct correlation function $$\begin{aligned}
\label{c_onebody}
c^{(1)}_{\text{p}}({{\mathbf r}}_1)=-\sum_{\alpha}\int d{{\mathbf r}}_2\, 
\Phi'_{\alpha}({{\mathbf r}}_2)\,\omega_{\alpha}({{\mathbf r}}_{21}),\end{aligned}$$ where the summation runs over all scalar and vector indices, $\Phi'_{\alpha}\!=\!\partial \Phi/\partial n_{\alpha}$, and ${{\mathbf r}}_{21}={{\mathbf r}}_2-{{\mathbf r}}_1$. The function $\Phi'_{\alpha}$ is a vector quantity when $\alpha$ takes the value ${\bold 1}$ or ${\bold 2}$, in which case a scalar product with the corresponding vectorial weight function is implied in equation , otherwise it is a scalar function.

Taking two functional derivatives of the free energy generates the following expression for the two-body direct correlation function $$\begin{aligned}
c^{(2)}({{\mathbf r}}_1, {{\mathbf r}}_2)
&=-\!\sum_{\alpha\beta}\int \!d{{\mathbf r}}_3\, 
\omega_{\alpha}({{\mathbf r}}_{31})\,
\Phi''_{\alpha \beta}({{\mathbf r}}_3)\,
\omega_{\beta}({{\mathbf r}}_{32}),
\label{c_ros_fe}\end{aligned}$$ where $\Phi''_{\alpha \beta}\!=\!\partial^2 \Phi/\partial n_{\alpha} \partial n_{\beta}$. For detailed descriptions of how to implement equation in planar and spherical geometries we refer the reader to Reference @tschopp2021.

The inhomogeneous OZ equation $$\begin{aligned}
\label{oz}
h^{}({{\mathbf r}}_1,{{\mathbf r}}_2) = c^{(2)}({{\mathbf r}}_1,{{\mathbf r}}_2) \!+\! 
\int\! d{{\mathbf r}}_3\, h^{}({{\mathbf r}}_1,{{\mathbf r}}_3)\rho({{\mathbf r}}_3) c^{(2)}({{\mathbf r}}_3,{{\mathbf r}}_2),\end{aligned}$$ connects the two-body direct correlation function, $c^{(2)}$, with the total correlation function, $h$. The latter is related to the two-body density according to $$\label{rhotwo_h}
\rho^{(2)}({{\mathbf r}}_1, {{\mathbf r}}_2) = \rho({{\mathbf r}}_1) \rho({{\mathbf r}}_2) \bigg(h({{\mathbf r}}_1, {{\mathbf r}}_2) +1\bigg).$$ Substitution of equation into the inhomogeneous OZ equation yields a linear integral equation which can be solved for $h$, given the one-body density as input. The two-body density defined by equation is thus a known functional of the one-body density, as required for implementation of the force-DFT.

Numerical evaluation of the right-hand side of equation followed by iterative solution of the inhomogeneous OZ equation is a demanding, yet well-defined and ultimately manageable, task. For researchers familiar with standard potential-DFT implementations (which operate purely on the one-body level) working with two-body numerics represents a significant step. However, having explicit access to the two-body correlations provides a much deeper insight into the particle microstructure and this benefit thus outweighs the increased computational complexity.

Implementation in planar geometry {#implementation}
---------------------------------

Now that we have specified the model of interest (hard-spheres) we choose to henceforth restrict our attention to planar geometry, for which the two-body correlation functions can be expressed using the cylindrical coordinates, $z_1$, $z_2$ and $r_2$ (see References @tschopp2020 [@tschopp2021]). Although neither the potential- nor the force-DFT are limited to any particular geometry, our choice to focus on the planar case enables us to make connection to the contact sum-rules proven analytically in subsections \[virial\_contact\] and \[compressibility\_contact\].

In order to implement force-DFT, as expressed by the central equation , we begin by integrating equation to obtain the function $c_{\text{f}}^{(1)}$. This yields $$\begin{gathered}
c^{(1)}_{\text f}(z) - c^{(1)}_{\text f}(0) \\
= \int_0^z dz_1 \frac{2\pi}{\rho(z_1)} \int_{-\infty}^{\infty} dz_2 (z_1-z_2) {\rho^{(2)}}(z_1,z_2,r_2^{*}),\end{gathered}$$ with $r_2^{*} \!\equiv\! \sqrt{1-(z_1-z_2)^2}$ and where the particle diameter has been set to unity. Both the factor $(z_1\!-\!z_2)$ and the argument $r_2^*$ appearing in the two-body density are consequences of the gradient of the hard-sphere potential in equation . The integration constant $c^{(1)}_{\text f}(0)$ is unknown, but it does not have to be determined in order to calculate the density profile. Defining a new parameter $\alpha \!\equiv\! \beta \mu + c_{\text f}^{(1)}(0)$, we obtain the following expression $$\begin{aligned}
\label{alpha_route_eq1}
\rho(z) &= {\rm e}^{\beta \left(\mu - V_{\text{ext}}(z)\right) + c^{(1)}_{\text f}(z)} \\
&= {\rm e}^{\alpha} {\rm e}^{-\beta V_{\text{ext}}(z) + \int_0^z dz_1 \frac{2\pi}{\rho(z_1)} \int_{-\infty}^{\infty} dz_2 (z_1-z_2) {\rho^{(2)}}(z_1,z_2,r_2^{*})}. \notag\end{aligned}$$ If we choose the average number of particles $\langle N \rangle\!=\!\int_{-\infty}^{\infty} dz \,\rho(z)$ to be conserved then the corresponding value of $\alpha$ can be determined from $$\label{alpha_route_eq2}
{\rm e}^{\alpha} \!=\! \frac{\langle N \rangle}{\int_{-\infty}^{\infty} \!\! dz \, {\rm e}^{-\beta V_{\text{ext}}(z) + 2\pi \! \int_0^z dz_1 \! \int_{-\infty}^{\infty} \! dz_2 \, (z_1-z_2) \frac{{\rho^{(2)}}(z_1,z_2,r_2^{*})}{\rho(z_1)}}},$$ which circumvents the need to prescribe $c_{\text f}^{(1)}(0)$ and $\mu$ independently. Given a method to calculate the two-body density from a given one-body profile, equations and provide a closed system for numerical determination of the equilibrium density profile. This is possible since the two-body direct correlation function, $c^{(2)}$, is given as a functional of the one-body density in equation . The connection between $c^{(2)}$ and ${\rho^{(2)}}$ is given by combining the inhomogeneous OZ equation with the definition . The three-dimensional integral appearing in can be reduced to a manageable one-dimensional integral using the method of Hankel transforms, as described in detail in Reference @tschopp2021. The Hankel transform of the OZ equation is given by $$\begin{aligned}
\label{oz_planar}
\overline{h}(z_1,z_2,k) &= \overline{c}^{\,(2)}(z_1,z_2,k) 
\\
&+ \int_{-\infty}^{\infty} \!dz_3 \;  
\overline{h}(z_1,z_3,k)\,\rho(z_3)\,\overline{c}^{\,(2)}(z_3,z_2,k), 
\notag\end{aligned}$$ where an overbar indicates a Hankel transformed quantity. In Reference @tschopp2021 a convenient analytical expression is given for the Rosenfeld form of $\overline{c}^{\,(2)}$.

On the other hand, the implementation of potential-DFT to obtain the density profile in planar geometry is a standard procedure in FMT studies. The EL equation in planar geometry reads $$\label{EL_planar}
\rho(z) = {\rm e}^{\beta \left(\mu - V_{\text{ext}}(z)\right) + c^{(1)}_{\text p}(z)},$$ where $c^{(1)}_{\text p}(z)$ is given by the planar version of equation (see Reference @tschopp2021).

Numerical results for hard-spheres at a hard-wall {#hardwall_numerics}
-------------------------------------------------

To calculate the density profile from force-DFT, we need to choose as input a value for the average number of particles, $\langle N\rangle$. In contrast, the potential-DFT takes as input the reduced chemical potential, $\beta \mu$. To enable comparison of the results from the two different approaches, we first calculate the potential-DFT density profiles for a given value of the reduced chemical potential and then calculate the average number of particles in the system by spatial integration. This value is then used as input in the force-DFT calculation. The quantities of relevance for testing the wall contact theorem are the bulk density (taken as $\rho_{\text{b}}\approx\rho(z\!\to\!\infty)$) and the density at the wall, $\rho_{\text w}$. As we employ the Rosenfeld functional, the compressibility and virial pressures are identical to those of the well-known Percus-Yevick (PY) integral equation theory @hansen2013, which are given by $$\begin{aligned}
\frac{\beta P^{\,\text{c}}}{\rho_{\text{b}}} &= \frac{1+\eta+\eta^2}{(1-\eta)^3}, 
\notag\\
\frac{\beta P^{\,\text{v}}}{\rho_{\text{b}}} &= \frac{1+2\eta+3\eta^2}{(1-\eta)^2},
\label{pressure}\end{aligned}$$ where $\eta\!=\!\frac{4\pi}{3}\rho_{\text{b}} R^3$ is the packing fraction.

In Figure \[slit\_fig\], we show three sets of representative density profiles and the contact density as a function of $\rho_{\text{b}}$ compared with the expected pressure. In the top left panel the reduced chemical potential is rather low, $\beta\mu\!=\!3$, and the resulting potential- and force-DFT density profiles are very similar. Zooming to inspect the contact value highlights the difference between the two profiles and shows that our numerical data are highly consistent with the expected analytical pressures (indicated by the horizontal dotted lines, red for the compressibility route and green for the virial route). The bottom left panel is for $\beta\mu\!=\!5$ and, although some slight differences begin to emerge in the oscillations of the two density profiles, the contact values remain in excellent agreement with the respective analytical predictions. The bottom right panel is for $\beta\mu\!=\!7$ and shows more significant deviation of the density oscillations, but the contact densities still remain consistent with equations . We find that both the oscillation amplitude and contact density from force-DFT are lower than those of the potential-DFT.

We have performed similar calculations for a wider set of reduced chemical potentials. The upper right panel of Figure \[slit\_fig\] shows the resulting contact densities as a function of $\rho_{\text{b}}$. This discrete set of points are shown together with the analytical curves from equations , exhibiting an excellent level of agreement for a broad range of bulk densities. From our numerical results it is clear that the force-DFT does correspond to the virial route. This demonstrates that we have constructed a method by which DFT calculations can be reliably performed within the 'virial realm' instead of the 'compressibility realm', which seemed to be the only one accessible before.

Dynamical theory {#dynamics}
================

Force-DDFT {#forceDDFT}
----------

The tools we have developed can be readily extended to explore the dynamics of the one-body density out-of-equilibrium. In the following we consider systems subject to overdamped Brownian dynamics.

The dynamics of the $N$-body distribution function is dictated by the Smoluchowski equation @archer_evans. Integration over $N\!-\!1$ position coordinates generates the exact equation of motion for the one-body density $$\label{continuity}
\frac{\partial \rho({\mathbf}{r}_1,t)}{\partial t} = - \nabla_{{\mathbf}{r}_1} \cdot {\mathbf}{j}({\mathbf}{r}_1,t),$$ where the current is given by $$\begin{gathered}
\label{exact_current}
{\mathbf}{j}({\mathbf}{r}_1,t) = -D_0 \, \rho({\mathbf}{r}_1,t) \Bigg( \nabla_{{\mathbf}{r}_1} \ln(\rho({\mathbf}{r}_1,t))
+ \nabla_{{\mathbf}{r}_1} \beta V_{\text{ext}}({\mathbf}{r}_1) \\
+ \int d {\mathbf}{r}_2 \, \frac{\rho^{(2)}({\mathbf}{r}_1,{\mathbf}{r}_2,t)}{\rho({\mathbf}{r}_1,t)} \nabla_{{\mathbf}{r}_1} \beta \phi_{12} \Bigg),\end{gathered}$$ where $D_0$ is the diffusion coefficient. The interparticle force, $-\nabla_{{\mathbf}{r}_1} \beta \phi_{12}$, appears explicitly in the integral term. Equations and form the basis of the force-DDFT. Calculation of the current requires the exact time-dependent two-body density, ${\rho^{(2)}}$, as an input quantity, which is not available for any interacting model of real interest. A workable approximation can be obtained by making the assumption that ${\rho^{(2)}}$ is instantaneously equilibrated to the nonequilibrium density. This adiabatic approximation enables one to employ the two-body correlations calculated using the inhomogeneous OZ equation (which is an equilibrium relation) to obtain the average interaction force at each time-step. Note that in equilibrium the current vanishes. Since the density is nonzero, the sum of the three terms in parentheses in equation must also vanish and we recover the YBG equation . The time-dependent density of force-DDFT thus relaxes to the density profile of force-DFT in the long-time limit.

As for the equilibrium case, we only consider hard-spheres subject to external fields of planar geometry. The gradient inside the integral term of equation must therefore be treated carefully to correctly capture the discontinuous hard-sphere interaction potential. Fortunately, for planar geometry the integral can be conveniently reduced to one-dimension and equations and can be combined and rewritten as $$\begin{gathered}
\label{ddft2 planar}
\frac{1}{D_0} \, \frac{\partial \rho(z_1,t)}{\partial t} = \frac{\partial}{\partial z_1}  \Bigg( \frac{\partial \rho(z_1,t)}{\partial z_1}
+  \rho(z_1,t) \frac{\partial \beta V_{\text{ext}}(z_1)}{\partial z_1} \\
- 2\pi \int_{-\infty}^{\infty} dz_2 \, (z_1-z_2)\, \rho^{(2)}(z_1,z_2,r_2^{*},t) \Bigg),\end{gathered}$$ where $r_2^{*}\!=\!\sqrt{1-(z_1-z_2)^2}$ for the particle diameter set to unity. This corresponds to evaluating the two-body density only on the contact shell where the interparticle forces act. The force-DDFT generates the dynamics of the density profile in the virial realm, which contrasts and complements the standard potential-DDFT, which we recall in the following.

Potential-DDFT {#potentialDDFT}
--------------

The current for potential-DDFT @archer_evans is given by $$\begin{gathered}
\label{approx_current}
\!\!\!\!{\mathbf}{j}({\mathbf}{r},t) \!=\! -D_0 \, \rho({\mathbf}{r},t)
\nabla_{{\mathbf}{r}}\Bigg( \ln(\rho({\mathbf}{r},t))
+ \beta V_{\text{ext}}({\mathbf}{r}) \\
-  c^{(1)}_{\text{p}}({\mathbf}{r},t) \Bigg). \end{gathered}$$ In the construction of the force-DDFT, in subsection \[forceDDFT\], we applied an adiabatic approximation to the two-body density, ${\rho^{(2)}}$, and thus to the entire average interaction force. This approach explicitly implements the idea of instantaneous equilibration of ${\rho^{(2)}}$ at each time-step. Here we exploit an equilibrium sum-rule (see Reference @archer_evans) to approximate the average interaction force using the gradient of the one-body direct correlation function, $c^{(1)}_{\text{p}}$, which results in equation . The consequence of making this approximation is that the potential-DDFT operates within the compressibility realm. The long-time limit of the density time-evolution then reduces to that of the potential-DFT. As already pointed out in the previous subsection, the current must reyessteven@example.org. In the present case this implies that the sum of terms in parentheses in must vanish, which recovers the (gradient of) the EL equation .

For the present case of planar geometry, combining equations and yields the following one-dimensional equation of motion $$\begin{gathered}
\label{ddft1 planar}
\frac{1}{D_0} \, \frac{\partial \rho(z,t)}{\partial t} = \frac{\partial}{\partial z} \Bigg( \frac{\partial \rho(z,t)}{\partial z} + \rho(z,t) \frac{\partial \beta V_{\text{ext}}(z)}{\partial z} \\
- \rho(z,t) \frac{\partial c^{(1)}_{\text{p}}(z,t)}{\partial z} \Bigg)\end{gathered}$$ for the density profile. This can be compared with the exact equation . Note that if we follow the adiabatic approximation scheme on the one-body density functional ${\rho^{(2)}}[\rho]$, then we get back equation but with $c^{(1)}_{\text{f}}$, defined by equation , instead of $c^{(1)}_{\text{p}}$.

Numerical results for hard-spheres in a harmonic-trap {#numericaltrap}
-----------------------------------------------------

In order to compare the predictions of force-DDFT with those of potential-DDFT we consider a simple benchmark test of the relaxational dynamics. The density is first equilibrated to a planar harmonic external potential, $\beta V_{\text{ext}}(z)\!=\!A(z-z_0)^2$, where we use the values $A\!=\!0.75$ and $z_0\!=\!5$ inside of a computational domain covering the range from $z\!=\!0$ to $z\!=\!10$. At time $t\!=\!0$ we instantaneously switch the harmonic-trap amplitude to the value $A\!=\!0.5$ and then use either equation or to calculate the relaxational time-evolution of the density towards the equilibrium state of the new trap. The time integration of equations and is performed using forward Euler integration, which amounts to approximating the partial time derivative according to the following finite difference expression $$\frac{\partial \rho(z,t)}{\partial t} \approx \frac{\rho(z,t+\Delta t)-\rho(z,t)}{\Delta t},$$ where $\Delta t$ is the time-step. In practice, the numerical realization of equilibrium as a long-time limit of the dynamics may be difficult to achieve due to the accumulation of discretization errors over many time-steps.

The left panels of Figure \[trap\_fig\] show the time-evolution of the density obtained from the potential-DDFT. In the upper panel we show only the left-half of the symmetric density profile and in the lower panel we show a zoom of the density peak. The black dashed curves indicate the equilibrium densities obtained from potential-DFT and can be compared with our grand-canonical Monte-Carlo simulation data @frenkel, given by the silver dotted lines. The simulation is equilibrated for $10^5$ sweeps and sampled for $10^7$ sweeps, the box size is $30\times30\times20$, where the unit of length is a hard-sphere diameter, and on average there are $2142$ particles in the system. The colored dashed lines show density profiles obtained from potential-DDFT for a selection of different times, which we give in units of particle diameter squared over diffusion coefficient, $D_0$. These results should be compared with those of the force-DFT and force-DDFT shown in the right panels of Figure \[trap\_fig\], where we used the same colors as before to identify curves at equal times. We clearly see that, in this case, the force-DDFT relaxes more slowly than potential-DDFT, which implies that the average (repulsive) interaction force is stronger in the latter approximation. A possible explanation for that phenomenon is that the hard-sphere system has a very harshly repulsive interparticle potential, which strongly influences the spatial distribution of the particles and which is captured more effectively in force-DDFT.

The implementation of potential-DDFT is rather quick and simple since it only involves one-body functions and requires only a single Picard update at each time-step. On the other hand the force-DDFT is way more demanding since it involves solving the OZ equation at every time-step and then also requires a Picard update of the density. Not only are the analytical expressions more complicated, but also the numerical computational work. The shown curves therefore took significantly more computational time to be obtained, but they can nevertheless be calculated to high accuracy.

Conclusions and outlook {#conclusions}
=======================

Starting from fundamental principles of Noether invariance, we have developed a force-based theory for the density profile both in- and out-of-equilibrium. The equilibrium theory shows that density profiles can be calculated via the virial route by following our explicit force-DFT scheme. This situation can be contrasted with the standard potential-DFT that is known to follow the compressibility route. Although the latter is a well-used result and often a crucial test in a significant number of DFT studies, to the best of our knowledge we have here provided the first mathematical proof that explicitly shows that the planar hard-wall contact density from potential-DFT is given by the reduced *compressibility* pressure.

Our analytical proofs have been tailored to highlight the different outcomes from the two routes. If we had access to the exact Helmholtz free energy functional, then there would be no route-dependency. A more general proof of the contact theorem (shown in Appendix \[general\_contact\]) would then be sufficient. We thus suggest to exploit the differences between the density profiles from the virial and compressibility routes to test, scrutinize, and ultimately attempt to improve, approximate DFT schemes. Working with inhomogeneous two-body correlation functions, as implemented explicitly in the force-DFT, is both analytically and numerically more demanding than using the standard potential-DFT scheme. However, facing the increase in complexity is rewarded by gaining deeper insight into the theoretical structure of DFT. Moreover working on the two-body level allows to explicitly incorporate the pairwise interparticle interactions and take direct account of their influence on the spatial distribution of the particles. The distinction between the virial and compressibility routes is known to be important in the integral-equation theory of bulk liquids @hansen2013. Here we reveal an analogous scenario for the theory of inhomogeneous fluids, which is an interesting result in its own right.

A particularly appealing feature of the force-DFT is that it naturally generalizes to treat nonequilibrium systems. At the most fundamental level, particles are moved by forces, rather than by potentials, and hence forces form a solid basis for developing a dynamical theory @delasheras2018velocityGradient [@delasheras2020fourForces; @schmidt2013pft; @schmidt2021pft]. The adiabatic approach that we have employed closes the dynamical description on the level of the one-body density. On this basis we have explored the dynamical behaviour of hard-spheres inside of a harmonic-trap under a temporal switching protocol. We found that the density dynamics that follow from potential- and force-DDFT differ significantly from each other. Not only are the equilibrium (long-time) profiles different, but so are the relaxation rates. The starting equations of force-DDFT, namely equations and , are exact. If we would have access to the exact ${\rho^{(2)}}$ as a functional of the one-body density, then we could calculate the exact time-evolution of $\rho$. As this information is not available, we close the theory by making an adiabatic approximation for ${\rho^{(2)}}$, thus assuming that it equilibrates at each time-step. This thinking is also captured in the adiabatic construction of power functional theory @schmidt2013pft [@schmidt2021pft].

A point of interest is to attempt to close at a higher level of the correlation function hierarchy, with the aim to provide a first-principles superadiabatic dynamical theory. It is hard to conceive that such progress could made without a force-based approach. The force-DFT that we present here thus represents a first step towards full treatment of nonequilibrium. Furthermore force-DDFT, when compared with potential-DDFT, has the clear benefit that the average interparticle interaction force does not appear automatically as a gradient term in the exact equation . If this were the case, as it is in potential-DDFT, it would exclude *de facto* all nonconservative forces. Force-DDFT thus leaves the door open for future studies of driven systems.

We thank D. de las Heras for useful discussions and G. T. Hamsler for her critical judgement and for taking the time to go through the whole manuscript several times. This work is supported by the German Research Foundation (DFG) via Project No. 436306241.

Canonical transformations {#canonical}
=========================

The transformations and are canonical and preserve the phase-space volume element. This property can be demonstrated by considering a generating function ${\cal G}$ @goldstein2002, given by $$\begin{aligned}
  {\cal G} &= \sum_{i=1}^N {{\bf p}}'_i\cdot ({{\mathbf r}}_i +{{\boldsymbol \epsilon}}({{\mathbf r}}_i)).
  \label{EQcanonicalTransformationGenerator}\end{aligned}$$ As ${\cal G}$ is a function of the old coordinates and of the new momenta, the transformation equations are generated via ${{\mathbf r}}'_i \!=\!
\partial {\cal G}/\partial {{\bf p}}'_i$ and ${{\bf p}}_i \!=\! \partial {\cal
  G}/\partial {{\mathbf r}}_i$. Using the explicit form and expanding to lowest order in ${{\boldsymbol \epsilon}}({{\mathbf r}})$ yields and in a straightforward way.

General derivation of the contact theorem {#general_contact}
=========================================

The following appendix shows a derivation of the contact theorem appropriate to situations in which all quantities are known exactly. For this reason we use the generic notation $c^{(1)}$ and $P$ for the one-body direct correlation function and the pressure, respectively.

Let us consider a hard-wall such that the distance of closest approach of a particle is located at $z\!=\!0$. We assume that the system reaches a bulk-like state at and around a (large) distance $L$ away from the wall. In order to have a closed system in the $z$-direction, we consider a second 'ultrasoft' wall that vanishes for $z\!<\!L$, and then gives a slowly rising energy penalty upon increasing $z$, which ultimately diverges $V_{\text{ext}}(z\to\infty)\!=\!\infty$.

We recall the global Noether identity of vanishing total interparticle force $$\begin{aligned}
  \int_{-\infty}^\infty dz \, \rho(z) \frac{dc^{(1)}(z)}{dz} &= 0,
  \label{EQhardWallNoetherVanishingForce}\end{aligned}$$ where $c^{(1)}({{\mathbf r}})=-\beta \delta F_{\text{exc}}[\rho]/\delta\rho({{\mathbf r}})$ is the one-body direct correlation function. The integrand in is, up to a factor of thermal energy, the locally resolved interparticle force density, $k_BT\rho({{\mathbf r}})\nabla_{{{\mathbf r}}} c^{(1)}({{\mathbf r}})$, acting in the $z$-direction. One can argue equivalently and independently (see, e.g. @hermann2021noether), that holds on the basis of Newton's third law.

Here we rather start from the alternative form $$\begin{aligned}
  \int_{-\infty}^\infty dz \,  c^{(1)}(z) \frac{d\rho(z)}{dz}=0,
  \label{EQhardWallNoetherVanishingForceByParts}\end{aligned}$$ which is straightforwardly obtained from the Noether sum-rule via integration by parts; circumstances must be such that the boundary terms at infinity vanish. More significantly, within a DFT context, it is the form that is the primary result from applying Noether's theorem to the invariance of the excess free energy functional $F_{\text{exc}}[\rho]$ upon spatial shifting of the system @hermann2021noether.

Here we proceed directly with the form , treating three spatial regions separately: the vicinity of the hard-wall, $-\Delta\!<\!z\!<\!\Delta$, where $\Delta$ is a small parameter (as compared to all other lengthscales in the sytem); the region from the wall to the bulk-like state, i.e. $\Delta\!<\!z\!<\!L$; and the soft wall region, $z\!>\!L$. In the following, the limit $\Delta\!\to\! 0$ is implicit.

In the vicinity of the hard-wall we can identify the leading term as $$\begin{aligned}
  \int_{-\Delta}^\Delta dz \, c^{(1)}(z) \frac{d\rho(z)}{dz}
  &= \int_{-\Delta}^\Delta dz \, c^{(1)}(z)\delta(z)\rho(0) \notag\\
  &=c^{(1)}(0)\rho_{\text{w}}
  \notag\\&
  =\rho_{\text{w}}\ln(\rho_{\text{w}}) - \beta\mu\rho_{\text{w}},
  \label{EQhardWallNoetherRegionOne}\end{aligned}$$ where $\rho_{\text{w}}\!=\!\rho(0)$ and in the last step we have used the EL equation $$\begin{aligned}
  c^{(1)}(z) &= \ln(\rho(z)) + \beta V_{\text{ext}}(z) - \beta \mu,
  \notag $$ to express the one-body direct correlation function at contact, $c^{(1)}(0)$; note that the external potential term gives no contribution as $V_{\text{ext}}(0^+)\!=\!0$; furthermore $c^{(1)}(z)$ is continuous at $z\!=\!0$.

In the region from between outside the wall and the bulk, i.e. for $\Delta\!<\!z\!<\!L$, the external potential vanishes and we have $$\begin{aligned}
  &\int_\Delta^L dz \, c^{(1)}(z)\frac{d\rho(z)}{dz} =
  \int_\Delta^L dz \, [\ln(\rho(z))-\beta\mu]\frac{d\rho(z)}{dz}\notag\\
  &\quad=[\rho(\ln(\rho)-1)-\beta\mu\rho]_{\rho_{\text{w}}}^{\rho_{\text{b}}}\notag\\
  &\quad= \rho_{\text{b}}(\ln(\rho_{\text{b}})-1-\beta\mu)
  - \rho_{\text{w}}(\ln(\rho_{\text{w}})-1-\beta\mu),
  \label{EQhardWallNoetherRegionTwo}\end{aligned}$$ where in the first step we have again used the EL equation and the bulk density is defined as $\rho_{\text{b}}\!=\!\rho(L)$.

In the soft wall regime, i.e. for $L<z$, the density inhomogeneity is so weak that a local density approximation becomes accurate and hence $$\begin{aligned}
  \int_L^\infty \!\! dz \, c^{(1)}(z)\frac{d\rho(z)}{dz} &=
  \int_{\rho_{\text{b}}}^0 d\rho \, c^{(1)}(\rho)
  =f_{\text{exc}}(\rho_{\text{b}})\notag\\
  &  = -P - \rho_{\text{b}}(\ln(\rho_{\text{b}})-1)+\mu\rho_{\text{b}}.
  \label{EQhardWallNoetherRegionThree}\end{aligned}$$ The upper limit in the density integral is $\rho(z\!\to\!\infty)\!=\!0$, and $f_{\text{exc}}(\rho_{\text{b}})$ is the bulk excess free energy density per volume as a function of $\rho_{\text{b}}$. The value at the upper boundary of the density integration vanishes, as the system is infinitely dilute. The last step identifies the pressure $P$.

Adding up the three contributions , and gives according to Noether invariance a vanishing result. Rewriting yields $$\begin{aligned}
  \rho_{\text{w}} = \beta P,\end{aligned}$$ which is the general form of the hard-wall sum-rule.

<span>31</span>

J. P. Hansen and I. R. McDonald, <span>*Theory of Simple Liquids*</span>, 4th ed.  (Academic Press, London, 2013).

R. Evans, D. Frenkel, and M. Dijkstra, <span>*From simple liquids to colloids and soft matter*</span>, <span>Physics Today <span>**72**</span>, 38 (2019).</span>

S. R. Nagel, <span>*Experimental soft-matter science*</span>, <span>Rev. Mod. Phys. <span>**89**</span>, 025002 (2017).</span>

M. Levesque, R. Vuilleumier, and D. Borgis, <span>*Scalar fundamental measure theory for hard spheres in three dimensions: Application to hydrophobic solvation*</span>, <span>J. Chem. Phys. <span>**137**</span>, 034115 (2012).</span>

G. Jeanmairet, M. Levesque, and D. Borgis, <span>*Molecular density functional theory of water describing hydrophobicity at short and long length scales*</span>, <span>J. Chem. Phys. <span>**139**</span>, 154101 (2013).</span>

R. Evans, M. C. Stewart, and N. B. Wilding, <span>*A unified description of hydrophilic and superhydrophobic surfaces in terms of the wetting and drying transitions of liquids*</span>, <span>Proc. Nat. Acad. Sci. <span>**116**</span>, 23901 (2019).</span>

R. Evans and N. B. Wilding, <span>*Quantifying density fluctuations in water at a hydrophobic surface: evidence for critical drying*</span>, <span>Phys. Rev. Lett. <span>**115**</span>, 016103 (2015).</span>

R. Evans, M. C. Stewart, and N. B. Wilding, <span>*Critical drying of liquids*</span>, <span>Phys. Rev. Lett. <span>**117**</span>, 176102 (2016).</span>

B. Chacko, R. Evans, and A. J. Archer, <span>*Solvent fluctuations around solvophobic, solvophilic, and patchy nanostructures and the accompanying solvent mediated interactions*</span>, <span>J. Chem. Phys. <span>**146**</span>, 124703 (2017).</span>

D. Martin-Jimenez, E. Chacón, P. Tarazona, and R. Garcia, <span>*Atomically resolved three-dimensional structures of electrolyte aqueous solutions near a solid surface*</span>, <span>Nat. Commun. <span>**7**</span>, 12164 (2016).</span>

J. Hernández-Muñoz, E. Chacón, and P. Tarazona, <span>*Density functional analysis of atomic force microscopy in a dense fluid*</span>, <span>J. Chem. Phys. <span>**151**</span>, 034701 (2019).</span>

J. Muscatello, E. Chacón, P. Tarazona, and F. Bresme, <span>*Deconstructing temperature gradients across fluid interfaces: the structural origin of the thermal resistance of liquid-vapor interfaces*</span>, <span>Phys. Rev. Lett. <span>**119**</span>, 045901 (2017).</span>

S. M. Tschopp, H. D. Vuijk, A. Sharma, and J. M. Brader, <span>*Mean-field theory of inhomogeneous fluids*</span>, <span>Phys. Rev. E <span>**102**</span>, 042140 (2020).</span>

T. Eckert, N. C. X. Stuhlmüller, F. Sammüller, and M. Schmidt, <span>*Fluctuation profiles in inhomogeneous fluids*</span>, <span>Phys. Rev. Lett. <span>**125**</span>, 268004 (2020).</span>

R. Evans, <span>*The nature of the liquid-vapour interface and other topics in the statistical mechanics of non-uniform, classical fluids*</span>, <span>Adv. Phys. <span>**28**</span>, 143 (1979).</span>

R. Evans, 'Density functionals in the theory nonuniform fluids', in <span>*Fundamentals of Inhomogeneous Fluids*</span>, edited by D. Henderson (Dekker, New York, 1992).

For an overview of new developments in classical density functional theory, see: R. Evans, M. Oettel, R. Roth, and G. Kahl, <span>*New developments in classical density functional theory*</span>, <span>J. Phys.: Condens. Matter <span>**28**</span>, 240401 (2016).</span>

J. S. Rowlinson and B. Widom, <span>*Molecular Theory of Capillarity*</span> (Dover, New York, 2002).

J. Yvon, <span>*Actualités Scientifiques et Industrielles*</span>, (Hermann & Cie., 1935).

M. Born and H. S. Green, <span>*A general kinetic theory of liquids I. The molecular distribution functions*</span>, <span>Proc. R. Soc. London, Ser. A <span>**188**</span>, 10 (1946).</span>

B. Rotenberg, <span>*Use the force! Reduced variance estimators for densities, radial distribution functions, and local mobilities in molecular simulations*</span>, <span>J. Chem. Phys. <span>**153**</span>, 150902 (2020).</span>

D. de las Heras and M. Schmidt, <span>*Better than counting: Density profiles from force sampling*</span>, <span>Phys. Rev. Lett. <span>**120**</span>, 218001 (2018).</span>

D. Borgis, R. Assaraf, B. Rotenberg, and R. Vuilleumier, <span>*Computation of pair distribution functions and three-dimensional densities with a reduced variance principle*</span>, <span>Mol. Phys. <span>**111**</span>, 3486 (2013).</span>

A. Purohit, A. J. Schultz, and D. A. Kofke, <span>*Force-sampling methods for density distributions as instances of mapped averaging*</span>, <span>Mol. Phys. <span>**117**</span>, 2822 (2019).</span>

D. de las Heras and M. Schmidt, <span>*Velocity gradient power functional for Brownian dynamics*</span>, <span>Phys. Rev. Lett. <span>**120**</span>, 028001 (2018).</span>

D. de las Heras and M. Schmidt, <span>*Flow and structure in nonequilibrium Brownian many-body systems*</span>, <span>Phys. Rev. Lett. <span>**125**</span>, 018001 (2020).</span>

W. Tarantino and C. A. Ullrich, <span>*A reformulation of time-dependent Kohn– Sham theory in terms of the second time derivative of the density*</span>, <span>J. Chem. Phys. <span>**154**</span>, 204112 (2021).</span>

M.-L. M. Tchenkoue, M. Penz, I. Theophilou, M. Ruggenthaler, and A. Rubio, <span>*Force balance approach for advanced approximations in density functional theories*</span>, <span>J. Chem. Phys. <span>**151**</span>, 154107 (2019).</span>

A. J. Archer and R. Evans, <span>*Dynamical density functional theory and its application to spinodal decomposition*</span>, J. Chem. Phys. <span>**121**</span>, 4246 (2004). U. M. B. Marconi and P. Tarazona, <span>*Dynamic density functional theory of fluids*</span>, J. Chem. Phys. <span>**110**</span>, 8032 (1999).

M. Schmidt and J. M. Brader, <span>*Power functional theory for Brownian dynamics*</span>, <span>J. Chem. Phys. <span>**138**</span>, 214101 (2013).</span>

M. Schmidt, <span>*Power functional theory for many-body dynamics*</span>, Rev. Mod. Phys. (to appear); <span>arxiv:2111.00432.</span>

S. Hermann and M. Schmidt, <span>*Noether's Theorem in Statistical Mechanics*</span>, <span>Commun. Phys. <span>**4**</span>, 176 (2021).</span>

S. Hermann and M. Schmidt, <span>*Why Noether's Theorem applies to Statistical Mechanics*</span>, <span>arxiv:2109.10283</span>

S. M. Tschopp and J. M. Brader, <span>*Fundamental measure theory of inhomogeneous two-body correlation functions*</span>, <span>Phys. Rev. E <span>**103**</span>, 042103 (2021)</span>.

P. Attard, <span>*Thermodynamics and Statistical Mechanics*</span> (Academic Press, 2002).

D. A. McQuarrie, <span>*Statistical Mechanics*</span> (University Science Books, 2000).

D. Frenkel and B. Smit, <span>*Understanding Molecular Simulation: From Algorithms to Applications*</span> (Academic Press, 2001).

R. L. Davidchack, B. B. Laird, and R. Roth, <span>*Hard spheres at a planar hard wall: Simulations and density functional theory*</span>, <span>Condens. Matter Phys. <span>**19**</span>, 23001 (2016).</span>

H. Goldstein, C. Poole, and J. Safko, <span>*Classical Mechanics*</span> (Addison–Wesley, New York, 2002). Our generator $\cal G$ is notated as $F_2$ in their presentation.

Y. Rosenfeld, <span>*Free-energy model for the inhomogeneous hard-sphere fluid mixture and density-functional theory of freezing*</span>, Phys. Rev. Lett. <span>**63**</span>, 980 (1989).

M. Kasch, X. S. Chen, and F. Forstmann, <span>*The calculation of correlation functions in fluids by a weighted density concept*</span>, Mol. Phys. <span>**75**</span>, 415 (1992).

J. M. Brader and M. Schmidt, <span>*Free power dissipation from functional line integration*</span>, Mol. Phys. <span>**113**</span>, 2873 (2015).

{'source': 'arXiv_out/2203'}