<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>ITensor Support Q&amp;A - Recent questions and answers</title>
<link>http://itensor.org/support/qa</link>
<description>Powered by Question2Answer</description>
<item>
<title>Answered: Best way to create equal amplitude states</title>
<link>http://itensor.org/support/3931/best-way-to-create-equal-amplitude-states?show=3932#a3932</link>
<description>&lt;p&gt;Hi Vadim,&lt;br&gt;
We can help you with this, but could you please ask your question on our new forum? We only keep this one up for legacy purposes and might close it down soon.&lt;/p&gt;

&lt;p&gt;Here is the link to the new forum:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://itensor.discourse.group&quot;&gt;https://itensor.discourse.group&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3931/best-way-to-create-equal-amplitude-states?show=3932#a3932</guid>
<pubDate>Tue, 08 Apr 2025 16:45:08 +0000</pubDate>
</item>
<item>
<title>Exponential of MPO</title>
<link>http://itensor.org/support/3928/exponential-of-mpo</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;So I've been trying to use this function: expHermitian(ITensor H, Cplx tau = 1)&lt;br&gt;
but the operator that I want to exponentiate is the total Sz. Here is the code that I have so far:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;auto ampo2  = AutoMPO(sites);
            for(auto k : range1(Nspins))
                {
                ampo2 += &quot;Sz&quot;,k;
                }        
         auto proj = toMPO(ampo2);
        auto exp2H = expHermitian(proj,2);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;but I get an error that the function expects an ITensor object as the first argument (as expected). Is it possible to somehow do what I am trying to do?&lt;/p&gt;

&lt;p&gt;Thank you.&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3928/exponential-of-mpo</guid>
<pubDate>Fri, 23 Sep 2022 16:22:44 +0000</pubDate>
</item>
<item>
<title>Answered: Adding a field to Hamiltonian to form gates</title>
<link>http://itensor.org/support/3926/adding-a-field-to-hamiltonian-to-form-gates?show=3927#a3927</link>
<description>&lt;p&gt;Just a reminder this forum is now closed, and we are leaving it here mainly so that people can search it for previous answers.&lt;/p&gt;

&lt;p&gt;Thanks for realizing this, clanglett, and posting on the new forum.&lt;/p&gt;

&lt;p&gt;You can see my response here:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://itensor.discourse.group/t/adding-a-field-to-hamiltonian-for-tebd-gates/364/2&quot;&gt;https://itensor.discourse.group/t/adding-a-field-to-hamiltonian-for-tebd-gates/364/2&lt;/a&gt;&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3926/adding-a-field-to-hamiltonian-to-form-gates?show=3927#a3927</guid>
<pubDate>Wed, 24 Aug 2022 20:45:23 +0000</pubDate>
</item>
<item>
<title>Answered: &quot;No space left on device&quot; error when using write_to_disk feature in Itensor Julia</title>
<link>http://itensor.org/support/3923/space-device-error-using-write_to_disk-feature-itensor-julia?show=3925#a3925</link>
<description>&lt;p&gt;It turns out that the intermediate tensors are  by default stored in the &quot;/tmp&quot; directory, which in my case has small disk storage. To resolve the issue, I changed the environment variable TMPDIR to a location with a bigger storage.&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3923/space-device-error-using-write_to_disk-feature-itensor-julia?show=3925#a3925</guid>
<pubDate>Fri, 29 Jul 2022 00:39:37 +0000</pubDate>
</item>
<item>
<title>about MixedSiteSet for electron and spin</title>
<link>http://itensor.org/support/3922/about-mixedsiteset-for-electron-and-spin</link>
<description>&lt;p&gt;Dear there,&lt;br&gt;
I want to use dmrg to solve a Hamiltonian which has couplied spin 1/2 operator and electron operator on same site. &lt;br&gt;
For example:  H= a \sum{n}  {Sx(n)C^dag&lt;em&gt;up(n)C&lt;/em&gt;up(n)}  +  b\sum{n}   {Sz(n)}.&lt;/p&gt;

&lt;p&gt;After some searching, I found I need use MixedSiteSet. But so far, I only find a previous example for a Holstein-type new site set , which is: &lt;br&gt;
using Holstein = MixedSiteSet(ElectronSite,BosonSite);&lt;/p&gt;

&lt;p&gt;And I saw in that answer, it mentions &quot;the odd numbered sites will be electron sites and the even numbered sites will be boson sites&quot;. But in my case, I need electron and spin on same site. I'm not sure if this kind of MixedSiteSet already exits in Itensor or how could I construct this?&lt;/p&gt;

&lt;p&gt;Thank you so much!!&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3922/about-mixedsiteset-for-electron-and-spin</guid>
<pubDate>Wed, 27 Jul 2022 23:59:53 +0000</pubDate>
</item>
<item>
<title>Answered: Coupling a spin to heat bath</title>
<link>http://itensor.org/support/3920/coupling-a-spin-to-heat-bath?show=3921#a3921</link>
<description>&lt;p&gt;Hi, thanks for the question but&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;we have now created a new forum to replace this one (though we are leaving this one so people can search it). Here is the link to the new forum: &lt;a rel=&quot;nofollow&quot; href=&quot;https://itensor.discourse.group&quot;&gt;https://itensor.discourse.group&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;when you post your question on the new forum, could you please clarify your question? Are you asking how to create a state which represents a kind of heat bath? If so, what mathematical model of this heat bath would you like to use? Or can you please provide a literature reference for what you are trying to do?&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thanks,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3920/coupling-a-spin-to-heat-bath?show=3921#a3921</guid>
<pubDate>Tue, 24 May 2022 14:12:12 +0000</pubDate>
</item>
<item>
<title>Answered: New Forum Launched!</title>
<link>http://itensor.org/support/3913/new-forum-launched?show=3914#a3914</link>
<description>&lt;p&gt;(Replying just to give this question a blue badge.)&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3913/new-forum-launched?show=3914#a3914</guid>
<pubDate>Thu, 14 Apr 2022 21:49:16 +0000</pubDate>
</item>
<item>
<title>Answered: how to measure correlator of two point with 4 operators in two component bose-hubbard model(c++)</title>
<link>http://itensor.org/support/3898/measure-correlator-point-operators-component-hubbard-model?show=3902#a3902</link>
<description>&lt;p&gt;Hi Wang,&lt;br&gt;
Thanks for the question. Yes, this kind of error means there is a mistake in your code, where you are trying to contract two ITensors that have a matching Index, but where the Index has the same arrow direction. As you may know, in order for two indices to contract, they have to have opposite arrows. Usually this kind of error results from not putting a &quot;dag&quot; somewhere in your code where it is needed. So please look for any places that you should need to take the Hermitian conjugate (or &quot;dag&quot;) of an ITensor that may be missing.&lt;/p&gt;

&lt;p&gt;Also it would be very helpful in this case to either use a debugger or a printing statement to identify which line of your code is causing the error to happen.&lt;/p&gt;

&lt;p&gt;If you spend some more time looking for the error and can't find it, or have a question about how to work with &lt;code&gt;dag&lt;/code&gt; and Index arrows, please just ask by posting a comment below.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3898/measure-correlator-point-operators-component-hubbard-model?show=3902#a3902</guid>
<pubDate>Tue, 12 Apr 2022 16:06:26 +0000</pubDate>
</item>
<item>
<title>Answered: [JULIA] Strange Error concerning my external file of S=2 spin system</title>
<link>http://itensor.org/support/3896/julia-strange-error-concerning-my-external-file-spin-system?show=3901#a3901</link>
<description>&lt;p&gt;Hi, thanks for the question and the kind words about ITensor! &lt;/p&gt;

&lt;p&gt;Most likely the error you are getting comes from setting your ITensor first with an integer value, then afterward trying to set a floating point value. When you have a line of code like &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Op[s'=&amp;gt;2,s=&amp;gt;1] = 2
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;as the first non-zero element to be set, the storage type inside the ITensor ends up being an array of integers, rather than floating point values. So then when you set the second element to be sqrt(6), it's causing an error. &lt;/p&gt;

&lt;p&gt;This is a behavior we might change in the future, making the storage type switch automatically in a case like yours.&lt;/p&gt;

&lt;p&gt;But for now, please just change the code to use explicit floating point values like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Op[s'=&amp;gt;2,s=&amp;gt;1] = 2.0
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;or you could put the lines with sqrt(6) as the first lines of code.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3896/julia-strange-error-concerning-my-external-file-spin-system?show=3901#a3901</guid>
<pubDate>Tue, 12 Apr 2022 16:02:39 +0000</pubDate>
</item>
<item>
<title>Answered: von Neumann entanglement entropy of 1D hubbard model (Julia)</title>
<link>http://itensor.org/support/3895/von-neumann-entanglement-entropy-of-1d-hubbard-model-julia?show=3900#a3900</link>
<description>&lt;p&gt;Hi, so I found the issue and it's due to a bug in the entropy measuring function you were using. The bug is that the for loop should be written like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    for n in 1:dim(S, 1)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;instead of writing &lt;code&gt;for n in dim(S,1)&lt;/code&gt; as in the original code. As I think you can see,  in the original buggy version, &lt;code&gt;dim(S,1)&lt;/code&gt; is just a number, whereas a for loop should go over a range. &lt;/p&gt;

&lt;p&gt;The function in the other question you linked to had that bug plus a second bug, so I went and edited that question reply to fix both bugs. Here is a corrected version of your implementation of it below:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function entropyvonneumann(psi::MPS, N::Int)
  s = siteinds(psi)
  SvN = fill(0.0, N)
  for b in 2:N-1
    orthogonalize!(psi, b)
    _,S = svd(psi[b], (linkind(psi, b-1), s[b]))
    for n in 1:dim(S, 1)
      p = S[n,n]^2
      SvN[b] -= p * log(p)
    end
    println(&quot;$(SvN[b])&quot;)
  end
  return SvN
end
&lt;/code&gt;&lt;/pre&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3895/von-neumann-entanglement-entropy-of-1d-hubbard-model-julia?show=3900#a3900</guid>
<pubDate>Tue, 12 Apr 2022 15:48:57 +0000</pubDate>
</item>
<item>
<title>Julia related error in purification.jl code</title>
<link>http://itensor.org/support/3897/julia-related-error-in-purification-jl-code</link>
<description>&lt;p&gt;Hello,&lt;br&gt;
  I am getting the following error while running  &lt;code&gt;purification.jl&lt;/code&gt;, strangely, it is working in REPL &quot;&lt;a rel=&quot;nofollow&quot; href=&quot;https://replit.com/@scin/EnragedJadedNasm#main.jl&quot;&gt;https://replit.com/@scin/EnragedJadedNasm#main.jl&lt;/a&gt;&quot;.  Could you please help me out in this ?&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;β = 0.00 energy = 0.00000000
 ************
 ERROR:
 LoadError: MethodError: no method matching /(::MPO, ::Float64)
 Closest candidates are:
/(::StridedArray{P, N} where N, ::Real) where P&amp;lt;:Dates.Period at /buildworker    
/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Dates  
/src/deprecated.jl:44
/(::Union{SparseArrays.SparseVector{Tv, Ti}, SubArray{Tv, 1, var&quot;#s814&quot;,    
Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, false} where var&quot;#s814&quot;   
&amp;lt;:SparseArrays.AbstractSparseMatrixCSC{Tv, Ti}, SubArray{Tv, 1, var&quot;#s814&quot;,    
Tuple{Base.Slice{Base.OneTo{Int64}}}, false} where var&quot;#s814&quot; 
&amp;lt;:SparseArrays.AbstractSparseVector{Tv, Ti}} where {Tv, Ti}, ::Number) at   
/buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/SparseArrays  
/src/sparsevector.jl:1450
/(::Complex, ::Real) at complex.jl:333
...
Stacktrace:
[ 1] main(; N::Int64, cutoff::Float64, δτ::Float64, beta_max::Float64)
 @ Main /media/test.jl:26
[2] main()
 @ Main /media/test.jl:11
 [3] top-level scope
 @ /media/test.jl:30
 in expression starting at /media/test.jl:30
&lt;/code&gt;&lt;/pre&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3897/julia-related-error-in-purification-jl-code</guid>
<pubDate>Tue, 12 Apr 2022 06:56:14 +0000</pubDate>
</item>
<item>
<title>Answered: Finite Temperature Properties of  the Spin Systems</title>
<link>http://itensor.org/support/3893/finite-temperature-properties-of-the-spin-systems?show=3894#a3894</link>
<description>&lt;p&gt;So as you likely know,  the reason &lt;code&gt;inner(psi,Mz,psi)&lt;/code&gt; gives the zero-temperature result is because &lt;code&gt;psi&lt;/code&gt; is the ground state. In order to compute finite-temperature properties, you must compute the finite temperature state, either as a mixed state or as an average over a collection of pure states. There is an algorithm called the &quot;ancilla algorithm&quot; or &quot;purification algorithm&quot; for doing the first thing (mixed state), or an algorithm called minimally entangled typical thermal states (METTS) for the second thing (average over pure states).&lt;/p&gt;

&lt;p&gt;Fortunately, I just added sample codes of how to do each to our examples folder! Here is the link:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/ITensor/ITensors.jl/tree/main/examples/finite_temperature&quot;&gt;https://github.com/ITensor/ITensors.jl/tree/main/examples/finite_temperature&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are references for these two algorithms below also:&lt;/p&gt;

&lt;p&gt;Purification or ancilla algorithm:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://journals.aps.org/prb/abstract/10.1103/PhysRevB.72.220401&quot;&gt;https://journals.aps.org/prb/abstract/10.1103/PhysRevB.72.220401&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;METTS algorithm:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.102.190601&quot;&gt;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.102.190601&lt;/a&gt;&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://iopscience.iop.org/article/10.1088/1367-2630/12/5/055026/meta&quot;&gt;https://iopscience.iop.org/article/10.1088/1367-2630/12/5/055026/meta&lt;/a&gt;&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3893/finite-temperature-properties-of-the-spin-systems?show=3894#a3894</guid>
<pubDate>Wed, 06 Apr 2022 14:13:26 +0000</pubDate>
</item>
<item>
<title>Answered: fail to reproduce results of 1D Bose-Hubbard model</title>
<link>http://itensor.org/support/3851/fail-to-reproduce-results-of-1d-bose-hubbard-model?show=3888#a3888</link>
<description>&lt;p&gt;Hi FJ,&lt;br&gt;
Thanks for providing a short sample code to show what you were doing. I ran your code today to see what results I got, using t = 0.1, U=0.1, and mu=0.2 as you mentioned in your comments.&lt;/p&gt;

&lt;p&gt;What I found was that I could get the density to be 0.99999 to many digits on L=24,48,64 if I just ran the DMRG calculation for long enough. I did 60 sweeps instead of the 40 that you reported doing, and I also made sure to ramp up the bond dimension very gradually, like this &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;auto sweeps = Sweeps(60);
sweeps.maxdim() = 10,10,10,10,20,20,20,20,40,40,40,40,100,100,200;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Slowly increasing the bond dimension can be a good technique for dealing with difficult systems, because you can do many sweeps without the initial sweeps taking a long time. Also I've found that increasing the bond dimension too soon can lead to DMRG getting &quot;stuck&quot; and having trouble finding the best basis to use for the ground state.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3851/fail-to-reproduce-results-of-1d-bose-hubbard-model?show=3888#a3888</guid>
<pubDate>Mon, 04 Apr 2022 20:17:49 +0000</pubDate>
</item>
<item>
<title>Unsuccesful TEBD for Time Independent Fermi-Hubbard Model</title>
<link>http://itensor.org/support/3883/unsuccesful-tebd-for-time-independent-fermi-hubbard-model</link>
<description>&lt;p&gt;I have been trying to recreate the dynamics of a driven Fermi-Hubbard Hamiltonian in Julia:&lt;/p&gt;

&lt;p&gt;$$&lt;br&gt;
\hat{H}=-t&amp;#95;0 \sum&amp;#95;{j,\sigma}\left( e^{-i\Phi(t)}\hat{c}^{\dag}&amp;#95;{j,\sigma}\hat{c}&lt;em&gt;{j+1,\sigma} + h.c. \right)+\sum&amp;#95;{j} \hat{n}&amp;#95;{j,\uparrow}\hat{n}&lt;/em&gt;{j,\downarrow}&lt;br&gt;
$$&lt;br&gt;
(don't know why this isn't formatting this is the Hamiltonian given by equation 12 in &lt;a rel=&quot;nofollow&quot; href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.101.053408&quot;&gt;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.101.053408&lt;/a&gt; )&lt;/p&gt;

&lt;p&gt;where @@ \sigma @@ is spin, but my first step is attempting this with @@\Phi(t)@@ set to 0, which results in an undriven, time independent model. I have successfully performed DMRG to obtain the ground state (which I know because I have compared energies to exact calculations in the QuSpin package), but I have been unsuccessful in using TEBD (and RK2 and RK4) to evolve the ground state using the time independent Hamiltonian. I know applying the time evolution operator as an exponential of the TI Hamiltonian to the ground state should preserve the ground state, but instead the energy of the state resulting from the application of the time evolution operator increases throughout the evolution. Though I have not tested dependence rigorously, the energy increase seems to be mostly independent of the time step even though it should be @@\mathcal{O}(\delta t)@@ according to &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.sciencedirect.com/science/article/pii/S0003491619302532.&quot;&gt;https://www.sciencedirect.com/science/article/pii/S0003491619302532.&lt;/a&gt; I have implemented a dynamic time step as well, and tested a couple different maximum bond dimensions in DMRG, as well as decreasing the cutoff for both DMRG and the apply function. Any help is greatly appreciated, thanks in advance! My code is below:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&quot;&quot;&quot;
Use second order TEBD to evolve psi(t) to psi (t + dt)
&quot;&quot;&quot;
function TEBD(psi, dt, time, params, independent, cutoff)

    phi = phi_tl(time + dt / 2, params, independent)

    # odd gates (1,2),(3,4),(5,6),...
    ogates = ITensor[]
    # even gates (2,3),(4,5),(6,7),...
    egates = ITensor[]
    for j=1:params.nsites
        s1 = params.space[j]
        #periodic BC
        if j == params.nsites
            s2 = params.space[1]
        else
            s2 = params.space[j+1]
        end
        # we have to define the two site operator so contributions
        # of each site will be counted twice
        ul = ur = params.U / 2
        # exp(i phi(t)) and exp(-i phi(t))
        eiphi = exp(1.0im * phi)
        eiphiconj = conj(eiphi)
        # create operator (only scaled parameters are passed in so t is always 1)
        hj = -eiphiconj * op(&quot;Cdagup&quot;,s1) * op(&quot;Cup&quot;,s2) +
             -eiphiconj * op(&quot;Cdagdn&quot;,s1) * op(&quot;Cdn&quot;,s2) +
             -eiphi * op(&quot;Cdagup&quot;,s2) * op(&quot;Cup&quot;,s1) +
             -eiphi * op(&quot;Cdagdn&quot;,s2) * op(&quot;Cdn&quot;,s1) +
             ul * op(&quot;Nupdn&quot;, s1) * op(&quot;Id&quot;,s2) +
             ur * op(&quot;Id&quot;,s1) * op(&quot;Nupdn&quot;, s2)
        # odd gate
        if j % 2 == 1
            Gj = exp(-1.0im * dt * hj)
            push!(ogates, Gj)
        # even gate
        else
            Gj = exp(-1.0im * dt / 2 * hj)
            push!(egates, Gj)
        end
    end

    gates = ITensor[]
    append!(gates, egates)
    append!(gates, ogates)
    append!(gates, egates)

    return apply(gates, psi; cutoff=cutoff)

end

&quot;&quot;&quot;
Propogates ground from 0 to tf using method to propogate by an adaptive timestep
Parameters:
    ground - ground state (MPS)
    tf - final time
    method - the function used to propogate a wavefunction over single dt
    dti - initial guess for timestep
    epsilon - total change allowed in a single time step
    independent - boolean that is True if we are evolving with a time independent
              Hamiltonian, and False otherwise
&quot;&quot;&quot;
function propogation(ground::MPS, params, tf, method, dti, epsilon, independent, cutoff)
    # error measures (en is for current step, en1 is for previous step)
    en = en1 = 0.0
    time = 0.0
    # copy states
    psi = deepcopy(ground)
    # set dt and previous dt
    dt = pdt = dti

    # initialize vectors for saving times and expectation values
    times = [0]
    energies = [inner(ground, get_ham(0, params, independent), ground)]
    currents = [inner(ground, get_current(0, params, independent), ground)]

    # run for the entire time interval
    while time &amp;lt; tf

        # get the MPS at time + dt
        next_psi = method(psi, dt, time, params, independent, cutoff)

        # calculate difference between current and next psi
        en = difference(psi, next_psi)

        # run propogation while the difference is greater than acceptable error
        while en &amp;gt; epsilon
            # adjust time step
            dt *= epsilon / en
            # get the next MPS and calculate difference
            next_psi = method(psi, dt, time, params, independent, cutoff)
            en = difference(psi, next_psi)
        end

        # incremement time and add it to the array
        time += dt
        times = vcat(times, [time])

        # accept wavefunction
        psi = deepcopy(next_psi)

        # calculate expectations
        energies = vcat(energies, [inner(psi, get_ham(time, params, independent), psi)])
        currents = vcat(currents, [inner(psi, get_current(time, params, independent), psi)])

        en1 = (en1 &amp;gt; 0) ? en1 : en

        # adjust for next time step
        # https://www.sciencedirect.com/science/article/pii/S0377042705001123
        ndt = dt * ((epsilon^2 * dt)/ (en * en1 * pdt))^(1/12)

        # update values for next iteration e_{n-1} -&amp;gt; e_n, dt_{n-1} = dt_n,
        # dt_n -&amp;gt; dt_{n+1}
        en1 = en
        pdt = dt
        dt = ndt
    end
    return times, energies, currents
end
&lt;/code&gt;&lt;/pre&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3883/unsuccesful-tebd-for-time-independent-fermi-hubbard-model</guid>
<pubDate>Tue, 29 Mar 2022 23:17:57 +0000</pubDate>
</item>
<item>
<title>Answered: AutoMPO using operators with more arguments</title>
<link>http://itensor.org/support/3879/autompo-using-operators-with-more-arguments?show=3880#a3880</link>
<description>&lt;p&gt;Hi thanks for the question. So if the main parameter you are wanting to pass is the dimension of one of the Hilbert space types (the bosons representing the phonons) then the best way to do that is the idea you suggest at the end of your question: just by making your sites in a different way.&lt;/p&gt;

&lt;p&gt;The &quot;Boson&quot; site type included in ITensors.jl recognizes a &lt;code&gt;dim&lt;/code&gt; keyword argument whose default is 2, but can be increased to any number. &lt;/p&gt;

&lt;p&gt;So then instead of using the siteinds function to make your sites, you can do the following for your case&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;dim = 3
s = [isodd(n) ? siteind(&quot;Fermion&quot;, n) : siteind(&quot;Boson&quot;, n; dim) for n in 1:N]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which will make an array of site indices and pass the &lt;code&gt;dim&lt;/code&gt; keyword argument in the case that the site is a &quot;Boson&quot;. (There is a Julia trick here where instead of writing &lt;code&gt;dim=dim&lt;/code&gt; you can just write &lt;code&gt;dim&lt;/code&gt;.) &lt;/p&gt;

&lt;p&gt;Would that address the issue you're facing? You can also print out the array &lt;code&gt;s&lt;/code&gt; of site indices afterward to verify that your &quot;Boson&quot; sites have the correct dimension.&lt;/p&gt;

&lt;p&gt;Finally, when you then make operators for these sites, such as by using the OpSum/AutoMPO system, the correct operators will be made to match the dimension of the &quot;Boson&quot; sites that you make.&lt;/p&gt;

&lt;p&gt;Happy to discuss more -&lt;/p&gt;

&lt;p&gt;Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3879/autompo-using-operators-with-more-arguments?show=3880#a3880</guid>
<pubDate>Tue, 29 Mar 2022 19:44:15 +0000</pubDate>
</item>
<item>
<title>Answered: Infinite MPS TEBD in Julia</title>
<link>http://itensor.org/support/3871/infinite-mps-tebd-in-julia?show=3872#a3872</link>
<description>&lt;p&gt;Hello Tianqi,&lt;/p&gt;

&lt;p&gt;Good questions, the ITensorInfiniteMPS.jl package is more of a pre-release as we round out the features and finalize the interface, so it is not well documented right now but should be usable (the VUMPS code is already being used in a few research projects).&lt;/p&gt;

&lt;p&gt;The  tags &quot;c=0&quot;, &quot;c=1&quot;, etc. indicate which unit cell the MPS Index or tensor is in. If you have have a 3-site unit cell, the first tensor in the first unit is &lt;code&gt;psi[1]&lt;/code&gt; and the first tensor of the second unit cell is &lt;code&gt;psi[4]&lt;/code&gt;, with the relationship that &lt;code&gt;psi[4] = translatecell(psi[1], 1)&lt;/code&gt; (i.e. &lt;code&gt;psi[1]&lt;/code&gt; shifted by one unit cell, which shifts the tags from &quot;c=1&quot; to &quot;c=2&quot;). It only ever actually stores the tensors of the first unit cell. If you set a new tensor outside of the first unit cell like &lt;code&gt;psi[4] = T&lt;/code&gt;, it maps it to the first unit cell and overwrites the tensor of the first unit cell.&lt;/p&gt;

&lt;p&gt;It wouldn't be too hard to implement iTEBD with the current code. As you say, you should only need to evolve with gates in the first unit cell, and when you update the tensors of the InfiniteMPS in the first unit cell it implicitly updates tensors in the rest of the unit cells. Of course, you will have to follow the details of Fig. 3 in &lt;a rel=&quot;nofollow&quot; href=&quot;https://arxiv.org/pdf/cond-mat/0605597.pdf&quot;&gt;https://arxiv.org/pdf/cond-mat/0605597.pdf&lt;/a&gt; to properly update the tensors of the state.&lt;/p&gt;

&lt;p&gt;Alternatively, we already have a TDVP implementation in ITensorInfiniteMPS.jl which is an alternative time evolution method that in general has been found to work better for more complicated models. You just use the &lt;code&gt;tdvp&lt;/code&gt; function instead of &lt;code&gt;vumps&lt;/code&gt;, and specify a time step with the keyword argument &lt;code&gt;time_step&lt;/code&gt;. You can see it tested here: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/ITensor/ITensorInfiniteMPS.jl/blob/main/test/test_vumps.jl&quot;&gt;https://github.com/ITensor/ITensorInfiniteMPS.jl/blob/main/test/test_vumps.jl&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please try the TDVP code and let us know if it works for your use case. If you write the iTEBD code, please consider contributing it to the ITensorInfiniteMPS.jl package, since it would also be nice to have.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br&gt;
Matt&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3871/infinite-mps-tebd-in-julia?show=3872#a3872</guid>
<pubDate>Fri, 25 Mar 2022 13:39:53 +0000</pubDate>
</item>
<item>
<title>Answered: [Julia]3-sites MPS Time Evolution</title>
<link>http://itensor.org/support/3862/julia-3-sites-mps-time-evolution?show=3868#a3868</link>
<description>&lt;p&gt;Hi, it's a good question, though could you please be more specific about what you changed in the code? Did you leave the original two site terms unchanged and then add these three site terms? Or do you only have the three site terms now?&lt;/p&gt;

&lt;p&gt;Also when you say the time is much longer, how much longer is it?&lt;/p&gt;

&lt;p&gt;I did my own tests of adding three-site terms, in addition to the previous two-site terms. In my case it is slower but by an amount that seems reasonable to me. For N=40 sites and setting conserve_qns=false, I found that the original code took about 4 seconds and the code with additional three-site terms took 12 seconds.&lt;/p&gt;

&lt;p&gt;There are many reasons this extra time is reasonable. Here are the main ones:&lt;br&gt;
1. there are just more gates, and there is a cost for acting each gate. If there are twice as many gates, then the code should generally take at least twice as long.&lt;br&gt;
2. the extra gates could lead to the state becoming entangled more quickly, which would add further codes even when applying the two-site gates&lt;br&gt;
3. the cost of applying a three-site gate is always higher than a two-site gate. This is because the code merges together three sites of the MPS, so there is one extra site making that step at least 2 times more expensive and more like 4 times more expensive. (If the site dimension is d then there is one step costing an additional factor of d and another one scaling with an additional d^2). &lt;/p&gt;

&lt;p&gt;So for all those reasons I am not too surprised. In general if you are dealing with a very complicated Hamiltonian, then TDVP can be a better option for time evolution compared to Trotter or TEBD. We are actively working on a TDVP code for ITensor and it will be released soon.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3862/julia-3-sites-mps-time-evolution?show=3868#a3868</guid>
<pubDate>Thu, 24 Mar 2022 15:25:30 +0000</pubDate>
</item>
<item>
<title>Answered: How to add a constant term in Hamiltonian(julia)</title>
<link>http://itensor.org/support/3864/how-to-add-a-constant-term-in-hamiltonian-julia?show=3867#a3867</link>
<description>&lt;p&gt;No that's a pretty good question actually! &lt;/p&gt;

&lt;p&gt;The short answer is that if you want an overall constant shift, you can do this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ampo += -0.5/4,&quot;Id&quot;,1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and importantly do that &lt;em&gt;outside&lt;/em&gt; the loop so it's only a single shift. If you put that inside the loop if would be equivalent to adding a shift&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ampo += -(N-1)*0.5/4,&quot;Id',1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;unless that's actually the behavior you want.&lt;/p&gt;

&lt;p&gt;On a more big picture level, recall that a constant shift to a Hamiltonian really means a term which is the tensor product of the identity operator on every site. The way OpSum works when converting to an MPO is that any sites not included in a term are assumed to have the identity operator acting on them. So a term like &quot;Sz&quot;,3 is really Id&lt;em&gt;1 Id&lt;/em&gt;2 Sz&lt;em&gt;3 Id&lt;/em&gt;4 Id_5 ....&lt;/p&gt;

&lt;p&gt;We should add as a feature, though, the ability to just add a constant by itself as you tried. It's  a nice suggestion and could be convenient in many cases.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3864/how-to-add-a-constant-term-in-hamiltonian-julia?show=3867#a3867</guid>
<pubDate>Thu, 24 Mar 2022 15:07:07 +0000</pubDate>
</item>
<item>
<title>Answered: Where can I find the proper syntax required to perform SVD in dmrg tutorial ?</title>
<link>http://itensor.org/support/3859/where-find-proper-syntax-required-perform-svd-dmrg-tutorial?show=3861#a3861</link>
<description>&lt;p&gt;Hi asing,&lt;br&gt;
For the C++ version the interface of the svd function is described and some examples given in the documentation here:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;http://itensor.org/docs.cgi?vers=cppv3&amp;amp;page=classes/decomp&quot;&gt;http://itensor.org/docs.cgi?vers=cppv3&amp;amp;page=classes/decomp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the the link halfway down the page that say &quot;Click to Show Example&quot; to see a nice example of the interface. The Synopsis at the top shows one too.&lt;/p&gt;

&lt;p&gt;The basic idea is that, given an ITensor with indices i,j,k,l, you pass the ones you want to end up on U to the svd function, like svd(T,{i,k}) if you want i and k to be on U, with the remaining indices going onto V. &lt;/p&gt;

&lt;p&gt;In the context of DMRG, you should also pass truncation parameters to control the cost of the DMRG algorithm, so you should also pass values for the &quot;MaxDim&quot; and &quot;Cutoff' named arguments, so like svd(T,{i,k}, {&quot;MaxDim=&quot;, maxdim, &quot;Cutoff=&quot;, cutoff}); where maxdim is some integer and cutoff is a real number.&lt;/p&gt;

&lt;p&gt;Hope that helps. Also we have fully working examples of using our DMRG code if you want to look at those, such as in the sample folder and in the Code Formulas section of the C++ documentation.&lt;/p&gt;

&lt;p&gt;Best,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3859/where-find-proper-syntax-required-perform-svd-dmrg-tutorial?show=3861#a3861</guid>
<pubDate>Thu, 24 Mar 2022 01:22:25 +0000</pubDate>
</item>
<item>
<title>Answered: [C++] OMP vs. MKL parallelization</title>
<link>http://itensor.org/support/3852/c-omp-vs-mkl-parallelization?show=3854#a3854</link>
<description>&lt;p&gt;Hi Chia-Min,&lt;br&gt;
Your understanding about the role of these two different environment variables is correct, assuming that the BLAS you are using is actually MKL. Of course for a user using a different BLAS, such as OpenBLAS, they would need to set OPENBLAS&lt;em&gt;NUM&lt;/em&gt;THREADS instead of MKL&lt;em&gt;NUM&lt;/em&gt;THREADS.&lt;/p&gt;

&lt;p&gt;To answer your last question, within ITensor the only explicit parallelization is over quantum number blocks, with the number of threads used for that controlled by OMP&lt;em&gt;NUM&lt;/em&gt;THREADS. However, that does not mean ITensor &quot;only&quot; supports that kind of multithreading. Since we use BLAS to do the tensor contractions, then if you turn on multithreading for your BLAS then calls to the BLAS by ITensor will also be multithreaded. In fact, it is something ITensor does not control itself and you just control by setting MKL&lt;em&gt;NUM&lt;/em&gt;THREADS or similar.&lt;/p&gt;

&lt;p&gt;If you did not see any effect of setting MKL&lt;em&gt;NUM&lt;/em&gt;THREADS, this could be for a number of different reasons. A less likely one is that it's not properly set by your code or terminal. But more likely, it's one of two other things (or both):&lt;br&gt;
1. there is a competition of resources happening between the multithreading over the blocks and the multithreading over the matrix data within BLAS&lt;br&gt;
2. many of the blocks or tensors are just too small for the BLAS multithreading to have much of an effect&lt;/p&gt;

&lt;p&gt;We have in general seen that BLAS multithreading does not often scale very well, and will just give something like a factor of 2 speedup even if more than two threads are used for it. &lt;/p&gt;

&lt;p&gt;To be more precise about all these things, please see the benchmarks in the latest version of the ITensor paper, Section 12: &lt;a rel=&quot;nofollow&quot; href=&quot;https://arxiv.org/abs/2007.14822&quot;&gt;https://arxiv.org/abs/2007.14822&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is a link to the actual code that was used to obtain these benchmarks - I link here to the line that sets the MKL&lt;em&gt;NUM&lt;/em&gt;THREADS and OMP&lt;em&gt;NUM&lt;/em&gt;THREADS variables so you can see that is indeed how it is done:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/ITensor/ITensorBenchmarks.jl/blob/12e3a1f0ff3e587fd026d22d79a00bf36668cb34/src/runbenchmarks.jl#L234&quot;&gt;https://github.com/ITensor/ITensorBenchmarks.jl/blob/12e3a1f0ff3e587fd026d22d79a00bf36668cb34/src/runbenchmarks.jl#L234&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Of course if you have any followup questions please ask. Also I might ask Matt Fishman to weigh in since he did those benchmarks and wrote the block-sparse multithreading code.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3852/c-omp-vs-mkl-parallelization?show=3854#a3854</guid>
<pubDate>Tue, 22 Mar 2022 15:06:51 +0000</pubDate>
</item>
<item>
<title>Answered: C++ version, complex matrix-vector multiplication</title>
<link>http://itensor.org/support/3809/c-version-complex-matrix-vector-multiplication?show=3844#a3844</link>
<description>&lt;p&gt;After writing the comment above, I realized this feature could be added rather quickly so I just added it. Please see the following PR to see the lines of code that were changed (the important ones are in tensor/mat_impl.h) which I thought might interest you:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/ITensor/ITensor/pull/409&quot;&gt;https://github.com/ITensor/ITensor/pull/409&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for pointing this out -&lt;/p&gt;

&lt;p&gt;Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3809/c-version-complex-matrix-vector-multiplication?show=3844#a3844</guid>
<pubDate>Fri, 18 Mar 2022 03:18:26 +0000</pubDate>
</item>
<item>
<title>Answered: Measure multi-point correlation in 2D lattice</title>
<link>http://itensor.org/support/3825/measure-multi-point-correlation-in-2d-lattice?show=3839#a3839</link>
<description>&lt;p&gt;Thanks for the interesting question. That is puzzling, because it looks like you are doing everything correctly and should get +1 in both cases, assuming that your MPS really does describe the same wavefunction.&lt;/p&gt;

&lt;p&gt;I don't know the answer off the top of my head, because this is more in the category of like &quot;numerical bugs&quot; where one has to try out different things to resolve the mystery, but I could suggest some ideas.&lt;/p&gt;

&lt;p&gt;1) you could try making the W operator using our AutoMPO tool and then taking the expected value of the resulting MPO. What answer do you get that way?&lt;/p&gt;

&lt;p&gt;2) are there other properties, like two-point correlation functions, you can also compute to ensure that you really are getting the same wavefunction? Even though they have the same energy, because you are using two different 2D paths, it could be that DMRG is finding a different solution for each path, something like a funny superposition of ground states (assuming there is a ground state degeneracy, which I'm not sure is a correct assumption or not – you'd have to remind me)&lt;/p&gt;

