  The atomic-scale response of inhomogeneous fluids at interfaces and
surrounding solute particles plays a critical role in governing chemical,
electrochemical and biological processes at such interfaces. Classical
molecular dynamics simulations have been applied extensively to simulate the
response of inhomogeneous fluids directly, and as inputs to classical density
functional theory, but are limited by the accuracy of the underlying empirical
force fields. Here, we deploy neural network potentials (NNPs) trained to ab
initio simulations to accurately predict the inhomogeneous response of two
widely different fluids: liquid water and molten NaCl. Although NNPs can be
readily trained to model complex bulk systems across a range of state points,
in order to appropriately model a fluid's response at an interface,
inhomogeneous configurations must be included in the training data. We
establish protocols based on molecular dynamics simulations in external atomic
potentials in order to sufficiently sample the correct configurations of
inhomogeneous fluids. We show that NNPs trained to inhomogeneous fluid
configurations can predict several properties such as the density response,
surface tension and size-dependent cavitation free energies in water and molten
NaCl corresponding to ab initio interactions more accurately than empirical
force fields. This work therefore provides a first demonstration and framework
for extracting the response of inhomogeneous fluids from first principles for
classical density-functional treatment of fluids free from empirical
potentials.
