Back

TorchRef: An open-source PyTorch Framework for Crystallographic Refinement

Weinert, T.; Standfuss, J.; Seidel, H. P.

2026-05-16 bioinformatics
10.64898/2026.05.13.724821 bioRxiv
Show 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.

Matching journals

The top 6 journals account for 50% of the predicted probability mass.

1
Nature Communications
4913 papers in training set
Top 10%
14.7%
2
Structure
175 papers in training set
Top 0.1%
12.3%
3
Protein Science
221 papers in training set
Top 0.1%
6.8%
4
Acta Crystallographica Section D Structural Biology
54 papers in training set
Top 0.1%
6.8%
5
Nature Methods
336 papers in training set
Top 2%
4.8%
6
Bioinformatics
1061 papers in training set
Top 4%
4.8%
50% of probability mass above
7
Journal of Molecular Biology
217 papers in training set
Top 0.5%
4.0%
8
Nature Biotechnology
147 papers in training set
Top 2%
4.0%
9
Science
429 papers in training set
Top 9%
3.6%
10
PLOS ONE
4510 papers in training set
Top 39%
3.6%
11
Journal of Structural Biology
58 papers in training set
Top 0.4%
3.1%
12
Proceedings of the National Academy of Sciences
2130 papers in training set
Top 24%
2.7%
13
Communications Biology
886 papers in training set
Top 9%
1.7%
14
Cell Systems
167 papers in training set
Top 7%
1.7%
15
Bioinformatics Advances
184 papers in training set
Top 3%
1.5%
16
Nucleic Acids Research
1128 papers in training set
Top 13%
1.3%
17
Nature Computational Science
50 papers in training set
Top 1%
1.2%
18
Nature
575 papers in training set
Top 14%
0.9%
19
Scientific Reports
3102 papers in training set
Top 70%
0.9%
20
Advanced Science
249 papers in training set
Top 17%
0.9%
21
Communications Chemistry
39 papers in training set
Top 0.8%
0.9%
22
eLife
5422 papers in training set
Top 54%
0.9%
23
The American Journal of Human Genetics
206 papers in training set
Top 3%
0.9%
24
Nature Genetics
240 papers in training set
Top 7%
0.8%
25
Journal of Chemical Information and Modeling
207 papers in training set
Top 3%
0.7%
26
PLOS Computational Biology
1633 papers in training set
Top 25%
0.7%
27
BMC Bioinformatics
383 papers in training set
Top 7%
0.7%
28
Proteins: Structure, Function, and Bioinformatics
82 papers in training set
Top 1%
0.6%