Mathematicians Unleash Multifold Speed Boost for Supercomputer Simulations of Molecules

By leveraging a classical mathematical function in simulations of molecular behavior, researchers at the Simons Foundation’s Flatiron Institute drastically sped up the simulations while maintaining the same accuracy.

An atomistic molecular dynamics simulation of a dense ionic liquid made of LiTFSI — a key lithium salt used to study next-generation battery electrolytes. Each sphere represents an atom, with colors distinguishing lithium ions and atoms in the TFSI anions. The motion illustrates how ions and their local environments continually rearrange and interact within the electrolyte. The movie was made from a molecular dynamics simulation of a 1 million-atom system. Jiuyang Liang/Flatiron Institute

More than 20 percent of the workload on the world’s 500 fastest supercomputers is spent simulating how atoms and molecules move — with applications ranging from material design to identifying drug interactions to understanding protein folding.

By leveraging a classical mathematical function, researchers at the Simons Foundation’s Flatiron Institute developed a new method that enables these simulations to run 2.5 to seven times as fast — all without sacrificing accuracy. For the most popular software package for molecular dynamics simulations, GROMACS, the researchers achieved a fivefold speed increase in simulations run at high accuracy.

The new method can be rapidly and easily integrated into existing software workflows, meaning the field could soon see drastically reduced time and energy demands for the simulations. The researchers present their breakthrough in a paper published online May 21 in Nature Communications.

“There are so many fields in science that rely on molecular simulations that can now take less energy and computing time,” says the study’s senior author, Shidong Jiang, a senior research scientist at the Flatiron Institute’s Center for Computational Mathematics (CCM). “We think this work is going to have a broad impact.”

The CCM’s new work “holds tremendous potential to meaningfully accelerate molecular dynamics workloads — a field that for the past decade has only seen incremental improvements in speed,” says Anthony Costa, director of digital biology at Nvidia, who was not involved in the study. “The work is a testament to the importance of applied mathematical research and its enormous impact in multiple domains, including but not limited to life sciences and materials science.”

Jiang worked on the study with lead author Jiuyang Liang — a CCM affiliate research fellow and a researcher at Shanghai Jiao Tong University — as well as Libin Lu, a CCM software engineer; Alex Barnett, a CCM project leader; and CCM Director Leslie Greengard.

Dancing Molecules

Molecular dynamics simulations model the behavior of millions of molecules in a box, where each molecule is composed of multiple atoms. “We try to simulate the evolution of the system — say a protein in a box of water — as a function of time,” says Pilar Cossio, a Flatiron Institute senior research scientist who uses molecular dynamics simulations as part of her work.

The challenge comes with the time scales involved. Like a video game rendering an environment, molecular dynamics simulations chop time up into small slices. While a video game might run at 60 video frames per second of gameplay, capturing the vibrations of molecular bonds requires around 500 trillion time slices per second.

That quickly adds up, even when most of the frequently studied scientific processes take just a few microseconds or milliseconds. For a simulation to be meaningful, it can require as many as a trillion steps. “Even with great hardware, we are limited to hundreds of nanoseconds a day, which gets us to microseconds in weeks,” says Sonya Hanson, a Flatiron Institute research scientist who also works with molecular dynamics simulations.

Speeding Things Up

It’s not hard to imagine why such simulations are so computationally intensive. The simulations must account for the pushing and pulling of the charged particles that make up the molecules. These long-range ‘electrostatic forces’ mean that “we basically have to calculate the distances between all of the atoms in this big box,” Cossio says.

“If you do this naively, you end up with a number of operations equal to the number of atoms squared,” says Jiang. There are shortcuts, though. Mathematicians have invented and adapted algorithms such as the fast Fourier transform and, later, the fast multipole method (co-invented by Greengard), both of which reduce the required operations. Even with those advancements, long-range force calculations in molecular dynamics simulations have continued to consume vast computational time and resources.

“We saw potential to improve a tool that has been unquestioned for decades,” Barnett says.

An infographic titled “Speed Bumps” explaining a mathematical method that accelerates molecular dynamics simulations by smoothing electrostatic energy landscapes. The left side contains text describing three concepts: (1) a computational bottleneck, where simulations must calculate pairwise electrostatic forces among many atoms; (2) a jagged terrain, where positively charged atoms create sharp peaks and negatively charged atoms create deep valleys in the electric potential; and (3) a smooth operator, where a refined “bump function” smooths these spikes to make calculations easier and faster. On the right, a diagram of orange positive and blue negative atoms connected by lines illustrates pairwise attraction and repulsion between charged particles. Below, a graph compares a spiky electrostatic potential with sharp peaks and valleys to a smoother, wavy potential that approximates the same landscape while reducing computational cost. The overall message is that smoothing the potential allows simulations to avoid directly summing all pairwise forces, greatly speeding calculations without sacrificing accuracy.
Lucy Reading-Ikkanda/Simons Foundation

The CCM researchers turned to a set of mathematical functions known as prolate spheroidal wave functions, which were invented in 1880 and later applied to signal processing at Bell Labs in the 1960s. The functions make two critical decisions in the simulations: how to split electrostatic interactions between atoms into short-range and long-range components and how to spread atomic charges onto a grid for the long-range force calculation.

For these tasks, the functions need to be both spatially localized (confined to a narrow region) and as smooth as possible (having the minimum allowed spatial frequency range, or ‘bandlimit’). These are seemingly conflicting demands that the prolate function satisfies much better than previously used functions.

“It took knowing the mathematical literature about the right way to do splits and spreading,” combined with knowing about the bottlenecks in molecular dynamics simulations, Barnett says.

“Something I learned from Leslie [Greengard],” Jiang says, “is that as computational mathematicians, our job is to give the user the most accurate solution in the shortest time. Sometimes an advance in one field — in this case, molecular dynamics — comes from people who are outside the discipline.”

The researchers ensured that the new code could be seamlessly integrated into the code of the most widely used software packages, such as LAMMPS, GROMACS and OpenMM.

“We needed to convince people that our method can beat the best ones out there,” says Jiang, adding that their code has officially been accepted by the LAMMPS developers.

Record-Breaking Speed

The researchers tested the functions to simulate molecular dynamics in several different systems, including a collection of water molecules, a protein system important in immunity, and a lithium-ion solution used in batteries. In each case, the new method completed the tests 2.5 to seven times as fast.

“We did have this lurking fear that even though this was clearly a mathematically better idea, what if we missed something in thinking about applying it? But it worked out as we anticipated,” Greengard says.

The findings underscore the importance of computational mathematics and out-of-the-box thinking. Says Greengard, “The Flatiron is a place where we have both the freedom to carry out and the recognition for doing this kind of interdisciplinary work.”

Information for Press

Recent Articles