# How to get the energy bands of the Haldane model?

I am struggling with how to get the dispersion relationship of the Haldane model and plot it, just like this:

And then apply it to graphene nanoribbons (armchair) and plot it like this:

Here's a reference: Haldane model.

Better with codes.

The Haldane model hamiltonian for the full (infinite) 2D plane reads $$H(\mathbf k) = t_1 \sum_i\left[\sigma_x \cos(\mathbf a_i\cdot \mathbf k) - \sigma_y \sin(\mathbf a_i\cdot \mathbf k)\right] +M\sigma_z +2t_2\sum_i \sigma_z \sin(\mathbf b_i\cdot \mathbf k)$$ in the crystal-momentum plane, with the notation explained in depth in this link, from which you presumably took your images. This means that the hamiltonian can be written in the form $$H(\mathbf k) = \mathbf B(\mathbf k) \cdot \boldsymbol\sigma,$$ where $$\boldsymbol \sigma = (\sigma_x, \sigma_y, \sigma_z)$$ is the vector of the three Pauli matrices, which gets dotted with the vector-valued function $$\mathbf B(\mathbf k) = \begin{pmatrix} t_1 \sum_i \cos(\mathbf a_i\cdot \mathbf k) \\ t_1 \sum_i \sin(\mathbf a_i\cdot \mathbf k) \\ M + 2t_2\sum_i \sin(\mathbf b_i\cdot \mathbf k) \end{pmatrix}$$ to give the hamiltonian.
The nice thing about this expression is that any linear combination of Pauli matrices has simple eigenvalues, $$\pm 1$$, since it basically represents a Pauli matrix around the axis of quantization fixed by the direction of the vector that's dotted into $$\boldsymbol \sigma$$. If you care about the eigenvectors then you basically get them directly from the Bloch-sphere representation (though with some nontrivial handling of gauge issues), but if you only need the energy spectrum then that's not necessary: on a frame aligned with the unit vector $$\hat{\mathbf n}(\mathbf k) = \mathbf B(\mathbf k)/B(\mathbf k)$$, for $$B(\mathbf k) = ||\mathbf B(\mathbf k)||,$$ the hamiltonian reads $$H(\mathbf k) = B(\mathbf k) \sigma_{\hat{\mathbf n}(\mathbf k)},$$ with the eigenvalues of $$\sigma_{\hat{\mathbf n}(\mathbf k)}$$ set to $$\pm 1$$, so the eigenvalues of $$H(\mathbf k)$$ then given by $$\pm B(\mathbf k ) = \pm \sqrt{ \left(t_1 \sum_i \cos(\mathbf a_i\cdot \mathbf k) \right)^2 +\left(t_1 \sum_i \sin(\mathbf a_i\cdot \mathbf k) \right)^2 +\left(M + 2t_2\sum_i \sin(\mathbf b_i\cdot \mathbf k)\right)^2 }.$$
On the other hand, if you want to get the spectrum for a nanoribbon, then you need to do the Fourier transform (which gets you from the position representation to the crystal-momentum representation) in only one dimension, keeping the explicit matrix in the other direction and imposing the relevant boundary conditions. This then gets you a large-ish $$n$$-by-$$n$$ matrix $$H(k)$$, as a function of a one-dimensional crystal momentum and with $$n$$ the number of unit cells transversely across the nanoribbon.
And, unfortunately, there's no analytical way to get those eigenvalues ─ they need to be solved numerically for each $$k$$ you want to handle. This is generally quite efficient for smallish matrices (i.e. it's not a problem unless you want to churn $$n$$ up to the multiple hundreds or thousands), but there's no alternative to the numerics.