Intro to Optimization - Mathified

by Jonathon Vandezande · Nov 12, 2026

Our previous gamified blog on optimization ignored the math behind it. In this blog, we hope to make optimization theory more concrete while keeping it easy to understand. As such, we have provided a modicum of simple equations and lots of interactive graphics.

We will (without justification) assume that our potential-energy surface is smooth, so that near any point q\mathbf{q} it is well approximated by a Taylor-series expansion:

E(q+δq)=Eq+gq⊤δq+12δq⊤Hqδq+⋯E(\mathbf{q} + \delta\mathbf{q}) = E_q + \mathbf{g}_q^\top \delta\mathbf{q} + \frac12 \delta\mathbf{q}^\top \mathbf{H}_q \delta\mathbf{q} + \cdots

Here,

We can examine how each of these terms varies across the Müller–Brown PES.

Loading ...

The gradient vector (gq\mathbf{g}_q) shows us the instantaneous slope at the point, and its negative (−gq-\mathbf{g}_q) points the way a ball would start rolling on the surface. The Hessian matrix (Hq\mathbf{H}_q) describes the curvature. Its diagonal elements give how quickly the slope along each coordinate changes as you move along that coordinate, and its off-diagonal elements give how moving along one coordinate changes the slope along another. Higher-order tensors (generalizations of matrices to higher orders) show higher-order couplings between coordinates.

If we choose a small step δq\delta\mathbf{q} and contract it with the derivative tensors, then the actual contribution of each term drops off significantly on this PES, as the nnth-order term is contracted nn times with very small values and divided by n!n!.

Loading ...

For small steps, higher-order terms are often inconsequential, and truncating the Taylor-series expansion is a viable option. If we keep only the terms through second order, we get a quadratic model of the surface around q\mathbf{q}. Setting the model's derivative with respect to δq\delta\mathbf{q} to zero and solving gives the Newton step:

δq=−Hq−1gq\delta\mathbf{q} = -\mathbf{H}_q^{-1} \mathbf{g}_q

This step jumps to the stationary point of the quadratic model. That point is a minimum only when the Hessian is positive definite (all of its eigenvalues are positive); otherwise, the Newton step heads toward a saddle point or maximum.

In computational chemistry, gradients are usually only marginally more expensive than energies (roughly one extra SCF cycle for DFT and about twice the cost of an energy for NNPs), but Hessians are often 3N times more expensive than gradients. For minimization, the extra information gained from computing the Hessian is rarely worth the cost. Instead of computing the true Hessian at the start of an optimization, we often start with a guess (e.g., Schlegel, Lindh, or the identity matrix) and iteratively update it as we optimize. The most common update, BFGS (Broyden–Fletcher–Goldfarb–Shanno), uses the change in the gradient between consecutive steps to estimate the curvature along the step direction. It preserves positive definiteness if the initial Hessian is positive definite and each update satisfies the curvature condition.

Loading ...

Quasi-Newton minimization with BFGS works well in the approximately quadratic region of a potential well, where the true Hessian is positive definite. Near a transition state or in a non-quadratic region, two problems arise. First, a BFGS approximation initialized positive definite cannot learn negative curvature. The explorer skips updates that fail the curvature condition. An exact initial Hessian can already contain negative curvature, but skipped updates can still limit what BFGS learns. Second, higher-order terms can become significant.

The first problem is fixed by using Bofill updates, which can represent negative curvature, and rational function optimization (RFO) steps. RFO shifts the Hessian by a scalar, δq=−(Hq−μI)−1gq\delta\mathbf{q} = -(\mathbf{H}_q - \mu\mathbf{I})^{-1} \mathbf{g}_q, with μ\mu chosen below both zero and the lowest eigenvalue. The shifted Hessian is then positive definite, so the step goes downhill along every mode. The shift does not guarantee a short step: when the gradient has only a small component along a mode with negative curvature, the RFO step can be very long, so optimizers also cap it at a trust radius. A partitioned variant (P-RFO) instead goes uphill along the lowest mode to find a transition state. The second problem is often mitigated by taking smaller steps or using nonlinear coordinate transforms.

