ITensor Support Q&A - Recent questions and answers
http://itensor.org/support/qa
Powered by Question2AnswerAnswered: Warnings on macOS Mojave
http://itensor.org/support/1214/warnings-on-macos-mojave?show=1219#a1219
<p>(Just marking this as answered, via Matt Fishman's comments above.)</p>
<p>Jin, I second Matt's comment that we appreciate you reporting this, as these are very likely mis-used or unnecessary std::move commands that we will remove to get rid of these warnings as well. Thanks!</p>
http://itensor.org/support/1214/warnings-on-macos-mojave?show=1219#a1219Wed, 16 Jan 2019 21:59:56 +0000AutoMPO Syntax: Concatenate local terms
http://itensor.org/support/1212/autompo-syntax-concatenate-local-terms
<p>Hi everyone and happy new year, </p>
<p>It's just a syntax question but the answer would be very useful for me, in order to simplify my code.</p>
<p>I simulate a model with plaquette-like interactions on a Ladder with terms of<br>
of the type sigma<em>{i,x} \prod</em>{j neighbors of i } Proj_{j,up}. <br>
This means that I have to construct autoMPO terms with variable number of involved operators (due to boundaries)</p>
<p>Is there a way to construct each term of the Hamiltonian via concatenation?</p>
<h3> Pseudo-code:</h3>
<pre><code>for (site 1)
term = coeff; //Real number
term = concatenate(term,op1,site1);
if (condition site 2 met)
term = concatenate(term,op2,site2);
if (condition site 3 met)
term = concatenate(term,op3,site3);
ampo += term;
</code></pre>
<hr>
<p>Benoit</p>
http://itensor.org/support/1212/autompo-syntax-concatenate-local-termsThu, 10 Jan 2019 16:51:04 +0000Answered: Accessing elements of tensor with variable rank
http://itensor.org/support/1209/accessing-elements-of-tensor-with-variable-rank?show=1210#a1210
<p>Hey Andreas,</p>
<p>That functionality had not been available, but that is a good suggestion (<code>.set()</code> can currently accept <code>vector<IndexVal></code>, so it is inconsistent that <code>.real()</code> and <code>.cplx()</code> can't).</p>
<p>I made a pull request for adding <code>.real(vector<IndexVal>)</code> and <code>.cplx(vector<IndexVal>)</code>, is that sufficient for your use case?</p>
<p>Cheers,<br>
Matt</p>
http://itensor.org/support/1209/accessing-elements-of-tensor-with-variable-rank?show=1210#a1210Wed, 02 Jan 2019 23:29:36 +0000Answered: non-Hermitian MPO
http://itensor.org/support/1205/non-hermitian-mpo?show=1207#a1207
<p>Thanks for the question. Yes, this function works for arbitrary MPO's, including non-Hermitian ones. </p>
<p>By the way, I'd recommend upgrading to the latest version of ITensor since we made a few fixes to this function a few months ago, and also because now we recommend a new interface through a function just called "applyMPO". Please see the last section of this page for more information:<br>
<a rel="nofollow" href="http://itensor.org/docs.cgi?page=classes/mps_mpo_algs">http://itensor.org/docs.cgi?page=classes/mps_mpo_algs</a></p>
<p>I'd recommend using the checkMPOProd method within your code when you are first building and testing it to make sure that applyMPO is working and calculating the product that you expect. The function checkMPOProd is kind of slow, so you'll want to leave it out of your production code, but it makes no approximations whatsover when computing the quantity (distance) explained in the documentation so it's useful for testing.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1205/non-hermitian-mpo?show=1207#a1207Mon, 31 Dec 2018 17:20:41 +0000Answered: Alternative method for PBC?
http://itensor.org/support/1203/alternative-method-for-pbc?show=1206#a1206
<p>Yes, I believe this has the same (not very good) scaling as the long-bond approach. In fact, I think this approach will be even more highly entangled than the long-bond for the purpose of simulating a 1D system, since the bulk of the system will have two "copies" of the 1D chain running through it! </p>
<p>As you may know, the reason PBC is tough with the usual DMRG approach is because the standard DMRG algorithm is based on a matrix product state form of the wavefunction that is suitable for open boundary conditions. That is, it optimizes an open-boundary MPS. So if you input a periodic Hamiltonian, it can work but it will be sort of a mismatch between the type of Hamiltonian and the type of wavefunction.</p>
<p>One could also optimize a periodic MPS, which could in principle give a better scaling algorithm, but fewer techniques are known for periodic MPS and it's not known how to optimally truncate them just using local operations or how to achieve similar algorithmic properties like "gauging" an open MPS to make the eigensolver step have nice properties.</p>
<p>Miles</p>
http://itensor.org/support/1203/alternative-method-for-pbc?show=1206#a1206Mon, 31 Dec 2018 17:16:19 +0000Answered: Re: Adding a non-Hermitian Eigensolver
http://itensor.org/support/1189/re-adding-a-non-hermitian-eigensolver?show=1194#a1194
<p>Hi, yes we do need to and plan to add an Arnoldi code similar to Davidson. We actually had one in an older version of ITensor, and just need to put it back in. </p>
<p>So it is on our to-do list, and Matt Fishman has this as a high priority (he was the one who recently also added the gmres algorithm for iteratively solving linear equations). </p>
<p>I don't think we will use ARPACK, since it would become a dependency for ITensor and I've heard there are some issues with ARPACK and that it is not maintained much anymore.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1189/re-adding-a-non-hermitian-eigensolver?show=1194#a1194Fri, 14 Dec 2018 16:46:14 +0000Answered: How to solve eigen-problem in itensor?
http://itensor.org/support/1157/how-to-solve-eigen-problem-in-itensor?show=1193#a1193
<p>Hi, so if you tensor is equivalent to a Hermitian matrix, you can use the diagHermitian function described on this page of the documentation:</p>
<p><a rel="nofollow" href="http://itensor.org/docs.cgi?page=classes/decomp">http://itensor.org/docs.cgi?page=classes/decomp</a></p>
<p>Please let me know if that does not give you what you need -</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1157/how-to-solve-eigen-problem-in-itensor?show=1193#a1193Fri, 14 Dec 2018 16:42:22 +0000Answered: Time evolution by Trotter gate for fermions
http://itensor.org/support/1177/time-evolution-by-trotter-gate-for-fermions?show=1190#a1190
<p>Just for anybody interested, I fixed the problem after thinking about the anti-commutations of fermions. What I should do is to replace the C-operators to combinations of A- and F-operators as:</p>
<pre><code>auto hterm = -1.*sites.op("Adagup*F",b)*sites.op("Aup",b+1);
hterm += -1.*sites.op("Adagdn",b)*sites.op("F*Adn",b+1);
hterm += +1.*sites.op("Aup*F",b)*sites.op("Adagup",b+1);
hterm += +1.*sites.op("Adn",b)*sites.op("F*Adagdn",b+1);
</code></pre>
<p>With this I see that the energy is conserved for time-independent Hamiltonian! </p>
http://itensor.org/support/1177/time-evolution-by-trotter-gate-for-fermions?show=1190#a1190Thu, 13 Dec 2018 13:20:38 +0000Answered: Installing MPI Dmrg
http://itensor.org/support/1179/installing-mpi-dmrg?show=1187#a1187
<p>To mark this question as answered, the solution that worked the best was to add the line:</p>
<p>CCCOM=mpicxx</p>
<p>in the Makefile to redefine the CCCOM (cc compiler) variable.</p>
<p>Or replace mpicxx with the appropriate C++ compiler frontend provided by your MPI distribution.</p>
http://itensor.org/support/1179/installing-mpi-dmrg?show=1187#a1187Thu, 13 Dec 2018 03:46:56 +0000Answered: Problems when Building ITensor Library
http://itensor.org/support/1159/problems-when-building-itensor-library?show=1175#a1175
<p>In my practice, itensor (git version cloned today) works under macOS 10.14.1.<br>
In options.mk, I just comment<br>
<code>CCCOM=g++ -m64 -std=c++11 -fPIC</code><br>
and uncomment<br>
<code>#CCCOM=clang++ -std=c++11 -fPIC</code></p>
<p>The only problem is <strong>Accelerate are out of sync</strong>, the same problem <a rel="nofollow" href="http://itensor.org/support/1134/problem-with-framework-accelerate">here</a>, anyway the program works.</p>
http://itensor.org/support/1159/problems-when-building-itensor-library?show=1175#a1175Wed, 05 Dec 2018 06:15:23 +0000Answered: Issue for the ground state psi in pdmrg
http://itensor.org/support/1169/issue-for-the-ground-state-psi-in-pdmrg?show=1170#a1170
<p>Hi Victor,<br>
Yes, that's the expected behavior, actually. In addition to the MPS (IQMPS) tensors, there are also "V" tensors (inverse Lambda, or inverse singular value diagonal) tensors which "link" or "glue" together the different patches of the MPS.</p>
<p>For simplicity of the code, each node works with an MPS which is the length of the whole system. But then it only actually updates the tensors within the block that it "owns". The other tensors don't get updated.</p>
<p>Hope that helps -</p>
<p>Miles</p>
http://itensor.org/support/1169/issue-for-the-ground-state-psi-in-pdmrg?show=1170#a1170Tue, 04 Dec 2018 16:17:28 +0000Answered: Problems with an entanglement entropy calculation
http://itensor.org/support/1165/problems-with-an-entanglement-entropy-calculation?show=1166#a1166
<p>Hi, so the answer is that it's incorrect that dmrg (with open boundary conditions and without conserving Sz-parity symmetry) will give an entropy of ln2, except perhaps on very small system sizes.</p>
<p>You are right, of course, that there is a two-fold ground state degeneracy but this means that dmrg has succeeded if it gives any linear combination of these two ground states, since it's goal is just to minimize the energy. Typical DMRG calculations result in ground-state combinations which have the minimal entanglement entropy. For the ferromagnetic Ising chain this is either all spins up or all spins down, not a linear combination of the two.</p>
<p>The reason I mention small system sizes, is that, for small transverse field there is a tiny reduction in energy due to have a linear combination ("cat state") of both all up and all down ground states, but this energy 'gain' goes away exponentially quickly as a function of system size, so it's typically quite negligible and the truncations that happen inside DMRG will remove this solution.</p>
<p>Miles</p>
http://itensor.org/support/1165/problems-with-an-entanglement-entropy-calculation?show=1166#a1166Mon, 03 Dec 2018 17:21:00 +0000Answered: How to Turn an Operator into an MPO to apply to MPS
http://itensor.org/support/1154/how-to-turn-an-operator-into-an-mpo-to-apply-to-mps?show=1161#a1161
<p>Hi, so thanks for the question. We didn't have anything in the documentation that covers precisely this, which is an important operation for MPS.</p>
<p>So I just added a new 'Code Formula' that shows you how to apply a gate to an MPS efficiently:<br>
<a rel="nofollow" href="http://itensor.org/docs.cgi?page=formulas/gate">http://itensor.org/docs.cgi?page=formulas/gate</a></p>
<p>To apply each of your gates, just iterate the above formula for each gate you want to apply and for each bond you want to apply it to. </p>
<p>Please let me know if anything is unclear about the code in the formula or if you have more questions -</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1154/how-to-turn-an-operator-into-an-mpo-to-apply-to-mps?show=1161#a1161Sat, 01 Dec 2018 18:35:37 +0000Answered: Any Two-site wavefunction
http://itensor.org/support/1146/any-two-site-wavefunction?show=1152#a1152
<p>Hi Ipsita,<br>
I've posted a new code formula that should show you how to compute the two-site reduced density matrix you are asking about.</p>
<p><a rel="nofollow" href="http://itensor.org/docs.cgi?page=formulas/mps_two_rdm">http://itensor.org/docs.cgi?page=formulas/mps_two_rdm</a></p>
<p>Please let me know if you still have a question about this part.</p>
<p>For the partial transpose of the resulting r.d.m., you should be able to do this by manipulating the prime levels of the s<em>j and s'</em>j indices. Like if you raise the s'<em>j index to s''</em>j; then raise s<em>j to s'</em>j; then lower s''<em>j to just s</em>j, you have switched these two indices.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1146/any-two-site-wavefunction?show=1152#a1152Wed, 28 Nov 2018 20:55:18 +0000Answered: Constraints with Bosons
http://itensor.org/support/1138/constraints-with-bosons?show=1145#a1145
<p>I think one way you can do this, although probably at an increased computational cost relative to the energy-penalty strategy you mentioned (which is what I would try first) is to do the following:</p>
<ol>
<li>define a Hamiltonian MPO (assuming this is a 1D problem) in the usual Hilbert space which includes all configurations including ones which violate your constraints</li>
<li>define "isometry" tensors which map three neighboring site indices into one "mega site" index, sending to zero any states which violate your constraints</li>
<li>since these isometries will overlap, try to resolve them into a MERA-like tensor network by introducing unitary two-site maps (gates) that allow you to then use two-site isometries on the indices resulting after the unitary maps</li>
<li>finally, apply these MERA-like tensors to your MPO and use an algorithm like DMRG to find the ground state in your modified MPO</li>
</ol>
<p>This is just an idea off the top of my head which I haven't worked out in any detail, so I'm not sure if step #3 is possible in the way I'm guessing it might be. It's just an idea to get started with. Hope it helps though- </p>
<p>Another off-the-top-of-my-head idea is to work out the most general form of MPS that obeys your constraints #1 and #2. It might have a block-sparse structure, similar to quantum number conserving MPS. Then you could formulate an MPS with such a constrained structure, write down the energy expectation value expression in terms of the MPS blocks (naming them like "A", "B", "C") and then use gradient descent or some other optimization technique to minimize the energy. Once you found the optimal blocks, you could "load" them back into your MPS to compute other properties numerically.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/1138/constraints-with-bosons?show=1145#a1145Mon, 26 Nov 2018 01:51:52 +0000Answered: 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 +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 +0000