&lt;p&gt;3) could you try on a smaller ladder, with only one hexagon in the y-direction?&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3825/measure-multi-point-correlation-in-2d-lattice?show=3839#a3839</guid>
<pubDate>Thu, 17 Mar 2022 19:03:30 +0000</pubDate>
</item>
<item>
<title>Answered: Entanglement Entropy near phase transition in 1D</title>
<link>http://itensor.org/support/3823/entanglement-entropy-near-phase-transition-in-1d?show=3838#a3838</link>
<description>&lt;p&gt;HI, thanks for the question. &lt;/p&gt;

&lt;p&gt;I don't immediately know the answer, but I would like to know if the energy of the unentangled state you are getting is matching the expected ground state energy for the J &amp;gt; 0 case? In other words, is the product state (unentangled state) you are finding a valid ground state? &lt;/p&gt;

&lt;p&gt;I ask because you mentioned Majorana physics but the Hamiltonian here is a spin model. I know of some cases, like the Kitaev chain, where the Majorana model is equivalent to a spin model but the ground state in the fermion language is more entangled, while in the spin language is has less entanglement. In fact, it is an equal superposition of the two spin ground states. Is something like that expected here?&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3823/entanglement-entropy-near-phase-transition-in-1d?show=3838#a3838</guid>
<pubDate>Thu, 17 Mar 2022 18:58:18 +0000</pubDate>
</item>
<item>
<title>Answered: Computing the transfer matrix for iDMRG</title>
<link>http://itensor.org/support/3820/computing-the-transfer-matrix-for-idmrg?show=3837#a3837</link>
<description>&lt;p&gt;Hi Sylvain,&lt;br&gt;
Thanks for your patience. I belive the iDMRG you are meaning is the code here: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/ITensor/iDMRG&quot;&gt;https://github.com/ITensor/iDMRG&lt;/a&gt;  (just for reference of those reading).&lt;/p&gt;