The explorer below draws all three steps from the exact Hessian at a point you choose. Turn on the quadratic model to see its contours: ellipses in a well and hyperbolae where the Hessian is indefinite. In a well, the Newton and RFO steps point in nearly the same direction, while P-RFO climbs along the lowest mode. Where the Hessian is indefinite, as it is near a saddle point, Newton and P-RFO both step towards the model's saddle point, while RFO steps downhill.

Loading ...

Further improvements can be made by taking into account the unique nature of molecular systems. Modern computational-chemistry optimizers generate initial guess Hessians that use empirical estimates for the second derivatives of bond stretches, angle bends, and dihedral twists (Schlegel, 1984). Nonlinear transformations to internal coordinates based on these stretches, bends, and twists can reduce anharmonic coupling between molecular motions, helping the quadratic approximation remain accurate over larger displacements and allowing optimizers to take larger steps (Fogarasi et al., 1992). For nonbonded species, whole-body translational and rotational coordinates are also added (Wang and Song, 2016). Further refinements can be made to how these transformations are applied or how steps are taken. These tricks have been added to the Rowan optimizer but are beyond the scope of this blog.

For fun minigames showcasing optimization theory, including a transition-state search, see our companion blog Intro to Optimization - Gamified.

Banner background image

Start running calculations in minutes!

Our platform lets you submit, view, analyze, and share calculations using cutting-edge methods trusted by hundreds of leading scientists. We give every new user 500 free credits to start, plus more every week. Making an account and running your first calculation takes only seconds: start using Rowan today!

Start computing →

What to read next

Intro to Optimization - Gamified

Intro to Optimization - Gamified

Minigames on the Müller–Brown PES to introduce the difficulties experienced during optimization.
Nov 12, 2026 · Jonathon Vandezande
Returning from Retreat

Returning from Retreat

the fruits of our time in the Finger Lakes; a bountiful harvest of research miniblogs; manifold platform improvements
Nov 9, 2026 · Ari Wagen, Corin Wagen, Spencer Schneider, Zach Fried, Jonathon Vandezande, and Eli Mann
Do Boltz-2's Structure and Affinity Predictions Agree?

Do Boltz-2's Structure and Affinity Predictions Agree?

Comparing Boltz-2's initial and affinity-stage structures across 600 complexes, and testing how pose differences affect predicted affinity.
Nov 9, 2026 · Zachary Fried
Building a Frontier Lab for Chemistry: A Conversation With Hatem Helal

Building a Frontier Lab for Chemistry: A Conversation With Hatem Helal

A conversation with Hatem Helal, the founder of Potential Sciences.
Nov 6, 2026 · Corin Wagen
Modeling Carbonyl–Olefin Metathesis with Neural Network Potentials

Modeling Carbonyl–Olefin Metathesis with Neural Network Potentials

Reproducing a tricky mechanistic result from grad school with LLMs and NNPs.
Nov 2, 2026 · Corin Wagen
Do Co-folding Models Notice When You Change the Pocket?

Do Co-folding Models Notice When You Change the Pocket?

Running published pocket-mutation tests on six co-folding models in Rowan.
Nov 2, 2026 · Spencer Schneider
Modeling Selectivity with Low-Cost Binding-Affinity Methods

Modeling Selectivity with Low-Cost Binding-Affinity Methods

Exploring whether Vina, Gnina, Boltz, Nesso, or UMA can capture trends in JAK1/JAK2 selectivity.
Oct 28, 2026 · Ari Wagen
Making FEP Better

Making FEP Better

RESP charges, per-ligand custom forcefields, & cofactors in FEP; natural transition orbitals and transition densities; probing LLM capabilities in folding proteins; design for nighthawks
Oct 20, 2026 · Corin Wagen, Eli Mann, Jonathon Vandezande, Ari Wagen, and Ishaan Ganti
Persistent Hydration Sites and Water Exchange in Daraxonrasib Simulations

Persistent Hydration Sites and Water Exchange in Daraxonrasib Simulations

A site can stay occupied even as individual water molecules come and go.
Oct 19, 2026 · Ishaan Ganti
Testing Binding-Affinity Prediction in Rowan

Testing Binding-Affinity Prediction in Rowan

Benchmarking single-point interaction energies and ML affinity models in Rowan's binding-affinity workflow on the JACS set, and how much pose optimization and pocket selection matter.
Oct 13, 2026 · Zachary Fried