Search found 429 matches

by Johannes
11 Mar 2021, 03:08
Forum: HowTos and FAQ for TeNPy
Topic: Fourier Transform Product state
Replies: 1
Views: 2015

Re: Fourier Transform Product state

The MPS does not know about the Hamiltonian, so it can't have an "energy" per se. Instead, you have a model you ran DMRG with, and you can compute the energy from the MPO of that model as E = model.H_MPO.expectation_value(psi) giving you the value E = \langle \psi | H |\psi \rangle . (For ...
by Johannes
11 Mar 2021, 02:36
Forum: HowTos and FAQ for TeNPy
Topic: Product state of rotated spins for SpinHalfFermionSite
Replies: 2
Views: 2323

Re: Product state of rotated spins for SpinHalfFermionSite

Hi Tana, first of all, welcome to TeNPy, and sorry that I didn't reply earlier. I hope this still helps. The issue which you ran into is quite simple: the SpinHalfFermionSite represents a 4-dimensional local Hilbert space (with states "empty", "spin-up", "spin-down", &q...
by Johannes
11 Mar 2021, 02:22
Forum: HowTos and FAQ for TeNPy
Topic: RuntimeWarning and how to fix it
Replies: 3
Views: 2720

Re: RuntimeWarning and how to fix it

Hmmm. I'm still a bit worried, because after all we should usually avoid taking inverses of small singular values all-together for numerical stability. I tried to track down where it came from and found that it basically stems from this line in MPS.compress_svd() not truncating tiny singualar values...
by Johannes
11 Mar 2021, 00:50
Forum: HowTos and FAQ for TeNPy
Topic: RuntimeWarning and how to fix it
Replies: 3
Views: 2720

Re: RuntimeWarning and how to fix it

Hi Ruben, I have seen this warning before as well, but not so much lately. I vaguely remember that I also tried printing the S values and/or checking that none of them was 0 or negative, but couldn't quite pinpoint it.When testing S=S**-1. for different values like S = np.array([1.e-2, 1.e-15, 1.e-2...
by Johannes
25 Feb 2021, 07:06
Forum: HowTos and FAQ for TeNPy
Topic: How to define a infiniteT MPS under canonical ensemble
Replies: 3
Views: 2657

Re: How to define a infiniteT MPS under canonical ensemble

I played around with this a little bit. When you choose a smaller time step, the error gets smaller, it's O(dt). Further, I noticed that the error is coming from the state not being in canonical form: If you call psi.canonical_form_finite() right before measurements, at least this error is gone, as ...
by Johannes
11 Feb 2021, 23:05
Forum: HowTos and FAQ for TeNPy
Topic: np conserved module
Replies: 3
Views: 3405

Re: np conserved module

Why do you need the state Sx|psi> in the first place? As you know, S^x=0.5* (S^+ + S^-) and thus applying Sx to a state S|\psi\rangle with fixed Sz will give you a superposition of |\phi^\pm\rangle := S^\pm |\psi\rangle . In other words, S^x |\psi\rangle does not have a well defined Sz charge, and c...
by Johannes
11 Feb 2021, 02:20
Forum: HowTos and FAQ for TeNPy
Topic: Convergence Problem for Quantum Impurity Systems
Replies: 2
Views: 1976

Re: Convergence Problem for Quantum Impurity Systems

Sorry for the late reply. In general, I think DMRG should be suitable for such problems. I could understand that it fails for tiny/zero values of lambda, but for O(1) values of lambda it should definitely work. (In fact, I think that people have successfully used DMRG as an impurity solver for DMFT....
by Johannes
11 Feb 2021, 00:57
Forum: HowTos and FAQ for TeNPy
Topic: Excited states using tenpy
Replies: 13
Views: 9921

Re: Excited states using tenpy

I've update the model userguide to inclue a new section on this.

by Johannes
11 Feb 2021, 00:33
Forum: HowTos and FAQ for TeNPy
Topic: Two component Bose-Hubbard model
Replies: 4
Views: 6055

Re: Two component Bose-Hubbard model

Your code looks right. I would have done it basically the same way :) In the newest version of TeNPy, tenpy.networks.site.multi_sites_combine_charges is deprecated in favor of tenpy.networks.site.set_common_charges , you should call it with set_common_charges([siteA, siteB], 'independent') . This sh...
by Johannes
10 Feb 2021, 19:23
Forum: HowTos and FAQ for TeNPy
Topic: Excited states using tenpy
Replies: 13
Views: 9921

