Constructing custom thermodynamics using deep learning

Xiaoli Chen, Beatrice W. Soh, Zi-En Ooi, Eléonore Vissol-Gaudin, Haijun Yu, Kostya S. Novoselov, Kedar Hippalgaonkar, Qianxiao Li · DOI

Abstract

Deriving macroscopic physical laws from microscopic data is a fundamental challenge in physics, particularly for non-equilibrium systems. This paper introduces Stochastic OnsagerNet (S-OnsagerNet), a deep learning framework designed to discover interpretable, low-dimensional thermodynamic models from high-dimensional microscopic trajectories. By embedding a generalized stochastic Onsager principle into the neural network architecture, the model learns stable macroscopic coordinates and their governing dynamics. We demonstrate its efficacy in predicting polymer stretching dynamics and modeling spatial epidemics, showing that it can discover hidden physical variables and enable data-driven control of complex systems.

Introduction

Complex physical systems, ranging from protein folding to the spread of infectious diseases, involve a vast number of interacting components. Despite this complexity, scientists often seek to describe these systems using a few macroscopic variables, such as the extension of a polymer or the total number of infected individuals. However, deriving these macroscopic "custom thermodynamics" from microscopic laws is notoriously difficult, especially for systems driven by random thermal fluctuations and non-equilibrium forces.

Traditional machine learning approaches can fit dynamic data but often function as "black boxes." They lack interpretability, ignore fundamental physical constraints, and can become unstable during long-term predictions. This research addresses these shortcomings by developing a structured AI approach that automatically identifies essential macroscopic variables and the physical laws governing them.

Methodology: Stochastic OnsagerNet

The core of this work is Stochastic OnsagerNet (S-OnsagerNet). Unlike standard neural networks, S-OnsagerNet enforces physical laws directly within its architecture through the Generalized Stochastic Onsager Principle (GSOP).

The network is structured to learn specific matrices that have physical meaning:

  • $M(\mathbf{Z})$: The dissipation matrix, representing energy loss.
  • $W(\mathbf{Z})$: The conservative force matrix.
  • $V(\mathbf{Z})$: A generalized free-energy potential.
  • $\sigma(\mathbf{Z})$: Thermal noise or fluctuations.

To ensure physical consistency, the architecture strictly enforces that $M$ is symmetric positive semi-definite and $W$ is anti-symmetric. These constraints guarantee that the learned dynamics dissipate energy correctly and remain stable over time.

The S-OnsagerNet workflow for discovering reduced coordinates and closed equations from microscopic data.

The model also performs Simultaneous Coordinate Discovery. Using a PCA-ResNet encoder, it compresses high-dimensional microscopic states ($X$) into a small set of "closure coordinates" ($Z$). Training is conducted via Maximum Likelihood Estimation (MLE) using an Euler-Maruyama discretization scheme, which allows the model to accurately capture the noise and diffusion characteristics of the system.

Key Insights and Interpretability

One of the most significant advantages of S-OnsagerNet is its interpretability. Because the neural network is differentiable, the authors used auto-differentiation to probe the learned coordinates. They found that one abstract coordinate mapped perfectly to the "foldedness" of the polymer.

Furthermore, the learned potential function $V(Z)$ provides a dynamic free-energy landscape. This landscape explains why visually identical polymers unfold at different rates: some get trapped in metastable "valleys" (folded states) and require thermal noise to cross a "ridge" (saddle point) to unfold. This understanding allowed the authors to design a control protocol—adjusting fluid flow—to steer polymers out of these traps, reducing unfolding time by approximately 14%.

Results and Applications

The researchers validated S-OnsagerNet on several challenging datasets, including polymer simulations (900 degrees of freedom), real-world DNA stretching experiments, and spatial epidemic models. In the polymer case, S-OnsagerNet discovered that just three variables were sufficient to describe the complex dynamics.

Comparison of true versus predicted results for polymer trajectories, means, standard deviations, and unfolding time distributions.

As shown in the results, the predicted trajectories, means, and standard deviations of the macroscopic coordinates closely matched the ground truth from simulations. In experimental DNA stretching, S-OnsagerNet outperformed human experts in classifying "fast" versus "slow" unfolding molecules from early-stage images. In epidemic modeling, it discovered a "spatial overlap" coordinate that predicted whether an outbreak would spread or dissipate.

Conclusion

S-OnsagerNet represents a significant step toward automated physical discovery. By baking physics into the AI architecture, it provides a stable, interpretable, and predictive framework for complex non-equilibrium systems. Future work will focus on automating the selection of the number of reduced dimensions and integrating active learning to better sample rare transition states.

Summary updated

BibTeX
@article{chen2024constructing,
  author = {Xiaoli Chen and Beatrice W. Soh and Zi-En Ooi and Eléonore Vissol-Gaudin and Haijun Yu and Kostya S. Novoselov and Kedar Hippalgaonkar and Qianxiao Li},
  title = {{Constructing custom thermodynamics using deep learning}},
  journal = {Nat. Comput. Sci.},
  year = {2024},
  doi = {10.1038/s43588-023-00581-5},
}
Figure