ITensor Support Q&A - Recent questions
http://itensor.org/support/questions
Powered by Question2AnswerGround 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 +0000Segmentation fault when using combiner
http://itensor.org/support/489/segmentation-fault-when-using-combiner
<p>Hi, </p>
<p>I'm getting a segmentation fault when using a combiner in a contraction. </p>
<p>The specific example is: </p>
<p>combine = <br>
/--------------IQTensor--------------<br>
r=3 div=QN() log(scale)=0<br>
IQIndex(cmb,8,Link,854) <br>
(c0,1,Link,390) (Sz=-1,Nf=1)<br>
(c1,2,Link,985) (Sz=0,Nf=2)<br>
(c2,1,Link,906) (Sz=1,Nf=3)<br>
(c3,1,Link,69) (Sz=-2,Nf=2)<br>
(c4,2,Link,545) (Sz=-1,Nf=3)<br>
(c5,1,Link,386) (Sz=0,Nf=4)</p>
<p>IQIndex(d,2,Link,168) <br>
(d2,1,Link,997) (Sz=-1,Nf=1)<br>
(d3,1,Link,486) (Sz=0,Nf=2)</p>
<p>IQIndex(site=2,4,Site,268) <br>
(Emp 2,1,Site,200) (Sz=0,Nf=0)<br>
(Up 2,1,Site,598) (Sz=1,Nf=1)<br>
(Dn 2,1,Site,552) (Sz=-1,Nf=1)<br>
(UpDn 2,1,Site,867) (Sz=0,Nf=2)</p>
<p>|-- Data -------<br>
QCombiner <br>
------------------------------------</p>
<p>and the other tensor is: </p>
<p>drho = <br>
/--------------IQTensor--------------<br>
r=7 div=(Sz=-1,Nf=21) log(scale)=5.58209<br>
IQIndex(d,2,Link,168) <br>
(d2,1,Link,997) (Sz=-1,Nf=1)<br>
(d3,1,Link,486) (Sz=0,Nf=2)</p>
<p>IQIndex(L3,1,Link,377) <br>
(l3,1,Link,471) (Sz=0,Nf=4)</p>
<p>IQIndex(site=3,4,Site,172) <br>
(Emp 3,1,Site,898) (Sz=0,Nf=0)<br>
(Up 3,1,Site,547) (Sz=1,Nf=1)<br>
(Dn 3,1,Site,602) (Sz=-1,Nf=1)<br>
(UpDn 3,1,Site,151) (Sz=0,Nf=2)</p>
<p>IQIndex(d,2,Link,168) <br>
(d2,1,Link,997) (Sz=-1,Nf=1)<br>
(d3,1,Link,486) (Sz=0,Nf=2)</p>
<p>IQIndex(L1,1,Link,47) <br>
(l1,1,Link,932) (Sz=0,Nf=8)</p>
<p>IQIndex(MPOIndex,38,Link,584) <br>
(1st i=1,3,Link,248) (Sz=1,Nf=-1)<br>
(cst i=1,2,Link,101) (Sz=-1,Nf=-1)<br>
(cdagup i=1,2,Link,773) (Sz=-1,Nf=1)<br>
(cdagdn i=1,2,Link,670) (Sz=1,Nf=1)<br>
(3rd i=1,8,Link,749) (Sz=0,Nf=0)<br>
(RiNus<em>1,7,Link,17) (Sz=2,Nf=0)<br>
(PiNus</em>1,7,Link,534) (Sz=2,Nf=-2)<br>
(PiNds_1,7,Link,330) (Sz=0,Nf=-2)</p>
<p>IQIndex(site=2,4,Site,268) <br>
(Emp 2,1,Site,200) (Sz=0,Nf=0)<br>
(Up 2,1,Site,598) (Sz=1,Nf=1)<br>
(Dn 2,1,Site,552) (Sz=-1,Nf=1)<br>
(UpDn 2,1,Site,867) (Sz=0,Nf=2)</p>
<p>|-- Data -------<br>
QDense Real {7 blocks; data size 45}<br>
(d3,1,Link,486) (l3,1,Link,471) (UpDn 3,1,Site,151) (d3,1,Link,486) (l1,1,Link,932) (PiNus<em>1,7,Link,534) (Up 2,1,Site,598)<br>
(2,1,4,2,1,31,2) -1.8727<br>
(d3,1,Link,486) (l3,1,Link,471) (UpDn 3,1,Site,151) (d3,1,Link,486) (l1,1,Link,932) (PiNds</em>1,7,Link,330) (Dn 2,1,Site,552)<br>
(2,1,4,2,1,38,3) 2.21107<br>
(d3,1,Link,486) (l3,1,Link,471) (UpDn 3,1,Site,151) (d3,1,Link,486) (l1,1,Link,932) (1st i=1,3,Link,248) (UpDn 2,1,Site,867)<br>
(2,1,4,2,1,1,4) 265.153<br>
(2,1,4,2,1,2,4) -15.364<br>
(d3,1,Link,486) (l3,1,Link,471) (UpDn 3,1,Site,151) (d2,1,Link,997) (l1,1,Link,932) (PiNds_1,7,Link,330) (UpDn 2,1,Site,867)<br>
(2,1,4,1,1,38,4) -2.51961</p>
<p>------------------------------------</p>
<p>if I do drho = combine * drho, I get </p>
<p>Signal: Segmentation fault (11)<br>
Signal code: Address not mapped (1)<br>
Failing at address: 0x8</p>
<p>I hope anyone can help me. </p>
<p>Btw: This happens in the "deltaRho" method of the class "LocalOp" when using a noise term in "fitApplyMPO".</p>
<p>Best, <br>
Lars</p>
http://itensor.org/support/489/segmentation-fault-when-using-combinerWed, 03 May 2017 16:54:06 +0000Calculating energy expectation in infinite DMRG
http://itensor.org/support/485/calculating-energy-expectation-in-infinite-dmrg
<p>Hi Miles,</p>
<p>I am trying to calculate something like <psi|U^\dagger H U|psi> in infinite dmrg. As a first step I want to calculate <psi|H|psi> and compare it with the dmrg output. I tried the following code:</p>
<p>auto E = overlap(psi, H, psi);</p>
<p>and it doesn't work. I think it might have something to do with the "edge vectors" of the Hamiltonian as well as the MPS. What's the right way of handling this? Thanks!</p>
<p>Best,<br>
Chengshu</p>
http://itensor.org/support/485/calculating-energy-expectation-in-infinite-dmrgMon, 01 May 2017 22:28:54 +0000MixedIQTensor with complex coefficients not working ?
http://itensor.org/support/484/mixediqtensor-with-complex-coefficients-not-working
<p>Hello Miles,</p>
<p>I got an execution error with a code using MixedIQTensor with complex coefficients. The error is the following:</p>
<blockquote>
<p>terminate called after throwing and instance of 'ITerror'<br>
what(): doTask not defined for task CalcDiv and storage type QMixed< Cplx ><br>
Aborted</p>
</blockquote>
<p>Is there any physical reason why MixedIQTensor should not have complex coefficients ?</p>
<p>Additional information:<br>
This error arises when transforming AutoMPO into IQMPO. The MixedIQTensor with complex coefficients is defined in a new SystemSite class. Transformation to MPO works fine.</p>
<p>Best,</p>
<p>Samuel</p>
http://itensor.org/support/484/mixediqtensor-with-complex-coefficients-not-workingFri, 28 Apr 2017 21:35:53 +0000Installation on WIndows Cygwin
http://itensor.org/support/480/installation-on-windows-cygwin
<p>Hi, I am trying to install itensor on my Windows laptop with Cygwin. While it is working well with Mac machine, Windows installation keep showing following error:</p>
<p>make[1]: Entering directory '/ITENSOR/itensor'<br>
Compiling itensor/util/args.cc with optimizations<br>
util/args.cc:8:31: fatal error: itensor/util/args.h: No such file or directory<br>
compilation terminated.<br>
Failure while executing command: g++ -m64 -std=c++11 -c -I/ITENSOR -I/openblas/include -fpermissive -DHAVE<em>LAPACK</em>CONFIG<em>H -DLAPACK</em>COMPLEX<em>STRUCTURE -O2 -DNDEBUG -Wall -DPLATFORM</em>openblas -D<strong>ASSERT<em>MACROS</em>DEFINE<em>VERSIONS</em>WITHOUT<em>UNDERSCORES=0 -DPLATFORM</em>openblas -D</strong>ASSERT<em>MACROS</em>DEFINE<em>VERSIONS</em>WITHOUT_UNDERSCORES=0 -o util/args.o util/args.cc<br>
make[1]: *** [Makefile:57: util/args.o] Error 1<br>
make[1]: Leaving directory '/ITENSOR/itensor'<br>
make: *** [Makefile:14: itensor] Error 2</p>
<p>It seems the directory is not properly included with -I flag, but I cannot find why. I would greatly appreciate it if anybody can advise this.</p>
<p>Thank you!</p>
http://itensor.org/support/480/installation-on-windows-cygwinTue, 25 Apr 2017 20:08:05 +0000Installation problem
http://itensor.org/support/468/installation-problem
<p>I use Mac OS EL Capitan and installed Xcode. When I type "CCCOM=clang++ -std=c++11" into the terminal, it says command not found. And I checked my clang version, it seems to be clang 3.6 so it should support c++11 feature. I checked the files in the XcodeDefault.xctoolchain/usr/bin and "clang++" is a "Alias" file while "clang" is a "Unix executable" file. When I type "CCCOM=clang++" alone it seems to work and type "std=c++11" it also works. I don't know if "std=c++11" means the same operation as "-std=c++11". And when I tried to configure other terms I also encounter "command not found". Following is the command shown in my terminal. I doubt in which directory I should make the configurations?</p>
<p>x-10-104-121-90:itensor Alesa$ CCCOM=clang++ -std=c++11<br>
-bash: -std=c++11: command not found</p>
<p>x-10-104-121-90:itensor Alesa$ clang++ --version<br>
Apple LLVM version 7.0.2 (clang-700.1.81)</p>
<p>x-10-104-121-90:itensor Alesa$ BLAS<em>LAPACK</em>LIBFLAGS=-framework Accelerate<br>
-bash: Accelerate: command not found</p>
<p>And I tried the optional configuration:<br>
x-10-104-121-90:itensor Alesa$ OPTIMIZATIONS=-O2 -DNDEBUG -Wall<br>
-bash: -DNDEBUG: command not found</p>
http://itensor.org/support/468/installation-problemTue, 18 Apr 2017 16:27:59 +0000Generalized eigenvalue problem
http://itensor.org/support/467/generalized-eigenvalue-problem
<p>Hi,</p>
<p>Suppose that we are tring to solve a genralized eigenvalue problem, how can we solve it in ITensor by using lapack functions?</p>
<p>The Hamiltonain now is a 2n rank tensor, and the eigenvector is now a n rank tensor. Should we tranform the tensors into matrix or vector and invoke standard lapack functions? </p>
<p>What about other linear equations? There should be a generalized method to use lapack functions to solve these equations.</p>
<p>Thanks </p>
http://itensor.org/support/467/generalized-eigenvalue-problemMon, 17 Apr 2017 13:51:40 +0000About installing itensor library
http://itensor.org/support/464/about-installing-itensor-library
<p>I am trying to install itensor library in my ubuntu linux virtualbox. I followed all the instructions. After that, I run some sample code like <code>hello_itensor.cc</code> provided in ITensor Basics Quick Start. <br>
However, it keep showing error like LAPACK<em>INT has not been declared and LAPACK</em>REAL has not been declared.<br>
It seems like the identifier PLATFORM_lapack isn't defined so the <code>lapack_wrap.h</code> file is not working well. </p>
<p>Does it mean I didn't setup the options.mk properly? <br>
In options.mk BLAS/LAPACK Related Options, I set</p>
<pre><code>PLATFORM=lapack
BLAS_LAPACK_LIBFLAGS=-lpthread -L/usr/lib -lblas -llapack
</code></pre>
<p>OR is that because I didn't install lapack correctly?<br>
I followed the instruction from here<br>
<a rel="nofollow" href="https://astroiisc.wikispaces.com/Lapack+Installation+in+Ubuntu">https://astroiisc.wikispaces.com/Lapack+Installation+in+Ubuntu</a><br>
And I can see the files <code>liblapack.a liblapack.so liblapack.so.3 libblas.a libblas.so libblas.so.3</code> in the path <code>/usr/lib</code> .</p>
<p>Thanks!</p>
http://itensor.org/support/464/about-installing-itensor-librarySat, 15 Apr 2017 16:47:18 +0000Conversion of AutoMPO->IQMPO for PBC
http://itensor.org/support/463/conversion-of-autompo-iqmpo-for-pbc
<p>Hello Miles,</p>
<p>I've encountered a strange convergence issue with DMRG using periodic boundary conditions, and conservation of total Sz (iqdmrg). The system is the simple spin-1 AKLT model (I know, we wouldn't need to run GS DMRG on it ... !). Anyway, it appears that the following commands</p>
<pre><code>Args argsH = Args("Exact=",true);
IQMPO H = toMPO<IQTensor>(ampo,argsH);
</code></pre>
<p>lead to:<br>
1) incorrect evaluation of the energy of the initial state,<br>
2) no convergence of DMRG to the ground state.</p>
<p>I was using the two lines of code above instead of the simple</p>
<pre><code>IQMPO H = toMPO<IQTensor>(ampo);
</code></pre>
<p>because the latter displays "Using approx/svd conversion of AutoMPO->IQMPO".</p>
<p>My questions are the following:<br>
1) What is happening in the "exact" case ? How does <code>toMPO<IQTensor></code> work in that case ?<br>
2) In the "approx/svd conversion" case, is there a way to know how accurate is the compression of the Hamiltonian ? (in terms of singular values/truncation, for example)<br>
3) Is there a way to set a precision to this compression ?<br>
4) Why is the "exact" case not working on the AKLT Hamiltonian, but works fine for the Haldane chain ? Is it due to the additional biquadratic terms which make it hard to have an exact representation ? (the W-operator valued matrix (Schollwöck's notation) grows fast in this case, is that the reason ?)<br>
5) Finally, why does this behavior occur only when using the QN-conserving code ? (running DMRG without symmetry works fine with the "exact" conversion to MPO, using <code>MPO H = toMPO<ITensor>(ampo,argsH)</code>).</p>
<p>Thanks a lot, and have a nice Easter holiday !</p>
<p>Samuel</p>
http://itensor.org/support/463/conversion-of-autompo-iqmpo-for-pbcThu, 13 Apr 2017 23:02:04 +0000broadcast tensor or index
http://itensor.org/support/454/broadcast-tensor-or-index
<p>Hi,</p>
<p>I'm trying to use MPI to parallelize my codes. But I haven't found a proper way to broadcast a tensor or index among workers. Due to the complex structure of tensor in itensor, it's not easy to implement such tensor-broadcast functions efficiently.</p>
<p>Would someone share his/her idea on this issue?</p>
<p>Thanks<br>
Rui-Zhen</p>
http://itensor.org/support/454/broadcast-tensor-or-indexTue, 11 Apr 2017 16:14:38 +0000Obtaining eigenstates of reduced density matrix
http://itensor.org/support/446/obtaining-eigenstates-of-reduced-density-matrix
<p>Hi Miles,</p>
<p>In literature people often obtain eigenstates of reduced density matrix from a DMRG calculation (e.g. Cincio & Vidal, PRL 110, 067208 (2013)). While there is a nice code formula to calculate the entanglement spectrum, I couldn't find one for this seemingly different task. Is there a way of implemeting this calculation using ITensor? Thanks!</p>
<p>Best,<br>
Chengshu</p>
http://itensor.org/support/446/obtaining-eigenstates-of-reduced-density-matrixFri, 07 Apr 2017 22:47:40 +0000AutoMPO to IQMPO Error with user-defined siteset / four-body interactions
http://itensor.org/support/445/autompo-iqmpo-error-defined-siteset-four-body-interactions
<p>Hello,</p>
<p>I want to define a new siteset with two "colors" (A and B) of spin 1/2. We can assume that in a chain lattice odd sites=A and that even sites=B. In my system, @@S^z_\mathrm{tot}@@ of A and B spin is conserved separately. This also means that @@S^z_\mathrm{tot}(A+B)=S^z_\mathrm{tot}(A)+S^z_\mathrm{tot}(B)@@ is conserved.</p>
<p>Using the standard "SpinHalf" siteset would only lead to @@S^z_\mathrm{tot}(A+B)@@ conservation. So I've implemented a new one with two QNs where the only difference with the standard one is</p>
<pre><code>SpinHalfABSite(int n, Args const& args = Args::global())
{
if(n%2 == 1)
s = IQIndex{nameint("S=1/2 (A) ",n),
Index(nameint("Up ",n),1,Site),QN(+1, 0),
Index(nameint("Dn ",n),1,Site),QN(-1, 0)};
else
s = IQIndex{nameint("S=1/2 (B) ",n),
Index(nameint("Up ",n),1,Site),QN(0, +1),
Index(nameint("Dn ",n),1,Site),QN(0, -1)};
}
</code></pre>
<p>I think that at this point, it is correct. The problem is when I want to build an IQMPO through the AutoMPO builder for my specific Hamiltonian,</p>
<pre><code>auto ampo = AutoMPO(sites);
for(int i = 1; i < sites.N(); i += 2)
{
for(int j = 1; j < sites.N(); j += 2)
{
if(i < j)
{
ampo += 1.0,"S+",i,"S-",i+1,"S-",j,"S+",j+1;
ampo += 1.0,"S-",i,"S+",i+1,"S+",j,"S-",j+1;
}
}
}
auto ham = IQMPO(ampo);
</code></pre>
<p>where @@S^\alpha_{i,j}@@ acts on the A spins and @@S^\alpha_{i+1,j+1}@@ on the B ones. However, this leads to the following error,</p>
<pre><code>I = IQIndex(Hl4,2,Link,901) <Out>
(hl4_0,2,Link,628) QN()
qn = QN(-4,4)
From line 514, file iqindex.cc
IQIndex does not contain given QN block.
IQIndex does not contain given QN block.
Abort trap: 6
</code></pre>
<p>I do not get this error when working with only one color of spin (and the same Hamiltonian). The error happens inside the 'compressMPO' function, when making the compressed MPO for the fourth site (no matter the system size, it always happens at the fourth one).</p>
<p>I'm trying to figure out a bit more this part of the ITensor code but if you have any idea of what could be wrong!</p>
http://itensor.org/support/445/autompo-iqmpo-error-defined-siteset-four-body-interactionsWed, 05 Apr 2017 16:38:42 +0000Segmentation Fault in Calculation of Excited States?
http://itensor.org/support/441/segmentation-fault-in-calculation-of-excited-states
<p>Hi Miles,</p>
<p>I had a error when running the following code to calculate the exited state of a spin-1 chain,</p>
<pre><code>int N = 24;
auto sites = SpinOne(N);
Real J = 0.05;
auto ampo = AutoMPO(sites);
for(int j = 1; j <= N; ++j)
{
ampo += 0.5,"Sz2",j;
ampo += -0.5,"Sz",j;
}
for(int j = 1; j < N; ++j)
{
ampo += -J,"S+",j,"S-",j+1;
ampo += -J,"S+",j+1,"S-",j;
}
auto H = IQMPO(ampo);
auto sweeps = Sweeps(30);
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 state = InitState(sites);
for(int i = 1; i <= N; i++)
{
state.set(i, i <= N/2 ? "+" : "0");
}
auto psi0 = IQMPS(state);
auto en0 = dmrg(psi0,H,sweeps,{"Quiet=",true});
auto wfs = std::vector<IQMPS>(1);
wfs.at(0) = psi0;
auto psi1 = IQMPS(state);
auto en1 = dmrg(psi1,H,wfs,sweeps,{"Quiet=",true,"Weight=",20.0});
</code></pre>
<p>It always stops after calculating the ground state, with a message "Segmentation fault: 11". When I run it in debug mode, it says</p>
<p>"<br>
From line 87, file itensor_operators.cc</p>
<p>div(T1)=QN(24) must equal div(T2)=QN() when adding T1+T2</p>
<p>div(T1)=QN(24) must equal div(T2)=QN() when adding T1+T2<br>
Abort trap: 6<br>
"</p>
<p>This error looks wired for me because the code works for N <=22. I solved this problem by modifying the initial state </p>
<pre><code>for(int i = 1; i <= N; i++)
{
state.set(i, i%2 == 1 ? "+" : "0");
}
</code></pre>
<p>My questions,</p>
<ol>
<li><p>Why the former initial state would cause this error? </p></li>
<li><p>Why this error appear only for N >= 24? </p></li>
</ol>
<p>Many thanks for answering all these questions!</p>
<p>Jin</p>
http://itensor.org/support/441/segmentation-fault-in-calculation-of-excited-statesFri, 24 Mar 2017 17:59:09 +0000iDMRG stops at step 3
http://itensor.org/support/419/idmrg-stops-at-step-3
<p>Hi Miles,</p>
<p>I have been trying to do the iDMRG calculation using the idmrg function. </p>
<p>But every time the calculation stops at step 3 with the following in the terminal</p>
<p>iDMRG Step = 3, N=12 sites<br>
Initial energy = -9.74864055676848728638<br>
area(phi.front().inds()) = 81<br>
A.size() = 45369<br>
From line 99, file /home/sam/Desktop/itensor/itensor/itensor/eigensolver.h</p>
<p>davidson: size of initial vector should match linear matrix size</p>
<p>davidson: size of initial vector should match linear matrix size<br>
Aborted (core dumped)</p>
<p>I don't know if it is a problem in my code or not.</p>
<p>Many thanks in advance.</p>
<p>Sam</p>
http://itensor.org/support/419/idmrg-stops-at-step-3Fri, 17 Mar 2017 21:38:04 +0000How to restart iDMRG using the state "psi" from previous run?
http://itensor.org/support/410/how-to-restart-idmrg-using-the-state-psi-from-previous-run
<p>Hi Miles,</p>
<p>It is considerate of you to add a template in idmrg.h for "restarting idmrg calculations from a previous run". But I still cannot use it. Let me show you my code:</p>
<p>in my own idmrg.cc I wrote:</p>
<p><code>auto res = idmrg(psi, H, sweeps, { Args });
auto res2 = idmrg(psi, H, res, sweeps,{ Args});</code></p>
<p>The first idmrg runs well, but the second one cannot work—— it stops after printing sweeps and a line:</p>
<blockquote>
<p>Sweep=1, HS=1, Bond=(1,2)</p>
</blockquote>
<p>which comes from the first step of dmrg in this iDMRG, the exit without error messages. <br>
Could you spot any error here?</p>
<p>Thank you in advance.</p>
<p>Zhiyu</p>
http://itensor.org/support/410/how-to-restart-idmrg-using-the-state-psi-from-previous-runTue, 14 Mar 2017 15:46:00 +0000The idmrg is not working for topological state
http://itensor.org/support/407/the-idmrg-is-not-working-for-topological-state
<p>Putting bosonic complex hopping on Honeycomb lattice check paper (<a rel="nofollow" href="http://journals.aps.org/prl/abstract/10.1103/PhysRevLett.110.067208">http://journals.aps.org/prl/abstract/10.1103/PhysRevLett.110.067208</a> ), the result is not converging and the energy is increasing with each sweep and I am getting the eigenvalues of density matrix greater than one and so negative entanglement entropy. Again when taking real hopping without y-periodicity, for even sweep I am getting zero entanglement entropy, but non-zero for odd sweeps. I have the code if you want I can give you.</p>
<p>Thanks in advance.</p>
http://itensor.org/support/407/the-idmrg-is-not-working-for-topological-stateTue, 14 Mar 2017 11:09:04 +0000QN degeneracy caused "segmentation fault" for odd number of sites
http://itensor.org/support/406/degeneracy-caused-segmentation-fault-for-odd-number-sites
<p>Here by "QN" degeneracy I mean that two Index-QN pair defined in an IQIndex have the same QN (quantum number). For example, the following two pairs are degenerate :</p>
<pre><code>Index(nameint("pzm101",n),1,Site),QN({0,-1},{2,1},{0,1},{0,1})
Index(nameint("pzm020",n),1,Site),QN({0,-1},{2,1},{0,1},{0,1})
</code></pre>
<p>if such degeneracy appears in the definition of IQIndex, than "segmentation fault" might happen. I seems we can redefine a Index-QN pair with two sector:</p>
<pre><code>Index(nameint("pzm***",n),2,Site),QN({0,-1},{2,1},{0,1},{0,1})
</code></pre>
<p>But it may have problems when we try to define operators. On the other hand, QN only receive at most 4 slots, I can no longer add an additional quantum number to distinguish these two states.</p>
<p>Thank you.</p>
http://itensor.org/support/406/degeneracy-caused-segmentation-fault-for-odd-number-sitesMon, 13 Mar 2017 08:16:20 +0000Calculating excited states in infinite DMRG
http://itensor.org/support/399/calculating-excited-states-in-infinite-dmrg
<p>Hi Miles,</p>
<p>I'm trying to do excited states calculation in infinite DMRG. A naïve adaption of the sample code from <a rel="nofollow" href="http://itensor.org/docs.cgi?page=formulas/excited_dmrg">http://itensor.org/docs.cgi?page=formulas/excited_dmrg</a> does not work, which I copy below:</p>
<pre><code>auto psi = MPS(state);
auto res = idmrg(psi,H,sweeps,{"OutputLevel",1});
auto wfs = std::vector<MPS>(1);
wfs.at(0) = psi;
auto psi1 = MPS(state);
auto res1 = idmrg(psi1,H,wfs,sweeps,{"OutputLevel",1,"Weight",20.0});
</code></pre>
<p>What is the correct way of doing this? Thanks very much!</p>
<p>Best,<br>
Chengshu</p>
http://itensor.org/support/399/calculating-excited-states-in-infinite-dmrgSun, 12 Mar 2017 04:01:04 +0000Trotter Gates with PBC?
http://itensor.org/support/398/trotter-gates-with-pbc
<p>Hi All,</p>
<p>Is it possible to time-evolve a MPS with trotter gates including a gate connecting the 1st and the last sites? I think the main difficulty is how to effectively compress MPS each time after applying a gate. Because there's no orthogonality center for MPS with PBC. Is there a way to overcome this difficulty? Thanks very much.</p>
<p>Jin</p>
http://itensor.org/support/398/trotter-gates-with-pbcSat, 11 Mar 2017 11:51:19 +0000