Search found 465 matches
- 04 Feb 2021, 22:37
- Forum: About the forum
- Topic: Forum rules
- Replies: 0
- Views: 238634
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...
- 04 Feb 2021, 19:37
- Forum: HowTos and FAQ for TeNPy
- Topic: finite open, finite periodic and infinite periodic chains
- Replies: 10
- Views: 29507
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...
- 04 Feb 2021, 19:22
- Forum: HowTos and FAQ for TeNPy
- Topic: Warning Cons_N and Cons_Sz unused
- Replies: 2
- Views: 6050
Re: Warning Cons_N and Cons_Sz unused
That's why the warning is there - to help you spot typos 

- 04 Feb 2021, 19:22
- Forum: HowTos and FAQ for TeNPy
- Topic: Modified Fermi-Hubbard model
- Replies: 3
- Views: 7885
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^...
- 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: 5654
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...
- 04 Feb 2021, 02:49
- Forum: HowTos and FAQ for TeNPy
- Topic: Excited states using tenpy
- Replies: 13
- Views: 34801
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...
- 04 Feb 2021, 01:30
- Forum: HowTos and FAQ for TeNPy
- Topic: Entanglement_entropy for finite ladder
- Replies: 2
- Views: 5874
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={...
- 04 Feb 2021, 01:11
- Forum: HowTos and FAQ for TeNPy
- Topic: Modified Fermi-Hubbard model
- Replies: 3
- Views: 7885
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...
- 04 Feb 2021, 01:06
- Forum: HowTos and FAQ for TeNPy
- Topic: DMRG with fixed bond dimension
- Replies: 2
- Views: 5326
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.
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.
- 04 Feb 2021, 00:36
- Forum: HowTos and FAQ for TeNPy
- Topic: How to obtain full spectrum of given Model?
- Replies: 1
- Views: 5221
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 ...
- 04 Feb 2021, 00:03
- Forum: HowTos and FAQ for TeNPy
- Topic: Basis for a fermion chain
- Replies: 1
- Views: 4007
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,...
- 03 Feb 2021, 23:44
- Forum: HowTos and FAQ for TeNPy
- Topic: Relation between bond energies and total expected value of energy of MPS
- Replies: 1
- Views: 5090
Re: Relation between bond energies and total expected value of energy of MPS
You tried to find *all* possible eigenstates, right? Really, DMRG is not good at finding highly excited states - that's not what it is designed for ;) What fails is not the calculation of the energy, but the trick of finding excited eigenstates with an algorithm (DMRG) looking for the ground state. ...
- 02 Dec 2020, 21:00
- Forum: HowTos and FAQ for TeNPy
- Topic: Symmetries Of lattice
- Replies: 10
- Views: 21354
Re: Symmetries Of lattice
Sorry for the late reply; your post was displayed on another page that I didn't see. To see how you can use Sz conservation, take a look at the implementation of the tenpy.models.xxz_chain.XXZChain2 The lines self.add_coupling(Jxx * 0.5, u1, 'Sp', u2, 'Sm', dx, plus_hc=True) self.add_coupling(Jz, u1...
- 01 Dec 2020, 09:36
- Forum: HowTos and FAQ for TeNPy
- Topic: Entanglement spectrum by charge (specifically for iDMRG)
- Replies: 4
- Views: 8846
Re: Entanglement spectrum by charge (specifically for iDMRG)
Wow, I'm even mentioned in the acknowledgement 
Thanks for coming back on this! It's great to see what people can do with TeNPy.
I've right away updated the list of papers citing TeNPy, your paper is now included

Thanks for coming back on this! It's great to see what people can do with TeNPy.
I've right away updated the list of papers citing TeNPy, your paper is now included

- 26 Nov 2020, 11:38
- Forum: HowTos and FAQ for TeNPy
- Topic: Initial CAT state
- Replies: 5
- Views: 19915
Re: Initial CAT state
Given that you talked about charges, I'll assume that you try to conserve the total Sz spin. In this case, the all-up state and the Neel state are in completely different sectors, and you can not add them up in a single MPS! Instead, you can and should run DMRG independently in each of these sectors...
- 26 Nov 2020, 10:44
- Forum: HowTos and FAQ for TeNPy
- Topic: Initial CAT state
- Replies: 5
- Views: 19915
Re: Initial CAT state
There is a reason that MPS.add doesn't support adding states of infinite MPS: usually, you really want to avoid writing infinte MPS cat states. I would advice against using it as an initial state for iDMRG... If you do that, you just try to find two ground states at the same time. DMRG should at som...
- 26 Nov 2020, 07:37
- Forum: HowTos and FAQ for TeNPy
- Topic: Initial CAT state
- Replies: 5
- Views: 19915
Re: Initial CAT state
Hi Pasa, from_product_state and from_singlets call that function in the end. The source code of from_Bflat might serve as an example. The first argument really is just a list of the B tensor that make up the MPS, in the form of numpy arrays. The topic title indicates that you want to write a cat sta...
- 18 Nov 2020, 21:37
- Forum: HowTos and FAQ for TeNPy
- Topic: Qn on muti-sites DMRG
- Replies: 3
- Views: 6878
Re: Qn on muti-sites DMRG
DMRG scales with (at least) the third power of the local dimension. Using a GroupedSite forces the local dimension to 2^3 = 8, so you can expect a very significant speedup of roughly \frac{8^3}{3\cdot 2^3} when switching to separate sites. To implement it, simply use a lattice with a non-trivial uni...
- 18 Nov 2020, 07:54
- Forum: HowTos and FAQ for TeNPy
- Topic: Lattice with different spins
- Replies: 3
- Views: 7233
Re: Lattice with different spins
Sure! just add the extra site into the unit cell. Since there are already two sites in the unit cell, it will get the unit-cell index 2, so you can specify the new added site to be [1, 1, 2] instead of [1, 1, 1] . You can do the whole process in a single step: irregular_lat = lattice.IrregularLattic...
- 08 Nov 2020, 14:20
- Forum: HowTos and FAQ for TeNPy
- Topic: Qn on muti-sites DMRG
- Replies: 3
- Views: 6878
Re: Qn on muti-sites DMRG
Let me get this straight: you initialize the state without c electrons and DMRG to keep the number of c electrons at 0, because you have no hopping terms to c (by explicitly setting t2 and t3 to 0). However, you have only two globally conserved charges: the total number of electrons, and the total s...
- 04 Nov 2020, 12:49
- Forum: HowTos and FAQ for TeNPy
- Topic: state overlap(probability)
- Replies: 11
- Views: 38076
Re: state overlap(probability)
You need to transpose at the right position, namely before you start grouping/reshaping the legs. psi.get_rho_segment([i,j]) returns a 4-leg tensor with labels ('p0', 'p1', 'p0*', 'p1*') for (ket left, ket right, bra left, bra right). Grouping the legs will give you two legs '(p0.p1)', '(p0*.p1*)' ,...
- 04 Nov 2020, 08:34
- Forum: HowTos and FAQ for TeNPy
- Topic: Lattice with different spins
- Replies: 3
- Views: 7233
Re: Lattice with different spins
The tenpy.models.lattice.IrregularLattice is doing exactly what you want. The idea is that you first generate the regular lattice (in your case a Honeycomb lattice) and then add/replace the extra site(s) for the Spin-1. If you want to conserve e.g. the total Sz, or the Sz of the spin-1/2 sites, you ...
- 02 Nov 2020, 09:48
- Forum: HowTos and FAQ for TeNPy
- Topic: state overlap(probability)
- Replies: 11
- Views: 38076
Re: state overlap(probability)
You have indices i,j, so I guess you're looking at two-site density matrices now. It works the same way, though: rho_ij = psi.get_rho_segment([i,j]) rho_ij_dense = rho_ij.transpose(['p0', 'p1', 'p0*', 'p1*']).to_ndarray() # has shape (2, 2, 2, 2) assert psi.sites[i].state_labels['up'] == 0 # ensure ...
- 26 Oct 2020, 16:59
- Forum: HowTos and FAQ for TeNPy
- Topic: state overlap(probability)
- Replies: 11
- Views: 38076
Re: state overlap(probability)
1.) rho_i.to_ndarray() , if you really want to convert to a numpy array. 2) There is not a unique such value, because the density matrix is mixed . Work it out for a 2-spin system: the probability for the second spin to be down is P(\sigma_2 = \downarrow) = \Psi_{\uparrow\downarrow}\Psi_{\uparrow\do...
- 26 Oct 2020, 09:21
- Forum: HowTos and FAQ for TeNPy
- Topic: state overlap(probability)
- Replies: 11
- Views: 38076
Re: state overlap(probability)
Sure! Basically, what you want is P(\sigma_i=\downarrow_i) = \langle \Psi | \downarrow_i\rangle \langle \downarrow_i |\Psi \rangle = Tr_{\mathcal{H}}(|\Psi\rangle \langle \Psi | \downarrow_i\rangle \langle \downarrow_i |) = Tr_{\mathcal{H}_i}(\rho_i |\downarrow_i\rangle \langle \downarrow_i |) = \la...