Module Hamiltonians
This module contains definitions of Hamiltonians, in particular specific physical models of interest. These are organised by means of an interface around the abstract type AbstractHamiltonian, in the spirit of the AbstractArray interface as discussed in the Julia Documentation.
Rimu.Hamiltonians — Modulemodule HamiltoniansThis module defines Hamiltonian types and functions for working with Hamiltonians.
Exported concrete Hamiltonian types
Real space Hubbard models
Momentum space Hubbard models
Harmonic oscillator models
Other
Interface for working with Hamiltonians
AbstractHamiltonian: defined in the moduleInterfaces
Usage with FCIQMC and exact diagonalisation
In order to define a specific model Hamiltonian with relevant parameters for the model, instantiate the model like this in the input file:
hubb = HubbardReal1D(BoseFS((1,2,0,3)); u=1.0, t=1.0)The Hamiltonian hubb is now ready to be used for FCIQMC in lomc! and for exact diagonalisation with KrylovKit.jl directly, or after transforming into a sparse matrix first with
using SparseArrays
sh = sparse(hubb)or into a full matrix with
using LinearAlgebra
fh = Matrix(hubb)This functionality relies on
Rimu.Hamiltonians.BasisSetRep — TypeBasisSetRep(
h::AbstractHamiltonian, addr=starting_address(h);
sizelim=10^6, nnzs, cutoff, filter, sort=false, kwargs...
)
BasisSetRep(h::AbstractHamiltonian, addresses::AbstractVector; kwargs...)Eagerly construct the basis set representation of the operator h with all addresses reachable from addr. Instead of a single address, a vector of addresses can be passed.
An ArgumentError is thrown if dimension(h) > sizelim in order to prevent memory overflow. Set sizelim = Inf in order to disable this behaviour.
Providing the number nnzs of expected calculated matrix elements and col_hint for the estimated number of nonzero off-diagonal matrix elements in each matrix column may improve performance.
Providing an energy cutoff will skip the columns and rows with diagonal elements greater than cutoff. Alternatively, an arbitrary filter function can be used instead. Addresses passed as arguments are not filtered. To generate the matrix truncated to the subspace spanned by the addresses, use filter = Returns(false).
Setting sort to true will sort the matrix rows and columns. This is useful when the order of the columns matters, e.g. when comparing matrices. Any additional keyword arguments are passed on to Base.sortperm.
Fields
sm: sparse matrix representinghin the basisbasisbasis: vector of addressesh: the Hamiltonian
Example
julia> h = HubbardReal1D(BoseFS(1,0,0));
julia> bsr = BasisSetRep(h)
BasisSetRep(HubbardReal1D(BoseFS{1,3}(1, 0, 0); u=1.0, t=1.0)) with dimension 3 and 9 stored entries:3×3 SparseArrays.SparseMatrixCSC{Float64, Int64} with 9 stored entries:
0.0 -1.0 -1.0
-1.0 0.0 -1.0
-1.0 -1.0 0.0
julia> BasisSetRep(h, bsr.basis[1:2]; filter = Returns(false)) # passing addresses and truncating
BasisSetRep(HubbardReal1D(BoseFS{1,3}(1, 0, 0); u=1.0, t=1.0)) with dimension 2 and 4 stored entries:2×2 SparseArrays.SparseMatrixCSC{Float64, Int64} with 4 stored entries:
0.0 -1.0
-1.0 0.0julia> using LinearAlgebra; eigvals(Matrix(bsr)) # eigenvalues
3-element Vector{Float64}:
-1.9999999999999996
0.9999999999999997
1.0000000000000002
julia> ev = eigvecs(Matrix(bsr))[:,1] # ground state eigenvector
3-element Vector{Float64}:
-0.5773502691896257
-0.5773502691896255
-0.5773502691896257
julia> DVec(zip(bsr.basis,ev)) # ground state as DVec
DVec{BoseFS{1, 3, BitString{3, 1, UInt8}},Float64} with 3 entries, style = IsDeterministic{Float64}()
fs"|0 0 1⟩" => -0.57735
fs"|0 1 0⟩" => -0.57735
fs"|1 0 0⟩" => -0.57735Has methods for dimension, sparse, Matrix, starting_address.
SparseArrays.sparse — Functionsparse(h::AbstractHamiltonian, addr=starting_address(h); kwargs...)
sparse(bsr::BasisSetRep)Return a sparse matrix representation of h or bsr. kwargs are passed to BasisSetRep.
See BasisSetRep.
Base.Matrix — TypeMatrix(h::AbstractHamiltonian, addr=starting_address(h); sizelim=10^4, kwargs...)
Matrix(bsr::BasisSetRep)Return a dense matrix representation of h or bsr. kwargs are passed to BasisSetRep.
See BasisSetRep.
If only the basis is required and not the matrix representation it is more efficient to use
Rimu.Hamiltonians.build_basis — Functionbuild_basis(
ham, address=starting_address(ham);
cutoff, filter, sizelim, sort=false, kwargs...
) -> basis
build_basis(ham, addresses::AbstractVector; kwargs...)Get all basis element of a linear operator ham that are reachable (via non-zero matrix elements) from the address address, returned as a vector. Instead of a single address, a vector of addresses can be passed. Does not return the matrix, for that purpose use BasisSetRep.
Providing an energy cutoff will skip addresses with diagonal elements greater than cutoff. Alternatively, an arbitrary filter function can be used instead. Addresses passed as arguments are not filtered. A maximum basis size sizelim can be set which will throw an error if the expected dimension of ham is larger than sizelim. This may be useful when memory may be a concern. These options are disabled by default.
Setting sort to true will sort the basis. Any additional keyword arguments are passed on to Base.sort!.
Model Hamiltonians
Here is a list of fully implemented model Hamiltonians. There are several variants of the Hubbard model in real and momentum space, as well as some other models.
Real space Hubbard models
Rimu.Hamiltonians.HubbardReal1D — TypeHubbardReal1D(address; u=1.0, t=1.0)Implements a one-dimensional Bose Hubbard chain in real space.
\[\hat{H} = -t \sum_{\langle i,j\rangle} a_i^† a_j + \frac{u}{2}\sum_i n_i (n_i-1)\]
Arguments
address: the starting address, defines number of particles and sites.u: the interaction parameter.t: the hopping strength.
See also
Rimu.Hamiltonians.BoseHubbardReal1D2C — TypeBoseHubbardReal1D2C(address::BoseFS2C; ua=1.0, ub=1.0, ta=1.0, tb=1.0, v=1.0)Implements a two-component one-dimensional Bose Hubbard chain in real space.
\[\hat{H} = \hat{H}_a + \hat{H}_b + V\sum_{i} n_{a_i}n_{b_i}\]
Arguments
address: the starting address, defines number of particles and sites.ua: the on-site interaction parameter parameter for Hamiltonian a.ub: the on-site interaction parameter parameter for Hamiltonian b.ta: the hopping strength for Hamiltonian a.tb: the hopping strength for Hamiltonian b.v: the inter-species interaction parameter V.
See also
Rimu.Hamiltonians.HubbardReal1DEP — TypeHubbardReal1DEP(address; u=1.0, t=1.0, v_ho=1.0)Implements a one-dimensional Bose Hubbard chain in real space with external potential.
\[\hat{H} = -t \sum_{\langle i,j\rangle} a_i^† a_j + \sum_i ϵ_i n_i + \frac{u}{2}\sum_i n_i (n_i-1)\]
Arguments
address: the starting address, defines number of particles and sites.u: the interaction parameter.t: the hopping strength.v_ho: strength of the external harmonic oscillator potential $ϵ_i = v_{ho} i^2$.
The first index is i=0 and the maximum of the potential occurs in the centre of the lattice.
See also
Rimu.Hamiltonians.HubbardRealSpace — TypeHubbardRealSpace(address; geometry=PeriodicBoundaries(M,), t=ones(C), u=ones(C, C), v=zeros(C, D))Hubbard model in real space. Supports single or multi-component Fock state addresses (with C components) and various (rectangular) lattice geometries in D dimensions.
\[ \hat{H} = -\sum_{\langle i,j\rangle,σ} t_σ a^†_{iσ} a_{jσ} + \frac{1}{2}\sum_{i,σ} u_{σσ} n_{iσ} (n_{iσ} - 1) + \sum_{i,σ≠τ}u_{στ} n_{iσ} n_{iτ}\]
If v is nonzero then this calculates $\hat{H} + \hat{V}$ by adding the harmonic trapping potential
\[ \hat{V} = \sum_{i,σ,d} v_{σd} x_{di}^2 n_{iσ}\]
where $x_{di}$ is the distance of site $i$ from the centre of the trap along dimension $d$.
Address types
BoseFS: Single-component Bose-Hubbard model.FermiFS: Single-component Fermi-Hubbard model.CompositeFS: For multi-component models.
Note that a single component of fermions cannot interact with itself. A warning is produced if addressis incompatible with the interaction parameters u.
Geometries
Implemented LatticeGeometrys for keyword geometry
Default is geometry=PeriodicBoundaries(M,), i.e. a one-dimensional lattice with the number of sites M inferred from the number of modes in address.
Other parameters
t: the hopping strengths. Must be a vector of lengthC. Thei-th element of the vector corresponds to the hopping strength of thei-th component.u: the on-site interaction parameters. Must be a symmetric matrix.u[i, j]corresponds to the interaction between thei-th andj-th component.u[i, i]corresponds to the interaction of a component with itself. Note thatu[i,i]must be zero for fermionic components.v: the trap potential strengths. Must be a matrix of sizeC × D.v[i,j]is the strength of the trap for componentiin thejth dimension.
Rimu.Hamiltonians.ExtendedHubbardReal1D — TypeExtendedHubbardReal1D(address; u=1.0, v=1.0, t=1.0)Implements the extended Hubbard model on a one-dimensional chain in real space.
\[\hat{H} = -t \sum_{\langle i,j\rangle} a_i^† a_j + \frac{u}{2}\sum_i n_i (n_i-1) + v \sum_{\langle i,j\rangle} n_i n_j\]
Arguments
address: the starting address.u: on-site interaction parameterv: the next-neighbor interactiont: the hopping strength
Momentum space Hubbard models
Rimu.Hamiltonians.HubbardMom1D — TypeHubbardMom1D(address; u=1.0, t=1.0, dispersion=hubbard_dispersion)Implements a one-dimensional Bose Hubbard chain in momentum space.
\[\hat{H} = \sum_{k} ϵ_k n_k + \frac{u}{M}\sum_{kpqr} a^†_{r} a^†_{q} a_p a_k δ_{r+q,p+k}\]
Arguments
address: the starting address, defines number of particles and sites.u: the interaction parameter.t: the hopping strength.dispersion: defines $ϵ_k =$t*dispersion(k)hubbard_dispersion: $ϵ_k = -2t \cos(k)$continuum_dispersion: $ϵ_k = tk^2$
See also
Rimu.Hamiltonians.BoseHubbardMom1D2C — TypeBoseHubbardMom1D2C(add::BoseFS2C; ua=1.0, ub=1.0, ta=1.0, tb=1.0, v=1.0, kwargs...)Implements a one-dimensional Bose Hubbard chain in momentum space with a two-component Bose gas.
\[\hat{H} = \hat{H}_a + \hat{H}_b + \frac{V}{M}\sum_{kpqr} b^†_{r} a^†_{q} b_p a_k δ_{r+q,p+k}\]
Arguments
add: the starting address.ua: theuparameter for Hamiltonian a.ub: theuparameter for Hamiltonian b.ta: thetparameter for Hamiltonian a.tb: thetparameter for Hamiltonian b.v: the inter-species interaction parameter V.
Further keyword arguments are passed on to the constructor of HubbardMom1D.
See also
Rimu.Hamiltonians.HubbardMom1DEP — TypeHubbardMom1DEP(address; u=1.0, t=1.0, v_ho=1.0, dispersion=hubbard_dispersion)Implements a one-dimensional Bose Hubbard chain in momentum space with harmonic external potential.
\[Ĥ = \sum_{k} ϵ_k n_k + \frac{u}{M}\sum_{kpqr} a^†_{r} a^†_{q} a_p a_k δ_{r+q,p+k} + V̂_\mathrm{ho} ,\]
where
\[\begin{aligned} V̂_\mathrm{ho} & = \frac{1}{M} \sum_{p,q} \mathrm{DFT}[V_{ext}]_{p-q} \, a^†_{p} a_q ,\\ V_\mathrm{ext}(x) &= v_\mathrm{ho} \,x^2 , \end{aligned}\]
is an external harmonic potential in momentum space, $\mathrm{DFT}[…]_k$ is a discrete Fourier transform performed by fft()[k%M + 1], and M == num_modes(address).
Arguments
address: the starting address, defines number of particles and sites.u: the interaction parameter.t: the hopping strength.dispersion: defines $ϵ_k =$t*dispersion(k)hubbard_dispersion: $ϵ_k = -2t \cos(k)$continuum_dispersion: $ϵ_k = tk^2$
v_ho: strength of the external harmonic oscillator potential $v_\mathrm{ho}$.
See also HubbardMom1D, HubbardReal1DEP, Transcorrelated1D, Hamiltonians.
Harmonic oscillator models
Rimu.Hamiltonians.HOCartesianContactInteractions — TypeHOCartesianContactInteractions(addr; S, η, g = 1.0, interaction_only = false, block_by_level = true)Implements a bosonic harmonic oscillator in Cartesian basis with contact interactions
\[\hat{H} = \sum_{i} \epsilon_\mathbf{i} n_\mathbf{i} + \frac{g}{2}\sum_\mathbf{ijkl} V_\mathbf{ijkl} a^†_\mathbf{i} a^†_\mathbf{j} a_\mathbf{k} a_\mathbf{l}.\]
For a $D$-dimensional harmonic oscillator indices $\mathbf{i}, \mathbf{j}, \ldots$ are $D$-tuples. The energy scale is defined by the first dimension i.e. $\hbar \omega_x$ so that single particle energies are
\[ \frac{\epsilon_\mathbf{i}}{\hbar \omega_x} = (i_x + 1/2) + \eta_y (i_y+1/2) + \ldots.\]
The factors $\eta_y, \ldots$ allow for anisotropic trapping geometries and are assumed to be greater than 1 so that $\omega_x$ is the smallest trapping frequency.
By default the offdiagonal elements due to the interactions are consistent with first-order degenerate perturbation theory
\[ V_{\mathbf{ijkl}} = \delta_{\epsilon_\mathbf{i} + \epsilon_\mathbf{j}} ^{\epsilon_\mathbf{k} + \epsilon_\mathbf{l}} \prod_{d \in x, y,\ldots} \mathcal{I}(i_d,j_d,k_d,l_d),\]
where the $\delta$ function indicates that the total noninteracting energy is conserved meaning all states with the same noninteracting energy are connected by this interaction and the Hamiltonian blocks according to noninteracting energy levels. Setting block_by_level = false will disable this restriction and allow coupling between basis states of any noninteracting energy level, leading to many more offdiagonals and fewer but larger blocks (the blocks are still distinguished by parity of basis states). Alternatively, see HOCartesianEnergyConservedPerDim for a model with the stronger restriction that conserves energy separately per spatial dimension. The integral $\mathcal{I}(a,b,c,d)$ is of four one dimensional harmonic oscillator basis functions, implemented in four_oscillator_integral_general.
Arguments
addr: the starting address, defines number of particles and total number of modes.S: Tuple of the number of levels in each dimension, including the groundstate. The allowed couplings between states is defined by the aspect ratio ofS .- 1. Defaults to a 1D spectrum with number of levels matching modes ofaddr. Will be sorted to make the first dimension the largest.η: Define a custom aspect ratio for the trapping potential strengths, instead of deriving fromS .- 1. This will only affect the single particle energy scale and not the interactions. The values are always scaled relative to the first dimension, which sets the energy scale of the system, $\hbar\omega_x$.g: the (isotropic) bare interaction parameter. The value ofgis assumed to be in trap units.interaction_only: if set totruethen the noninteracting single-particle terms are ignored. Useful if only energy shifts due to interactions are required.block_by_level: if set to false will allow the interactions to couple all states without comparing their noninteracting energy.
num_offdiagonals is a bad estimate for this Hamiltonian. Take care when building a matrix or using QMC methods. Use get_all_blocks first then pass option col_hint = block_size to BasisSetRep to safely build the matrix.
Rimu.Hamiltonians.HOCartesianEnergyConservedPerDim — TypeHOCartesianEnergyConservedPerDim(addr; S, η, g = 1.0, interaction_only = false)Implements a bosonic harmonic oscillator in Cartesian basis with contact interactions
\[\hat{H} = \sum_{i} ϵ_i n_i + \frac{g}{2}\sum_{ijkl} V_{ijkl} a^†_i a^†_j a_k a_l,\]
with the additional restriction that the interactions only couple states with the same energy in each dimension separately. See HOCartesianContactInteractions for a model that conserves total energy.
For a $D$-dimensional harmonic oscillator indices $\mathbf{i}, \mathbf{j}, \ldots$ are $D$-tuples. The energy scale is defined by the first dimension i.e. $\hbar \omega_x$ so that single particle energies are
\[ \frac{\epsilon_\mathbf{i}}{\hbar \omega_x} = (i_x + 1/2) + \eta_y (i_y+1/2) + \ldots.\]
The factors $\eta_y, \ldots$ allow for anisotropic trapping geometries and are assumed to be greater than 1 so that $\omega_x$ is the smallest trapping frequency.
Matrix elements $V_{\mathbf{ijkl}}$ are for a contact interaction calculated in this basis using first-order degenerate perturbation theory.
\[ V_{\mathbf{ijkl}} = \prod_{d \in x, y,\ldots} \mathcal{I}(i_d,j_d,k_d,l_d) \delta_{i_d + j_d}^{k_d + l_d},\]
where the $\delta$-function indicates that the noninteracting energy is conserved along each dimension. The integral $\mathcal{I}(a,b,c,d)$ is of four one dimensional harmonic oscillator basis functions, see four_oscillator_integral_general, with the additional restriction that energy is conserved in each dimension.
Arguments
addr: the starting address, defines number of particles and total number of modes.S: Tuple of the number of levels in each dimension, including the groundstate. Defaults to a 1D spectrum with number of levels matching modes ofaddr. Will be sorted to make the first dimension the largest.η: Define a custom aspect ratio for the trapping potential strengths, instead of deriving fromS .- 1. The values are always scaled relative to the first dimension, which sets the energy scale of the system, $\hbar\omega_x$.g: the (isotropic) interparticle interaction parameter. The value ofgis assumed to be in trap units.interaction_only: if set totruethen the noninteracting single-particle terms are ignored. Useful if only energy shifts due to interactions are required.
Rimu.Hamiltonians.HOCartesianCentralImpurity — TypeHOCartesianCentralImpurity(addr; kwargs...)Hamiltonian of non-interacting particles in an arbitrary harmonic trap with a delta-function potential at the centre, with strength g,
\[\hat{H}_\mathrm{rel} = \sum_\mathbf{i} ϵ_\mathbf{i} n_\mathbf{i} + g\sum_\mathbf{ij} V_\mathbf{ij} a^†_\mathbf{i} a_\mathbf{j}.\]
For a $D$-dimensional harmonic oscillator indices $\mathbf{i}, \mathbf{j}, \ldots$ are $D$-tuples. The energy scale is defined by the first dimension i.e. $\hbar \omega_x$ so that single particle energies are
\[ \frac{\epsilon_\mathbf{i}}{\hbar \omega_x} = (i_x + 1/2) + \eta_y (i_y+1/2) + \ldots.\]
The factors $\eta_y, \ldots$ allow for anisotropic trapping geometries and are assumed to be greater than 1 so that $\omega_x$ is the smallest trapping frequency.
Matrix elements $V_{\mathbf{ij}}$ are for a delta function potential calculated in this basis
\[ V_{\mathbf{ij}} = \prod_{d \in x, y,\ldots} \psi_{i_d}(0) \psi_{j_d}(0).\]
Only even parity states feel this impurity, so all $i_d$ are even. Note that the matrix representation of this Hamiltonian for a single particle is completely dense in the even-parity subspace.
Arguments
addr: the starting address, defines number of particles and total number of modes.max_nx = num_modes(addr) - 1: the maximum harmonic oscillator index number in the $x$-dimension. Must be even. Index number for the harmonic oscillator groundstate is0.ηs = (): a tuple of aspect ratios for the remaining dimensions(η_y, ...). Should be empty for a 1D trap or contain values greater than1.0. The maximum index in other dimensions will be the largest even number less thanM/η_y.S = nothing: Instead ofmax_nx, manually set the number of levels in each dimension, including the groundstate. Must be aTupleofInts.g = 1.0: the strength of the delta impurity in ($x$-dimension) trap units.impurity_only=false: if set totruethen the trap energy terms are ignored. Useful if only energy shifts due to the impurity are required.
Due to use of `SpecialFunctions` with large arguments the matrix representation of
this Hamiltonian may not be strictly symmetric, but is approximately symmetric within
machine precision.See also HOCartesianContactInteractions andHOCartesianEnergyConservedPerDim.
Other
Rimu.Hamiltonians.MatrixHamiltonian — TypeMatrixHamiltonian(
mat::AbstractMatrix{T};
starting_address::Int = starting_address(mat)
) <: AbstractHamiltonian{T}Wrap an abstract matrix mat as an AbstractHamiltonian object. Works with stochastic methods of lomc!() and DVec. Optionally, a valid index can be provided as the starting_address.
Specialised methods are implemented for sparse matrices of type AbstractSparseMatrixCSC. One based indexing is required for the matrix mat.
Rimu.Hamiltonians.Transcorrelated1D — TypeTranscorrelated1D(address; t=1.0, v=1.0, v_ho=0.0, cutoff=1, three_body_term=true)Implements a transcorrelated Hamiltonian for contact interactions in one dimensional momentum space from Jeszenski et al. (2018). Currently limited to two component fermionic addresses.
\[\begin{aligned} \tilde{H} &= t \sum_{kσ}k^2 n_{k,σ} \\ &\quad + \sum_{pqkσσ'} T_{pqk} a^†_{p-k,σ} a^†_{q+k,σ'} a_{q,σ'} a_{p,σ} \\ &\quad + \sum_{pqskk'σσ'} Q_{kk'}a^†_{p-k,σ} a^†_{q+k,σ} a^†_{s+k-k',σ'} a_{s,σ'} a_{q,σ} a_{p,σ} \\ &\quad + V̂_\mathrm{ho} \end{aligned}\]
where
\[\begin{aligned} \tilde{u}(k) &= \begin{cases} -\frac{2}{k^2} &\mathrm{if\ } |k| ≥ k_c\\ 0 & \mathrm{otherwise} \end{cases} \\ T_{pqk} &= \frac{v}{M} + \frac{2v}{M}\left[k^2\tilde{u}(k) - (p - q)k\tilde{u}(k)\right] + \frac{2v^2}{t}W(k)\\ W(k) &= \frac{1}{M^2}\sum_{q} (k - q)q\, \tilde{u}(q)\,\tilde{u}(k - q) \\ Q_{kl} &= -\frac{v^2}{t M^2}k \tilde{u}(k)\,l\tilde{u}(l), \end{aligned}\]
Arguments
address: The starting address, defines number of particles and sites.v: The interaction parameter.t: The kinetic energy prefactor.v_ho: Strength of the external harmonic oscillator potential $V̂_\mathrm{ho}$. SeeHubbardMom1DEP.cutoffcontrols $k_c$ in equations above. Note: skipping generating off-diagonal elements below the cutoff is not implemented - zero-valued elements are returned instead.three_body_term: If set to false, generating three body excitations is skipped. Note: when disabling three body terms, cutoff should be set to a higher value for best results.
See also
Convenience functions
Rimu.Hamiltonians.rayleigh_quotient — Functionrayleigh_quotient(H, v)\[\frac{⟨ v | H | v ⟩}{⟨ v|v ⟩}\]
Rimu.Hamiltonians.momentum — Functionmomentum(ham::AbstractHamiltonian)Momentum as a linear operator in Fock space. Pass a Hamiltonian ham in order to convey information about the Fock basis.
Note: momentum is currently only defined on HubbardMom1D.
Example
julia> add = BoseFS((1, 0, 2, 1, 2, 1, 1, 3));
julia> ham = HubbardMom1D(add; u = 2.0, t = 1.0);
julia> mom = momentum(ham);
julia> diagonal_element(mom, add) # calculate the momentum of a single configuration
-1.5707963267948966
julia> v = DVec(add => 10; capacity=1000);
julia> rayleigh_quotient(mom, v) # momentum expectation value for state vector `v`
-1.5707963267948966Rimu.Hamiltonians.hubbard_dispersion — Functionhubbard_dispersion(k)Dispersion relation for HubbardMom1D. Returns -2cos(k).
See also continuum_dispersion.
Rimu.Hamiltonians.continuum_dispersion — Functioncontinuum_dispersion(k)Dispersion relation for HubbardMom1D. Returns k^2.
See also hubbard_dispersion.
Rimu.Hamiltonians.shift_lattice — Functionshift_lattice(is)Circular shift contiguous indices is in interval [M÷2, M÷2) such that set starts with 0, where M=length(is).
Inverse operation: shift_lattice_inv. Used in HubbardReal1DEP and HubbardMom1DEP
Rimu.Hamiltonians.shift_lattice_inv — Functionshift_lattice_inv(js)Circular shift indices starting with 0 into a contiguous set in interval [M÷2, M÷2), where M=length(js).
Inverse operation of shift_lattice. Used in HubbardReal1DEP and HubbardMom1DEP
Hamiltonian wrappers
The following Hamiltonians are constructed from an existing Hamiltonian instance and change its behaviour:
Rimu.Hamiltonians.GutzwillerSampling — TypeGutzwillerSampling(::AbstractHamiltonian; g)Wrapper over any AbstractHamiltonian that implements Gutzwiller sampling. In this importance sampling scheme the Hamiltonian is modified as follows
\[\tilde{H}_{ij} = H_{ij} e^{-g(H_{ii} - H_{jj})} .\]
This way off-diagonal spawns to higher-energy configurations are discouraged and spawns to lower-energy configurations encouraged for positive g.
Constructor
GutzwillerSampling(::AbstractHamiltonian, g)GutzwillerSampling(::AbstractHamiltonian; g)
After construction, we can access the underlying Hamiltonian with G.hamiltonian and the g parameter with G.g.
Example
julia> H = HubbardMom1D(BoseFS(1,1,1); u=6.0, t=1.0)
HubbardMom1D(BoseFS{3,3}(1, 1, 1); u=6.0, t=1.0)
julia> G = GutzwillerSampling(H, g=0.3)
GutzwillerSampling(HubbardMom1D(BoseFS{3,3}(1, 1, 1); u=6.0, t=1.0); g=0.3)
julia> get_offdiagonal(H, BoseFS(2, 1, 0), 1)
(BoseFS{3,3}(1, 0, 2), 2.0)
julia> get_offdiagonal(G, BoseFS(2, 1, 0), 1)
(BoseFS{3,3}(1, 0, 2), 0.8131393194811987)Observables
To calculate observables, pass the transformed Hamiltonian G to AllOverlaps with keyword argument transform=G.
Rimu.Hamiltonians.GuidingVectorSampling — TypeGuidingVectorSamplingWrapper over any AbstractHamiltonian that implements guided vector a.k.a. guided wave function sampling. In this importance sampling scheme the Hamiltonian is modified as follows.
\[\tilde{H}_{ij} = v_i H_{ij} v_j^{-1}\]
and where v is the guiding vector. v_i and v_j are also thresholded to avoid dividing by zero (see below).
Constructors
GuidingVectorSampling(::AbstractHamiltonian, vector, eps)GuidingVectorSampling(::AbstractHamiltonian; vector, eps)
eps is a thresholding parameter used to avoid dividing by zero; all values below eps are set to eps. It is recommended that eps is in the same value range as the guiding vector. The default value is set to eps=norm(v, Inf) * 1e-2
After construction, we can access the underlying hamiltonian with G.hamiltonian, the eps parameter with G.eps, and the guiding vector with G.vector.
Example
julia> H = HubbardReal1D(BoseFS(1,1,1); u=6.0, t=1.0);
julia> v = DVec(starting_address(H) => 10; capacity=1);
julia> G = GuidingVectorSampling(H, v, 0.1);
julia> get_offdiagonal(H, starting_address(H), 4)
(BoseFS{3,3}(2, 0, 1), -1.4142135623730951)
julia> get_offdiagonal(G, starting_address(G), 4)
(BoseFS{3,3}(2, 0, 1), -0.014142135623730952)Observables
To calculate observables, pass the transformed Hamiltonian G to AllOverlaps with keyword argument transform=G.
Rimu.Hamiltonians.ParitySymmetry — TypeParitySymmetry(ham::AbstractHamiltonian{T}; even=true) <: AbstractHamiltonian{T}Impose even or odd parity on all states and the Hamiltonian ham as controlled by the keyword argument even. Parity symmetry of the Hamiltonian is assumed. For some Hamiltonians, ParitySymmetry reduces the size of the Hilbert space by half.
ParitySymmetry performs a unitary transformation, leaving the eigenvalues unchanged and preserving the LOStructure. This is achieved by changing the basis set to states with defined parity. Effectively, a non-even address $|α⟩$ is replaced by $\frac{1}{√2}(|α⟩ ± |ᾱ⟩)$ for even and odd parity, respectively, where ᾱ == reverse(α).
Notes
- This modifier currently only works on
starting_addresss with an odd number of modes. - For odd parity, the
starting_addressof the underlying Hamiltonian cannot be symmetric. - If parity is not a symmetry of the Hamiltonian
hamthen the result is undefined. ParitySymmetryworks by modifying theoffdiagonalsiterator.
julia> ham = HubbardReal1D(BoseFS(0,2,1))
HubbardReal1D(BoseFS{3,3}(0, 2, 1); u=1.0, t=1.0)
julia> size(Matrix(ham))
(10, 10)
julia> size(Matrix(ParitySymmetry(ham)))
(6, 6)
julia> size(Matrix(ParitySymmetry(ham; odd=true)))
(4, 4)
julia> eigvals(Matrix(ham))[1] ≈ eigvals(Matrix(ParitySymmetry(ham)))[1]
trueSee also TimeReversalSymmetry.
Rimu.Hamiltonians.TimeReversalSymmetry — TypeTimeReversalSymmetry(ham::AbstractHamiltonian{T}; even=true) <: AbstractHamiltonian{T}Impose even or odd time reversal on all states and the Hamiltonian ham as controlled by the keyword argument even. If time reversal is a symmetry of the Hamiltonian it will block (reducing Hilbert space dimension) preserving the eigenvalues and LOStructure.
Notes
- This modifier only works two component
starting_addresses. - For odd time reversal symmetry, the
starting_addressof the underlying Hamiltonian must not be symmetric. - If time reversal is not a symmetry of the Hamiltonian
hamthen the result is undefined. TimeReversalSymmetryworks by modifying theoffdiagonalsiterator.
julia> ham = HubbardMom1D(FermiFS2C((1,0,1),(0,1,1)));
julia> size(Matrix(ham))
(3, 3)
julia> size(Matrix(TimeReversalSymmetry(ham)))
(2, 2)
julia> size(Matrix(TimeReversalSymmetry(ham, even=false)))
(1, 1)
julia> eigvals(Matrix(TimeReversalSymmetry(ham)))[1] ≈ eigvals(Matrix(ham))[1]
trueSee also ParitySymmetry.
Rimu.Hamiltonians.Stoquastic — TypeStoquastic(ham <: AbstractHamiltonian) <: AbstractHamiltonianA wrapper for an AbstractHamiltonian that replaces all off-diagonal matrix elements v by -abs(v), thus making the new Hamiltonian stoquastic.
A stoquastic Hamiltonian does not have a Monte Carlo sign problem. For a hermitian ham the smallest eigenvalue of Stoquastic(ham) is ≤ the smallest eigenvalue of ham.
Observables
Observables are AbstractHamiltonians that represent a physical observable. Their ground state expectation values can be sampled by passing them into AllOverlaps.
Rimu.Hamiltonians.G2MomCorrelator — TypeG2MomCorrelator(d::Int,c=:cross) <: AbstractHamiltonian{ComplexF64}Two-body correlation operator representing the density-density correlation at distance d of a two component system in a momentum-space Fock-state basis. It returns a Complex value.
Correlation across two components:
\[\hat{G}^{(2)}(d) = \frac{1}{M}\sum_{spqr=1}^M e^{-id(p-q)2π/M} a^†_{s} b^†_{p} b_q a_r δ_{s+p,q+r}\]
Correlation within a single component:
\[\hat{G}^{(2)}(d) = \frac{1}{M}\sum_{spqr=1}^M e^{-id(p-q)2π/M} a^†_{s} a^†_{p} a_q a_r δ_{s+p,q+r}\]
The diagonal element, where (p-q)=0, is
\[\frac{1}{M}\sum_{k,p=1}^M a^†_{k} b^†_{p} b_p a_k .\]
Arguments
d::Integer: the distance between two particles.c: possible instructions::cross: default instruction, computing correlation between particles across two components;:first: computing correlation between particles within the first component;:second: computing correlation between particles within the second component. These are the only defined instructions, using anything else will produce errors.
To use on a one-component system
For a system with only one component, e.g. with BoseFS, the second argument c is irrelevant and can be any of the above instructions, one could simply skip this argument and let it be the default value.
See also
Rimu.Hamiltonians.G2RealCorrelator — TypeG2RealCorrelator(d::Int) <: AbstractHamiltonian{Float64}Two-body operator for density-density correlation between sites separated by d with 0 ≤ d < M.
\[ \hat{G}^{(2)}(d) = \frac{1}{M} \sum_i^M \hat{n}_i (\hat{n}_{i+d} - \delta_{0d}).\]
Assumes a one-dimensional lattice with periodic boundary conditions where
\[ \hat{G}^{(2)}(-M/2 \leq d < 0) = \hat{G}^{(2)}(|d|),\]
\[ \hat{G}^{(2)}(M/2 < d < M) = \hat{G}^{(2)}(M - d),\]
and normalisation
\[ \sum_{d=0}^{M-1} \langle \hat{G}^{(2)}(d) \rangle = \frac{N (N-1)}{M}.\]
For multicomponent basis, calculates correlations between all particles equally, equivalent to stacking all components into a single Fock state.
Arguments
d::Integer: distance between sites.
See also
Rimu.Hamiltonians.SuperfluidCorrelator — TypeSuperfluidCorrelator(d::Int) <: AbstractHamiltonian{Float64}Operator for extracting superfluid correlation between sites separated by a distance d with 0 ≤ d < M:
\[ \hat{C}_{\text{SF}}(d) = \frac{1}{M} \sum_{i}^{M} a_{i}^{\dagger} a_{i + d}\]
Assumes a one-dimensional lattice with $M$ sites and periodic boundary conditions. $M$ is also the number of modes in the Fock state address.
Usage
Superfluid correlations can be extracted from a Monte Carlo calculation by wrapping SuperfluidCorrelator with AllOverlaps and passing into lomc! with the replica keyword argument. For an example with a similar use of G2RealCorrelator see G2 Correlator Example.
See also HubbardReal1D, G2RealCorrelator, AbstractHamiltonian, and AllOverlaps.
Rimu.Hamiltonians.StringCorrelator — TypeStringCorrelator(d::Int) <: AbstractHamiltonian{Float64}Operator for extracting string correlation between lattice sites on a one-dimensional Hubbard lattice separated by a distance d with 0 ≤ d < M
\[ \hat{C}_{\text{string}}(d) = \frac{1}{M} \sum_{j}^{M} \delta n_j (e^{i \pi \sum_{j \leq k < j + d} \delta n_k}) \delta n_{j+d}\]
Here, $\delta \hat{n}_j = \hat{n}_j - \bar{n}$ is the boson number deviation from the mean filling number and $\bar{n} = N/M$ is the mean filling number of lattice sites with $N$ particles and $M$ lattice sites (or modes).
Assumes a one-dimensional lattice with periodic boundary conditions. For usage see SuperfluidCorrelator and AllOverlaps.
See also HubbardReal1D, G2RealCorrelator, SuperfluidCorrelator, AbstractHamiltonian, and AllOverlaps.
Rimu.Hamiltonians.DensityMatrixDiagonal — TypeDensityMatrixDiagonal(mode; component=0) <: AbstractHamiltonianRepresent a diagonal element of the single-particle density:
\[\hat{n}_{i,σ} = \hat a^†_{i,σ} \hat a_{i,σ}\]
where $i$ is the mode and $σ$ is the component. If component is zero, the sum over all components is computed.
See also
Rimu.Hamiltonians.Momentum — TypeMomentum(component=0; fold=true) <: AbstractHamiltonianThe momentum operator $\hat{p}$.
The component argument controls which component of the address is taken into consideration. A value of 0 sums the contributions of all components. If fold is true, the momentum is folded into the Brillouin zone.
julia> add = BoseFS((1, 0, 2, 1, 2, 1, 1, 3))
BoseFS{11,8}(1, 0, 2, 1, 2, 1, 1, 3)
julia> v = DVec(add => 10);
julia> rayleigh_quotient(Momentum(), DVec(add => 1))
-2.0
julia> rayleigh_quotient(Momentum(fold=false), DVec(add => 1))
14.0Rimu.Hamiltonians.AxialAngularMomentumHO — TypeAxialAngularMomentumHO(S; z_dim = 3, addr = BoseFS(prod(S))) <: AbstractHamiltonianAngular momentum operator for application to Cartesian harmonic oscillator basis, see HOCartesianContactInteractions or HOCartesianEnergyConservedPerDim. Represents the projection of angular momentum onto z-axis:
\[\hat{L}_z = i \hbar \sum_{j=1}^N \left( b_x b_y^\dag - b_y b_x^\dag \right),\]
where $b_x^\dag$ and $b_x$ are raising and lowering (ladder) operators for a harmonic oscillator in the $x$ dimension, and simlarly for $y$.
This is implemented for an $N$ particle Fock space with creation and annihilation operators as
\[\frac{1}{\hbar} \hat{L}_z = i \sum_{n_x=1}^{M_x} \sum_{n_y=1}^{M_y} \left( a_{n_x-1,n_y+1}^\dag - a_{n_x+1,n_y-1}^\dag \right) a_{n_x, n_y}.\]
in units of $\hbar$.
Argument S is a tuple defining the range of Cartesian modes in each dimension and their mapping to Fock space modes in a SingleComponentFockAddress. If S indicates a 3D system the z dimension can be changed by setting z_dim; S should be be isotropic in the remaining x-y plane, i.e. must have S[x_dim] == S[y_dim]. The starting address addr only needs to satisfy num_modes(addr) == prod(S).
Example
Calculate the overlap of two Fock addresses interpreted as harmonic oscillator states in a 2D Cartesian basis
julia> S = (2,2)
(2, 2)
julia> Lz = AxialAngularMomentumHO(S)
AxialAngularMomentumHO((2, 2); z_dim = 3, addr = BoseFS{0,4}(0, 0, 0, 0))
julia> v = DVec(BoseFS(prod(S), 2 => 1) => 1.0)
DVec{BoseFS{1, 4, BitString{4, 1, UInt8}},Float64} with 1 entry, style = IsDeterministic{Float64}()
fs"|0 1 0 0⟩" => 1.0
julia> w = DVec(BoseFS(prod(S), 3 => 1) => 1.0)
DVec{BoseFS{1, 4, BitString{4, 1, UInt8}},Float64} with 1 entry, style = IsDeterministic{Float64}()
fs"|0 0 1 0⟩" => 1.0
julia> dot(w, Lz, v)
0.0 + 1.0imHamiltonians interface
Behind the implementation of a particular model is a more abstract interface for defining Hamiltonians. If you want to define a new model you should make use of this interface. The most general form of a model Hamiltonian should subtype to AbstractHamiltonian and implement the relevant methods.
Rimu.Interfaces.AbstractHamiltonian — TypeAbstractHamiltonian{T}Supertype that provides an interface for linear operators over a linear space with scalar type T that are suitable for FCIQMC (with lomc!). Indexing is done with addresses (typically not integers) from an address space that may be large (and will not need to be completely generated).
AbstractHamiltonian instances operate on vectors of type AbstractDVec from the module DictVectors and work well with addresses of type AbstractFockAddress from the module BitStringAddresses. The type works well with the external package KrylovKit.jl.
For available implementations see Hamiltonians.
Interface
Methods that need to be implemented:
num_offdiagonals(::AbstractHamiltonian, address)get_offdiagonal(::AbstractHamiltonian, address, chosen::Integer)diagonal_element(::AbstractHamiltonian, address)starting_address(::AbstractHamiltonian)
Optional methods to implement:
LOStructure(::Type{typeof(lo)}): defaults toAdjointUnknowndimension(::AbstractHamiltonian, addr): defaults to dimension of address spaceallowed_address_type(h::AbstractHamiltonian): defaults totypeof(starting_address(h))momentum(::AbstractHamiltonian): no default
Provides:
offdiagonals: iterator over reachable off-diagonal matrix elementsrandom_offdiagonal: function to generate random off-diagonal matrix element*(H, v): deterministic matrix-vector multiply (allocating)H(v): equivalent toH * v.mul!(w, H, v): mutating matrix-vector multiply.dot(x, H, v): computex⋅(H*v)minimizing allocations.H[address1, address2]: indexing withgetindex()- mostly for testing purposes (slow!)BasisSetRep: construct a basis set repesentationsparse,Matrix: construct a (sparse) matrix representation
See also Hamiltonians, Interfaces.
Rimu.Interfaces.offdiagonals — Functionoffdiagonals(h::AbstractHamiltonian, address)Return an iterator over reachable off-diagonal matrix elements of type <:AbstractOffdiagonals. Defaults to returning Offdiagonals(h, a)
See also
julia> addr = BoseFS((3,2,1));
julia> H = HubbardReal1D(addr);
julia> h = offdiagonals(H, addr)
6-element Rimu.Hamiltonians.Offdiagonals{BoseFS{6, 3, BitString{8, 1, UInt8}}, Float64, HubbardReal1D{Float64, BoseFS{6, 3, BitString{8, 1, UInt8}}, 1.0, 1.0}}:
(fs"|2 3 1⟩", -3.0)
(fs"|2 2 2⟩", -2.449489742783178)
(fs"|3 1 2⟩", -2.0)
(fs"|4 1 1⟩", -2.8284271247461903)
(fs"|4 2 0⟩", -2.0)
(fs"|3 3 0⟩", -1.7320508075688772)Rimu.Interfaces.diagonal_element — Functiondiagonal_element(ham, add)Compute the diagonal matrix element of the linear operator ham at address add.
Example
julia> addr = BoseFS((3, 2, 1));
julia> H = HubbardMom1D(addr);
julia> diagonal_element(H, addr)
8.666666666666664Rimu.Interfaces.starting_address — Functionstarting_address(h)Return the starting address for Hamiltonian h. Part of the AbstractHamiltonian interface. When called on an AbstractMatrix return the index of the lowest diagonal element.
Example
julia> addr = BoseFS((3, 2, 1));
julia> H = HubbardMom1D(addr);
julia> addr == starting_address(H)
trueThe following functions may be implemented instead of offdiagonals.
Rimu.Interfaces.num_offdiagonals — Functionnum_offdiagonals(ham, add)Compute the number of number of reachable configurations from address add.
Example
julia> addr = BoseFS((3, 2, 1));
julia> H = HubbardMom1D(addr);
julia> num_offdiagonals(H, addr)
10Rimu.Interfaces.get_offdiagonal — Functionnewadd, me = get_offdiagonal(ham, add, chosen)Compute value me and new address newadd of a single (off-diagonal) matrix element in a Hamiltonian ham. The off-diagonal element is in the same column as address add and is indexed by integer index chosen.
Example
julia> addr = BoseFS(3, 2, 1);
julia> H = HubbardMom1D(addr);
julia> get_offdiagonal(H, addr, 3)
(BoseFS{6,3}(2, 1, 3), 1.0)The following functions come with default implementations, but may be customized.
Rimu.Interfaces.random_offdiagonal — Functionrandom_offdiagonal(offdiagonals::AbstractOffdiagonals)
random_offdiagonal(ham::AbstractHamiltonian, add)Generate a single random excitation, i.e. choose from one of the accessible off-diagonal elements in the column corresponding to address add of the Hamiltonian matrix represented by ham. Alternatively, pass as argument an iterator over the accessible matrix elements.
Rimu.Interfaces.LOStructure — TypeLOStructure(op::AbstractHamiltonian)
LOStructure(typeof(op))LOStructure speficies properties of the linear operator op. If a special structure is known this can speed up calculations. Implemented structures are:
IsDiagonal: The operator is diagonal.IsHermitian: The operator is complex and Hermitian or real and symmetric.AdjointKnown: The operator is not Hermitian, but itsadjointis implemented.AdjointUnknown:adjointfor this operator is not implemented.
In order to define this trait for a new linear operator type, define a method for LOStructure(::Type{<:MyNewLOType}) = ….
Rimu.Hamiltonians.dimension — Functiondimension(h::AbstractHamiltonian, addr=starting_address(h))
dimension(addr::AbstractFockAddress)Return the estimated dimension of Hilbert space. May return a BigInt number.
When called on an address, the dimension of the linear space spanned by the address type is returned. When called on an AbstractHamiltonian, an upper bound on the dimension of the matrix representing the Hamiltonian is returned.
Examples
julia> dimension(BoseFS((1,2,3)))
28
julia> dimension(HubbardReal1D(BoseFS((1,2,3))))
28
julia> dimension(HubbardReal1D(near_uniform(BoseFS{200,100})))
1386083821086188248261127842108801860093488668581216236221011219101585442774669540
julia> dimension(HubbardReal1D(near_uniform(BoseFS{200,100})))|>Float64
1.3860838210861882e81Interface
When extending AbstractHamiltonian, define a method for the two-argument form dimension(h::MyNewHamiltonian, addr).
See also BasisSetRep.
Rimu.Interfaces.has_adjoint — Functionhas_adjoint(op)Return true if adjoint is defined on op.
Rimu.Interfaces.allowed_address_type — Functionallowed_address_type(h::AbstractHamiltonian)Return the type of addresses that can be used with Hamiltonian h. Part of the AbstractHamiltonian interface. Defaults to typeof(starting_address(h)).
Overload this function if the Hamiltonian can be used with addresses of different types.
This interface relies on unexported functionality, including
Base.adjoint — Functionadjoint(::LOStructure, op::AbstractHamiltonian)Represent the adjoint of an AbstractHamiltonian. Extend this method to define custom adjoints.
LinearAlgebra.dot — Functiondot(w, op::AbstractHamiltonian, v)Evaluate w⋅op(v) minimizing memory allocations.
dot(y::PDVec, A::AbstractHamiltonian, x::PDVec[, w::PDWorkingMemory])Perform y ⋅ A ⋅ x. The working memory w is required to facilitate threaded/distributed operations with non-diagonal A. If needed and not passed a new instance will be allocated. A can be replaced with a tuple of operators.
dot(map::OccupiedModeMap, vec::AbstractVector)
dot(map1::OccupiedModeMap, map2::OccupiedModeMap)Dot product extracting mode occupation numbers from an OccupiedModeMap similar to onr.
julia> b = BoseFS(10, 0, 0, 0, 2, 0, 1)
BoseFS{13,7}(10, 0, 0, 0, 2, 0, 1)
julia> mb = OccupiedModeMap(b)
3-element OccupiedModeMap{7, BoseFSIndex}:
BoseFSIndex(occnum=10, mode=1, offset=0)
BoseFSIndex(occnum=2, mode=5, offset=14)
BoseFSIndex(occnum=1, mode=7, offset=18)
julia> dot(mb, 1:7)
27
julia> mb⋅(1:7) == onr(b)⋅(1:7)
trueSee also SingleComponentFockAddress.
Rimu.Hamiltonians.AbstractOffdiagonals — TypeAbstractOffdiagonals{A,T}<:AbstractVector{Tuple{A,T}}Iterator over new address and matrix elements for reachable off-diagonal matrix elements of a linear operator.
See Offdiagonals for a default implementation.
Methods to define
offdiagonals(h, a)::AbstractOffdiagonals: This function is used to construct the correct type of offdiagonals for a given combination of Hamiltonianhand Fock addressa.Base.getindex(::AbstractOffdiagonals, i): should be equivalent toget_offdiagonal(h, a, i).Base.size(::AbstractOffdiagonals): should be equivalent tonum_offdiagonals(h, a).
Rimu.Hamiltonians.Offdiagonals — TypeOffdiagonals(h, address)Iterator over new address and matrix element for reachable off-diagonal matrix elements of linear operator h from address address. Represents an abstract vector containing the possibly non-zero off-diagonal matrix elements of the column of ham indexed by add.
This is the default implementation defined in terms of num_offdiagonals and get_offdiagonal.
See also
Rimu.Hamiltonians.check_address_type — Functioncheck_address_type(h::AbstractHamiltonian, addr_or_type)Throw an ArgumentError if addr_or_type is not compatible with h. Acceptable arguments are either an address or an address type, or a tuple or array thereof.
See also allowed_address_type.
Geometry
Lattices in higher dimensions are defined here for HubbardRealSpace.
Rimu.Hamiltonians.LatticeGeometry — Typeabstract type LatticeGeometry{D}A LatticeGeometry controls which sites in an AbstractFockAddress are considered to be neighbours.
Currently only supported by HubbardRealSpace.
Available implementations
Interface to implement
Base.size: return the lattice size.neighbour_site(::LatticeGeometry, ::Int, ::Int)num_dimensions(::LatticeGeometry)num_neighbours(::LatticeGeometry)
Rimu.Hamiltonians.PeriodicBoundaries — TypePeriodicBoundaries(size...) <: LatticeGeometryRectangular lattice with periodic boundary conditions of size size.
The dimension of the lattice is controlled by the number of arguments given to its constructor.
This is the default geometry used by HubbardRealSpace.
Example
julia> lattice = PeriodicBoundaries(5, 4) # 2D lattice of size 5 × 4
PeriodicBoundaries(5, 4)
julia> num_neighbours(lattice)
4
julia> neighbour_site(lattice, 1, 1)
2
julia> neighbour_site(lattice, 1, 2)
5
julia> neighbour_site(lattice, 1, 3)
6
julia> neighbour_site(lattice, 1, 4)
16See also
Rimu.Hamiltonians.HardwallBoundaries — TypeHardwallBoundariesRectangular lattice with hard wall boundary conditions of size size. neighbour_site() will return 0 for some neighbours of boundary sites.
The dimension of the lattice is controlled by the number of arguments given to its constructor.
Example
julia> lattice = HardwallBoundaries(5) # 1D lattice of size 5
HardwallBoundaries(5)
julia> neighbour_site(lattice, 1, 1)
2
julia> neighbour_site(lattice, 1, 2)
0
See also
Rimu.Hamiltonians.LadderBoundaries — TypeLadderBoundaries(size...; subgeometry=PeriodicBoundaries) <: LatticeGeometryLattice geometry where the first dimension is of size 2 and has hardwall boundary conditions. Using this geometry is more efficient than using HardwallBoundaries with a size of 2, as it does not generate rejected neighbours.
In other dimensions, it behaves like its subgeometry, which can be any LatticeGeometry.
Example
julia> lattice = LadderBoundaries(2, 3, 4) # 3D lattice of size 2 × 3 × 4
LadderBoundaries(2, 3, 4)
julia> num_neighbours(lattice)
5
julia> neighbour_site(lattice, 1, 1)
2
julia> neighbour_site(lattice, 1, 2)
3
julia> neighbour_site(lattice, 1, 3)
5
julia> neighbour_site(lattice, 1, 4)
7
julia> neighbour_site(lattice, 1, 5)
19See also
Rimu.Hamiltonians.num_neighbours — Functionnum_neighbours(geom::LatticeGeometry)Return the number of neighbours each lattice site has in this geometry.
Note that for efficiency reasons, all sites are expected to have the same number of neighbours. If some of the neighbours are invalid, this is handled by having neighbour_site return 0.
Rimu.Hamiltonians.num_dimensions — Functionnum_dimensions(geom::LatticeGeometry)Return the number of dimensions of the lattice in this geometry.
Rimu.Hamiltonians.neighbour_site — Functionneighbour_site(geom::LatticeGeometry, site, i)Find the i-th neighbour of site in the geometry. If the move is illegal, return 0.
Harmonic Oscillator
Useful utilities for harmonic oscillator in Cartesian basis, see HOCartesianContactInteractions and HOCartesianEnergyConservedPerDim.
Rimu.Hamiltonians.get_all_blocks — Functionget_all_blocks(h::Union{HOCartesianContactInteractions,HOCartesianEnergyConservedPerDim};
target_energy = nothing,
max_energy = nothing,
max_blocks = nothing,
method = :vertices,
kwargs...) -> dfFind all distinct blocks of h. Returns a DataFrame with columns
block_id: index of block in order foundblock_E0: noninteracting energy of all elements in the blockblock_size: number of elements in the blockaddr: first address that generates the block with e.g.BasisSetRepindices: tuple of mode indices that allow recreation of the generating addressaddr; in this case use e.g.BoseFS(M; indices .=> 1)This is useful when theDataFrameis loaded from file sinceArrow.jlconverts custom types toNamedTuples.t_basis: time to generate the basis for each block
Keyword arguments:
target_energy: only blocks with this noninteracting energy are foundmax_energy: only blocks with noninteracting energy less than this are foundmax_blocks: exit after finding this many blocksmethod: Choose between:verticesand:combfor method of enumerating tuples of quantum numberssave_to_file=nothing: if set then theDataFramerecording blocks is saved after each new block is found- additional
kwargs: passed toisapproxfor comparing block energies. Useful for anisotropic traps
Note: If h was constructed with option block_by_level = false then the block seeds addr are determined by parity. In this case the blocks are not generated; t_basis will be zero, and block_size will be an estimate. Pass the seed addresses to BasisSetRep with an appropriate filter to generate the blocks.
Rimu.Hamiltonians.fock_to_cart — Functionfock_to_cart(addr, S; zero_index = true)Convert a Fock state address addr to Cartesian harmonic oscillator basis indices $n_x,n_y,\ldots$. These indices are bounded by S which is a tuple of the maximum number of states in each dimension. By default the groundstate in each dimension is indexed by 0, but this can be changed by setting zero_index = false.
Underlying integrals for the interaction matrix elements are implemented in the following unexported functions
Rimu.Hamiltonians.four_oscillator_integral_general — Functionfour_oscillator_integral_general(i, j, k, l; max_level = typemax(Int))Integral of four one-dimensional harmonic oscillator functions,
\[ \mathcal{I}(i,j,k,l) = \int_{-\infty}^\infty dx \, \phi_i(x) \phi_j(x) \phi_k(x) \phi_l(x)\]
Indices i,j,k,l start at 0 for the groundstate.
This integral has a closed form in terms of the hypergeometric $_{3}F_2$ function, and is non-zero unless $i+j+k+l$ is odd. See e.g. Titchmarsh (1948). This is a generalisation of the closed form in Papenbrock (2002), which is is the special case where $i+j == k+l$, but is numerically unstable for large arguments. Used in HOCartesianContactInteractions and HOCartesianEnergyConservedPerDim.
Rimu.Hamiltonians.ho_delta_potential — Functionho_delta_potential(S, i, j; [vals])Returns the matrix element of a delta potential at the centre of a trap, i.e. the product of two harmonic oscillator functions evaluated at the origin,
\[ v_{ij} = \phi_{\mathbf{n}_i}(0) \phi_{\mathbf{n}_j}(0)\]
which is only non-zero for even-parity states. The ith single particle state corresponds to a $D$-tuple of harmonic oscillator indices $\mathbf{n}_i$. S defines the bounds of Cartesian harmonic oscillator indices for each dimension. The optional keyword argument vals allows passing pre-computed values of $\phi_i(0)$ to speed-up the calculation. The values can be calculated with log_abs_oscillator_zero.
See also HOCartesianCentralImpurity.
Rimu.Hamiltonians.log_abs_oscillator_zero — Functionlog_abs_oscillator_zero(n)Compute the logarithm of the absolute value of the $n^\mathrm{th}$ 1D harmonic oscillator function evaluated at the origin. The overall sign is determined when the matrix element is evaluated in ho_delta_potential.
Index
Rimu.HamiltoniansBase.MatrixRimu.Hamiltonians.AbstractOffdiagonalsRimu.Hamiltonians.AxialAngularMomentumHORimu.Hamiltonians.BasisSetRepRimu.Hamiltonians.BoseHubbardMom1D2CRimu.Hamiltonians.BoseHubbardReal1D2CRimu.Hamiltonians.DensityMatrixDiagonalRimu.Hamiltonians.ExtendedHubbardReal1DRimu.Hamiltonians.G2MomCorrelatorRimu.Hamiltonians.G2RealCorrelatorRimu.Hamiltonians.GuidingVectorSamplingRimu.Hamiltonians.GutzwillerSamplingRimu.Hamiltonians.HOCartesianCentralImpurityRimu.Hamiltonians.HOCartesianContactInteractionsRimu.Hamiltonians.HOCartesianEnergyConservedPerDimRimu.Hamiltonians.HardwallBoundariesRimu.Hamiltonians.HubbardMom1DRimu.Hamiltonians.HubbardMom1DEPRimu.Hamiltonians.HubbardReal1DRimu.Hamiltonians.HubbardReal1DEPRimu.Hamiltonians.HubbardRealSpaceRimu.Hamiltonians.LadderBoundariesRimu.Hamiltonians.LatticeGeometryRimu.Hamiltonians.MatrixHamiltonianRimu.Hamiltonians.MomentumRimu.Hamiltonians.OffdiagonalsRimu.Hamiltonians.ParitySymmetryRimu.Hamiltonians.PeriodicBoundariesRimu.Hamiltonians.StoquasticRimu.Hamiltonians.StringCorrelatorRimu.Hamiltonians.SuperfluidCorrelatorRimu.Hamiltonians.TimeReversalSymmetryRimu.Hamiltonians.Transcorrelated1DRimu.Interfaces.AbstractHamiltonianRimu.Interfaces.LOStructureBase.adjointLinearAlgebra.dotRimu.Hamiltonians.build_basisRimu.Hamiltonians.check_address_typeRimu.Hamiltonians.continuum_dispersionRimu.Hamiltonians.dimensionRimu.Hamiltonians.fock_to_cartRimu.Hamiltonians.four_oscillator_integral_generalRimu.Hamiltonians.get_all_blocksRimu.Hamiltonians.ho_delta_potentialRimu.Hamiltonians.hubbard_dispersionRimu.Hamiltonians.log_abs_oscillator_zeroRimu.Hamiltonians.momentumRimu.Hamiltonians.neighbour_siteRimu.Hamiltonians.num_dimensionsRimu.Hamiltonians.num_neighboursRimu.Hamiltonians.rayleigh_quotientRimu.Hamiltonians.shift_latticeRimu.Hamiltonians.shift_lattice_invRimu.Interfaces.allowed_address_typeRimu.Interfaces.diagonal_elementRimu.Interfaces.get_offdiagonalRimu.Interfaces.has_adjointRimu.Interfaces.num_offdiagonalsRimu.Interfaces.offdiagonalsRimu.Interfaces.random_offdiagonalRimu.Interfaces.starting_addressSparseArrays.sparse