Skip to main content

Atomic relaxation, strain extraction, and multi-layer analysis for twisted 2D van der Waals heterostructures

Project description

moire-metrology

ci docs status python license DOI

Atomic relaxation, strain extraction, and multi-layer analysis for twisted 2D van der Waals heterostructures.

This is a Python re-implementation of the modeling tools developed for the papers listed under References. The goal is to make the methodology accessible as a pip-installable package, instead of a private collection of MATLAB scripts.

Documentation -- full user guide, theory background, API reference, and examples.

Status

Beta. The single-interface relaxation, strain extraction, multi-layer stack, and finite-mesh point-pinning APIs are all in place and covered by 70+ fast tests plus integration tests gated behind a slow marker.

Features

  • Single-interface relaxation of twisted bilayer systems on a periodic triangular FEM mesh, with three solver options: damped Newton, implicit pseudo-time-stepping, and L-BFGS-B.
  • Multi-layer stack API (LayerStack) for heterostructures with any number of layers per flake, including fix_top / fix_bottom clamps to approximate semi-infinite substrates.
  • Materials database with bundled GSFE parameterizations for graphene, hBN (AA, AA'), MoSe2/WSe2, and graphene/hBN heterointerfaces.
  • Strain extraction from measured moire patterns, implementing the closed-form inversion of Halbertal et al., ACS Nano (2022).
  • Constrained relaxation on a finite domain via PinningMap.
  • Plotting helpers for stacking-energy maps, elastic-energy maps, local twist angle, and displacement fields.

Installation

pip install moire-metrology

Or install from source for development:

git clone https://github.com/dorrih/moire_metrology.git
cd moire_metrology
python3.11 -m venv .venv
.venv/bin/pip install -e '.[dev]'

Requires Python 3.10+. Dependencies: numpy, scipy, matplotlib.

Quick start

from moire_metrology import GRAPHENE_GRAPHENE, RelaxationSolver, SolverConfig

solver = RelaxationSolver(SolverConfig(pixel_size=1.0, max_iter=200))
result = solver.solve(
    moire_interface=GRAPHENE_GRAPHENE,
    theta_twist=1.05,  # degrees
)

print(f"Moire wavelength: {result.geometry.wavelength:.1f} nm")
print(f"Energy reduction: {100 * result.energy_reduction:.1f}%")

result.plot_stacking(n_tile=2)        # AB/BA triangular domains
result.plot_elastic_energy(n_tile=2)  # SDW network
result.plot_local_twist(n_tile=2)     # AA vortex map

All bundled examples are CLI-configurable:

python examples/bilayer_relaxation.py                    # TBG default
python examples/bilayer_relaxation.py --preset hbn       # graphene/hBN
python examples/bilayer_relaxation.py --preset tmd       # MoSe2/WSe2
python examples/bilayer_relaxation.py --list-interfaces  # show all bundled interfaces

See the documentation for the full quick-start guide, multi-layer stacks, strain extraction, constrained relaxation, custom materials via TOML, and the API reference.

References

Capability Reference
Single-interface relaxation, GSFE-based continuum model [1]
Multi-layer (LayerStack) relaxation [2]
Strain matrix and twist-angle extraction from moire vectors [3]
Spatially-varying / point-pinned constrained relaxation [4]
  1. Halbertal, D. et al. Moire metrology of energy landscapes in van der Waals heterostructures. Nat. Commun. 12, 242 (2021). doi:10.1038/s41467-020-20428-1 -- arXiv:2008.04835

  2. Halbertal, D. et al. Multilayered Atomic Relaxation in van der Waals Heterostructures. Phys. Rev. X 13, 011026 (2023). doi:10.1103/PhysRevX.13.011026 -- arXiv:2206.06395

  3. Halbertal, D., Shabani, S., Pasupathy, A. N. & Basov, D. N. Extracting the Strain Matrix and Twist Angle from the Moire Superlattice in van der Waals Heterostructures. ACS Nano 16, 1471--1476 (2022). doi:10.1021/acsnano.1c09789

  4. Shabani, S., Halbertal, D., Wu, W., Chen, M., Liu, S., Hone, J., Yao, W., Basov, D. N., Zhu, X. & Pasupathy, A. N. Deep moire potentials in twisted transition metal dichalcogenide bilayers. Nature Physics 17, 720--725 (2021). doi:10.1038/s41567-021-01174-7 -- arXiv:2008.07696

Citing the software itself

The package is archived on Zenodo with a concept DOI that always resolves to the latest version:

A machine-readable citation file is provided as CITATION.cff; GitHub surfaces it via the "Cite this repository" button.

License

MIT. See LICENSE.

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

moire_metrology-0.8.0.tar.gz (140.6 kB view details)

Uploaded Source

Built Distribution

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

moire_metrology-0.8.0-py3-none-any.whl (89.7 kB view details)

Uploaded Python 3

File details

Details for the file moire_metrology-0.8.0.tar.gz.

File metadata

  • Download URL: moire_metrology-0.8.0.tar.gz
  • Upload date:
  • Size: 140.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for moire_metrology-0.8.0.tar.gz
Algorithm Hash digest
SHA256 dfe0030dbf4d6b1d44cfc1bff6f31c30d2fea90b2660639b0a05f3067a6767ba
MD5 d97938226f9000648acffabdbd61650f
BLAKE2b-256 deb069835f8bf75fc3ed0767bd759f3b7ab92a7440f3e7d91abefadda94a0788

See more details on using hashes here.

Provenance

The following attestation bundles were made for moire_metrology-0.8.0.tar.gz:

Publisher: release.yml on dorrih/moire_metrology

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moire_metrology-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: moire_metrology-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 89.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for moire_metrology-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0353dc37ca2328cfcbc15dae272fa1fa137e0ea6583e63357719ad0570b79fc8
MD5 847ab83575129cd2df8eea45bd2aab49
BLAKE2b-256 b1904847dabcf6c005d6e0f27290bece506f53776de2eb6ed0ab44a9ffb1a418

See more details on using hashes here.

Provenance

The following attestation bundles were made for moire_metrology-0.8.0-py3-none-any.whl:

Publisher: release.yml on dorrih/moire_metrology

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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