Define a new type of sites in mixed space

Hello,

I want to do DMRG calculation in the mixed space: In x-dirction, it is in real-space. While in y-direction, it is in k-space. I define a new type of site, Fermionk. The total momentum in y direction and the total particle number are the good quantum numbers. Here are the codes:

“”“julia
import ITensors: space, state, op!, has_fermion_string
function ITensors.space(
::SiteType"Fermionk”,
n::Int;
conserve_qns=false,
conserve_nf = conserve_qns,
conserve_nfparity = conserve_qns,
conserve_ky=false,
qnname_nf = “Nf”,
qnname_nfparity = “NfParity”,
qnname_ky=“Ky”,
# qnname_sz=“Sz”,
# conserve_sz=true,
modulus_ky,
)
if conserve_nf && conserve_ky
mod = (n-1) % modulus_ky
# mod = n % modulus_ky
return [
QN((qnname_nf,0,-1),(qnname_ky,0,modulus_ky))=>1
QN((qnname_nf,1,-1),(qnname_ky,mod,modulus_ky))=>1
]
elseif conserve_ky
error(“Cannot conserve ky without conserving nf”)
elseif conserve_nf
return [
QN(qnname_nf,0,-1)=>1
QN(qnname_nf,1,-1)=>1
]
elseif conserve_nfparity
return [
QN(qnname_nfparity,0,-2)=>1
QN(qnname_nfparity,1,-2)=>1
]
end
return 2
end
#define vals
ITensors.val(::ValName"Emp",::SiteType"Fermionk") = 1
ITensors.val(::ValName"Occ",::SiteType"Fermionk") = 2
ITensors.val(::ValName"0",st::SiteType"Fermionk") = val(ValName(“Emp”),st)
ITensors.val(::ValName"1",st::SiteType"Fermionk") = val(ValName(“Occ”),st)
#define states
ITensors.state(::StateName"Emp",::SiteType"Fermionk") = [1.0 0.0]
ITensors.state(::StateName"Occ",::SiteType"Fermionk") = [0.0 1.0]
ITensors.state(::StateName"0",st::SiteType"Fermionk") = state(StateName(“Emp”),st)
ITensors.state(::StateName"1",st::SiteType"Fermionk") = state(StateName(“Occ”),st)

occupation operator definition

function ITensors.op!(Op::ITensor,::OpName"N",::SiteType"Fermionk",s::Index)
return Op[s’=>2,s=>2] = 1.0
end
function ITensors.op!(Op::ITensor,on::OpName"n",st::SiteType"Fermionk",s::Index)
return ITensors.op!(Op,alias(on),st,s)
end

anhilation operator definition

function ITensors.op!(Op::ITensor,::OpName"C",::SiteType"Fermionk",s::Index)
return Op[s’ => 1,s => 2] = 1.0
end
function ITensors.op!(Op::ITensor,on::OpName"c",st::SiteType"Fermionk",s::Index)
return ITensors.op!(Op,alias(on),st,s)
end
#creation opertor
function ITensors.op!(Op::ITensor, ::OpName"Cdag", ::SiteType"Fermionk", s::Index)
return Op[s’ => 2, s => 1] = 1.0
end
function ITensors.op!(Op::ITensor, on::OpName"c†“, st::SiteType"Fermionk”, s::Index)
return ITensors.op!(Op, alias(on), st, s)
end
function ITensors.op!(Op::ITensor, on::OpName"cdag", st::SiteType"Fermionk", s::Index)
return ITensors.op!(Op, alias(on), st, s)
end
#F operator
function ITensors.op!(Op::ITensor, ::OpName"F", ::SiteType"Fermionk", s::Index)
Op[s’ => 1, s => 1] = +1.0
return Op[s’ => 2, s => 2] = -1.0
end

has_fermion_string(::OpName"C", ::SiteType"Fermionk") = true
has_fermion_string(::OpName"Cdag", ::SiteType"Fermionk") = true

“”"

However, when I try to use the new type of sites to get a MPS with specific quantum number and linkdim,

‘’’
itensor_rng = Xoshiro()
Random.seed!(itensor_rng,1234)
Nx = 8
Ny = 4
N = Nx*Ny
sites = siteinds(“Fermionk”,N;conserve_qns=true,conserve_ky=true,modulus_ky = Ny)
state = Array{String}(undef, N)
for i = 1:Nx
for j = 1:Ny
if isodd(i)
state[(i-1)*Ny+j]=isodd(j) ? “Emp” : “Occ”
else
state[(i-1)*Ny+j]=isodd(j) ? “Occ” : “Emp”
end
end
end
psi0 = randomMPS(itensor_rng,sites,state;linkdims = 10)
‘’’
I get the warning
‘’’
Warning: MPS center bond dimension is less than requested (you requested 10, but in practice it is 1. This is likely due to technicalities of truncating quantum number sectors.
‘’’
It seems that every time I set “conserve_ky=true”, the linkdim of the MPS is always equal to 1, and I cannot get the correct result of DMRG calculation. If I set “conserve_ky=false”, the DMRG calculation result is right. But, the aim of doing DMRG calculation in the mixed space is making use of the momentum conservation to enhance the calculation efficiency. Could you please tell me how to deal with this problem? Thank you very much!

Best wishes,
Wenqi

1 Like

Hi Wenqi,
Thanks for providing a lot of helpful information. Could you please make sure your code above is formatted properly for the forum? The way to do that is to use three backtick symbols at the beginning and end (so not quotation marks but like backwards apostrophe symbols like these: ```). If you need help, I could edit and format your post – just let me know.

Regarding your questions:

  1. I wouldn’t worry too much about the warning about the MPS center bond dimension. It’s a weakness of our current implementation of the randomMPS function and it should only slightly affect your initial state, but shouldn’t affect any other parts of your calculation (i.e. you should still find that the total quantum number is ok and if you do enough sweeps of DMRG it won’t affect what answer you obtain at the end).

  2. It’s a little difficult to know or immediately guess why you are getting only bond dimension 1 for the linkdims when you try to conserve ky.

Are you using the noise parameter (noise term) when you are running your DMRG calculations?