Simulate X-ray crystallography diffraction data from atomic models.
Project description
synth-xtal
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
gemmiandreciprocalspaceshipfor 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.DataSetobjects 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.mtzfile (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:
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file synth_xtal-0.1.0.tar.gz.
File metadata
- Download URL: synth_xtal-0.1.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
872998137ed7bfa143bf24929681ef525677dc44fb1d828d9d37e69e3afebbf3
|
|
| MD5 |
b48eaf829506ca6e413f89bb63dfa402
|
|
| BLAKE2b-256 |
8eef524f34bec93a1e9371048481202161f9fc0dfd5b2274f5d89de2bd1a643a
|
Provenance
The following attestation bundles were made for synth_xtal-0.1.0.tar.gz:
Publisher:
publish.yml on elkins-lab/synth-xtal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
synth_xtal-0.1.0.tar.gz -
Subject digest:
872998137ed7bfa143bf24929681ef525677dc44fb1d828d9d37e69e3afebbf3 - Sigstore transparency entry: 1884982946
- Sigstore integration time:
-
Permalink:
elkins-lab/synth-xtal@79d13d1eddc8cea0e6e259cb8620c56bb27940fe -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/elkins-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@79d13d1eddc8cea0e6e259cb8620c56bb27940fe -
Trigger Event:
release
-
Statement type:
File details
Details for the file synth_xtal-0.1.0-py3-none-any.whl.
File metadata
- Download URL: synth_xtal-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
411f04eee3edca3ce8bac1e0be3e97655bac6da9155de8956f5043a9b1707667
|
|
| MD5 |
903a45e0df39f64e6ea062d69acdbbc9
|
|
| BLAKE2b-256 |
8e768b1779c80c606e12faebf4eec4be827c2225a2927f2accd811f52c17f4ed
|
Provenance
The following attestation bundles were made for synth_xtal-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on elkins-lab/synth-xtal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
synth_xtal-0.1.0-py3-none-any.whl -
Subject digest:
411f04eee3edca3ce8bac1e0be3e97655bac6da9155de8956f5043a9b1707667 - Sigstore transparency entry: 1884983099
- Sigstore integration time:
-
Permalink:
elkins-lab/synth-xtal@79d13d1eddc8cea0e6e259cb8620c56bb27940fe -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/elkins-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@79d13d1eddc8cea0e6e259cb8620c56bb27940fe -
Trigger Event:
release
-
Statement type: