ITensor Support Q&A - Recent questions
http://itensor.org/support/questions
Powered by Question2AnswerHow to define a custom two-site operator for autoMPO?
http://itensor.org/support/850/how-to-define-a-custom-two-site-operator-for-autompo
<p>I want to use ITensor to obtain thermal states for the 1D Fermi-Hubbard model using the purification method and to do so I need to define an entangler Hamiltonian but I'm having some problems. </p>
<p>Right now I'm trying to use autoMPO to create the Hamiltonian and that requires me to define the operator |1 - N<em>up</em>i - N<em>dn</em>i'| acting on a site i and its ancilla i' (as in Eq. 26 and 29 of <a rel="nofollow" href="https://journals.aps.org/prb/abstract/10.1103/PhysRevB.93.045137">https://journals.aps.org/prb/abstract/10.1103/PhysRevB.93.045137</a> ). It seems that this operator just projects away the states |Up Up> and |Dn Dn> so I could define a tensor with two indices going and two going in out that does that(with something like to "Op.set()..." I imagine) but is there a way to use this new tensor with the autoMPO system?</p>
<p>If that is not possible then what would be the best way to construct the Hamiltonian MPO?</p>
http://itensor.org/support/850/how-to-define-a-custom-two-site-operator-for-autompoMon, 19 Mar 2018 16:07:04 +0000How to use a previously DMRG calculated state as starting point for a new H?
http://itensor.org/support/843/use-previously-dmrg-calculated-state-starting-point-for-new
<p>Is it possible to read a state (IQMPS) calculated with one Hamiltonian, and then load it as an initial guess for a DMRG with a slightly different Hamiltonian?</p>
<p>If I try to simply load the IQMPS and apply the new Hamiltonian in the DMRG function, I get an error that they don't match.</p>
http://itensor.org/support/843/use-previously-dmrg-calculated-state-starting-point-for-newFri, 16 Mar 2018 10:32:40 +0000While doing parallel dmrg we need the file mpi.h. Where do we get that?
http://itensor.org/support/839/while-doing-parallel-dmrg-need-the-file-mpi-where-we-get-that
http://itensor.org/support/839/while-doing-parallel-dmrg-need-the-file-mpi-where-we-get-thatFri, 09 Mar 2018 12:08:48 +0000Please explain to me how exactly the program 'autompo.cc' works.
http://itensor.org/support/838/please-explain-to-me-how-exactly-the-program-autompo-cc-works
http://itensor.org/support/838/please-explain-to-me-how-exactly-the-program-autompo-cc-worksWed, 07 Mar 2018 09:16:42 +0000Is it possible to run several DMRG-processes in parallel without segmentation fault?
http://itensor.org/support/837/possible-several-processes-parallel-without-segmentation
In my project I have to run a long DMRG calculation for different values of particle interactions, and I would like to run the different calculations in parallel. For this I implement a naive OpenMP parallel computing the following way:<br />
<br />
Add the "-fopenmp" flag in compilation<br />
<br />
Run my entire program within a for-loop initialized with "#pragma omp parallel for".<br />
<br />
The processes run for about 40-60 sweeps (of 128), after which I get "Segmentation fault (core dumped)". Is the DMRG code in ITensor not thread-safe?http://itensor.org/support/837/possible-several-processes-parallel-without-segmentationFri, 02 Mar 2018 13:34:34 +0000Dynamics with fitapplyMPO on dmrg groundstate
http://itensor.org/support/790/dynamics-with-fitapplympo-on-dmrg-groundstate
<p>Hi,<br>
I am trying to study some dynamics using ITensor and I was wondering what is the most stable combination of functions. </p>
<p>To fix the ideas, I am considering the open Ising spin 1/2 chain in the gapped phase (h transverse field > 1) with N=100 sites. The groundstate is found very efficiently with the dmrg function of ITensor with a small number of sweeps; for the case I am considering (h = 1.5), I obtain high accuracy with a bond dimension of 5 at most.</p>
<p>Now, I am trying to perform some dynamics on this state. In order to do so, I am using the bult-in function fitapplyMPO with imaginary time. What I noticed is that even though I evolve with the same MPO Hamiltonian I used to find the groundstate, the bond dimension starts to grow. In principle, the state should not evolve at all as it is the groundstate of the Hamiltonian.</p>
<p>This effect is suppressed if I take a very small timestep (t=0.001) for the time-evolution. </p>
<p>I was wondering: is this the expected behaviour, which is essentially unavoidable, or it is a bad idea to combine the dmrg function and then the fitapplyMPO?</p>
<p>I was thinking that using imaginary time evolution e^{- tau H} to find the groundstate still with fitapplyMPO could avoid this issue, even though it would provide a worse description of the groundstate.</p>
<p>What do you think? </p>
http://itensor.org/support/790/dynamics-with-fitapplympo-on-dmrg-groundstateThu, 25 Jan 2018 11:07:10 +0000The running of memory due to large m for dmrg and iqdmrg of one dimensional spin system
http://itensor.org/support/789/running-memory-large-dmrg-and-iqdmrg-dimensional-spin-system
<p>Hi, Miles. </p>
<p>In order to achieve the accuracy(cutoff) such as 1E-10 for my 1-D spin one system on , I need to put m to 4800 on iqdmrg. Here is my sweep:<br>
Sweeps:<br>
1 Maxm=10, Minm=1, Cutoff=1.0E-10, Niter=2, Noise=1.0E-07<br>
2 Maxm=20, Minm=1, Cutoff=1.0E-10, Niter=2, Noise=1.0E-08<br>
3 Maxm=100, Minm=1, Cutoff=1.0E-10, Niter=2, Noise=1.0E-10<br>
4 Maxm=200, Minm=1, Cutoff=1.0E-10, Niter=2, Noise=1.0E-15<br>
5 Maxm=400, Minm=1, Cutoff=1.0E-10, Niter=2, Noise=1.0E-20<br>
6 Maxm=800, Minm=1, Cutoff=1.0E-10, Niter=2, Noise=1.0E-30<br>
7 Maxm=1200, Minm=1, Cutoff=1.0E-10, Niter=2, Noise=0.0E+00<br>
8 Maxm=2400, Minm=1, Cutoff=1.0E-10, Niter=2, Noise=0.0E+00<br>
9 Maxm=4800, Minm=1, Cutoff=1.0E-10, Niter=2, Noise=0.0E+00<br>
10 Maxm=9600, Minm=1, Cutoff=1.0E-10, Niter=2, Noise=0.0E+00</p>
<pre><code>vN Entropy at center bond b=31 = 1.238744298544
Eigs at center bond b=31: 0.5049 0.3166 0.1094 0.0282 0.0180 0.0094 0.0059 0.0026 0.0024 0.0017
Largest m during sweep 1 was 10
Largest truncation error: 0.0258392
Energy after sweep 1 is 5.602725754556
Sweep 1 CPU time = 2.204s (Wall time = 2.205s)
vN Entropy at center bond b=31 = 1.612233679937
Eigs at center bond b=31: 0.3923 0.2871 0.1657 0.0503 0.0338 0.0229 0.0115 0.0107 0.0076 0.0071
Largest m during sweep 2 was 20
Largest truncation error: 0.0028786
Energy after sweep 2 is 0.530196370527
Sweep 2 CPU time = 36.54s (Wall time = 7.408s)
vN Entropy at center bond b=31 = 1.925120785867
Eigs at center bond b=31: 0.3345 0.2587 0.1691 0.0615 0.0459 0.0318 0.0192 0.0188 0.0125 0.0120
Largest m during sweep 3 was 100
Largest truncation error: 4.6379e-05
Energy after sweep 3 is -1.624350530351
Sweep 3 CPU time = 5m, 44.1s (Wall time = 22.07s)
vN Entropy at center bond b=31 = 2.274203834242
Eigs at center bond b=31: 0.2817 0.2263 0.1570 0.0639 0.0589 0.0345 0.0280 0.0265 0.0227 0.0190
Largest m during sweep 4 was 200
Largest truncation error: 4.08592e-05
Energy after sweep 4 is -1.868673250230
Sweep 4 CPU time = 22m, 17s (Wall time = 1m, 25.4s)
vN Entropy at center bond b=31 = 2.575774377167
Eigs at center bond b=31: 0.2459 0.1961 0.1393 0.0676 0.0569 0.0356 0.0332 0.0332 0.0312 0.0268
Largest m during sweep 5 was 400
Largest truncation error: 1.87256e-05
Energy after sweep 5 is -1.952988038907
Sweep 5 CPU time = 1h, 23m, 11s (Wall time = 5m, 19.3s)
vN Entropy at center bond b=31 = 2.959973291749
Eigs at center bond b=31: 0.1998 0.1549 0.1120 0.0760 0.0503 0.0458 0.0420 0.0412 0.0307 0.0254
Largest m during sweep 6 was 800
Largest truncation error: 9.42967e-06
Energy after sweep 6 is -2.003774164313
Sweep 6 CPU time = 5h, 44m, 4s (Wall time = 22m, 6s)
vN Entropy at center bond b=31 = 3.273794426370
Eigs at center bond b=31: 0.1523 0.1090 0.0917 0.0892 0.0524 0.0513 0.0494 0.0318 0.0305 0.0293
Largest m during sweep 7 was 1200
Largest truncation error: 6.29943e-06
Energy after sweep 7 is -2.024859515379
Sweep 7 CPU time = 11h, 34m, 3s (Wall time = 44m, 28s)
vN Entropy at center bond b=31 = 3.326094274331
Eigs at center bond b=31: 0.1442 0.0967 0.0943 0.0924 0.0517 0.0515 0.0513 0.0307 0.0306 0.0305
Largest m during sweep 8 was 2400
Largest truncation error: 7.15778e-07
Energy after sweep 8 is -2.028678884827
Sweep 8 CPU time = 46h, 7m, 7s (Wall time = 2h, 59m, 20s)
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc/var/spool/slurm/slurmd/job00768/slurm_script: line 11: 22084
Aborted ./iqdmrg input
</code></pre>
<p>As it shows, the memory ran out in sweep 9 with m=4800<br>
I observed my memory usage as following :</p>
<p><a rel="nofollow" href="https://imgur.com/a/mKIUH">https://imgur.com/a/mKIUH</a></p>
<p>The memory of final sweep increases linearly to the upper limit of my node. <br>
Is there any suggestion to resolve it? <br>
Thank you.</p>
<p>Victor</p>
http://itensor.org/support/789/running-memory-large-dmrg-and-iqdmrg-dimensional-spin-systemWed, 24 Jan 2018 13:55:33 +0000Fastest way to create and apply diagonal exponential operator
http://itensor.org/support/787/fastest-way-create-and-apply-diagonal-exponential-operator
<p>Hello Miles,</p>
<p>I am trying to time evolve a state using a Hamiltonian, which changes every time step. The Hamiltonian consists of a constant two-site term (for which I evolve using Trotter gates), and a varying single-site term, which is diagonal. <br>
Since the sequence will be run many times, the total time of the process of exponentiating the Hamiltonian and applying it needs to be as fast as possible.<br>
Currently I create the exponent through toExpH, and apply the tensors directly to the MPS right after the forward sweep of Trotter gates, like this:</p>
<pre><code>if (ni1 >= i2)
{
psi.svdBond(i1,AA,Fromleft,args);
auto Ap = psi.A(i1)*expHt.A(i1);
Ap.mapprime(1,0,Site);
psi.setA(i1,Ap);
psi.position(ni1);
}
</code></pre>
<p>Although this method is fairly fast, I need it to be even faster. Is there any way I can effectively truncate the MPS after applying the expHt, or can I somehow utilize the diagonal form of the time dependent Hamiltonian Ht?</p>
<p>Thank you!</p>
http://itensor.org/support/787/fastest-way-create-and-apply-diagonal-exponential-operatorTue, 23 Jan 2018 02:22:52 +0000Issues 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 04: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 10: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 02: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 05: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 01: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 00: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 01: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 09: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 12: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 02: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-effectThu, 30 Nov 2017 20: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 08: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 11: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-dataTue, 21 Nov 2017 18: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 11: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 14: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-chargeTue, 31 Oct 2017 17: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 07: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 07: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 10: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 08: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 12: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 07: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 14: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 01: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 15: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-codeTue, 03 Oct 2017 19: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 11: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 04: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 08: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-stringSun, 24 Sep 2017 18: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 14: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 14: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 08: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 11: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 06: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 11: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-convergenceThu, 17 Aug 2017 18: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-productMon, 14 Aug 2017 17: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 07: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-ubuntuWed, 09 Aug 2017 22: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 14:53:21 +0000