Developer Documentation

Module Hamiltionians.jl

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 LinearOperator, in the spirit of the AbstractArray interface as discussed in the Julia Documentation.

Relation to other parts of the Rimu code

In order to define a specific model Hamiltonian with relevant parameters for the model, instantiate the model like this in the input file:

ham = BoseHubbardReal1D(n=6, m=6, u=1.0, t=1.0, AT = BSAdd64)

In the rest of the Rimu code, access to properties and matrix elements of the model are then provided by the following methods:

Model Hamiltonians

Here is a list of fully implemented model Hamiltonians. So far there are two variants implemented of the Bose-Hubbard model in one dimensional in real space.

Rimu.Hamiltonians.BoseHubbardReal1DType
ham = BoseHubbardReal1D(;[n=6, m=6, u=1.0, t=1.0, AT = BSAdd64])

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

  • n::Int: the number of bosons
  • m::Int: the number of lattice sites
  • u::Float64: the interaction parameter
  • t::Float64: the hopping strength
  • AT::Type: the address type

Functor use:

w = ham(v)
ham(w, v)

Compute the matrix - vector product w = ham * v. The two-argument version is mutating for w.

ham(:dim)

Return the dimension of the linear space if representable as Int, otherwise return nothing.

ham(:fdim)

Return the approximate dimension of linear space as Float64.

source
Rimu.Hamiltonians.ExtendedBHReal1DType
ham = ExtendedBHReal1D(n=6, m=6, u=1.0, v=1.0, t=1.0, AT=BSAdd64)

Implements the extended Bose 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

  • n::Int: number of bosons
  • m::Int: number of lattice sites
  • u::Float64: on-site interaction parameter
  • v::Float64: the next-neighbor interaction
  • t::Float64: the hopping strength
  • AT::Type: address type for identifying configuration
source

Hamiltonians 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 LinearOperator and implement the relevant methods.

Rimu.Hamiltonians.LinearOperatorType
LinearOperator{T}

Supertype that provides and interface for linear operators over T that are suitable for FCIQMC. Indexing is done with addresses from a linear space that may be large (and will not need to be completely generated).

Provides:

  • Hops: iterator over reachable off-diagonal matrix elements
  • generateRandHop: function to generate random off-diagonal matrix element
  • hamiltonian[address1, address2]: indexing with getindex() - mostly for testing purposes
  • *(LO, v) deterministic matrix-vector multiply (== LO(v))
  • mul!(w, LO, v) mutating matrix-vector multiply
  • dot(x, LO, v) compute x⋅(LO*v) minimizing allocations

Methods that need to be implemented:

Optional:

source
Rimu.Hamiltonians.HopsType
Hops(ham, add)

Iterator over new address and matrix element for reachable off-diagonal matrix elements of linear operator ham from address add. Represents an abstract vector containing the possibly non-zero off-diagonal matrix elements of the column of ham indexed by add.

Examples

new_address, matrix_element = Hops(ham, current_address)[i]
number_of_hops = length(Hops(ham, current_address))
for (add,elem) in Hops(ham, current_address)
   # do something with address and elem
end
source
Rimu.Hamiltonians.generateRandHopFunction
generateRandHop(ham, add)
generateRandHop(hops::Hops)

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.

source

Core functions

The following functions are part of the core functionality of a Hamiltonian and need to be implemented efficiently and specifically for each model.

Rimu.Hamiltonians.hopFunction
newadd, me = hop(ham, add, chosen)

Compute matrix element of hamiltonian and new address of a single hop from address add with integer index chosen.

source

BosonicHamiltonian

For a many-body system consisting of spinless bosons, we already know more about the structure of the problem. BosonicHamiltonian is a pre-defined subtype of LinearOperator.

Rimu.Hamiltonians.BosonicHamiltonianType
BosonicHamiltonian{T} <: LinearOperator{T}

Abstract type for representing Hamiltonians in a Fock space of fixed number of scalar bosons. At least the following fields should be present:

  • n # number of particles
  • m # number of modes
  • AT # address type

Methods that need to be implemented:

Optional:

Provides:

source
Rimu.Hamiltonians.hasIntDimensionFunction
hasIntDimension(ham)

Return true if dimension of the linear operator ham can be computed as an integer and false if not.

If true, dimensionLO(h) will be successful and return an Int. The method fDimensionLO(h) should be useful in other cases.

source
Rimu.Hamiltonians.fDimensionLOFunction
fDimensionLO(hamiltonian)

Returns the dimension of Hilbert space as Float64. The exact result is returned if the value is smaller than 2^53. Otherwise, an improved Stirling formula is used.

source
Rimu.BitStringAddresses.nearUniformFunction
nearUniform(N, M) -> onr::SVector{M,Int}

Create occupation number representation onr distributing N particles in M modes in a close-to-uniform fashion with each orbital filled with at least N ÷ M particles and at most with N ÷ M + 1 particles.

source
nearUniform(BoseFS{N,M})
nearUniform(BoseFS{N,M,A}) -> bfs::BoseFS{N,M,A}

Create bosonic Fock state with near uniform occupation number of M modes with a total of N particles. Specifying the bit address type A is optional.

Examples

julia> nearUniform(BoseFS{7,5,BitAdd})
BoseFS{BitAdd}((2,2,1,1,1))

julia> nearUniform(BoseFS{7,5})
BoseFS{BSAdd64}((2,2,1,1,1))
source
nearUniform(ham)

Create bitstring address with near uniform distribution of particles across modes for the Hamiltonian ham.

source