PyWPEM
[https://bin-cao.github.io/PyWPEM] AI-Driven Structure Refinement of X-ray Diffraction
Install / Use
/learn @Bin-Cao/PyWPEMREADME
Other tools include XQueryer for initial structure inference and PRDNet for crystal property prediction.
⚠️⚠️⚠️ I am developing a user interface to support all functionalities of PyXplore (see the UI repository). Through the UI, users only need to input their data and parameters, and the corresponding execution code is generated automatically. Please stay tuned for updates.
We welcome contributions from the community. The contributors will be acknowledged in the current paper. Substantial contributions to key functionalities may lead to co-authorship in future publications for the next version of WPEM
<p align="center"> <a href="https://star-history.com/#Bin-Cao/PyWPEM&Date"> <img src="https://api.star-history.com/svg?repos=Bin-Cao/PyWPEM&type=Date" width="650" style="border: 1px solid #d0d7de; border-radius: 12px; padding: 8px; background: #ffffff;" /> </a> </p>
Overview
PyXplore is a modular Python framework for X-ray diffraction (XRD) simulation, decomposition, quantitative analysis, and AI-assisted structure refinement.
It integrates:
- Physics-based diffraction modeling
- EM-based Bragg optimization
- Structure graph construction
- Extinction and Wyckoff analysis
- Amorphous phase quantification
- AI-driven structural refinement
The toolkit is designed for reproducible scientific workflows in materials characterization and AI for Science research.
Install from PyPI and Install the dependencies:
pip install PyXplore
Upgrade to the latest version:
pip install --upgrade PyXplore
Key Features
-
XRD Simulation Accurate diffraction pattern generation from crystallographic information.
-
Peak Decomposition & Quantitative Analysis WPEM-based decomposition and volume fraction determination.
-
Bragg Law Optimization (EM Framework) Expectation-Maximization-based parameter solving.
-
Extinction & Wyckoff Handling Symmetry-aware preprocessing and structural filtering.
-
Graph-Based Structure Representation Crystal graph construction for downstream machine learning tasks.
-
Amorphous Structure Analysis RDF-based quantitative evaluation.
-
Multi-modal Extension Integrated modules for XAS and XPS analysis.
Architecture Overview
PyWPEM/
├── WPEM.py
├── XRDSimulation/
├── EMBraggOpt/
├── Refinement/
├── StructureOpt/
├── GraphStructure/
├── Extinction/
├── Amorphous/
├── Background/
├── Plot/
├── DecomposePlot/
├── WPEMXAS/
├── WPEMXPS/
└── refs/
The design follows a physics-consistent, modular architecture, enabling independent or pipeline-based execution.
Tables & Figures
<p align="center"> <img width="450" src="https://github.com/user-attachments/assets/da5bd320-3651-4223-b862-06fb5ce1f96a" /> </p> <p align="center"> <img width="700" src="https://github.com/user-attachments/assets/50b1aacc-6a4f-4b58-95fb-a4094da60055" /> </p>Scientific Reference
If you use PyWPEM in your research, please cite:
@article{cao2026wpem,
title={AI-Driven Structure Refinement of X-ray Diffraction},
author={Bin Cao, Qian Zhang, Zhenjie Feng, Taolue Zhang, Jiaqiang Huang, Lu-Tao Weng, Tong-Yi Zhang},
journal={arXiv preprint},
year={2026},
url={https://arxiv.org/abs/2602.16372v1}
}
Contributing
We welcome contributions from the community.
- Report bugs via Issues
- Propose features
- Submit pull requests
- Contact for academic collaboration
Please ensure code readability, documentation clarity, and scientific correctness before submission.
License
This project is released under the MIT License.
Free for academic and commercial use. Please cite related publications when used in scientific research.
<table> <tr> <td width="160" align="center" valign="top"> <img src="https://github.com/user-attachments/assets/7e77bd5a-42d6-45db-b8e6-2c82cac81b9d" width="140" style="border-radius: 50%;"/> </td> <td valign="top"> <b>For any inquiries or assistance, feel free to contact Mr. CAO Bin at:</b><br> 📧 Email: <a href="mailto:bcao686@connect.hkust-gz.edu.cn">bcao686@connect.hkust-gz.edu.cn</a><br><br> Cao Bin is a PhD candidate at the <b>Hong Kong University of Science and Technology (Guangzhou)</b>, under the supervision of Professor <a href="https://gbaaa.org.hk/en-us/article/67">Zhang Tong-Yi</a>. His research focuses on <b>AI for science</b>, especially intelligent crystal-structure analysis and discovery. Learn more about his work on his <a href="https://bin-cao.github.io/">homepage</a>. </td> </tr> </table>
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
