NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Stress and heat flux via automatic differentiation

Marcel F. Langer, J. Thorben Frank, Florian Knoop

TL;DR

This paper presents a unified approach using automatic differentiation (AD) to efficiently compute forces, stress, and heat flux for complex machine-learning potentials (MLPs). This method offers a model-independent implementation, making it easier to extract crucial material properties from MLPs without manual derivative calculations or computationally expensive finite-difference schemes.

What Problem Does This Paper Address?

Accurately simulating material behavior at the atomic level is crucial for designing new materials. Molecular dynamics (MD) simulations are a powerful tool for this, but they rely on knowing the forces acting on atoms, which are derived from the potential energy surface (PES). While first-principles methods like DFT provide accurate PES, they are computationally expensive. Machine-learning potentials (MLPs) offer a computationally efficient alternative, but their complex, often non-linear, functional forms make it challenging to derive essential quantities like forces, stress (related to mechanical properties), and heat flux (related to thermal transport). Traditionally, these derivatives were obtained through manual analytical derivations or finite-difference approximations, which are error-prone, time-consuming, and often infeasible for modern, sophisticated MLPs. This paper addresses the need for a general, efficient, and accurate method to compute these critical derivatives for MLPs.

Methods

The core of this work is the application of automatic differentiation (AD). AD is a technique that computes derivatives of functions by breaking them down into elementary operations and applying the chain rule. The authors propose a unified AD approach to compute forces, stress, and heat flux for a class of MLPs they call graph-based machine-learning potentials (GLPs). GLPs represent atomic systems as graphs, where atoms are nodes and interactions are edges, allowing for flexible and scalable modeling of many-body interactions.

Key methodological contributions include:

  • Model-Independent Implementation: The approach is designed to be general and work with any GLP, regardless of its specific architecture, as long as the potential energy can be computed.
  • Unified Framework: Forces, stress, and heat flux are derived within a single AD framework, simplifying implementation and ensuring consistency.
  • Handling Complex Architectures: AD overcomes the difficulty of manually deriving gradients for complex MLPs, such as those employing message-passing mechanisms and equivariant representations.
  • Efficient Computation: AD allows for the computation of these derivatives with the same asymptotic computational cost as calculating the energy itself, a significant advantage over finite-difference methods.
  • Two Strategies for GLPs: The paper discusses two ways to construct GLPs: a "standard" approach that incorporates periodicity via graph edges and an "unfolded" approach that explicitly includes replicas of the simulation cell.

Datasets

The paper uses two primary systems for validation and demonstration:

  • Lennard-Jones Argon: This is a well-understood model system with readily available analytical derivatives. It's used to numerically verify the correctness of the implemented stress and heat flux formulations against known analytical results and finite-difference approximations.
  • Tin Selenide (SnSe): This is a real material system studied using an equivariant message-passing neural network potential (SO3KRATES). The training data for the SO3KRATES models consisted of approximately 3000 reference calculations from a larger ab initio Green-Kubo (aiGK) benchmark study. These calculations involved thermalization trajectories at different volumes at 300 K.

Key Insights and Ideas

  • AD is a Game-Changer for MLP Derivatives: The paper strongly advocates for AD as the go-to method for obtaining derivatives from MLPs, highlighting its efficiency and generality compared to traditional methods.
  • Unified Stress and Heat Flux Formulations: By abstracting MLPs as functions of graph representations, the authors provide general formulations for stress and heat flux that can be applied broadly to GLPs.
  • Model-Independent Implementation is Achievable: The development of the glp package demonstrates that a practical, model-independent implementation of these AD-based derivative calculations is feasible.
  • M=2 is Often Sufficient for Vibrational Properties: For SnSe, the study suggests that an interaction depth of M=2 in the message-passing network is often adequate for capturing vibrational properties, though M=3 shows improvement for energy-volume curves.
  • Bridging the Gap to Materials Properties: This work directly enables the calculation of crucial material properties (mechanical and thermal) from MLPs, accelerating materials discovery and design.

Key Results

  • Verification on Lennard-Jones Argon: The implemented stress and heat flux formulations using AD were shown to be equivalent to analytical derivatives and outperformed finite-difference methods in some cases, especially in single-precision arithmetic.
  • Accurate Prediction for Tin Selenide (SnSe):
    • The SO3KRATES MLP with M=3 interaction steps accurately predicted cohesive properties (equilibrium volume, bulk modulus) of SnSe, showing deviations of -0.16% and -3.14% respectively, compared to DFT.
  • The model also captured the vibrational density of states and phonon band structure of SnSe reasonably well, with performance improving with M.
  • The predicted thermal conductivity of SnSe using the Green-Kubo method with the SO3KRATES MLP (M=2,3) was in excellent agreement with previous DFT calculations and experimental data.
  • Efficiency: The AD approach allows for the computation of stress and heat flux at the same asymptotic cost as energy calculation, a significant improvement over quadratic scaling methods.

Limitations and Future Work

  • Global Interactions: The current GLP framework, as implemented, does not inherently model global interactions. While this is often acceptable for many systems, it could be a limitation for phenomena requiring long-range correlations.
  • Computational Overhead for M>1 Heat Flux: While the "unfolded" approach restores linear scaling for heat flux in GLPs with M>1, it introduces some overhead compared to the M=1 case.
  • Future Work: The authors suggest that their framework enables the use of a broad class of MLPs for materials science calculations, particularly for thermal conductivity via the GK method. The provided glp package aims to facilitate this. Further exploration of the parameter space for MLPs and their application to a wider range of materials are natural next steps.

Summary updated

BibTeX
@misc{langer2023stress,
  author = {Marcel F. Langer and J. Thorben Frank and Florian Knoop},
  title = {{Stress and heat flux via automatic differentiation}},
  year = {2023},
  eprint = {2305.01401},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2305.01401},
}
Figure