Re: Excited states using tenpy

Yes, any strength given to add_onsite, add_coupling, or add_multi_coupling can be an array, as documented in these functions.
Thus also Jv, is allowed to be a numpy array. The shape it needs to have depend on the boundary conditions and shape of your lattice.

by Johannes
09 Feb 2021, 22:00
Forum: HowTos and FAQ for TeNPy
Topic: Excited states using tenpy
Replies: 13
Views: 9921

Re: Excited states using tenpy

the line states = dmrg_params['orthogonal_to'] = [] creates a new list and assigns it to both the variable name states and dmrg_params['orthogonal_to'] . Remember, in Python everything is an "object", and your variables really are just references to objects. Inside the loop, you first crea...
by Johannes
05 Feb 2021, 18:33
Forum: HowTos and FAQ for TeNPy
Topic: TDVP run time issue
Replies: 3
Views: 2931

Re: TDVP run time issue

1) How did you try to install TeNPy? It looks like it's using a version installed with `pip` into the local home directory. Can you try to pip uninstall physics-tenpy and then try to re-install TeNPy? Moreover, the svd_gesvd hints that you're using a very old version of scipy? What python are you us...
by Johannes
05 Feb 2021, 17:23
Forum: HowTos and FAQ for TeNPy
Topic: Excited states using tenpy
Replies: 13
Views: 9921

Re: Excited states using tenpy

1) That was intentional, you need a new copy each time in the loop! After all, you want to have a list of 3 different states in the end. You might at most argue that it's a bad idea to "restart" the whole DMRG from scratch for the excited states, if we already found a ground state. But the...
by Johannes
05 Feb 2021, 03:17
Forum: HowTos and FAQ for TeNPy
Topic: How to define a infiniteT MPS under canonical ensemble
Replies: 3
Views: 2657

Re: How to define a infiniteT MPS under canonical ensemble

This wasn't implemented yet in TeNPy , as you have probably seen by the ToDo entry. However, since today, it is: 64cd7a3a690e80b2876fce48e79675f060b52ab7 ;) The function from_infiniteT_canonical gives you an initial density matrix with fixed particle number on the physical sector, i.e. the canonical...
by Johannes
04 Feb 2021, 22:37
Forum: About the forum
Topic: Forum rules
Replies: 0
Views: 118487

Forum rules

Welcome! This forum is meant to be a community place for both the users and developers of the Tensor Network Python (TeNPy) package. The source code of this package is available on github . The official documentation (generated from the latest source code) has also a user-guide section with some tu...
by Johannes
04 Feb 2021, 19:37
Forum: HowTos and FAQ for TeNPy
Topic: finite open, finite periodic and infinite periodic chains
Replies: 10
Views: 11564

Re: finite open, finite periodic and infinite periodic chains

Even though the model is originially nearest-neighbor on the periodic chain, it will have longer-range interactions in the (open-boundary) MPS - with default ordering, there is one interaction going from site 0 to site L-1, or if you use the "folded" order, most of the originally nearest-n...
by Johannes
04 Feb 2021, 19:22
Forum: HowTos and FAQ for TeNPy
Topic: Warning Cons_N and Cons_Sz unused
Replies: 2
Views: 2247

Re: Warning Cons_N and Cons_Sz unused