&lt;p&gt;At a high level, here is some key information about that code and what it returns. When the iDMRG finishes running, the MPS that is return describes just one unit cell, of course. A key thing to know is that the MPS tensors are in the &quot;right orthogonal&quot; gauge meaning each of the tensors psi(1), psi(2), ... will be right orthogonal. &lt;/p&gt;

&lt;p&gt;There is a special tensor also returned as psi(0) which is the &quot;center tensor&quot; and it has no physical index, but lives on the link to the left of the first site.&lt;/p&gt;

&lt;p&gt;So for example if you wanted to compute properties only within one unit cell of say size 2, then &lt;code&gt;psi(0)*psi(1)*psi(2)&lt;/code&gt; would be the correct wavefunction of one unit cell. For two unit cells, conceptually &lt;code&gt;psi(0)*psi(1)*psi(2)*psi(1)*psi(2)&lt;/code&gt; would be the wavefunction. That is, you only use the center tensor psi(0) once and keep &quot;chaining&quot; the other MPS tensors to make a basis for the infinite unit cells going off to the right.&lt;/p&gt;

&lt;p&gt;From this background, you can see how the transfer matrix is schematically &lt;code&gt;dag(psi(1))*psi(1)*dag(psi(2))*psi(2)&lt;/code&gt;. I say schematically because there I am being very loose about the necessity to prime the link indices sticking out of the left and the right ends to make this contraction actually a matrix and not a scalar. Also you would never want to actually form the transfer matrix this way because it would cost the fourth power of the bond dimension of the MPS, which is a very high cost.&lt;/p&gt;

&lt;p&gt;So finally to get the transfer matrix spectrum, which is what you want as you know for obtaining the correlation length, you can obtain it using the Arnoldi algorithm which uses iterative applications of the matrix to get only the dominant right-eigenvectors and their eigenvalues. You will need to code a custom C++ object that defines the method &lt;/p&gt;

