MLM: Multi-Layer Moire -- A Python Package for Generating Commensurate Supercells of Twisted Multilayer Two-Dimensional Materials
Pith reviewed 2026-05-08 15:59 UTC · model grok-4.3
The pith
The MLM package uses a solve-and-round algorithm to generate periodic supercells for multilayer twisted 2D materials with arbitrary angles and lattice types.
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
Core claim
MLM constructs periodic, PBC-compatible moire supercells for an arbitrary number of twisted layers with any Bravais lattice type. It employs a solve-and-round algorithm that reduces the coincidence-site search to an O(N^2) linear-algebra problem per twist angle, compared to the O(N^4) brute-force enumeration required by conventional approaches. The fractional-coordinate atom-selection algorithm scales to supercells containing millions of atoms and is robust across all twist angles including very small angles below 1 degree.
What carries the argument
The solve-and-round algorithm, which solves a linear system for approximate lattice-vector matches between layers and rounds the result to integer indices within a user-specified tolerance to locate coincidence sites.
If this is right
- Trilayer and higher multilayer twisted systems with independent angles become practical to model under periodic boundary conditions.
- Supercells containing millions of atoms can be generated and simulated without prohibitive memory or time costs.
- Output files ready for VASP and LAMMPS allow immediate use in standard electronic-structure and molecular-dynamics workflows.
- The method works for any Bravais lattice, removing the need for separate code paths when moving between materials such as graphene and perovskites.
Where Pith is reading between the lines
- Integration with automated relaxation or strain-mapping tools could extend the package to produce relaxed structures directly from the ideal commensurate cells.
- The efficiency gain may enable high-throughput screening of multilayer twist angles for desired electronic or optical properties.
- Standardizing supercell generation through such a package could improve reproducibility when comparing results across different twistronics studies.
Load-bearing premise
The solve-and-round procedure will reliably produce valid commensurate supercells within the prescribed tolerance for arbitrary combinations of twist angles, layer numbers, and Bravais lattice types without missing optimal solutions or requiring post-hoc adjustments.
What would settle it
Apply the algorithm to a documented trilayer MoS2 system with a known exact supercell size at a twist angle below 1 degree and verify whether the returned cell reproduces the expected moire periodicity to within the input tolerance.
Figures
read the original abstract
Moire superlattices formed by stacking atomically thin two-dimensional materials with a relative twist angle have emerged as a versatile platform for engineering quantum electronic, optical, and ferroic properties. Computational modelling of such systems with periodic boundary conditions requires the identification of commensurate supercells in which the moire periodicity is reproduced exactly, or within a prescribed tolerance. While several codes exist for bilayer systems, extension to three or more layers with independently chosen twist angles remains a significant challenge. Here we present MLM (Multi-Layer Moire), an open-source Python package that constructs periodic, PBC-compatible moire supercells for an arbitrary number of twisted layers with any Bravais lattice type. The package employs a solve-and-round algorithm that reduces the coincidence-site search to an $O(N^2)$ linear-algebra problem per twist angle, compared to the O(N^4) brute-force enumeration required by conventional approaches. We demonstrate the package on bilayer graphene, bilayer and trilayer MoS$_2$, bilayer SrTiO$_3$, and a PbTiO$_3$/SrTiO$_3$ oxide heterostructure, producing simulation-ready structure files for both VASP and LAMMPS. The fractional-coordinate atom-selection algorithm scales to supercells containing millions of atoms and is robust across all twist angles including very small angles below 1 degree.
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The paper presents MLM, an open-source Python package for constructing periodic, PBC-compatible commensurate supercells of twisted multilayer 2D materials with arbitrary layer count and any Bravais lattice type. It introduces a solve-and-round algorithm that reduces the coincidence-site lattice-vector search to an O(N²) linear-algebra problem per twist angle (versus conventional O(N⁴) brute-force enumeration), demonstrates the package on bilayer graphene, bilayer/trilayer MoS₂, bilayer SrTiO₃, and a PbTiO₃/SrTiO₃ heterostructure, and reports generation of VASP/LAMMPS-ready structures that scale to supercells containing millions of atoms, including for twist angles <1°.
Significance. If the solve-and-round procedure is shown to be complete and reliable, the work would provide a practical and scalable tool for modeling complex moiré superlattices beyond bilayers, removing a major computational barrier in the study of multilayer twisted 2D systems. The open-source release, support for multiple output formats, and explicit scaling demonstrations constitute clear strengths.
major comments (2)
- [§3] §3 (solve-and-round algorithm description): No formal proof or exhaustive verification is given that the rounding step produces a single consistent integer supercell matrix satisfying simultaneous commensurability for all layer pairs when N>2 and twists are chosen independently; the abstract asserts general applicability, but the demonstrations remain case-specific and do not rule out inconsistent or non-minimal solutions for arbitrary angle/lattice combinations.
- [Results] Results section (demonstrations and scaling claims): The reported success on selected systems (including <1° twists) does not include systematic error analysis, comparison against known minimal cells, or tests confirming that the fractional-coordinate atom-selection procedure always yields valid structures within the prescribed tolerance without post-hoc fixes.
minor comments (2)
- The O(N²) versus O(N⁴) complexity statement should explicitly define the parameter N and the precise operations counted in each case.
- A short table comparing MLM output supercell sizes against existing bilayer codes for the same twist angles would improve clarity.
Simulated Author's Rebuttal
We thank the referee for their thorough review and insightful comments on our manuscript. We address each of the major comments in detail below and outline the revisions we plan to make to strengthen the paper.
read point-by-point responses
-
Referee: [§3] §3 (solve-and-round algorithm description): No formal proof or exhaustive verification is given that the rounding step produces a single consistent integer supercell matrix satisfying simultaneous commensurability for all layer pairs when N>2 and twists are chosen independently; the abstract asserts general applicability, but the demonstrations remain case-specific and do not rule out inconsistent or non-minimal solutions for arbitrary angle/lattice combinations.
Authors: We acknowledge the referee's concern regarding the lack of a formal proof for the consistency of the solve-and-round algorithm in multilayer systems. While the original manuscript describes the algorithm and demonstrates its application to specific cases including trilayer MoS₂, we agree that additional rigor is beneficial. In the revised manuscript, we will expand §3 to include a mathematical argument demonstrating that the rounding procedure yields a consistent integer supercell matrix for arbitrary N. This is based on solving the linear system for lattice vector approximations and applying a global rounding to ensure the same supercell is used across all layers, with the error bounded by the tolerance. Furthermore, we will include an appendix with exhaustive numerical verification for N up to 4 with independently chosen twist angles and different Bravais lattices, showing that consistent solutions are always obtained without inconsistencies. These additions will support the general applicability claimed in the abstract. revision: yes
-
Referee: [Results] Results section (demonstrations and scaling claims): The reported success on selected systems (including <1° twists) does not include systematic error analysis, comparison against known minimal cells, or tests confirming that the fractional-coordinate atom-selection procedure always yields valid structures within the prescribed tolerance without post-hoc fixes.
Authors: We thank the referee for pointing out the need for more systematic validation in the Results section. We will revise this section to incorporate a comprehensive error analysis, including comparisons of the generated supercell sizes and lattice parameters against analytically known minimal commensurate cells for bilayer systems such as graphene and MoS₂. We will also present results from a parameter sweep over twist angles, reporting the average and maximum rounding errors, as well as the frequency of obtaining the minimal cell. For the atom-selection procedure, we will add tests across all demonstrated systems and additional random configurations, confirming that structures are generated within the specified tolerance without any post-processing adjustments. These enhancements will provide stronger evidence for the reliability and scalability of the package, including for supercells with millions of atoms. revision: yes
Circularity Check
No circularity; algorithm is a direct linear-algebra construction
full rationale
The paper presents a solve-and-round procedure that reduces the coincidence-site lattice search to solving a linear system for each twist angle followed by integer rounding. This is a standard computational technique whose output is not presupposed in its definition, nor does any equation or claim reduce to a fitted parameter or self-citation. No self-definitional loops, renamed empirical patterns, or load-bearing self-citations appear in the abstract or described method. The O(N^2) scaling follows directly from the per-angle linear-algebra step without circular reduction, and demonstrations on specific multilayer systems serve as external validation rather than redefinition of the algorithm. The derivation chain is therefore self-contained against external benchmarks.
Axiom & Free-Parameter Ledger
axioms (1)
- standard math Standard linear algebra operations suffice to solve for integer combinations of lattice vectors that approximate twist-induced shifts
Reference graph
Works this paper leans on
-
[1]
National Academies of Sciences, Engineering, and Medicine, Frontiers in Synthetic Moiré Quantum Matter, National Academies Press, 2022
2022
-
[2]
M. Feuerbacher, Moiré, euler and self-similarity – the lattice param- eters of twisted hexagonal crystals, Acta Crystallographica Section A Foundations and Advances 77 (5) (2021) 460–471.doi:10.1107/ s2053273321007245
2021
-
[3]
M. H. Naik, I. Maity, P. K. Maiti, M. Jain, Kolmogorov–crespi potential for multilayer transition-metal dichalcogenides: Capturing structural transformations in moiré superlattices, The Journal of Physical Chem- istry C 123 (15) (2019) 9770–9778.doi:10.1021/acs.jpcc.8b10392
-
[4]
Sánchez-Santolino, V
G. Sánchez-Santolino, V. Rouco, S. Puebla, H. Aramberri, V. Zamora, M. Cabero, F. A. Cuellar, C. Munuera, F. Mompean, M. García- Hernández, A. Castellanos-Gomez, J. I. niguez, C. Leon, J. San- tamaria, A 2d ferroelectric vortex pattern in twisted batio 3 free- standing layers, Nature 626 (7999) (2024) 529–534.doi:10.1038/ s41586-023-06978-6
2024
-
[5]
L. Du, M. R. Molas, Z. Huang, G. Zhang, F. Wang, Z. Sun, Moiré photonics and optoelectronics, Science 379 (6639) (Mar. 2023).doi: 10.1126/science.adg0014
-
[6]
M. H. Naik, M. Jain, TWISTER: Construction and structural relaxation of commensurate moiré superlattices, Computer Physics Communica- tions 271 (2022) 108184.doi:10.1016/j.cpc.2021.108184
-
[7]
A. H. Larsen, et al., The atomic simulation environment — a Python library for working with atoms, Journal of Physics: Condensed Matter 29 (27) (2017) 273002.doi:10.1088/1361-648X/aa680e
-
[8]
A. P. Thompson, H. M. Aktulga, R. Berger, D. S. Bolintineanu, W. M. Brown, P. S. Crozier, P. J. in ’t Veld, A. Kohlmeyer, S. G. Moore, T. D. Nguyen, R. Shan, M. J. Stevens, J. Tranchida, C. Trott, S. J. Plimpton, Lammps-aflexiblesimulationtoolforparticle-basedmaterialsmodeling at the atomic, meso, and continuum scales, Computer Physics Commu- nications 27...
-
[9]
Y. Cao, V. Fatemi, A. Demir, S. Fang, S. L. Tomarken, J. Y. Luo, J. D. Sanchez-Yamagishi, K. Watanabe, T. Taniguchi, E. Kaxiras, R. C. Ashoori, P. Jarillo-Herrero, Correlated insulator behaviour at half-filling in magic-angle graphene superlattices, Nature 556 (7699) (2018) 80–84. doi:10.1038/nature26154
-
[10]
Y. Cao, V. Fatemi, S. Fang, K. Watanabe, T. Taniguchi, E. Kaxi- ras, P. Jarillo-Herrero, Unconventional superconductivity in magic- angle graphene superlattices, Nature 556 (7699) (2018) 43–50.doi: 10.1038/nature26160
-
[11]
F. M. Arnold, A. Ghasemifard, A. Kuc, J. Kunstmann, T. Heine, Re- laxation effects in twisted bilayer molybdenum disulfide: structure, sta- bility, and electronic properties, 2D Materials 10 (4) (2023) 045010. doi:10.1088/2053-1583/aceb75
-
[12]
A. M. van der Zande, J. Kunstmann, A. Chernikov, D. A. Chenet, Y. You, X. Zhang, P. Y. Huang, T. C. Berkelbach, L. Wang, F. Zhang, M. S. Hybertsen, D. A. Muller, D. R. Reichman, T. F. Heinz, J. C. Hone, Tailoring the electronic structure in bilayer molybdenum disul- fide via interlayer twist, Nano Letters 14 (7) (2014) 3869–3875.doi: 10.1021/nl501077m
-
[13]
S.Lee, D.J.P.deSá, B.Jiang, T.-R.Lee, Moirépolarvortex, flatbands, and lieb lattice in twisted bilayer perovskite oxides, Science Advances 10 (47) (2024) eadq0293.doi:10.1126/sciadv.adq0293. 28
discussion (0)
Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.