That's why the warning is there - to help you spot typos :)
by Johannes
04 Feb 2021, 19:22
Forum: HowTos and FAQ for TeNPy
Topic: Modified Fermi-Hubbard model
Replies: 3
Views: 3376

Re: Modified Fermi-Hubbard model

Well, TEBD is nice because it is conceptually very simple - you just use a Suzuki-Trotter decomposition and straight forward iterations of (apply two site gate; compress & split to get back to MPS form). Grouping sites makes things more costly, however - formally TEBD scales as \mathcal{O}(\chi^...
by Johannes
04 Feb 2021, 03:17
Forum: HowTos and FAQ for TeNPy
Topic: Create a hump-like density profile in Fermi-Hubbard model
Replies: 1
Views: 2963

Re: Create a hump-like density profile in Fermi-Hubbard model

First of all, let me clarify: Do you want some uniform "background density" and then some more particles in the center? Or do you only want particles in the center? For 1): If you don't enforce charge conservation, DMRG is "allowed" to switch to another charge sector, even if you...
by Johannes
04 Feb 2021, 02:49
Forum: HowTos and FAQ for TeNPy
Topic: Excited states using tenpy
Replies: 13
Views: 9921

Re: Excited states using tenpy

you need to make a loop and run DMRG multiple times, each time orthogonalizing against the previous state: psi0 = MPS.from_product_state(...) states = dmrg_params['orthogonal_to'] = [] for i in range(3): psi = psi0.copy() results = dmrg.run(psi, M, dmrg_params) states.append(psi) # this also adds th...
by Johannes
04 Feb 2021, 01:30
Forum: HowTos and FAQ for TeNPy
Topic: Entanglement_entropy for finite ladder
Replies: 2
Views: 2732

Re: Entanglement_entropy for finite ladder

Let's look at the example Ladder image: https://tenpy.readthedocs.io/en/latest/reference/tenpy-models-lattice-Ladder-1.png The MPS follows the red dashed line 0 - 1 - 2 -3 -4 -5- ... When you cut the MPS at the bond between 3 and 4, it will split the system in regions left = {0, 1, 2, 3} and right={...
by Johannes
04 Feb 2021, 01:11
Forum: HowTos and FAQ for TeNPy
Topic: Modified Fermi-Hubbard model
Replies: 3
Views: 3376

Re: Modified Fermi-Hubbard model

If you have at most next-nearest neighbor interactions in a 1D chain, you can group sites and then perform TEBD. In general, I'd recommend to switch to another time evolution algorithm, though: either TDVP or the tenpy.algorithms.mpo_evolution.ExpMPOEvolution can deal with longer range. The latter e...
by Johannes
04 Feb 2021, 01:06
Forum: HowTos and FAQ for TeNPy
Topic: DMRG with fixed bond dimension
Replies: 2
Views: 2071

Re: DMRG with fixed bond dimension

Welcome, Rike!

chi_min can only avoid reducing the bond dimension, not increase it further.
In addition to setting chi_min to the same value as chi_max, you should set svd_min to 0.
by Johannes
04 Feb 2021, 00:36
Forum: HowTos and FAQ for TeNPy
Topic: How to obtain full spectrum of given Model?
Replies: 1
Views: 2542

Re: How to obtain full spectrum of given Model?

Clearly, you can only do this for small system sizes, where you can also do a full exact diagonalization. DMRG really is not a good algorithm at finding excited states, as I explained in the earlier posting You should just use exact diagonalization to find (all) the excited states, and then convert ...
by Johannes
04 Feb 2021, 00:03
Forum: HowTos and FAQ for TeNPy
Topic: Basis for a fermion chain
Replies: 1
Views: 1573

Re: Basis for a fermion chain

I'm not sure what exactly you mean with "occupation-number-representation basis". You have a local basis of occupations, e.g. for spin-less fermions just |0\rangle, |1\rangle> = c^\dagger |0\rangle , or for spin-full fermions |0\rangle , |\uparrow\rangle \equiv c^\dagger_\uparrow|0\rangle,...