Skip to main content

XRD-Rust

Compute powder X-ray diffraction (XRD) patterns using modified pymatgen’s XRDCalculator, with the performance-critical routines reimplemented in Rust, achieving typically more than ⚡10× speedup. The implementation further optimizes the original calculation workflow through SIMD vectorization and optional Rayon-based multithreaded parallelization. The larger and more complex your structure (more peaks and atoms), the greater the speedup gains.

The XRD-Rust follows the same notation as the XRDCalculator, with the only change being the renamed class, XRDCalculatorRust. Due to this, it can be easily implemented into existing workflows that use the original pymatgen package for powder XRD pattern calculations. Simply import the XRD-Rust package and replace the class name (see also example below).

XRDCalculatorRust(
    wavelength   = "CuKa",   # str or float — radiation wavelength
    symprec      = 0,         # float — symmetry precision in Angstroms (0 = disabled)
    debye_waller_factors = None,
    parallel     = False,     # bool  — enable multi-threaded execution via Rayon
    num_threads  = 4,         # int   — number of threads (only used if parallel=True)
    use_simd     = True,      # bool  — enable SIMD vectorization
)

XRD-Rust speed up

Benchmarks

Benchmark results (2θ range = 2–60° (Mo radiation), serial mode, SIMD) on two large crystallographic datasets demonstrate the following acceleration:

  • COD (515 181 structures): ⚡10.7× median speedup (median absolute deviation, MAD 4.2×)

  • MC3D (33 142 structures): ⚡12.6× median speedup (MAD 2.0×)

Full benchmarking details are available at: 📖 https://doi.org/10.1107/S1600576726005273 (or https://arxiv.org/abs/2602.11709)

If you like the package, please cite:

  • For XRD-Rust: Lebeda, Miroslav, et al. Rust-accelerated powder X-ray diffraction simulation for high-throughput and machine-learning-driven materials science. Journal of Applied Crystallography, 2026, vol. 59, Part 4. DOI: 10.1107/S1600576726005273.
  • For pymatgen: Ong, Shyue Ping, et al. Python Materials Genomics (pymatgen): A robust, open-source python library for materials analysis. Computational Materials Science, 2013, 68: 314-319.

How to install XRD-Rust

Tested on: Python 3.10, 3.12, 3.13
(Optional but recommended) Create and activate a virtual environment to avoid potential dependency conflicts:

python -m venv xrd-rust_venv  
source xrd-rust_venv/bin/activate  # On Windows use: xrd-rust_venv\Scripts\Activate.ps1

Install the package:

pip install xrd-rust

Example: Calculate powder XRD pattern

The following example loads a crystal structure from a CIF file ('structure.cif') and calculates its powder XRD pattern using the Rust-accelerated calculator. The pattern is computed with Cu Kα radiation over a 2θ range of 5 - 70°, with intensities normalized to a maximum of 100. Symmetry refinement is disabled (symprec=0), meaning the structure is used exactly as provided, without refining atomic positions for the found space group. The calculations are parallelized across 4 threads via the Rayon library and further accelerated using SIMD vectorization. The resulting pattern, including 2θ positions, normalized intensities, Miller indices, and reflection multiplicities, is saved to a CSV file.

from pymatgen.core import Structure
from xrd_rust_calculator import XRDCalculatorRust

# Load structure and calculate powder XRD pattern
structure = Structure.from_file("structure.cif")
calc = XRDCalculatorRust(wavelength="CuKa", symprec = 0,
    parallel = True, num_threads  = 4, use_simd = True)
pattern = calc.get_pattern(structure, scaled=False, two_theta_range=(5, 70))

# Save to file
with open("xrd_pattern.csv", 'w') as f:
    f.write("2theta,intensity,hkl,multiplicity\n")
    for i in range(len(pattern.x)):
        hkl_list = [tuple(h['hkl']) for h in pattern.hkls[i]]
        hkl_str  = str(hkl_list)
        mult     = sum(h['multiplicity'] for h in pattern.hkls[i])
        f.write(f"{pattern.x[i]},{pattern.y[i]},{hkl_str},{mult}\n")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

xrd_rust-0.3.5-cp313-cp313-win_amd64.whl (186.5 kB view details)

Uploaded CPython 3.13Windows x86-64

