Search found 407 matches

by Johannes
17 Aug 2022, 15:39
Forum: HowTos and FAQ for TeNPy
Topic: Converting MPS to State Vector
Replies: 2
Views: 2102

Re: Converting MPS to State Vector

Formally yes , you can do it by just contracting all the tensors of the MPS, leaving the physical legs open. Depending on your preferred form, you might want to combine the L physical legs of dimension d into a single, big leg of dimension dim(\mathcal{H})= d^L , but this is essentially just a resh...
by Johannes
10 Aug 2022, 16:30
Forum: HowTos and FAQ for TeNPy
Topic: Regarding Two point correlation function in TenPy
Replies: 2
Views: 1905

Re: Regarding Two point correlation function in TenPy

In general, you should probably do this for one j in the center of your chain only and write this as C(t) = \langle \psi_0 | e^{i H t} S^z_i e^{-iHt} S^z_j | \psi_0 \rangle = \langle \psi(t) | S^z_i | \phi(t) \rangle, \quad \text{where} \quad |\psi(t) \rangle = e^{-iHt} |\psi_0 \rangle \text{~and~} ...
by Johannes
10 Aug 2022, 16:08
Forum: HowTos and FAQ for TeNPy
Topic: UserWarnings differ for identical initializations when run several times
Replies: 1
Views: 1600

Re: UserWarnings differ for identical initializations when run several times

That's expected behaviour given the implmentation of these warnings. The engine does use the options, but only once you actually time evolve the state with eng.run() . This stems from the convention that options only need to be read out by the time when they are actually used: depending on previousl...
by Johannes
29 Jul 2022, 10:21
Forum: HowTos and FAQ for TeNPy
Topic: My correlation functions from MPS.correlation_function and MPSEnvironment.expectation value disagree
Replies: 2
Views: 1736

Re: My correlation functions from MPS.correlation_function and MPSEnvironment.expectation value disagree

The issue is confusion about the (first two) arguments of correlation_function . Giving a list of operators as arguments does not mean that you evaluate correlations between multi-site terms, but that you evaluate different correlation functions on even vs odd sites: psi.correlation_function(['A','B...
by Johannes
29 Jul 2022, 07:09
Forum: HowTos and FAQ for TeNPy
Topic: Crash during calculation of <Sy>
Replies: 4
Views: 2139

Re: Crash during calculation of <Sy>

Glad to hear that :)
by Johannes
27 Jul 2022, 16:25
Forum: HowTos and FAQ for TeNPy
Topic: Crash during calculation of <Sy>
Replies: 4
Views: 2139

Re: Crash during calculation of <Sy>

I checked, and the code runs without issues on my machine. I'd guess it's some incompatibility/issue with the BLAS code being called in the end. First of all, try whether it works with export TENPY_OPTIMIZE=0 , which forces TeNPy to not load the compiled Cython parts. How did you install TeNPy? Did ...
by Johannes
26 Jul 2022, 16:26
Forum: HowTos and FAQ for TeNPy
Topic: Spin-Boson MPO
Replies: 1
Views: 1786

Re: Spin-Boson MPO

Hi, and sorry for the slow response; I hope it's still useful, given that I added extensive examples and further functions! Let me first explain why your examples do or don't work: When you write the MPO grid as W_0 = (S^z, S^x); W_1 = (N, N^2)^T or as in the last example, The [tenpyclass=tenpy.netw...
by Johannes
22 Jul 2022, 08:40
Forum: HowTos and FAQ for TeNPy
Topic: term_correlation_function_left for MPSEnvironment
Replies: 3
Views: 2264

Re: term_correlation_function_left for MPSEnvironment

You can also do SpIdSm = tenpy.networks.site.kron(s.Sp, s.Id, S.Sm, group=False) The tenpy.networks.site.kron function with n input onsite operators generates an operator acting on n consecutive sites at once, with n input and n output legs, e.g for n=3, p0*, p1*, p2*, p0, p1, p2 . The expectation_v...
by Johannes
19 Jul 2022, 10:22
Forum: HowTos and FAQ for TeNPy
Topic: reset environment
Replies: 1
Views: 19470

Re: reset environment

Since you fully re-initialize the TwoSiteDMRGEngine in the example you sent without passing the environment, you actually don't reuse the environment here. You define a new (random) product_state , but don't use it to initialize psi itself, I assume you also do that within the loop? And what exactly...
by Johannes
19 Jul 2022, 09:55
Forum: HowTos and FAQ for TeNPy
Topic: term_correlation_function_left for MPSEnvironment
Replies: 3
Views: 2264

Re: term_correlation_function_left for MPSEnvironment

Really, the proper functions is to adjust the *correlation_function methods of the MPS to the MPSEnvironment, see the new 173 . If you really just need the nearest-neighbor correlations, the expectation_value actually supports this: import tenpy s = tenpy.networks.site.SpinHalfSite() psi = tenpy.net...
by Johannes
18 Jul 2022, 16:09
Forum: HowTos and FAQ for TeNPy
Topic: Hermitian conjugate for coupled system
Replies: 1
Views: 1403

Re: Hermitian conjugate for coupled system

The first example adds terms b^\dagger_{x,0} b_{x,1} n_{x+1,1} + b^\dagger_{x,1} b_{x,0} n_{x+1,0} , which is not hermitian due to the switch in the n index. DMRG (or more precisely the Lanczos called by DMRG) always assumes a hermitian Hamiltonian! The "poorly conditioned Lanczos" is like...
by Johannes
18 Jul 2022, 15:48
Forum: HowTos and FAQ for TeNPy
Topic: Cell choice and long range correlations in a 2D iDMRG calculation
Replies: 2
Views: 1528

Re: Cell choice and long range correlations in a 2D iDMRG calculation

If you expect translation invariance along the cylinder direction (and you Hamiltonian itself is also translation invariant in x-direction), Lx=1 is certainly a natural choice. Using Lx=1 does not hinder the calculation of correlation lengths - in general, if you have an infinite MPS, it just implie...
by Johannes
18 Jul 2022, 15:11
Forum: HowTos and FAQ for TeNPy
Topic: Different Energy measures giving mixed results
Replies: 1
Views: 1425

Re: Different Energy measures giving mixed results

TEBD breaks translation invariance by performing the Trotterization of the evolution operator onto even/odd bonds. The direct way to reduce this effect is to do more, but smaller timesteps. You could also try to do higher-order evolution, but of course that doesn't make your algorithm higher-order i...
by Johannes
18 Jul 2022, 14:42
Forum: HowTos and FAQ for TeNPy
Topic: Newcomer of tenpy having an issue with my code
Replies: 1
Views: 6681

Re: Newcomer of tenpy having an issue with my code

It's correct behaviour that the state doesn't change: You start from the fully polarized all-up state, which is an eigenstate of the Hamiltonian! Try to start from another initial state, e.g. the Neel state: product_state = ["up", "down"] psi = MPS.from_product_state(M.lat.mps_si...
by Johannes
17 Jun 2022, 12:17
Forum: Implementations
Topic: Why can we set a low number of maximal Lanczos iterations in DMRG?
Replies: 0
Views: 35167

Why can we set a low number of maximal Lanczos iterations in DMRG?

Actually, I have a few more questions for you about lanczos in TeNPy. I notice that in TeNPy you set the default maximum number of iterations for lanczos (i.e. the attribute N_max) to be 20. However, when I tried to realize DMRG and lanczos algorithm on my own, I found that for a Hermitian matrix w...
by Johannes
17 Jun 2022, 12:02
Forum: HowTos and FAQ for TeNPy
Topic: add_multi_coupling vs. GroupedSite
Replies: 4
Views: 2859

Re: add_multi_coupling vs. GroupedSite

What bond dimensions did you try for the timing benchmarks? I'd expect it to become relevant only around chi >~500 or so, maybe even just with chi on the order of a thousands.
by Johannes
10 Jun 2022, 19:01
Forum: HowTos and FAQ for TeNPy
Topic: Linking against MKL
Replies: 1
Views: 1596

Re: Linking against MKL

It's documented in the conda-forge docs here . I think that's actually fine and properly linked against mkl. I've checked, and when I start from a fresh conda environment defined by TeNPy's environment.yml, I also get the # All requested packages already installed. Indeed, when I checked the install...
by Johannes
10 Jun 2022, 16:16
Forum: HowTos and FAQ for TeNPy
Topic: add_multi_coupling vs. GroupedSite
Replies: 4
Views: 2859

Re: add_multi_coupling vs. GroupedSite

Of course, both approaches can work and should give similar results eventually; but I'd usually recommend not grouping sites if you can manage to write the model without grouping. Let me elaborate: When using the tenpy.networks.site.GroupedSite , you will double your local Hilbert space dimension d ...
by Johannes
10 Jun 2022, 15:24
Forum: HowTos and FAQ for TeNPy
Topic: How to apply a quantum channel?
Replies: 2
Views: 1677

Re: How to apply a quantum channel?

I'm confused - what state do you start with? Some ground state, or other pure state, represented as an MPS? What do you want to calculate afterwards? You can use TeNPy to get the single-site reduced density matrix, and then apply the dephasing channel, but you can not apply it on the whole MPS: it's...
by Johannes
01 Jun 2022, 13:50
Forum: HowTos and FAQ for TeNPy
Topic: About the entropy growth in random unitary circuit
Replies: 2
Views: 1728

Re: About the entropy growth in random unitary circuit

With the random unitary evolution, you get an ensemble of Haar-distributed states, i.e. each normalized state has the same probability. Since there *are* states with less than maximal, but no states with more-than-maximal entropy, it is clear that the average entropy in the Haar distribution is less...
by Johannes
30 May 2022, 10:40
Forum: HowTos and FAQ for TeNPy
Topic: 1d lattice with arbitrary distribution of sites
Replies: 1
Views: 1784

Re: 1d lattice with arbitrary distribution of sites

Hi Umberto, there is a tenpy.models.lattice.TrivialLattice , which is exactly the approach 1) you described - it just takes a list of sites, and defines them as a single, big unit cell. Internally in TeNPy, this is used if you group sites together, since you then no longer have the original lattice ...
by Johannes
30 May 2022, 10:23
Forum: HowTos and FAQ for TeNPy
Topic: Alternating Heisenberg coupling at infinite chain
Replies: 4
Views: 2148

Re: Alternating Heisenberg coupling at infinite chain

I don't see the issue here, I checked that it works for an even number of couplings , where the couplings are not incommensurable. For nearest neighbor couplings A_i B_{i+1}, this means it works for (finite, odd # sites) or (infinite, even # sites), as you can easily check with the example below. No...
by Johannes
03 May 2022, 15:10
Forum: HowTos and FAQ for TeNPy
Topic: Alternating Heisenberg coupling at infinite chain
Replies: 4
Views: 2148

Re: Alternating Heisenberg coupling at infinite chain

Hi,
yes, that is correct. It works if the number of couplings is even (ie. odd number of sites for finite systems, even number of sites for infinite MPS) , otherwise it complains about incommensurate arrays for the expansion.
by Johannes
26 Apr 2022, 17:07
Forum: HowTos and FAQ for TeNPy
Topic: calculate four-point correlation function
Replies: 1
Views: 1513

Re: calculate four-point correlation function

Yes, you can do better. The explicit loops you have make this scale as O(L^3 \chi^3) , since each call to psi.expectation_value_term is O(|j+1 - i| \chi^3) . You can get this down to O(L^2 \chi^3) by using the term_correlation_function_right or ..._left, with term_L = [('Cd', 0), ('Cd', 1)], term_R=...
by Johannes
21 Apr 2022, 02:01
Forum: HowTos and FAQ for TeNPy
Topic: Charge Info for Z3 symmetry in 3-state Potts Model
Replies: 3
Views: 2869

Re: Charge Info for Z3 symmetry in 3-state Potts Model

TeNPy tries to preserve local, diagonal symmetries, in your case the Z3 symmetry (\sum_i Q_i \mod 3) where Q_i = diag(0, 1, 2) are the charge values you define. However, the Hamiltonian does not preserve these symmetries, since the \Gamma^{(1,2)}_i don't commute with this symmetry. Instead, you need...