Hello everyone!
I want to use purification method or ancillas method to get a finite temperature state with an characteristic energy E_{e} and with half-filling bosons in a Bosonic system.
Its Hamiltonian is a simple Bose-Hubbard model.
I start imaginary time-evolution from an infinite temperature state which is an Identity operator \rho_o=\frac{1}{d^L}\hat{I} according to the paper.
My question is how to find an specific finite temperature state which is characterized by its energy E_e and particle numbers N=L/2.
Another particularly trivial question is that how can one obtain local observables from density operator \hat{\rho}(\beta).
I have tried tr(rho[i]*dag(op("N",sites[i])))
to get particle numbers on the site i, but it doesn’t work.
tr(rho1[2]*dag(op("N",sites[2])))
ERROR: MethodError: no method matching outer()
Closest candidates are:
outer(::NDTensors.DenseTensor{ElT1}, ::NDTensors.DenseTensor{ElT2}) where {ElT1, ElT2} at C:\Users\黄旺\.julia\packages\NDTensors\oXCSC\src\dense\tensoralgebra\outer.jl:31
outer(::NDTensors.DiagTensor{ElT1, N1}, ::NDTensors.DiagTensor{ElT2, N2}) where {ElT1, ElT2, N1, N2} at C:\Users\黄旺\.julia\packages\NDTensors\oXCSC\src\diag\tensoralgebra\outer.jl:25
outer(::NDTensors.DiagBlockSparseTensor{ElT1, N1}, ::NDTensors.DiagBlockSparseTensor{ElT2, N2}) where {ElT1, ElT2, N1, N2} at C:\Users\黄旺\.julia\packages\NDTensors\oXCSC\src\blocksparse\diagblocksparse.jl:425
...
Stacktrace:
[1] combiner(inds::Vector{Index{Vector{Pair{QN, Int64}}}}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ITensors C:\Users\Wang\.julia\packages\ITensors\4aoLl\src\qn\qnitensor.jl:405
[2] combiner(inds::Vector{Index{Vector{Pair{QN, Int64}}}})
@ ITensors C:\Users\Wang\.julia\packages\ITensors\4aoLl\src\qn\qnitensor.jl:401
[3] _tr(T::ITensor; plev::Pair{Int64, Int64}, tags::Pair{TagSet, TagSet})
@ ITensors C:\Users\Wang\.julia\packages\ITensors\4aoLl\src\tensor_operations\matrix_algebra.jl:4
[4] _tr
@ C:\Users\Wang\.julia\packages\ITensors\4aoLl\src\tensor_operations\matrix_algebra.jl:2 [inlined]
[5] #tr#256
@ C:\Users\Wang\.julia\packages\ITensors\4aoLl\src\tensor_operations\matrix_algebra.jl:20 [inlined]
[6] tr(T::ITensor)
@ ITensors C:\Users\Wang\.julia\packages\ITensors\4aoLl\src\tensor_operations\matrix_algebra.jl:19
[7] top-level scope
@ REPL[105]:1
Here is my code.
sites = siteinds("Boson",L;conserve_qns = true,conserve_number = true,dim = 5)
#Halmitonian whcih only acts on physical sites
hal=OpSum()
for i=1:2:L
hal += -j1,"Adag",i,"A",i+2
hal += -j1,"Adag",i+2,"A",i
hal += U/2,"N",i,"N",i
hal += -U/2,"N",i
end
hal += U/2,"N",L-1,"N",L-1
hal += -U/2,"N",L-1
H = toMPO(hal,sites)
#troter gates
gates=ITensor[]
for i=1:2:L
s1=sites[i]
s2=sites[i+2]
hj = U/2*op("N * N",s1)*op("Id",s2)
hj += -U/2*op("N",s1)*op("Id",s2)
hj += -j1*op("Adag",s1)*op("A",s2)
hj += -j1*op("Adag",s2)*op("A",s1)
Gj = exp(-tau / 2 * hj)
push!(gates,Gj)
end
hj = U/2*op("N * N",sites[L-1])*op("Id",sites[L])
hj += -U/2*op("N",sites[L-1])*op("Id",sites[L])
Gj = exp(-tau / 2 * hj)
push!(gates,Gj)
append!(gates,reverse(gates))
#infinite temperature mixed state
rho = MPO(sites, "Id")/(5^L)
#imaginary time-evolution
for beta in 0:tau:beta_max
println("beta=",beta)
energy_rho=real(inner(rho,H))
println("energy_rho=$energy_rho")
density_rho=[]
for i=1:2:L
density_i=tr(rho[i]*op("N",sites[i]))
append!(density_rho,density_i)
end
println("density_psi=$density_rho")
rho=apply(gates,rho)
end