define initial translation-invariant state

Hi, How one can create initial product state of the form:
\psi = \psi_0 \otimes \psi_0 \ldots \psi_0,
where \psi_0 = \cos(\theta) |Up\rangle + \sin(\theta) |Dn\rangle

similar question was posted in Setting Random Initial Product State - ITensor Support Q&A

The code below ought to work

N = 10
sites = siteinds(“S=1/2”,N)
psi = MPS(sites)
for j=1:N
  psi[j] = ITensor([cos(theta), sin(theta)], sites[j])
end
orthogonalize!(psi,1) # not strictly necessary but will put in link indices and may help later functions to work correctly

Many thanks!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.