Skip to main content

Package for exactly solving low-dimensional fermionic Hamiltonians

Project description

FermPy

A Python package for exactly solving low-dimensional fermionic Hamiltonians. It was developed with the intention of constructing and diagonalizing matrix representations of low-dimensional, interacting fermionic Hamiltonians, in particular effective (surrogate) models that describe the low-energy (sub-gap) physics of the superconducting Anderson impurity model (see the arXiv preprint).

FermPy is based on NumPy and SciPy. Small systems use dense NumPy arrays as operator representations while large systems employ sparse SciPy arrays.

Functionality of this package includes:

  • Construction of matrix representations of operators ($H, S_z$, etc.) from a basis (chosen from symmetry considerations)
  • Diagonalization (numpy.linalg.eigh, scipy.sparse.linalg.eigh) of operators
  • Calculation of expectation values and thermal averages of operators

Installation

FermPy is found on PyPI and easily installed by running

pip install fermpy

from the command-line.

Usage

As an example of the intended usage of FermPy, we calculate and plot the excitation spectrum and average spin on a quantum dot (QD), coupled to a superconducting (SC) lead which is described by an effective three-level discretization (see the arXiv preprint for more details).


Import the necessary packages.
import numpy as np
import matplotlib.pyplot as plt

from fermpy.operator_sum import OpSum
from fermpy.hamiltonian_constructors import build_ham_op_sum_S_D
from fermpy.operator_representation import OpRep, operator_exp_val
from fermpy.bases import BasisS2

Construct the operator sum for the Hamiltonian $H$ of an SC-QD junction with an effective three-level lead. The effective couplings gamma and level positions xi are collected in Table 1 of the Supplemental Material of arXiv preprint. Everything is in units of the SC gap Delta.

Gamma = np.linspace(0, 10, 201)
h_os = build_ham_op_sum_S_D(epsilon_d=-7.5,
                            U=15,
                            Gamma=Gamma,
                            Delta=1,
                            gamma=[0.5080, 1.8454, 1.8454],
                            xi=[0, 2.7546, -2.7546])

Define the basis. Here, we choose the eigenstates of total spin $S^2$ (the Hamiltonian preserves spin rotational symmetry).

basis = BasisS2(1 + 3) # One quantum dot level + three lead levels

Build the matrix representation of the Hamiltonian from the operator sum h_os and basis. We only consider the singlet, doublet, and triplet states ($s = 0, 1/2, 1$) - the quantum numbers of $S^2$: $S^2 |s\rangle = s(s+1)|s\rangle$.

h_op = OpRep(h_os, basis, qns_to_consider=(0, 1, 2)) # quantum numbers: 2*s

Diagonalize $H$, giving the eigenenergies and eigenvectors. energies and eigenvectors are dictionaries with quantum numbers as keys ($2s = 0, 1, 2$) and NumPy arrays as values.

energies: dict[int, np.ndarray]
eigenvectors: dict[int, np.ndarray]
energies, eigenvectors = h_op.diagonalize_all_qns(return_eigenvectors=True)

Extract the ground state quantum number and energy.

s_gs = np.argmin([E[:, 0] for E in energies.values()], axis=0)
E_gs = np.array([energies[s][idx, 0] for idx, s in enumerate(s_gs)])

Calculate the z-projection of spin on the quantum dot in the ground state. The syntax of OpSum is similar to ITensor.

sz_op = OpRep(opsum=OpSum([('sz', 0)]), basis=basis)
sz_exp = operator_exp_val(op_rep=sz_op, state_rep=eigenvectors, axis=1)
sz_exp_gs = [sz_exp[s][idx, 0] for idx, s in enumerate(s_gs)]

Plot the excitation spectrum and average dot spin in the ground state.

fig, (ax_top, ax_bot) = plt.subplots(2, 1,
                                     figsize=(5.5, 5.5),
                                     sharex=True,
                                     constrained_layout=True
                                     )

ax_top.set(ylabel=r'$(E - E_\mathrm{GS}) / \Delta$',
           xlim=(0, 10),
           ylim=(-0.05, 2)
          )
ax_bot.set(xlabel=r'$\Gamma / \Delta$',
           ylabel=r'$\langle S_{z, \mathrm{dot}} \rangle$',
           xlim=(0, 10),
           ylim=(-0.05, 0.55)
          )

ax_top.hlines(1, 0, 10, linestyle='dashed', color='k', linewidth=0.5)
ax_bot.hlines(0, 0, 10, linestyle='dashed', color='k', linewidth=0.5)

colors = {0: 'tab:blue', 1: 'tab:orange', 2: 'tab:green'}
lines_to_label = []
for s, energies_s in energies.items():
    lines_to_label.append(ax_top.plot(Gamma,
                                      energies_s - E_gs[:, None],
                                      color=colors[s])[0]
                          )
ax_top.legend(handles=lines_to_label,
              labels=range(3),
              loc='upper right',
              title='s'
             )
ax_bot.plot(Gamma, sz_exp_gs)

Here's the output figure.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fermpy-0.0.2.tar.gz (69.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fermpy-0.0.2-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file fermpy-0.0.2.tar.gz.

File metadata

  • Download URL: fermpy-0.0.2.tar.gz
  • Upload date:
  • Size: 69.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for fermpy-0.0.2.tar.gz
Algorithm Hash digest
SHA256 827dc7da6f0df69eda277599a5afaafbe7b40cf8dca850a12156b207cac337ae
MD5 13544bdc24dce8b83ce1dc1bc01a7aeb
BLAKE2b-256 68d7bb44ae38ec1cf708e9f9b835b0a223379de8f94759679d6547920c2ea19c

See more details on using hashes here.

File details

Details for the file fermpy-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: fermpy-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for fermpy-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b6fc254a46b0204a8b4461cbf075266e8d44704fb617f2af4587083f88e64d68
MD5 57bcd22b59236e24bfdae5a114297311
BLAKE2b-256 26e8fb260015d0d73556cc03139a9998353f477ffb36c209e38bad03f428b759

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page