ITensor Support Q&A - Recent questions and answers
http://itensor.org/support/qa
Powered by Question2AnswerAnswered: Can you calculate the ground-state fidelity using DMRG?
http://itensor.org/support/1140/can-you-calculate-the-ground-state-fidelity-using-dmrg?show=1141#a1141
<p>Hi, so yes you can calculate the fidelity and the way you are doing it (using overlap between two MPS) is correct.</p>
<p>I'm not sure why you are getting incorrect results. It could be due to many various reasons including an error in constructing your Hamiltonian; insufficient convergence of DMRG; poor selection of initial states; finite size effects; etc. </p>
<p>I'd recommend studying a particular set of Hamiltonian parameters in detail, trying out different numbers of sweeps and looking at the convergence of the MPS by looking closely at the reported truncation error, for example. Then if you are still getting an incorrect fidelity for that particular Hamiltonian you will be in a better position to assess why it's happening.</p>
<p>Please let me know if I can be of more help, like if you suspect there is an issue with one of the ITensor routines. </p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1140/can-you-calculate-the-ground-state-fidelity-using-dmrg?show=1141#a1141Sun, 18 Nov 2018 17:05:56 +0000MPI and disorder average
http://itensor.org/support/1139/mpi-and-disorder-average
<p>Hi,</p>
<p>I like to make my code parallel in order to do some disorder averaging . I used openmp but getting segmentation fault error whenever using more than one thread. <br>
I looked into the discussion section of itensor and found :<br>
<a rel="nofollow" href="http://itensor.org/support/837/possible-several-processes-parallel-without-segmentation">http://itensor.org/support/837/possible-several-processes-parallel-without-segmentation</a></p>
<p>It seems that, there is an issue using openMP in itensor. Is there any other way to make my code parallel? </p>
<p>Thanks in advance!</p>
<p>Ranjan</p>
http://itensor.org/support/1139/mpi-and-disorder-averageWed, 14 Nov 2018 14:56:13 +0000Constraints with Bosons
http://itensor.org/support/1138/constraints-with-bosons
<p>Hi everyone,</p>
<p>I have implemented in iTensor a very simple hard-core boson Hamiltonian (only one-site terms), using the SiteSet "Spinless.h". Now, for my model I have to implement two <strong>constraints</strong>: </p>
<p>1) <em>n<em>{i} * n</em>{i+1} = 0</em> (bosons cannot sit on neighboring sites)<br>
2) <em>n<em>{i-1} * n</em>{i+1} = 0</em> (bosons cannot sit at a distance of 2 lattice sites). </p>
<p>where <em>n_{i}</em> is the density (i.e. occupation number) on the lattice site i. </p>
<p>What is the best strategy to do this (apart from introducing energy penalties with extra-terms in the Hamiltonian)? I would like to implement directly this "physical" sub-space. </p>
<p>Thank you in advance.</p>
http://itensor.org/support/1138/constraints-with-bosonsTue, 13 Nov 2018 12:41:07 +0000Answered: time evolution of singlet state using iTEBD ?
http://itensor.org/support/1133/time-evolution-of-singlet-state-using-itebd?show=1137#a1137
<p>Hi, so this isn't provided inside of the ITensor library, but there is a user-contributed iTEBD code based on ITensor.</p>
<p>For a link to it, please see this page:</p>
<p><a rel="nofollow" href="http://itensor.org/codes.html">http://itensor.org/codes.html</a></p>
http://itensor.org/support/1133/time-evolution-of-singlet-state-using-itebd?show=1137#a1137Mon, 12 Nov 2018 18:47:33 +0000Answered: Problem with framework Accelerate
http://itensor.org/support/1134/problem-with-framework-accelerate?show=1135#a1135
<p>Dear Giuseppe,<br>
I can't say whether this issue will affect the working of ITensor, but fortunately there is a fix for it, so I'd recommend doing the fix then recompiling ITensor (and hopefully then you won't see the warnings). Here is a link explaining the fix:</p>
<p><a rel="nofollow" href="http://sd.jtimothyking.com/2018/07/26/stub-file-and-library-file-out-of-sync/">http://sd.jtimothyking.com/2018/07/26/stub-file-and-library-file-out-of-sync/</a></p>
<p>Finally, if you can get Intel MKL I'd strongly recommend that over Apple Accelerate / VecLib. MKL now has a free license. The reason I recommend it is that I've found some cases over the years where Accelerate gives less accurate results than MKL on certain tough cases (matrix decompositions involving small numbers etc.) and as a bonus, MKL is also much faster.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1134/problem-with-framework-accelerate?show=1135#a1135Mon, 12 Nov 2018 15:35:14 +0000Answered: Error message regarding the operator Sx2 (SpinTwo siteset)
http://itensor.org/support/1127/error-message-regarding-the-operator-sx2-spintwo-siteset?show=1130#a1130
<p>Hi, thanks for the question. So the issue is a rather technical one and has to do with a tricky design issue we have with using a single site set type for both ITensor and IQTensor tensor types. We have a plan to fix this more deeply in the library, but for now you have to do the following steps:</p>
<ol>
<li><p>when defining an operator such as Sx^2 inside your site set, add the line<br>
Op = mixedIQTensor(dag(s),sP);<br>
before setting the elements of your operator. See the file itensor/mps/sites/spinhalf.h and where the "Sx" operator is defined for an example.</p></li>
<li><p>when retrieving your operator from the sites.op("Sx2",j) method, make sure to convert it to an ITensor</p></li>
</ol>
<p>You will need to use ITensors, and not IQTensors, to work with operators such as Sx^2 in your own code since such an operator does not conserve the total Sz quantum number.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1127/error-message-regarding-the-operator-sx2-spintwo-siteset?show=1130#a1130Tue, 06 Nov 2018 16:02:32 +0000Answered: Superposed states with IQTensor
http://itensor.org/support/1126/superposed-states-with-iqtensor?show=1128#a1128
<p>Hi Titas,<br>
Thanks for the question. My initial reaction is that this just isn't what the IQTensor system is intended for. What you are asking for is to create a state which doesn't have well-defined quantum numbers but still use tensors which keep track of the (non-existent) quantum numbers. Such tensors would not be block-sparse in your case so all of the extra IQTensor bookkeeping, even if it was allowed, would just slow down the code for no advantage.</p>
<p>I hope that answer is helpful. Are you ok with just using ITensors and MPS for your case rather than IQTensors and IQMPS?</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1126/superposed-states-with-iqtensor?show=1128#a1128Mon, 05 Nov 2018 17:26:50 +0000Answered: IDMRG implementation (tensor diagrams)
http://itensor.org/support/1124/idmrg-implementation-tensor-diagrams?show=1125#a1125
<p>Hi, so the ITensor iDMRG code is based on this paper by McCulloch:<br>
<a rel="nofollow" href="https://arxiv.org/abs/0804.2509">https://arxiv.org/abs/0804.2509</a></p>
<p>It follows the main steps of the algorithm, but uses a different (yet equivalent) form of the growing step / ansatz for the new unit cell. </p>
<p>An alternative approach to infinite DMRG which you might be interested in implementing instead, since it can give much faster convergence for challenging systems, is the "VUMPS" algorithm described in this paper:<br>
<a rel="nofollow" href="https://arxiv.org/abs/1701.07035">https://arxiv.org/abs/1701.07035</a></p>
http://itensor.org/support/1124/idmrg-implementation-tensor-diagrams?show=1125#a1125Tue, 23 Oct 2018 20:09:49 +0000Answered: How to run an itensor program in Ubuntu?
http://itensor.org/support/1110/how-to-run-an-itensor-program-in-ubuntu?show=1112#a1112
<p>Hi, so to install ITensor please follow the steps here:<br>
<a rel="nofollow" href="http://itensor.org/docs.cgi?page=install">http://itensor.org/docs.cgi?page=install</a></p>
<p>It's important to install and have available a BLAS/LAPACK distribution. The recommended and best one is Intel MKL (which is now free for academics) but also Ubuntu offers a distribution (lapack-devel package). </p>
<p>Then there are sample programs in the sample/ folder and a project template you can use to write and compile your own code in tutorial/project_template .</p>
<p>More info here:<br>
<a rel="nofollow" href="http://itensor.org/docs.cgi?page=formulas/driver">http://itensor.org/docs.cgi?page=formulas/driver</a></p>
http://itensor.org/support/1110/how-to-run-an-itensor-program-in-ubuntu?show=1112#a1112Sun, 21 Oct 2018 17:28:45 +0000Answered: Time evolution of MPS long range Hamiltonian.
http://itensor.org/support/1099/time-evolution-of-mps-long-range-hamiltonian?show=1100#a1100
<p>Hi, yes I have also found that MPO based evolution is less well behaved than other types (e.g. Trotter). </p>
<p>Could you say, though, what isn't working very well? Is it exactApplyMPO itself or the approximation of exp(-iHt) as an MPO? Does not working well mean that your results are not accurate or that it is too slow? How much have you explored the effects of choosing smaller and larger time steps? I'm asking in part so we can keep tabs on which parts of ITensor can be improved.</p>
<p>Within the approach of using an MPO approximation for the time evolution operator, I'm not sure the exact approach you are using but there may be some additional tricks which you haven't tried, such as using two complex time steps instead of one purely real or imaginary time step to get a better scaling with the time step size. (See <a rel="nofollow" href="https://arxiv.org/abs/1407.1832">https://arxiv.org/abs/1407.1832</a> for details.)</p>
<p>As far as other methods, yes the TDVP method (which is also similar to the older "time step targeting" methods) and I believe the Krylov method can handle long-range interactions since they can be formulated in terms of an MPO for the Hamiltonian directly (rather than an MPO approximation of the time-evolution operator). </p>
<p>Unfortunately ITensor doesn't currently have a TDVP, time-step targeting, or Krylov implementaion, but it does have all of the necessary pieces for you to write your own. I'm hoping someone will contribute such a code. Otherwise we will eventually post our own but we aren't working with these methods currently.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1099/time-evolution-of-mps-long-range-hamiltonian?show=1100#a1100Sat, 06 Oct 2018 16:41:46 +0000Answered: How to quickly implement dynamical block state selection
http://itensor.org/support/1086/how-to-quickly-implement-dynamical-block-state-selection?show=1098#a1098
<p>I'm going to start implementing this, and if I get a clean looking code put together I'll add it to ITensor on github (although I am slow at programming).</p>
http://itensor.org/support/1086/how-to-quickly-implement-dynamical-block-state-selection?show=1098#a1098Sun, 30 Sep 2018 01:16:22 +0000Answered: A few questions about MPS class, PBC, and dmrg
http://itensor.org/support/1094/a-few-questions-about-mps-class-pbc-and-dmrg?show=1096#a1096
<p>Hi Titas,<br>
1. The algorithm hasn’t been formally published anywhere yet, but is discussed in words sometimes in various papers (not enough for most people to know of it of course. Here is a link to a new website I’m working on which describes this and other algorithms:<br>
<a rel="nofollow" href="http://tensornetwork.org/mps/index.html#compression">http://tensornetwork.org/mps/index.html#compression</a></p>
<ol>
<li><p>I don’t recommend using periodic MPS. No efficient and/or reliable algorithms are known for them, basically. For most purposes you can use finite open-boundary or infinite algorithms. Here is an article I wrote about it: <br>
<a rel="nofollow" href="http://itensor.org/docs.cgi?page=articles/periodic">http://itensor.org/docs.cgi?page=articles/periodic</a></p></li>
<li><p>Yes we are planning to add single site DMRG but don’t have support for it yet. </p></li>
</ol>
<p>Best regards, Miles</p>
http://itensor.org/support/1094/a-few-questions-about-mps-class-pbc-and-dmrg?show=1096#a1096Thu, 27 Sep 2018 14:18:09 +0000Answered: Entanglemnet spectrum in spin-1 chain
http://itensor.org/support/1087/entanglemnet-spectrum-in-spin-1-chain?show=1090#a1090
<p>Yes, you can use finite system DMRG to analyze the entanglement spectrum of SPT phases. These are systems with a finite correlation length, so if the system size exceeds the correlation length then the bulk behavior should generally be the same as for an infinite system. (Of course there can be exceptions, such as if the system breaks a symmetry yet the state is a superposition of two or more symmetry broken ground states.)</p>
<p>I would not be surprised if the precise values you get do have some finite-size and finite-sweep effects that make them not exactly identical to other reported values. The key thing of course is that you should see agreement with converged infinite values in the limit of taking larger and larger system sizes and converging your calculation to a more accurate level.</p>
<p>Best regards,<br>
Miles</p>
<p>P.S. I didn't see any numerical values reported in the PRB article you mentioned? Where do they appear in the article?</p>
http://itensor.org/support/1087/entanglemnet-spectrum-in-spin-1-chain?show=1090#a1090Wed, 26 Sep 2018 15:14:05 +0000Answered: davidson() for ITensor
http://itensor.org/support/1088/davidson-for-itensor?show=1089#a1089
<p>Hi Titas,<br>
Yes that is exactly right. I'll make a note that we need to document the davidson function on the website to especially mention this information. (Before I had been thinking of it as a low level / internal function but it could indeed be useful for users such as yourself to take advantage of it.)</p>
<p>Thanks for the post which will be helpful to others wanting to implement this same thing.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1088/davidson-for-itensor?show=1089#a1089Wed, 26 Sep 2018 15:08:42 +0000Answered: How to Determine the Convergence
http://itensor.org/support/761/how-to-determine-the-convergence?show=1084#a1084
<p>Also, I have the related question: How is the truncation value used when it is defined in a sweeps object? If I remember correctly, in a given sweep, M is fixed and the energy precision takes precedent over truncation error in determining when a set of sweeps is terminated. The result is that the sweeps might stop before the minimum truncation error is reached if the energy precision is reached first. Is it simple the first of the two that determines when a set of sweeps terminates -- i.e. either dE or trunc?</p>
<p>Thanks!</p>
<p>Jon</p>
http://itensor.org/support/761/how-to-determine-the-convergence?show=1084#a1084Tue, 25 Sep 2018 02:14:51 +0000Wavefunction projection into fixed particle number subsectors
http://itensor.org/support/1081/wavefunction-projection-fixed-particle-number-subsectors
<p>Hi Miles,</p>
<p>iTensor is amazing! I haven’t played with it since we were all in Sherbrooke and I’m blown away by the examples and how simple it is to get something useful up and running. I think my question arises from a lack of understanding of IQIndex and IQMPS. </p>
<p>I’m thinking about spinless fermions with nearest neighbor interactions, i.e.:</p>
<pre><code>N = 8;
auto sites = Spinless(N,{"ConserveNf",true});
AutoMPO ampo(sites);
for(int j = 1; j < N;++j)
{
ampo += -1.0,"Cdag",j,"C",j+1;
ampo += -1.0,"Cdag",j+1,"C",j;
ampo += 0.765,"N",j+1,"N",j;
}
auto H = IQMPO(ampo);
</code></pre>
<p>After getting the ground state as per the <a rel="nofollow" href="https://github.com/ITensor/ITensor/blob/master/sample/iqdmrg.cc">https://github.com/ITensor/ITensor/blob/master/sample/iqdmrg.cc</a> sample code:</p>
<pre><code>auto state = InitState(sites);
for(int i = 1; i <= N; ++i)
{
if(i%2 == 0) state.set(i,"Emp");
else state.set(i,"Occ");
}
auto psi = IQMPS(state);
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;
auto energy = dmrg(psi,H,sweeps,"Quiet");
</code></pre>
<p>I’m trying to figure out if it is possible to compute the entanglement entropy for “each local particle number block” i.e. I know that the reduced density matrix must commute with the particle number operator for the spatial subregion n, so ρA is block diagonal in n. </p>
<p>Is there a way to use IQIndex or 'Proj' to get the wavefunction projected into a fixed number of particles subsector in the subregion (corresponding to 1/2 the sites)?</p>
<p>Thanks in advance for any help!</p>
<p>Best,<br>
Adrian.</p>
http://itensor.org/support/1081/wavefunction-projection-fixed-particle-number-subsectorsSun, 23 Sep 2018 22:05:58 +0000Answered: Cannot find libiomp5 & libpthread in MKL library
http://itensor.org/support/1079/cannot-find-libiomp5-%26-libpthread-in-mkl-library?show=1080#a1080
<p>Hi, so the exact flags you have to use varies with different installations of MKL and different versions unfortunately. On our cluster at my office, I have to include also some headers associated with the Intel compiler to get MKL to work properly (though I don't believe this is necessary in general).</p>
<p>As you can see in your mkl/lib/intel64 folder, there are no libiomp5.so and libpthread.so files so that's the immediate reason why you're getting the error. As to where these files actually are on your system, that sort of depends.</p>
<p>A very useful thing to do can be to use the Intel "Link Line Advisor" website which asks you some questions about your system then recommends linker flags:</p>
<p><a rel="nofollow" href="https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor">https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor</a></p>
<p>Hope that helps -</p>
<p>Miles</p>
http://itensor.org/support/1079/cannot-find-libiomp5-%26-libpthread-in-mkl-library?show=1080#a1080Wed, 19 Sep 2018 02:01:41 +0000Answered: A potential low level bug with MPS class
http://itensor.org/support/1065/a-potential-low-level-bug-with-mps-class?show=1075#a1075
<p>Hi, thanks for the report - could you please email me a code that reproduces the issue? (Ideally with the minimal amount of code and running time to still see the issue.) Otherwise I don't know if I'll be able to see where it could be happening since I haven't been observing this behavior. </p>
<p>Thanks!</p>
<p>Miles</p>
http://itensor.org/support/1065/a-potential-low-level-bug-with-mps-class?show=1075#a1075Sun, 16 Sep 2018 01:58:10 +0000Is it possible to use toExpH more-than-two-operator terms ?
http://itensor.org/support/1071/is-it-possible-to-use-toexph-more-than-two-operator-terms
<p>If not. Can one suggest something which can be implemented using itensor library.</p>
<p>THanks.</p>
http://itensor.org/support/1071/is-it-possible-to-use-toexph-more-than-two-operator-termsFri, 14 Sep 2018 18:49:41 +0000Answered: Exponentiating autompo with 3-site operators
http://itensor.org/support/1062/exponentiating-autompo-with-3-site-operators?show=1063#a1063
<p>Hi, so AutoMPO's containing more than two-site operators cannot currently be exponentiated using the toExpH feature. It is a feature we'd like to add soon.</p>
<p>If you definitely need to time evolve a Hamiltonian with more than two-site terms, then an alternative could be to use a "time step targeting" method such as TDVP or the method described in this paper:<br>
<a rel="nofollow" href="https://arxiv.org/abs/1706.09537">https://arxiv.org/abs/1706.09537</a></p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1062/exponentiating-autompo-with-3-site-operators?show=1063#a1063Wed, 05 Sep 2018 21:49:54 +0000Answered: Which tensor library to use?
http://itensor.org/support/1052/which-tensor-library-to-use?show=1060#a1060
<p>Hi Xaver,<br>
I think this is a good question. I can't really speak with much knowledge about the others besides ITensor, except to say that Uni10 and TenPy are also good choices. TensorOperations in Julia may also be a reasonable choice. The main difference between these are probably:<br>
(1) which language they are in (C++ for ITensor, Uni10; python for TenPy; Julia for TensorOperations; etc.)<br>
(2) availability of certain operations you might need, such as quantum numbers and certain advanced tensor "index merging/folding" operations etc.<br>
(3) how much they make you deal with lower-level details, such as the ordering of indices and reshaping of tensors</p>
<p>For #1, this is a big difference so you'll have to decide what language you're most comfortable using. My feeling is that while python is easy to learn, later on you'll be frustrated by bugs that keep occurring and are hard to find and by parts of the code that will be slow and will be hard to speed up without putting in pieces of C/C++. Julia is great and I would recommend that language unreservedly. C++ is also good, but has a steep learning curve for the more advanced sort of features. However, if you write C++ similar to how you'd write python or Julia there is a subset of modern C++ that is nice and fairly easy to use.</p>
<p>For #2 you'll have to check the status of each library yourself. I think quantum numbers are particularly easy to work with and nicely handled in ITensor, and less so in some other libraries I've seen. But this may have changed. Also you might be more focused on other features. </p>
<p>For #3, this is where ITensor particularly excels. You hardly ever have to think about the ordering of indices and you never have to reshape a tensor. These details can be quite a pain in more sophisticated algorithms beyond MPS algorithms. One concern that more advanced people I know had about ITensor was that for PEPS, sometimes it's quite important to control the order of indices so as to avoid extra reshaping during the contraction step. But ITensor now offers a .order(...) method that lets you change the index ordering for cases like PEPS codes. So if you find this is an issue for you when trying ITensor, we can discuss and I can help you to make this no longer an issue.</p>
<p>So in summary I think ITensor would be quite a good choice for writing a PEPS code, provided that you are comfortable using C++. I would say also to check out Uni10, which is aimed at 2D tensor networks specifically, and also TenPy which is written by some top people in the field of tensor networks. TensorOperations in Julia is reasonable too if you want to do a lot "by hand" with the other features using Julia built-in tensor manipulations. TNT and the others I'm less knowledgeable about but hopefully someone else can say something about them here.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1052/which-tensor-library-to-use?show=1060#a1060Wed, 05 Sep 2018 14:45:56 +0000Answered: Is there a simple way to calculate bipartite entanglement entropy for 2D system?
http://itensor.org/support/1058/there-simple-calculate-bipartite-entanglement-entropy-system?show=1059#a1059
<p>Hi, so yes you can calculate this kind of entanglement (I assume you mean using DMRG to first compute a ground-state MPS of a 2D system?). </p>
<p>The way to do it is to arrange the numbering of your sites to first visit every site in the left half of your system, then every site in the right half. If you do the "zig zag" path of an MPS through a 2D cylinder or rectangle this property will already be fulfilled.</p>
<p>Then simply compute the entanglement entropy the same way you would for a 1D system, cutting on the bond that separates the two halves of your system.</p>
<p><a rel="nofollow" href="http://itensor.org/docs.cgi?page=formulas/entanglement_mps">http://itensor.org/docs.cgi?page=formulas/entanglement_mps</a></p>
<p>Here are some related questions and answers:<br>
<a rel="nofollow" href="http://itensor.org/support/74/how-to-define-and-implement-a-zig-zag-chain?show=80#a80">http://itensor.org/support/74/how-to-define-and-implement-a-zig-zag-chain?show=80#a80</a><br>
<a rel="nofollow" href="http://itensor.org/support/580/entanglement-entropy-of-2d-mps?show=580#q580">http://itensor.org/support/580/entanglement-entropy-of-2d-mps?show=580#q580</a></p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1058/there-simple-calculate-bipartite-entanglement-entropy-system?show=1059#a1059Wed, 05 Sep 2018 14:36:36 +0000Answered: AutoMPO for fermions and DMRG
http://itensor.org/support/1054/autompo-for-fermions-and-dmrg?show=1055#a1055
<p>Hi, it looks like your Hamiltonian is not Hermitian for <code>ampo</code>. That's probably why its different every time you run it. Assuming you directly copied and pasted:</p>
<pre><code>ampo += -1.0,"Cup",b,"Adagup",b+1;
</code></pre>
<p>is the offending line. The <code>Adagup</code> should be <code>Cdagup</code></p>
<p>Once you fix that, they still don't agree and that's because you didn't write your C operators in normal ordering, so they are off by a commutator I think? When I do</p>
<pre><code>ampo += -1.0,"Cdagup",b,"Cup",b+1; //Hopping for spin up
ampo += -1.0,"Cdagup",b+1,"Cup",b; // <-
ampo += -1.0,"Cdagdn",b,"Cdn",b+1; //Hopping for spin down
ampo += -1.0,"Cdagdn",b+1,"Cdn",b;// <-
</code></pre>
<p>I get the same value for both cases using this change</p>
http://itensor.org/support/1054/autompo-for-fermions-and-dmrg?show=1055#a1055Thu, 30 Aug 2018 19:59:02 +0000Answered: Compare two (same rank) tensors
http://itensor.org/support/1050/compare-two-same-rank-tensors?show=1053#a1053
<p>Hi, good question. So first of all it's a good thing that ITensor throws an error here, because in a general case one shouldn't be able to add or subtract tensors with different indices.</p>
<p>But we've been needing a feature for a while that will conveniently replace indices with equivalent ones. A key use case would be making an operator once, then "sliding" it down a chain of sites.</p>
<p>So I added a function just now to ITensor called "reindex". Here is the documentation for it:<br>
<a rel="nofollow" href="http://itensor.org/docs.cgi?page=classes/itensor#reindex">http://itensor.org/docs.cgi?page=classes/itensor#reindex</a></p>
<p>You can use it in your case by replacing T2 by reindex(T2,s2,s1) in your norm calculation. (Also no need for the separate -1*T2; it's ok to subtract ITensors, once they have the same indices.)</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1050/compare-two-same-rank-tensors?show=1053#a1053Wed, 29 Aug 2018 21:52:24 +0000Time Evolving Kagome Heisenberg AF Ground State
http://itensor.org/support/1051/time-evolving-kagome-heisenberg-af-ground-state
<p>I'm trying to perform real-time evolution of the Heisenberg anti-ferromagnet on a Kagome lattice using fitApplyMPO. When I try to do this with a spin-half chain I don't get any errors. For the kagome lattice, the Hamiltonian I generate gives me a reasonable ground state so I think the problem isn't in the MPO itself. Furthermore, I also don't get errors (even in debug mode) when I do </p>
<pre><code>auto expH = toExpH<ITensor>(aH, tau*Cplx_i);
</code></pre>
<p>The problem only occurs during this line:</p>
<pre><code>psi = fitApplyMPO(psi, expH, args);
</code></pre>
<p>This is the error I get:</p>
<pre><code>terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
</code></pre>
<p>Any idea what is going on? I'm confused because this exact code works for a spin chain and the Hamiltonian itself, which is the only thing that is different, isn't causing issues directly.</p>
<p>Thanks in advance for the help!</p>
http://itensor.org/support/1051/time-evolving-kagome-heisenberg-af-ground-stateWed, 29 Aug 2018 06:42:34 +0000Answered: Compiling for multithreading
http://itensor.org/support/1043/compiling-for-multithreading?show=1049#a1049
<p>Hi Josh,<br>
So currently the only part of ITensor that uses multithreading is when ITensor makes calls to BLAS dgemm (and in some cases zgemm) for performing tensor contractions. When the contracted tensors are sufficiently large, BLAS libraries like MKL will automatically use multi-threading to speed them up.</p>
<p>So if you are using a good BLAS library such as MKL and you do calculations involving large tensors, you should see a speedup when you leave OMP<em>NUM</em>THREADS or set it to a larger value versus setting OMP<em>NUM</em>THREADS=1. </p>
<p>If you aren't seeing a speedup, it could be because the tensors involved in your code are not quite large enough, or your code's running time isn't dominated by tensor contractions.</p>
<p>In the future we plan to exploit multithreading more within ITensor itself.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1043/compiling-for-multithreading?show=1049#a1049Wed, 15 Aug 2018 21:23:08 +0000Answered: FQHE in iTensor?
http://itensor.org/support/1044/fqhe-in-itensor?show=1048#a1048
<p>Hi, good question. So this should certainly be possible to do with ITensor. The way to handle the momentum quantum number should be that label the allowed y-periodic momenta by integers, then create a "slot" in the QNs which you set up to have a Z<em>N addition rule, where N is the maximum allowed momentum (dependent on the transverse system size L</em>y of course).</p>
<p>This paper which you've probably seen has some helpful details:<br>
<a rel="nofollow" href="https://arxiv.org/abs/1512.03318">https://arxiv.org/abs/1512.03318</a></p>
<p>To set up the QNs, you can do something like this:</p>
<p>First site IQIndex along a column of your cylinder (qn values are spin, charge, momentum):</p>
<pre><code>IQIndex("S1",Index("e1",1),QN({0,1},{0,-1},{0,Nmax}),
Index("up1",1),QN({1,1},{1,-1},{0,Nmax}),
Index("dn1",1),QN({-1,1},{1,-1},{0,Nmax}),
Index("ud1",1),QN({0,1},{2,-1},{0,Nmax}))
</code></pre>
<p>Second site IQIndex</p>
<pre><code>IQIndex("S1",Index("e1",1),QN({0,1},{0,-1},{1,Nmax}),
Index("up1",1),QN({1,1},{1,-1},{1,Nmax}),
Index("dn1",1),QN({-1,1},{1,-1},{1,Nmax}),
Index("ud1",1),QN({0,1},{2,-1},{1,Nmax}))
</code></pre>
<p>To understand the notation inside the QN better, see the QN documentation page:<br>
<a rel="nofollow" href="http://itensor.org/docs.cgi?page=classes/qn">http://itensor.org/docs.cgi?page=classes/qn</a></p>
http://itensor.org/support/1044/fqhe-in-itensor?show=1048#a1048Wed, 15 Aug 2018 03:30:15 +0000Answered: How do I use iTEBD for disordered Heisenberg spin chain ( to study dynamics in Many Body Localized systems) in ITensor?
http://itensor.org/support/1045/disordered-heisenberg-dynamics-localized-systems-itensor?show=1046#a1046
<p>Hi sayandip,<br>
When you say iTEBD, do you mean to find the ground state or to do real-time evolution? Since you referrred to MBL, I'm assuming you mean real time evolution but I'll comment on both.</p>
<p>Here is a "code formula" page that shows how to make a code to do time evolution of MPS using Trotter gates, which is the best approach if you have a short ranged Hamiltonian:<br>
<a rel="nofollow" href="http://itensor.org/docs.cgi?page=formulas/tevol_trotter">http://itensor.org/docs.cgi?page=formulas/tevol_trotter</a></p>
<p>To include disorder, just define the individual Hamiltonian terms ("hterm" in the code) appropriately, with parameters depending on the bond number "b". Be careful that you use the same parameters for the reverse set of gates defined in the second loop going from N-1 down to 1. </p>
<p>If you pass the Gate::tReal flag as shown in the sample code, it will produce real-time evolving gates of the form exp(-i h tau). If you pass the Gate::tImag flag it will do imaginary time evolution and you can use that to project into the ground state.</p>
<p>But for finding the ground state, a more powerful approach is to use DMRG. Be careful, though, as DMRG can get stuck in an eigenstate which isn't the ground state if disorder is extremely strong (and depending on the initial state you give).</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1045/disordered-heisenberg-dynamics-localized-systems-itensor?show=1046#a1046Wed, 08 Aug 2018 17:54:16 +0000Answered: I am wondering if it's possible to set the on site operator "N_up,i", or two operators on the same site.
http://itensor.org/support/1025/wondering-possible-site-operator-n_up-operators-same-site?show=1042#a1042
<p>Thanks for the question Chenrong - it's good to keep an eye on these things and glad it's working well now. </p>
<p>Yixuan - thanks for the answer also. Feel free in the future to post an official answer; the forum allows multiple answers as you can see, so it's a good way for people to contribute.</p>
<p>Miles</p>
http://itensor.org/support/1025/wondering-possible-site-operator-n_up-operators-same-site?show=1042#a1042Fri, 27 Jul 2018 15:33:32 +0000Answered: Concatenate two Tensors
http://itensor.org/support/1039/concatenate-two-tensors?show=1040#a1040
<p>Hi Ze-Pei,<br>
Good question. Unfortunately this feature is missing in ITensor currently. We have a practice of not adding features until there is a clear use case, but I think the case you describe definitely justifies adding this feature.</p>
<p>So if you can wait, I will try to add it as soon as I can. Hopefully within a week's time but we'll see.</p>
<p>For the ITensor class, adding this feature should not be extremely hard if you feel like digging into the internals yourself, although it will be faster for me to do it of course. Basically, I plan to allocate a new storage for the concatenated ITensor, then use a "TensorRef" object which is a lower-level type of non-owning tensor to refer to this storage. The TensorRef class supports "tensor slicing" which lets one select only a specific sub-block of the tensor. Then one can straightforwardly copy another tensor whose size matches that sub-block into the sub-block. In this way, one can copy each of the two tensors to be concatenated into the new tensor's storage.</p>
<p>Anyway that's the plan and I hope to finish it soon, at least for the ITensor class. For IQTensors it will be more technical, but should also be possible.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1039/concatenate-two-tensors?show=1040#a1040Thu, 26 Jul 2018 04:06:38 +0000Answered: Many body operators in time evolution
http://itensor.org/support/1026/many-body-operators-in-time-evolution?show=1035#a1035
<p>Hi Tobias,<br>
Thanks for the question. The short answer is just that the toExpH function just doesn't support operators beyond two-site operators at the moment, even though the non-exponentiated part of AutoMPO does support it. This is a fixable feature, but I may not find time to fix it very soon. Since another user also asked about it recently, though, I'll try to prioritize adding it in.</p>
<p>But in the mean time, another approach to time evolving with arbitrary Hamiltonians is to use the "time step targeting" method which is very similar to the "TDVP" method of Haegeman and Verstraete. Here are two papers on the time-step targeting method:</p>
<p><a rel="nofollow" href="https://arxiv.org/abs/cond-mat/0502475">https://arxiv.org/abs/cond-mat/0502475</a></p>
<p><a rel="nofollow" href="https://arxiv.org/abs/1706.09537">https://arxiv.org/abs/1706.09537</a></p>
<p>We don't have this method implemented in ITensor, but ITensor would be very well suited for writing your own implementation. </p>
<p>Regarding more generalized Jordan-Wigner string, that's not something I could quickly add to AutoMPO. You are welcome to look at how fermion J-W string gets handled in AutoMPO and make your own modified version for your system, but instead of adding all of the different cases people might try on top of what is a rather temporary solution that we have currently, I am working instead to overhaul our approach to fermions and non-Abelian anyons. </p>
<p>The new approach I'm working on actually makes certain types of IQIndex objects anticommute (or commute up to a general phase factor) when in certain QN sectors. It will take until at least this fall for this feature to be put in, though, and no guarantee it will work as well as I'm hoping -</p>
<p>Miles</p>
http://itensor.org/support/1026/many-body-operators-in-time-evolution?show=1035#a1035Wed, 18 Jul 2018 16:20:46 +0000Answered: Entanglement entropy for a two-leg Heisenberg ladder
http://itensor.org/support/1028/entanglement-entropy-for-a-two-leg-heisenberg-ladder?show=1032#a1032
<p>Hi Jeffrey,<br>
Thanks for the question & for the easy to read code.</p>
<p>Your code looks good to me to start with. So if you are getting an answer that seems wrong, then I would look at two things:</p>
<ol>
<li><p>is your DMRG converged for all of the different Hamiltonians you consider? Some simple checks for convergence are (a) does the truncation error printed by DMRG for the last two sweeps reach a small value, where small means less than 1E-6 and ideally less than 1E-8 or even smaller? (b) does the energy not change appreciably in the last two or three sweeps? </p></li>
<li><p>when you compute the entanglement, try printing the eigenvalues. Are some of them funny looking? Like are there a lot which are very small or even negative? Not sure if this is really likely to happen, just chasing down all possible ways there could be an error.</p></li>
</ol>
<p>If you try those two things and still have the error, please comment below and we can keep discussing it.</p>
<p>Miles </p>
http://itensor.org/support/1028/entanglement-entropy-for-a-two-leg-heisenberg-ladder?show=1032#a1032Wed, 18 Jul 2018 15:49:05 +0000Answered: Sz_i - Sz_j Correlator at Different Times
http://itensor.org/support/1030/sz_i-sz_j-correlator-at-different-times?show=1031#a1031
<p>Hi jamarks,<br>
So you have the right idea, namely that you should apply @@S^z_j@@ to your MPS, then time evolve it, then measure @@S^z_i@@ after time evolving (and by measure, I mean compute @@S^z_i@@ "sandwiched" between your original state "0" on one side and your time-evolved state on the other side).</p>
<p>To apply @@S^z_j@@ to an MPS, all you need to do is this:</p>
<pre><code>psi.Aref(j) *= sites.op("Sz",j);
psi.Aref(j).noprime(Site);
</code></pre>
<p>The first line gets the @@S^z_j@@ operator from the site set "sites" and contracts it with the jth "A" tensor or MPS tensor of the MPS psi.</p>
<p>The second line removes the prime on the site index that results from the first line, since site operators have one unprimed index and one primed index by our library's convention.</p>
<p>Hope that helps!</p>
<p>Miles</p>
http://itensor.org/support/1030/sz_i-sz_j-correlator-at-different-times?show=1031#a1031Wed, 18 Jul 2018 15:42:58 +0000Answered: Creating SiteSets that represents three spin 1/2's
http://itensor.org/support/1013/creating-sitesets-that-represents-three-spin-1-2s?show=1022#a1022
<p>Please see the comment discussion above -</p>
<p>Specifically regarding the "QMixed" error, that's an error which occurs when trying to make an IQTensor (usually an operator returned from the .op method of a site set) which would violate the QN symmetry in the sense of not having a well defined QN "flux" (<a rel="nofollow" href="http://itensor.org/docs.cgi?page=book/block_sparse).">http://itensor.org/docs.cgi?page=book/block_sparse).</a> The purpose of QMixed storage is to "smuggle" an ITensor (non-QN-conserving) out of a function that only returns IQTensors. It's kind of an ugly workaround and we are planning to fix the design issue that led to it a different way in the future.</p>
<p>So then there are probably two things causing the error you're seeing:<br>
1. you are making an IQTensor (operator) which doesn't conserve the quantum numbers it needs to. For example, you are trying to make the operator Sx as an IQTensor in a context where total Sz is conserved (solution: use S+ and S- instead). <br>
2. you are working in a context where you aren't conserving any quantum numbers, in which case you need to convert the IQTensor with QMixed storage to a regular ITensor before using it.</p>
<p>If you're making a custom site set, please follow the pattern used to make operators such as Sz, S+, and S- in spinhalf.h for making most of your (QN conserving) operators, not the pattern for making operators such as Sx or Sy which are special cases.</p>
<p>Miles</p>
http://itensor.org/support/1013/creating-sitesets-that-represents-three-spin-1-2s?show=1022#a1022Fri, 13 Jul 2018 14:22:40 +0000Answered: How can I free the memory allocated for MPS?
http://itensor.org/support/1012/how-can-i-free-the-memory-allocated-for-mps?show=1020#a1020
<p>Hi Yilun,<br>
To officially answer your question, all that should be necessary to free the memory used by an MPS is to let it go out of scope and/or overwrite it with a new MPS (such as a default-constructed MPS, or any other operation which calls the destructor of the MPS and its member objects). </p>
<p>However, it's important to know that all ITensors use a copy-on-write system where multiple ITensors can share the same underlying memory when copied, until one of them needs to make a change to the shared data, at which point the data is copied so as to be unique to that tensor. So there can be cases where an object is destructed but the memory usage doesn't go down because another tensor is still pointing to that data. It should be leak-proof, though, in the sense that once all of the tensors sharing data go out of scope the memory is freed.</p>
<p>Please also see my comment above asking some more questions about your code and what you are seeing happen -</p>
<p>Miles</p>
http://itensor.org/support/1012/how-can-i-free-the-memory-allocated-for-mps?show=1020#a1020Fri, 13 Jul 2018 14:11:56 +0000Answered: Constructing MPO manually
http://itensor.org/support/1016/constructing-mpo-manually?show=1017#a1017
<p>Hi Yixuan,<br>
Yes, you can definitely create an exponential interaction with that pattern. Also, yes you can extend this trick to a ladder or two-chain system as you are thinking. You just have to be clever about blocking the MPO into different rows and columns so that the correct terms connect with each other on different legs of the ladder, and set the diagonal terms to 1 or else e^{-1} (or the appropriate base of your exponential) on alternating sites.</p>
<p>To get you started with making an MPO or IQMPO manually, have a look at the file Heisenberg.h in the sample/ folder under the ITensor source code directory. That file has a code pattern you can use to make arbitrary MPOs in a more manual way, by placing operators in different locations in each matrix as you wish.</p>
<p>Finally, once you think you have made your IQMPO correctly, a good way to test it is to prepare different product states |i> and |j> where, for example, |i> is the state with a single particle located on site i and |j> similar but for site j. Call these IQMPS psii and psij. Then calculate overlap(psii,H,psij) and it should give you the coefficient of the hopping term connecting site i to j in your Hamiltonian MPO. You can do similar things with two particles to get interaction matrix elements etc.</p>
<p>Miles</p>
http://itensor.org/support/1016/constructing-mpo-manually?show=1017#a1017Tue, 10 Jul 2018 22:37:27 +0000Answered: Read/Write tensors to HDF5 files
http://itensor.org/support/886/read-write-tensors-to-hdf5-files?show=1010#a1010
<p>So here's another piece of an answer: I wanted to write an ITensor of results to an hdf5 file for analysis in Julia. To save everybody else from having to re-invent this particular wheel, the code is in a <a rel="nofollow" href="https://gist.github.com/christopherdavidwhite/0eafbf88bc5171c2bb6071587af0359a">gist</a>. (Too long for the answer box.)</p>
<p>FWIW the code in the gist can take IQTensors---but it deals with them by flattening them down to ordinary ITensors.</p>
http://itensor.org/support/886/read-write-tensors-to-hdf5-files?show=1010#a1010Sat, 07 Jul 2018 00:47:51 +0000Answered: How do I control threading and indexing?
http://itensor.org/support/1006/how-do-i-control-threading-and-indexing?show=1007#a1007
<p>Hi, so I assume you mean the threading that's happening inside of BLAS dgemm? That's the only place that ITensor uses multi threading right now. If you want to force BLAS to be single threaded, it's sort of implementation dependent. Usually the way to do it is to set an environment variable such as export OMP<em>NUM</em>THREADS=1 which works for Apple vecLib / Accelerate and for MKL. (Also MKL recognizes MKL<em>NUM</em>THREADS.)</p>
<p>Regarding 1-indexing, no it's just how our interface works, so it can't be turned off. We are actually considering making a Julia version of ITensor at some point where everything, even low-level things, are 1-indexed and then the indexing will be more consistent throughout the high and low level parts of the library.</p>
<p>Miles</p>
http://itensor.org/support/1006/how-do-i-control-threading-and-indexing?show=1007#a1007Fri, 29 Jun 2018 22:31:12 +0000Answered: How to calculate 2-particle density matrix for the Hubbard Model when two indexes are equal?
http://itensor.org/support/998/calculate-particle-density-matrix-hubbard-model-indexes-equal?show=1005#a1005
<p>Well, after posting this problem I ended up solving it. I decided to keep the post here if other people do the same silly thing as me. Another reason to leave the post here is that people who want to make a similar calculation can see and even exchange ideas with me.</p>
<p>The calculation is right, but the order of the operators' application is wrong in the code. Simple error, but since the correlator is calculated starting from the lowest to the highest site index (usually), I did not realize that in the same site the application of operators is obviously in the anti lexicographic order. The order of application is like this:</p>
<p>$$<br>
\begin{align}<br>
=-\underbrace{\left(a_{i,\sigma_{i}}^{\dagger}F_{i}^{\sigma_{i}+\sigma_{k}}a_{k,\sigma_{k}}\right)}_{\leftarrow}\underbrace{\left(a_{j,\sigma_{j}}F_{j}^{\sigma_{j}+1}\right)}_{\leftarrow}\underbrace{\left(F_{j+1}\cdots F_{l-1}\right)}_{\rightarrow}\underbrace{\left(F_{l}^{\sigma_{l}}a_{l,\sigma_{l}}\right)}_{\leftarrow}.<br>
\end{align}<br>
$$</p>
http://itensor.org/support/998/calculate-particle-density-matrix-hubbard-model-indexes-equal?show=1005#a1005Fri, 29 Jun 2018 14:56:37 +0000Answered: Are spinless fermions just fermions with fixed spin?
http://itensor.org/support/1001/are-spinless-fermions-just-fermions-with-fixed-spin?show=1002#a1002
<p>Hi Jon,<br>
I think this is correct and will work, however, I'd advise just translating your code to use the Spinless site set. All that should involve for the most part is switching the site set names and then the names of certain operators, but otherwise the structure and logic of the code could be left intact and you wouldn't have to worry about any weird surprises -</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1001/are-spinless-fermions-just-fermions-with-fixed-spin?show=1002#a1002Thu, 28 Jun 2018 16:05:53 +0000Answered: How to keep the quantum number fixed in time evolution
http://itensor.org/support/991/how-to-keep-the-quantum-number-fixed-in-time-evolution?show=992#a992
<p>Hi Yixuan,<br>
If you are using IQMPS and IQTensors with a site set that defines a particle number (such as the Hubbard site set) then the total electron number should be kept precisely the same in an automatic way by the IQTensor system. Which site set are you using to define the IQMPS and how are you constructing it?</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/991/how-to-keep-the-quantum-number-fixed-in-time-evolution?show=992#a992Wed, 13 Jun 2018 21:34:40 +0000Projection operator for the AKLT ground state
http://itensor.org/support/986/projection-operator-for-the-aklt-ground-state
<p>Dear forum,</p>
<p>I want to check if the ground state returned by DMRG is identical to the valence bond ground state of the AKLT model<br>
( <a rel="nofollow" href="https://en.wikipedia.org/wiki/AKLT_model">https://en.wikipedia.org/wiki/AKLT_model</a> ).</p>
<p>For this purpose, I need to project a pair of spin-1/2 particles on adjacent sites onto the spin-1 (or triplet) subspace using the projection operator as shown on the following link</p>
<p><a rel="nofollow" href="https://1drv.ms/u/s!ApS6tTYbSmDBjFXFmQdES0QnV7yw">https://1drv.ms/u/s!ApS6tTYbSmDBjFXFmQdES0QnV7yw</a></p>
<p>where the symbols “+”, “0” and “−” label the standard spin-1 basis states.</p>
<p>I have been able to construct the first and last terms of this operator using the pre-built operator “Proj” discussed on the webpage <a rel="nofollow" href="http://itensor.org/docs.cgi?page=classes/siteset">http://itensor.org/docs.cgi?page=classes/siteset</a> but I have not been able to construct the second term (the one with |0>). Could you please help me? Thanks in advance.</p>
<p>Regards,<br>
Niraj</p>
http://itensor.org/support/986/projection-operator-for-the-aklt-ground-stateMon, 11 Jun 2018 19:52:09 +0000Answered: Computing the spin-spin correlation function between site b and b+2.
http://itensor.org/support/983/computing-spin-spin-correlation-function-between-site-and?show=984#a984
<p>Hello, <br>
I believe the above method works only for a correlation between two adjacent sites. I would use the following method to calculate the correlation between any two sites:</p>
<p><a rel="nofollow" href="http://itensor.org/docs.cgi?page=tutorials/correlations">http://itensor.org/docs.cgi?page=tutorials/correlations</a></p>
<p>Regards,<br>
Niraj</p>
http://itensor.org/support/983/computing-spin-spin-correlation-function-between-site-and?show=984#a984Mon, 11 Jun 2018 16:30:48 +0000non-local correlated hopping term expressed as MPO
http://itensor.org/support/977/non-local-correlated-hopping-term-expressed-as-mpo
<p>For a Hubbard model with correlation hopping, the hopping term is</p>
<p>$$ <br>
H_0=-J\sum_{<i,j>}a_i^{\dagger} F_0(\hat{n}_i-\hat{n}_j)a_j <br>
$$</p>
<p>with </p>
<p>$$<br>
F_0(\hat{n}_i-\hat{n}_j)=J_0(\Omega(\hat{n}_i-\hat{n}_j))<br>
$$</p>
<p>here, @@J_0@@ is first-order Bessel function. SInce @@F_0@@ is non-linear, it is impossible to express @@ F_0 @@ as a product of two local operators on sites i and j, i.e.</p>
<p>$$ <br>
F_0(\hat{n}_i-\hat{n}_j) ?= O_i \cdot O_j <br>
$$</p>
<p>Then in this case, how can we perform DMRG as usual using ITensor ?</p>
http://itensor.org/support/977/non-local-correlated-hopping-term-expressed-as-mpoThu, 07 Jun 2018 15:58:43 +0000Answered: IQMPS singlet product state doesn't update quantum number
http://itensor.org/support/969/iqmps-singlet-product-state-doesnt-update-quantum-number?show=975#a975
<p>Hi, so the reason for the error message you're getting is that when you initialize the IQMPS from the InitState object "state", the corresponding constructor puts in dimension=1 "link" indices connecting each MPS tensor. The code below that which sets site 52 onwards to be a product of singlets doesn't connect with the link index coming off of the 51st site tensor. So to get a correctly structured MPS, you'll need to modify tensor number 51, or else set up the whole IQMPS in a different way.</p>
<p>I'm not sure why you got exactly the quantum number that was reported, but first you'll need to ensure that the MPS is properly formed before I'd trust the output of totalQN (which assumes a properly formed MPS).</p>
<p>Miles</p>
http://itensor.org/support/969/iqmps-singlet-product-state-doesnt-update-quantum-number?show=975#a975Fri, 01 Jun 2018 02:02:19 +0000Answered: Combine two SiteSets
http://itensor.org/support/970/combine-two-sitesets?show=974#a974
<p>Hi Josh,<br>
So the answer is that, for the time being, there is not an automatic way to do this unless the two site sets have identical quantum number types (so basically, no useful cases). The reason is that although the site set class design is quite flexible, the QN system is currently less flexible (for efficiency reasons). The QN system currently requires that all QNs throughout your code are globally the same, in terms of having the same number of active "slots" with identical modulus numbers in the same ordering. If you just took two of the site sets provided with ITensor and merged them, they'd have different quantum number definitions.</p>
<p>I've been thinking for a while that I should upgrade the QN system to include string descriptions of the different numbers inside the QN. Doing so ought to make it possible to do what you are asking.</p>
<p>For the meantime though, please just define a new type of site set that returns different site indices depending on the site number, but with the same kind of QN on each site, as in the example you linked.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/970/combine-two-sitesets?show=974#a974Tue, 29 May 2018 22:19:52 +0000Answered: tDMRG cplx error
http://itensor.org/support/971/tdmrg-cplx-error?show=972#a972
<p>Hi, so the reason for this error is that somehow an element of a tensor turned out to be complex even though a subroutine expected a real result. This isn't too surprising since you were doing real-time evolution, so complex numbers were involved. Then some subroutine multiplied (essentially) a complex number by its conjugate giving a real number ideally, but due to some floating point roundoff error gave a tiny imaginary part.</p>
<p>The code that triggered this error checks if the imaginary part is more than 1E-14 times smaller than the real part. Because the real part here was so small that check failed. So I'll put in a separate check that only runs this one if the imaginary part is larger than some reasonable value.</p>
<p>It's hard to get these things to be perfect in every case - thanks for reporting this.</p>
http://itensor.org/support/971/tdmrg-cplx-error?show=972#a972Fri, 25 May 2018 03:14:47 +0000Answered: install itensor on Linux
http://itensor.org/support/961/install-itensor-on-linux?show=967#a967
<p>To officially answer this question, the bug was fixed in the latest version of ITensor.</p>
http://itensor.org/support/961/install-itensor-on-linux?show=967#a967Fri, 11 May 2018 17:09:48 +0000Answered: How to do partial trace in a multi-component system
http://itensor.org/support/948/how-to-do-partial-trace-in-a-multi-component-system?show=957#a957
<p>Hi Junjie,<br>
So the most straightforward answer to your question is that you cannot efficiently measure this particular quantity from an MPS representation of the ground state. Sorry.</p>
<p>One way to see this is to think of your sites not as 3*N dimensional sites, but as separate sites for each of your sublevels. So this would be a representation of your problem having a unit cell, with the first site being sublevel -1, the second being sublevel 0, the third being sublevel +1, the fourth being sublevel -1, etc.</p>
<p>From this point of view, the entanglement you are asking for is like the entanglement of every third site, starting with site 2, relative to all the other sites. But as you probably know, the only entanglement "cut" which is efficient to obtain from an MPS is a left-right bipartition.</p>
<p>Ok that's the straightforward answer. The more complicated answer is that you may be able to obtain this quantity if you "swap" the sites or reorder them. So if you apply swap gates to move all of the sublevel 0 sites to the right of the sublevel +1 and -1 sites then it would be a left-right bipartition. But this is unlikely to scale well, so it's probably inefficient.</p>
<p>Another idea is that you could perform sampling to obtain the second Renyi entropy of the sublevel 0 site entanglement.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/948/how-to-do-partial-trace-in-a-multi-component-system?show=957#a957Wed, 09 May 2018 15:22:36 +0000Changing quantum numbers of site set between DMRG and Time-Evolution
http://itensor.org/support/950/changing-quantum-numbers-site-between-dmrg-time-evolution
<p>Hello everybody,</p>
<p>I am currently implementing a time-evolution proceeded by a 2site dmrg groundstate optimisation. For the groundstate search, I have 4 conserved quantum numbers, but the time-evolution may break up to 3 of these. I cannot just do my groundstate search with the single non-broken quantum number, as then I would start my evolution with a groundstate from the wrong subspace (i.e. I need the other quantum numbers for the dmrg to find the groundstate in one specific subspace).</p>
<p>The two “naive” ways of implementing this kind of setup is only using the single quantum number which is never broken and then either doing imaginary time-evolution starting from an initial state in the correct quantum number block (instead of 2 site optimisation to find the groundstate), or adding an energy penalty to the Hamiltonian (to stay in the correct subspace) and using 2 site optimisation.</p>
<p>Neither of these solutions have great appeal, because the groundstate search is less controllable. So I was wondering if someone has an idea how to effectively change the siteset between groundstate search and time-evolution from 4 down to less than 4 quantum numbers.</p>
<p>Or is there a way how to efficiently read through all my tensor components of my mps and copy them by hand into a new mps defined on the new siteset.</p>
<p>Any help would be appreciated.</p>
<p>Best wishes<br>
Johannes</p>
http://itensor.org/support/950/changing-quantum-numbers-site-between-dmrg-time-evolutionTue, 08 May 2018 16:22:43 +0000