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.15.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.15-cp311-abi3-win_amd64.whl (329.4 kB view details)

Uploaded CPython 3.11+Windows x86-64

moirepy-0.0.15-cp311-abi3-manylinux_2_34_x86_64.whl (490.2 kB view details)

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

moirepy-0.0.15-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (464.0 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

moirepy-0.0.15-cp311-abi3-macosx_10_12_x86_64.whl (452.6 kB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: moirepy-0.0.15.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.15.tar.gz
Algorithm Hash digest
SHA256 016f43d980c7971a80704eae657e0985734a60eb3d7e5ffe4de886552011021c
MD5 c5190e1664becb924812cd3784ad495c
BLAKE2b-256 d23c1ff5097217cebb1daf76cb02fffc0c6a1d3043e334f46117c6a48d402733

See more details on using hashes here.

File details

Details for the file moirepy-0.0.15-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: moirepy-0.0.15-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 329.4 kB
  • Tags: CPython 3.11+, 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.15-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7f629c032cf9fc98dd1c8bfcdfcb8025e6201192a5586f0c170ed79e62285089
MD5 be68300da973ef24f2ec5c521c5fc223
BLAKE2b-256 bbdf0ddb85df21bc25d7847d85f6745bf61e31735884b8a6879ad603e7d95fb7

See more details on using hashes here.

File details

Details for the file moirepy-0.0.15-cp311-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for moirepy-0.0.15-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5f786aca19e76122d1fb3f3a078a45249c62bffeb94721924c128366e1240ec4
MD5 5057db35911e9528b4dabeb1e136135b
BLAKE2b-256 fee59aeeb11ba8f8d3ab9caa9e3678cc77706a4eab88a1198e36a98b480c0596

See more details on using hashes here.

File details

Details for the file moirepy-0.0.15-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for moirepy-0.0.15-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0edc478f11ce92ab4ecca2b6706657e48dc9651f6ee6d51d2f95e43d959c8705
MD5 f2d84bd2b78c53b64510718fa2acf485
BLAKE2b-256 a35da203081874e9a5b3dec9714377b22348a22f0ae8548cf0a1889b8f596754

See more details on using hashes here.

File details

Details for the file moirepy-0.0.15-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for moirepy-0.0.15-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 38c00cd4c57cf8665083cbb7f08526bb768518913e89aadab7de6b8d04e13016
MD5 5ef54cb15ac650f51e58969b24ec3ef0
BLAKE2b-256 b21708f89eb1b707a555de36ccfe67632f84d0fe20c419339033469aeb5aeab5

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