Hexagonal Lattice: Fermi-Hubbard model [courtesy of A. Buyskikh]

This example demonstrates how to use the python package networkx to construct a hexagonal (honeycomb) lattice, and define the Fermi-Hubbard Hamiltonian:

\[H = -t\sum_{\sigma=\pm}\sum_{i=0}^{N-1}\sum_{j_i=0}^{3} a^\dagger_{i\sigma} b_{j_i\sigma} + U\sum_i n_{i\uparrow}n_{i\downarrow}.\]

where \(i\) runs over the lattice sites, \(j_i\) over all nearest neighbours of \(i\), and \(\sigma\) labels the fermion spin index. The creation/annihilation operators on sublattice A and B, denoted \(a_i, b_{j_i}\), obey fermion statistics. The tunneling matrix element is \(t\), and the interaction strength is denoted by \(U\).

Below, we first construct the hexagonal graph using networkx, and then follow the standard QuSpin procedure to construct the Hamiltonian. The users should feel free to add the symmetries of the graph and send us an improved version of this tutorial, and we will update the script.

This example can be generalized to other lattice geometrices supported by networkx. To install networkx using anaconda, run

$ conda install -c anaconda networkx

Script

download script

 1#
 2import sys, os
 3
 4os.environ["KMP_DUPLICATE_LIB_OK"] = (
 5    "True"  # uncomment this line if omp error occurs on OSX for python 3
 6)
 7os.environ["OMP_NUM_THREADS"] = "1"  # set number of OpenMP threads to run in parallel
 8os.environ["MKL_NUM_THREADS"] = "1"  # set number of MKL threads to run in parallel
 9#
10
11###########################################################################
12#                            example 18                                   #
13# This example exploits the python package 'networkx',                    #
14# https://networkx.github.io/documentation/stable/ , for building a       #
15# connectivity graph representing the hexagonal lattice geometry, using   #
16# the spinful Fermy-Hubbard model on a honeycomb lattice. Using the same  #
17# syntax one can define many other geometries predefined in networkx.     #
18###########################################################################
19from quspin.basis import spinful_fermion_basis_general
20from quspin.operators import hamiltonian
21import numpy as np
22import networkx as nx  # networkx package, see https://networkx.github.io/documentation/stable/
23import matplotlib.pyplot as plt  # plotting library
24
25#
26###### create honeycomb lattice
27# lattice graph parameters
28m = 2  # number of rows of hexagons in the lattice
29n = 2  # number of columns of hexagons in the lattice
30isPBC = False  # if True, use periodic boundary conditions
31#
32### build graph using networkx
33hex_graph = nx.generators.lattice.hexagonal_lattice_graph(m, n, periodic=isPBC)
34# label graph nodes by consecutive integers
35hex_graph = nx.convert_node_labels_to_integers(hex_graph)
36# set number of lattice sites
37N = hex_graph.number_of_nodes()
38print("constructed hexagonal lattice with {0:d} sites.\n".format(N))
39# visualise graph
40pos = nx.spring_layout(hex_graph, seed=42, iterations=100)
41nx.draw(hex_graph, pos=pos, with_labels=True)
42plt.show(block=False)
43#
44###### model parameters
45#
46N_up = 2  # number of spin-up fermions
47N_down = 2  # number of spin-down fermions
48t = 1.0  # tunnelling matrix element
49U = 2.0  # on-site fermion interaction strength
50#
51##### set up Fermi-Hubbard Hubbard Hamiltonian with quspin #####
52#
53### compute basis
54basis = spinful_fermion_basis_general(N, Nf=(N_up, N_down))
55print("Hilbert space size: {0:d}.\n".format(basis.Ns))
56#
57# define site-coupling lists
58tunnelling = [[-t, i, j] for i in range(N) for j in hex_graph.adj[i]]
59interactions = [[U, i, i] for i in range(N)]
60#
61# define site-coupling lists [hermitian conjugates "-+|" and "|-+" contained in tunnelling list]
62static = [["n|n", interactions], ["+-|", tunnelling], ["|+-", tunnelling]]
63dynamic = []
64#
65### construct Hamiltonian
66H = hamiltonian(static, dynamic, basis=basis, dtype=np.float64)
67#
68# compute eigensystem
69E, V = H.eigsh(k=4, which="SA", maxiter=1e4)
70print(f"\nlowest energies: {E}")