Skip to main content

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 library for simulating moire lattices with a clean, highly Pythonic API.

It is designed to be easy to use while remaining fully flexible. You can define custom lattice geometries, program arbitrary hopping functions, and build tight-binding Hamiltonians in both real space and k-space, with support for open (OBC) and periodic (PBC) boundary conditions. Generated Hamiltonians can also be exported to tools like Kwant for further analysis.


Why MoirePy

  • Define anything: No restrictions on lattice geometry or orbitals
  • Pythonic API: If you know Python, MoirePy is intuitive
  • Custom hoppings: Fully programmable intra/inter-layer couplings
  • Real-space + k-space: Both supported natively
  • OBC + PBC: Switch boundary conditions easily
  • Kwant-compatible: Export Hamiltonians for further analysis
  • Fast construction: Efficient neighbour search using KDTree
  • Reproducibility-first: Designed to replicate known results and papers

Installation

pip install moirepy

Quick Example: Twisted Bilayer Graphene

import numpy as np
import matplotlib.pyplot as plt
from moirepy import BilayerMoireLattice, HexagonalLayer

# Define a twisted bilayer moiré lattice
lattice = BilayerMoireLattice(
    latticetype=HexagonalLayer,
    # you choose the next 4 values based on the twist angle using this tool:
    # Angle-Value Calculator: https://jabed-umar.github.io/MoirePy/theory/avc/
    ll1=3, ll2=4, ul1=4, ul2=3,
    n1=1, n2=1,
)

# Visualize the lattice
lattice.plot_lattice()
plt.show()

ham = lattice.generate_hamiltonian(
    tll=1, tuu=1,
    tlu=1, tul=1,
    tlself=0, tuself=0
)  # returns scipy sparse matrix

print(ham.shape)

Philosophy

MoirePy does not try to enforce what is "physically valid".

If you want:

  • unusual lattices
  • non-standard couplings
  • high orbital counts

you are free to do so.

The library gives you control. You decide what makes sense.


Contributing

Contributions are welcome.

  • Report bugs or request features via issues
  • Submit pull requests for improvements
  • Add examples, tutorials, or benchmarks

A detailed contributing guide will be added soon.


Citation

If you use this work in research:

@software{MoirePy2025,
  author = {Mukhopadhyay, Aritra and Umar, Jabed},
  license = {MIT},
  title = {{MoirePy: Python package for efficient atomistic simulation of moiré lattices}},
  url = {https://github.com/jabed-umar/MoirePy}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moirepy-0.0.11.tar.gz (7.9 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

moirepy-0.0.11-cp312-abi3-win_amd64.whl (113.5 kB view details)

Uploaded CPython 3.12+Windows x86-64

moirepy-0.0.11-cp312-abi3-manylinux_2_34_x86_64.whl (249.2 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.34+ x86-64

moirepy-0.0.11-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (242.8 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ ARM64

moirepy-0.0.11-cp312-abi3-macosx_10_12_x86_64.whl (219.7 kB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

File details

Details for the file moirepy-0.0.11.tar.gz.

File metadata

  • Download URL: moirepy-0.0.11.tar.gz
  • Upload date:
  • Size: 7.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for moirepy-0.0.11.tar.gz
Algorithm Hash digest
SHA256 7f5bda1d654739d40390dfef6af6005c7491eb9ac37aab8e518f707dffd65503
MD5 35edbdc09c479e3589768ee11c3bfd18
BLAKE2b-256 145d786161b5c34e12a6c7bf2b6c441f167e9963169edde80fdf71b14eb51959

See more details on using hashes here.

File details

Details for the file moirepy-0.0.11-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: moirepy-0.0.11-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 113.5 kB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for moirepy-0.0.11-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 14fadd6fec7b29e32314fec1f37d221f39a6a4e6668f94164c21ec32dd0156df
MD5 e437707dada835358563ff9050316f9b
BLAKE2b-256 de2d662fd64323521754699b431f75dca2bc2249895aa9c375a9eef806e4cfcb

See more details on using hashes here.

File details

Details for the file moirepy-0.0.11-cp312-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for moirepy-0.0.11-cp312-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c7ba27a18716b9b40b0ec3a8d39a586140d7c8c62d4f9d4a5820e7d41bfc8d97
MD5 478e1567e62daa33f8cef0cd6eb01d39
BLAKE2b-256 6121c566b0fc2d014c123be8235ba7df2d9350ca96aabe286e0cb0f61f62c33d

See more details on using hashes here.

File details

Details for the file moirepy-0.0.11-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for moirepy-0.0.11-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 758b17ea1ff574322270c07978cb8a2615c71fb490e9aaf299b0fd6fbc30fc12
MD5 d26b7be3b3702422712eebe0aeedd306
BLAKE2b-256 f883d22160f8f059f7c9e90a4a412776ff763e97b8ecd2b0026400ad67ad0d28

See more details on using hashes here.

File details

Details for the file moirepy-0.0.11-cp312-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for moirepy-0.0.11-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ab821a3b4655fcac7bd8080d732379bb93156a461abf4c08b9c6deef9137f911
MD5 c2a6040b2f9a624c48bbb6ec6aa1dfb5
BLAKE2b-256 fc04d64a69c07984f016af2d73cc9883c221527a02056dc6a57e7ae4f190b550

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page