Learning pair potentials using differentiable simulations

Wujie Wang, Zhenghao Wu, Johannes C. B. Dietschreit, Rafael Gómez‐Bombarelli

TL;DR

DiffSim is a new framework that uses differentiable molecular dynamics simulations to learn interatomic pair potentials directly from structural data, such as radial distribution functions (RDFs). By backpropagating through the entire simulation, the method can optimize flexible neural network potentials and handle multiple thermodynamic states simultaneously, resulting in models that are significantly more transferable across different temperatures and compositions than traditional methods.

What Problem Does This Paper Address?

In molecular modeling, the "holy grail" is an interatomic potential (or force field) that is both computationally efficient and physically accurate. Traditionally, researchers have used methods like Iterative Boltzmann Inversion (IBI) to derive these potentials from structural data. However, IBI is often limited to simple tabulated forms and struggles to generalize—a potential learned at one temperature or density often fails miserably at another.

Another popular approach, Force Matching, requires high-fidelity atomistic data (positions and forces), which can be prohibitively expensive to generate. The authors of this paper tackle the gap: How can we learn complex, flexible potentials directly from macroscopic observables (like the RDF) while ensuring they work across a wide range of conditions?

Methods

The core innovation is DiffSim, which treats a molecular dynamics (MD) simulation as a differentiable program.

  1. Differentiable MD: The authors use Automatic Differentiation (AD) to calculate the gradient of a loss function (the difference between simulated and target RDFs) with respect to the parameters of the potential.
  2. Differentiable RDFs: To make the "histogramming" of particle distances differentiable, they employ a "kernel density trick" using Gaussian kernels.
  3. Neural Pair Potentials: Instead of simple tables, they use Multi-Layer Perceptrons (MLPs) to represent the potential. They also incorporate a repulsive "prior" potential to prevent particles from overlapping during the early stages of learning.
  4. Multi-state Optimization: The framework allows for "top-down" learning, where the potential is optimized against multiple simulation boxes at once (e.g., different temperatures or concentrations), forcing the model to find a physically consistent solution that works for all of them.

Datasets

The authors validated DiffSim using several synthetic and real-world benchmarks:

  • Lennard-Jones (LJ) Systems: Standard noble-gas-like particles at various densities ($\rho = 0.3, 0.5, 0.7$).
  • Modified Morse (MM) Potentials: A set of potentials with varying "softness" to test the sensitivity of the learning process.
  • Binary Mixtures: Systems with three types of interactions (AA, AB, BB) at different compositions.
  • Coarse-Grained Water: Using all-atom simulations (SPC/E model) at 288K, 338K, and 388K as "ground truth" to learn a single-bead coarse-grained water model.

Key Insights and Ideas

  • The "Entropic Effect of Packing": The authors found that at high densities, the structure of a liquid (the RDF) is dominated by how spheres pack together rather than the specific details of the potential. This makes it much harder to "learn" the true potential from high-density data alone—a phenomenon they call "low sensitivity."
  • Multi-state Training as Regularization: Training on a single state often leads to "overfitting" where the potential looks weird (e.g., concave-down shapes) but produces the right RDF for that specific state. Training on multiple states simultaneously acts as a physical regularizer, recovering potentials that look much closer to the "ground truth" physics.
  • Explicit Temperature Dependence: For coarse-graining water, they introduced a functional form $u(r, T) = u_1(r) - k_B T u_2(r)$, where $u_1$ represents energy and $u_2$ represents entropy. This explicit inclusion of $T$ allowed the neural network to achieve excellent transferability across a 100K range.

Key Results

  • Superior Recovery: DiffSim successfully recovered the functional form of LJ and Morse potentials from RDF data, outperforming IBI in terms of flexibility and accuracy.
  • Transferability: In binary mixtures, potentials learned from multiple compositions simultaneously showed much better performance when tested on "unseen" compositions compared to those learned from a single state.
  • Water Modeling: The temperature-transferable neural potential for water produced significantly lower errors across all tested temperatures (288K–388K) compared to potentials optimized for just one temperature.

Limitations and Future Work

  • Computational Intensity: Differentiating through long MD trajectories is memory-intensive and computationally expensive. The authors currently limit updates to short "unrolled" trajectories (100–300 steps).
  • Gradient Stability: Like many recurrent architectures, differentiable simulations can suffer from vanishing or exploding gradients if the trajectories are too long.
  • Expanding Observables: While this paper focuses on RDFs, the authors suggest that future work could incorporate other observables like stress tensors (for pressure) or velocity autocorrelation functions (for transport properties) to further constrain the learned physics.

Summary updated

BibTeX
@article{wang2023learning,
  author = {Wujie Wang and Zhenghao Wu and Johannes C. B. Dietschreit and Rafael Gómez‐Bombarelli},
  title = {{Learning pair potentials using differentiable simulations}},
  journal = {The Journal of Chemical Physics},
  year = {2023},
  doi = {10.1063/5.0126475},
}
Figure