Skip to main content

Fast XRD pattern calculator with Rust acceleration (5-10x faster than original pymatgen implementation)

Project description

XRD-Rust

Compute powder X-ray diffraction (XRD) patterns using modified pymatgen’s XRDCalculator, with the performance-critical routines reimplemented in Rust, achieving an average ⚡ 4–6× speedup. 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).

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

  • COD (515 181 structures): ⚡ 6.1 ± 4.6× average speedup, up to 719× faster (1437 min (original pymatgen implementation) → 2 min (Rust-accelerated))

  • MC3D (33 142 structures): ⚡ 4.7 ± 1.6× average speedup, up to 25× faster (34.9 s → 1.4 s)

Full benchmarking details are available at: 📖 https://arxiv.org/abs/2602.11709

If you like the package, please cite:

  • For XRD-Rust (arXiv): LEBEDA, Miroslav, et al. Rust-accelerated powder X-ray diffraction simulation for high-throughput and machine-learning-driven materials science. arXiv preprint arXiv:2602.11709, 2026.
  • 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 it (tested on Python 3.12)

pip install xrd-rust

Example: Calculate powder XRD pattern

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")
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\n")
    for i in range(len(pattern.x)):
        hkl = str([tuple(h['hkl']) for h in pattern.hkls[i]])
        f.write(f"{pattern.x[i]},{pattern.y[i]},{hkl}\n")

Project details


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.4-cp313-cp313-win_amd64.whl (187.4 kB view details)

Uploaded CPython 3.13Windows x86-64

