#include "itensor/all.h"
#include "itensor/util/print_macro.h"
using namespace itensor;
int main()
{
int N =10;
auto sites = SpinOne(N,{"ConserveQNs=",false}); //make a chain of N spin 1's
auto psi = MPS(sites);
for(int n = 1; n <= N-1; n += 2)
{
auto s1 = sites(n);
auto s2 = sites(n+1);
auto wf = ITensor(s1,s2);
wf.set(s1(1),s2(1), 1.0/sqrt(3.0));
wf.set(s1(2),s2(2), -1.0/sqrt(3.0));
wf.set(s1(3),s2(3), 1.0/sqrt(3.0));
ITensor D;
psi.ref(n) = ITensor(s1);
psi.ref(n+1) = ITensor(s2);
svd(wf,psi.ref(n),D,psi.ref(n+1));
psi.ref(n) *= D;
}
Print(psi);
return 0;
}
I test the code, which might be what you want!