How create a mps like (|up>+|Dn>)_1(|up>-|Dn>)_2|up>+|Dn>)_3(|up>-|Dn>)_4....

Dear evergone,

I need to generate a state in the form MPS. The state is

(|up>+|dn>)_1 (|up>-|dn>)_2 (|up>+|dn>)_3 (|up>-|dn>)_4....(|up>+|dn>)_{N-1} (|up>-|dn>)_N.

Looking forward to your reply
Thanks

The Hadamard gate (or matrix) acting on up or down will do this for you
H|\uparrow\rangle = 1/\sqrt{2} (|\uparrow\rangle +|\downarrow\rangle) \\ H|\downarrow\rangle = 1/\sqrt{2} (|\uparrow\rangle -|\downarrow\rangle)
So start with the antiferromagnetic |\uparrow\downarrow\uparrow\dots\uparrow\downarrow\rangle state as an MPS, then apply the single site itensor/gate to each site. This isn’t built in to the C++ version, so you’ll need to make the op yourself (It’s built in to the Julia version))

You can also just write out the tensors directly if thats easier, this is a MPS with bond dimension of 1

1 Like

Thanks.
I solved this problem,for Spin-1 chain

auto psiz4 = MPS(sites);
for(int i=1; i<=N; i++){
if(i%2==1 ){
auto si = sites(i);
auto wf = ITensor(si);
wf.set(si(1), 1./sqrt(2));
wf.set(si(2), 0.0) ;
wf.set(si(3), 1./sqrt(2));
psiz4.setA(i,wf);
}
else
{
auto si = sites(i);
auto wf = ITensor(si);
wf.set(si(1), 1./sqrt(2));
wf.set(si(2), 0.0) ;
wf.set(si(3), -1./sqrt(2));
psiz4.setA(i,wf);}
}

Great! Just a small thing, be careful since the MPS you created has no link indices, so certain algorithms may not work as expected (e.g. inner(psiz4,H,psiz4) will error but DMRG seems to work)

Good point, Ryan.

Jie, as a workaround in case you have any issues related to the lack of link indices, you can just call:
orthogonalize!(psi,1)
on your MPS psi and that ought to put the link indices in for you.

I use function Apply,inner(psiz4,Apply(H,psiz4)). Yours is better.