&lt;p&gt;&lt;code&gt;void product(ITensor const&amp;amp; in, ITensor &amp;amp; out)&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;which, given an input ITensor &quot;in&quot;, efficiently applies the transfer matrix to it one time and returns the resulting ITensor &quot;out&quot; so that it has the same collection of indices (including same prime levels) as the input ITensor. You can finally pass an instance of this custom object to the function &lt;code&gt;arnoldi&lt;/code&gt; defined here:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/ITensor/ITensor/blob/97f73cd7387b61420011ff36dbfd95ff87860990/itensor/iterativesolvers.h#L715&quot;&gt;https://github.com/ITensor/ITensor/blob/97f73cd7387b61420011ff36dbfd95ff87860990/itensor/iterativesolvers.h#L715&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Given the right parameters, you can obtain the dominant eigenvalues of the transfer matrix efficiently that way.&lt;/p&gt;

&lt;p&gt;Or you can use our new Julia ITensorInfiniteMPS package which includes a pre-written example code already of how to get the transfer matrix spectrum :^)&lt;br&gt;
That example is located here:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/ITensor/ITensorInfiniteMPS.jl/blob/main/examples/vumps/transfer_matrix_spectrum.jl&quot;&gt;https://github.com/ITensor/ITensorInfiniteMPS.jl/blob/main/examples/vumps/transfer_matrix_spectrum.jl&lt;/a&gt;&lt;br&gt;
And we could help you get set up using that package (it has to be installed separately but only takes a second - very easy) if you are interested in that approach.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3820/computing-the-transfer-matrix-for-idmrg?show=3837#a3837</guid>
<pubDate>Thu, 17 Mar 2022 18:50:09 +0000</pubDate>
</item>
<item>
<title>Answered: DMRG for 2D lattices with rotational symmetry</title>
<link>http://itensor.org/support/3794/dmrg-for-2d-lattices-with-rotational-symmetry?show=3833#a3833</link>
<description>&lt;p&gt;Hi Niccolò,&lt;/p&gt;

&lt;p&gt;I think the short answer is that it would probably be technically possible, but either through some nontrivial modifications of the DMRG algorithm &lt;br&gt;
(not just small modifications to the current DMRG code in ITensor) or by using a different optimization method like gradient optimization, where it is easier to implement optimizations with nontrivial constraints like that but would likely be slower than DMRG. My guess is that in the end it would be a lot of work and not really worth it.&lt;/p&gt;

&lt;p&gt;It is a bit easier to do with infinite MPS algorithms like VUMPS, but I found that there were subtle numerical issues involved with actually getting it working (for example details about which particular matrix factorizations you use when orthogonalizing the effective wavefunction to maintain the symmetry properly). I also only tried it for 1 site unit cells where it is more obvious how to implement that kind of symmetry, I think it would be more subtle for multi-site unit cells.&lt;/p&gt;

&lt;p&gt;In the end, you would at most get a factor of 2 speedup, which is ok but I think there are other strategies we are working on for real space parallelization and parallelizing over sums of Hamiltonians which would be more general, easier to implement, easier to maintain, and scale to speedups beyond a factor of 2. We are working on them now so hopefully they will be available to try out relatively soon!&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br&gt;
Matt&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3794/dmrg-for-2d-lattices-with-rotational-symmetry?show=3833#a3833</guid>
<pubDate>Thu, 17 Mar 2022 14:50:42 +0000</pubDate>
</item>
<item>
<title>Answered: Computing correlation function</title>
<link>http://itensor.org/support/3795/computing-correlation-function?show=3824#a3824</link>
<description>&lt;p&gt;Wow okay this is so embarrassing but the bug was in my plotting function all along. The code as described above works perfectly fine! Thank you to everyone who tried to help, and I am so sorry for wasting your time like this&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3795/computing-correlation-function?show=3824#a3824</guid>
<pubDate>Tue, 15 Mar 2022 20:26:57 +0000</pubDate>
</item>
<item>
<title>SPIN-SPIN CORREALTION FOR A TWO LEG LADDER MODEL</title>
<link>http://itensor.org/support/3821/spin-spin-correaltion-for-a-two-leg-ladder-model</link>
<description>&lt;p&gt;Hii,&lt;/p&gt;

&lt;p&gt;I am doing DMRG  of a two leg ladder model  in ITensor  julia.&lt;/p&gt;

&lt;p&gt;I have calculated the ground sate energy and spin-spin correlation in 1D Heisenberg model and 1D Hubbard model and it gives correct ground state energy  and spin-spin(Total spin on each site) .&lt;/p&gt;

&lt;p&gt;However, when i calculated DMRG for a two leg ladder model (for 48*2 sites) , it appears the ground state energy is correct, but the spin-spin correlation is antiferromagnetic while the actual correlation should be ferromagnetic.&lt;/p&gt;

&lt;p&gt;Here is the Hamiltonian of the code with parameters&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Nx=48

N= 2*Nx

sites=siteinds(&quot;Electron&quot;,N,conserve_qns=true,conserve_nf = true,conserve_sz=true,conserve_nfparity=false)



ampo =AutoMPO()

#intra-leg hopping
for j=1:2:(N-3)

    ampo += -t,&quot;Cdagup&quot;,j,&quot;Cup&quot;,j+2
    ampo += -t,&quot;Cdagup&quot;,j+2,&quot;Cup&quot;,j
    ampo += -t,&quot;Cdagdn&quot;,j,&quot;Cdn&quot;,j+2
    ampo += -t,&quot;Cdagdn&quot;,j+2,&quot;Cdn&quot;,j


    ampo += -t,&quot;Cdagup&quot;,j+1,&quot;Cup&quot;,j+3
    ampo += -t,&quot;Cdagup&quot;,j+3,&quot;Cup&quot;,j+1
    ampo += -t,&quot;Cdagdn&quot;,j+1,&quot;Cdn&quot;,j+3
    ampo += -t,&quot;Cdagdn&quot;,j+3,&quot;Cdn&quot;,j+1

end

#inter-leg hopping

p=1

for j =1:2:(N-1)

    ampo += Q(p),&quot;Cdagup&quot;,j,&quot;Cup&quot;,j+1
    ampo += conj(Q(p)),&quot;Cdagup&quot;,j+1,&quot;Cup&quot;,j
    ampo += Q(p),&quot;Cdagdn&quot;,j,&quot;Cdn&quot;,j+1
    ampo += conj(Q(p)),&quot;Cdagdn&quot;,j+1,&quot;Cdn&quot;,j
    p=p+1

end   





# On-site interaction       

for j=1:N

    ampo += U,&quot;Nupdn&quot;,j


end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I kept the particle number fixed as i want to calculate ground sate energy  at some particular electron density.&lt;/p&gt;

&lt;p&gt;After performing the DMRG with the above Hamiltonian i calculate the spin-spin correlation in the following way&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;xxcorr = correlation_matrix(psi,&quot;S+&quot;,&quot;S-&quot;)
yycorr = correlation_matrix(psi,&quot;S-&quot;,&quot;S+&quot;)
zzcorr = correlation_matrix(psi,&quot;Sz&quot;,&quot;Sz&quot;)
zz =  0.5* xxcorr + 0.5 * yycorr +  zzcorr
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I calculate the spin-spin correlation for a reference site  away from the boundary.&lt;/p&gt;

&lt;p&gt;But as i mentioned i am not getting the correct spin-spin correlations(which is ferromagnetic for some given parameters).&lt;/p&gt;

&lt;p&gt;So ,is there   anything wrong in  writing the Hamiltonian or in the correlation matrix ?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3821/spin-spin-correaltion-for-a-two-leg-ladder-model</guid>
<pubDate>Mon, 14 Mar 2022 19:02:11 +0000</pubDate>
</item>
<item>
<title>Answered: [C++] Convert an MPS with quantum number to an MPS without quantum number</title>
<link>http://itensor.org/support/3818/convert-mps-with-quantum-number-mps-without-quantum-number?show=3819#a3819</link>
<description>&lt;p&gt;Hi Chiamin,&lt;br&gt;
Yes, there is a function called &lt;code&gt;removeQNs(MPS const&amp;amp; psi)&lt;/code&gt; that you can call on an MPS that will remove all of the quantum numbers and make the storage dense.&lt;/p&gt;

&lt;p&gt;There isn't any function that will remove only some of the quantum numbers and not others, however.&lt;/p&gt;

&lt;p&gt;I think for these more technical kinds of things, we would need help adding these features to ITensor which could be quite a project. It's something we might consider doing in the Julia version first if it would be used often, then porting back to the C++ version.&lt;/p&gt;

&lt;p&gt;Best,&lt;br&gt;
Miles&lt;/p&gt;

&lt;p&gt;P.S. would you be able to do the application you want just with a regular dense MPS rather than having to keep the parity quantum numbers?&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3818/convert-mps-with-quantum-number-mps-without-quantum-number?show=3819#a3819</guid>
<pubDate>Mon, 14 Mar 2022 18:19:52 +0000</pubDate>
</item>
<item>
<title>Answered: [Julia]using a periodic boundary condition</title>
<link>http://itensor.org/support/3811/julia-using-a-periodic-boundary-condition?show=3814#a3814</link>
<description>&lt;p&gt;Hi, to answer your question, I just added a &quot;Frequently Asked Question&quot; FAQ entry here:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://itensor.github.io/ITensors.jl/dev/faq/DMRG.html#How-to-do-periodic-boundary-condition-DMRG&quot;&gt;https://itensor.github.io/ITensors.jl/dev/faq/DMRG.html#How-to-do-periodic-boundary-condition-DMRG&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;since it's something I get asked from time to time.&lt;/p&gt;

&lt;p&gt;Please let me know if that FAQ doesn't answer your question &amp;amp; we could discuss it more.&lt;/p&gt;

&lt;p&gt;Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3811/julia-using-a-periodic-boundary-condition?show=3814#a3814</guid>
<pubDate>Sun, 13 Mar 2022 23:10:27 +0000</pubDate>
</item>
<item>
<title>Answered: Time dependent correlations</title>
<link>http://itensor.org/support/3798/time-dependent-correlations?show=3801#a3801</link>
<description>&lt;p&gt;Hi, so I think the way to figure this out is to look at the expression&lt;/p&gt;

&lt;p&gt;&amp;lt;Sz&lt;em&gt;1(t) Sz&lt;/em&gt;4(0)&amp;gt; = exp(i E0 t) &amp;lt;0| Sz&lt;em&gt;4 exp(-iHt) Sz&lt;/em&gt;1 |0&amp;gt;&lt;/p&gt;