xrd_rust-0.3.4-cp313-cp313-manylinux_2_28_x86_64.whl (315.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.4-cp313-cp313-macosx_11_0_arm64.whl (275.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

xrd_rust-0.3.4-cp313-cp313-macosx_10_12_x86_64.whl (284.1 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

xrd_rust-0.3.4-cp312-cp312-win_amd64.whl (187.9 kB view details)

Uploaded CPython 3.12Windows x86-64

xrd_rust-0.3.4-cp312-cp312-manylinux_2_28_x86_64.whl (315.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.4-cp312-cp312-macosx_11_0_arm64.whl (275.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

xrd_rust-0.3.4-cp312-cp312-macosx_10_12_x86_64.whl (284.5 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

xrd_rust-0.3.4-cp311-cp311-win_amd64.whl (187.2 kB view details)

Uploaded CPython 3.11Windows x86-64

xrd_rust-0.3.4-cp311-cp311-manylinux_2_28_x86_64.whl (316.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.4-cp311-cp311-macosx_11_0_arm64.whl (277.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

xrd_rust-0.3.4-cp311-cp311-macosx_10_12_x86_64.whl (285.6 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

xrd_rust-0.3.4-cp310-cp310-win_amd64.whl (187.4 kB view details)

Uploaded CPython 3.10Windows x86-64

xrd_rust-0.3.4-cp310-cp310-manylinux_2_28_x86_64.whl (316.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.4-cp310-cp310-macosx_11_0_arm64.whl (277.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

xrd_rust-0.3.4-cp310-cp310-macosx_10_12_x86_64.whl (285.7 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

xrd_rust-0.3.4-cp39-cp39-win_amd64.whl (187.7 kB view details)

Uploaded CPython 3.9Windows x86-64

xrd_rust-0.3.4-cp39-cp39-manylinux_2_28_x86_64.whl (317.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.4-cp39-cp39-macosx_11_0_arm64.whl (277.8 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

xrd_rust-0.3.4-cp39-cp39-macosx_10_12_x86_64.whl (286.2 kB view details)

Uploaded CPython 3.9macOS 10.12+ x86-64

xrd_rust-0.3.4-cp38-cp38-win_amd64.whl (187.6 kB view details)

Uploaded CPython 3.8Windows x86-64

xrd_rust-0.3.4-cp38-cp38-manylinux_2_28_x86_64.whl (317.0 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.4-cp38-cp38-macosx_11_0_arm64.whl (277.6 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

xrd_rust-0.3.4-cp38-cp38-macosx_10_12_x86_64.whl (286.0 kB view details)

Uploaded CPython 3.8macOS 10.12+ x86-64

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5ca333e7f7581fb603bc9dc48936ddc08584498e652ce8da80d65d07b19773db
MD5 74e0f203cebde1c24bcf82c16d6dad06
BLAKE2b-256 7038da8a30dc0edc581f0d6a8c7cfdc59da80a7022d49a24f0836ac1a59fe9ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7b2da7d46e7f17719b5a5de0eaa8c27ef4863cf3ab7444f59419486936e46345
MD5 1536f2d84b8727c71f23e6e86e6dfb08
BLAKE2b-256 deb9e086e428778325608bdb21e3b66d44c19bb49ac3e4028dc024db7e4500e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 402da64bb61edb1afa16edaa5d541ecd7ad3287967fa96498eaa5b65d1971766
MD5 1538d3745b3a4be52cfcb2977e18bde4
BLAKE2b-256 54bcf89747ed8af7e276d8faa0059e95fb1d2c8d16eb866b63d7073eb8ee8624

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f6f9f7e8e9b0bbfa41b78db63a9fe1a90447cef026b003c679ff2f9c46528ef9
MD5 27b63e78ca568f4784e5b02254d619b5
BLAKE2b-256 435124a2f8a29abbc55de144b23b8b41a86db47c7178f7dcf5149369254d2664

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9f188b296dd8dc84ff971c5a0e9e0c9045c6c19f84716fbf2259c5ef21879db5
MD5 5034b2fa63f153534e54ea836234311c
BLAKE2b-256 68b89440b1cb586aa62b50c611adcd46ae5aaaddd24e8cac463fdcdfa0ac1a00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d2917f8fdda1aad7fa944c4ce40df74799c2711eaa72ff5d94034e2b179eb125
MD5 24a4b3a9d151898a637853442ece830e
BLAKE2b-256 8d84b6e831eb79cc23ee327efdcf63dce7bff2f19d18aeef2932406804c10420

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6bf768e41d6c3fa62277375fe608b3ddb24f689910dd6125333d17d848fb6901
MD5 e9aef3aa86fd1d74adbe34177450b80b
BLAKE2b-256 993ef6e70330e95bce65a2753b2a29ccf760ac196fbdb1e2d590cea4e5355e97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 571ba31be9ef720b2bdb9078df1da0abc9c8c19f48f9de84f2e57b3f55fc1e1f
MD5 5412723fd1d1ba41aa96ed1d429f359f
BLAKE2b-256 0a2bca632a7e774c051615da8a2c0ad044bffa197d7f480000384c0c61d9aaa3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f611f45c7de73fdc73b31f2815bbc3c18e9731fa2a6cd2616f7da3b41d1bcce7
MD5 c9717f21b47893d9a624fc626d981f0c
BLAKE2b-256 ff27fec0efd99a19b4b166aa01625a5472182578f317db53177c2cb76767133d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a9c81c5f269c20b51b1e8020b6602ba20b518eb7fef02751563726e9a17b8903
MD5 c94b3487aa7729c66527695a173fb58c
BLAKE2b-256 d84893d4c4b517cd45d8e57014afde633d3e11365cd2dfad5201638cb86186f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 04d51901e7760b66912ae69696aec7399a0b128c702b3266778cc83292445fbf
MD5 ca3a2f3ce7b54a3135e2e867a32ff87d
BLAKE2b-256 1e667679b590c95eddb7e0ee04c778d29b14bb498ee39b538c2b6c9cc94a98e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 27a8f9c8c405f6ffe578f268579465a2e8e862dee872264d58a0775879a6c2b5
MD5 683ed9cd0be71b4c81aeeb328b2cc8da
BLAKE2b-256 897ea04bc21b2dc9cc7972894642e5774092628da9fd65ed30d15c8913fb5241

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b6a6ea0d374e7ea820829f74706564db73abe7184f11031ccd0b2cab1f90ba5c
MD5 8635985f7fe934b92a9f6cea6d8c1365
BLAKE2b-256 d4200d04e41aae302c5da14c5aef778de9f1c0d7ca51290ec716337e944e51c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 88bf6515ee7e332f83567feb5aec52556b6ecbebb637bc077b32583f718e09e3
MD5 92bd8ef1e2416135b42cf99e370dbce3
BLAKE2b-256 cd3445a210106b10b86209b5fbd30b366ec56aec8030ada075ee2f2a3c16dd8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 99236b2ff4edec3258d92a6e2ce9d276110579f78836ab676246e5f5a5cf32a9
MD5 7c4c25c7191280bbe84d32ba32b39914
BLAKE2b-256 cffa97f400b83bd89300895176c84558441cf03a7973e82695010795d8b76ac2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 89843ebf05fcb2cf5576cfaa8960e4fb2050951b2656b4caf2f6b7d7d0f96b45
MD5 5f06f341ecb7936e78dc630ab753f7d4
BLAKE2b-256 68414ebc0c93260e0933ea81ab7abdf39c9e6ff1b0d82bc48609b6e4fe73d2b5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for xrd_rust-0.3.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6a4a26fff5a39fae47b85c89093eec53def3c326349028f30c5bbc8d34790c39
MD5 015575cf3f0571068ddebb92eb2687b5
BLAKE2b-256 8341553ef3c8ef9cd5391250bebcbcab43e4aba0196558f66b5ed05ba8c9e2c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fd0297da219c6df5cad7935185a833d7638d9cb4aea143b777f37cc30b07a190
MD5 028dc896a58d09560bcb4018ac260eb7
BLAKE2b-256 fdf908a0d6bd83c32a698cd7df0097632a089a4338c4a2b832cd837269a7daa9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 19b57c3937a5955b50e35a2406d9f1001a07e7ea0849a62f4454258c4085652f
MD5 6db9d1995f1ce7e0f567332d9ea4882d
BLAKE2b-256 89b9ec198c9794001fdca87465c8f3adef09bab88653450ab2c61b89eb4f77f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 20683da8a383a351031570ac4d290164ee2aa348edddf2bc381b4d3a3b9f3e28
MD5 80c88e13c811c0688f1f5eb80041ce62
BLAKE2b-256 521f633351e9c27f8445c6d29daa4c22cc6f376d3898fc0303a5d103cf44b59c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for xrd_rust-0.3.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 8383b8ff49a761836436bc9111974cc8d99ae13c2faab75ffd2592dfb0c8bd25
MD5 cd3c9455730329ed947ebf0f853e6388
BLAKE2b-256 54c71ead87f278076eb1c45d65343b38485b0b2fd5b2bb20d6b3a657423d1dc2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 562e94ebaa3d816576dea18636e1fdb35b12d51798b2f43d531349e17f52bf7b
MD5 03a8957ba085e84da8eb481e4a326b98
BLAKE2b-256 b4d5072e37033fdb64d33d98d35b9e67b31b29bdbc02426571177d3ff2c19ec8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0688c30a33abc70e1da502382d0c3ff79e16cfcfdbc47504d18bee4e715cba81
MD5 364f6c29d8a232faff1faa291c7d430e
BLAKE2b-256 50ebd1054390dde802d359983393ac716ad40a406e0b04b1e7c54dc807b44202

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.4-cp38-cp38-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 56ed8a891a372dc2a030e21b2812476dc4029a76f2ca314032b3a28c90fde696
MD5 167c910cd817c315658ebdd5893c37a5
BLAKE2b-256 1f4f241087aa483ca8d4e8d50c81c988e23e536722820229f9455375109bab17

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page