HubbardModel class

class HubbardModel(num_sites, t, U)

A class that represents the Hubbard model for a system of interacting electrons on a lattice. It is used to study phenomena in condensed matter physics such as high-temperature superconductivity.

Parameters:
  • num_sites (int) – The number of lattice sites in the model.

  • t (float) – The hopping parameter representing the kinetic energy for electrons hopping between sites.

  • U (float) – The on-site Coulomb interaction parameter.

create_hamiltonian()

Constructs the Hamiltonian matrix for the Hubbard model given the parameters specified during class instantiation.

Returns:

A Hamiltonian matrix of dimensions (4**num_sites, 4**num_sites).

Return type:

numpy.ndarray

diagonalize()

Diagonalizes the Hamiltonian matrix to find the energy levels of the system.

Returns:

A tuple containing an array of eigenvalues and a matrix of eigenvectors.

Return type:

(numpy.ndarray, numpy.ndarray)

plot_energy_levels(energies)

Plots the energy levels of the Hubbard model as horizontal lines.

Parameters:

energies (numpy.ndarray) – The array of energy levels to plot.

Example Usage

The following example demonstrates how to instantiate the HubbardModel class, compute the energy levels of the system, and plot them:

# Instantiate the model with 2 sites, hopping parameter t=1.0, and interaction U=2.0
model = HubbardModel(num_sites=2, t=1.0, U=2.0)

# Diagonalize the Hamiltonian to find the energy levels
energies, _ = model.diagonalize()

# Plot the energy levels
model.plot_energy_levels(energies)

This will produce a plot of the energy levels of the Hubbard model for a system with two lattice sites.