Basis module (quspin.basis)

Basis classes for quantum many-body systems.

The following table shows the available operator strings for the different bases (sps is the onsite Hilbert space dimension):

\[\begin{array}{cccc} \texttt{basis}/\texttt{opstr} & \texttt{"I"} & \texttt{"+"} & \texttt{"-"} & \texttt{"n"} & \texttt{"z"} & \texttt{"x"} & \texttt{"y"} \newline \texttt{spin_basis_*} & \hat{1} & \hat S^+(\hat\sigma^+) & \hat S^-(\hat\sigma^-) & - & \hat S^z(\hat\sigma^z) & \hat S^x(\hat\sigma^x) & \hat S^y(\hat\sigma^y) \ \newline \texttt{boson_basis_*}& \hat{1} & \hat b^\dagger & \hat b & \hat b^\dagger \hat b & \hat b^\dagger\hat b - \frac{\mathrm{sps}-1}{2} & - & - \newline \texttt{*_fermion_basis_*}& \hat{1} & \hat c^\dagger & \hat c & \hat c^\dagger \hat c & \hat c^\dagger\hat c - \frac{1}{2} & \hat c + \hat c^\dagger & -i\left( \hat c - \hat c^\dagger\right) \newline \end{array}\]

Notes:

  • The default operators for spin-1/2 are the Pauli matrices, NOT the spin operators. To change this, see the argument pauli of the spin_basis_* classes.

  • Higher spins can only be defined using the spin operators, and do NOT support the operator strings “x” and “y”.

  • The fermion operator strings “x” and “y” are present only in the general basis fermion classes, and correspond to real fermions, i.e. Majorana operators (note the sign difference between “y” and the \(\sigma^y\) Pauli matrix, which is convention).

  • The variable sps in the definition of the bosonic “z” operator stands for “states per site”, i.e., the local on-site Hilbert space dimension.

one-dimensional symmetries

spin_basis_1d(L[, Nup, m, S, pauli])

Constructs basis for spin operators in a specified 1-d symmetry sector.

boson_basis_1d(L[, Nb, nb, sps])

Constructs basis for boson operators in a specified 1-d symmetry sector.

spinless_fermion_basis_1d(L[, Nf, nf])

Constructs basis for spinless fermionic operators in a specified 1-d symmetry sector.

spinful_fermion_basis_1d(L[, Nf, nf, ...])

Constructs basis for spinful fermionic operators in a specified 1-d symmetry sector.

general lattice symmetries

spin_basis_general(N[, Nup, m, S, pauli, ...])

Constructs basis for spin operators for USER-DEFINED symmetries.

boson_basis_general(N[, Nb, nb, sps, ...])

Constructs basis for boson operators for USER-DEFINED symmetries.

spinless_fermion_basis_general(N[, Nf, nf, ...])

Constructs basis for spinless fermion operators for USER-DEFINED symmetries.

spinful_fermion_basis_general(N[, Nf, nf, ...])

Constructs basis for spinful fermion operators for USER-DEFINED symmetries.

user basis

user_basis(basis_dtype, N, op_dict[, sps, ...])

Constructs basis for USER-DEFINED functionality of a basis object.

combining basis classes

tensor_basis(*basis_list)

Constructs basis in tensor product Hilbert space.

photon_basis(basis_constructor, ...)

Constructs basis in photon-particle Hilbert space.

functions

coherent_state(a, n[, dtype])

Creates a harmonic oscillator (HO) coherent state.

photon_Hspace_dim(N, Ntot, Nph)

Calculates the dimension of the total spin-photon Hilbert space.

large integer support for general basis classes

To construct *_basis_general classes with more than 64 lattice sites, QuSpin uses custom unsigned integer types for the integer representation of many-body states.

a) custom large integer data types supported in general basis

uint256

DType class corresponding to the scalar type and dtype of the same name.

uint1024

DType class corresponding to the scalar type and dtype of the same name.

uint4096

DType class corresponding to the scalar type and dtype of the same name.

uint16384

DType class corresponding to the scalar type and dtype of the same name.

b) array initialization routines

basis_ones(shape[, dtype])

Allocates initialized array using the QuSpin basis integers.

basis_zeros(shape[, dtype])

Allocates initialized array using the QuSpin basis integers.

c) utilities to use large integers

get_basis_type(N, Np, sps)

Returns minimum dtype to represent manybody state.

python_int_to_basis_int(python_int[, dtype])

Converts python integer to QuSpin basis type.

basis_int_to_python_int(basis_int)

Converts QuSpin basis type integer to a python integer.

bitwise_not(x[, out, where])

Bitwise NOT operation ~x.

bitwise_and(x1, x2[, out, where])

Bitwise AND operation x1 & x2.

bitwise_or(x1, x2[, out, where])

Bitwise OR operation x1 | x2.

bitwise_xor(x1, x2[, out, where])

Bitwise XOR operation x1 ^ x2.

bitwise_leftshift(x1, x2[, out, where])

Bitwise LEFT SHIFT operation x1 << x2.

bitwise_rightshift(x1, x2[, out, where])

Bitwise RIGHT SHIFT operation x1 >> x2.