ITensor Support Q&A - Recent questions
http://itensor.org/support/questions
Powered by Question2AnswerIssues with speed when linking ITensor through CMake
http://itensor.org/support/786/issues-with-speed-when-linking-itensor-through-cmake
<p>Hello,</p>
<p>I am performing time evolution through fitApplyMPO, however, the process is very slow compared to the DMRG algorithm.<br>
In an attempt to speed up the calculation, I have tried adding compile flags -march=native and -O2 when compiling my own program through CMake, but doing this actually slows down the whole program. The README mentions linking the options.mk file, but I don't know how to achieve this in CMake.<br>
Which flags/setting should I use in my CMakeList in order for my program to utilize ITensor to its fullest?</p>
<p>Note, I have compiled ITensor with Intel MKL.</p>
<p>Thank you!</p>
http://itensor.org/support/786/issues-with-speed-when-linking-itensor-through-cmakeTue, 16 Jan 2018 12:44:37 +0000Apply MPO to an IDMRG wave function
http://itensor.org/support/784/apply-mpo-to-an-idmrg-wave-function
<p>Hi Miles,</p>
<p>I tried to apply an MPO to a wave function obtained by IDMRG . Are the existing fitApplyMPO and ExactApplyMPO adaptable for that? Or does one need to consider the technicality of psi.A(0)* psi.A(1)? The latter case seems to lead to 'std::bad_alloc'. Many thanks,</p>
<p>Sam </p>
http://itensor.org/support/784/apply-mpo-to-an-idmrg-wave-functionWed, 10 Jan 2018 18:35:17 +0000How to deal with bose-fermion mixture with fermion is spinfull (up and down)
http://itensor.org/support/782/how-deal-with-bose-fermion-mixture-with-fermion-spinfull-down
<p>Hello,mlils<br>
I am curious about 1D bose-fermion mixture with fermion is spinfull (up and down) . I set QN like this.<br>
if the site is fermion:<br>
s=IQIndex(nameint("site=",n),<br>
Index(nameint("Emp",n),1,Site), QN({0,1}, {0,-1},{0,1}), // vaccum<br>
Index(nameint("Up",n),1,Site), QN({1,1},{+1,-1},{0,1}), // Up fermion<br>
Index(nameint("Dn",n),1,Site), QN({-1,1},{+1,-1},{0,1}), // Dn fermion<br>
Index(nameint("UpDn",n),1,Site), QN({0,1}, {2,-1},{0,1})); // UpDn fermion<br>
if the site is ths bosons:<br>
s=IQIndex(nameint("site=",n),<br>
Index(nameint("Emp",n),1,Site),QN({0,1},{0,1},{0,1}),<br>
Index(nameint("b1",n),1,Site), QN({0,1},{0,1},{1,1}),<br>
Index(nameint("b2",n),1,Site), QN({0,1},{0,1},{2,1}),<br>
Index(nameint("b3",n),1,Site), QN({0,1},{0,1},{3,1}));<br>
Unfortuntanately, the program can be compiled, but can't work (IQIdex does not given QN block). <br>
The first slot of QN mean "Sz", the second denotes fermion, the third is the boson.<br>
can I do like this?</p>
http://itensor.org/support/782/how-deal-with-bose-fermion-mixture-with-fermion-spinfull-downFri, 05 Jan 2018 10:52:13 +0000slow down when sweep from right to left site
http://itensor.org/support/781/slow-down-when-sweep-from-right-to-left-site
<p>I use dmrg function and set "Quite" to false to see the detail output. And I find that sweep from left to right is quickl while the opposite direction is much slower. Here I use a self-defined site set file for spin-1 Bose Hubbard model with total number and total magnetic moment conserved. Is there any reason for this result ? Or may be I should post my code later.</p>
http://itensor.org/support/781/slow-down-when-sweep-from-right-to-left-siteTue, 26 Dec 2017 13:18:31 +0000read error : Wrong number of IndexVals passed to real/cplx
http://itensor.org/support/777/read-error-wrong-number-of-indexvals-passed-to-real-cplx
<p>I save the wave function given by dmrg using "writeToFile("output/psi<em>test", psi)". And then I try to read it by using "readFromFile" and calculate correlation function, the error comes out. The code that reads psi</em>test from file is</p>
<pre><code>// this file tests spinless Bose-Hubbard model
#include "itensor/all.h"
#include <typeinfo>
#include <iostream>
#include <fstream>
#include <vector>
#include <stdlib.h>
#include <cmath>
#include <cstring>
#include <sstream>
using namespace itensor;
using namespace std;
int main()
{
auto N = 40;
auto sites = BH(N);
auto psi = readFromFile<IQMPS>("psi_test");
auto pos_i = int(N/4);
auto pos_f = 3*int(N/4);
auto AL = sites.op("Nb", pos_i);
auto AR = sites.op("Nb", pos_f);
psi.position(pos_i);
auto C = psi.A(pos_i);
C *= AL;
auto iR = commonIndex(psi.A(pos_i), psi.A(pos_i+1), Link);
C *= dag(prime(prime(psi.A(pos_i), Site), iR));
for (int i = pos_i+1; i < pos_f; i++){
C *= psi.A(i);
C *= dag(prime(psi.A(i), Link));
}
C *= psi.A(pos_f);
C *= AR;
auto iL = commonIndex(psi.A(pos_f-1), psi.A(pos_f), Link);
C *= dag(prime(prime(psi.A(pos_f), Site), iL));
cout << C.real() << endl;
}
</code></pre>
<p>In fact, there is no error if I do not use "C.real()" and this i should be the origin of the problem. I also try to calculated the same correlation function just after the "dmrg" immediately, that is, I do not save the "psi" and read it later. No problem appears.</p>
http://itensor.org/support/777/read-error-wrong-number-of-indexvals-passed-to-real-cplxTue, 19 Dec 2017 09:13:04 +0000Can we define a QN objects using non-conserving quantum number ?
http://itensor.org/support/770/can-we-define-qn-objects-using-non-conserving-quantum-number
<p>consider a simple interaction Hamiltonian of spin-1 boson. Each boson has 3 spin states : @@m<em>F=1,0,-1@@. We now use @@a</em>{m<em>F}@@ (@@a</em>{m<em>F}^{\dagger}@@) as the annihilation (creation) operator for different @@m</em>F@@ states.</p>
<p>@@H=a<em>1^{\dagger}a</em>{-1}^{\dagger}a<em>0a</em>0+h.c.@@</p>
<p>Obviously, this Hamiltonian does not conserve @@a<em>{m</em>F}^{\dagger}a<em>{m</em>F}@@ separately, but instead it conserves total @@S<em>z=a</em>1^{\dagger}a<em>1-a</em>{-1}^{\dagger}a_{-1}@@. </p>
<p>Now I have a problem. When I define a site set file for spin-1 Bose-Hubbard model, I need to define a IQIndex object with (Index, QN) pair. Can I use @@a<em>{mF}^{\dagger}a</em>{mF}@@ as a quantum number for QN objects ? That is, I may define them to be</p>
<pre><code> Index(nameint("state name",n),1,Site),QN({Np1,1},{Nz0,1},{Nm1,1}));
</code></pre>
<p>where Np1=@@a<em>{1}^{\dagger}a</em>1@@, Nz0=@@=a<em>0^{\dagger}a</em>0@@ and Nm1=@@a<em>{-1}^{\dagger}a</em>{-1}@@.</p>
<p>Thank you.</p>
http://itensor.org/support/770/can-we-define-qn-objects-using-non-conserving-quantum-numberSun, 17 Dec 2017 08:41:02 +0000different results for Hamiltonian written in different form
http://itensor.org/support/762/different-results-for-hamiltonian-written-different-form
<p>Here I have a Bose-Hubbard model (with self-defined siteset file) and the density-density interaction can be written in two identical forms as follows</p>
<pre><code>ampo += U, "Nb", i, "Nb", i;
ampo += -U, "Nb", i;
</code></pre>
<p>and</p>
<pre><code>ampo += U, "Adagb", i, "Adagb", i, "Ab", i, "Ab", i;
</code></pre>
<p>this two forms of "ampo" should be the same because @@N_b=A^{\dagger}A@@. However, the final results of dmrg is quite different for this two forms. In fact, the first form gives the correct answer while the second one does not and it just converge very slowly.</p>
<p>Here I presents the siteset file for Bose Hubbard model</p>
<pre><code>#ifndef __ITENSOR_BH_H
#define __ITENSOR_BH_H
#include "itensor/mps/siteset.h"
#include <cmath>
namespace itensor
{
class BoseHubbard;
using BH=BasicSiteSet<BoseHubbard>;
auto Sqrt3=1.7320508075688772;
class BoseHubbard
{
IQIndex s;
public:
BoseHubbard() {}
BoseHubbard(IQIndex I): s(I) {}
BoseHubbard(int n, Args const& args=Args::global())
{
// spinless boson (3 boson/site at most)
s=IQIndex(nameint("site=",n),
Index(nameint("Emp",n),1,Site),QN({0,1}),
Index(nameint("b1",n),1,Site),QN({1,1}),
Index(nameint("b2",n),1,Site),QN({2,1}),
Index(nameint("b3",n),1,Site),QN({3,1}));
}
IQIndex index() const {return s;}
IQIndexVal state(std::string const& state)
{
if (state=="Emp")
{
return s(1);
}
else if (state=="b1")
{
return s(2);
}
else if (state=="b2")
{
return s(3);
}
else if (state=="b3")
{
return s(4);
}
}
IQTensor op(std::string const& opname, Args const& args) const
{
auto sP=prime(s);
IQIndexVal
Em(s(1)),EmP(sP(1)),
b1(s(2)),b1P(sP(2)),
b2(s(3)),b2P(sP(3)),
b3(s(4)),b3P(sP(4));
IQTensor Op(dag(s),sP);
// boson single-site operator
if (opname=="Nb")
{
Op.set(b1,b1P,1);
Op.set(b2,b2P,2);
Op.set(b3,b3P,3);
}
else if (opname=="Ab")
{
Op.set(Em,b1P,1);
Op.set(b1,b2P,std::sqrt(2.));
Op.set(b2,b3P,std::sqrt(3.));
}
else if (opname=="Adagb")
{
Op.set(b1,EmP,1);
Op.set(b2,b1P,std::sqrt(2.));
Op.set(b3,b2P,std::sqrt(3.));
}
else if (opname=="Id")
{
Op.set(Em,EmP,1);
Op.set(b1,b1P,1);
Op.set(b2,b2P,1);
Op.set(b3,b3P,1);
}
else
{
Error("Operator " + opname + " name not recognized !");
}
return Op;
}
};
}
#endif
</code></pre>
<p>Here I restricts that at most 3 bosons can lie in the same site. The main file is prsented as follows</p>
<pre><code>// this file tests spinless Bose-Hubbard model
#include "itensor/all.h"
#include <typeinfo>
#include <iostream>
#include <fstream>
#include <vector>
#include <stdlib.h>
#include <cmath>
using namespace itensor;
using namespace std;
int main()
{
auto N = 20;
auto J = 1.0;
auto U = 0.5;
auto V = 1.0;
auto sites = BH(N);
auto ampo = AutoMPO(sites);
// site index must start from 1
for (int i = 1; i < N; i++) {
// hopping term
ampo += -J, "Adagb", i, "Ab", i+1;
ampo += -J, "Adagb", i+1, "Ab", i;
// onsite interaction
// ampo += U/2.0, "Nb", i, "Nb", i;
// ampo += -U/2.0, "Nb", i;
ampo += U/2.0, "Adagb", i, "Ab", i, "Adagb", i, "Ab", i;
ampo += -U/2.0, "Adagb", i, "Ab", i;
// NN interaction
// ampo += V, "Nb", i, "Nb", i+1;
ampo += V, "Adagb", i, "Ab", i, "Adagb", i+1, "Ab", i+1;
}
// ampo += U/2.0, "Nb", N, "Nb", N;
// ampo += -U/2.0, "Nb", N;
ampo += U/2.0, "Adagb", N, "Ab", N, "Adagb", N, "Ab", N;
ampo += -U/2.0, "Adagb", N, "Ab", N;
auto Hamil = IQMPO(ampo);
auto state = InitState(sites);
for (int i = 1; i <= N; i++)
{
if (i%2 == 0){
state.set(i, "b2");
}
else {
state.set(i, "Emp");
}
}
auto psi=IQMPS(state);
// DMRG parameter
auto sweeps = Sweeps(10);
sweeps.maxm() = 160;
sweeps.cutoff() = 1E-12;
// perform DMRG algorithm
auto energy=dmrg(psi,Hamil,sweeps,{"Quiet",true});
println("Ground state energy = ",energy);
}
</code></pre>
http://itensor.org/support/762/different-results-for-hamiltonian-written-different-formFri, 15 Dec 2017 09:26:40 +0000How to Determine the Convergence
http://itensor.org/support/761/how-to-determine-the-convergence
<p>Hi Miles,</p>
<p>I have got some problem with the convergence recently. I was doing Iqdmrg calculations with Kondo model. My ground state energy kept decreasing linearly (-0.03) after 8 sweeps to 30 and more, and the observables calculated were not as I expected . I believed there were two reasons. Maybe my initial state was not mixed (good?) enough for it to keep from stucking at the "local minimum" excited state, or it was not converged yet. I have tried using different initial states and putting a noise term, it did improve a little bit, so my question was,</p>
<p>How do I determine if it is converged? Besides the energy, I think it would be helpful if I could calculate correlation function or electron density at every step to see if those quantities are converged. I know how to calculate them with a given psi, but how do I calculate them at every step? I found a argument called "Debuglevel" and "Quiet = false" for information between sweeps, will that be useful for determining the convergence?</p>
<p>Also, In traditional DMRG algorithm there is a truncation error determined by the sum of the abandoned eigenvalues of the density matrix at each step, and that is what we use to determine the convergence. Is there a similar quantity in Itensor to do the same job?</p>
<p>There is another small question about creating the sweeping table. If I wanted 70 sweeps with Maxm=100, and then 10 sweeps with Maxm=500, is there any way simpler other than copying Maxm=100 seventy times? I know if I wanted the remaining sweeps parameter to be the same I would just leave it unfilled.</p>
<p>Thank you very much.</p>
<p>Best,<br>
Yixuan</p>
http://itensor.org/support/761/how-to-determine-the-convergenceThu, 14 Dec 2017 17:15:04 +0000Swap gates for non-identical sites
http://itensor.org/support/760/swap-gates-for-non-identical-sites
<p>Hello,</p>
<p>I want to consider a mixture of 2 bosonic type of sites (with different local dimensions, for example one site with hard core bosons and one site with soft core bosons with a certain cutoff) and perform a swap operation on the 2 sites. I am asking in the context of performing Trotter time evolution with swap gates and I would have to swap the soft core site through a hard core chain.</p>
<p>Can the Swap Gate implemented in 'bondgate.h' be used in this situation with non identical sites with different local dimensions? And can this still be used with IQTensors, if, for example, I want to conserve the total number of hard-core bosons?</p>
<p>Thank you very much! <br>
Catalin</p>
http://itensor.org/support/760/swap-gates-for-non-identical-sitesWed, 13 Dec 2017 20:53:37 +0000Writing Wavefunction and Hamiltonian to Disk in Parallel DMRG
http://itensor.org/support/759/writing-wavefunction-and-hamiltonian-to-disk-parallel-dmrg
<p>Hi Miles,</p>
<p>Thank you for your persistent effort to address our problems.</p>
<p>I can write Mps or Hamiltonian into disk in dmrg. However, I encountered problems when I want to do so in parallel dmrg program.</p>
<ol>
<li><p>In dmrg, I insert writeToFile() in DMRG_Worker in order to output wavefunction after each sweep. However, this approach no longer work in parallel dmrg. If I still do so, each cores only write the block of wavefunction sent to it, while the last core finishing the sweep will overwrite wavefunction stored before. Therefore, I cannot store a complete wavefunction for further measurement. So my Question is: is there any way to output the whole wavefunction collected from all cores at a time? And it would be the best if there is a way to output complete wavefuntion after each sweep.</p></li>
<li><p>Besides, I also need to write Hamiltonian into disk to save memory. I tried to set WriteM in the arguments as I did in dmrg program, but the program stopped in the second sweep. I found the names of Hamiltonians written in the last sweep do not match the ones to be read in the next sweep. For example, in the output message I found :</p>
<blockquote>
<p>Tried to read file ./PH<em>0pBYHg/PH</em>002<br>
Missing file</p>
</blockquote>
<p>Similar for other PH's.<br>
I checked the directory PH<em>0pBYHg/, the file name of PH inside is "PH</em>003" . It seems that all the number given to PH when writing is 1 greater than the number in the name of the PH to be read.</p>
<p>Is it a bug or there should be other ways to write Hamiltonian?</p></li>
</ol>
<p>Thank you in advance.</p>
<p>Zhiyu</p>
http://itensor.org/support/759/writing-wavefunction-and-hamiltonian-to-disk-parallel-dmrgSat, 02 Dec 2017 10:17:02 +0000Anomalous Cluster Runtime Effect
http://itensor.org/support/751/anomalous-cluster-runtime-effect
<p>Hi,</p>
<p>I have tried running codes with Itensor on my personal computer as well as the cluster of my school and compared the results. It turned out that the CPU time needed on every sweep was much more (usually 5-8 times) on the cluster than on my computer, which was really unsettling. I have tested several times with only one variable changed, </p>
<p>If I run the codes that didn't involve Itensor, the CPU time needed on the cluster was less (3 times) than that on my computer, which sounded normal because the cluster did have a better performance. </p>
<p>The Itensor package was built on the same platform Lapack, with the same compiler GCC 6.4.0 and the same flags. </p>
<p>I have tested 2 different codes on the cluster and my computer. One was the sample code called "dmrg.cc" and the other was a 2D model that I wrote with a custom siteset and iqdmrg. The results are the same. (5-8 times slower on the cluster)</p>
<p>I kept the same parameters when I run the codes. The calculated observables (ground state energy, magnetization) were identical to 10 decimals, so I believed there were no extra hidden procedure when running on the cluster.</p>
<p>I have tried switching to mpirun and it didn't make any difference. I did realized that the executive file created on the cluster was smaller than that on my computer. I thought it was because I was using windows system while the cluster was a linux.</p>
<p>Does anyone else have this kind of problem before? </p>
<p>Best,<br>
Yixuan</p>
http://itensor.org/support/751/anomalous-cluster-runtime-effectFri, 01 Dec 2017 04:05:10 +0000How to do a single impurity problem with Itensor.
http://itensor.org/support/747/how-to-do-a-single-impurity-problem-with-itensor
<p>Hello,<br>
I want to calculate a Hamiltonian that has an tight-binding term and a simple one magnet impurity local on one site. Therefore, the second term must be the interaction<br>
between the impurity and the particles which has occupied on this site. So, the form is S*s.<br>
"S" indicates the impurity spin and the "s" is the particle spin. Then,I follow the sample code and set sites=Hubbard(N), and I delete the U term in the "ampo" space and this is the first term. However, I don't know how to set the second term since the impurity spin is not belong to the "sites", actually<br>
, I also don't know how do the particle spin term in this Hubbard sites with Itensor. So, Could anyone give me some helps? <br>
Thank you very much! </p>
http://itensor.org/support/747/how-to-do-a-single-impurity-problem-with-itensorWed, 29 Nov 2017 16:56:23 +0000Passing ITensor to a function in C++
http://itensor.org/support/740/passing-itensor-to-a-function-in-c
<p>Hello, </p>
<p>I had problems passing Sensor structure from main to a function to carry out operations inside the function and return it. It behaves as the indexing are changing inside the function which makes erroneous to perform other operations like contractions inside the main function.</p>
<p>I would be glad if you have any guidance on this problem.</p>
<p>Best</p>
http://itensor.org/support/740/passing-itensor-to-a-function-in-cTue, 28 Nov 2017 19:59:11 +0000Output the data into a file and view the data
http://itensor.org/support/736/output-the-data-into-a-file-and-view-the-data
<p>Hello Everyone, <br>
I tried to output the data into a file and learned the writeToFile, <br>
but I do not how to show them. <br>
For example</p>
<h2>include "itensor/all.h"</h2>
<p>using namespace itensor;</p>
<p>int<br>
main()<br>
{<br>
int N = 100; //number of sites<br>
SpinHalf sites(N); //SpinHalf is a subclass of SiteSet<br>
MPS psi(sites);<br>
writeToFile("sites<em>file",sites);<br>
writeToFile("psi</em>file",psi);<br>
}</p>
<p>When vi psi_file in the folder, I get :</p>
<p>^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ø^?^A^@^@^@^@^@^@^@^B^@^@^@^@^@^@^@^@^@^@^@Site^@^@^@H4<9c>ó^B^@^@^@S=1/2 </p>
<p>I would like to list my own data in three columns : i , j , result <br>
Thanks for any help <br>
Wz</p>
http://itensor.org/support/736/output-the-data-into-a-file-and-view-the-dataWed, 22 Nov 2017 02:37:54 +0000About psi.position(n) of MPS
http://itensor.org/support/729/about-psi-position-n-of-mps
<p>Hi,</p>
<p>I was wondering that when we call psi.position(n) to put orthogonal center at n site, it should include some SVD. But SVD should be assigned with "Cutoff" and "Maxm". Why we don't consider that in psi.position(n)? <br>
Thanks.</p>
<p>Victor.</p>
http://itensor.org/support/729/about-psi-position-n-of-mpsSat, 11 Nov 2017 19:06:19 +0000Fermionic correlation function and jordan-wigner string
http://itensor.org/support/716/fermionic-correlation-function-and-jordan-wigner-string
<p>Hi,</p>
<p>I am manually writing a correlation function for Fermions (that is, not using AutoMPO).</p>
<p>In order to include the Jordan-Wigner string, will I need to use bosonic operators (i.e. A and A^dag) instead of fermionic operators (C and C^dag), along with Jordan-wigner string operators, F?</p>
<p>Or, do I write the correlation function in terms of C operators along with F operators? That is, since the MPS that this correlation function acts on is for spinful fermions, I must use C operators, and then also need F operators because they don't automatically include the F operators?</p>
<p>Sorry if this has been covered before, but this is a point of significant confusion for me.</p>
<p>Jon</p>
http://itensor.org/support/716/fermionic-correlation-function-and-jordan-wigner-stringWed, 08 Nov 2017 22:17:58 +0000Getting "IQIndex does not contain given QN block" when the AutoMPO clearly conserves spin and charge
http://itensor.org/support/714/getting-iqindex-contain-autompo-clearly-conserves-charge
<p>Hi Miles,</p>
<p>I'm using AutoMPO to create IQMPOs, and I get the following message when I run my code:</p>
<blockquote>
<p>I = IQIndex("Hl2",2,Link|60) <br>
("hl2_0",2,Link|286) QN()</p>
<p>qn = (Sz=-2,Nf=-2)<br>
From line 536, file iqindex.cc</p>
<p>IQIndex does not contain given QN block.</p>
<p>IQIndex does not contain given QN block.<br>
Aborted</p>
</blockquote>
<p>Here's a minimal example of my code:</p>
<pre><code>#include "itensor/all.h"
using namespace std;
using namespace itensor;
int main(int argc, char* argv[])
{
int N=2;
int i=1;
auto sites = Hubbard(N);
auto ampo=AutoMPO(sites);
ampo+=.25,"Cdagup",i ,"Cup",i+1,"Cdagup",i ,"Cup",i+1;
IQMPO N1 = IQMPO(ampo);
return 0;
}
</code></pre>
<p>I realize this is a stupid MPO to try to define, since it is obviously zero. But terms like these occur when I am looping over a lot of terms I want to add to my AutoMPO, and whenever they occur I get the same error. I could try to separate terms like this out, but it's bit painful. Is it possible there's some bug that's leading to this error, or does AutoMPO just break when trying to handle terms that are identically zero?</p>
http://itensor.org/support/714/getting-iqindex-contain-autompo-clearly-conserves-chargeWed, 01 Nov 2017 00:47:29 +0000zipUpApplyMPO vs fitApplyMPO
http://itensor.org/support/705/zipupapplympo-vs-fitapplympo
<p>Looking at your source code, I found a method called zipUpApplyMPO. This method isn't described in your documentation, but I tried it out, and it seemed to yield the same results as fitApplyMPO, only (in my case) faster. Is there a reason zipUpApplyMPO is missing from documentation, and how does it compare to fitApplyMPO?</p>
http://itensor.org/support/705/zipupapplympo-vs-fitapplympoMon, 30 Oct 2017 14:42:06 +0000Using AutoMPO with toExpH
http://itensor.org/support/704/using-autompo-with-toexph
<p>We have recently tried to do time evolution in the Bose Hubbard model as detailed in <a rel="nofollow" href="http://itensor.org/support/322/time-evolution-in-bose-hubbard?show=322#q322.">http://itensor.org/support/322/time-evolution-in-bose-hubbard?show=322#q322.</a></p>
<p>We wanted to do time evolution on a five particle superfluid ground state with a Mott Hamiltonian and see the revival of the condensate fraction.<br>
However, we encountered an issue performing time evolution with toExpH. <br>
At first we tried,</p>
<pre><code>auto ampo2ops = AutoMPO(sites);
for (int i = 1; i <= N; ++i) {
ampo2ops += U/2.0,"N",i,"N-1", i;
}
auto expH = toExpH<IQTensor>(ampo2ops,tau*Cplx_i);
</code></pre>
<p>And defined the operators "N" and "N-1" accordingly. This did not work. The code runs, but we reach the Mott ground state and get stuck there. On the other hand, </p>
<pre><code>for (int i = 1; i <= N; ++i) {
ampo1op += U/2.0,"N(N-1)",i;
}
auto expH = toExpH<IQTensor>(ampo1op,tau*Cplx_i);
</code></pre>
<p>with "N(N-1)" as just one single operator, works just fine. In addition, </p>
<pre><code>for (int i = 1; i <= N; ++i) {
ampo2opagain += U/2.0,"N",i"N",i;
ampo2opagain += -U/2.0, "N",i;
}
auto expH = toExpH<IQTensor>(ampo2opagain,tau*Cplx_i);
</code></pre>
<p>didn't work either.</p>
<p>This leads us to believe that toExpH doesn't work for two-operator autompos. Is this a bug? Do you have any workaround for this?</p>
http://itensor.org/support/704/using-autompo-with-toexphMon, 30 Oct 2017 14:26:46 +0000Simple exact diagonalization in ITensor
http://itensor.org/support/695/simple-exact-diagonalization-in-itensor
<p>I want to implement some simple exact diagonalization, for a challenging/new system, to benchmark DMRG for larger systems.</p>
<p>Is this simple to do? I need to keep the wavefunctions in MPS format after ED.</p>
<p>Thanks!</p>
<p>Jon</p>
http://itensor.org/support/695/simple-exact-diagonalization-in-itensorThu, 19 Oct 2017 17:54:21 +0000toExpH for 3spin operator
http://itensor.org/support/694/toexph-for-3spin-operator
<p>Hi Miles,</p>
<p>I follow the instruction in following post and implement the autompo for 3spin operator successfully. Thanks a lot.<br>
<a rel="nofollow" href="http://itensor.org/support/173/build-more-than-two-operator-terms-using-autompo">http://itensor.org/support/173/build-more-than-two-operator-terms-using-autompo</a></p>
<p>However, when I try to feed the mpo with 3 spin to auto expH = toExpH(ampo,tau*Cplx_i); It returns error. Is it because the implementation of toExpH for 3spin interaction is not yet complete? Are there simple workaround to get similar effect as toExpH for the 3spin MPO?</p>
<p>Thanks a lot.</p>
http://itensor.org/support/694/toexph-for-3spin-operatorWed, 18 Oct 2017 15:01:02 +0000Using IQMPOs with a custom SiteSet
http://itensor.org/support/692/using-iqmpos-with-a-custom-siteset
<p>I've defined a custom SiteSet that is a mixture of SpinHalfSite and HubbardSite, and now I want to define a Hamiltonian on these sites using AutoMPO. This works just fine when I convert AutoMPO to an MPO. However, when I convert AutoMPO to an IQMPO, and try to apply it to an IQMPS, I get a segmentation fault.</p>
<p>I've defined my custom SiteSet in siteset.h as</p>
<pre><code>template<typename SiteType1,typename SiteType2>
class BasicSiteSet2 : public SiteSet
{
public:
BasicSiteSet2() { }
BasicSiteSet2(int N,
Args const& args = Args::global()){
assert (N%2==0);
auto sites = SiteStore(N);
for(int j = 1; j <= N; ++j){
if (j%2==1){
sites.set(j,SiteType1(j,args));
}
else{
sites.set(j,SiteType2(j,args));
}
}
SiteSet::init(std::move(sites));
}
BasicSiteSet2(std::vector<IQIndex> const& inds)
{
int N = inds.size();
auto sites = SiteStore(N);
for(int j = 1, i = 0; j <= N; ++j, ++i)
{
auto& Ii = inds.at(i);
if (j%2==1){
sites.set(j,SiteType1(Ii));
}
else{
sites.set(j,SiteType2(Ii));
}
}
SiteSet::init(std::move(sites));
}
void
read(std::istream& s)
{
SiteSet::readType2<SiteType1,SiteType2>(s);
}
};
</code></pre>
<p>Then my code is:</p>
<pre><code>auto sites = BasicSiteSet2<HubbardSite,SpinHalfSite>(2)
auto ampo=AutoMPO(sites);
ampo += 1,"Sz",1,"Sz",2;
auto H = IQMPO(ampo);
auto state = InitState(sites,"Up");
auto psi = IQMPS(state);
auto psi1 = exactApplyMPO(H,psi);
</code></pre>
<p>My Hamiltonian conserves spin and overall fermion number. Is there some adjustment to the quantum numbers I need to make in order to have this work? If so, what?</p>
<p>Thank you for your help!</p>
http://itensor.org/support/692/using-iqmpos-with-a-custom-sitesetFri, 13 Oct 2017 19:25:50 +0000Periodicity of domain walls for ferromagnetic ground state?
http://itensor.org/support/686/periodicity-of-domain-walls-for-ferromagnetic-ground-state
<p>Dear forum,<br>
I am working with a 1D chain of 100 spin 1/2 particles at "half-filling". The model Hamiltonian contains (a) NN interactions and hopping that can be different between odd and even connections, and (b) NNN hopping and interaction. The only symmetry in this model is Ising symmetry: \sum_j < S^z _j > = 0. I am looking into a regime that is deeply ferromagnetic (FM) for all NN and NNN pairs, therefore, analytically one should expect 50 spins up, a domain wall, and 50 spins down, or the other way around (i.e., doubly degenerate ground state). However, DMRG gives a FM phase with several periodically distributed domain walls even though there is nothing in the Hamiltonian that would induce this periodicity. I am just wondering if DMRG is known to introduce such a periodicity through the way sweeping is done. Please let me know.</p>
<p>Thanks,<br>
Niraj</p>
http://itensor.org/support/686/periodicity-of-domain-walls-for-ferromagnetic-ground-stateWed, 11 Oct 2017 14:29:24 +0000Default constructor for MPS
http://itensor.org/support/683/default-constructor-for-mps
<p>Hi,</p>
<p>Is there a way to update the MPS constructor so that the initial state has some default values? This would be a nice feature.</p>
<p>Thanks</p>
<p>Jon</p>
http://itensor.org/support/683/default-constructor-for-mpsMon, 09 Oct 2017 21:11:10 +0000How to calculate dynamical spin structure factor S(k,w) of a spin chain?
http://itensor.org/support/681/how-to-calculate-dynamical-spin-structure-factor-spin-chain
<p>I am trying to calculate a dynamical spin structure factor S(k, w) of a spin chain (e.g., 1d Heisenberg Model, in order to check if I can see the spin wave dispersion). </p>
<p>An implementation that I am thinking of is;</p>
<p>(Step 1) get the groundstate |psi_0> by DMRG for a given Hamiltonian (I can already do this easily)</p>
<p>(Step 2) calculate the time-dependent correlation function,<br>
C^a(r,t)=, <br>
where the superscript a={x, y, z} is a spin component, and the subscript r is a site index, and t is time. </p>
<p>Simplifying the above expression by using the interaction picture, <br>
C^a(r, t)=<psi<em>0| S^z</em>r(0) exp(-i(H-E<em>0)t) S^z</em>0(0) |psi<em>0> , <br>
where E</em>0 is the groundstate energy, which I already calculated in step(1)</p>
<p>(Step 3) then Fourier transforming, <br>
C^a(r,t) ---> S^a(k, w) </p>
<p>I want to know an efficient way of doing Step 2. It would be great if you can provide a sample code (for me, looking at a sample working code is the best way to learn).<br>
Also if you have any practical tips (e.g., how to choose the interval of time-evolutions to get the most accurate S(k,w) etc ), please make some comments as well.</p>
<p>Thanks,</p>
<p>Soshi</p>
<p>(The most naive implementation I can think of for Step2 is; <br>
for each r & t, <br>
(Step2.1) define three MPOs, <br>
A=S^z<em>r(0), B=exp(-i(H</em>E<em>0) t), C=S^z</em>0(0)<br>
(Step2.2) calculate the total MPO by multiplying the three MPOs,<br>
X=A<em>B</em>C<br>
(Step2.3) calculate the overlap, <br>
C(r,t)=<psi<em>0|M|psi</em>0><br>
I am not sure if this implementation works, and even if it does, I believe it is computationally super inefficient. ) </p>
http://itensor.org/support/681/how-to-calculate-dynamical-spin-structure-factor-spin-chainSun, 08 Oct 2017 08:57:29 +0000Get error message for using Sx2
http://itensor.org/support/678/get-error-message-for-using-sx2
<p>I'd like to calculate Sx^2 in spin 1 system and the operator "Sx2" is defined in the spinone.h file. For the simplest example below, the compile was successful. But when I run the code, I got error message: "From line 161, file itdata/qdense.cc<br>
Setting IQTensor element non-zero would violate its symmetry.<br>
Setting IQTensor element non-zero would violate its symmetry."</p>
<h2>include "itensor/all.h"</h2>
<p>using namespace itensor;</p>
<p>int main()<br>
{<br>
auto sites = SpinOne(4);<br>
ITensor op = sites.op("Sx2",2);<br>
PrintData(op);<br>
return 0;<br>
}</p>
<p>I tried to modify the "opname" of "Sx2" and the content of "Sx2" in the spinone.h file, but still got the same error message. Unlike the case when I modify the the "opname" or content of "Sz", I got what I modified. </p>
<p>Other operators have the same problem: Sy2, XUp, XZ0, XDn.</p>
http://itensor.org/support/678/get-error-message-for-using-sx2Wed, 04 Oct 2017 22:19:29 +00001D SSH model DMRG code
http://itensor.org/support/676/1d-ssh-model-dmrg-code
<p>HI, </p>
<p>I am new to C language and iTensor.<br>
I want to perform a DMRG calculation on the SSH model with Hamiltonian</p>
<p>$H=-\sum<em>\i (1+\eta) c</em>{A,i}^\dagger c<em>{B,i} +(1-\eta) c</em>{B,i}^\dagger c_{A,i+1} + h.c.$</p>
<p>I considered the A site as odd index site and B site as even index in a 1D chain. This is the code I used</p>
<pre><code>#include "itensor/all.h"
using namespace itensor;
int main()
{
int N = 20;
Real eta = 0.5;
auto sites = Spinless(N);
auto ampo = AutoMPO(sites);
for(int j = 1; j <= N; ++j)
{
if (j%2 == 1)
{
ampo += -(1+eta),"Cdag",j,"C",j+1;
ampo += -(1+eta),"Cdag",j+1,"C",j;
}
else (j%2 ==0)
{
ampo += -(1-eta),"Cdag",j,"C",j+1;
ampo += -(1-eta),"Cdag",j+1,"C",j;
}
}
auto H = MPO(ampo);
auto psi = MPS(sites);
auto sweeps = Sweeps(5);
sweeps.maxm() = 10,20,100,100,200;
sweeps.cutoff() = 1E-10;
sweeps.niter() = 2;
sweeps.noise() = 1E-7,1E-8,0.0;
println(sweeps);
auto energy = dmrg(psi,H,sweeps,"Quiet");
printfln("\nGround State Energy = %.10f",energy);
return 0;
}
</code></pre>
<p>However, the Hamiltonian seems haven't been created properly. The program terminated at a line saying "Using approx/svd conversion of AutoMPO->MPO"... May someone suggests what's wrong in my code? </p>
<p>Thanks in advance.</p>
http://itensor.org/support/676/1d-ssh-model-dmrg-codeWed, 04 Oct 2017 02:23:07 +0000About the tutorial of Fermions and Jordan-Wigner String
http://itensor.org/support/671/about-the-tutorial-of-fermions-and-jordan-wigner-string
<p>Hi,</p>
<p>On the page of <a rel="nofollow" href="http://itensor.org/docs.cgi?page=tutorials/fermions">http://itensor.org/docs.cgi?page=tutorials/fermions</a> <br>
, it shows the anticommutation relation of spinless case can be derived by treating it for i < j. <br>
However, I think the derivation doesn't work for i = j. <br>
Is there anything I missed? <br>
Thank you very much! </p>
<p>Victor.</p>
http://itensor.org/support/671/about-the-tutorial-of-fermions-and-jordan-wigner-stringSat, 30 Sep 2017 18:39:10 +0000accessing maximal tensor element and scalings
http://itensor.org/support/667/accessing-maximal-tensor-element-and-scalings
<p>Hi all,</p>
<p>I am currently implementing a CTM method for iPEPS in ITensor. For this, and similar algorithms, I want to absorb a big bunch of tensors and truncate the result in order to approximate the environment.</p>
<p>For numerical stability, one way to do this is by dividing the updated tensors by its norm or maximal element etc in order to not diverge to infinity or zero. However, for some purpose it might be good to have the tensor not divided by its norm. To stabilize this, I would expect the <code>scaleTo( )</code> method to do the job. Playing around with it naively, however, <br>
<code>tensor.scaleTo(norm(tensor))</code><br>
does only work every now and then. I am not yet sure why that is, but also have not yet got through the whole details behind this method. Moreover, I have the feeling that probably using something like <br>
<code>tensor.scaleTo(maxElm(tensor))</code><br>
should work more accurately. Therefore: is there some method that finds the maximal (in absolute value) element within the tensor data?</p>
<p>Best and thanks a lot!<br>
Alex :)</p>
http://itensor.org/support/667/accessing-maximal-tensor-element-and-scalingsThu, 28 Sep 2017 11:21:29 +0000Make use of storage_ptr&
http://itensor.org/support/666/make-use-of-storage_ptr%26
<p>Is there a way to use the storage pointer of a tensor like a pointer of std::vector? The .store() method get a pointer of "ITData" type and can not be used directly.<br>
Currently, I can pass the Vector class in ITensor library to other library by .data() method because the data is held by storage_type = std::vector. But this does not work for a vector like ITensor (rank one). Is there a workaround?</p>
<p>Updata1:<br>
Find workaround at <a rel="nofollow" href="http://itensor.org/docs.cgi?page=formulas/extractdense">http://itensor.org/docs.cgi?page=formulas/extractdense</a><br>
Can anyone give a template example so there is no need to use isComplex() to determine to call ExtractReal or ExtractCplx.</p>
<p>Remember to use T.scaleTo(1) before Extract the Storage of Tensor T because of the designed feature(see for example <a rel="nofollow" href="https://github.com/ITensor/ITensor/issues/139">https://github.com/ITensor/ITensor/issues/139</a> ). </p>
<p>Thanks!</p>
http://itensor.org/support/666/make-use-of-storage_ptr%26Wed, 27 Sep 2017 15:38:27 +0000Correlation functions and Jordan-Wigner string
http://itensor.org/support/659/correlation-functions-and-jordan-wigner-string
<p>In the page on Jordan-Wigner strings, it says</p>
<blockquote>
<p>Even though AutoMPO will produce a correct MPO, if you use this MPO in DMRG, for example, to find a ground state of a fermionic system, when measuring correlation functions such as @@⟨c_i^\dagger c_j⟩@@ it is still required that you insert the necessary Jordan-Wigner string operators yourself.</p>
</blockquote>
<p>I don't understand this. If I do something like</p>
<pre><code>auto ampo = AutoMPO(sites);
ampo+=1,"Cdagup",i,"Cup",j;
auto mpo = MPO(ampo);
auto answer = overlap(psi,mpo,psi);
</code></pre>
<p>will this not give the correct answer automatically? I thought the whole point of AutoMPO was that it generated the exact right thing for fermions.</p>
<p>Or am I misinterpreting something?</p>
<p>Thanks! </p>
http://itensor.org/support/659/correlation-functions-and-jordan-wigner-stringMon, 25 Sep 2017 01:51:08 +0000Ground state energy increases for nearly converged state at order 10^(-10)
http://itensor.org/support/658/ground-state-energy-increases-nearly-converged-state-order
<p>I observe similar increases in energy as those seen here (<a rel="nofollow" href="http://itensor.org/support/576/ground-state-energy-increase-after-10th-sweep).">http://itensor.org/support/576/ground-state-energy-increase-after-10th-sweep).</a> The increases in energy I see also begin at order 10^(-10) even though my truncation cutoff is set to 10^(-12). I'm able to reproduce energies up to the order of 10^(-10) using ED so I'm confident that my Hamiltonian is set up correctly and suspect that there is some issue with the Davidson convergence/precision. Is there a default cutoff of 10^(-10) that I'm missing somewhere or should the supplied DMRG algorithm be capable of seeing energy convergence on the order of 10^(-12) and potentially lower for more stringent cutoffs (it looks like there might be a hard-coded cutoff of 10^(-12) in the Davidson algorithm)?</p>
<p>The answer to the referenced question suggests increasing the number of iterations, but I'm not sure if this addresses the root of the problem or not. Should I increase "niter" (the max number of Davidson iterations) to something like 6 so that the algorithm will exit automatically if convergence is reached and I just hope this is sufficient or should I play with "Errgoal" in the args for the algorithm? It looks like the default value for "Errgoal" is quite small at 10^(-4) so I'm not sure if this is the right approach and if I'm reading the code properly. I'm interested in calculating non-local observables whose errors should scale as the square root of the errors in energy so I'd like to have as high of precision as possible.</p>
<p>As a quick aside, I know that the error in energy should scale proportional to the truncation error, but in practice I find it is several orders of magnitude larger. What is the reason for this?</p>
<p>Thanks!</p>
http://itensor.org/support/658/ground-state-energy-increases-nearly-converged-state-orderThu, 21 Sep 2017 21:53:35 +0000meaning of return IQIndexVal{}?
http://itensor.org/support/648/meaning-of-return-iqindexval
<p>I'm reading code of the file spinone.h. What does "return IQIndexVal{};" mean? I also found in the file siteset.h, there's "return IQIndexVal{}" and "return IQTensor{}"? You defined IQTensor and IQIndexVal as the names of 2 classes. What does it mean by "return classname {}"? Thanks a lot.</p>
http://itensor.org/support/648/meaning-of-return-iqindexvalWed, 13 Sep 2017 21:23:32 +0000Export eigenvectors with corresponding eigenvalue from diagHermitian function
http://itensor.org/support/646/eigenvectors-corresponding-eigenvalue-diaghermitian-function
<p>Hi,</p>
<p>I'm using diagHermitian(IQTensor H, IQTensor & U, IQTensor & D, Args args = Args::global()) -> Spectrum to calculate other expectation values with the eigenstates. Is there anyway more clever than looking up the U to sum over the all the states with the same Link index and get the corresponding eigenstates? <br>
Thank you.</p>
<p>Best,<br>
Victor</p>
http://itensor.org/support/646/eigenvectors-corresponding-eigenvalue-diaghermitian-functionTue, 12 Sep 2017 15:31:25 +0000To measure total spin angular momentum S^2 on MPS
http://itensor.org/support/641/to-measure-total-spin-angular-momentum-s-2-on-mps
<p>Hi, </p>
<p>Is there any possibility to measure total S^2 for a large system ? <br>
Since the site operators can only be added with the same indexes, we would do expectations separately and sum over it. However, there are some cross terms which can be long range correlation measurement. Any suggestion for it? <br>
Thank you so much! </p>
<p>Best,<br>
Victor.</p>
http://itensor.org/support/641/to-measure-total-spin-angular-momentum-s-2-on-mpsSat, 09 Sep 2017 18:30:29 +0000How to get the "discarded weight" when using fitApplyMPO ?
http://itensor.org/support/638/how-to-get-the-discarded-weight-when-using-fitapplympo
<p>Hi,</p>
<p>When using fitApplyMPO to perform some unitary time-evolution, exactly as in <a rel="nofollow" href="http://itensor.org/docs.cgi?page=formulas/tevol_mps_mpo,">http://itensor.org/docs.cgi?page=formulas/tevol_mps_mpo,</a> what would be the simplest way to get the "discarded weight" after one time step ? (assuming that Cutoff is sufficiently small, so that the new bond dimension is actually set by Maxm).</p>
<p>Thanks a lot !</p>
<p>G.</p>
http://itensor.org/support/638/how-to-get-the-discarded-weight-when-using-fitapplympoFri, 01 Sep 2017 13:41:26 +0000Contraction of two sparse tensors
http://itensor.org/support/637/contraction-of-two-sparse-tensors
<p>I am trying to implement a simple version of iTebd. I defined a class which involves tensors Gamma with three indexes and tensors Lambda, which are real diagonal and contain the Schmidt eigenvalues. I have one of these tensors for each site in the elementary cell.</p>
<p>In order to exploit the advantage of having Lambda diagonal, I defined them using diagTensor.</p>
<p>In performing products of these tensors, I encountered the situation where I needed to change the indexes of one Lambda tensor. Therefore I performed the contraction with the sparse tensor delta.</p>
<p>However, I was surprised by the runtime error that I got when performing this contraction:</p>
<p>libc++abi.dylib: terminating with uncaught exception of type itensor::ITError: doTask not defined for task Contract and storage types DiagReal DiagReal</p>
<p>It seems that the product between two diagonal tensors is not implemented. Why is it so?</p>
http://itensor.org/support/637/contraction-of-two-sparse-tensorsThu, 31 Aug 2017 18:55:11 +0000Practical routes to convergence
http://itensor.org/support/633/practical-routes-to-convergence
<p>I've long struggled with the question, "What is the best possible sequence of input parameters -- energy cutoff, maximum number of singular values, noise, number of sweeps per set of parameters to get the most rapid and precise wavefunction?"</p>
<p>I opted for a compromise, for practical purposes of getting my calculations running, that incorporates a combination of noise at the start of a set of sweeps and doubling in the number of singular values at each set of sweeps.</p>
<p>In other words, I provide up to 7 input files in succession, and each input file has a different maximum number of singular values (M). </p>
<p>So in my most recent set of calculations, I used roughly the following:<br>
Inputfile 1:<br>
M = 50 states kept<br>
Noise = 1E-4 and decreasing to 0 over about 7 sweeps<br>
Energy cutoff = 1E-2</p>
<p>Inputfile 2:<br>
M = 100 states kept<br>
Noise is the same as inputfile 1<br>
Energy cutoff is 1E-4</p>
<p>3:<br>
M = 200<br>
E cutoff is 1E-7</p>
<p>4:<br>
M = 400<br>
Ecutoff is 1E-8</p>
<p>5:<br>
M = 800<br>
Ecutoff is 1E-9</p>
<p>and so on. The higher cutoff files are usually too time-consuming to run so I don't use them often.</p>
<p>I have since realized that this "practical attempt" to get good convergence might be inefficient for the following reason: The decrease in energy from one inputfile to the next is greater than the supposed energy cutoff of the previous inputfile. So I am decreasing the energy cutoffs to better match the true precision afforded by a given M.</p>
<p>Jin recommended letting M follow a simpler sequence such as 20, 20, 40, 40, ...Mprevious + 20 with two sweeps at each M. For me, this seems impractical since I want to reach high precisions (M up to and beyond 800 to get energy precisions above 1E-6 if possible).</p>
<p>Is there any realistic way of optimizing this energy cutoff/states kept/number of sweeps/noise sequence besides an automated (or manual) trial-and-error approach? I am studying a difficult system and need the most efficient and precise wavefunctions I can afford. I have limited computer time that is running out rapidly.</p>
<p>Thanks!</p>
<p>Jon</p>
http://itensor.org/support/633/practical-routes-to-convergenceFri, 18 Aug 2017 01:27:05 +0000Error: "Default constructed ITensor in product"
http://itensor.org/support/627/error-default-constructed-itensor-in-product
<p>While attempting to import a wavefunction and site data from files, and then analyze the wavefunctions, I got the following error:</p>
<pre><code>From line 101, file itensor_operators.cc
Default constructed ITensor in product
</code></pre>
<p>Is this error message consistent with some kind of error in the wavefunction file that is somehow jamming either the import or analysis of the wavefunction?</p>
http://itensor.org/support/627/error-default-constructed-itensor-in-productTue, 15 Aug 2017 00:12:30 +0000How to properly use the MPS and MPO methods for arbitrary MPOs?
http://itensor.org/support/622/how-to-properly-use-the-mps-and-mpo-methods-for-arbitrary-mpos
<p>Hi,</p>
<p>using the MPS and MPO classes and methods, I find some behaviour which is contradictory to what I think should happen. Therefore, I wanted to make sure to use these classes in a valid way (which I meanwhile doubt a lot):</p>
<p><strong>What I want to do:</strong> I want to contract a periodic MPS with a periodic MPO a couple of times (both with arbitrary bond dimension, physical as well as virtual, such that the builders such as AutoMPO don't seem adequate to me?). </p>
<p><strong>What I do:</strong> So I initialize my site set <code>sites</code> and initialize sets of virtual indices once for the MPS and once for the MPO <code>mpo_inds</code> and <code>mps_inds</code>. I initialize an MPO and MPS object<br>
<code>MPS myMPS (sites)</code><br>
<code>MPO myMPO (sites)</code><br>
then for each site <code>site_</code> I create tensors <code>mps_A</code> and <code>mpo_A</code> that fullfill my index structure defined in <code>mps_inds</code> and <code>mpo_inds</code>. Then I simply set<br>
<code>myMPS.Aref(site_) = mps_A;</code><br>
<code>myMPO.Aref(site_) = mpo_A;</code></p>
<p><strong>What I would expect:</strong> So now I would expect that using <code>exactApplyMPO</code> should yield the same result (modulo gauge invariance) as initializing a new MPS defined through tensors of the form <code>mps_A * mpo_A</code> (combining the double index to a new index and building an adequate index set for the MPS build this way etc ...) <br>
However, after normalizing each of the states I find that:<br>
<code>overlapC(myMPS_, myOtherMPS) = 0.86 - 0.95</code><br>
whilst <br>
<code>overlapC(myMPS_, myMPS_)=overlapC(myOtherMPS, myOtherMPS) = 0.99 - 1.0</code><br>
where <code>myOtherMPS</code> is the manually defined contraction, whilst <code>myMPS_</code> is the result from <code>exactApply(myMPS, myMPO, myMPS_)</code>.</p>
<p>So, to me it seems that 1) obviously the states <code>myMPS_</code> and <code>myOtherMPS</code> aren't the same whilst 2) they stay surprisingly close (still about 90% +- 5% overlap) all the time (where I do use randomly generated ITensors for the MPO and MPS initialization). </p>
<p>What is it that I am misusing, or how to do this in the correct way?</p>
<p>Best wishes,<br>
Alex</p>
http://itensor.org/support/622/how-to-properly-use-the-mps-and-mpo-methods-for-arbitrary-mposThu, 10 Aug 2017 14:38:48 +0000Installation on Linux Ubuntu
http://itensor.org/support/619/installation-on-linux-ubuntu
<p>Hi, I am trying to install ITensor library on my Ubuntu (v. 16.04.3) virtual machine.<br>
I followed the instruction, but when I compile the library, the error shows up at the stage of compiling mps module. The error reads:</p>
<pre><code>...
Compiling itensor/mps/mps.cc with optimizations
mps/mps.cc: In member function 'void itensor::MPSt<Tensor>::copyWriteDir() [with Tensor
= itensor::ITensorT<itensor::Index>]':
mps/mps.cc::1035:9: warning: ignoring return value of 'int system(const char*)', declared with
attribute warn_unused_result [-Wunused-result]
system(cmdstr.c_str());
^
mps/mps.cc: In member function 'void itensor::MPSt<Tensor>::copyWriteDir() [with Tensor
= itensor::ITensorT<itensor::IQIndex>]':
mps/mps.cc::1035:9: warning: ignoring return value of 'int system(const char*)', declared with
attribute warn_unused_result [-Wunused-result]
mps/mps.cc: In member function 'void itensor::MPSt<Tensor>::cleanupWrite() [with Tensor
= itensor::ITensorT<itensor::Index>]':
mps/mps.cc::1051:9: warning: ignoring return value of 'int system(const char*)', declared with
attribute warn_unused_result [-Wunused-result]
system(cmdstr.c_str());
^
mps/mps.cc: In member function 'void itensor::MPSt<Tensor>::cleanupWrite() [with Tensor
= itensor::ITensorT<itensor::Index>]':
mps/mps.cc::1051:9: warning: ignoring return value of 'int system(const char*)', declared with
attribute warn_unused_result [-Wunused-result]
</code></pre>
<p>Other modules were compiled without errors.<br>
The makefile was used with options below:<br>
[1] <br>
## GNU GCC compiler<br>
CCCOM=g++ -m64 -std=c++11 -fPIC<br>
[2]<br>
PLATFORM=lapack<br>
BLAS<em>LAPACK</em>LIBFLAGS=-lpthread -L/usr/lib -lblas -llapack</p>
<p>Thank you!</p>
http://itensor.org/support/619/installation-on-linux-ubuntuThu, 10 Aug 2017 05:00:15 +0000Difficulty adding fermionic IQTensors with sum(psi1,psi2)
http://itensor.org/support/606/difficulty-adding-fermionic-iqtensors-with-sum-psi1-psi2
<p>I am attempting to create a trial wavefunction that is a superposition of two wavefunctions.</p>
<p>My code does roughly the following:</p>
<pre><code>Hubbard sites;
auto sites1,sites2 = sites; // N is even
sites = Hubbard(N);
sites1 = sites;
sites2 = sites;
IQMPS psi1, psi2;
auto state1 = InitState(sites1);
auto state2 = InitState(sites2);
loop over sites;
for odd sites, state1.set(i, "UpDn")
for even sites, state2.set(i, "UpDn")
other sites are empty
psi1 = IQMPS(state1);
psi2 = IQMPS(state2);
psi = sum(psi1,psi2); // I also tried out sum(psi1, psi1) as a check
psi.norm();
</code></pre>
<p>The electron densities that result for psi are<br>
8 8 8 8 8 8<br>
whereas I was expecting<br>
1 1 1 1 1 1</p>
<p>Notes:<br>
The above code works fine for a single wavefunction. That is, if I just set psi = psi1 or psi = psi2, just the odd or just the even sites are filled, the electron density is<br>
2 0 2 0 2 0<br>
or<br>
0 2 0 2 0 2</p>
<p>When I set psi = sum(psi1, psi1) the electron density is<br>
8 0 8 0 8 0</p>
<p>The only portion of the code that isn't working, from what I can tell, is the sum( , ) function. Is there a bug in sum() that is not conserving quantum numbers? Is there another function that I can use to conserve quantum numbers while adding wavefunctions?</p>
http://itensor.org/support/606/difficulty-adding-fermionic-iqtensors-with-sum-psi1-psi2Wed, 02 Aug 2017 21:53:21 +0000Conversion MPS into ITensor and Time reversal symmetry
http://itensor.org/support/603/conversion-mps-into-itensor-and-time-reversal-symmetry
<p>Hi, all</p>
<ol>
<li>Instead of using .product of all psi.A(i), is there any way to convert MPS into ITensor form ? </li>
<li>Is there any clever way to check if ground state psi breaks time reversal symmetry? </li>
</ol>
<p>Thank you so much! </p>
<p>Best,<br>
Victor</p>
http://itensor.org/support/603/conversion-mps-into-itensor-and-time-reversal-symmetryWed, 02 Aug 2017 20:12:32 +0000Quick Question: Storing an ITensor to a file
http://itensor.org/support/594/quick-question-storing-an-itensor-to-a-file
<p>Hi all,</p>
<p>as I didn't find a solution yet and am sure not to be the only one who has yet looked for that:</p>
<p>is there a canonical (or how you want to call it) way of storing the data of an ITensor to a file in order to later read the ITeonsor into the RAM again except for reading the data in through a file input/output stream? <br>
I.e. are there functions like<br>
<code>itensor::storeToFile(itensor::ITensor, file)</code><br>
<code>itensor::ITensor tensor = itensor::readFromFile(file)</code> ?</p>
<p>Best,<br>
Alex</p>
http://itensor.org/support/594/quick-question-storing-an-itensor-to-a-fileTue, 01 Aug 2017 15:28:13 +0000Difficulties with DMRG on a non-hermitian system
http://itensor.org/support/593/difficulties-with-dmrg-on-a-non-hermitian-system
<p>I'm trying to run dmrg on a non-Hermitian Z3 system, defined below. The system has an exact solution for the ground state in the open bc case, and iTensor typically gets within about 1% of the correct energy. I can't seem to achieve better convergence by changing the sweep parameters (including noise), and furthermore the final energy seems to depend on the initial state used, again to margins of ~1%. The system has a real ground state energy, but the rest of the spectrum is complex. I suspect this is the cause of the problem, as the algorithm appears to truncate to real numbers at various stages.</p>
<p>Is there anything you can suggest to improve convergence? I was considering attempting to rewrite the various dmrg functions using Cplx instead of Real - would this be worthwhile?</p>
<pre><code> auto sites = Z3(N);
auto ampo = AutoMPO(sites);
for(int j = 1; j < N; ++j){
ampo += -1.0, "Sig", j;
ampo += -1.0,"Tau",j,"TauDag",j+1;
}
ampo += -1.0, "Sig", N;
if (periodic_bcs)
ampo += -1.0,"Tau",N,"TauDag",1;
auto H = MPO(ampo);
</code></pre>
<p>Note: the system is a special case of <a rel="nofollow" href="https://arxiv.org/pdf/1612.02617.pdf">https://arxiv.org/pdf/1612.02617.pdf</a></p>
http://itensor.org/support/593/difficulties-with-dmrg-on-a-non-hermitian-systemFri, 28 Jul 2017 06:20:08 +0000What is the order of indexes output by tensor.inds()?
http://itensor.org/support/588/what-is-the-order-of-indexes-output-by-tensor-inds
<p>Is there a way I can keep them in a particular order?</p>
http://itensor.org/support/588/what-is-the-order-of-indexes-output-by-tensor-indsThu, 20 Jul 2017 06:03:58 +0000.set() method of ITensor
http://itensor.org/support/587/set-method-of-itensor
<p>After construct a tenstor with</p>
<pre><code> ITensor(std::vector<Index>)
</code></pre>
<p>how can I set a single element without calling </p>
<pre><code> tensor.set(indval_1, indval_2, ...)
</code></pre>
<p>The reason is that std::vector is determined in run time, so I have no idea of how many arguments need to passing into .set function.</p>
http://itensor.org/support/587/set-method-of-itensorWed, 19 Jul 2017 23:30:57 +0000IQDMRG and good quantum number
http://itensor.org/support/585/iqdmrg-and-good-quantum-number
<p>Hi Miles,</p>
<p>I want to know some details about iqdmrg. </p>
<p>I think the iqdmrg is a variational optimization algorithm and in each sweep step iqdmrg has to solve an eigenequation, is it? Or iqdmrg works like traditional DMRG with many block matrices ?</p>
<p>I also do not know how iqindex make MPS conserve quantum number. Or in other words, I do not know how iqindex make a tensor contain non-zero elements only for certain index ranges. Is there any detailed reference for MPS algorithm with additive quantum number?</p>
<p>Best regards!<br>
Huike </p>
http://itensor.org/support/585/iqdmrg-and-good-quantum-numberTue, 18 Jul 2017 07:26:15 +0000ITensor/LAPACK SVD
http://itensor.org/support/582/itensor-lapack-svd
<p>It appears that the ITensor svd operation does not ultimately call a LAPACK SVD routine. What advantage does this implementation have?</p>
http://itensor.org/support/582/itensor-lapack-svdFri, 30 Jun 2017 14:46:33 +0000Entanglement Entropy of 2D MPS
http://itensor.org/support/580/entanglement-entropy-of-2d-mps
<p>There is an tutorial on 2D DMRG</p>
<p><a rel="nofollow" href="http://itensor.org/docs.cgi?page=formulas/2d_dmrg">http://itensor.org/docs.cgi?page=formulas/2d_dmrg</a></p>
<p>This yields ground state psi of a given Hamiltonian and its energy.<br>
My question is, is there an easy way to extract the entanglement entropy of a subsystem (say the central 4x4 quadrant in an 8x8 system with square lattice geometry) given the groundstate psi? E.g. with the help of the lattice class?</p>
<p>Thank you!<br>
Best,<br>
Andreas</p>
http://itensor.org/support/580/entanglement-entropy-of-2d-mpsTue, 27 Jun 2017 08:58:08 +0000