TorchRef Documentation

A PyTorch-based crystallographic refinement library

TorchRef is a crystallographic refinement package built entirely on PyTorch. Autograd and GPU acceleration make it composable with machine-learning workflows and cheap to extend with new targets, restraints, and optimizers.

It is mainly a library to build and experiment with, not a replacement for mainline refinement programs on standard problems.

Key Features

  • Native PyTorch Integration: built on nn.Module

  • Automatic Differentiation: define a forward pass, get gradients

  • Modular Architecture: composable targets, restraints, optimizers

  • GPU Acceleration: CUDA and Apple Silicon (MPS)

  • State Management: full state_dict support for checkpointing

Development

Indices and tables