Skip to main content

A small package to create images of atomic lattices

Project description

Moiré lattice generator

Binder build PyPI Documentation Status DOI

test

Easily generate renders of lattices, moiré lattices and even quasi-lattices in Python.

Documentation: https://moire-lattice-generator.readthedocs.io

Magic angle bilayer graphene was shown to be superconducting in 2018 [1]. Despite the considerable hype concerning this discovery, little code exists to visualize the moiré pattern of two graphene layers.

To illustrate the work as done in our own paper "Direct evidence for flat bands in twisted bilayer graphene from nano-ARPES" (arXiv version here), I created this repository.

This repository contains Python code to generate lattices with values reasonably like experimental (e.g. STM or TEM) results. If you are looking to generate more schematic like hexagonal lattice drawings, have a look at @alexkaz2's excellent hexalattice.

  • Trigonal, hexagonal, square lattices as well as quasi lattices can be created and combined.
  • Linear distortions, such as a uniaxial strain along an arbitrary direction and rotations are supported. In addition, arbitrary deformations can be rendered (by passing a deformation tensor to the shift parameter).
  • Edge dislocations can be added to the lattice as well.

A simple Python notebook to interactively generate visualizations of moire patterns of hexagonal lattices at different angles is included.

A high resolution resulting movie of varying twist angle can be found here.

Furthermore, the effect of uniaxial deformation along a single direction as described in e.g. "Measuring local moiré lattice heterogeneity of twisted bilayer graphene " can be visualized.

Click the "Launch binder" button above to open an interactive notebook directly in your browser. (Note: performance in the mybinder environment is somewhat slow. Download and run the notebook on a local machine for better performance.)

moire pattern

Installation

Using pip

The package is available on pypi:

pip install latticegen

From source

If you want to install from source, that is of course also possible:

git clone https://github.com/TAdeJong/moire-lattice-generator.git
cd moire-lattice-generator
pip install .

If you want to be able to play around with the functions themselves, consider using pip install -e ..

Using conda:

Not yet available in conda-forge, but you can install it in a conda environment using pip. There is an environment.yml located in the binder folder in this project which can be used to create the environment: conda env create -f binder/environment.yml

Development

Testing

This project uses pytest and hypothesis to run tests.

Install the test dependencies:

$ pip install -r requirements_test.txt

To run the tests:

$ pytest

Releasing

Releases are published to PyPI by github actions when a tag is pushed to GitHub. (Note: we are using versioneer for version management)

Acknowledgement

This work was financially supported by the Netherlands Organisation for Scientific Research (NWO/OCW) as part of the Frontiers of Nanoscience (NanoFront) program.

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

latticegen-0.0.5.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

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

latticegen-0.0.5-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file latticegen-0.0.5.tar.gz.

File metadata

  • Download URL: latticegen-0.0.5.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for latticegen-0.0.5.tar.gz
Algorithm Hash digest
SHA256 665344161d16f2cdfd35b5cfdd36fed32bc90fc1d8b89a6227fe1c53687b73bf
MD5 96f1b0a09383872d924b31eb7360e652
BLAKE2b-256 aa16d1f641fb198b3d1ed9d6ed72f3b645a297034f5174c140b2b5881f62475d

See more details on using hashes here.

File details

Details for the file latticegen-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: latticegen-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for latticegen-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f1ee1495511c84ed1144877e3f71ce2cefc803acdbee31dc20fa910b3c2571ef
MD5 39bc72134edacf1e27a4bf24aae234fb
BLAKE2b-256 5bbe5c20d1368101ea3411a1c5683c26b1d2e516fb6f125dc1380b5469919967

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