I have created a new Z3 sitetype using
const Z3Site = TagType"Z3"
function siteinds(::Z3Site, Num::Int;kwargs...)
conserve_qns = get(kwargs,:conserve_qns,false)
if conserve_qns
s = [ QN(("P", n, 3)) => 1 for n = 0:2]
return [Index(s;tags="Site,Z3,n=$n") for n=1:Num]
end
return [Index(N,"Site,Z3,n=$n") for n=1:Num]
end
function state(::Z3Site,
st::AbstractString)
if st == "s1"
return 1
elseif st == "s2"
return 2
elseif st == "s3"
return 3
end
when I use these site type to initialize a random mps with
sites=siteinds("Z3",N,conserve_qns=true)
state = ["s1" for n in 1:N]
randomMPS(sites,state,10)
It throws the error that
"Indices must have the same spaces to be replaced"
This error can be reproduced using the following minimal code
sites = siteinds("Z3",N,conserve_qns=true);
s1 = sites[1];
s2 = sites[2];
M = randomITensor(QN(),s1',s2',dag(s1),dag(s2));
U,S,V = svd(M,(s1',s2'));
replaceind!(U,ind(S,1),ind(S,2))
because
space(ind(S,2))!=space(ind(S,1))
However, when I print the space of the two index space, it seems that they are the same when module 3
space(ind(S,2))
3-element Array{Pair{QN,Int64},1}:
QN("P",-2,3) => 3
QN("P",-1,3) => 3
QN("P",0,3) => 3
space(ind(S,1))
3-element Array{Pair{QN,Int64},1}:
QN("P",1,3) => 3
QN("P",2,3) => 3
QN("P",0,3) => 3
Is there something wrong when I define the Z3 sitetype?
Thank you very much for the answer!