CUDA Spotlight: GPU-Accelerated Quantum Chemistry


This week’s Spotlight is on Professor Todd Martínez of Stanford.

Professor Martínez’ research lies in the area of theoretical chemistry, emphasizing the development and application of new methods which accurately and efficiently capture quantum mechanical effects.

Professor Martínez pioneered the use of GPU technology for computational chemistry, culminating in the TeraChem software package that uses GPUs for first principles molecular dynamics. He is a founder of PetaChem, the company that distributes this software.

NVIDIA: Todd, tell us about TeraChem.
Todd: TeraChem simulates the dynamics and motion of molecules, solving the electronic Schrodinger equation to determine the forces between atoms. This is often called first principles molecular dynamics or ab initio molecular dynamics.

The primary advantage over empirical force fields (for example, often used for protein structure) is that chemical bond rearrangements and electron transfer can be described seamlessly.

NVIDIA: Who are the users of TeraChem?
Todd: The primary users are academic researchers (from fields such as chemistry, materials and biology), but we are seeing increased interest from industry. Even though TeraChem was designed for ab initio molecular dynamics, it can also carry out simpler tasks such as optimization of the geometry of a molecular structure and calculation of reaction mechanisms.

Many people use TeraChem for these purposes, often referred to as quantum chemistry. Some of the most enthusiastic users have realized that TeraChem makes many simulations possible that were otherwise intractable. They have used TeraChem to optimize molecular structures for proteins, nanotubes, and minerals and to explore chemical reactions happening in these structures.

The protein BPTI (Bovine Pancreatic Trypsin Inhibitor) in TeraChem
The protein BPTI (Bovine Pancreatic Trypsin Inhibitor) in TeraChem

NVIDIA: How does TeraChem leverage GPU computing?
Todd: TeraChem was written for GPUs. I believe it remains the only quantum chemistry and/or ab initio molecular dynamics code which was designed for the GPU. The payoff from this redesign was remarkable – TeraChem is up to two orders of magnitude faster than similar programs designed for CPUs. This is bringing us much closer to the holy grail of computer-aided molecular design.

NVIDIA: When did you first see the promise of GPU computing?
Todd: Our interest in stream processing began around 2000. Our first efforts were focused on the Emotion Engine and Graphics Synthesizer in the PlayStation 2. We wrote a few key routines in assembler and ported the GAMESS quantum chemistry code to run on the PS2.

Writing in assembler was very tedious and the idea of rewriting all the code in assembler was unattractive. Thus, we were keeping close tabs on developments in GPGPU computing, which might be a more sustainable approach. Indeed, we were evaluating Brook as a possible avenue to expand that work.

Fortunately, we found out about NVIDIA’s plans to release CUDA from Professor Wen-mei Hwu at UIUC and were able to redirect these efforts into CUDA. Our first CUDA electronic structure code was written in late 2007, using a beta release of CUDA.

NVIDIA: What is unique about the TeraChem code?
Todd: We reformulated all the algorithms of quantum chemistry to map well onto GPU architectures. This implies a fair bit of precomputing to arrange the data so that the GPU can process it effectively. Because of this, TeraChem takes advantage of spatial locality more efficiently than other quantum chemistry packages. It also spends almost all of its execution time on the GPU – the CPU does very little work.

NVIDIA: In what ways is your team using CUDA?
Todd: All of our code development is now done with an eye towards stream processors and most of this is in CUDA. Unlike many who view the GPU as an accelerator for the CPU, we tend to see the CPU as a coprocessor for the GPU. Most of our computers are now loaded with eight GPUs in each node and we would be delighted to increase the GPU density even further. Reformulating algorithms to run on the GPU as much as possible has clearly been a winning strategy so far.

NVIDIA: Can you talk about how TeraChem is developing into a teaching tool?
Todd: Chemists often use physical model kits in order to visualize molecular structures. These are great learning tools, but the model kits only “know” a limited amount of chemistry. TeraChem gave us an opportunity to make a virtual model kit that knows about the electrons (and thus knows all of chemistry!).

We combined TeraChem with 3D visualization and force-feedback input devices so that students can “grab” atoms in a molecule and pull on them – the molecule will “pull back” via the haptic input device.

Students can learn chemistry by playing with molecules directly and they can feel the difference between strong and weak bonds. They also “feel” the difference between favorable and unfavorable reaction pathways. The key here was being able to match human and molecular time scales – this all works fluidly because TeraChem is able to do calculations fast enough so that one second of real time corresponds to several femtoseconds of molecular time.

NVIDIA: What are you looking forward to in the next 5-10 years?
Todd: Another one to two orders of magnitude improvement in the performance of electronic structure theory. We expect that a combination of hardware and algorithmic improvements will get us there. At that point, computer-aided molecular and materials design will be the new standard. This will have a tremendous impact on industry as well as academia.

In terms of industrial applications, we expect to be able to design polymers with tailored responses to external stimuli – for example, strengthening by chemical crosslinking as they are stressed to prevent damage. An example would be developing new molecular systems for efficiently converting sunlight into electricity or fuels.

[Editor’s Note: Learn more about GPU-based quantum chemistry at the GPU Technology Conference in March. Stanford graduate student Nathan Luehr will speak on Virtual Molecular Modeling Kits: Playing Games with Quantum Chemistry, on Thurs., March 27.]

Read more GPU Computing Spotlights.