Skip to content

Commit a06d8cf

Browse files
authored
Update particle number density implementation in bose_hubbard_model (#48)
* Update particle number density implementation in `bose_hubbard_model` * Add test
1 parent b2c370e commit a06d8cf

File tree

3 files changed

+51
-4
lines changed

3 files changed

+51
-4
lines changed

src/models/hamiltonians.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,14 @@ end
331331
332332
MPO for the hamiltonian of the Bose-Hubbard model, as defined by
333333
```math
334-
H = -t \\sum_{\\langle i,j \\rangle} \\left( a_{i}^+ a_{j}^- + a_{i}^- a_{j}^+ \\right) - \\sum_i \\mu N_i + \\frac{U}{2} \\sum_i N_i(N_i - 1).
334+
H = -t \\sum_{\\langle i,j \\rangle} \\left( a_{i}^+ a_{j}^- + a_{i}^- a_{j}^+ \\right) - \\mu \\sum_i N_i + \\frac{U}{2} \\sum_i N_i(N_i - 1).
335335
```
336336
where ``N`` is the bosonic number operator [`a_number`](@ref).
337337
338-
By default, the model is defined on an infinite chain with unit lattice spacing, without any symmetries and with `ComplexF64` entries of the tensors. The Hilbert space is truncated such that at maximum of `cutoff` bosons can be at a single site. If the `symmetry` is not `Trivial`, a fixed particle number density `n` can be imposed.
338+
By default, the model is defined on an infinite chain with unit lattice spacing, without any
339+
symmetries and with `ComplexF64` entries of the tensors. The Hilbert space is truncated such
340+
that at maximum of `cutoff` bosons can be at a single site. If the `symmetry` is not
341+
`Trivial`, a fixed (halfinteger) particle number density `n` can be imposed.
339342
"""
340343
function bose_hubbard_model end
341344
function bose_hubbard_model(lattice::AbstractLattice; kwargs...)
@@ -348,7 +351,7 @@ end
348351
function bose_hubbard_model(elt::Type{<:Number}=ComplexF64,
349352
symmetry::Type{<:Sector}=Trivial,
350353
lattice::AbstractLattice=InfiniteChain(1);
351-
cutoff::Integer=5, t=1.0, U=1.0, mu=0.0, n::Integer=0)
354+
cutoff::Integer=5, t=1.0, U=1.0, mu=0.0, n=0)
352355
hopping_term = a_plusmin(elt, symmetry; cutoff=cutoff) +
353356
a_minplus(elt, symmetry; cutoff=cutoff)
354357
N = a_number(elt, symmetry; cutoff=cutoff)
@@ -368,7 +371,7 @@ function bose_hubbard_model(elt::Type{<:Number}=ComplexF64,
368371
elseif symmetry === U1Irrep
369372
isinteger(2n) ||
370373
throw(ArgumentError("`U₁` symmetry requires halfinteger particle number"))
371-
H = MPSKit.add_physical_charge(H, fill(U1Irrep(n), length(H)))
374+
H = MPSKit.add_physical_charge(H, fill(U1Irrep(-n), length(H)))
372375
else
373376
throw(ArgumentError("symmetry not implemented"))
374377
end

test/bose_hubbard.jl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using Test
2+
using TensorKit
3+
using MPSKit
4+
using MPSKitModels
5+
6+
## Setup
7+
8+
symmetry = U1Irrep
9+
cutoff = 3
10+
t = 1.0
11+
U = 10.0
12+
mu = 0.0
13+
n = 1
14+
lattice = InfiniteChain()
15+
16+
Vspace = U1Space(0 => 8, 1 => 6, -1 => 6, 2 => 4, -2 => 4, 3 => 2, -3 => 2)
17+
18+
alg = VUMPS(; maxiter=25, verbosity=0)
19+
20+
# compare against higher-order analytic expansion from https://arxiv.org/pdf/1507.06426
21+
function exact_bose_hubbard_energy(; t=1.0, U=1.0)
22+
J = t / U
23+
24+
E = 4 * U *
25+
(-J^2 + J^4 + 68 / 9 * J^6 - 1267 / 81 * J^8 + 44171 / 1458 * J^10 -
26+
4902596 / 6561 * J^12 -
27+
8020902135607 / 2645395200 * J^14 - 32507578587517774813 / 466647713280000 * J^16)
28+
29+
return E
30+
end
31+
32+
## Test
33+
34+
@testset "Bose-Hubbard ground state" begin
35+
H = bose_hubbard_model(symmetry, lattice; cutoff, t, U, mu, n)
36+
ψ = InfiniteMPS([physicalspace(H, 1)], [Vspace])
37+
@test imag(expectation_value(ψ, H)) 0 atol = 1e-10
38+
ψ, envs, δ = find_groundstate(ψ, H, alg)
39+
@test expectation_value(ψ, H, envs) exact_bose_hubbard_energy(; t, U) atol = 1e-2
40+
end

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ end
3737
include("heisenberg.jl")
3838
end
3939

40+
@testset "bose-hubbard model" begin
41+
include("bose_hubbard.jl")
42+
end
43+
4044
@testset "quantum potts model" begin
4145
include("quantum_potts.jl")
4246
end

0 commit comments

Comments
 (0)