I am trying to reproduce the code snippet listed in the C++ Forum: http://itensor.org/support/3295/how-to-construct-bose-hubbard-model?show=3295#q3295
Basically the author is trying to implement the following Bose-Hubbard model:
H = \sum_{j=1}^{L}[-\mu\hat{n}_{j}+\frac{U}{2}\hat{n}_{j}(\hat{n}_j - 1)-J(\hat{a}_{j}\hat{a}_{j+1}^{\dagger}+h.c.)+V\hat{n}_{j}\hat{n}_{j+1}]
In the original author’s code, the author initialized the sites and initial state in the following form
auto sites = Boson(L, {"MaxOcc=", 1, "ConserveQNs", true, "ConserveNb", false});
auto state = InitState(sites);
for (int i : range1(L))
{
if (i % 2 == 1)
state.set(i, "1");
else
state.set(i, "1");
}
auto psi = randomMPS(state);
I assume that to translate the code into Julia ITensor, it will be in the form
sites = siteinds("Boson",N;conserve_number=true,dim=1);
init = ["1" for i in 1:N]
psi0= randomMPS(sites,init);
But running like this it shows an error,
BoundsError: attempt to access 1-element Vector{Float64} at index [2]
So I am wondering what is meaning of dim
in siteinds
? Does it just equivalent to MaxOcc=
in Boson case??