![PyPI](https://img.shields.io/pypi/v/pypfc)
![License](https://img.shields.io/github/license/HHallb/pyPFC)

![PFC atoms](https://github.com/HHallb/pyPFC/raw/main/docs/images/pyPFC_logo_transparent.png)

# A Python package for GPU-accelerated 3D Phase Field Crystal simulations

![PFC atoms](https://github.com/HHallb/pyPFC/raw/main/docs/images/PFC_atoms.png)

## Overview

pyPFC is a high-performance simulation framework designed for modeling crystal structures and their evolution using the Phase Field Crystal (PFC) method. The code uses PyTorch to allow execution on both CPUs and GPUs, with particularly efficiency gained on GPU platforms. pyPFC is developed with a combined focus on computational efficiency, flexibility and accessibility, making it suitable for both research and educational purposes.  

Installation instructions, examples and API documentation can be found in the [pyPFC documentation](https://HHallb.github.io/pyPFC).

## Licencing

This software is released under a [GNU GPLv3 license](https://www.gnu.org/licenses/).

## References

Further details on PFC modeling and example applications can be found in:

- [H. Hallberg and K.H. Blixt, **pyPFC: an open-source Python package for phase field crystal simulations**, *Modelling and Simulation in Materials Science and Engineering*, 34(1):015004, 2026](https://doi.org/10.1088/1361-651X/ae2599)
- [K.H. Blixt and H. Hallberg, **Phase Field Crystal Modeling of Grain Boundary Migration: Mobility, Energy and Structural Variability**, *Acta Materialia*, 297:121318, 2025](https://doi.org/10.1016/j.actamat.2025.121318)
- [H. Hallberg and K.H. Blixt, **Assessing grain boundary variability through phase field crystal simulations**, *Physical Review Materials*, 8(3):113605, 2024](https://doi.org/10.1103/PhysRevMaterials.8.113605)
- [K.H. Blixt and H. Hallberg, **Phase field crystal modeling of grain boundary structures in diamond cubic systems**, *Physical Review Materials*, 8(3):033606, 2024](https://doi.org/10.1103/PhysRevMaterials.8.033606)
- [H. Hallberg and K.H. Blixt, **Multiplicity of grain boundary structures and related energy variations**, *Materials Today Communications*, 38:107724, 2024](https://doi.org/10.1016/j.mtcomm.2023.107724)
- [H. Hallberg and K.H. Blixt, **Evaluation of Nanoscale Deformation Fields from Phase Field Crystal Simulations**, *Metals*, 12(10):1630, 2022](https://doi.org/10.3390/met12101630)
- [K.H. Blixt and H. Hallberg, **Grain boundary and particle interaction: Enveloping and pass-through mechanisms studied by 3D phase field crystal simulations**, *Materials & Design*, 220:110845, 2022](https://doi.org/10.1016/j.matdes.2022.110845)
- [K.H. Blixt and H. Hallberg, **Grain boundary stiffness based on phase field crystal simulations**, *Materials Letters*, 318:132178, 2022](https://doi.org/10.1016/j.matlet.2022.132178)
- [K.H. Blixt and H. Hallberg, **Evaluation of grain boundary energy, structure and stiffness from phase field crystal simulations**, *Modelling and Simulation in Materials Science and Engineering*, 30(1):014002, 2022](https://doi.org/10.1088/1361-651X/ac3ca1)