# Starting Initial State as product state of singlets

+1 vote
asked

Is there any way to construct the initial state so that it will be a product state of singlets??
For example if I have 2N sites I want N singlets to initialize the state.

## 1 Answer

0 votes
answered by (52.6k points)

Hi Dhiman,
Good question as this is an important thing to be able to do sometimes. And of course you can do this, yes, as one can set the elements of an ITensor or IQTensor individually so you can make any MPS this way.

Here is a sample code that makes an MPS which is a product state of singlets. To do the IQMPS version all you should need to do is change MPS to IQMPS and ITensor to IQTensor.

auto psi = MPS(sites);
for(int n = 1; n <= 2*N; n += 2)
{
auto s1 = sites(n);
auto s2 = sites(n+1);
auto wf = ITensor(s1,s2);
wf.set(s1(1),s2(2), ISqrt2);
wf.set(s1(2),s2(1), -ISqrt2);
ITensor D;
psi.Aref(n) = ITensor(s1);
psi.Aref(n+1) = ITensor(s2);
svd(wf,psi.Aref(n),D,psi.Aref(n+1));
psi.Aref(n) *= D;
}

commented by (150 points)
Thanks miles.
commented by (620 points)
edited
Hi Miles,
This is very helpful, thank you. Could you please let me know how I can edit this code to get a product state of singlets with free spins at the edges, i.e., |up> x |singlet> x ..... x |singlet> x |down>, where x is the symbol for the tensor product? Thanks in advance.

Regards,
Niraj