Hi Javad,
Thanks for the question. This is a case we had thought about quite a bit, so we have a way to do it in both the C++ and Julia versions of ITensor. I'll give an answer for both.
---- Julia ITensor ----
Starting from a usual DMRG code such as the one in this example:
https://itensor.github.io/ITensors.jl/stable/examples/DMRG.html
right after making the siteinds
array (which is just a Julia array of indices), modify the first and last indices to be S=1/2 indices, like this
N = 100
sites = siteinds("S=1",N)
sites[1] = siteind("S=1/2")
sites[N] = siteind("S=1/2")
---- C++ ITensor ----
Starting from the usual DMRG code for a S=1 chain, such as the sample code here:
https://github.com/ITensor/ITensor/blob/v3/sample/dmrg.cc
change the line auto sites = SpinOne(N);
to include an extra named argument asking for the edge spins to be spin-half, like this:
auto sites = SpinOne(N,{"SHalfEdge=",true});