MP-NeRF: A Massively Parallel Method for Accelerating Protein Structure Reconstruction from Internal Coordinates

Eric Alcaide, Stella Biderman, Amalio Telenti, M. Cyrus Maher

Abstract

The conversion of proteins between internal and cartesian coordinates is a limiting step in many pipelines, such as molecular dynamics simulations and machine learning models. This conversion is typically carried out by sequential or parallel applications of the Natural extension of Reference Frame (NeRF) algorithm. This work proposes a massively parallel NeRF implementation which, depending on the polymer length, achieves speedups between 400-1200x over the previous state-of-the-art. It accomplishes this by dividing the conversion into three main phases: parallel composition of the monomer backbone, assembly of backbone subunits, and parallel elongation of sidechains; and by batching these computations into a minimal number of efficient matrix operations. Special emphasis is placed on reusability and ease of use. We open source the code (available at https://github.com/EleutherAI/mp_nerf ) and provide a corresponding python package.

Introduction

In computational biology, proteins are represented in two primary ways: Cartesian coordinates (x, y, z positions of every atom) and internal coordinates (bond lengths, bond angles, and dihedral angles). While Cartesian coordinates are essential for visualization and rigid-body rotations, internal coordinates are the "natural language" of molecular forces and interactions.

The challenge lies in "reverse translation"—converting internal coordinates back into 3D Cartesian space. Traditionally, this is a sequential process: to know where atom C is, you must first know the positions of atoms A and B. This serial dependency creates a massive computational bottleneck, especially for long protein chains. As machine learning models (like those predicting protein folding) become more complex, they require thousands of these conversions, making the slow, sequential "Natural extension of Reference Frame" (NeRF) algorithm a major drag on performance. MP-NeRF (Massively Parallel NeRF) introduces a parallel algorithm to eliminate this bottleneck, achieving a staggering 400x to 1200x speedup over previous state-of-the-art methods.

Methods

The MP-NeRF algorithm breaks the sequential chain by dividing the reconstruction into three distinct, parallelizable phases:

  1. Parallel Monomer Composition: Instead of building the whole backbone atom-by-atom, the algorithm builds the backbone fragment of every amino acid in the chain simultaneously.
  2. Backbone Assembly: These independent fragments are then joined together using efficient "roto-translation" operations. This involves batched matrix multiplications to align the fragments and a cumulative sum to position them correctly in 3D space.
  3. Parallel Sidechain Elongation: Once the "spine" (backbone) is assembled, all sidechains (the "arms" of the amino acids) are grown in parallel.
Overview of the MP-NeRF algorithm: (a) parallel monomer composition, (b) backbone assembly via roto-translation, and (c) parallel sidechain elongation.

The implementation is built using PyTorch, ensuring the entire process is differentiable. This allows the reconstruction step to be integrated directly into the training loops of deep learning models, where gradients need to flow back from the 3D structure to the input parameters.

Key Results

The primary evaluation metric for MP-NeRF was computational speed across varying protein lengths (from 114 to 1000 residues). Compared to the previous state-of-the-art (Bayati et al.), MP-NeRF achieved speedups between 400x and 1200x.

Performance comparison of MP-NeRF against previous state-of-the-art (SOTA) and pNeRF across various protein lengths.

For a protein with 1,000 residues, the previous SOTA took ~18.66 seconds to reconstruct. MP-NeRF completed the same task on a standard laptop CPU in just 0.0153 seconds. Interestingly, the authors found that for many protein lengths, the CPU implementation was faster than the GPU version. This is attributed to the overhead of data transfer between the CPU and GPU and the fact that modern CPUs have highly optimized vector instructions (SIMD/AVX) that handle the "assembly" phase more efficiently than a GPU's lower-clock-speed cores.

Beyond speed, the algorithm maintains high numerical stability. Even after 1,000 "round-trip" cycles (converting from Cartesian to internal and back), the error (RMSD) remains remarkably low and stable (~0.03 Å).

Discussion and Limitations

MP-NeRF significantly lowers the hardware barrier for high-speed protein reconstruction. By optimizing for CPUs, it eliminates the strict requirement for expensive GPU hardware for this specific task. However, some limitations remain:

  • Python Latency: The Python wrapper introduces overhead; a pure C++ implementation could potentially double or triple the current speed.
  • Ring Simplification: To maintain a clear parallel path, the algorithm simplifies molecular rings (like those in Proline) by "masking" one bond. While sufficient for point cloud generation, specific connectivity may need handling for certain physics simulations.
  • Scaling: While optimized for proteins, the GPU implementation might show more significant advantages for even larger structures, such as long strands of nucleic acids (DNA/RNA).

The code and corresponding Python package are available at https://github.com/EleutherAI/mp_nerf.

Summary updated

Abstract

Abstract The conversion of proteins between internal and cartesian coordinates is a limiting step in many pipelines, such as molecular dynamics simulations and machine learning models. This conversion is typically carried out by sequential or parallel applications of the Natural extension of Reference Frame (NeRF) algorithm. This work proposes a massively parallel NeRF implementation which, depending on the polymer length, achieves speedups between 400-1200x over the previous state-of-the-art. It accomplishes this by dividing the conversion into three main phases: parallel composition of the monomer backbone, assembly of backbone subunits, and parallel elongation of sidechains; and by batching these computations into a minimal number of efficient matrix operations. Special emphasis is placed on reusability and ease of use. We open source the code (available at https://github.com/EleutherAI/mp_nerf ) and provide a corresponding python package.
BibTeX
@article{alcaide2022mp,
  author = {Eric Alcaide and Stella Biderman and Amalio Telenti and M. Cyrus Maher},
  title = {{MP-NeRF: A Massively Parallel Method for Accelerating Protein Structure Reconstruction from Internal Coordinates}},
  journal = {J. Comput. Chem.},
  year = {2022},
  doi = {10.1002/jcc.26768},
}
Figure