Journal of Applied CrystallographyBioinformaticsPeer-reviewed journal article
TorchRef: An open-source PyTorch Framework for Crystallographic Refinement
Abstract
Macromolecular crystallographic refinement underpins structural biology, yet existing software packages often lack accessible, modular codebases amenable to rapid method development. Here, we introduce TorchRef, a PyTorch-based crystallographic refinement framework that exposes all refinable parameters, atomic coordinates, displacement parameters, occupancies, and scale factors to automatic differentiation. The framework implements FFT-based structure-factor calculations, the French-Wilson treatment of intensities, bulk-solvent modeling with established mask parameters, and stereochemical restraints from the CCP4 Monomer Library. A modular target architecture allows loss functions to be combined, weighted, and extended independently of the core refinement machinery. Validation against 1,000 PDB structures demonstrates that TorchRef-based refinement reproduces a median R-free within 1% of Phenix while maintaining comparable model quality. Structure factor calculation in TorchRef scales readily across multiple CPU cores and is over 100 times faster on modern GPUs than CCTBX. To showcase how modern methods like time-resolved crystallography can benefit from the flexibility that TorchRef provides, we implemented direct refinement of a typical time-resolved model against amplitude differences, a use case currently not explored by classic refinement programs. TorchRef is released under the MIT license with full API documentation and tutorials, providing an accessible platform for developing and testing new crystallographic refinement protocols. SynopsisTorchRef is an open-source PyTorch-based crystallographic refinement framework that exposes all refinable parameters to automatic differentiation, delivers GPU-accelerated structure-factor evaluation more than 100x faster than CCTBX, and enables new workflows, such as direct refinement against amplitude differences in time-resolved crystallography.
- Citations
- 0
- FWCI
- 0.00
- Field percentile
- 21th percentile
Reproducibility ledger
Nobody has reported trying to reproduce this paper yet. Did you replicate an experiment or run the code? Your report saves the next lab a week.
Sign in to file a reproducibility report.
Related papers
- Improved chemistry restraints for crystallographic refinement by integrating the Amber force field into Phenix
Nigel W. Moriarty, Pawel A. Janowski, … Paul D. Adams·Acta Crystallographica Section D Structural BiologyPeer-reviewed·Dec 20, 2019
- RELION-3: new tools for automated high-resolution cryo-EM structure determination
J. Zivanov, T. Nakane, … S. H. W. Scheres·bioRxiv·Sep 19, 2018
- Correcting Multiple Scattering Enables Dynamical Electron Crystallography in Standard Workflows
Denver R. Hopkins, Tim Low-Beer, … Michael W. Martynowycz·bioRxiv·Oct 27, 2026
- Including Crystallographic Symmetry in Quantum-based Refinement: Q|R#2
Min Zheng, Małgorzata Biczysko, … Pavel V. Afonine·Acta Crystallographica Section D Structural BiologyPeer-reviewed·Dec 20, 2019
- KNexPHENIX: A PHENIX-Based Workflow for Improving Cryo-EM and Crystallographic Structural Models
Suparno Nandi, Graeme L. Conn·Journal of Chemical Information and ModelingPeer-reviewed·Jun 9, 2026
- Real-space refinement in Phenix for cryo-EM and crystallography
Pavel V. Afonine, Billy K. Poon, … Paul D. Adams·Acta Crystallographica Section D Structural BiologyPeer-reviewed·May 30, 2018