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

Uploaded CPython 3.13Windows x86-64

xrd_rust-0.3.3-cp313-cp313-manylinux_2_28_x86_64.whl (305.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.3-cp313-cp313-macosx_11_0_arm64.whl (270.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

xrd_rust-0.3.3-cp313-cp313-macosx_10_12_x86_64.whl (276.0 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

xrd_rust-0.3.3-cp312-cp312-win_amd64.whl (178.2 kB view details)

Uploaded CPython 3.12Windows x86-64

xrd_rust-0.3.3-cp312-cp312-manylinux_2_28_x86_64.whl (305.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.3-cp312-cp312-macosx_11_0_arm64.whl (270.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

xrd_rust-0.3.3-cp312-cp312-macosx_10_12_x86_64.whl (276.3 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

xrd_rust-0.3.3-cp311-cp311-win_amd64.whl (177.6 kB view details)

Uploaded CPython 3.11Windows x86-64

xrd_rust-0.3.3-cp311-cp311-manylinux_2_28_x86_64.whl (306.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.3-cp311-cp311-macosx_11_0_arm64.whl (271.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

xrd_rust-0.3.3-cp311-cp311-macosx_10_12_x86_64.whl (277.1 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

xrd_rust-0.3.3-cp310-cp310-win_amd64.whl (177.7 kB view details)

Uploaded CPython 3.10Windows x86-64

xrd_rust-0.3.3-cp310-cp310-manylinux_2_28_x86_64.whl (307.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.3-cp310-cp310-macosx_11_0_arm64.whl (271.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

xrd_rust-0.3.3-cp310-cp310-macosx_10_12_x86_64.whl (277.3 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

xrd_rust-0.3.3-cp39-cp39-win_amd64.whl (178.0 kB view details)

Uploaded CPython 3.9Windows x86-64

xrd_rust-0.3.3-cp39-cp39-manylinux_2_28_x86_64.whl (307.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.3-cp39-cp39-macosx_11_0_arm64.whl (271.7 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

xrd_rust-0.3.3-cp39-cp39-macosx_10_12_x86_64.whl (277.7 kB view details)

Uploaded CPython 3.9macOS 10.12+ x86-64

xrd_rust-0.3.3-cp38-cp38-win_amd64.whl (177.9 kB view details)

Uploaded CPython 3.8Windows x86-64

xrd_rust-0.3.3-cp38-cp38-manylinux_2_28_x86_64.whl (307.3 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

xrd_rust-0.3.3-cp38-cp38-macosx_11_0_arm64.whl (271.6 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

xrd_rust-0.3.3-cp38-cp38-macosx_10_12_x86_64.whl (277.5 kB view details)

Uploaded CPython 3.8macOS 10.12+ x86-64

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 981c0882c460b19d8bf66fac5b16cd0f8c70ff35cdd46dc7453b80ef453ff5d1
MD5 9714849f1ef51d04aec65f328650361b
BLAKE2b-256 6899322b361af13266a4b0a3f0ebfffc77e713381ddb8d1b6a74c46fae6dd55f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f4ce15b220e053ce4f3d2f23a646a252c8c0c84065004a764f600a0ab51ca05f
MD5 7757ef43b29504bde86c717562d01bed
BLAKE2b-256 dd7dcb5ac0b97f9ef9074cb31ce8ce58d2e28673bbdb7ca2b791c0f0eacf028a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5cd3be026d58c5a77fd3b3cb79cad6b862396c6cecc11d7cfb370b570f870db2
MD5 e9a91768619ac079289bd505ce246802
BLAKE2b-256 9e4a111d2bbc57838b777870234fd6ea90015ee802ca8221a641c238bcba7858

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8fc0d8c32b40b06d3d4ba0961c9e8eca06124b6b08dcee0702f80b0bbb69392e
MD5 814188c28f8b14d72ab5e76808849f18
BLAKE2b-256 fe24dd73850255b73b2b46d7bff7ab1f6a0f357965a3c3e98b40b2df65f63198

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ea25d4ec4fa31296ea5cfd13a97f845eb59336c97dfeb5205a78183b6d834600
MD5 df0b3ae46c046b3f7193970c199e77bc
BLAKE2b-256 85418cf0c710442b77199a92e3a5d43197aad2bf2b0b74cf63a7e460ecab2a48

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 42433bb88523c6dec9c9d905d47554e955b3837f0a6ce97479dd7920b10c2b95
MD5 6e4f7290bc7b7776f7bbd028f2e5b1e2
BLAKE2b-256 0fc1cb71a1487a0ff0a1fc8fee5d82ce2ce9542d9a247dcd9e6fd99be718664a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c935d4ad0ab8d3cc2012f437564efaf863152e6e8796369447a0f6e5094c75f
MD5 7bda0eb5c7b2e6c869c22783ff7b84e7
BLAKE2b-256 ee7e3e79de9a43697ba64e22fa533c6566cd7ca9ee5360a762b616e5281fb9ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ff7b84c62036091ea74603a2afeb37f017b01d5652dd1317a27cf8ce5414d23b
MD5 a01ed9c511b7c6c50aed0f269cd346e7
BLAKE2b-256 e960ace8aece13b29c7ecda6844f4aadd015f833d80e32bb59eac1f5daf037b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1f844cec799bd969022108eaf61d9ea669ee2ad719c102191d606be33afba65a
MD5 5ce2d336c43b29d4b9c04bdc8ebfafea
BLAKE2b-256 89391a1c557898e5aba5f088259a6ef1200da2189b805e023f7caa89929a05c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a705a5c77449350730345e490bb07a887c3b76bace791416c364615a5321024e
MD5 41f02ff5c20b2143942237a467e7cc9d
BLAKE2b-256 b501b7420b7a459ee5b20d6a38ce9f6cb2c396025e7bad4a66be8654b278ba51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f9bcc88bebc9e46e55facd16690600534c8723dd177988742e601a0786f7b8d9
MD5 cf157efa8d3f45975927fc455cfe68f6
BLAKE2b-256 1d838206d6116eb32cd742718fb3864c900183e37d488c9a1695a482b22fc20f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 71d2542652a4252b77a79ca913b5c704a53cc63ab93c593463544b0e8b50e21e
MD5 4e466492acd971cc5f20b496e81f7f6b
BLAKE2b-256 b128a9d7f5a71079963eb2b5313bed7e10a3e1cd4fea1b481f4c90b81afd737c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d0483e8eb2a577cc8f0aa8cc01907dc7a9f4e669b67c8481c36ac05a09f9e3d2
MD5 bc6dcff8edb89a9dc393d809c618578a
BLAKE2b-256 7bf32caa55a0cbc0fd1d2dcbc75f06cdde373f0738631adeab213edb5979d79d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7ca89c778d397ef8daa959250f18954cbb17cc2a9042a6b9a7358b0935fa617b
MD5 b9938b636364e1fb11ec27125b9b2564
BLAKE2b-256 303070cf9420ff5293ac80736e6d585c42e2feff169147d23608f840096a9de0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 780da4148cde7c9186840f828e752ccae0d2e0df21c48081f40d6a4acde3f4a6
MD5 8cb32c0de6383550530d0ae8b8c80490
BLAKE2b-256 8186bb1d71696063311faa16350b92a36c16d92d849bc2ad3bc266886b4e06e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c08b7f80010a1ff22e99e9d06815b6062ba1a696486f66905a56cbf10a939920
MD5 1be552694ec2e1f1e86ffca300063627
BLAKE2b-256 7224d2c533459c9f41d4cda89381a90148fcee9436841ffb0f655e6a59b2b46c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xrd_rust-0.3.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 178.0 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.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e13e69143df8bc53c1773affb83c8e4193181bebd7b82d0ee5027fd0906e139c
MD5 abecfb6966a0ef15063aed2e676db285
BLAKE2b-256 62ad9adf31c2342a52848850bbe27d442f93416b5104ec7af839c659a722a4a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c0e1b1c06b423c53bf2519d695f101c2fd1cb66a9bbfb0c3d2fb5f4fafd8add8
MD5 fa5024107632f856c6563c085160e711
BLAKE2b-256 245718c859b4fed704c6c513b65b6e5a4f1b7e7577ee7ac98c7e63f6c85237f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f2efa93375333579390a0d088a67c03c02e29ad16d9e48d869a38e26d0b8f71c
MD5 4895021b4db43d6427152bf918331c60
BLAKE2b-256 9be7de9137a161de747d5624daf74870a690efab8105e6516fa2ca73a81a60d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f33961d4f7b4915fad0b2a0ece22f7537fa17574cad23dd21b8405ea8418cd99
MD5 59fab6dab0372dd574d9ca1135647bbc
BLAKE2b-256 a0792ee78959c905da12bf90f7d059c73cf5133548da8f4957e621521d50ffc5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xrd_rust-0.3.3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 177.9 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.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 5a739d30e0d0fdf294014ec778376d93e11bbc64bf3ce26a48030cebd09ac1fb
MD5 c5bd5800e76e93e98f643001585ed43e
BLAKE2b-256 42ac2e32acb73b922c243c89986ea8e0743d50da17d7c7b6c3d471001dd00726

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1ca4d3607cf3f5464b1f5aa29cf15672a673fab744900de024af9ab9a34d42fe
MD5 3c05b8858702b232846310075f67a588
BLAKE2b-256 ca8a01eb52133fe994f07af45bf902abf07bc5628d5f6e7220932d3fa4ad3d9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b29863c84ab982137ed40ce49504bd37f285d38bb1b323c7562527862d2fcd58
MD5 4edc49413235a81d19e15a6a09325d29
BLAKE2b-256 6bf4ff5244a5642b3eb977f0cec7cbe2fa9698fe696c456d3e2ca507df55fc58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.3.3-cp38-cp38-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d05c3998a32701a97a4d4680ef1222ef3f153cf86183866e2f481f7ae6d6b4b8
MD5 7d41f274abe442419245ec8845885ad5
BLAKE2b-256 14f831419e519bc9468c26691eadabd6953a466f84343e7434dd1910bd828c91

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