Overview
Classical density-functional theory relates the external field acting on a many-particle system to the density profile the particles adopt. Machine learning has been applied to that relationship mostly in one direction, discovering free-energy functionals automatically.
This paper runs it the other way. Given observed particle positions, it infers the external potential responsible for them, combining Bayesian inference with the density-functional apparatus so that physics constrains the fit rather than the data alone determining it.
Because the treatment is Bayesian, the result is a distribution over potentials rather than a single best guess, and the uncertainty is quantified as a function of how much data was available. The demonstration uses a one-dimensional grand-canonical ensemble with excluded-volume interactions in confinement, trained on Monte Carlo output, and benchmarks the inferred density against the exact one computed from the true potential.
The model
The system is a one-dimensional fluid of hard rods, chosen because its free-energy functional ℱ[ρ] has a known closed form, which is what makes checking the method against ground truth possible at all. The rods sit in a pore of length L = 20, confined between two walls, with rod width 2R = 1 and a chemical potential μ = −2 setting the reservoir the pore exchanges particles with.
The equilibrium density is the one that minimises the grand potential Ω[ρ] = ℱ[ρ] + ∫dx ρ(x)(V(x) − μ), found where its functional derivative vanishes, δΩ/δρ(x) = δℱ/δρ(x) + V(x) − μ = 0. Given a known external potential V(x), this is the forward problem classical DFT already solves. The paper first works it forward, applying an asymmetric potential V(x) = −ε[exp((x − L/4)/r) + exp((−x − L/2)/r)] with ε = 2 and r = 5, to generate a target density it can later try to recover blind.
A grand-canonical Monte Carlo simulation then produces the training data: particle coordinates sampled under the same potential and chemical potential, using local moves (displacing a particle, or inserting/removing one from the reservoir) accepted with the standard Metropolis probability. With enough configurations, the histogram of sampled positions converges to the same density the DFT calculation gives analytically, which is the paper’s check that the simulation and the theory agree before the harder inverse problem is attempted.
Derivation
The inverse problem discards knowledge of V(x) and tries to recover it from the Monte Carlo particle coordinates alone, using Bayes’ rule, P(Q|𝒟) ∝ P(Q)P(𝒟|Q), where Q are the parameters of a parametrised potential, 𝒟 is the observed particle-position dataset, P(Q) is a prior over those parameters and P(𝒟|Q) is the likelihood of the data given them.
The potential itself is represented as a mixture of three Gaussian radial basis functions, V̄(x|Q) = Σᵢ Q¹ᵢ exp(−(x − zᵢ)²/exp(Q²ᵢ)), with fixed centres at the two walls and the pore’s midpoint, and amplitude and width parameters Q¹ᵢ, Q²ᵢ left free, expressive enough to fit a smooth potential without hand-picking its functional form, given a Gaussian prior with zero mean on Q. The likelihood is the physics-informed part: for any sampled Q, the corresponding V̄(x|Q) is inserted into the DFT minimisation to compute ρ(x|Q), and the probability of the observed particle coordinates under that density is what P(𝒟|Q) actually measures. Classical DFT sits inside the inference loop rather than beside it.
Because the posterior has no closed form, it is sampled with the Metropolis–Hastings algorithm: a symmetric Gaussian proposal distribution walks the Markov chain through parameter space, accepting each proposed step with the standard Metropolis–Hastings ratio, and every accepted step requires re-solving the DFT minimisation to evaluate the likelihood.
Results
With a training set of 800 Monte Carlo configurations (roughly 5,000 individual particle coordinates), the predictive potential V̄(x|Q) lies within the 99% credible region of the true potential across almost the entire pore, the one exception being a narrow low-density region near the centre, x ∈ [−2.5, 2.5], where the fit is visibly worse.
That mismatch turns out not to matter much for what is actually being asked: the resulting density profile ρ(x|Q), obtained by feeding the mean recovered potential back through the DFT minimisation, is almost indistinguishable from the exact density even in the region where the potential itself was poorly recovered. The near-wall layering effects, including oscillatory structure right against the walls, are reproduced with high fidelity: the potential’s errors are concentrated exactly where the density barely depends on it.
Validation
The paper checks how the inference degrades as less data is supplied, running the same procedure on datasets of 360, 800, 2,400 and 6,000 configurations. The posterior visibly contracts as data increases: the histogram of a representative parameter narrows steadily from 800 to 6,000, and the credible interval on V̄(x|Q) shrinks to match, exactly the behaviour a well-calibrated Bayesian method should show.
At 360 configurations, the Markov chains fail to settle into a stable region of parameter space at all, oscillating around values far from the ones the larger datasets agree on: a clear, honestly reported floor below which the method does not produce a trustworthy answer, rather than a silently degraded one. At 6,000 configurations, the recovered density is closer still to the exact one over the low-density central region than the 800-configuration result was, confirming that more data narrows the gap precisely where the potential was previously least well determined.
Why it matters
Inferring a cause from its equilibrium consequences is a recurring shape of problem, and the deliberate choice here is to let the physical theory carry the structure while inference supplies only what the theory leaves open. That keeps the uncertainty honest, which a purely statistical fit of the same data would not.
The authors position the one-dimensional case as a prototype for adsorption, wetting and capillarity rather than as an end in itself.
Citation
Antonio Malpica-Morales, Peter Yatsyshin, Miguel A. Durán-Olivencia, Serafim Kalliadasis. Physics-informed Bayesian inference of external potentials in classical density-functional theory. The Journal of Chemical Physics, 2023. https://doi.org/10.1063/5.0146920