pycommute.models

Functions in this module return real or complex expression objects corresponding to some Hamiltonians widely used in the theory of quantum many-body systems, quantum optics and statistical mechanics of interacting spins.

By default, these functions use integer indices 0, 1, ... to label fermionic, bosonic and spin operators corresponding to individual basis states (lattice sites, orbitals) in the output expressions. They also accept custom lists of indices, which can come in two forms,

  • A list of integer and/or string indices, e.g. [0, "a", 2, 5, "xyz"];

  • A list of multi-indices, e.g. [('a', 1), ('b', 2), ('c', 'd')].

It is also allowed to mix indices and multi-indices in the same list.

Quantum many-body theory

pycommute.models.tight_binding(t: ndarray, *, indices: Sequence[int | str | Tuple[int | str, ...]] = None, statistics: int = -3) ExpressionR | ExpressionC

Constructs a tight-binding lattice Hamiltonian from a matrix of hopping elements t.

H^=i,j=0N1tijO^iO^j.

By default, the corresponding lattice is a collection of sites with integer indices i=0,,N1. Operators O^i and O^j can be fermionic or bosonic creation/annihilation operators. The on-site energies are given by the diagonal elements of the hopping matrix tij.

Parameters:
  • t – An N×N matrix of hopping elements tij.

  • indices – An optional list of N (multi-)indices to be used instead of the simple numeric indices i.

  • statistics – Statistics of the particles in question, either pycommute.expression.FERMION or pycommute.expression.BOSON.

Returns:

Tight-binding Hamiltonian H^.

pycommute.models.dispersion(eps: ndarray, *, indices: Sequence[int | str | Tuple[int | str, ...]] = None, statistics: int = -3) ExpressionR | ExpressionC

Constructs an energy dispersion term of a system of many fermions or bosons from a list of energy levels.

H^=i=0N1εiO^iO^i.

By default, individual degrees of freedom carry integer indices i=0,,N1. Operators O^i and O^j can be fermionic or bosonic creation/annihilation operators.

Parameters:
  • eps – A length-N list of energy levels εi.

  • indices – An optional list of N (multi-)indices to be used instead of the simple numeric indices i.

  • statistics – Statistics of the particles in question, either pycommute.expression.FERMION or pycommute.expression.BOSON.

Returns:

Dispersion term H^.

pycommute.models.pairing(delta: ndarray, *, indices: Sequence[int | str | Tuple[int | str, ...]] = None)

Constructs a pairing Hamiltonian from a matrix of pairing parameters Δ.

H^=i,j=0N1(Δijc^ic^jΔijc^ic^j).
Parameters:
  • delta – An N×N matrix of the pairing parameters Δij.

  • indices – An optional list of N (multi-)indices to be used instead of the simple numeric indices i.

Returns:

Pairing Hamiltonian H^.

pycommute.models.zeeman(b: ndarray, *, indices_up: Sequence[int | str | Tuple[int | str, ...]] = None, indices_dn: Sequence[int | str | Tuple[int | str, ...]] = None) ExpressionR | ExpressionC

Constructs a Zeeman coupling term describing a system of N electrons (spin-1/2 fermions) in an external magnetic field,

H^=2i=0N1S^iBi=i=0N1σ,σ=↑,(τσσBi)c^i,σc^i,σ.

The pre-factor 2 is the spin Landé factor, while the Bohr magneton and the Planck constant are set to unity. τ is a vector of Pauli matrices, and operators c^i,σ/c^i,σ create/annihilate electrons at site i with the 3-rd spin projection σ.

Parameters:
  • b

    One of the following:

    • An N×3 matrix, whose rows are the local magnetic field vectors bi={bix,biy,biz}.

    • A length-N vector of 3-rd projections biz. It is assumed that bix=biy=0 in this case.

  • indices_up – An optional list of N (multi-)indices to label the spin-up operators. By default, the spin-up operators carry indices (0, "up"), (1, "up"), ....

  • indices_dn – An optional list of N (multi-)indices to label the spin-down operators. By default, the spin-down operators carry indices (0, "dn"), (1, "dn"), ....

Returns:

Zeeman coupling term H^.

pycommute.models.hubbard_int(U: ndarray, *, indices_up: Sequence[int | str | Tuple[int | str, ...]] = None, indices_dn: Sequence[int | str | Tuple[int | str, ...]] = None) ExpressionR | ExpressionC

Constructs an interaction term of the Fermi-Hubbard model defined on a finite lattice (collection of sites i=0,,N1),

H^=i=0N1Uin^i,n^i,.
Parameters:
  • U – A length-N vector of Hubbard interaction parameters Ui.

  • indices_up – An optional list of N (multi-)indices to label the spin-up operators. By default, the spin-up operators carry indices (0, "up"), (1, "up"), ....

  • indices_dn – An optional list of N (multi-)indices to label the spin-down operators. By default, the spin-down operators carry indices (0, "dn"), (1, "dn"), ....

Returns:

Interaction term H^.

pycommute.models.bose_hubbard_int(U: ndarray, *, indices: Sequence[int | str | Tuple[int | str, ...]] = None) ExpressionR | ExpressionC

Constructs an interaction term of the Bose-Hubbard model defined on a finite lattice (collection of sites i=0,,N1),

H^=i=0N1Uia^ia^i(a^ia^i1).
Parameters:
  • U – A length-N vector of Hubbard interaction parameters Ui.

  • indices – An optional list of N (multi-)indices to be used instead of the simple numeric indices i.

Returns:

Interaction term H^.

pycommute.models.extended_hubbard_int(V: ndarray, *, indices_up: Sequence[int | str | Tuple[int | str, ...]] = None, indices_dn: Sequence[int | str | Tuple[int | str, ...]] = None) ExpressionR | ExpressionC

Constructs an interaction term of the extended Fermi-Hubbard model defined on a finite lattice (collection of sites i=0,,N1),

H^=12i,j=0N1Vijn^in^j,

where n^i=n^i,+n^i, is the total electron occupation number at site i. The local part of the interaction is encoded in the diagonal matrix elements Vii.

Parameters:
  • V – An N×N matrix of interaction parameters Vij.

  • indices_up – An optional list of N (multi-)indices to label the spin-up operators. By default, the spin-up operators carry indices (0, "up"), (1, "up"), ....

  • indices_dn – An optional list of N (multi-)indices to label the spin-down operators. By default, the spin-down operators carry indices (0, "dn"), (1, "dn"), ....

Returns:

Interaction term H^.

pycommute.models.t_j_int(J: ndarray, *, indices_up: Sequence[int | str | Tuple[int | str, ...]] = None, indices_dn: Sequence[int | str | Tuple[int | str, ...]] = None) ExpressionR | ExpressionC

Constructs an interaction term of the t-J model defined on a finite lattice (collection of sites i=0,,N1),

H^=i,j=0N1Jij(S^iS^j14n^in^j),

where

S^i=σστσσ2c^i,σc^i,σ

is the spin vector of the electron localized at site i, and n^i=n^i,+n^i, is the total electron occupation number at site i.

Parameters:
  • J – An N×N matrix of coupling parameters Jij.

  • indices_up – An optional list of N (multi-)indices to label the spin-up operators. By default, the spin-up operators carry indices (0, "up"), (1, "up"), ....

  • indices_dn – An optional list of N (multi-)indices to label the spin-down operators. By default, the spin-down operators carry indices (0, "dn"), (1, "dn"), ....

Returns:

Interaction term H^.

pycommute.models.kondo_int(J: ndarray, *, indices_up: Sequence[int | str | Tuple[int | str, ...]] = None, indices_dn: Sequence[int | str | Tuple[int | str, ...]] = None, indices_spin: Sequence[int | str | Tuple[int | str, ...]] = None, spin: float = 0.5) ExpressionR | ExpressionC

Constructs an interaction term of the Kondo lattice model defined on a finite collection of sites i=0,,N1,

H^=i=0N1Jis^iS^i,

where

s^i=σστσσ2c^i,σc^i,σ

is the spin vector of the electron localized at site i.

Parameters:
  • J – A length-N vector of coupling constants Ji.

  • indices_up – An optional list of N (multi-)indices to label the spin-up operators c^i,/ c^i,. By default, the spin-up operators carry indices (0, "up"), (1, "up"), ....

  • indices_dn – An optional list of N (multi-)indices to label the spin-down operators c^i,/ c^i,. By default, the spin-down operators carry indices (0, "dn"), (1, "dn"), ....

  • indices_spin – An optional list of N (multi-)indices to label the localized spin operators S^i. By default, the localized spin operators carry indices 0, 1, ....

  • spin – Spin of operators S^i, 1/2 by default.

Returns:

Interaction term H^.

pycommute.models.holstein_int(g: ndarray, *, indices_up: Sequence[int | str | Tuple[int | str, ...]] = None, indices_dn: Sequence[int | str | Tuple[int | str, ...]] = None, indices_boson: Sequence[int | str | Tuple[int | str, ...]] = None) ExpressionR | ExpressionC

Constructs an electron-phonon coupling term of the Holstein model defined on a finite collection of sites i=0,,N1,

H^=i=0N1σgin^i,σ(a^i+a^i).
Parameters:
  • g – A length-N vector of coupling constants gi.

  • indices_up – An optional list of N (multi-)indices to label the spin-up operators. By default, the spin-up operators carry indices (0, "up"), (1, "up"), ....

  • indices_dn – An optional list of N (multi-)indices to label the spin-down operators. By default, the spin-down operators carry indices (0, "dn"), (1, "dn"), ....

  • indices_boson – An optional list of N (multi-)indices to label the localized boson (phonon) operators a^i. By default, the localized boson operators carry indices 0, 1, ....

Returns:

Electron-phonon coupling term H^.

pycommute.models.quartic_int(U: ndarray, *, indices: Sequence[int | str | Tuple[int | str, ...]] = None, statistics: int = -3) ExpressionR | ExpressionC

Constructs a general 4-fermion or 4-boson interaction Hamiltonian

H^=12ijkl=0N1UijklO^iO^jO^lO^k.

Operators O^i and O^j can be fermionic or bosonic creation/annihilation operators.

Parameters:
  • U – An N×N×N×N tensor of interaction matrix elements Uijkl.

  • indices – An optional list of N (multi-)indices to be used instead of the simple numeric indices i.

  • statistics – Statistics of the particles in question, either pycommute.expression.FERMION or pycommute.expression.BOSON.

Returns:

Interaction Hamiltonian H^.

pycommute.models.kanamori_int(M: int, U: float | complex, J: float | complex, Up: float | complex = None, Jx: float | complex = None, Jp: float | complex = None, *, indices_up: Sequence[int | str | Tuple[int | str, ...]] = None, indices_dn: Sequence[int | str | Tuple[int | str, ...]] = None) ExpressionR | ExpressionC

Constructs a generalized Kanamori multiorbital Hamiltonian with M orbitals,

H^=Um=0M1n^m,n^m,+Umm=0M1n^m,n^m,+(UJ)m<mM1σn^m,σn^m,σ+JXmm=0M1d^m,d^m,d^m,d^m,+JPmm=0M1d^m,d^m,d^m,d^m,.

This function will derive values of the optional parameters according to the following rules.

  • If only U and J are provided, then the rest of parameters will be defined according to U=U2J and JX=JP=J (this choice results in a rotationally invariant form of the model).

  • If U, J and U are provided, then JX=JP=J.

  • If JX is provided, then JP must also be provided (and vice versa).

Parameters:
  • M – Number of orbitals M.

  • U – Intra-orbital Coulomb repulsion U.

  • J – Hund coupling constant J.

  • Up – Inter-orbital Coulomb repulsion U.

  • Jx – Spin-flip coupling constant JX.

  • Jp – Pair-hopping coupling constant JP.

  • indices_up – An optional list of M (multi-)indices to label the spin-up operators. By default, the spin-up operators carry indices (0, "up"), (1, "up"), ....

  • indices_dn – An optional list of M (multi-)indices to label the spin-down operators. By default, the spin-down operators carry indices (0, "dn"), (1, "dn"), ....

Returns:

Kanamori Hamiltonian H^.

pycommute.models.slater_int(F: ndarray, *, indices_up: Sequence[int | str | Tuple[int | str, ...]] = None, indices_dn: Sequence[int | str | Tuple[int | str, ...]] = None) ExpressionR | ExpressionC

Constructs a (2L+1)-orbital fully rotationally-invariant electron interaction Hamiltonian using Slater parametrization,

H^=12m1,m2,m3,m4=LLσ,σUm1,m2,m3,m4σ,σc^m1,σc^m2,σc^m4,σc^m3,σ.

The interaction tensor U is a linear combination of L+1 radial integrals F0,F2,F4,,F2L with coefficients given by the angular interaction matrix elements Ak(m1,m2,m3,m4),

Um1,m2,m3,m4σ,σ=k=02LFkAk(m1,m2,m3,m4).

All odd-k angular matrix elements vanish, while for the even k

Ak(m1,m2,m3,m4)==(2l+1)2(lkl000)2q=kk(1)m1+m2+q(lklm1qm3)(lklm2qm4).
Parameters:
  • F – List of L+1 radial Slater integrals F0,F2,F4,.

  • indices_up – An optional list of 2L+1 (multi-)indices to label the spin-up operators. By default, the spin-up operators carry indices (-L, "up"), (-L+1, "up"), ..., (L, "up").

  • indices_dn – An optional list of 2L+1 (multi-)indices to label the spin-down operators. By default, the spin-down operators carry indices (-L, "dn"), (-L+1, "dn"), ..., (L, "dn").

Returns:

Slater interaction Hamiltonian H^.

Spin lattice models

pycommute.models.ising(J: ndarray, h_l: ndarray = None, h_t: ndarray = None, *, indices: Sequence[int | str | Tuple[int | str, ...]] = None, spin: float = 0.5) ExpressionR | ExpressionC

Constructs Hamiltonian of the quantum Ising model on a finite lattice (collection of sites i=0,,N1),

H^=i,j=0N1JijS^izS^jzi=0N1(hilS^iz+hitS^ix).
Parameters:
  • J – An N×N matrix of coupling constants Jij.

  • h_l – A length-N vector of the local longitudinal magnetic fields hil. By default, all magnetic fields are zero.

  • h_t – A length-N vector of the local transverse magnetic fields hit. By default, all magnetic fields are zero.

  • indices – An optional list of N (multi-)indices to be used instead of the simple numeric indices i.

  • spin – Spin of operators S^iα, 1/2 by default.

Returns:

Hamiltonian H^.

pycommute.models.heisenberg(J: ndarray, h: ndarray = None, *, indices: Sequence[int | str | Tuple[int | str, ...]] = None, spin: float = 0.5) ExpressionR | ExpressionC

Constructs Hamiltonian of the quantum Heisenberg model on a finite lattice (collection of sites i=0,,N1),

H^=i,j=0N1JijS^iS^ji=0N1hiS^i.
Parameters:
  • J – An N×N matrix of Heisenberg coupling constants Jij.

  • h – An N×3 matrix, whose rows are the local magnetic field vectors hi={hix,hiy,hiz}. By default, all magnetic fields are zero.

  • indices – An optional list of N (multi-)indices to be used instead of the simple numeric indices i.

  • spin – Spin of operators S^i, 1/2 by default.

Returns:

Hamiltonian H^.

pycommute.models.anisotropic_heisenberg(J: Tuple[ndarray, ndarray, ndarray], h: ndarray = None, *, indices: Sequence[int | str | Tuple[int | str, ...]] = None, spin: float = 0.5) ExpressionC

Constructs Hamiltonian of the anisotropic quantum Heisenberg model on a finite lattice (collection of sites i=0,,N1),

H^=i,j=0N1[JijxS^ixS^jx+JijyS^iyS^jy+JijzS^izS^jz]i=0N1hiS^i.
Parameters:
  • J – A triplet of N×N matrices of Heisenberg coupling constants (Jijx,Jijy,Jijz).

  • h – An N×3 matrix, whose rows are the local magnetic field vectors hi={hix,hiy,hiz}. By default, all magnetic fields are zero.

  • indices – An optional list of N (multi-)indices to be used instead of the simple numeric indices i.

  • spin – Spin of operators S^i, 1/2 by default.

Returns:

Hamiltonian H^.

pycommute.models.biquadratic_spin_int(J: ndarray, *, indices: Sequence[int | str | Tuple[int | str, ...]] = None, spin: float = 1) ExpressionR | ExpressionC

Constructs a biquadratic spin interaction term on a finite lattice (collection of sites i=0,,N1),

H^=i,j=0N1Jij(S^iS^j)2
Parameters:
  • J – An N×N matrix of Heisenberg coupling constants Jij.

  • indices – An optional list of N (multi-)indices to be used instead of the simple numeric indices i.

  • spin – Spin of operators S^i, 1 by default.

Returns:

Interaction term H^.

pycommute.models.dzyaloshinskii_moriya(D: ndarray, *, indices: Sequence[int | str | Tuple[int | str, ...]] = None, spin: float = 0.5) ExpressionC

Constructs Dzyaloshinskii–Moriya interaction Hamiltonian on a finite lattice (collection of sites i=0,,N1).

H^=i,j=0N1Dij(S^i×S^j).
Parameters:
  • D – An N×N×3 array, whose slices D[i,j,:] are vectors Dij.

  • indices – An optional list of N (multi-)indices to be used instead of the simple numeric indices i.

  • spin – Spin of operators S^i, 1/2 by default.

Returns:

Hamiltonian H^.

Quantum optics and quantum dissipation

pycommute.models.spin_boson(eps: ndarray, delta: ndarray, omega: ndarray, lambda_: ndarray, *, indices_spin: Sequence[int | str | Tuple[int | str, ...]] = None, indices_boson: Sequence[int | str | Tuple[int | str, ...]] = None, spin: float = 0.5) ExpressionR | ExpressionC

Constructs Hamiltonian of the general multi-spin-boson model with N spin degrees of freedom and M bosonic modes,

H^=i=0N1(ϵiS^iz+ΔiS^ix)+m=0M1ωma^ma^m+i=0N1m=0M1S^iz(λima^m+λima^m).
Parameters:
  • eps – A length-N vector of energy biases ϵi.

  • delta – A length-N vector of tunneling amplitudes Δi.

  • omega – A length-M vector of bosonic frequencies ωm.

  • lambda – An N×M matrix of spin-boson coupling constants λim.

  • indices_spin – An optional list of N (multi-)indices to be used instead of the simple numeric indices i.

  • indices_boson – An optional list of M (multi-)indices to be used instead of the simple numeric indices m.

  • spin – Spin of operators S^iα, 1/2 by default.

Returns:

Spin-boson Hamiltonian H^.

pycommute.models.rabi(eps: ndarray, omega: ndarray, g: ndarray, *, indices_atom: Sequence[int | str | Tuple[int | str, ...]] = None, indices_boson: Sequence[int | str | Tuple[int | str, ...]] = None, spin: float = 0.5) ExpressionR | ExpressionC

Constructs Hamiltonian of the general multi-mode multi-atom Rabi model with N atomic degrees of freedom and M cavity modes,

H^=i=0N1ϵiS^iz+m=0M1ωma^ma^m+i=0N1m=0M1gimS^ix(a^m+a^m).
Parameters:
  • eps – A length-N vector of atomic transition frequencies ϵi.

  • omega – A length-M vector of cavity frequencies ωm.

  • g – An N×M matrix of atom-cavity coupling constants gim.

  • indices_atom – An optional list of N (multi-)indices to be used instead of the simple numeric indices i.

  • indices_boson – An optional list of M (multi-)indices to be used instead of the simple numeric indices m.

  • spin – Pseudo-spin of operators S^iα, 1/2 by default (two-level atoms).

Returns:

Spin-boson Hamiltonian H^.

pycommute.models.jaynes_cummings(eps: ndarray, omega: ndarray, g: ndarray, *, indices_atom: Sequence[int | str | Tuple[int | str, ...]] = None, indices_boson: Sequence[int | str | Tuple[int | str, ...]] = None, spin: float = 0.5) ExpressionR | ExpressionC

Constructs Hamiltonian of the multi-mode multi-atom Jaynes-Cummings model (Tavis-Cummings model) with N atomic degrees of freedom and M cavity modes,

H^=i=0N1ϵiS^iz+m=0M1ωma^ma^m+i=0N1m=0M1(gima^mS^i+gima^mS^i+).
Parameters:
  • eps – A length-N vector of atomic transition frequencies ϵi.

  • omega – A length-M vector of cavity frequencies ωm.

  • g – An N×M matrix of atom-cavity coupling constants gim.

  • indices_atom – An optional list of N (multi-)indices to be used instead of the simple numeric indices i.

  • indices_boson – An optional list of M (multi-)indices to be used instead of the simple numeric indices m.

  • spin – Pseudo-spin of operators S^iα, 1/2 by default (two-level atoms).

Returns:

Spin-boson Hamiltonian H^.