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 (version 3.13 currently not supported)

pip install xrd-rust

Example: Calculate powder XRD pattern

from pymatgen.core import Structure
from xrd_rust_accelerator 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.2.1-cp313-cp313-manylinux_2_28_x86_64.whl (241.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

xrd_rust-0.2.1-cp313-cp313-macosx_11_0_arm64.whl (218.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

xrd_rust-0.2.1-cp313-cp313-macosx_10_12_x86_64.whl (228.2 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

xrd_rust-0.2.1-cp312-cp312-manylinux_2_28_x86_64.whl (241.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

xrd_rust-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (241.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

xrd_rust-0.2.1-cp312-cp312-macosx_11_0_arm64.whl (218.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

xrd_rust-0.2.1-cp312-cp312-macosx_10_12_x86_64.whl (228.2 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

xrd_rust-0.2.1-cp311-cp311-manylinux_2_28_x86_64.whl (243.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

xrd_rust-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (243.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

xrd_rust-0.2.1-cp311-cp311-macosx_11_0_arm64.whl (219.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

xrd_rust-0.2.1-cp311-cp311-macosx_10_12_x86_64.whl (228.8 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

xrd_rust-0.2.1-cp310-cp310-manylinux_2_28_x86_64.whl (243.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

xrd_rust-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (243.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

xrd_rust-0.2.1-cp310-cp310-macosx_11_0_arm64.whl (219.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

xrd_rust-0.2.1-cp310-cp310-macosx_10_12_x86_64.whl (229.1 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

xrd_rust-0.2.1-cp39-cp39-manylinux_2_28_x86_64.whl (244.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

xrd_rust-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (243.7 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

xrd_rust-0.2.1-cp39-cp39-macosx_11_0_arm64.whl (219.9 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

xrd_rust-0.2.1-cp39-cp39-macosx_10_12_x86_64.whl (229.3 kB view details)

Uploaded CPython 3.9macOS 10.12+ x86-64

xrd_rust-0.2.1-cp38-cp38-manylinux_2_28_x86_64.whl (243.9 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

xrd_rust-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (243.6 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

xrd_rust-0.2.1-cp38-cp38-macosx_11_0_arm64.whl (219.7 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

xrd_rust-0.2.1-cp38-cp38-macosx_10_12_x86_64.whl (229.2 kB view details)

Uploaded CPython 3.8macOS 10.12+ x86-64

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c9b67896503954cface5cdfc977241e2f80dd7813e8c7ec59fb5f9a2b06295c0
MD5 405853675b463239bc59de1d51274b12
BLAKE2b-256 4108a756e331c5378a8e64a97c00b401b9920adc525d1d08ba8d681a35539afd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 117512dc5130c0bbe1f45b95309e8658017f7cdc1428d33d773ac364a88a34a2
MD5 8482dc7f343efd3aad7155e7883ef180
BLAKE2b-256 c1c901a04ca09bf358411f0d1b500fdbcd58f00b9dc88c7512a83c607f0a47f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c70280eb0201434fca48c99891ff0d728606d9d63cb0b289f8dcc78e541daf20
MD5 e8ec21107812529fc95580d6711b0710
BLAKE2b-256 7b869494c4fcca341eb4056d2420571c74caf7d5ddf0edf16698e8c6b42896d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 517642805c1eea7592d84a74a84bdfa7de3fb15918848422a4f8060276eee482
MD5 debd011524c06bb92a91f4da83862ab6
BLAKE2b-256 2bbd2f644b19c32c76e014ccfb6ebd28d4948a33147c4aa0b7daeb352ff5d944

See more details on using hashes here.

File details

Details for the file xrd_rust-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ba8866e81c1ed2993f7500030fabb9a652f3326172a3f4317ee40c6aa989fb0e
MD5 ff6d3a204e247d41a02cf2fcb32e0e32
BLAKE2b-256 d64b2a82a99da8f5516471e45bba5a6dc2897f31eb74823ca8c141468661dff3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fb116fa3cc57003e012f013943665df69a0ab015baab9b81c469e8fc2e1a58ca
MD5 9a9063049f85333e4dd17906d9c24788
BLAKE2b-256 df50f8428eb999b825464564c2d098fcad8f2ba4cba177e904e4cefcadfa387f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9f8b7158dec51b17de148217317cb9b2114775518c1d7ed0f15378737f648107
MD5 7dc63cdb6012177b46ab2a178dfe8cf4
BLAKE2b-256 0eb6e130f2d05c2a5c9249d0c9e13df98b67a0a8b25bfe79b96a9eb07fd4301d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 34d3b8cf9da6e2e579a693d2619a2adfdf2ebdf2ebe21dbc6dc0dbb03143a00a
MD5 c3d3c37ac92186e0eb5864f0884d1137
BLAKE2b-256 4bf92850d8bc5ec905f3ae41e3afe857cccd18ee2331bca5a3569df58e4df5a5

See more details on using hashes here.

File details

Details for the file xrd_rust-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 86e7a7980898bb29730514a1e330583a50b5bc1383bbee0752f98d96cc6e2646
MD5 da48351ad51e803e5bb41cc6596d2a73
BLAKE2b-256 0dccd0694579b6b6bb911943f3b285d31ccea24503a53dbd9e31fc77c53a1130

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c53ffac1944d97d5b868760c29a8c39fe5595e00336b4e0cf97c065c7930d0f5
MD5 2073bd5639bca7fcd40a54655e185a7c
BLAKE2b-256 ce11e2a6a5c005c035d3bf4dcb03f288d4327c69fd2f607278d0f554bd62233d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 23524207380d82aeb0cb4432273f0c34650c9a9808a88c487e645ee7ceae33fb
MD5 08e8f88b020ae8c755cce0691bb90875
BLAKE2b-256 22e4bc5e052e1b331291365294a9d078037b04154101d2cbcbdccc63f966e5eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 24d5dec13ecf0b9fab9ecb87a6547be37f51d694a5842817e6baa395b193389e
MD5 62f61ada77096308b4a01571ca92de99
BLAKE2b-256 dad44feccfa51d8b3cd7e2f9e886754409348ee799ece4ba66b0485bd49f145a

See more details on using hashes here.

File details

Details for the file xrd_rust-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 acbd68324fe3d18f7e4beb51a42b9f4537b74cf7e3d84faa5769ceb3011753ca
MD5 e8c44bde742d8a662773a36de8114c0c
BLAKE2b-256 0c0025a532dcb3c60ca722aab9402c4fa77adc0e31d6ba6ee6e226710227f34e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab83138c298a2a119e32eb0d802bd78bdcf2415b09a7685319aa9108f5750255
MD5 0e6ef1d5fff8d2b40e987b06ee936dd0
BLAKE2b-256 c28e9638b6752c977905bc35a9f8441bfdbce27b866c9f49befcace9ac07975d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1648a46c336ef0543e5bf9fdd0e2e79ba777682d3a6835b8204bca57feff8411
MD5 2e7f76ef9206ee890b8fe86083ac6951
BLAKE2b-256 bdf80cd329140f8f006703134e1171ce865a6caee36b2f78e1c6e241e8a93f0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0e86312377a8344ad8da774b50f7e8ea1bd20a239f73f967f4de93be9cd722bb
MD5 a7fe992e677c8f187074ad80ee65753a
BLAKE2b-256 bd79286587d9f045e28cc2bcc7d14560c93262b758e63d254fe6d6d3eb586a24

See more details on using hashes here.

File details

Details for the file xrd_rust-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1383f32caff33f540d812639e742980fd2cbf4e5d6181f9921d50ee1386cf067
MD5 fd9ebe12894f9174a7e68d2d0385a58a
BLAKE2b-256 457c907aded1ead0de9568b7b2a905615fe89aff421f00d5b06da7b6487bdfa1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 19cee0b968f2633cdc121a400c5d80e67fb271f63361ef485817186adcc00616
MD5 306b134f2f9ea5c0b515e0d1ff4ee48b
BLAKE2b-256 c5db4a151514cc1114a0d571fbdc2b9ac53290f08d2150c31611ffe5148e26de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ed6b8ba24425fac4eff9f3e3db786b2be7abdc71ffdd47daa64d7f2b8403df21
MD5 65556b300eac79517a199554c79a1b8d
BLAKE2b-256 66a5aaa7449f776f486ce264b18bbcb891adad4d5b5c106a40752cb8765545bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a143fd686a3e2e2f53dcc2fa86a037c6f50106ce7f1807a2ac8bcc1db613198f
MD5 4c2581b5ab4738a9e39d21cecd25cc65
BLAKE2b-256 7e2f6d9135122a05338280b40fb3274539ca08fb0ef2600b790bd0cdb31a0337

See more details on using hashes here.

File details

Details for the file xrd_rust-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ebf7eeba52de3894933b575bd96cf17f29ab6905eafc7ad9c671b3ddd7196edc
MD5 aa041426d8ef3db7440eff1b375207d5
BLAKE2b-256 25c34621c06487c48a6be389beec70a62794ef88188beb0a800b2052d3a85476

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 305f5110a0a40097085a6d03a469e8f569f5053f5882fed44ab2472ca09ee22c
MD5 4cb7192ee144406b6756d2a8c2357082
BLAKE2b-256 1692f3ec82cf64f9c389a010ba4d2149a64cd443c35dfe490745f93d5285b5bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xrd_rust-0.2.1-cp38-cp38-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9695940f052c49cd934e1898ab656e5f0039e136d45a0e4bd8c1c53be403048e
MD5 a26b9d9c323a629ade78c0b3077f43e0
BLAKE2b-256 e4bd45efa7473c6247b42fa18986abf7c7e73c20790d594c4c4a1277872c576d

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