xrd_rust-0.3.5-cp313-cp313-manylinux_2_28_x86_64.whl (309.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.5-cp313-cp313-macosx_11_0_arm64.whl (274.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

xrd_rust-0.3.5-cp313-cp313-macosx_10_12_x86_64.whl (282.7 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

xrd_rust-0.3.5-cp312-cp312-win_amd64.whl (186.8 kB view details)

Uploaded CPython 3.12Windows x86-64

xrd_rust-0.3.5-cp312-cp312-manylinux_2_28_x86_64.whl (310.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.5-cp312-cp312-macosx_11_0_arm64.whl (274.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

xrd_rust-0.3.5-cp312-cp312-macosx_10_12_x86_64.whl (283.1 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

xrd_rust-0.3.5-cp311-cp311-win_amd64.whl (186.1 kB view details)

Uploaded CPython 3.11Windows x86-64

xrd_rust-0.3.5-cp311-cp311-manylinux_2_28_x86_64.whl (311.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.5-cp311-cp311-macosx_11_0_arm64.whl (275.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

xrd_rust-0.3.5-cp311-cp311-macosx_10_12_x86_64.whl (284.0 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

xrd_rust-0.3.5-cp310-cp310-win_amd64.whl (186.1 kB view details)

Uploaded CPython 3.10Windows x86-64

xrd_rust-0.3.5-cp310-cp310-manylinux_2_28_x86_64.whl (311.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.5-cp310-cp310-macosx_11_0_arm64.whl (276.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

xrd_rust-0.3.5-cp310-cp310-macosx_10_12_x86_64.whl (284.2 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

xrd_rust-0.3.5-cp39-cp39-win_amd64.whl (186.6 kB view details)

Uploaded CPython 3.9Windows x86-64

xrd_rust-0.3.5-cp39-cp39-manylinux_2_28_x86_64.whl (311.9 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.5-cp39-cp39-macosx_11_0_arm64.whl (276.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

xrd_rust-0.3.5-cp39-cp39-macosx_10_12_x86_64.whl (284.6 kB view details)

Uploaded CPython 3.9macOS 10.12+ x86-64

xrd_rust-0.3.5-cp38-cp38-win_amd64.whl (186.5 kB view details)

Uploaded CPython 3.8Windows x86-64

xrd_rust-0.3.5-cp38-cp38-manylinux_2_28_x86_64.whl (311.7 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.5-cp38-cp38-macosx_11_0_arm64.whl (276.1 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

xrd_rust-0.3.5-cp38-cp38-macosx_10_12_x86_64.whl (284.4 kB view details)

Uploaded CPython 3.8macOS 10.12+ x86-64

File details

Details for the file xrd_rust-0.3.5-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 af6dcc7c399f79c91fbdbe930b1ebb77ebd5d4aa3ce5df400ae25578583d7c4e
MD5 eff1e300277b70b8754ce5b703069e5d
BLAKE2b-256 030da6bda1c5531e5d14c301d59500aa4c9f4c05c54015f2fd7e6cb111a3ebc3

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 863ee23a04e4e418d1c963c9d3204f3e8ce638f58aba28225a96a7701f81bc67
MD5 2bdcda833eaaf77153a963435d73c2b0
BLAKE2b-256 8ba5b7f8e51d83966463b6cd125867f25ee0b555cd966a20edf8a13d9a8051e8

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 07fbf286d2aeb4493c7ba22d6742c1b2758fa37be44483e2380aec3eabc10891
MD5 5b5f6b1f4dcd60e76428904989dc1f5b
BLAKE2b-256 b5d7c06730b5378cbbcf647385779a022c3ce1a184507aadffa59c893ed9fd98

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0f92bc70208bc279b76a0d102ba10f3b0afcc05e414b5f1e211faa6e37d2080e
MD5 13357f08c5f02570c7e72b72b2e5bf58
BLAKE2b-256 adfef40d7aa8445d479c53102629596ced8190e51731829e0fd2ecb45dee0772

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a7f980a24fd2a9774371d5db59c4daaebb5c0268bf1a89ea20de25b64f52825a
MD5 64ef87dae2cfc42b608572771d70accb
BLAKE2b-256 d49568a7db7135ba4dd8de13a9095a589283828e8ea8cd68a9cf207257fe65f1

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 797a401507f0dc4676e35411d6b08bdfe21d7a1e685d293e32fe7d37e29bfaa6
MD5 edc0de4ed84511dde0e60d6d12061265
BLAKE2b-256 f9d329ffbcfa92a7848d4e7fc0471c704dc86d62cc89ac8cebf607110f6de1a2

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b3f996decd196de9bfe97f4d766cbd355c991bfa4601469f0ebad26f837e7fec
MD5 ee45c1e3fece5503f300a2c12616faae
BLAKE2b-256 35ac4e95b85f1a6368d9fe47d289a24f836ded526279aaa488032e20767b4856

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b315626e65dbac9f34dc950af01d07f7db434beee9b63f1e6c7fa37a75eed77e
MD5 ae4092a0f823b6bf8a0dd4f95d09cf1f
BLAKE2b-256 1800ba12f287da25e414b6aee8bf4972c26126ff2ceef3faf5bbec569369361d

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 13aa7e137d925b8535732b80bc2819c8ca107b8e709655af9c5446cfe914dc08
MD5 b3ac018ebfac1078c3c4dbde46cf7055
BLAKE2b-256 65400bc9d1c3c939c05e503571cc6a4bbeb0b610eac5ea7a75a79983c9f61537

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c2e50f6bbe921a8e0ed36636ee8bf88554317576f724b5daf5433f03e2bc2ebb
MD5 c0e33fa1beacda4738b032ec1caf7196
BLAKE2b-256 664eaed46e9b004da4fd586febbe83853e2cdfa5941659cf3b3360ab36ac3707

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 abb102b7c57200f9eca442b3ae70a073905a45261f8bda683c5a64dd0d375dcd
MD5 55edf91ca783775eeb66169be8a34501
BLAKE2b-256 2f4ef5e8abe19e0e52ce8dfa7b54287ab85a2b5eab2bdb6887f23763fb1ae867

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 df5f51311436d97865cb1802e94951c6766bd5f1ccc096683483466a365d6c9f
MD5 80ceb060ba46e2bf2f0cee0b1806b9b1
BLAKE2b-256 5e38532c3b643047130185b7074c7b0ced56f387eb9f09cc2e73a4d126c5ae19

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 01e68ad74e86dfde19d11ce472d1fc8847162d3d2f295789443f15dc4c704564
MD5 f3063dc0d1fe996aa8e8bbad67bd6751
BLAKE2b-256 2e7539b1a54b423b3b0a123728bc9156f8f2fee54ba494cbc05965f488590528

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f3d47fff980ccc478bcc578ee2fe072c317dbdd5cf1eb649c2159e836b95fed6
MD5 4797ea92010da65af4bea31abea979fb
BLAKE2b-256 0143177bd9c9ab259e11726a1a5a62ddb10176277c28b59dc88910687510a003

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3b3cd08b496fa3b2c7a0d694b8a293bc2dfda935d1b1361ca4389f6ae298dbce
MD5 fcc5f1f6e55c9a4210bc6494546ad586
BLAKE2b-256 92c19a8be04171607dcf78243c2be14329bbcc729fca9460eadcb63134e066c6

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b6222805a2e12e69574abd69b1de9f0aa56c115245a346f226aa7d5c3d19f26d
MD5 dbfde280760192c3eafb9fd62bb2ff78
BLAKE2b-256 7eb1a2b37c69a40f0c8859f929db5f63fec2e68f3d0387e56bf24bf8366fccc4

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: xrd_rust-0.3.5-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 186.6 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for xrd_rust-0.3.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 51652b1d6144387ccfc883113b25245257bac83212533997447e277d1ac05530
MD5 9c84a4c2f95fef17c3dd6933b6ac187a
BLAKE2b-256 ca64fd7657118ae8448a1db81e5e3c0cde9d12e8dbeb5d3e1da251d0a71f6ee1

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e7975bc72b828cd061d1fc4391516501e3edc42db05d9ae21dd48247aaaf625a
MD5 f2a1a30a5303a4d96a296b29b4ad1707
BLAKE2b-256 4a621395c6b71926456f6816ea8a678f561f454909d69b811c7bfde373dedeaf

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 537ed53b9dc08b59595ae1a46f679e2f147bc7fa19fcb0d991a41fc0d4044265
MD5 8f961020af54d4a3b5f01482c0710069
BLAKE2b-256 887af63eed8bea4af116acd267f2b21cf463257b5b9963da4a4e9781c19faca9

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp39-cp39-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 99f5743be64fee28577e817afc4ec0aa3576d820d28fdabf4a4689ac41f18daa
MD5 3faca673377dc91fdcec216ec24631c8
BLAKE2b-256 c7c628e7c06725c7f331c88a4246c34757b32682368702516efc7fb03df61223

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: xrd_rust-0.3.5-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 186.5 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for xrd_rust-0.3.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 fec71dbe3963120b5751c6e51732de757b4556d1719ac2677df37b139199414d
MD5 b4e8783f3540e6df3648bc910707ecae
BLAKE2b-256 93e819f9c75c469154b0d2050f5fc2effa7fbe2507f26c815abaf406cd48606c

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 473bd675059e8e2f5ab2735376442a1b93e7d2a1b43255d833f892a013b3965c
MD5 2e410ec04d0e620582804330cb403a15
BLAKE2b-256 2d9b6760b8bde56622eeb1e6dd5356a687f4725b6965ade66846e959fd9aa4c5

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 369a0fc1ed8d711f2efcfeb4b7b8cbd490a13b936b9c4bc7652b909c09ec5150
MD5 af012d924c467279175e38a123e4575a
BLAKE2b-256 81c67adc736222b373399385b30f936b4263776c6ddb8582d37329c762af60b5

See more details on using hashes here.

File details

Details for the file xrd_rust-0.3.5-cp38-cp38-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.3.5-cp38-cp38-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 539717a53266dd8391771857fc47b2e4dbfd2067d8ee4df420e96c7b60be2035
MD5 fe8be1728b4bae60ffaf8afbf775adb1
BLAKE2b-256 f533bafbf2caaef7b19e5f5698ea5255a3108beb54b619dbb96111728669f215

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.5 This release

24 files

0.3.4

24 files

0.3.3

24 files

0.3.2

18 files

0.3.0

18 files

0.2.1

23 files

0.2.0

15 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