+1 vote
asked by (280 points)

Dear ITensor team,
Thanks for you reply. I want to follow spin-1 Heisenberg chain(see S.R.White PhysRevB.48.10345 Fig.7(b)) by using ITensor, but I just want to calculate Sz=1 sector physical quantity(such as magnetization). I don't know where I can modified. I have two naive idea to do so:
1) Just keep initial state Sz=1 and they not change under evolving process.
2) auto sites = SpinOne(N,{"ConserveQNs=1",true});?(I don't know it is work?)

Please help me! For convenience, this is my naive code for reference:

int main()
{
ofstream outfile;
outfile.open("sz.dat",ios::app);

//Define a site set object "sites" which lets us
//easily obtain Site indices defining our Hilbert space
//and S=1 single-site operators

int N = 60; //number of sites
auto sites = SpinOne(N,{"ConserveQNs=",true});

//Make initial MPS psi to be in the Neel state
auto state = InitState(sites);
auto ampo = AutoMPO(sites);
for(auto j : range1(N))
{
state.set(j,j%2==1?"Up":"Dn");
}
auto psi = MPS(state);

for(int b = 1; b < N; ++b)
{
ampo += 0.5,"S+",b,"S-",b+1;
ampo += 0.5,"S-",b,"S+",b+1;
ampo += "Sz",b,"Sz",b+1;
}

auto H = MPO(ampo);

auto sweeps = Sweeps(30);
sweeps.maxm() = 100,200,800,800,1000;
sweeps.cutoff() = 1E-10;
sweeps.niter() = 2;
sweeps.noise() = 1E-7,1E-8,1E-9;
println(sweeps);

//
// Begin the DMRG calculation
//
auto energy = dmrg(psi,H,sweeps,"Quiet");
println(energy);
auto psi0=psi;

for(int i = 1; i <= N; ++i)
{
auto Sz=op(sites,"Sz",i);
auto newpsi = Sz*psi(i);
newpsi.noPrime();
psi.set(i,newpsi);

outfile <<i<<" "<<real(innerC(psi0,psi))<< endl;
}

outfile.close();
return 0;
}

1 Answer

0 votes
answered by (46.8k points)

Hi, thanks for the question. It's giving me some good ideas of how we can improve the documentation on the website.

To compute the ground state in the Sz=1 sector and measure its magnetization, you'll need to do the following three things:

  1. initialize your site set with the {"ConserveQNs=",true} option. (Note that you had a mistake in the code you put, with an extra "1" that shouldn't be there.) What this does is to make the Index objects in the 'sites' array carry QN information.

  2. initialize your MPS to be a product state with a total Sz of 1. You can use the "InitState" feature of ITensor to do this. If you look at the sample code sample/dmrg.cc it shows a use of this feature, and you can change the rule of how "Up" and "Dn" are set to make the Sz be 1. (Note that this means the total QN is QN("Sz",2) actually, since we measure spin in units of 1/2.) You can call totalQN(psi) on an MPS psi to see what its total QN is.

  3. after computing the ground state using DMRG, check that the totalQN is still QN("Sz",2).

  4. measure the magnetization using code similar to on the front page of the itensor.org website. Here I copy that code below:

for(int j = 1; j <= N; ++j)
{
//Make site j the MPS "orthogonality center"
psi.position(j);
//Measure magnetization
Real Szj = elt(psi(j)
* op(sites,"Sz",j)
* dag(prime(psi(j),"Site")));
println("Sz_",j," = ",Szj);
}

Best,
Miles

Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.

Categories

...