Abstract
Calculating Gibbs free energies is a cornerstone of computational materials science, yet traditional sequential sampling methods often face efficiency bottlenecks. We present NPT-flow, a normalizing flow framework extended to the isobaric-isothermal ($NPT$) ensemble. By jointly modeling particle coordinates and flexible triclinic simulation boxes, NPT-flow enables direct, parallel estimation of Gibbs free energies. Benchmarks on ice phases of monatomic water demonstrate that NPT-flow matches the accuracy of traditional Molecular Dynamics while offering significant advantages in sampling independence.
Introduction
Calculating the Gibbs free energy ($G$) is essential for determining phase stability and material behavior under realistic experimental conditions of constant temperature and pressure. Traditionally, researchers rely on Molecular Dynamics (MD) or Monte Carlo (MC) simulations. While robust, these methods are inherently sequential and often struggle with local energy minima.
Normalizing flows have recently emerged as a powerful alternative, learning to map simple base distributions to complex physical Boltzmann distributions. This approach enables massive parallelization, as samples can be generated independently. However, most existing flow models are restricted to the canonical ($NVT$) ensemble, where volume is fixed. This work introduces NPT-flow, extending normalizing flows to the isobaric-isothermal ($NPT$) ensemble by jointly modeling particle coordinates and fluctuating simulation box geometries.
The NPT-Flow Framework
The primary challenge in $NPT$ sampling is accounting for fluctuations in the simulation box's size and shape. The NPT-flow addresses this by decomposing the joint distribution of particle coordinates $s$ and box parameters $m$ as $q(s, m) = q(m) \cdot q(s|m)$.
As illustrated in Figure 1, the model transforms a reference box into a flexible, triclinic box. This flexibility is vital for solid-state simulations, as it allows crystal lattices to relax into their natural equilibrium configurations, a prerequisite for accurate free energy calculations.
Model Architecture and Training
The NPT-flow architecture is split into two distinct but coupled components. The first part, $q(m)$, determines the box shape. For the ice phases studied, the authors observed that box parameter distributions were nearly Gaussian, allowing for the use of a computationally efficient affine flow. The second part, $q(s|m)$, is a shape-conditional flow that determines atom positions.
As shown in Figure 2, the coordinate flow utilizes a permutation-equivariant transformer. This architecture ensures that the model respects the physical indistinguishability of identical atoms. The entire system is trained by minimizing the reverse Kullback–Leibler (KL) divergence, effectively matching the generated distribution to the target enthalpy-based Boltzmann distribution without requiring pre-existing training data. To achieve exact results, importance weighting is applied to the model's samples, providing unbiased physical estimates.
Results and Discussion
The NPT-flow was validated using monatomic water (mW) models of cubic (Ic) and hexagonal (Ih) ice. The model demonstrated remarkable precision, capturing the minute free energy differences between these two phases. For a 512-particle system, the flow estimated a Gibbs free energy difference ($\Delta G$) of $6.70 \pm 0.32$ J/mol, in excellent agreement with the MD baseline of $6.51 \pm 0.57$ J/mol. Structural properties, such as Radial Distribution Functions, also showed near-perfect agreement with traditional MD.
A significant advantage of this approach is its inherent parallelism. Unlike sequential MD, NPT-flow can generate thousands of independent configurations simultaneously across multiple GPUs. However, the model faces challenges with scaling; the statistical efficiency (Effective Sample Size) drops as the number of particles increases. Future research will focus on overcoming this "dimensionality curse" and extending the model to rigid molecules and broader ranges of temperatures and pressures through amortization.
Summary updated