Skip to content

Bin-Cao/PyWPEM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

193 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyWPEM

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

English | 简体中文 | 日本語 | 한국어 | Español | Français | Deutsch

Homepage Documentation arXiv Paper Supplementary Materials Download Stats

GitHub Stars GitHub Forks Open Issues Closed Issues License Last Commit

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. 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.


Star History


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.


Installation

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

PyWPEM table

PyWPEM figure


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}
}

License

This project is released under the MIT License.

About

[WPEM / PyWPEM] AI-Driven Structure Refinement of X-ray Diffraction

Topics

Resources

License

Stars

207 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors