Skip to main content

synth-xtal

codecov OpenSSF Best Practices PyPI version Python License: MIT Tests Ruff Checked with mypy

synth-xtal is a lightweight Python library for simulating X-ray Crystallography diffraction data (structure factors and MTZ files) from input atomic models (PDB/mmCIF files).

Extracted from the synth-pdb ecosystem, it provides a physically grounded, education-focused engine for reciprocal space simulation.


🧪 For Structural Biologists

  • Virtual Crystallography: Generate ideal $F_{calc}$ and $\phi_{calc}$ structure factors from structural models.
  • Automated Cell Generation: Transparently computes optimal bounding unit cells in $P 1$ for standalone peptides/proteins lacking periodic symmetry constraints.

🤖 For Machine Learning Researchers

  • Standard Integrations: Built directly on top of gemmi and reciprocalspaceship for native FFT acceleration and robust MTZ writing.
  • Multi-Model Support: Seamlessly handles NMR ensembles or MD trajectories by accurately averaging grid densities to simulate alternative conformations.
  • Educational Clarity: Simple, well-commented implementation of crystallographic density mapping — easy to audit and extend.

Features

  • Diffraction Simulation: Direct generation of complex structure factors from atomic coordinates using gemmi.DensityCalculatorX.
  • Ensemble Averaging: Calculates coherent scattering intensities over an ensemble of structural models.
  • Pythonic Data Structures: Outputs are formatted to reciprocalspaceship.DataSet objects for seamless downstream integration with standard ML/data-science tools (Pandas).

Installation

# Basic installation
pip install synth-xtal

# Installation for contributors/developers
pip install "synth-xtal[dev,test,docs]"

Command-Line Interface (CLI)

synth-xtal provides a simple CLI for rapid simulation:

# Basic simulation (outputs to MTZ format)
synth-xtal input.pdb -o simulated.mtz

# Simulation at a specific high-resolution limit (e.g., 1.5 Å)
synth-xtal input.pdb -o simulated.mtz --resolution 1.5

# Simulation with a custom padding margin for automatically generated unit cells
synth-xtal input.pdb -o simulated.mtz --margin 15.0

CLI Arguments

  • input: Path to PDB or mmCIF file.
  • -o, --output: Save structure factor data to an .mtz file (Required).
  • -d, --resolution: High resolution limit in Ångströms (default: 2.0).
  • --margin: Margin in Ångströms for the unit cell bounding box if the input lacks a defined unit cell (default: 10.0).

Quick Start

Python API

from synth_xtal.simulator import simulate_diffraction

# Calculate MTZ from a PDB or mmCIF file
simulate_diffraction(
    input_pdb="protein.cif",
    output_mtz="simulated_data.mtz",
    d_min=2.0
)

Tutorials

Try out synth-xtal interactively in Google Colab:

  • 01. Crystallography Basics: Open In Colab
  • 02. Experimental Validation (4LZT): Open In Colab
  • 03. Virtual Crystallography Lab: Open In Colab

Acknowledgements

synth-xtal was heavily inspired by the educational goals of the larger synth-pdb ecosystem and relies critically on:

  • gemmi - for core density calculations and FFT operations.
  • reciprocalspaceship - for MTZ manipulation and Pandas integration.

Release files for synth-xtal 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for synth-xtal 0.2.2
File Size Uploaded
synth_xtal-0.2.2.tar.gz 28.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for synth-xtal 0.2.2
File Interpreter ABI Platform
synth_xtal-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 36.5 kB

Release files / synth_xtal-0.2.2.tar.gz

Download URL synth_xtal-0.2.2.tar.gz
Size 28.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6cc2ab0e22b42935df707615421f998a94eb11cff6852d13e6e6a2b47c4cc848
BLAKE2b-256 checksum
How to use checksums
a5f189b3926bc93e0930c37041af7b3ef6f75300f6455ef8f8050eedb61b8d49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

Release files / synth_xtal-0.2.2-py3-none-any.whl

Download URL synth_xtal-0.2.2-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9e82d1fd8988e8b223b0b48d8fb2882740399ab14373fc954d52cc2f4537cf1
BLAKE2b-256 checksum
How to use checksums
2ffdc841193539d68748a5b01076fb0a97ef320c3ba67c224b228528faac89e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page