&lt;p&gt;which is what I believe you want to compute. Then reading it from right to left as a sequence of operations, they are:&lt;br&gt;
1. compute the ground state |0&amp;gt;&lt;br&gt;
2. act on the ground state with Sz&lt;em&gt;1 before doing any time evolution&lt;br&gt;
3. take the resulting state and time evolve it for a time t&lt;br&gt;
4. act on that state with Sz&lt;/em&gt;4&lt;br&gt;
5. take the overlap with the ground state ket &amp;lt;0| and multiply by exp(i E0 t) where E0 is the ground state energy&lt;/p&gt;

&lt;p&gt;A trick that can be done to make this more efficient is to break up exp(-i H t) as exp(-i H t/2) exp(-i H t/2) then act the first one of those time-evolution operators to the left. When you take the dagger this actually means an evolution of the ket Sz_4|0&amp;gt; by an opposite-sign time evolution of exp(+i H t/2). But before trying this trick you may want to follow the simpler prescription above to get some reference results.&lt;/p&gt;

&lt;p&gt;Hope that helps –&lt;/p&gt;

&lt;p&gt;Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3798/time-dependent-correlations?show=3801#a3801</guid>
<pubDate>Fri, 11 Mar 2022 03:25:41 +0000</pubDate>
</item>
<item>
<title>Answered: [Julia]define the state in different Hilbert space</title>
<link>http://itensor.org/support/3799/julia-define-the-state-in-different-hilbert-space?show=3800#a3800</link>
<description>&lt;p&gt;Hi, it's a good question as we have not documented this,  and need to! &lt;/p&gt;

&lt;p&gt;For now, a good way to learn how to define these kind of state definitions, such as &quot;Up&quot; and &quot;Dn&quot; for spin systems, is to look at how it is done in our source code, because the code you would need to write is the same. (Of course reading about it in the documentation will be even better once we document it!)&lt;/p&gt;

&lt;p&gt;Here is a link to the spinone.jl file where we create the states using the function ITensors.state:&lt;/p&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/ITensor/ITensors.jl/blob/main/src/physics/site_types/spinone.jl&quot;&gt;https://github.com/ITensor/ITensors.jl/blob/main/src/physics/site_types/spinone.jl&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the 3/2 example, you would do something like this:&lt;/p&gt;

&lt;p&gt;ITensors.state(::StateName&quot;Up&quot;, ::SiteType&quot;S=1&quot;) = [1.0, 0.0, 0.0, 0.0]&lt;/p&gt;

&lt;p&gt;So the key points are:&lt;br&gt;
  - you define a function named ITensors.state taking a StateName and SiteTyp&lt;br&gt;
  - it returns a vector which can be anything you want, and does not have to have only 1 and 0 entries&lt;br&gt;
  - once you define this function, you can immediately use your new states in the productMPS function and elsewhere&lt;/p&gt;

&lt;p&gt;Hope that helps and please let us know if you run into any issues.&lt;/p&gt;

&lt;p&gt;Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3799/julia-define-the-state-in-different-hilbert-space?show=3800#a3800</guid>
<pubDate>Thu, 10 Mar 2022 16:02:47 +0000</pubDate>
</item>
<item>
<title>Answered: Time evolution under periodic Hamiltoian</title>
<link>http://itensor.org/support/3796/time-evolution-under-periodic-hamiltoian?show=3797#a3797</link>
<description>&lt;p&gt;Hi, thanks for the question. I think there are two considerations here:&lt;/p&gt;

&lt;p&gt;1) the AutoMPO, MPO-based method for time evolution has turned out to not always be reliable. It is not due to a bug, but more of a limitation of the method used to exponentiate the Hamiltonian there. So I would instead recommend you use the TDVP method for time evolution. We have a code for that method here: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/ITensor/TDVP&quot;&gt;https://github.com/ITensor/TDVP&lt;/a&gt; and it includes a sample code. The sample code does imaginary time evolution but you can change t to t*Complex_i to do real-time evolution. I have updated the ITensor &quot;Code Formula&quot; about the MPO method to note that it's better to use TDVP.&lt;/p&gt;

&lt;p&gt;2) regarding periodic systems (I think when you say closed boundary conditions you are referring to periodic boundary conditions?) it has long been a limitation of MPS that the techniques for doing periodic systems are not as well developed. However, you can still input a periodic Hamiltonian to AutoMPO to use within TDVP. What AutoMPO does is it makes an open-boundary MPO but with a &quot;long bond&quot; connecting the first and last site inside the MPO.&lt;/p&gt;

&lt;p&gt;This approach of using open-boundary MPO and MPS for periodic Hamiltonians is technically correct and works well for small system sizes. For larger systems it can lead to large bond dimensions of the MPS and can be hard to converge well.&lt;/p&gt;

&lt;p&gt;So I think a key question is: do you really need periodic boundaries for the system you are studying? Although they are &quot;standard&quot; in theoretical calculations, they are often not the best choice for MPS numerics. I have more to say about that here: &lt;a rel=&quot;nofollow&quot; href=&quot;https://itensor.github.io/ITensors.jl/stable/faq/DMRG.html#What-boundary-conditions-should-I-choose:-open,-periodic,-or-infinite?&quot;&gt;https://itensor.github.io/ITensors.jl/stable/faq/DMRG.html#What-boundary-conditions-should-I-choose:-open,-periodic,-or-infinite?&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3796/time-evolution-under-periodic-hamiltoian?show=3797#a3797</guid>
<pubDate>Tue, 08 Mar 2022 15:44:16 +0000</pubDate>
</item>
<item>
<title>Answered: The principle of calculating excited states using DMRG</title>
<link>http://itensor.org/support/3784/the-principle-of-calculating-excited-states-using-dmrg?show=3788#a3788</link>
<description>&lt;p&gt;Hi, you can see section III.C. on page 7 of this paper for a discussion about the technique we have made available to compute excited states: &lt;a rel=&quot;nofollow&quot; href=&quot;https://arxiv.org/pdf/1105.1374&quot;&gt;https://arxiv.org/pdf/1105.1374&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is a discussion of this feature in the Julia documentation:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://itensor.github.io/ITensors.jl/stable/examples/DMRG.html#Compute-excited-states-with-DMRG&quot;&gt;https://itensor.github.io/ITensors.jl/stable/examples/DMRG.html#Compute-excited-states-with-DMRG&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's an idea which is used in other numerical methods too, just to change the objective of the code to require the state being computed to be orthogonal to a previous state.&lt;/p&gt;

&lt;p&gt;Thanks for the kind words about ITensor!&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3784/the-principle-of-calculating-excited-states-using-dmrg?show=3788#a3788</guid>
<pubDate>Wed, 23 Feb 2022 03:58:49 +0000</pubDate>
</item>
<item>
<title>Answered: Spontaneous symmetry breaking and ground state</title>
<link>http://itensor.org/support/3783/spontaneous-symmetry-breaking-and-ground-state?show=3787#a3787</link>
<description>&lt;p&gt;Hi Ajit,&lt;br&gt;
As mentioned above please do view the other discussion which Navya linked which goes into more detail.&lt;/p&gt;

&lt;p&gt;A short answer is that the true ground state of a symmetric system which breaks a symmetry is a symmetric linear combination of the symmetry-broken (quasi-) ground states. But this true ground state is only lower in energy by a very tiny amount than the symmetry-broken states, and has higher entanglement in general. So in practice on moderate to large system sizes DMRG will return a symmetry broken state. It can be a helpful technique to actually force this to happen by applying &quot;pinning&quot; fields on the edge sites to go ahead and select one of the symmetry breaking scenarios.&lt;/p&gt;

&lt;p&gt;Regarding the Weight parameter, I don't know a clear theory about how it should be chosen, but I believe it should be larger than the gap between the ground and first excited states. (Otherwise the energy penalty, which the weight adjusts, may not be strong enough for the returned state to be orthogonal.) So I'd recommend proceeding by guessing a moderately large value for the weight, then checking afterward that the returned state is really orthogonal to the previous ones. If you have any problem with convergence, try lowering the weight. &lt;/p&gt;

&lt;p&gt;Test this all out on small system sizes, and it's always a good idea to plot real-space properties of your states, especially for excited states which often need many more sweeps to converge fully.&lt;/p&gt;

&lt;p&gt;Best,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3783/spontaneous-symmetry-breaking-and-ground-state?show=3787#a3787</guid>
<pubDate>Wed, 23 Feb 2022 03:56:06 +0000</pubDate>
</item>
<item>
<title>Answered: DMRG FOR TWO LEG LADDER MODEL</title>
<link>http://itensor.org/support/3780/dmrg-for-two-leg-ladder-model?show=3782#a3782</link>
<description>&lt;p&gt;Hi Paban,&lt;br&gt;
Thanks for the good questions.&lt;/p&gt;

&lt;p&gt;a) for the filling you have two options: the main one is to use our quantum number (QN) conservation system, which works as you guessed: if you use site indices (calling the &lt;code&gt;siteinds&lt;/code&gt; function) with the conserve_qns=true, then when you prepare the initial state for DMRG, the number of particles in that initial state will remain unchanged by our DMRG code.&lt;/p&gt;

&lt;p&gt;If you turn off or do not conserve particle number, then you would have to add a chemical potential term to your Hamiltonian or otherwise tune your Hamiltonian to get the density that you want.&lt;/p&gt;

