Path-probability gradients for optimizing force fields against dynamical observables
Authors: Zhongyao Wang, Lun Song, Yakun Zeng, Xingao Gong, Rui Shi, Mao Su
Organizations: Shanghai Artificial Intelligence Laboratory, Shanghai 200232, China · College of Intelligent Robotics and Advanced Manufacturing, Fudan University, Shanghai 200433, China · Shanghai Innovation Institute, Shanghai 200231, China · Huazhong University of Science and Technology, Wuhan 430074, China · School of Physics, Zhejiang University, Hangzhou 310058, China · Key Laboratory of Computational Physical Sciences (Ministry of Education), Institute of Computational Physical Sciences, State Key Laboratory of Surface Physics, and Department of Physics, Fudan University, Shanghai 200433, China · Shenzhen Institute of Advanced Technology, Chinese Academy of Sciences, Shenzhen 518055, China
Machine learning force fields inherit the errors of the electronic-structure methods used to generate their training data, and refining them against experimental measurements provides a direct route beyond this limit. However, such refinement remains difficult for dynamical observables because differentiating chaotic molecular trajectories yields unstable gradients. Here, we introduce PathGrad, which differentiates Langevin path probabilities instead of the trajectories themselves. The resulting gradient estimator is accumulated on the fly from thermal noise and force derivatives, and its variance remains stable as the trajectory length increases. We validated the gradient estimator against finite-difference calculations and used it to fine-tune molten-copper and water potentials against experimental diffusion coefficients together with structural constraints. For water, jointly optimizing diffusion and the oxygen-oxygen radial distribution function also improves the predictions of shear viscosity and rotational relaxation, neither of which is included in the optimization objective. Alignment at a single temperature also improves the apparent activation energies of multiple dynamical observables, bringing their temperature dependences closer to experiments. Moreover, the optimized potential exhibits smaller force errors relative to an independent, higher-level quantum-chemical reference, indicating that alignment with experiments improves the fidelity of the potential energy surface beyond the fitted targets. PathGrad thus establishes a general framework for incorporating experimental observables directly into force field optimizations.
Figures & tables
Figure 1: Path-score differentiation on a two-dimensional toy model. ( a ) Corrugated potential U(x,y;θ)=−θ[cos(πx)+cos(πy)] with θ=0.5 . Darker regions denote lower potential energy; the barrier between neighboring minima is 2θ . ( b ) Twenty-four illustrative Langevin trajectories starting from rest at the origin, colored by their path score Sθ[Γi] . The gradient is determined by the covariance between the diffusion estimate and the path score. ( c ) Estimates of ∂D/∂θ from PathGrad and direct trajectory differentiation as a function of the number of trajectories per batch. Points and error bars denote the mean and sample standard deviation over five independent batches. The blue dashed line and shaded band show the finite-difference reference, −1.261±0.093 , obtained from five batches with K=2000 .
Figure 2: Fine-tuning the EAM potential for molten copper. ( a ) Langevin diffusion estimate D versus optimization iteration, with the experimental target Dtarget=4.3×10−9m2s−1 (dashed). ( b ) Equilibrium lattice constant a0 and ( c ) bulk modulus B versus optimization iteration, with targets a0=3.615A˚ and B=140GPa (dashed).
Figure 3: Fine-tuning the water potential. ( a ) Diffusion during optimization, with its target (dashed). ( b ) O–O RDF RMSE during optimization. ( c ) Force RMSE against the CCSD(T)-level reference 31 , evaluated every 10 iterations.
Figure 4: Water structure and dynamics before and after fine-tuning. All results are evaluated at T=298.15K and ρ=0.99704gcm−3 . ( a – c ) O–O, O–H and H–H RDFs for the initial and fine-tuned (at iteration 680) models. Blue dashed curves are experimental references: O–O from X-ray scattering at 299.5K 37 ; O–H and H–H from empirical potential structure refinement (EPSR) of scattering data at 298K 39 . Shading shows the uncertainty or variation reported by the corresponding sources. Only intermolecular regions are shown for O–H ( r≥1.3A˚ ) and H–H ( r≥2.0A˚ ). ( d – f ) Diffusion coefficient D , shear viscosity η and H–H rotational relaxation time τ2 at iterations 0 , 200 , 400 and 680 . Symbols are means over five independent 5ns trajectories and error bars are sample standard deviations. Some error bars are too small to be visible in the figure. Dashed lines are experimental values 17 , 18 , 19 , 20 . The optimization loss included only D and the O–O RDF. The estimation windows and underlying curves are shown in Supplementary Fig. S2.
Figure 5: Temperature transferability after fine-tuning at 300 K. ( a ) Diffusion coefficient D , ( b ) shear viscosity η and ( c ) rotational relaxation time τ2 at 288.15 , 298.15 and 308.15K , before (initial, grey) and after (fine-tuned, orange) optimization at 300 K (Methods). Simulations at each temperature were performed in the NVT ensemble using the corresponding experimental density 16 . Symbols and error bars denote the mean and sample standard deviation, respectively, over five independent trajectories. Some error bars are too small to be visible in the figure. Experimental references 17 , 18 , 19 , 20 are shown as triangles. Open triangles mark the τ2 references at 288.15 and 308.15K , digitized from a fitted experimental curve 21 (see Supplementary Tab. S3).
Figure 6: Gradient standard deviation and dynamics of the initial NEP water model. ( a ) Gradient standard deviation versus trajectory length at γ=1ps−1 . The results for longer trajectories are presented in Supplementary Fig. S1. ( b ) Gradient standard deviation versus γ for 2ps trajectories. Both methods estimate the gradient of the diffusion observable with respect to the potential parameters. ( c ) Diffusion coefficient D versus γ . Each point is obtained from a single 5ns trajectory using oxygen MSD fit. ( d ) All-atom velocity autocorrelation function (VACF), normalized by its ensemble mean at zero lag, at γ=1ps−1 .
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
Figure S1: Standard-deviation decomposition for the water gradient. ( a ) Sample standard deviation of diffusion coefficient across 128 trajectories. ( b ) Square root of the sample covariance trace of the accumulated dynamical path score. ( c ) Standard deviation of the gradient estimate.
T (K)
Density (g cm -3 )
Equilibration
Production
288.15
0.99910
400 ps
10 ns
298.15
0.99704
200 ps
5 ns
308.15
0.99403
200 ps
5 ns
Appendix
Table S1: Water validation protocol. Production lengths are per trajectory; five trajectories are used for each available parameter set.
Figure S2: Extraction of water transport coefficients. ( a ) Mean MSD with the 20 – 100ps fitting window shaded and linear fits over that window. ( b ) Mean viscosity running integral with its 25 – 75ps plateau window shaded. ( c ) Mean H–H second-rank rotational correlation and ( d ) its running trapezoidal integral over each set’s sampled window. Curves are averages over five independent trajectories per parameter set.
Iteration
D ( 10−9 m 2 s -1 )
η (mPa s)
τ2 (ps)
0
0.507±0.005
4.98±0.28
12.99±0.21
200
1.446±0.007
1.59±0.08
3.73±0.05
400
2.200±0.025
0.99±0.12
2.23±0.02
680
2.114±0.018
1.08±0.07
2.32±0.01
Experiment
2.299
0.890
2.36
Appendix
Table S2: Transport coefficients at 298.15K . T=298.15K , ρ=0.99704gcm−3 . Only D and the O–O RDF entered the loss. Values are means ± standard deviation over five independent trajectories.
Quantity
Set
288.15 K
298.15 K
308.15 K
D ( 10−9 m 2 s -1 )
Initial
0.275±0.005
0.507±0.005
0.832±0.011
Fine-tuned
1.602±0.010
2.114±0.018
2.712±0.005
Experiment
1.766
2.299
2.895
η (mPa s)
Initial
9.897±0.482
4.977±0.283
2.901±0.185
Fine-tuned
1.346±0.079
1.077±0.071
0.861±0.077
Experiment
1.138
0.890
0.720
Appendix
Table S3: Transferability across temperature. Initial and fine-tuned values at 288.15 , 298.15 and 308.15K , each at the experimental density of that temperature. Experimental references: D [ 17 ] ; η [ 18 ] ; τ2 at 298.15K [ 19 , 20 ] .
Figure S3: Arrhenius analysis of water dynamics over 288.15–308.15 K. ( a ) Diffusion coefficient D , ( b ) shear viscosity η and ( c ) second-rank rotational relaxation time τ2 of the intramolecular H–H vector, for the initial and fine-tuned models and experimental measurements. Results are plotted as ln(Q/Qref) versus 1000/T , where Q represents D , η , or τ2 . Simulation symbols represent means over five independent NVT trajectories. The corresponding standard errors are too small for the error bars to be visible in the figure. Lines represent linear Arrhenius fits, from which the apparent activation energies reported in Table S4 are determined.
Quantity
Initial
Fine-tuned
Experiment
D
40.86
19.44
18.25
η
45.35
16.47
16.94
τ2 (HH)
47.17
22.11
17.75
Appendix
Table S4: Apparent activation energies of water dynamics over 288.15–308.15 K. Values for initial and fine-tuned models and experiments were obtained from three-point Arrhenius fits at 288.15 , 298.15 and 308.15 K (Fig. S3 ). Experimental values were fitted using the reference data listed in Table S3 . All activation energies are reported in kJmol−1 .
Parameter
Molten Cu
water
t (ps)
1
2
Δt (ps)
10−3
10−3
γ (ps -1 )
1
1
T (K)
1500
300
ρ (g cm -3 )
7.94
0.994
Dtarget ( 10−9 m 2 s -1 )
4.3†
2.3‡
Appendix
Table S5: Simulation and optimization parameters. t is the trajectory length used to evaluate D , Δt the time step, γ the Langevin friction, T the thermostat temperature, ρ the density, Natoms the number of atoms simulated, K the number of independent trajectories used to estimate the gradient, and αD , αstruct the learning rates for the dynamical and structural loss terms.
Molecular dynamics simulations proceed by integrating the Langevin equations over many small femtosecond timesteps. This poses a challenge for estimating ensemble properties and transition dynamics that occur on much longer timescales. We introduce Langevin Flow Maps, which extend machine-learned force-fields to additionally learn the stochastic Langevin integrator. We show that Langevin Flow Maps enable large-timestep molecular dynamics and recover accurate dynamical properties of the system, while running an order of magnitude faster than current machine-learned force fields. Further, by training on a diverse molecular dataset, we demonstrate a path towards transferable Langevin Flow Maps.
Machine learning interatomic potentials (MLIPs) are commonly trained and evaluated by their ability to reproduce first-principles energies and forces. Practical value, however, is often determined by downstream processes such as structural relaxation. Much of MLIP literature is motivated by the expectation that improving force accuracy will produce correspondingly better downstream behavior. Although this expectation is natural, it may not hold in practice due to model inaccuracies. Here, we demonstrate that force accuracy and relaxation accuracy can be driven in opposite directions. Starting from pretrained MLIPs, we differentiate through relaxation trajectories and optimize the the final structures. This intervention produces increases in force-prediction errors while substantially reducing structural errors. Importantly, this represents a trade-off between two aspects of physical fidelity: the learned forces become less faithful to first-principles forces, while the resulting relaxed structures become more faithful to first-principles predictions. Rather than observing a discrepancy between local quality and downstream performance, we demonstrate that this discrepancy can be induced through optimization. Our findings suggest that MLIPs need not be optimized as approximations of first-principles forces, but can instead learn task-specific vector fields that guide relaxation trajectories toward more accurate final structures. By propagating supervision through complete relaxation trajectories, our framework captures dependencies between successive predictions that are absent when structure--force pairs are treated independently. More broadly, these results demonstrate that conventional force metrics can provide an incomplete assessment of downstream performance and highlights the importance of evaluating scientific machine-learning models within computational workflows.
Evan Dramko, Yizhi Zhu, Aleksandar Krivokapic +4
Department of Computer Science, Rice University, Houston, USA · Department of Materials Science and Nanoengineering, Rice University, Houston, USA · Rice Advanced Materials Institute, Rice University, Houston, USA +2
Classical force fields (FFs) remain the workhorse for large-scale simulations even as machine-learned interatomic potentials (MLIPs) approach ab initio accuracy. They decompose total configuration energies into simple effective interactions whose parameters are traditionally assigned based on atom or bond types, enabling efficient simulations but also limiting their ability to adapt across configurations. Recent machine learning approaches have improved the accuracy and transferability of bonded parameters in these FFs by inferring them as functions of local atomic environments, but still rely on empirical nonbonded parameters for practical simulations. In this work, we introduce a unified approach, grappa-fullFF, which learns both bonded and nonbonded parameters consistently and simultaneously from ab initio reference data. By incorporating physically inspired regularization via supervision of the electrostatic potential and an architecture that facilitates charge equilibration, our model recovers accurate electric response properties, achieves state-of-the-art accuracy on geometry optimization benchmarks, and reproduces the conformational sampling of both classical and existing machine-learned FFs, without relying on externally assigned nonbonded parameters.
Berkay Günes, Leif Seute, Jigyasa Nigam +1
Max Planck Institute for Polymer Research Mainz, Germany · Heidelberg University, Germany · Heidelberg Institute for Theoretical Studies, Germany +1