Simulate moire lattice systems in both real and momentum space and calculate various related observables.
Project description
MoirePy: Twist It, Solve It, Own It!
MoirePy is a FOSS Python package for the simulation and analysis of bilayer moiré lattices using tight-binding models. Built for computational physicists and material scientists, it enables quick and flexible moiré band structure calculations, visualization, and manipulation. Our primary focus is on commensurate moiré lattices only.
Documentation: https://jabed-umar.github.io/MoirePy/
Github Repository: https://github.com/jabed-umar/MoirePy
PyPI page: https://pypi.org/project/moirepy/
Features
- Fast and efficient simulation of 2D bilayer moiré lattices.
- Efficient $O(\log n)$ time nearest neighbour searches.
- supports custom lattice definitions with some basic predefined ones:
- Triangular
- Square
- Hexagonal
- Kagome
- both real and k-space Hamiltonian generation for tight-binding models with:
- Nearest-neighbour coupling
- Arbitrary number of orbitals per site
- All couplings can be real (default), or complex numbers.
- All couplings can be functions of position of the point(s) and the point type(s) (for example, different coupling for A-A, A-B, B-B sites for hexagonal lattices)
- Custom Intra and Interlayer Coupling Design.
- Web based tool makes it convenient to calculate lattice angles before simulation.
- Extensive Documentation and examples for easy onboarding.
- Compatible with other related libraries like Kwant (so that you can generate moire Hamiltonian and use it with Kwant for further analysis).
- Freedom to researcher: We allow you to define your layers and apply whatever couplings you want. If you want the lattice points to have 53 orbitals each—sure, go ahead. As long as you know what you're doing, we won’t stop you. We don't verify whether it's physically possible.
Upcoming Features
- Support for higher-dimensional layers: Extend current 2D-only support to include higher dimensional constituent layers.
- Multi-layer stacking: Go beyond bilayers; enable simulation of trilayers and complex heterostructures.
- Non-equilibrium Green's function support (research in progress): Develop tools for computing Green’s functions efficiently to study non-equilibrium and quantum transport phenomena.
Installation
You can install MoirePy from PyPI via pip:
$ pip install moirepy
Basic Usage
For detailed usage, please refer to our documentation.
>>> import matplotlib.pyplot as plt
>>> from moirepy import BilayerMoireLattice, TriangularLayer
>>> # Define the Moiré lattice with two triangular layers
>>> moire_lattice = BilayerMoireLattice(
>>> latticetype=TriangularLayer,
>>> ll1=9, ll2=10,
>>> ul1=10, ul2=9,
>>> n1=1, n2=1, # number of unit cells
>>> )
twist angle = 0.0608 rad (3.4810 deg)
271 points in lower lattice
271 points in upper lattice
>>> ham = moire_lattice.generate_hamiltonian(
>>> tll=1, tuu=1, tlu=1, tul=1,
>>> tuself=1, tlself=1,
>>> )
>>> plt.matshow(ham, cmap="gray")
License
This project is licensed under the MIT License.
Cite This Work
If you use this software or a modified version in academic or scientific research, please cite:
@misc{MoirePy2025,
author = {Aritra Mukhopadhyay, Jabed Umar},
title = {MoirePy: Python package for efficient atomistic simulation of moiré lattices},
year = {2025},
url = {https://jabed-umar.github.io/MoirePy/},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moirepy-0.0.8.tar.gz.
File metadata
- Download URL: moirepy-0.0.8.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0388b3e17c4c597943f2bdd3224e99af40114027cf45351f9a65c93eae003038
|
|
| MD5 |
cbcbc7a23be1a11524dccf242725f5d9
|
|
| BLAKE2b-256 |
ee8c2fad0c462b7ba09932654de6f33293ca1bf45d18c6233e2669381d5dfda8
|
File details
Details for the file moirepy-0.0.8-py3-none-any.whl.
File metadata
- Download URL: moirepy-0.0.8-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf140b02432eab3724a33f1dcf42d15c57f3d8d363d37b58baf3abe462d5df3e
|
|
| MD5 |
dfee2227675bafa2ae0e4f7512dab423
|
|
| BLAKE2b-256 |
0bce20a5b58e49e368f31ad1a4acb4d52b7da73044b50eb185b171adf6a9b10d
|