&lt;p&gt;b) for making custom measurements or other behaviors during a DMRG calculation, we have a very powerful system called the &quot;Observer System&quot; where you define a custom type and a function called &lt;code&gt;measure!&lt;/code&gt; for it that will be called throughout the DMRG code (if you pass your observer type to the &lt;code&gt;dmrg&lt;/code&gt; function). Then in your &lt;code&gt;measure!&lt;/code&gt; function you can put any code you want, such as measuring local observables, calling the &lt;code&gt;expect&lt;/code&gt; function to measure every site (I would do this only once per sweep, since it's a global measurement), write data to files, and anything else. Please let us know if you have any questions about how to use it.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3780/dmrg-for-two-leg-ladder-model?show=3782#a3782</guid>
<pubDate>Tue, 15 Feb 2022 23:22:19 +0000</pubDate>
</item>
<item>
<title>Answered: Time evolution of local green function using two applyMPO for spinless-fermions.</title>
<link>http://itensor.org/support/3725/evolution-local-green-function-applympo-spinless-fermions?show=3779#a3779</link>
<description>&lt;p&gt;Hi, thanks for the good question and your patience with a slow reply.&lt;/p&gt;

&lt;p&gt;While I'm not sure why you getting the value of zero on every other time step, I think there are a few major improvements to your approach which you should consider anyway, and after you make them this problem may disappear in the process of changing your code.&lt;/p&gt;

&lt;p&gt;Here are the improvements or fixes:&lt;br&gt;
1. since one of the exp(-i Ht) operators acts on the ground state of H, you can rigorously replace it by a scalar exp(-i E0 t) where E0 is the ground state energy &amp;lt;psi0|H|psi0&amp;gt; and so skip that step&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;a much better choice for doing the time evolution would be the TDVP algorithm, for which a high-quality implementation in ITensor is now available here:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/ITensor/TDVP&quot;&gt;https://github.com/ITensor/TDVP&lt;/a&gt;&lt;br&gt;
including a helpful sample code&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Especially #2 above might eliminate the zeros because I and others have found that unfortunately the MPO method (based on toExpH) has not turned out to be as accurate as originally hoped (I mean as an algorithm - not that there is anything buggy about how it is implemented by ITensor). TDVP is basically just a superior method in almost every way, with one caveat that one has to be careful about growing or adapting the MPS basis within TDVP. The 2-site TDVP method does this automatically but is somewhat less accurate than the 1-site TDVP method. For the 1-site TDVP method, the basis adaptation isn't automatic but can be achieved through a basis extension method (the addBasis function) shown in the TDVP code example.&lt;/p&gt;

&lt;p&gt;Or, last but very much not least, you can just use the Trotter gate or TEBD method for your time evolution. For your model which is short ranged and 1D, TEBD is a great method. It is efficient and automatically adapts the bond dimension in a very 'foolproof' and reliable way. The only advantage of TDVP over Trotter/TEBD for you model would be that TDVP allows larger time steps, basically. If I were in your shoes, I would implement both and use one as a check on the other, and not use the toExpH method.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3725/evolution-local-green-function-applympo-spinless-fermions?show=3779#a3779</guid>
<pubDate>Mon, 14 Feb 2022 16:43:50 +0000</pubDate>
</item>
<item>
<title>Answered: [C++ ITensor 3] MPO time evolution does not work for large interactions</title>
<link>http://itensor.org/support/3691/itensor-time-evolution-does-not-work-for-large-interactions?show=3776#a3776</link>
<description>&lt;p&gt;Hi Jin,&lt;br&gt;
I believe JR is correct that a smaller tau could help here, but of course it would be nice if you can use a method that allows a larger tau. &lt;/p&gt;

&lt;p&gt;Have you thought about using the TDVP method instead? It has all the advantages of the MPO approach you are using, but over the last handful of years has turned out to be much superior in terms of accuracy and ability to reliably use larger time steps.&lt;/p&gt;

&lt;p&gt;There is a high-quality TDVP code available for ITensor through this code repository:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/ITensor/TDVP&quot;&gt;https://github.com/ITensor/TDVP&lt;/a&gt;&lt;br&gt;
and it also includes a sample code to help you get started.&lt;/p&gt;

&lt;p&gt;There's one caution about TDVP, as you may know, that it historically has trouble 'adapting' the bond dimension automatically, either in the sense that it doesn't do so at all (1-site TDVP) or in the sense that it does it in a sub-optimal way (2-site TDVP). But the code linked above includes a novel 'basis expansion' method which you'll see used in the sample that improves the MPS basis to alleviate problems with the growth of the bond dimension in a proper way.&lt;/p&gt;

&lt;p&gt;As with any time evolution code, I'd recommend comparing to exact results either for small systems or in limits where an exact solution may be available.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3691/itensor-time-evolution-does-not-work-for-large-interactions?show=3776#a3776</guid>
<pubDate>Sun, 13 Feb 2022 04:04:15 +0000</pubDate>
</item>
<item>
<title>Answered: [julia] TEBD gates involving fermions</title>
<link>http://itensor.org/support/3743/julia-tebd-gates-involving-fermions?show=3773#a3773</link>
<description>&lt;p&gt;Hi Junsen,&lt;/p&gt;

&lt;p&gt;Good question. If you switch to using operators like &quot;Cdag&quot; and &quot;C&quot;, the evolution should just work. In practice, the fermion sign is handled with fermionic swap gates. If you apply local gates, there are no extra signs needed beyond those that might be within the operators themselves, and if you apply nonlocal gates, our fermionic swap system should handle the signs properly.&lt;/p&gt;

&lt;p&gt;Please try it out and let us know if you come across any issues.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br&gt;
Matt&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3743/julia-tebd-gates-involving-fermions?show=3773#a3773</guid>
<pubDate>Thu, 10 Feb 2022 13:46:50 +0000</pubDate>
</item>
<item>
<title>Answered: Possible bug in on-site terms - AutoMPO (C++)</title>
<link>http://itensor.org/support/3716/possible-bug-in-on-site-terms-autompo-c?show=3768#a3768</link>
<description>&lt;p&gt;Hi, so I checked some more on this. I think the code is working properly. It's hard (actually, impossible) to see from just looking at the first MPO tensor whether the MPO is correct because what operator is made by the MPO depends on all the MPO tensors. &lt;/p&gt;

&lt;p&gt;Here is a check you can do to tell whether in this case the MPO returned equals the requested operator:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;auto N2_1 = mapPrime( op(sites,&quot;N&quot;,1)*prime(op(sites,&quot;N&quot;,1)) ,2,1);
auto N2_2 = mapPrime( op(sites,&quot;N&quot;,2)*prime(op(sites,&quot;N&quot;,2)) ,2,1);
auto Id_1 = op(sites,&quot;Id&quot;,1);
auto Id_2 = op(sites,&quot;Id&quot;,2);

printfln(&quot;Norm difference = %.12f&quot;,norm(H(1)*H(2)-N2_1*Id_2-Id_1*N2_2));
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The first two lines make the operator N^2 on each site. Then the last line subtracts (N^2&lt;em&gt;1 + N^2&lt;/em&gt;2) from the operator defined by the MPO, which can be obtained by contracting all the MPO tensors together. When I run a code with your AutoMPO input at the top and this check at the end I find that the Norm difference as printed above is zero.&lt;/p&gt;

&lt;p&gt;Please let me know if that doesn't answer your question or if you have a follow-up question.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3716/possible-bug-in-on-site-terms-autompo-c?show=3768#a3768</guid>
<pubDate>Wed, 09 Feb 2022 17:59:09 +0000</pubDate>
</item>
<item>
<title>Answered: Customising the 'Custom SiteSet' in the Site set class ?</title>
<link>http://itensor.org/support/3762/customising-the-custom-siteset-in-the-site-set-class?show=3763#a3763</link>
<description>&lt;p&gt;Hi Eliem,&lt;br&gt;
It’s a good question. You can do this, however the typical outcome will be that DMRG and related algorithms will run more slowly than if you used separate sites for your various degrees of freedom. This is because MPS algorithms scale linearly in the number of sites, whereas they scale polynomially in the site dimension, and the site dimension itself grows exponentially as you group more degrees of freedom together onto one site. &lt;/p&gt;

&lt;p&gt;However it can in some cases be a good idea to group d.o.f. depending on the Hamiltonian. &lt;/p&gt;

&lt;p&gt;The way to define such a site type is just enumerate all the possible states it can be in, and make that the dimension of the site Index and assign the corresponding quantum numbers (QN’s) if applicable and if you plan to use that feature. &lt;/p&gt;

&lt;p&gt;If you do want to do this and need help, please let me know more details about your system. Thanks. &lt;/p&gt;

&lt;p&gt;Miles &lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3762/customising-the-custom-siteset-in-the-site-set-class?show=3763#a3763</guid>
<pubDate>Wed, 09 Feb 2022 14:07:31 +0000</pubDate>
</item>
<item>
<title>Answered: Spatial parity inversion of MPS using SWAP gates</title>
<link>http://itensor.org/support/3719/spatial-parity-inversion-of-mps-using-swap-gates?show=3754#a3754</link>
<description>&lt;p&gt;(Please see above discussion.)&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3719/spatial-parity-inversion-of-mps-using-swap-gates?show=3754#a3754</guid>
<pubDate>Mon, 07 Feb 2022 00:13:07 +0000</pubDate>
</item>
<item>
<title>Answered: Exponential of non-hermitian operator</title>
<link>http://itensor.org/support/3688/exponential-of-non-hermitian-operator?show=3753#a3753</link>
<description>&lt;p&gt;Thanks for the question. Yes the example code you linked to (involving the BondGate class) ought to work well for non-Hermitian operators. I think the Trotter expansion itself would still be justified in this case and the part of the code which does the exponentiation, which is inside the BondGate class itself, uses a general enough algorithm that it should handle exponentiating any type of operator. (Internally, BondGate sums a very high order Taylor series to exponentiate the local operator.)&lt;/p&gt;

&lt;p&gt;Regarding part (2) of your question, there is a built-in function to exponentiate local Hermitian operators, which is called expHermitian, but only for that case. However, as mentioned above the code you linked to uses the BondGate class which does the exponentiation internally using a different (high-order Taylor) algorithm. So that may be all you need for your use case.&lt;/p&gt;

&lt;p&gt;But we have not written tests for the non-Hermitian case, so I'd say please proceed with some case. Please test some exactly solvable or known limits of your problem such as small system sizes where you could do everything exactly with matrix methods. This is a good practice anyway even when using fully supported and tested cases such as Hermitian time evolution, because every new physical system presents its own challenges.&lt;/p&gt;

&lt;p&gt;Please let us know if you don't get the results you expect when doing those initial checks.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3688/exponential-of-non-hermitian-operator?show=3753#a3753</guid>
<pubDate>Mon, 07 Feb 2022 00:12:18 +0000</pubDate>
</item>
<item>
<title>Answered: Stopping a DMRG Run &quot;Gracefully&quot;</title>
<link>http://itensor.org/support/3745/stopping-a-dmrg-run-gracefully?show=3749#a3749</link>
<description>&lt;p&gt;Hi Leandro,&lt;/p&gt;

&lt;p&gt;Yes, there is a detailed and nice &lt;a rel=&quot;nofollow&quot; href=&quot;https://itensor.github.io/ITensors.jl/stable/Observer.html#Defining-a-Custom-Observer&quot;&gt;doc&lt;/a&gt; on how to stop early in Julia, using the so-called observer system. I personally have customized my own observer based on this post : )&lt;/p&gt;

&lt;p&gt;Best,&lt;br&gt;
Junsen&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3745/stopping-a-dmrg-run-gracefully?show=3749#a3749</guid>
<pubDate>Sun, 06 Feb 2022 08:01:24 +0000</pubDate>
</item>
<item>
<title>Answered: How to create a random state with definite fermion parity?</title>
<link>http://itensor.org/support/3690/how-to-create-a-random-state-with-definite-fermion-parity?show=3746#a3746</link>
<description>&lt;p&gt;Hi Navya,&lt;/p&gt;

&lt;p&gt;This is not an answer to your question. Just provide some information.&lt;/p&gt;

&lt;p&gt;In my case, when using the following site type&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sites = [
if mod(n,3) == 2
    Index([QN()=&amp;gt;2]; tags=&quot;S=1/2, Site, n=$n&quot;)
else
    siteind(&quot;Fermion&quot;, n;conserve_qns=true)
end
for n = 1:3*ns
    ]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and &lt;code&gt;randomMPS(sites,state,10)&lt;/code&gt;, I obtain the following warning:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Warning: MPS center bond dimension is less than requested (you requested 10, but in practice it is 1. This is likely due to technicalities of truncating quantum number sectors.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And I find the fermion number distribution is the same as given, i.e., there is no randomness in the fermion sector. However, the spin sector is indeed random.&lt;/p&gt;

&lt;p&gt;Instead, if I use the following site type&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sites = [
    if mod(n,3) == 2
        Index([QN()=&amp;gt;2]; tags=&quot;S=1/2, Site, n=$n&quot;)
    else
        siteind(&quot;Fermion&quot;, n;conserve_nfparity=true)
    end
    for n = 1:3*ns
        ]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The good news is that now the fermion sector also becomes random (by checking the fermion number distribution), however, it seems that the fermion parity is not conserved! In fact the total number of fermion is found to be a non-integer.&lt;/p&gt;

&lt;p&gt;Note, in my own project, the first site type and an essentially non-random (in the fermion sector) state &lt;code&gt;randomMPS(sites,state)&lt;/code&gt; are used, and it is so far so good :)&lt;/p&gt;

&lt;p&gt;Best,&lt;br&gt;
Junsen&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3690/how-to-create-a-random-state-with-definite-fermion-parity?show=3746#a3746</guid>
<pubDate>Sat, 05 Feb 2022 02:15:25 +0000</pubDate>
</item>
<item>
<title>Answered: [julia] how to create local identity operator</title>
<link>http://itensor.org/support/3738/julia-how-to-create-local-identity-operator?show=3739#a3739</link>
<description>&lt;p&gt;Hi Junsen,&lt;br&gt;
You can use the operator name &quot;Id&quot; to do this. So like &lt;code&gt;op(&quot;Id&quot;,sites,j)&lt;/code&gt; or alternatively &lt;code&gt;op(&quot;Id&quot;,ind)&lt;/code&gt; where ind is a Index object.&lt;/p&gt;

&lt;p&gt;This particular operator (&quot;Id&quot;) is actually defined for all indices, not just ones carrying special tags.&lt;/p&gt;

&lt;p&gt;Hope that is the answer you need -&lt;/p&gt;

&lt;p&gt;Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3738/julia-how-to-create-local-identity-operator?show=3739#a3739</guid>
<pubDate>Thu, 03 Feb 2022 15:01:37 +0000</pubDate>
</item>
<item>
<title>Answered: Symmetry breaking in the transverse field Ising model/ Kitaev chain</title>
<link>http://itensor.org/support/3729/symmetry-breaking-transverse-field-ising-model-kitaev-chain?show=3733#a3733</link>
<description>&lt;p&gt;Hi Navya,&lt;br&gt;
That's a lot of questions :^) But they are good ones. I will answer the ones I'm most confident about, then please comment below to remind me to try to answer the others as soon as I can or if my answer here is enough already.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Yes this is partly right. But a more key and simple reason this happens is that the energy of the cat state is only a little smaller than a non-cat state, and this difference goes exponentially to zero with system size. You can think of DMRG as always making a trade-off between energy and entanglement, so it's as if DMRG doesn't &quot;think it's worth it&quot; to spend a whole lot more entanglement to gain only a very tiny bit of energy. More rigorously, I think what is happening is that DMRG is technically slightly stuck in a (barely) excited state and just can't 'find' the cat state which is the true ground state.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The last part of my answer to (1) is the answer to this. The part about spending entanglement is more of a non-rigorous intuition. Really DMRG is a dynamical process where the MPS &quot;environment&quot; gets built from some initial state and then is used to project the Hamiltonian into a small part of the Hilbert space. This projected Hamiltonian and not the full one is used in the core step of DMRG to update the previous MPS basis on one site and then slide to the next site. So if one does not already start with an initial MPS that is a cat state, then the projection built from the non-cat initial state probably keeps DMRG from &quot;seeing&quot; that a cat solution exists. I think even a small deviation from a perfect cat initial state is probably unstable to a non-cat final state of DMRG for related reasons (how the MPS basis gets built and updated dynamically within DMRG).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I don't think there's a simple way to force DMRG to find cat states other than to maybe start already in a perfect cat state and carefully design a flavor of DMRG to preserve that property. Maybe there is some kind of internal MPS symmetry or gauge that can be enforced but it's not immediately obvious to me.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I have not found that DMRG makes a superposition of even and odd parity states for the Kitaev chain, and I studied a closely related system with DMRG in a paper of mine. I would say that in some philosophical sense you aren't really studying fermions if you don't enforce parity quantum number conservation. Or at least you can always choose to conserve this for a closed fermionic system. So I would make sure to use ITensor's QN DMRG mode and enforce fermion parity. Then you can just start off in a state of definite parity and our DMRG code will rigorously always stay in that parity sector. Then by how the mapping of the Kitaev chain works relative to the Ising chain, you will necessarily be in a cat state because the fermion parity conservation will enforce that.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For 5 &amp;amp; 6 I would suggest revisiting these questions in light of the idea of using QN conservation to enforce even or odd parity as discussed above.&lt;/p&gt;

&lt;p&gt;Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3729/symmetry-breaking-transverse-field-ising-model-kitaev-chain?show=3733#a3733</guid>
<pubDate>Mon, 31 Jan 2022 02:53:29 +0000</pubDate>
</item>
<item>
<title>Answered: DMRG for phase transitions</title>
<link>http://itensor.org/support/3730/dmrg-for-phase-transitions?show=3731#a3731</link>
<description>&lt;p&gt;Hi, I would say that – yes DMRG can certainly be used very well to study critical systems and phase transitions, especially of 1d systems.&lt;/p&gt;

&lt;p&gt;So it seems that the core of your issue is that for certain values of lambda, or perhaps certain initial states you happened to use for those values (it may be less about lambda itself, hard to be sure from what I know) that you are likely getting stuck into a state which is not the ground state. As you know that can happen easily with DMRG for some systems. It's good to see you are using the noise term which can help a lot with sticking.&lt;/p&gt;

&lt;p&gt;Did you rerun your calculation for the (possibly) troublesome values of lambda, such as lambda=0.26 here, again for a second or third time with different initial states? Is there a local property you can plot to visualize the states DMRG reaches at the end to inspect whether they look similar to each other for nearby lambda or very different? Those are the first two steps I would try. I would also try on very small system sizes first to see if the sticking can be avoided then work my way up to larger system sizes gradually.&lt;/p&gt;

&lt;p&gt;Hope that helps a bit –&lt;/p&gt;

&lt;p&gt;Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3730/dmrg-for-phase-transitions?show=3731#a3731</guid>
<pubDate>Mon, 31 Jan 2022 02:34:53 +0000</pubDate>
</item>
<item>
<title>Answered: How to calculate string operator in ITensor-3 C version</title>
<link>http://itensor.org/support/3715/how-to-calculate-string-operator-in-itensor-3-c-version?show=3721#a3721</link>
<description>&lt;p&gt;Hi, good question. So I think in this case because the operators inside and outside the exponential are all commuting, you can just write the exponential of the sum as a product of exponentials and then just locally exponentiate each Sz_k operator (this can just be done on paper even, ahead of time). So then to measure such a string operator which is now a product of local operators, you can either make an MPO which just has a bond dimension of 1 (product MPO) or just apply each operator to one of the MPS in the expectation value and finally compute the overlap with the other MPS. &lt;/p&gt;

&lt;p&gt;Hope that helps you find the answer you need - if not please comment below.&lt;/p&gt;

&lt;p&gt;Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3715/how-to-calculate-string-operator-in-itensor-3-c-version?show=3721#a3721</guid>
<pubDate>Mon, 24 Jan 2022 16:29:59 +0000</pubDate>
</item>
<item>
<title>Answered: toExpH in Julia</title>
<link>http://itensor.org/support/3718/toexph-in-julia?show=3720#a3720</link>
<description>&lt;p&gt;Hi Andreas,&lt;br&gt;
It’s a good question. It’s one of the few features of the C++ version we have not implemented in Julia yet. We may do it, however there are two reasons why it’s less urgent than it might seem:&lt;br&gt;
1. it’s been found that the MPO exponentiation method used for that is not as accurate for time evolution as other methods like Trotter gates or TDVP&lt;br&gt;
2. we should have a TDVP code available in Julia sometime this spring, and TDVP has all of the benefits of MPO time evolution plus many other benefits so it’s basically a superior method&lt;/p&gt;

&lt;p&gt;What system are you studying that you need toExpH for? Does it have long-range interactios?&lt;/p&gt;

&lt;p&gt;Miles&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3718/toexph-in-julia?show=3720#a3720</guid>
<pubDate>Mon, 24 Jan 2022 16:26:50 +0000</pubDate>
</item>
<item>
<title>Answered: [julia] Out of memory problem</title>
<link>http://itensor.org/support/3700/julia-out-of-memory-problem?show=3714#a3714</link>
<description>&lt;p&gt;(Please see discussion above.)&lt;/p&gt;
</description>
<guid isPermaLink="true">http://itensor.org/support/3700/julia-out-of-memory-problem?show=3714#a3714</guid>
<pubDate>Wed, 19 Jan 2022 17:59:47 +0000</pubDate>
</item>
</channel>
</rss>