kp_tblg Generates k-dot-p Hamiltonians based on ab initio models of twisted bilayer graphene. A C++ (python compatible) and a MATLAB version included. For reference of the k-dot-p model, see (and please cite) the following two works: "Minimal model for low-energy electronic states of twisted bilayer graphene." Stephen Carr, Shiang Fang, Ziyan Zhu, Efthimios Kaxiras https://arxiv.org/abs/1901.03420 "Angle-dependent ab initio low-energy hamiltonians for a relaxed twisted bilayer graphene heterostructure." Shiang Fang, Stephen Carr, Ziyan Zhu, Daniel Massatt, Efthimios Kaxiras https://arxiv.org/abs/1908.00058 The 8-band and 5-band reduced models can be found in (check the README!): ./MATLAB_vers/wannierization/ For reference of the 8-band and 5-band models, see (and please cite): "Derivation of Wannier orbitals and minimal-basis tight-binding hamiltonians for twisted bilayer graphene: a first-principles approach." Stephen Carr, Shiang Fang, Hoi Chun Po, Ashvin Vishwanath, Efthimios Kaxiras https://arxiv.org/abs/1907.06282 ===== CONTACT: stephencarr(at)g.harvard.edu Please let me know of any bugs, or if you have a feature request. ===== NOTE ON DATASET: There is currently one dataset of k-dot-p terms. The terms are organized in "shells" of equal momenta magnitude, organized via hexagonal Miller (crystallographic) indices. This includes 10 "shells" of coupling for both interlayer and intralayer coupling, and 1 "shell" of k-dependent interlayer terms. The dataset "data/full_relax_kp_01-06-2019.dat" contains terms for theta between 5.08 and 0.416 (degrees). We are preparing additional datasets for smaller angles, but these will be relased seperately. They require many more "shells" for accuracy in the low-energy electronic states. ===== NOTE ON UNITS: Our model uses energy units of eV and length units of Angstroms. ===== INSTALLATION: This code requires a c++ compiler and access to the header-only libraries: Eigen (required) pybind11 (optional) A python-readable library can be generated if the option is turned on in the CMakeLists.txt file in this directory. If making a python library, you have to pull the pybind11 repo by hand: git submodule update --init --recursive To compile: mkdir build cd build cmake .. make [python note: if pybind11 is finding python.3.x instead of python.2.x, try: cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python .. instead of < cmake .. >, this will usually force it to use python (not python3)] ===== USE: The class Kp_tblg_construct can be used to create accurate k-dot-p Hamiltonians including relaxation of the layers. (1) Initalize: Kp_tblg_construct kp = Kp_tblg_construct(); (2) Load data file: kp.loadFiles("data/full_relax_kp_01-06-2019.dat"); (3) Set twisting angle: kp.setTwist(1); // in degrees (4) Set sparsity pattern: kp.prepare(); (5) Access Hamiltonian: Eigen::MatrixXcd H = kp.getH(k); // k must be an Eigen::Vector2d Then use the hamiltonain H to e.g. compute bandstructure by diagonalization [In python, the usage is identical, except replace Eigen datatypes with their numpy counterparts] ===== TESTING (C++): Execute the application app/kp_tblg_test: ./app/kp_tblg_test This requires the data file (data/full_relax_kp-01-06-2019.dat) to be in the same folder as where the executable is called from. Note that the Eigen diagonalization routine is sometimes very slow, so this may take a while ===== TESTING (PYTHON): For testing the python code, try using: pysrc/generate_H_example.py pysrc/bandcalc.py Both the data-file (data/full_relax_kp_01-06-2019.dat) and the tblg_kpy.so library must be in your current working directory when these scripts are called.