ITensor Support Q&A - Recent questions
http://itensor.org/support/questions
Powered by Question2AnswerOutput 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 +0000Ground state energy increase after 10th sweep
http://itensor.org/support/576/ground-state-energy-increase-after-10th-sweep
<p>I'm calculating the spin 1 bilinear biquadratic model at the critical point $\theta=-PI/4$. For N=32, I did 13 sweeps. The ground state energy after each sweep is:<br>
Sweep 01: -88.497967398468<br>
Sweep 02: -88.909137146883<br>
Sweep 03: -88.917526981673<br>
Sweep 04: -88.917544395609<br>
Sweep 05: -88.917545655638<br>
Sweep 06: -88.917545847203<br>
Sweep 07: -88.917545866916<br>
Sweep 08: -88.917545867250<br>
Sweep 09: -88.917545867323<br>
Sweep 10: -88.917545867276<br>
Sweep 11: -88.917545867230<br>
Sweep 12: -88.917545867091<br>
Sweep 13: -88.917545867087</p>
<p>We can see from sweep 10, the ground state energy start to increase at order 10^(-10) instead of decreasing. Is it because of the largest truncation error I set is 10^-10? Do I consider this as convergence or wrong result? (The sweep info and code is attached in the end)</p>
<p>Besides this, I have a few questions:<br>
1. How should one set "niter" in each sweep? Large or small number? </p>
<ol>
<li><p>How many sweeps should I do to reach convergence? Should I keep the same "maxm" and do a few sweeps or keep increasing "maxm" to do sweeps (as long as the "maxm" I set is larger than the largest m during sweep)?</p></li>
<li><p>About the mid step information produced by "dmrg", say this example, I get:<br>
Sweep=1, HS=1, Bond=(1,2)<br>
I 0 q 2E+00 E -65.7609306503<br>
I 2 q 4E-14 E -66.9810071517</p></li>
</ol>
<p>What does "I 0" "q 2E+00" "E -65.7609306503" mean? And why are there 2 sets of data?</p>
<ol>
<li>If I want to measure the correlation functions <Sz(j)Sz(N-j+1)>, how can I determine if the correlation function is convergent? Do I compare the correlation function after each sweep? And what's the accuracy of the correlation function compare to the ground state energy?</li>
</ol>
<p>Thank you.</p>
<p>Sweep information:<br>
input<br>
{<br>
N = 32<br>
nsweeps = 13<br>
sw_table<br>
{<br>
maxm minm cutoff niter noise <br>
20 2 1E-8 9 1E-8 <br>
40 2 1E-8 8 1E-9 <br>
80 2 1E-10 7 1E-10<br>
120 2 1E-10 6 1E-10<br>
160 2 1E-10 5 0<br>
200 2 1E-10 4 0<br>
240 2 1E-10 4 0<br>
280 2 1E-10 4 0<br>
320 2 1E-10 5 0<br>
360 2 1E-10 6 0<br>
360 2 1E-10 7 0<br>
360 2 1E-10 8 0<br>
360 2 1E-10 9 0<br>
}<br>
quiet = no<br>
}</p>
<p>Code:</p>
<h2>include "itensor/all.h"</h2>
<h2>include <math.h></h2>
<p>using namespace itensor;<br>
using std::vector;<br>
using std::string;<br>
using std::min;<br>
using std::max;</p>
<h2>define PI 3.14159265358979323846</h2>
<p>int main(int argc, char* argv[])<br>
{<br>
if(argc != 2)<br>
{<br>
//reminds us to give an input file if we forget<br>
printfln("Usage: %s inputfile",argv[0]);<br>
return 0;<br>
}</p>
<pre><code>auto input = InputGroup(argv[1],"input");
auto N = input.getInt("N");
auto nsweeps = input.getInt("nsweeps");
auto sw_table = InputGroup(input,"sw_table");
auto quiet = input.getYesNo("quiet",true);
auto sweeps = Sweeps(nsweeps,sw_table);
println(sweeps);
println(quiet);
double theta = -PI/4;
double cost = cos(theta);
double sint = sin(theta);
auto sites = SpinOne(N);
auto ampo = AutoMPO(sites);
for(int j = 1; j < N; ++j)
{
ampo += cost,"Sz",j,"Sz",j+1;
ampo += cost*0.5,"S+",j,"S-",j+1;
ampo += cost*0.5,"S-",j,"S+",j+1;
ampo += sint,"Sz*Sz",j,"Sz*Sz",j+1;
ampo += sint*0.5,"Sz*S+",j,"Sz*S-",j+1;
ampo += sint*0.5,"Sz*S-",j,"Sz*S+",j+1;
ampo += sint*0.5,"S+*Sz",j,"S-*Sz",j+1;
ampo += sint*0.5,"S-*Sz",j,"S+*Sz",j+1;
ampo += sint*0.25,"S+*S+",j,"S-*S-",j+1;
ampo += sint*0.25,"S-*S-",j,"S+*S+",j+1;
ampo += sint*0.25,"S+*S-",j,"S-*S+",j+1;
ampo += sint*0.25,"S-*S+",j,"S+*S-",j+1;
}
auto H = IQMPO(ampo);
auto state = InitState(sites);
for(int i = 1; i <= N; ++i)
{
if(i%2 == 1)
state.set(i,"Up");
else
state.set(i,"Dn");
}
auto psi = IQMPS(state);
auto energy = dmrg(psi,H,sweeps,{"Quiet",quiet});
//
// Print the final energy reported by DMRG
//
printfln("\nGround State Energy = %.10f",energy);
return 0;
</code></pre>
<p>}</p>
http://itensor.org/support/576/ground-state-energy-increase-after-10th-sweepTue, 20 Jun 2017 19:18:04 +0000Using ITensor as external library in cmake project: undefined reference to `itensor::typeNameOf...
http://itensor.org/support/575/itensor-external-project-undefined-reference-typenameof
<p>Hi,</p>
<p>I am currently trying to use ITensor as library for some tensor network projects. I am working with CLion which relies on CMake. I got the CMake files ready such that my project can find the respective files. However, when I am building my super trivial test code:</p>
<pre><code>#include <iostream>
#include <itensor/all.h>
using namespace itensor;
int main(int argc, char* argv[]) {
return 0;
}
</code></pre>
<p>what i get is these error messages (repeated for many times, due to the usage of the function I expect) (<a rel="nofollow" href="https://drive.google.com/file/d/0BzL-NWO3QoFVeERpVFFld1RGVk0/view?usp=sharing">here the full log file</a>): </p>
<p>1)</p>
<pre><code>CMakeFiles/tutorial.dir/home/anietner/development/cpp/libraries/itensor/itensor/iqtensor.cc.o: In function `void itensor::detail::OneArg<itensor::CPData>::call<itensor::detail::RegisterTask<itensor::detail::OneArg<itensor::CPData>, itensor::ToITensor&&, itensor::ITensorT<itensor::Index> >, itensor::ToITensor, itensor::Scalar<double>, itensor::ITensorT<itensor::Index> >(itensor::detail::RegisterTask<itensor::detail::OneArg<itensor::CPData>, itensor::ToITensor&&, itensor::ITensorT<itensor::Index> >&, itensor::ToITensor&, itensor::Scalar<double>&, itensor::ManageStore&, itensor::ITensorT<itensor::Index>&)':
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/dotask.h:524: undefined reference to `itensor::typeNameOf(itensor::Scalar<double> const&)'
</code></pre>
<p>2)</p>
<pre><code>CMakeFiles/tutorial.dir/home/anietner/development/cpp/libraries/itensor/itensor/itensor_operators.cc.o: In function `void itensor::detail::CallWrap<itensor::detail::RegisterTask<itensor::detail::TwoArgs<std::shared_ptr<itensor::ITData>, itensor::CPData>, itensor::NCProd<itensor::Index>&&, itensor::NoneType>, itensor::NCProd<itensor::Index>, itensor::Scalar<double>, itensor::NoneType, std::shared_ptr<itensor::ITData>, itensor::CPData>::applyToImpl<itensor::Scalar<double> >(itensor::Scalar<double>&)':
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/dotask.h:611: undefined reference to `itensor::typeNameOf(itensor::Scalar<double> const&)'
</code></pre>
<p>3)</p>
<pre><code>CMakeFiles/tutorial.dir/home/anietner/development/cpp/libraries/itensor/itensor/iqtensor.cc.o: In function `void itensor::detail::CallWrap<itensor::detail::RegisterTask<itensor::detail::TwoArgs<std::shared_ptr<itensor::ITData>, itensor::CPData>, itensor::AddITensor&&, itensor::NoneType>, itensor::AddITensor, itensor::Dense<double>, itensor::NoneType, std::shared_ptr<itensor::ITData>, itensor::CPData>::applyToImpl<itensor::Scalar<std::complex<double> > const>(itensor::Scalar<std::complex<double> > const&)':
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/dotask.h:612: undefined reference to `itensor::typeNameOf(itensor::Scalar<std::complex<double> > const&)'
</code></pre>
<p>The CMake file can be found <a rel="nofollow" href="https://drive.google.com/file/d/0BzL-NWO3QoFVRXFxelF5bzVNNDA/view?usp=sharing">here</a></p>
<p>Maybe someone can help me and tell me how to fix this :) ?</p>
<p><strong>EDIT:</strong></p>
<p>Maybe this is of interest to the question: As one can see I do not include the files <code>itlazy.h</code> and <code>itlazy.cc</code>. This is because if I do so and build the project I get the following errors (<a rel="nofollow" href="https://drive.google.com/file/d/0BzL-NWO3QoFVOTlybHotRnUzMTg/view?usp=sharing">full log file</a>):</p>
<p>1)</p>
<pre><code>/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:14:25: error: ‘ITReal’ does not name a type
doTask(PrintStore,const ITReal& R) { println("Storage type of P is ITReal"); }
</code></pre>
<p>2)</p>
<pre><code>/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc: In function ‘itensor::PData itensor::evaluate(itensor::ITLazy&)’:
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:81:25: error: ‘using IndexSetBuilder = class itensor::RangeBuilderT<itensor::IndexSetT<itensor::Index> >’ has no member named ‘setExtent’
cis.setExtent(cn++,In);
</code></pre>
<p>3)</p>
<pre><code>In file included from /home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.h:9:0,
from /home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:1:
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h: In instantiation of ‘class itensor::ITWrap<itensor::ITLazy>’:
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h:262:9: required from ‘StorageT* itensor::ManageStore::makeNewData(VArgs&& ...) [with StorageT = itensor::ITLazy; Args = {const itensor::ITLazy&}]’
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:178:39: required from here
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h:81:5: error: static assertion failed: Data type not in list of registered storage types
static_assert(containsType<StorageTypes,stdx::decay_t<T>>{},"Data type not in list of registered storage types");
^
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h: In instantiation of ‘void itensor::ITWrap<T>::plugInto(itensor::FuncBase&) const [with T = itensor::ITLazy; itensor::FuncBase = itensor::FuncBaseT<itensor::TypeList<itensor::Dense<double>, itensor::Dense<std::complex<double> >, itensor::Combiner, itensor::Diag<double>, itensor::Diag<std::complex<double> >, itensor::QDense<double>, itensor::QDense<std::complex<double> >, itensor::QCombiner, itensor::QDiag<double>, itensor::QDiag<std::complex<double> >, itensor::QMixed<double>, itensor::QMixed<std::complex<double> >, itensor::Scalar<double>, itensor::Scalar<std::complex<double> > > >]’:
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:182:1: required from here
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h:104:9: error: no matching function for call to ‘itensor::FuncBaseT<itensor::TypeList<itensor::Dense<double>, itensor::Dense<std::complex<double> >, itensor::Combiner, itensor::Diag<double>, itensor::Diag<std::complex<double> >, itensor::QDense<double>, itensor::QDense<std::complex<double> >, itensor::QCombiner, itensor::QDiag<double>, itensor::QDiag<std::complex<double> >, itensor::QMixed<double>, itensor::QMixed<std::complex<double> >, itensor::Scalar<double>, itensor::Scalar<std::complex<double> > > >::applyTo(const itensor::ITLazy&)’
f.applyTo(d);
</code></pre>
http://itensor.org/support/575/itensor-external-project-undefined-reference-typenameofTue, 20 Jun 2017 16:37:33 +0000The installing problem
http://itensor.org/support/565/the-installing-problem
<p>I meet some problem on installing ITensor. I install it as the instructions provided on their website, but when I test the performance by using the sample file, the sample can not work. </p>
<p>The following step is what I installed before</p>
<ol>
<li><p>Since my computer is based on win10, so I install Cygwin, and i search 'make', 'gcc', and 'lapack' on the search window and install these file which related to the above keyword.</p></li>
<li><p>On the setting of options.mk, I select GCC on Windows cygwin and CCCOM=g++ -std=c++11 -Wa,-mbig-obj -O2 -fPIC. But I didnot find the suitable 'PLATFORM' , ' BLAS<em>LAPACK</em>INCLUDEFLAGS' and 'BLAS<em>LAPACK</em>LIBFLAGS' setting, but I choose the one which is mentioned ' Example using a C interface to LAPACK on GNU/LINUX systems'.</p></li>
<li><p>After the setting of options.mk, i started to type 'make' command on cygwin, and no error happened but there are several warnings. </p></li>
<li><p>So I think the library has been builded, then I want to test it by using the sample folder provided by ITensor. I can also get some .exe file after i typing 'make' command on cygwin, but i can not execute those .exe file. The error is 'cygstdc++.dll', 'cygwin1.dll','cygblas-0.dll' and 'cyggcc_s-seh-a.dll' are missing, and tell me I need to reinstall the program, but when I reinstall the program, I can not find the above file when i type the keywords on the search window.</p></li>
</ol>
<p>Is there any setting I missed? I can just find the official install instruction on google and no other detailed type.</p>
http://itensor.org/support/565/the-installing-problemFri, 09 Jun 2017 05:33:12 +0000expH for time evolution
http://itensor.org/support/556/exph-for-time-evolution
<p>Hi</p>
<p>I am facing a Segmentation fault error with the function expH (my goal is to simulate the dynamics of a spin boson hamiltonian with long-range interactions)</p>
<p>Please find below a minimal example which causes the crash:</p>
<p>It seems to be due to the interplay between the Complex argument Cplx<em>i + the flip-flip terms S</em>m S_m..</p>
<p>Thanks for your help</p>
<p>Benoit</p>
<p>int main(int argc, char* argv[])<br>
{<br>
auto sites = SpinHalf(3);<br>
auto ampo = AutoMPO(sites);<br>
ampo += "Sm",1,"Sm",2;<br>
ampo += "Sp",1,"Sp",2;<br>
ampo += "Sp",2,"Sp",3;<br>
ampo += "Sm",2,"Sm",3;<br>
auto H = MPO(ampo);<br>
PrintData(H);<br>
auto tau = 0.1;<br>
auto expH = toExpH(ampo,tau*Cplx_i);<br>
PrintData(expH);<br>
return 0;<br>
}<br>
~</p>
http://itensor.org/support/556/exph-for-time-evolutionFri, 02 Jun 2017 13:08:04 +0000Copying data from local tensor for creating density matrices from wave functions
http://itensor.org/support/553/copying-local-tensor-creating-density-matrices-functions
<p>Hello everybody, </p>
<p>my question is concerning the rewriting of a density matrix as a vector. I know how to construct an MPS with doubled length for the vectorized density matrix from a basis state (for example the Neel state for spin models) using InitState and direct initialization. Nevertheless, I have problems constructing this double-sized MPS |psi><psi| —> |psi>|psi> from a general, more complicated (larger bond dimension) state |psi> which I have in MPS-form, for example a ground state of some model obtained by DMRG.</p>
<p>Conceptually it is clear to me what to do, but I cannot find a good way to make a duplicate of local tensors A(i) of the wave function MPS |psi> in such a way, that the storage data is the same but the indices are new ones, i.e. they are different from the index set of the state they have been copied from so that one can distinguish the bra and ket part. I tried to use a doTask function to copy the data of the Dense data structure from the original tensor to a new created one, but didn’t really succeed with this. Is there maybe a better way to do this, or maybe an itensor function which I’ve overlooked and which could help here?</p>
<p>Any help is appreciated,<br>
Best,<br>
Stefan</p>
http://itensor.org/support/553/copying-local-tensor-creating-density-matrices-functionsThu, 01 Jun 2017 16:17:18 +0000Is it possible to multiply AutoMPO objects before converting to IQMPOs?
http://itensor.org/support/546/possible-multiply-autompo-objects-before-converting-iqmpos
<p>I want to be able to do something like</p>
<pre><code>auto A = AutoMPO(sites);
auto B = AutoMPO(sites);
//Add operators to A and B
auto C = A*B;
auto myIQMPO = IQMPO(C);
</code></pre>
<p>I want to be able to do this because I have operators A and B that don't individually conserve quantum numbers, but their product does. So I can't do something like</p>
<pre><code>auto A = AutoMPO(sites);
auto B = AutoMPO(sites);
//Add operators to A and B
auto myIQMPOA = IQMPO(A);
auto myIQMPOB = IQMPO(B);
IQMPO C;
nmultMPO(A,B,C);
</code></pre>
<p>because I can't construct the IQMPO of A and B individually. Additionally, experimenting with <code>nmultMPO</code>, I find that nmultMPO gives errors like </p>
<blockquote>
<p>scale too big, omitting from reported eigenvalues</p>
</blockquote>
<p>even when the product does have an efficient representation as a MPO. So I'd like to be able to construct products of AutoMPO operators directly.</p>
<p>Ultimately, I want to be able to take products like <code>A*B*C*D</code>, where A,B,C,D, are sums of a large number of local operators, so just figuring out what these products are in terms of <code>Cup</code>, <code>Cdn</code>, etc quickly gets prohibitively messy.</p>
<p>Is there any way to do this? Or is this feature something planned? Thanks!</p>
http://itensor.org/support/546/possible-multiply-autompo-objects-before-converting-iqmposThu, 25 May 2017 16:33:55 +0000How do I split one "sites" into several pieces or combine several "sites" to form a bigger "sites"?
http://itensor.org/support/541/split-sites-several-pieces-combine-several-sites-bigger-sites
<p>Hi Miles,</p>
<p>Is it possible to split one "sites" into several pieces or combine several "sites" to form a bigger "sites"? </p>
<p>For instance, I defined a SpinOne SiteSet "auto sites1 = SpinOne(N);", then I wanted "sites2" which is part of "sites1". How do I cut "sites1"? And if I have several parts of "sites1", how do I combine them into a new SiteSet? Thanks.</p>
<p>Jin</p>
http://itensor.org/support/541/split-sites-several-pieces-combine-several-sites-bigger-sitesMon, 22 May 2017 13:00:39 +0000About diagHermitian function
http://itensor.org/support/517/about-diaghermitian-function
<p>Hi Miles,</p>
<p>I'm trying to use the diagHermitian function. As a test I ran the following code:</p>
<pre><code>auto sx = sites.op("Sx",1);
auto sz = sites.op("Sz",1);
IQTensor U,D,U3,D3;
diagHermitian(sx,U,D);
PrintData(D);
diagHermitian(sz,U3,D3);
PrintData(D3);
</code></pre>
<p>While the result of sz is +/- 0.5, as expected, for sx I get +/+ 0.5. I also use PrintData to obtain the matrix element, see below. Apparently something is wrong here. I think this may have something to do with the QN system I define. What do you think about this? Thanks!</p>
<p>Best,<br>
Chengshu</p>
<p>sx = <br>
/--------------IQTensor--------------<br>
r=2 div=QN({1,2}) log(scale)=0<br>
IQIndex(S=1/2 1,2,Site|506) <br>
(Up 1,1,Site|592) QN({1,2})<br>
(Dn 1,1,Site|655) QN({0,2})</p>
<p>IQIndex(S=1/2 1,2,Site|506)' <br>
(Up 1,1,Site|592)' QN({1,2})<br>
(Dn 1,1,Site|655)' QN({0,2})</p>
<p>|-- Data -------<br>
QDense Real {2 blocks; data size 2}<br>
(Dn 1,1,Site|655) (Up 1,1,Site|592)'<br>
(2,1) 0.5000000<br>
(Up 1,1,Site|592) (Dn 1,1,Site|655)'<br>
(1,2) 0.5000000</p>
<p>------------------------------------</p>
<p>D = <br>
/--------------IQTensor--------------<br>
r=2 div=QN({0,2}) log(scale)=0<br>
IQIndex(d,2,Link|822)' <br>
(d0,1,Link|852)' QN({0,2})<br>
(d1,1,Link|832)' QN({1,2})</p>
<p>IQIndex(d,2,Link|822) <br>
(d0,1,Link|852) QN({0,2})<br>
(d1,1,Link|832) QN({1,2})</p>
<p>|-- Data -------<br>
QDiagReal<br>
(d0,1,Link|852)'QN({0,2}), (d0,1,Link|852)QN({0,2})<br>
(1,1) 0.5000000<br>
(d1,1,Link|832)'QN({1,2}), (d1,1,Link|832)QN({1,2})<br>
(2,2) 0.5000000</p>
<p>------------------------------------</p>
http://itensor.org/support/517/about-diaghermitian-functionThu, 18 May 2017 17:35:02 +0000Is it possible to export a state (density matrix) in matrix form in a given basis?
http://itensor.org/support/510/possible-export-state-density-matrix-matrix-form-given-basis
<p>I'm calculating time evolution in the Bose Hubbard model (using my own version of the hubbard site set). I would like to obtain the full state of my system in the Fock (number) basis at a given point to work further with it using different (Python) code. Is there an easy way to do this?</p>
http://itensor.org/support/510/possible-export-state-density-matrix-matrix-form-given-basisWed, 17 May 2017 16:42:09 +0000Contracting edge indices of MPS in infinite DMRG
http://itensor.org/support/500/contracting-edge-indices-of-mps-in-infinite-dmrg
<p>Hi Miles,</p>
<p>I have a question regarding the MPS in infinite DMRG calculations. When trying to compute the expectation of an operator O, there are two ways of contracting the edge indices, as shown in the figure (please forgive my drawing..)</p>
<p><img src="http://www.phas.ubc.ca/~chengshu/MPS.JPG" alt="MPS"></p>
<p>I think the lower one makes more sense, by definition of MPS, but the upper one is used in the sample codes. Also, the two methods give close but not exactly equal numerical results. Can you explain a little about the (in)equivalence thereof? Thanks!</p>
<p>Best,<br>
Chengshu</p>
<hr>
<p>Additional "experimental" fact</p>
<p><img src="http://www.phas.ubc.ca/~chengshu/mps1.png" alt="mps2"></p>
http://itensor.org/support/500/contracting-edge-indices-of-mps-in-infinite-dmrgSat, 13 May 2017 20:55:05 +0000Can you use a noise term with fitApplyMPO
http://itensor.org/support/496/can-you-use-a-noise-term-with-fitapplympo
<p>Hi there, </p>
<p>I am trying to use the fitApplyMPO method, however it seems to me that I only find a local minimum. My start state is a product state and after an arbitrary number of sweeps, I always get back a product state. The bond dimension of my IQMPS does not increase.</p>
<p>Then I saw that your fitApplyMPO also allows for a noise term, that is added when creating the svdBond. I gave it a try and it always crashes with a segmentation fault. </p>
<p>I was trying to understand what is going on and I am not so sure that a noise term makes sense at all here. </p>
<p>To my understanding, you need the "environment" to have a paired index, which is not the case anymore. In the fitApply concept, the environmental tensors have three bond indices: one from the MPS you are optimizing, one from the MPO, and one from the MPS you are applying the MPO to. The two MPS links can be completely different, which then causes the fitApplyMPO method to crash. </p>
<p>Is my understanding right? Does anybody have an idea how to fix that?</p>
<p>Lars</p>
http://itensor.org/support/496/can-you-use-a-noise-term-with-fitapplympoTue, 09 May 2017 14:49:07 +0000Entanglement entropy for a periodic chain
http://itensor.org/support/494/entanglement-entropy-for-a-periodic-chain
<p>Hi All,</p>
<p>I am very new of tensor network techniques and I have three very naive questions. I would like to measure the ground state entaglement entropy of an interval A that extends between the sites m and m+l of an XXZ chain and the rest fo the chain. I am interested in three cases:</p>
<p>1) The full chain has periodic boundary conditions<br>
2)The full chain has open boundary conditions.<br>
3)The full chain is infinite</p>
<p>How this can be done?</p>
<p>Thanks a lot!</p>
http://itensor.org/support/494/entanglement-entropy-for-a-periodic-chainMon, 08 May 2017 22:05:49 +0000Starting Initial State as product state of singlets
http://itensor.org/support/490/starting-initial-state-as-product-state-of-singlets
<p>Is there any way to construct the initial state so that it will be a product state of singlets??<br>
For example if I have 2N sites I want N singlets to initialize the state. </p>
http://itensor.org/support/490/starting-initial-state-as-product-state-of-singletsThu, 04 May 2017 08:52:17 +0000