ITensor Support Q&A - Recent questions and answers
http://itensor.org/support/qa
Powered by Question2AnswerAnswered: Computational cost of ITensor permute method
http://itensor.org/support/2810/computational-cost-of-itensor-permute-method?show=2811#a2811
<p>Hi Chia-Min,<br>
Good question. It really does permute all of the data, so the cost is proportional to the number of tensor elements.</p>
<p>The concept of permuting can be a little bit confusing in the case of ITensors, where the index order should not matter to the user. The way to think about it is that the permute function is a "lower-level" operation which is really permuting the way an ITensor is stored in memory. The usefulness of it is in case a different layout would make a later operation more efficient, or if you want to use a more traditional notation to access tensor elements such as T(1,2,3). </p>
<p>Otherwise, for normal types of operations involving ITensors such as adding them or contracting them with other ITensors, there is never any need to call the permute function.</p>
<p>Hope that helps! </p>
<p>Miles</p>
http://itensor.org/support/2810/computational-cost-of-itensor-permute-method?show=2811#a2811Thu, 21 Jan 2021 21:23:19 +0000Answered: M1 processor compatibility
http://itensor.org/support/2796/m1-processor-compatibility?show=2807#a2807
<p>Hi Jun,<br>
Thanks for the interesting question. So I just tried the C++ version of ITensor on a Macbook Air with the M1 processor, and it was a smooth experience. I just cloned ITensor from Github, and then used the options.mk.sample file provided as the template for options.mk. The only change I needed to make was to use clang as the C++ compiler, rather than g++. Otherwise I got an error about the -fconcepts flag not being recognized. I did not try to install MKL and build ITensor against that; it would be an interesting thing to try and important to compare the speed to Apple's default "vecLib" framework (default BLAS provided by MacOS).</p>
<p>The performance was very good. The speed I got running the exthubbard sample code was comparable to a workstation at our office that has a 24-core, 3.4 GHz Xeon chip, whereas from what I have read, the M1 has 8 3.2 GHz cores. It was more than two times faster than my Intel Macbook Pro which has a 2.9 GHz chip!</p>
<p>I also installed Julia and the Julia version of ITensor, ITensors.jl, without any issue. That surprised me because I had read that Julia was not yet working for the M1, so perhaps it is using the Rosetta compatibility layer? Also I was able to install the MKL Julia package which we have found significantly speeds up ITensors.jl on Intel chips. It would be interesting to compare Julia with and without MKL on the M1 chip.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/2796/m1-processor-compatibility?show=2807#a2807Mon, 18 Jan 2021 02:19:07 +0000Answered: Are there methods for returning QN value for an MPS or QN flux for an MPO?
http://itensor.org/support/2799/are-there-methods-for-returning-value-for-mps-or-flux-for-mpo?show=2801#a2801
<p>Yes, if you call <code>flux(psi)</code> where psi is an MPS or <code>flux(H)</code> where H is an MPO it will tell you the total flux of that MPS or MPO.</p>
<p>Best,<br>
Miles</p>
http://itensor.org/support/2799/are-there-methods-for-returning-value-for-mps-or-flux-for-mpo?show=2801#a2801Fri, 15 Jan 2021 18:53:33 +0000Answered: [julia] DMRGObserver not working
http://itensor.org/support/2779/julia-dmrgobserver-not-working?show=2793#a2793
<p>Hi Sherry, so that documentation was a little bit hard to understand, because it makes it appear as if those arguments are named arguments. They are (or were - see below) not named arguments but just default arguments. However, that constructor turned out to have another bug, so would not have worked anyway even if called correctly.</p>
<p>I used that situation as an opportunity to improve the interface, and now it should work as you'd expect, i.e. </p>
<p>DMRGObserver(; energy_tol = 1E-4, minsweeps = 2)</p>
<p>say. Note that this is true right now only for the master branch of ITensors.jl and isn't in the latest numbered version yet. But we will tag a new version soon and the change will be included in 0.1.35.</p>
<p>Miles</p>
http://itensor.org/support/2779/julia-dmrgobserver-not-working?show=2793#a2793Wed, 13 Jan 2021 21:46:26 +0000Answered: [julia] Initial state for DMRG
http://itensor.org/support/2780/julia-initial-state-for-dmrg?show=2791#a2791
<p>Please see the discussion above. The key take-away of the discussion is that the same array of site indices used to originally make an MPS must be used to make a compatible MPO or other MPS. This array of site indices can be conveniently obtained from an existing MPS <code>psi</code> by calling:</p>
<pre><code>sites = siteinds(psi)
</code></pre>
http://itensor.org/support/2780/julia-initial-state-for-dmrg?show=2791#a2791Wed, 13 Jan 2021 05:40:17 +0000Answered: convergence problem for small lattice
http://itensor.org/support/2766/convergence-problem-for-small-lattice?show=2775#a2775
<p>(Please see discussion above.)</p>
http://itensor.org/support/2766/convergence-problem-for-small-lattice?show=2775#a2775Sat, 09 Jan 2021 22:35:28 +0000Answered: leftlim and rightlim initialization present in randomizeMPS! but not productMPS
http://itensor.org/support/2771/rightlim-initialization-present-randomizemps-productmps?show=2772#a2772
<p>Hi Sujay,<br>
Happy to discuss more, but most of your question can probably be answered by addressing the true purpose of leftlim and rightlim. They do not represent the boundaries of the region currently optimized (though in an optimization context they might correspond to these regions). What they actually represent are the orthogonality properties of the MPS, or at least as much that we can guarantee in the code in an automated way. (What I mean by that last part is that the MPS might be orthogonal over an even larger region than indicated by leftlim and rightlim but at a minimum it is guaranteed to be orthogonal up to leftlim and rightlim.)</p>
<p>You probably already know what I mean by parts of the MPS being orthogonal, but to be clear the meaning of leftlim is that the MPS tensors 1:leftlim are all left-orthogonal (square to an identity when contracted over both their left index and site index) and the MPS tensors rightlim:N are all right-orthogonal. Again other MPS tensors might be right or left orthogonal besides the ones in (1:leftlim) and (rightlim:N) but we only guarantee the ones in those ranges in terms of our algorithms.</p>
<p>The specific case of the productMPS function is one where we could, and probably should, strengthen this guarantee. I gather that right now leftlim and rightlim just remain at their most conservative settings of leftlim=0 and rightlim=N+1 i.e. not guaranteeing any orthogonality. Whereas productMPS is a special case where <em>all</em> of the MPS tensors are simulaneously both left and right orthogonal. So we could instead say set leftlim=0 and rightlim=2 for productMPS or some other setting.</p>
<p>The randomMPS function doesn't specifically "shift" leftlim and rightlim: rather it sets them because it constructs the MPS out of a quantum circuit that ensures the property that all MPS tensors from 2:N are right-orthogonal. The MPS tensor at site 1 is the "orthogonality center" of this MPS gauge (so called right-orthogonal gauge). </p>
<p>What does shift the leftlim and rightlim values are functions like <code>replacebond!</code> as you mention, which is used internally by DMRG and other algorithms (or you can use it directly). In a sense, this is its main purpose i.e. to update an MPS locally while correctly shifting leftlim and rightlim, as well as selecting among various algorithms for you based on truncation and accuracy settings. Doing this correctly "by hand" could be error prone so we introduced this function to help.</p>
<p>Finally, what is the real purpose of even having leftlim and rightlim? It is for two reasons: correctness and efficiency. There is a correctness aspect where truncating an MPS locally without including the orthogonality center can lead to an uncontrolled / unknown error. Another reason is efficiency: having a known leftlim and rightlim means that for many purposes the left- and right-orthogonal tensors can be omitted from certain algorithmic steps which cuts down on computation by quite a lot without sacrificing correctness or accuracy.</p>
<p>Hope that helps - this is giving me some ideas of things we should put into the docs -</p>
<p>Miles</p>
http://itensor.org/support/2771/rightlim-initialization-present-randomizemps-productmps?show=2772#a2772Sat, 09 Jan 2021 18:08:23 +0000Answered: Non-contracting product in ITensor Julia
http://itensor.org/support/2762/non-contracting-product-in-itensor-julia?show=2763#a2763
<p>Hi Amartya, <br>
We haven’t defined that one in the Julia version. One reason is that it became hard to define it for QN conserving tensors in the C++ version. Another is just that we weren’t sure if anyone was using it. </p>
<p>Could I ask what your use case for it is?</p>
<p>Miles </p>
http://itensor.org/support/2762/non-contracting-product-in-itensor-julia?show=2763#a2763Thu, 24 Dec 2020 15:52:50 +0000Answered: convert an ITensor to fewer quantum number
http://itensor.org/support/2732/convert-an-itensor-to-fewer-quantum-number?show=2759#a2759
<p>Hi Chia-Min,<br>
The short answer is, no, we don't have this capability right now. It is something that could be theoretically added, but it would be hard for us to prioritize this right now. </p>
<p>If the purpose of this is to contract two tensors with different QNs, though, then one way you could do this is to just convert them both to dense, non-QN tensors and then contract them that way. (You may likely have to do some index replacement on one of them to get the id's to match before hand.)</p>
<p>Another way to go is just to use fewer QNs in the first place, so like the minimum amount shared by the two tensors. If you wanted to give a little more context, I might be able to help you more.</p>
<p>Miles</p>
http://itensor.org/support/2732/convert-an-itensor-to-fewer-quantum-number?show=2759#a2759Mon, 21 Dec 2020 01:27:47 +0000Answered: Questions about "Observer" Feature in ITensors.jl
http://itensor.org/support/2751/questions-about-observer-feature-in-itensors-jl?show=2757#a2757
<p>Hi, so we now have much more complete documentation about the DMRG observer system for the Julia version of ITensor (ITensors.jl). </p>
<p>Please see the 'dev' branch of the documentation here:</p>
<p><a rel="nofollow" href="https://itensor.github.io/ITensors.jl/dev/Observer.html">https://itensor.github.io/ITensors.jl/dev/Observer.html</a></p>
<p>(It will appear in the stable version after the next release.)</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/2751/questions-about-observer-feature-in-itensors-jl?show=2757#a2757Sun, 20 Dec 2020 21:30:05 +0000Random Initial state for julia version?
http://itensor.org/support/2748/random-initial-state-for-julia-version
<p>I am trying to find the ground state for a 2D Heisenberg hamiltonian. I want to use different initial states. I read the answers/ discussions regarding the same.</p>
<p>How can I build the random state on X basis? ( maybe using Hadamard as mentioned in other discussions) for the Julia version?</p>
http://itensor.org/support/2748/random-initial-state-for-julia-versionTue, 15 Dec 2020 22:04:49 +0000Answered: Replace siteIndex of MPO
http://itensor.org/support/2724/replace-siteindex-of-mpo?show=2746#a2746
<p>(Please see discussion above.)</p>
http://itensor.org/support/2724/replace-siteindex-of-mpo?show=2746#a2746Tue, 15 Dec 2020 16:09:30 +0000Answered: Spinless Fermionic Correlator Across a 1-d Lattice
http://itensor.org/support/2722/spinless-fermionic-correlator-across-a-1-d-lattice?show=2742#a2742
<p>(Please see the discussion above.)</p>
http://itensor.org/support/2722/spinless-fermionic-correlator-across-a-1-d-lattice?show=2742#a2742Mon, 14 Dec 2020 21:05:46 +0000Answered: Error after updating ITensors.jl
http://itensor.org/support/2726/error-after-updating-itensors-jl?show=2727#a2727
<p>Hi Jin,</p>
<p>This works as expected for me with the latest version of ITensors.jl:</p>
<pre><code>pkg> st ITensors
Status [...]
[9136182c] ITensors v0.1.30
julia> using ITensors
julia> s = Index([QN(("N",i,3))=>1 for i = 0:(2)];dir = ITensors.Arrow(1))
(dim=3|id=859) <Out>
1: QN("N",0,3) => 1
2: QN("N",1,3) => 1
3: QN("N",2,3) => 1
julia> l = setdir(addtags(s,"left"),ITensors.Arrow(-1))
(dim=3|id=859|"left") <In>
1: QN("N",0,3) => 1
2: QN("N",1,3) => 1
3: QN("N",2,3) => 1
julia> r = addtags(s,"right")
(dim=3|id=859|"right") <Out>
1: QN("N",0,3) => 1
2: QN("N",1,3) => 1
3: QN("N",2,3) => 1
julia> A = emptyITensor(l,r)
ITensor ord=2
(dim=3|id=859|"left") <In>
1: QN("N",0,3) => 1
2: QN("N",1,3) => 1
3: QN("N",2,3) => 1
(dim=3|id=859|"right") <Out>
1: QN("N",0,3) => 1
2: QN("N",1,3) => 1
3: QN("N",2,3) => 1
NDTensors.Empty{Float64,NDTensors.BlockSparse{Float64,Array{Float64,1},2}}
julia> A[l(1),r(1)] = 1.0
1.0
julia> @show A;
A = ITensor ord=2
Dim 1: (dim=3|id=859|"left") <In>
1: QN("N",0,3) => 1
2: QN("N",1,3) => 1
3: QN("N",2,3) => 1
Dim 2: (dim=3|id=859|"right") <Out>
1: QN("N",0,3) => 1
2: QN("N",1,3) => 1
3: QN("N",2,3) => 1
NDTensors.BlockSparse{Float64,Array{Float64,1},2}
3×3
Block: Block{2}((0x0000000000000001, 0x0000000000000001), 0xa03b74afc6984a6a)
[1:1, 1:1]
1.0
</code></pre>
<p>We've been making quite a few changes to indexing and block sparse operations in recent versions, so possibly something broke in one of the versions before v0.1.30.</p>
<p>Also note that the Index direction is out by default, and you can make a new Index with the arrow direction reversed with <code>dag</code>:</p>
<pre><code>julia> s = Index([QN("N",i,3)=>1 for i = 0:2])
(dim=3|id=917) <Out>
1: QN("N",0,3) => 1
2: QN("N",1,3) => 1
3: QN("N",2,3) => 1
julia> l = dag(addtags(s,"left"))
(dim=3|id=917|"left") <In>
1: QN("N",0,3) => 1
2: QN("N",1,3) => 1
3: QN("N",2,3) => 1
</code></pre>
<p>-Matt</p>
http://itensor.org/support/2726/error-after-updating-itensors-jl?show=2727#a2727Fri, 11 Dec 2020 14:30:27 +0000Answered: set ITensor elements Array-wise
http://itensor.org/support/2713/set-itensor-elements-array-wise?show=2714#a2714
<p>Hi,</p>
<p>Good question. Unfortunately we don't have very good support right now for slicing ITensors like that. However, in this case you can make use of the NDTensors.jl library, which is a "basic tensor" library that is used by ITensors for basic tensor operations. Here is an example for how to use it:</p>
<pre><code>using ITensors
using ITensors.NDTensors
i = Index(2)
j = Index(2)
k = Index(2)
l = Index(2)
A = randomITensor(i, j, k, l)
tensor(A)[1, 2, :, :] = [0 0; 0 0]
</code></pre>
<p>Note that when you index into a Tensor object (which is what you get when you call <code>tensor(A)</code>), it will use the current Index ordering of <code>A</code>, so you will have to be careful about the ordering of the indices. You can print the current Index ordering with <code>@show inds(A)</code>.</p>
<p>The ITensor functionality you suggest would be pretty easy to implement, I'm working on it now and I'll add a comment here when it is implemented.</p>
<p>-Matt</p>
http://itensor.org/support/2713/set-itensor-elements-array-wise?show=2714#a2714Wed, 02 Dec 2020 14:29:31 +0000Calculating correlations for fermions with spin
http://itensor.org/support/2707/calculating-correlations-for-fermions-with-spin
<p>Hi!<br>
I'm using the following code to calculate correlations of the type cdagup(i) cup(j) and take its log. I'm using Electron sites with {"ConserveSz=",false}</p>
<pre><code>auto ampo2 = AutoMPO(sites);
auto i = 100;
for(auto j=200;j<250;j++)
{
ampo2 += 1,"Cdagup",i,"Cup",j;
auto mpo = toMPO(ampo2);
auto result = innerC(psi,mpo,psi);
outfile<<i<<", "<<j<<", "<<log(abs(i-j))<<", "<<log(abs(result))<<"\n";
ampo2 = AutoMPO(sites);
}
outfile.close();
</code></pre>
<p>The answer depends on whether j is even or odd for a fixed i. Here is a small excerpt from the output. The log of the correlations are higher when j is odd.</p>
<p>i, j, Log(|i-j|), Log|cdagup(i) cup(j)| are printed below</p>
<p>100, 200, 4.60517, -8.32898<br>
100, 201, 4.61512, -6.1358<br>
100, 202, 4.62497, -8.33054<br>
100, 203, 4.63473, -6.1581<br>
100, 204, 4.64439, -8.33459<br>
100, 205, 4.65396, -6.17968<br>
100, 206, 4.66344, -8.34129<br>
100, 207, 4.67283, -6.20057</p>
<p>What is the reason for this? Is this a proper way to calculate the correlations?</p>
http://itensor.org/support/2707/calculating-correlations-for-fermions-with-spinSun, 29 Nov 2020 13:02:47 +0000Answered: Unknown issue concerning diagITensor with adding MPSs?
http://itensor.org/support/2686/unknown-issue-concerning-diagitensor-with-adding-mpss?show=2702#a2702
<p>I've implemented a new algorithm for adding MPS/MPO which now works with QNs here: <a rel="nofollow" href="https://github.com/ITensor/ITensors.jl/pull/528">https://github.com/ITensor/ITensors.jl/pull/528</a></p>
<p>We will release a new version of ITensors.jl that includes this improvement tomorrow. Hopefully this fixes the problem you are seeing. Please try it out after it is released and update us here or with an issue on Github if you keep seeing problems after updating your ITensors.jl version.</p>
http://itensor.org/support/2686/unknown-issue-concerning-diagitensor-with-adding-mpss?show=2702#a2702Thu, 19 Nov 2020 22:50:53 +0000Answered: What is the point of the space() method used in siteind()?
http://itensor.org/support/2699/what-is-the-point-of-the-space-method-used-in-siteind?show=2701#a2701
<p>Over all, the point of the space function is to define the Hilbert space of a physical site. If no QNs are being used, it is just an integer (so the size of the Hilbert space), while if QNs are being used the space is split up into different blocks for different quantum numbers.</p>
<p>What you are looking at there are just generic fallbacks for when the space function is not defined for a specific SiteType, and isn't relevant for user code. Most of the time only the first one is relevant, and that is what a user would overload for their own SiteType. You might imagine that it should return an error instead of nothing, however we don't want it to error because internally we sometimes check if space is defined for a certain tag, and move on if it isn't (so we don't always want an error). You can think of it returning <code>nothing</code> as a way to avoid doing exception handling with <code>try ... catch</code>. </p>
<p>The second definition can be used in the case when a site location is relevant for the space function, for example if you were conserving momentum where the momentum quantum number depends on the site (see <a rel="nofollow" href="https://github.com/ITensor/ITensors.jl/blob/master/examples/src/electronk.jl#L7-L71">https://github.com/ITensor/ITensors.jl/blob/master/examples/src/electronk.jl#L7-L71</a> as an example). This usually isn't the case, however. Possibly that interface could change if we come up with a better design for that feature.</p>
<p>I would focus on these two pages by Miles:</p>
<p><a rel="nofollow" href="http://itensor.org/docs.cgi?vers=julia&page=formulas/sitetype_basic">http://itensor.org/docs.cgi?vers=julia&page=formulas/sitetype_basic</a></p>
<p><a rel="nofollow" href="http://itensor.org/docs.cgi?vers=julia&page=formulas/sitetype_qns">http://itensor.org/docs.cgi?vers=julia&page=formulas/sitetype_qns</a></p>
<p>which explain the user interface for this system.</p>
http://itensor.org/support/2699/what-is-the-point-of-the-space-method-used-in-siteind?show=2701#a2701Tue, 17 Nov 2020 21:52:23 +0000Problem with nmultMPO on large Fermionic chain
http://itensor.org/support/2698/problem-with-nmultmpo-on-large-fermionic-chain
<p>Hi Miles&Matt,</p>
<p>I am encountering a problem with the nmultMPO function on the following minimal example:</p>
<pre><code> auto N=257;
auto sites = Electron(N);
auto ampo = AutoMPO(sites);
ampo += 1.0, "Ntot",2;
auto H = toMPO(ampo);
auto H2 = nmultMPO(H,prime(H));
</code></pre>
<p>For me this code works for N<257, but nmultMPO fails for N>=257 with the error message:<br>
terminate called after throwing an instance of 'std::runtime_error'<br>
what(): Error condition in diagHermitian<br>
Aborted (core dumped)</p>
<p>The same also happens for a less artificial Hamiltonian. For the Fermion SiteSet<br>
I observe something similar. However, instead of an error message nmultMPO seems to return just a zero MPO here (again, small systems work fine).<br>
Do you know where the problem could come from?<br>
I would appreciate any help.</p>
<p>Best regards,<br>
Lucas</p>
http://itensor.org/support/2698/problem-with-nmultmpo-on-large-fermionic-chainSun, 15 Nov 2020 00:45:35 +0000Answered: Can we use Intel MKL libraries on systems with new AMD processors ?
http://itensor.org/support/2695/can-use-intel-mkl-libraries-systems-with-new-amd-processors?show=2696#a2696
<p>Yes, I believe that MKL does work on AMD processors. However, by default it may not be as fast on AMD processors. My understanding is that you can set the following environment variable (in Linux):</p>
<pre><code>export MKL_DEBUG_CPU_TYPE=5
</code></pre>
<p>and then MKL should run as fast on AMD as it does on Intel processors, but this is an undocumented option in MKL and may not be guaranteed to work for different versions of MKL (and I have not personally tried it). Here are some more discussions about it:</p>
<p><a rel="nofollow" href="https://sites.google.com/a/uci.edu/mingru-yang/programming/mkl-has-bad-performance-on-an-amd-cpu">https://sites.google.com/a/uci.edu/mingru-yang/programming/mkl-has-bad-performance-on-an-amd-cpu</a></p>
<p><a rel="nofollow" href="https://www.reddit.com/r/matlab/comments/dxn38s/howto_force_matlab_to_use_a_fast_codepath_on_amd">https://www.reddit.com/r/matlab/comments/dxn38s/howto_force_matlab_to_use_a_fast_codepath_on_amd</a></p>
<p><a rel="nofollow" href="https://github.com/flame/blis/issues/312">https://github.com/flame/blis/issues/312</a></p>
http://itensor.org/support/2695/can-use-intel-mkl-libraries-systems-with-new-amd-processors?show=2696#a2696Fri, 13 Nov 2020 20:12:20 +0000Answered: runtime performance of Julia vs c++ DMRG
http://itensor.org/support/2119/runtime-performance-of-julia-vs-c-dmrg?show=2689#a2689
<p>Hi Matthew,<br>
We now have publicly available benchmarks of both the C++ and Julia version of ITensor, including DMRG benchmarks but also algorithms like TRG (<a rel="nofollow" href="http://tensornetwork.org/trg/)">http://tensornetwork.org/trg/)</a> and corner-transfer renormalization group (CTMRG). Here is the link:<br>
<a rel="nofollow" href="https://github.com/ITensor/ITensorsBenchmarks.jl">https://github.com/ITensor/ITensorsBenchmarks.jl</a></p>
<p>If you specifically look at the plots subfolder you can see some comparison graphs:<br>
<a rel="nofollow" href="https://github.com/ITensor/ITensorsBenchmarks.jl/tree/main/benchmarks/julia_vs_c%2B%2B/plots">https://github.com/ITensor/ITensorsBenchmarks.jl/tree/main/benchmarks/julia_vs_c%2B%2B/plots</a></p>
<p>The summary of what we've observed is that the Julia version is always very competitive with the C++ version, and typically even exceeds the C++ version's performance. We aren't totally sure why this is, but could include lots of effort by ITensor lead developer Matt Fishman to optimize the Julia version, and our use of high-quality Julia libraries for which we don't have an analogue in C++. Plus in some sense the Julia version got a head start by being based on years of effort designing and optimizing the C++ version.</p>
<p>We plan to put these benchmark results into the published version of the ITensor Paper (<a rel="nofollow" href="https://arxiv.org/abs/2007.14822)">https://arxiv.org/abs/2007.14822)</a> and give a more thorough discussion of them there.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/2119/runtime-performance-of-julia-vs-c-dmrg?show=2689#a2689Wed, 11 Nov 2020 17:23:06 +0000Answered: iDMRG for spinful fermions
http://itensor.org/support/2683/idmrg-for-spinful-fermions?show=2684#a2684
<p>I'll give a quick answer and I'm sure Miles can expand on it. You would have to make the MPO manually as explained here: <a rel="nofollow" href="http://itensor.org/docs.cgi?page=tutorials/MPO">http://itensor.org/docs.cgi?page=tutorials/MPO</a></p>
<p>There is an open issue about making this more automated with AutoMPO but we haven't incorporated it yet: <a rel="nofollow" href="https://github.com/ITensor/ITensor/pull/161">https://github.com/ITensor/ITensor/pull/161</a></p>
<p>However, I would definitely suggest trying out finite DMRG and using finite-size scaling first. It will be a lot easier to set up, and there isn't much of a disadvantage.</p>
<p>To answer the question about impurities, the standard iDMRG algorithm is not designed for impurities. I think the way to do it would be to first solve the problem with iDMRG without the impurity, then solve the impurity problem on a "finite" system using the solution from iDMRG to set the boundary conditions.</p>
http://itensor.org/support/2683/idmrg-for-spinful-fermions?show=2684#a2684Mon, 09 Nov 2020 13:43:24 +0000Answered: Misunderstanding about C/A operators in electron model
http://itensor.org/support/2626/misunderstanding-about-c-a-operators-in-electron-model?show=2679#a2679
<p>Hi Cameron,<br>
This issue ought to be fixed now in ITensor version v3.1.6. You should just be able to do a "git pull" and then do a "make clean" followed by "make" to rebuild ITensor and obtain this fix.</p>
<p>Please let me know if the issue persists though!</p>
<p>Miles</p>
http://itensor.org/support/2626/misunderstanding-about-c-a-operators-in-electron-model?show=2679#a2679Fri, 06 Nov 2020 04:59:39 +0000Answered: Calculate absolute value of magnetization
http://itensor.org/support/2657/calculate-absolute-value-of-magnetization?show=2678#a2678
<p>For an official answer, I'm going to say that I think your best bet without having to do heavy algorithm development (or unless I'm missing something simple) is to use sampling to address this problem. </p>
<p>In the Julia version of ITensor we have a function called <code>sample</code> (and a more guaranteed-efficient version called <code>sample!</code>) which will sample a configuration "c" from an MPS with probability |psi(c)|^2. One nice thing about MPS is that this sampling algorithm is 'perfect', meaning it does not rely on a Markov chain or have any autocorrelation time or effects.</p>
<p>For the C++ version, you can look in itensor/tutorial/finiteT folder for the METTS code there to see a version of the same sampling algorithm in C++. Or you could adapt the Julia code to C++.</p>
<p>For each sample, you can straightforwardly compute your observable and I think you know that the |psi(c)|^2 factor would be implicit in the algorithm itself so you can just compute a straight average.</p>
<p>Again there may be other ideas but this one has the virtue of being pretty straightforward to implement.</p>
<p>Best,<br>
Miles</p>
http://itensor.org/support/2657/calculate-absolute-value-of-magnetization?show=2678#a2678Thu, 05 Nov 2020 22:27:05 +0000Answered: Changing basis in DMRG
http://itensor.org/support/2676/changing-basis-in-dmrg?show=2677#a2677
<p>Yes, in principle you could but I'd need more information about which method you are wishing to implement. The simplest one I could think of would be this kind of method:<br>
1. devise a set of local unitary transformations (or "gates") which change the original basis into the new basis you want<br>
2. apply these gates to the MPO of your Hamiltonian to get a modified MPO Hamiltonian which is in the new basis<br>
3. run DMRG on this modified Hamiltonian</p>
<p>But there might be other algorithms than the above one that match the description of what you want.</p>
<p>Best,<br>
Miles</p>
http://itensor.org/support/2676/changing-basis-in-dmrg?show=2677#a2677Thu, 05 Nov 2020 22:12:46 +0000Answered: 2d hamiltonian in julia
http://itensor.org/support/2670/2d-hamiltonian-in-julia?show=2672#a2672
<p>Thanks for asking about this. I would definitely suggest looking at the codes in the examples folder in the ITensor source, as Matt recommends.</p>
<p>Also I just added a new "code formula" for 2D DMRG based on one of the example codes. You can view it here:<br>
<a rel="nofollow" href="http://itensor.org/docs.cgi?vers=julia&page=formulas/2d_dmrg">http://itensor.org/docs.cgi?vers=julia&page=formulas/2d_dmrg</a></p>
http://itensor.org/support/2670/2d-hamiltonian-in-julia?show=2672#a2672Thu, 05 Nov 2020 17:44:00 +0000Answered: Applying projective operator to MPS
http://itensor.org/support/2668/applying-projective-operator-to-mps?show=2669#a2669
<p>Hi,</p>
<p>You would apply it by contracting it with an MPS that has the indices <code>sites</code>, i.e.:</p>
<pre><code>psi(3) *= P3_2;
psi(3).noPrime(); // To make the site index unprimed again
</code></pre>
<p>It can help to print objects that you are unsure about, for example with:</p>
<pre><code>PrintData(P3_2);
</code></pre>
<p>you can see that it is an ITensor with a pair of unprimed and primed indices.</p>
<p>-Matt</p>
http://itensor.org/support/2668/applying-projective-operator-to-mps?show=2669#a2669Wed, 04 Nov 2020 22:53:34 +0000Answered: defining composite on-site operators in AutoMPO (Julia)
http://itensor.org/support/2662/defining-composite-on-site-operators-in-autompo-julia?show=2667#a2667
<p>Hi, so I just patched the latest ITensor (Julia) with a fix for this issue. Thank you for finding it and please let us know if anything else like this seems inconsistent in the future.</p>
<p>If you do <code>update ITensors</code> in the Julia pkg system you should now get this bug fix.</p>
<p>Related pull request:<br>
<a rel="nofollow" href="https://github.com/ITensor/ITensors.jl/pull/519">https://github.com/ITensor/ITensors.jl/pull/519</a></p>
<p>Best,<br>
Miles</p>
http://itensor.org/support/2662/defining-composite-on-site-operators-in-autompo-julia?show=2667#a2667Wed, 04 Nov 2020 04:28:28 +0000Answered: Thermal state missing/null link index
http://itensor.org/support/2637/thermal-state-missing-null-link-index?show=2659#a2659
<p>Hi Nick,<br>
Matt's answer is correct, that unfortunately we require an MPS to have bond or link indices between all of its tensors for some functions to work correctly. We should lift this restriction in the future.</p>
<p>For now, here is a piece of code you can insert that will fix your issue. You should put it after your <code>state</code> MPS is defined and before the call to inner. For a non-QN-conserving code, just remove the "QN()" argument to the Index constructor making the links variables.</p>
<pre><code>auto links = std::vector<Index>(N+1);
for(auto n : range(N+1))
{
auto tags = format("Link,n=%d",n);
links.at(n) = Index(QN(),1,tags);
}
for(int n = 2; n <= N-1; n += 2)
{
auto l = links.at(n);
state.ref(n) = state(n)*setElt(l(1));
state.ref(n+1) = state(n+1)*setElt(dag(l)(1));
}
</code></pre>
http://itensor.org/support/2637/thermal-state-missing-null-link-index?show=2659#a2659Mon, 02 Nov 2020 16:05:28 +0000Answered: Getting "Index does not contain given QN block" error
http://itensor.org/support/2638/getting-index-does-not-contain-given-qn-block-error?show=2658#a2658
<p>Hi Nikhil,<br>
Thanks for the question. If I'm not mistaken, the terms you are adding at the end of your code do not conserve total Sz of the electrons. However, by default the site indices produced by the Electron site set do conserve Sz. So you'll have to turn off Sz conservation if you want to add those particular terms to your Hamiltonian.</p>
<p>The way to do this is to change the call to Electron to be <code>Electron(N,{"ConserveSz=",false});</code>. </p>
<p>If you do want to conserve Sz, though, then there may just be an error in how you defined those terms.</p>
<p>Finally, I noticed that your t1 hopping terms don't appear to be Hermitian. You can look at the sample/exthubbard.cc sample code included with the ITensor source to see an example of a Hermitian electron hopping term. There are other ways to define it, some of which do involve minus signs, but I think your definition is not Hermitian at a glance.</p>
<p>Happy to discuss more -</p>
<p>Best,<br>
Miles</p>
http://itensor.org/support/2638/getting-index-does-not-contain-given-qn-block-error?show=2658#a2658Mon, 02 Nov 2020 15:48:51 +0000Answered: Error in the energy
http://itensor.org/support/2643/error-in-the-energy?show=2650#a2650
<p>Matt's answer above is the correct one. As far as I know, there isn't a theory of how truncation errors of the density matrix eigenvalues translate into energy errors.</p>
<p>Also, it is possible to compute the energy variance of an MPS. The function inner(psi,H,H,psi) computes <H^2> efficiently and inner(psi,H,psi) computes and you can combine these to get the variance <H^2>-^2. McCulloch has proposed that extrapolating in the variance can yield better extrapolations than using the truncation error. I've often wondered whether the variance could yield a bound on the energy error (if one assumes the state is closer to the ground state than any other excited state) but I think it's not such an obvious thing.</p>
<p>Best,<br>
Miles</p>
http://itensor.org/support/2643/error-in-the-energy?show=2650#a2650Thu, 29 Oct 2020 13:46:02 +0000Answered: Construction of Matrix product density operator
http://itensor.org/support/2641/construction-of-matrix-product-density-operator?show=2642#a2642
<p>Hi, good question but the important thing to know is that basically the MPS and MPO classes in ITensor are essentially just arrays of ITensors. The only details beyond them just being arrays are that they "remember" their orthogonality center (if they have one) and they have some associated functions that expect those types (MPS, MPO) to be passed.</p>
<p>But you can always put any collection of ITensors into an array and pass this array around, or store this array in a custom type (MPDO, say) then define analogous functions or operations on it as we have for MPS and MPO.</p>
<p>Finally, an MPDO is structurally equivalent to an MPO, correct? If so you could just repurpose the ITensor MPO type for your work. Or are you referring to the network I know as a "locally purified state" which looks more like two MPO's contracted together? </p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/2641/construction-of-matrix-product-density-operator?show=2642#a2642Wed, 28 Oct 2020 13:53:47 +0000Answered: Exact MPO option for the julia version
http://itensor.org/support/2636/exact-mpo-option-for-the-julia-version?show=2640#a2640
<p>Hi, good question but we don't offer the "Exact" back-end for AutoMPO right now in the Julia version. We just haven't ported it over, since the other backend (which I guess could be called "Compressing" or "SVD") is generally more useful as it can handle a much wider set of inputs.</p>
<p>However, it's important to know that the current backend is very accurate. It does make some approximations but these are basically to truncate singular values of certain matrices going into the MPO which are below 1E-13, so machine precision zero essentially.</p>
<p>Finally, you can test the quality of the MPO that is produced by computing matrix elements with product state MPS. You can use the <code>productMPS</code> function to make these MPS, then the <code>inner(psi,H,phi)</code> function to compute the matrix elements, to check whether they match the exact result you expect for your Hamiltonian.</p>
<p>Please let me know if you have any follow up questions about any of this.</p>
<p>Miles</p>
http://itensor.org/support/2636/exact-mpo-option-for-the-julia-version?show=2640#a2640Tue, 27 Oct 2020 20:25:57 +0000Answered: Spinless Fermion correlator in Julia
http://itensor.org/support/2629/spinless-fermion-correlator-in-julia?show=2633#a2633
<p>Hi, you should be able to follow essentially the same code as: <a rel="nofollow" href="http://www.itensor.org/docs.cgi?vers=cppv3&page=formulas/spinless_correlator_mps">http://www.itensor.org/docs.cgi?vers=cppv3&page=formulas/spinless_correlator_mps</a></p>
<p>Yes, you can use <code>commonind(psi[i],psi[i-1])</code> or <code>linkind(psi, i-1)</code> to get the left link index of site <code>i</code>.</p>
http://itensor.org/support/2629/spinless-fermion-correlator-in-julia?show=2633#a2633Thu, 22 Oct 2020 13:58:23 +0000How to calculate string operator in ITensor2?
http://itensor.org/support/2632/how-to-calculate-string-operator-in-itensor2
<p>Hi ITensor team,<br>
Thanks for your wonderful software ! I want to calculate Haldane string operator correlation function, so I want to define string operator, for example <\prod<em>{n<I}exp(I\pi S</em>{n}^{z})S^{z}_{I}>.if I have string operator, then I can calculate correlation function as spin correlation function. But I don't know how to exponential operator Sz(maybe MPO). my naive partial code as follow:</p>
<p>auto phi1=expHermitian(sites.op("Sz",1),PI<em>Cplx_i);<br>
auto phi2=expHermitian(sites.op("Sz",1),PI</em>Cplx_i);</p>
<p>for(int n = 2; n < N/4; ++n)<br>
{<br>
phi1 <em>=expHermitian(sites.op("Sz",n),PI</em>Cplx_i);<br>
print(phi1);<br>
}<br>
auto Ss1 = phi1*sites.op("Sz",N/4);</p>
<p>for(int n = 2; n < 3<em>N/4; ++n)<br>
{<br>
phi2 *=expHermitian(sites.op("Sz",n),PI</em>Cplx_i);<br>
}<br>
auto Ss2 = phi2*sites.op("Sz",3*N/4);</p>
<p>Ss1 and Ss2 is string operator at N/4 and 3*N/4. BUT this code does't work. Please help me to check. Thank you !</p>
http://itensor.org/support/2632/how-to-calculate-string-operator-in-itensor2Thu, 22 Oct 2020 13:21:57 +0000Answered: The leading a few eigenvalues with arnoldi
http://itensor.org/support/2628/the-leading-a-few-eigenvalues-with-arnoldi?show=2630#a2630
<p>Hi, this is a known problem with our Arnoldi implementation. I've suggested a workaround here: <a rel="nofollow" href="https://github.com/ITensor/ITensor/issues/360">https://github.com/ITensor/ITensor/issues/360</a></p>
<p>You could also consider using an external library like Arpack. Unfortunately, we don't have the time to debug the Arnoldi code in the near future.</p>
http://itensor.org/support/2628/the-leading-a-few-eigenvalues-with-arnoldi?show=2630#a2630Wed, 21 Oct 2020 21:12:32 +0000Answered: Issue with size of the vector in large bond dimension
http://itensor.org/support/2604/issue-with-size-of-the-vector-in-large-bond-dimension?show=2624#a2624
<p>Please see discussion above. This issue might be now fixed in the latest v3 branch of ITensor, following a recent PR #369 (<a rel="nofollow" href="https://github.com/ITensor/ITensor/pull/369).">https://github.com/ITensor/ITensor/pull/369).</a></p>
<p>However, also note that ITensor DMRG is not guaranteed to work at a given, predetermined large bond dimension, as the reachable bond dimension depends on many details of the code, the system being studied, and the user's software and hardware configuration (size of Hamiltonian MPO, degree of block-sparsity, behavior of memory allocator on user's individual platform and operating system, version of BLAS used, etc.). But we are of course happy to accept fixes and PRs which allow ITensor DMRG to reach larger bond dimensions.</p>
<p>Finally, one trick you might want to try to reach larger bond dimensions is to make separate MPOs for different kinds of terms in your Hamiltonian. For example, you might make one MPO which just has the terms that are local to individual 2d columns, and another MPO that is just the intra-column terms. This approach is not guaranteed to help with memory usage, and often has a bigger impact on time rather than memory, but could still help with things like allowing the code to allocate smaller temporary memory vectors one at a time rather than simultaneously and thereby delay running out of memory.</p>
<p>Best,<br>
Miles</p>
http://itensor.org/support/2604/issue-with-size-of-the-vector-in-large-bond-dimension?show=2624#a2624Sat, 17 Oct 2020 16:32:15 +0000Answered: Overlap between two MPS after time evolution
http://itensor.org/support/2591/overlap-between-two-mps-after-time-evolution?show=2618#a2618
<p>(Please see above discussion.)</p>
http://itensor.org/support/2591/overlap-between-two-mps-after-time-evolution?show=2618#a2618Wed, 14 Oct 2020 15:46:14 +0000Answered: How are hopping terms in the Hamiltonian stored in memory? Do they use a lot more memory?
http://itensor.org/support/2594/hopping-terms-hamiltonian-stored-memory-they-use-more-memory?show=2614#a2614
<p>Hi Sujay,<br>
The short version of the answer is that adding individual Hamiltonian terms in an MPO only require the bond dimension of the MPO to be increased by 1. Here by a "term" what is meant is a product of two local operators, such as <code>Sz_1 Sz_7</code>. The operator <code>S+_1 S-_7</code> would be a different term.</p>
<p>On the other hand, translation-invariant terms such as <code>\sum_j Sz_j Sz_j+1</code> also only require the MPO bond dimension to increase by 1, not by N-1 even though this sum contains N-1 terms for a length N system.</p>
<p>So if one starts out with an MPO encoding a sum of local terms, then wants to add the term <code>Sz_1 Sz_N</code> to it, the MPO dimension only has to increase by 1.</p>
<p>All of these comments above are referring to an MPO for an open-boundary, finite system.</p>
<p>Though one can in principle construct and talk about periodic MPOs, the ITensor AutoMPO system does not support making them and the ITensor DMRG code does not accept them as input. This is mostly because periodic MPS have a number of unsolved technical issues that makes them much less useful than either finite or infinite MPS.</p>
<p>For more reading about construction of Hamiltonian MPOs you can see the following papers:<br>
<a rel="nofollow" href="https://arxiv.org/abs/0708.1221">https://arxiv.org/abs/0708.1221</a><br>
<a rel="nofollow" href="https://arxiv.org/abs/1611.02498">https://arxiv.org/abs/1611.02498</a></p>
<p>Miles</p>
http://itensor.org/support/2594/hopping-terms-hamiltonian-stored-memory-they-use-more-memory?show=2614#a2614Tue, 13 Oct 2020 18:58:20 +0000Answered: Bug report in localop.h
http://itensor.org/support/2590/bug-report-in-localop-h?show=2611#a2611
<p>Thank you! I just fixed this in the latest version 3.1.4 based on your report</p>
http://itensor.org/support/2590/bug-report-in-localop-h?show=2611#a2611Mon, 12 Oct 2020 18:12:35 +0000Answered: Sharing a code for the iTDVP?
http://itensor.org/support/2595/sharing-a-code-for-the-itdvp?show=2605#a2605
<p>Hi Yantao,<br>
Thanks for pointing this out! I just added it to the Codes page of the website (C++ part of the codes page of course). Please let me know if you would like to alter the description text, and I can easily change it for you or you can send a pull request since the ITensor.org website is itself open-source.</p>
<p>Appreciate your contribution -</p>
<p>Miles</p>
http://itensor.org/support/2595/sharing-a-code-for-the-itdvp?show=2605#a2605Sun, 11 Oct 2020 20:15:45 +0000Answered: How can I converge to a continuum harmonic trap ground state?
http://itensor.org/support/2579/how-can-i-converge-to-a-continuum-harmonic-trap-ground-state?show=2597#a2597
<p>(Please see the discussion above.)</p>
http://itensor.org/support/2579/how-can-i-converge-to-a-continuum-harmonic-trap-ground-state?show=2597#a2597Fri, 09 Oct 2020 18:22:50 +0000Is there some built-in generalization of KrylovKit.eigsolve that optimizes over multiple input vectors?
http://itensor.org/support/2593/generalization-krylovkit-eigsolve-optimizes-multiple-vectors
<p>I know that the KrylovKit.eigsolve Julia function can find a vector @@x@@ to maximize or minimize @@x^\dagger Ax@@ for a fixed matrix @@M@@. We can think of this in index notation as @@M_{\alpha\beta}x^\alpha\overline{x}^\beta@@, where the bar denotes complex conjugation.</p>
<p>What I am wondering is: does some common package in Julia have a built-in generalization of this method that optimizes over multiple input vectors? For instance, is there a built-in function that finds vectors @@x@@ and @@y@@ to maximize or minimize @@M_{\alpha\beta\gamma\delta}x^\alpha\overline{x}^\beta y^\gamma\overline{y}^\delta@@?</p>
<p>In case you're wondering why I'm asking, basically I am wondering whether it is possible to do a single optimization step over two non-adjacent sites in a way that keeps them unliked, because if you just multiply the two tensors together and then optimize that, then it will introduce a link between those sites. Basically I want to just do this step once in a while to see whether it is possible to fix some problems with my trial Schwinger model (as I have already discussed in some other questions on this website).</p>
http://itensor.org/support/2593/generalization-krylovkit-eigsolve-optimizes-multiple-vectorsFri, 09 Oct 2020 14:25:18 +0000Answered: How do I distinguish between right moving and left moving fermions in ITensor?
http://itensor.org/support/2577/distinguish-between-right-moving-moving-fermions-itensor?show=2587#a2587
<p>Thanks for the extra info above.</p>
<p>So the easiest way to do this with the setup available in ITensor is to define (in your head, more so than in the code) the odd numbered sites to be "L" fermions and the even numbered sites to be "R" fermions. Then this choice is enforced by how you construct the Hamiltonian, such as only inputting hopping terms which connect even to even or odd to odd sites.</p>
<p>Does that approach seem clear to you? Note that converging this setup in DMRG may become a bit harder because two-site DMRG becomes effectively one-site DMRG, but you can overcome this with a good choice of initial state and the use of the noise term.</p>
<p>In the Julia version of ITensor, we offer some more customizability of operators, as used by the AutoMPO system. So there you can introduce custom fermionic operator types and it would be possible to put the L and R fermions on the same site (making dimension 4 site, sort of like in the Hubbard model but with L,R taking the place of spin).</p>
<p>Best,<br>
Miles</p>
http://itensor.org/support/2577/distinguish-between-right-moving-moving-fermions-itensor?show=2587#a2587Tue, 06 Oct 2020 20:57:40 +0000Answered: Question of producing a product signlet state and measuring it.
http://itensor.org/support/2566/question-producing-product-signlet-state-and-measuring-it?show=2580#a2580
<p>(See answer in comments above.)</p>
http://itensor.org/support/2566/question-producing-product-signlet-state-and-measuring-it?show=2580#a2580Sat, 03 Oct 2020 16:10:07 +0000Answered: How to define a new Class for particle like "Parafermions"?
http://itensor.org/support/2569/how-to-define-a-new-class-for-particle-like-parafermions?show=2578#a2578
<p>Hi Javad,<br>
Thanks for the question. Indeed we had designed the site set system for custom cases like parafermions.</p>
<p>Though we have not advertised it very much in the documentation or website, the ITensor library code actually includes a file "mps/sites/Z3.h" which defines a site set called Z3 (made out of a site type Z3Site) which implements Z3 parafermions. You could modify that code fairly straightforwardly to do ZN parafermions.</p>
<p>Here is a link to that code:<br>
<a rel="nofollow" href="https://github.com/ITensor/ITensor/blob/v3/itensor/mps/sites/Z3.h">https://github.com/ITensor/ITensor/blob/v3/itensor/mps/sites/Z3.h</a></p>
<p>One thing to note is that the definition of the Tau and Sig (tau and sigma) operators may be flipped from the one you are using, since these conventions differ from paper to paper involving parafermions.</p>
<p>Another very crucial thing to note is that these sites and operators are parafermionic only in a <em>local</em> sense. To properly implement Hamiltonian terms which involve operators acting beyond nearest-neighbor, it's crucial to include non-local strings of "Tau" or "TauDag" operators connecting the interaction operators. This is analogous to how fermions must be implemented using Jordan-Wigner string in ITensor currently.</p>
<p>Finally, note that this same issue about "Tau" string means that the AutoMPO system cannot currently make non-local parafermion Hamiltonians for you. You will need to make a custom Hamiltonian MPO for that. Ideally we are working on a system that will automate all this in the Julia version of ITensor, but I wouldn't expect it to handle parafermions automatically until sometime in late 2021 most likely.</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/2569/how-to-define-a-new-class-for-particle-like-parafermions?show=2578#a2578Thu, 01 Oct 2020 19:41:17 +0000Answered: SVD an ITensor with QN in Julia?
http://itensor.org/support/2560/svd-an-itensor-with-qn-in-julia?show=2565#a2565
<p>Hi Jin,<br>
Thanks for the question. So I think I see the possible issue: the <code>qn</code> function is defined as the "bare" QN which is the one you see printed when you do <code>@show s</code> say, times the arrow direction of the Index. The direction <code>ITensors.Out</code> corresponds to a multiplication of +1, so no change to the bare QN and you see the one printed. But if the direction is <code>ITensors.In</code>, then it multiples the QN by -1 (effectively) which really means to compute the additive inverse of the QN.</p>
<p>The other thing happening here is that your QN's are defined modulo 5; is that intentional? So since you put a modulus value of 5, the additive inverse of 1 modulo 5 is 4 and so for the case where the direction is <code>ITensors.In</code> you are getting the inverse of the bare QN, hence QN("N",4,5). (The "bare" QN in your case is QN("N",1,5) for subspace number 2.)</p>
<p>I don't think any of this is a bug, but it does raise a potential issue we should think about which is whether we should print the total QN (direction times bare QN, as returned by the <code>qn</code> function) rather than just the bare QN when printing an Index. We will think about it.</p>
<p>Regarding the name space conflict for In and Out, it is unfortunate which is why we don't export those values from ITensors.jl. Are you ok with just writing <code>ITensors.In</code> and <code>ITensors.Out</code> ? In a lot of ITensor code it's not required to work with arrows anyway; usually you obtain an In arrow Index by just taking the conjugate of an Out arrow Index using the function <code>dag</code>.</p>
<p>Miles</p>
http://itensor.org/support/2560/svd-an-itensor-with-qn-in-julia?show=2565#a2565Tue, 29 Sep 2020 02:40:49 +0000Answered: Can ITensor calculate 2D Heisenberg model real-time correlation function?
http://itensor.org/support/2558/itensor-calculate-heisenberg-model-correlation-function?show=2559#a2559
<p>Hi, thanks for the question. I think the core of your question is: what are the best ways to use ITensor to time-evolve systems which don't have nearest-neighbor interactions (in a 1D, MPS path order sense, which includes 2D systems).</p>
<p>To understand all of these methods, I'd recommend the review article by Paeckel:<br>
<a rel="nofollow" href="https://arxiv.org/abs/1901.05824">https://arxiv.org/abs/1901.05824</a><br>
as well as some of the material adapted from it on the tensornetwork.org website:<br>
<a rel="nofollow" href="http://tensornetwork.org/mps/algorithms/timeevo/">http://tensornetwork.org/mps/algorithms/timeevo/</a></p>
<p>There are three main methods available in connection with ITensor, and let me briefly list the pros and cons:</p>
<ol>
<li><p>using an MPO representation of the time evolution operator U=exp(-i tau H):</p>
<p>Pros: it is easy to set this up using AutoMPO and the toExpH function, so it is good for testing the other methods too</p>
<p>Cons: it is not very accurate in a few different ways, including having a large sensitivity to finite-time-step effects and also can result in MPS with rather large bond dimensions, more than what more accurate methods can provide</p>
<p>More information including a paper reference here: <br>
<a rel="nofollow" href="http://itensor.org/docs.cgi?vers=cppv3&page=formulas/tevol_mps_mpo">http://itensor.org/docs.cgi?vers=cppv3&page=formulas/tevol_mps_mpo</a></p></li>
<li><p>using the Trotter method but with additional "swaps" or "swap gates":</p>
<p>Pros: this method is the most reliable, in terms of being sure of convergence once it is implemented in a correct way. It is also not too hard to program. It can give very good accuracy too.</p>
<p>Cons: we don't have this available in a fully automatic way in the C++ version of ITensor (we do now in the Julia version, though). So you will have to implement the "swap" moves yourself, which temporarily bring further-neighbor sites together to become nearest neighbor.</p></li>
<li><p>using the TDVP method</p>
<p>Pros: this method is the best one to use, if you want the most state-of-the-art accuracy and efficiency. It has a very small time-step error and gives very accurate results, with relatively low bond dimensions. You can take rather large time steps for efficiency while still getting good results.</p>
<p>Cons: it is the most technical of the three to program. Also <em>caution</em> it can fail to converge if the initial state of the MPS has a poor basis, such as a product state or a state which has small overlap with the ideal state at a slightly later time. One way to overcome this initial-state problem is to start by using one of the other techniques above (Trotter is recommended for this) for a short time, then switch to TDVP. Or switch from one-site to two-site TDVP. Finally, one can use newer, more sophisticated TDVP convergence techniques such as in this recent paper: <a rel="nofollow" href="https://arxiv.org/abs/2005.06104">https://arxiv.org/abs/2005.06104</a></p>
<p>The TDVP method has been implemented in ITensor as an external code, and is available here:<br>
<a rel="nofollow" href="https://github.com/ITensor/TDVP">https://github.com/ITensor/TDVP</a></p></li>
</ol>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/2558/itensor-calculate-heisenberg-model-correlation-function?show=2559#a2559Fri, 25 Sep 2020 19:37:43 +0000Answered: Error loading MPS from file
http://itensor.org/support/2555/error-loading-mps-from-file?show=2556#a2556
<p>Hi, thanks for the question. The way the write-to-disk system works in the C++ version, currently, results in us being only able to guarantee that files are readable within the same version of the code and on the same machine (due to the use of a non-portable binary format). So it's not really intended for long-term or portable storage of results, so much as for techniques like write-to-disk within DMRG to prevent running out of RAM.</p>
<p>Because of these limitations, we're working on HDF5 support and it's pretty far along but not quite done yet. (Another reason for the HDF5 support is so files can be read and written between the C++ and Julia versions of ITensor.)</p>
<p>More specifically to your issue: were the files you were reading definitely written with a different version of the library? This would be especially relevant if the older version was version 2.x and the newer one version 3.x. I couldn't tell from your question if that was definitely the case, but it would be an important detail to know. My best guess at the moment is that this was the case, and that a change we made to the internal layout of a data type from one version to another made those older files not readable by the latest version.</p>
<p>Finally, yes the Electron site set and Hubbard site sets are identical in terms of their physical meaning and purpose, as well as which operators they offer and QN's they support etc. But one crucial (though small) difference is that the Index tags generated by the Electron site set include the tag "Electron". (Actually I think the change from Hubbard to Electron coincided with the introduction of Index tags so there weren't any tags per se associated to the Hubbard site set.)</p>
<p>Best regards,<br>
Miles</p>
http://itensor.org/support/2555/error-loading-mps-from-file?show=2556#a2556Thu, 24 Sep 2020 19:15:41 +0000Answered: error message in the code formula for DRMG computing excited states
http://itensor.org/support/2546/error-message-code-formula-for-drmg-computing-excited-states?show=2553#a2553
<p>(Question answered in discussion comments above.)</p>
http://itensor.org/support/2546/error-message-code-formula-for-drmg-computing-excited-states?show=2553#a2553Wed, 23 Sep 2020 17:50:29 +0000