TeMFpy: Tensor-Network Mean-Field Python
TeMFpy (Tensor Networks for Mean-Field States in Python, suggested pronuncation: ˈtɛmɸ.paɪ) is a TeNPy-based Python library for converting fermionic mean-field states to finite or infinite matrix product state form. TeMFpy includes new, efficient, and easy-to-understand algorithms for both Slater determinants and Pfaffian states. Together with Gutzwiller projection, these also allow the user to build variational wave functions for various strongly correlated electron systems, such as quantum spin liquids. Being built on top of TeNPy, it integrates seamlessly with existing MPS-based algorithms.
Installation
TeMFpy runs on all operating systems and requires Python 3.10 or later. We support installation through pip:
pip install --upgrade pip
pip install --upgrade temfpy
We will set up installation via Conda in the near future.
If you use Windows and want to use the Pfaffian-state functionality, make sure you install the pfapack dependency correctly!. Alternatively, consider using Windows Subsystem for Linux.
Documentation
The documentation is available on this website. In addition, every object in TeMFpy comes with detailed docstrings that are available through the help() function in Python.
Contribute
The most up-to-date version of TeMFpy is available on GitHub. If you find any bugs in the library, please let us know by opening an issue, including a minimal example to reproduce the issue.
We also welcome contributions, whether bug fixes or new features, please see our contributor guidelines for details.
Citing TeMFpy
If you find the TeMFpy project useful for your research, please consider citing the following software paper in order to help us continue devoting time and resources to the TeMFpy development:
@misc{temfpy,
title={{TeMFpy}: a {Python} library for converting fermionic mean-field states into tensor networks},
author={Simon H. Hille and Attila Szabó},
year={2025},
eprint={2510.05227},
archivePrefix={arXiv},
primaryClass={cond-mat.str-el},
url={https://arxiv.org/abs/2510.05227},
}
Please consider citing the underlying TeNPy library as well:
@Article{tenpy,
title={{Tensor network Python (TeNPy) version 1}},
author={Johannes Hauschild and Jakob Unfried and Sajant Anand and Bartholomew Andrews and Marcus Bintz and Umberto Borla and Stefan Divic and Markus Drescher and Jan Geiger and Martin Hefel and Kévin Hémery and Wilhelm Kadow and Jack Kemp and Nico Kirchner and Vincent S. Liu and Gunnar Möller and Daniel Parker and Michael Rader and Anton Romen and Samuel Scalet and Leon Schoonderwoerd and Maximilian Schulz and Tomohiro Soejima and Philipp Thoma and Yantao Wu and Philip Zechmann and Ludwig Zweng and Roger S. K. Mong and Michael P. Zaletel and Frank Pollmann},
journal={SciPost Phys. Codebases},
pages={41},
year={2024},
publisher={SciPost},
doi={10.21468/SciPostPhysCodeb.41},
url={https://scipost.org/10.21468/SciPostPhysCodeb.41},
}