## ~spxtr/bm_model

Bistritzer-MacDonald model for twisted bilayer graphene, with heterostrain.
`Typo.`
`Add an example.`
`Minor text fixes.`

main
browse  log

### clone

https://git.sr.ht/~spxtr/bm_model
git@git.sr.ht:~spxtr/bm_model

You can also use your local clone with git send-email.

## #Bistritzer-MacDonald model

Featuring heterostrain as computed in arXiv:2209.08204. Only depends on `numpy` for the computation of the Hamiltonian. The example usage notebook requires `tqdm`, `matplotlib`, and `scipy`.

Basic usage looks like this.

```import numpy as np
import matplotlib.pyplot as plt
import scipy
import scipy.linalg
import tqdm

import bm

# 1.38 degree twist angle with 0.2% biaxial heterostrain.
L, H = bm.prepare(ps)

# L contains lattice information that we can use to traverse the BZ.
N = 101
ks = np.concatenate((
np.linspace(L.Kt, L.Kb, N),
np.linspace(L.Kb, L.Γ, N),
np.linspace(L.Γ, L.M, N),
np.linspace(L.M, L.Kt, N),
))

eigs = np.empty((len(ks), len(H(0))))
for i, k in enumerate(tqdm.tqdm(ks)):
eigs[i, :] = np.sort(scipy.linalg.eigvalsh(H(k)))

plt.figure(figsize=(6, 4))
for i in range(5):
plt.axvline(i * N, alpha=0.2, ls='--')
plt.axhline(0, alpha=0.2, ls='--')
for i in range(eigs.shape[1]):
plt.plot(eigs[:, i], 'k')
plt.xticks([0, N, 2 * N, 3 * N, 4 * N], ['K\'', 'K', 'Γ', 'M', 'K\''])
plt.ylim(-220, 220)
plt.ylabel('E (meV)')
plt.tight_layout()
plt.show()
```

See `usage.ipynb` for a 2D plot. See `bm.py` for a list of parameters.