Skip to content

Bin-Cao/PyWPEM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

161 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyWPEM

A next-generation whole-pattern refinement framework for complex crystal structure analysis.

GitHub Stars GitHub Forks Open Issues Closed Issues

Language: English | 简体中文 | 日本語

WPEM_Image

Note

WPEM introduces a fundamentally new paradigm for XRD refinement beyond conventional Rietveld methods.
Instead of fitting diffraction peaks through traditional least-squares profile matching, WPEM formulates the entire diffraction pattern as a physics-constrained probabilistic mixture distribution and performs whole-pattern decomposition through an expectation-maximization framework. By explicitly embedding Bragg consistency into the optimization process, PyWPEM enables stable phase-resolved refinement under severe peak overlap, mixed phases, amorphous backgrounds, and complex experimental conditions. This work represents one of the first attempts to unify AI-driven structure analysis with physically admissible diffraction refinement, potentially redefining the next generation of automated XRD refinement workflows.

We have released the tutorial videos in Chinese on BiliBili:Link

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



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


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.

External Source

PyWPEM Desktop, developed by @Zhou Xuan-Yu.

About

[https://bin-cao.github.io/PyWPEM] AI-Driven Structure Refinement of X-ray Diffraction

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors