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
.By default, the corresponding lattice is a collection of sites with integer indices
. Operators and can be fermionic or bosonic creation/annihilation operators. The on-site energies are given by the diagonal elements of the hopping matrix .- Parameters:
t – An
matrix of hopping elements .indices – An optional list of
(multi-)indices to be used instead of the simple numeric indices .statistics – Statistics of the particles in question, either
pycommute.expression.FERMION
orpycommute.expression.BOSON
.
- Returns:
Tight-binding Hamiltonian
.
- 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.
By default, individual degrees of freedom carry integer indices
. Operators and can be fermionic or bosonic creation/annihilation operators.- Parameters:
eps – A length-
list of energy levels .indices – An optional list of
(multi-)indices to be used instead of the simple numeric indices .statistics – Statistics of the particles in question, either
pycommute.expression.FERMION
orpycommute.expression.BOSON
.
- Returns:
Dispersion term
.
- pycommute.models.pairing(delta: ndarray, *, indices: Sequence[int | str | Tuple[int | str, ...]] = None)
Constructs a pairing Hamiltonian from a matrix of pairing parameters
.- Parameters:
delta – An
matrix of the pairing parameters .indices – An optional list of
(multi-)indices to be used instead of the simple numeric indices .
- Returns:
Pairing Hamiltonian
.
- 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
electrons (spin-1/2 fermions) in an external magnetic field,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 / create/annihilate electrons at site with the 3-rd spin projection .- Parameters:
b –
One of the following:
An
matrix, whose rows are the local magnetic field vectors .A length-
vector of 3-rd projections . It is assumed that in this case.
indices_up – An optional list of
(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
(multi-)indices to label the spin-down operators. By default, the spin-down operators carry indices(0, "dn"), (1, "dn"), ...
.
- Returns:
Zeeman coupling term
.
- 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
),- Parameters:
U – A length-
vector of Hubbard interaction parameters .indices_up – An optional list of
(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
(multi-)indices to label the spin-down operators. By default, the spin-down operators carry indices(0, "dn"), (1, "dn"), ...
.
- Returns:
Interaction term
.
- 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
),- Parameters:
U – A length-
vector of Hubbard interaction parameters .indices – An optional list of
(multi-)indices to be used instead of the simple numeric indices .
- Returns:
Interaction term
.
- 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
),where
is the total electron occupation number at site . The local part of the interaction is encoded in the diagonal matrix elements .- Parameters:
V – An
matrix of interaction parameters .indices_up – An optional list of
(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
(multi-)indices to label the spin-down operators. By default, the spin-down operators carry indices(0, "dn"), (1, "dn"), ...
.
- Returns:
Interaction term
.
- 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
),where
is the spin vector of the electron localized at site
, and is the total electron occupation number at site .- Parameters:
J – An
matrix of coupling parameters .indices_up – An optional list of
(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
(multi-)indices to label the spin-down operators. By default, the spin-down operators carry indices(0, "dn"), (1, "dn"), ...
.
- Returns:
Interaction term
.
- 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
,where
is the spin vector of the electron localized at site
.- Parameters:
J – A length-
vector of coupling constants .indices_up – An optional list of
(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
(multi-)indices to label the spin-down operators / . By default, the spin-down operators carry indices(0, "dn"), (1, "dn"), ...
.indices_spin – An optional list of
(multi-)indices to label the localized spin operators . By default, the localized spin operators carry indices0, 1, ...
.spin – Spin of operators
, 1/2 by default.
- Returns:
Interaction term
.
- 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
,- Parameters:
g – A length-
vector of coupling constants .indices_up – An optional list of
(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
(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
(multi-)indices to label the localized boson (phonon) operators . By default, the localized boson operators carry indices0, 1, ...
.
- Returns:
Electron-phonon coupling term
.
- 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
Operators
and can be fermionic or bosonic creation/annihilation operators.- Parameters:
U – An
tensor of interaction matrix elements .indices – An optional list of
(multi-)indices to be used instead of the simple numeric indices .statistics – Statistics of the particles in question, either
pycommute.expression.FERMION
orpycommute.expression.BOSON
.
- Returns:
Interaction Hamiltonian
.
- 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
orbitals,This function will derive values of the optional parameters according to the following rules.
If only
and are provided, then the rest of parameters will be defined according to and (this choice results in a rotationally invariant form of the model).If
, and are provided, then .If
is provided, then must also be provided (and vice versa).
- Parameters:
M – Number of orbitals
.U – Intra-orbital Coulomb repulsion
.J – Hund coupling constant
.Up – Inter-orbital Coulomb repulsion
.Jx – Spin-flip coupling constant
.Jp – Pair-hopping coupling constant
.indices_up – An optional list of
(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
(multi-)indices to label the spin-down operators. By default, the spin-down operators carry indices(0, "dn"), (1, "dn"), ...
.
- Returns:
Kanamori Hamiltonian
.
- 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
-orbital fully rotationally-invariant electron interaction Hamiltonian using Slater parametrization,The interaction tensor
is a linear combination of radial integrals with coefficients given by the angular interaction matrix elements ,All odd-
angular matrix elements vanish, while for the even- Parameters:
F – List of
radial Slater integrals .indices_up – An optional list of
(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
(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
.
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
),- Parameters:
J – An
matrix of coupling constants .h_l – A length-
vector of the local longitudinal magnetic fields . By default, all magnetic fields are zero.h_t – A length-
vector of the local transverse magnetic fields . By default, all magnetic fields are zero.indices – An optional list of
(multi-)indices to be used instead of the simple numeric indices .spin – Spin of operators
, 1/2 by default.
- Returns:
Hamiltonian
.
- 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
),- Parameters:
J – An
matrix of Heisenberg coupling constants .h – An
matrix, whose rows are the local magnetic field vectors . By default, all magnetic fields are zero.indices – An optional list of
(multi-)indices to be used instead of the simple numeric indices .spin – Spin of operators
, 1/2 by default.
- Returns:
Hamiltonian
.
- 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
),- Parameters:
J – A triplet of
matrices of Heisenberg coupling constants .h – An
matrix, whose rows are the local magnetic field vectors . By default, all magnetic fields are zero.indices – An optional list of
(multi-)indices to be used instead of the simple numeric indices .spin – Spin of operators
, 1/2 by default.
- Returns:
Hamiltonian
.
- 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
),- Parameters:
J – An
matrix of Heisenberg coupling constants .indices – An optional list of
(multi-)indices to be used instead of the simple numeric indices .spin – Spin of operators
, 1 by default.
- Returns:
Interaction term
.
- 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
).- Parameters:
D – An
array, whose slicesD[i,j,:]
are vectors .indices – An optional list of
(multi-)indices to be used instead of the simple numeric indices .spin – Spin of operators
, 1/2 by default.
- Returns:
Hamiltonian
.
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
spin degrees of freedom and bosonic modes,- Parameters:
eps – A length-
vector of energy biases .delta – A length-
vector of tunneling amplitudes .omega – A length-
vector of bosonic frequencies .lambda – An
matrix of spin-boson coupling constants .indices_spin – An optional list of
(multi-)indices to be used instead of the simple numeric indices .indices_boson – An optional list of
(multi-)indices to be used instead of the simple numeric indices .spin – Spin of operators
, 1/2 by default.
- Returns:
Spin-boson Hamiltonian
.
- 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
atomic degrees of freedom and cavity modes,- Parameters:
eps – A length-
vector of atomic transition frequencies .omega – A length-
vector of cavity frequencies .g – An
matrix of atom-cavity coupling constants .indices_atom – An optional list of
(multi-)indices to be used instead of the simple numeric indices .indices_boson – An optional list of
(multi-)indices to be used instead of the simple numeric indices .spin – Pseudo-spin of operators
, 1/2 by default (two-level atoms).
- Returns:
Spin-boson Hamiltonian
.
- 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
atomic degrees of freedom and cavity modes,- Parameters:
eps – A length-
vector of atomic transition frequencies .omega – A length-
vector of cavity frequencies .g – An
matrix of atom-cavity coupling constants .indices_atom – An optional list of
(multi-)indices to be used instead of the simple numeric indices .indices_boson – An optional list of
(multi-)indices to be used instead of the simple numeric indices .spin – Pseudo-spin of operators
, 1/2 by default (two-level atoms).
- Returns:
Spin-boson Hamiltonian
.