Search found 422 matches

by Johannes
21 Feb 2019, 13:43
Forum: HowTos and FAQ for TeNPy
Topic: Exponentiation of operator / String order parameter
Replies: 11
Views: 96802

Re: Exponentiation of operator

Since exponentiating a matrix is often needed for tensor networks, the scipy.linalg.expm function is also implemented for np_conserved Arrays . When you talk about string order parameters, do you really want to calculate that? What you wrote suggests that you try to calculate something like \langle ...
by Johannes
18 Feb 2019, 09:34
Forum: HowTos and FAQ for TeNPy
Topic: Interpretation of qnumber>1 for Entanglement Spectra
Replies: 3
Views: 3916

Re: Interpretation of qnumber>1 for Entanglement Spectra

The "charges" you get are the "quantum numbers" you conserved. Of course, it depends on the model which "quantum numbers" you can actually preserve. For example, for a spin-model, you can preserve the Magnetization (e.g. Heisenberg XXZ chain), or just the parity of the ...
by Johannes
06 Feb 2019, 23:44
Forum: HowTos and FAQ for TeNPy
Topic: Investigations of the Hubbard model
Replies: 2
Views: 4039

Re: Investigations of the Hubbard model

The general setup looks fine. Regarding the bond dimension, you need to carefully check if larger \chi leads to different results. I would be very surprised if 30 is enough for convergence. To check that it works you need to compare results you have with existing results in the literature ;) Finite ...
by Johannes
05 Feb 2019, 15:53
Forum: HowTos and FAQ for TeNPy
Topic: perm parameter in compute_K function
Replies: 2
Views: 11347

Re: perm parameter in compute_K function

The correct permutation depends on the lattice you choose, and possibly on the "order" argument of that lattice. Yes, you should simply call it like psi.compute_K(perm=M.lat) # where M is your model to automatically figure out the "correct" permuation. This permutation will corre...
by Johannes
05 Feb 2019, 15:42
Forum: HowTos and FAQ for TeNPy
Topic: How to generate a random MPS in tenpy
Replies: 5
Views: 7006

Re: How to generate a random MPS in tenpy

Sorry for not coming back to this earlier. The real question is: what do you mean with "random" when talking about an MPS? When you draw a "random" state uniformly from the Hilbert space, it has a volume law entanglement; in fact it is almost maximally entangled! Therefore, it wo...
by Johannes
01 Feb 2019, 14:40
Forum: HowTos and FAQ for TeNPy
Topic: Implementing quantum gates
Replies: 2
Views: 2946

Re: Implementing quantum gates

What kind of "gate" do you have in mind? The usual TEBD where the "gates" are U=exp(i H_bond dt) is implemented in TeNPy.
by Johannes
31 Jan 2019, 10:20
Forum: Algorithms
Topic: Some questions about DMRG
Replies: 2
Views: 10785

Re: Some questions about DMRG

On general grounds: DMRG is a variational method which looks for the best approximation of the ground state in the space of MPS with a given maximal bond dimension (assuming you put a "chi_max" in the DMRG_parameters). This class of MPS can only represent states with a entanglement entropy...
by Johannes
25 Jan 2019, 15:12
Forum: HowTos and FAQ for TeNPy
Topic: xxz_corrlength.py example gives error 'out of the box'
Replies: 2
Views: 3280

Re: xxz_corrlength.py example gives error 'out of the box'

The problem was just that pickle needs the files to be opened in "binary" mode since Python 3, and the example stems from a time where TeNPy was still running with Python 2 :D
Anyways, I fixed it (and some other issue it had), it should now work again in the newest version.
by Johannes
21 Jan 2019, 09:32
Forum: HowTos and FAQ for TeNPy
Topic: Expectation values using GroupedSite
Replies: 2
Views: 3101

Re: Expectation values using GroupedSite

psi.expectation_value("Sx") tries to evaluate the expectation value \langle S^x_i\rangle on each site i of the MPS. If you called psi.group_sites(k) beforehand, the local sites i refer to GroupedSite , each containing k of the previous sites, and the "Sx" is no longer defined (o...
by Johannes
17 Jan 2019, 15:26
Forum: HowTos and FAQ for TeNPy
Topic: the truncation in dmrg
Replies: 5
Views: 5932

Re: the truncation in dmrg

That's the point: if your result is not unique (due to the degeneracy), any (small) change of the setup can change the result - it's basically random, what you get. Your results should usually still be reproducable, when you run the same code on the same machine with the same python version, but cha...
by Johannes
17 Jan 2019, 11:26
Forum: HowTos and FAQ for TeNPy
Topic: the truncation in dmrg
Replies: 5
Views: 5932

Re: the truncation in dmrg

The problem you have met comes from the degeneracy of the states - you have a bunch of correct, possible solutions, and which one is returned depends on numerical round off errors. I don't get the comment on truncation. Let me clarify: The truncation respects all the parameters chi_max, svd_min and ...
by Johannes
08 Jan 2019, 13:49
Forum: HowTos and FAQ for TeNPy
Topic: the truncation in dmrg
Replies: 5
Views: 5932

Re: the truncation in dmrg

What's even more worrying is that the expectation values of say "Sz" are also changing :!: However, it's not a bug of TenPy, but there is a simple explanation for this behaviour :roll: The problem is that the ground state is degenerate (up to a finite size gap below the precision). You cho...
by Johannes
18 Dec 2018, 16:37
Forum: HowTos and FAQ for TeNPy
Topic: Unit cell with different types of sites
Replies: 4
Views: 5615

Re: Unit cell with different types of sites

This is actually a common problem that makes very much sense is comes from the fact that DMRG optimizes locally (just two sites at once) and the special initial state - product states are very special, having no entanglement at all... People often say that DMRG is "stuck in a local minima"...
by Johannes
05 Dec 2018, 17:33
Forum: Algorithms
Topic: Infinite DMRG state prediction
Replies: 2
Views: 10503

Re: Infinite DMRG state prediction

Hi Jason, Welcome to the forum :) very good question! In TeNPy, this is a bit hidden. Actually, the "state prediction" is in the line 103 of the toycode: theta0 = np.reshape(self.psi.get_theta2(i), [Heff.shape[0]]) # initial guess This line gets the "initial guess" for the ground...
by Johannes
21 Nov 2018, 20:45
Forum: HowTos and FAQ for TeNPy
Topic: Unit cell with different types of sites
Replies: 4
Views: 5615

Re: Unit cell with different types of sites

That's a very good question, thanks for asking! Each of the different Site classes get their own instance of the ChargeInfo class, but all the sites involved into one tensor network (e.g. a MPS or MPO) need to have the same ChargeInfo. When you don't conserve the boson number, both sites agree by sa...
by Johannes
19 Nov 2018, 09:07
Forum: Implementations
Topic: Multi-Site Expectation Value
Replies: 6
Views: 17080

Re: Multi-Site Expectation Value

thank you very much, I've now included these new MPS methods into the master branch.
by Johannes
13 Nov 2018, 15:08
Forum: Implementations
Topic: Multi-Site Expectation Value
Replies: 6
Views: 17080

Re: Multi-Site Expectation Value

Thanks! This function does more than just inserting Jordan wigner strings: it maps a representation of a term in the form [('N', 1), ('C', 5), ('Cd', 3)] into a form having operators on each site for some range, ['N', 'Id', 'JW Cd', 'JW', 'C'] . Some minor issues: I think it should be for j in range...
by Johannes
08 Nov 2018, 20:08
Forum: HowTos and FAQ for TeNPy
Topic: Ground state search in subspace with definite charge
Replies: 1
Views: 4283

Re: Ground state search in subspace with definite charge

Welcome :) The Mixer is designed in such a way that it preserves the symmetries of the Hamiltonian. Basically, it takes the state, calculates the reduced density matrix and applies H to it, and adds this to the original state with a small amplitude. In particular, if you turn on charge conservation ...
by Johannes
05 Nov 2018, 22:01
Forum: HowTos and FAQ for TeNPy
Topic: Extracting matrix elements of exp(-dt*H_bond)
Replies: 5
Views: 7956

Re: Extracting matrix elements of exp(-dt*H_bond)

Sorry for not getting back directly... 1) The idea is to gradually decrease the time step to reach convergence as quickly as possible. Thanks for pointing out the missing documentation, I've just updated it. There's a subtle thing that even when using a second or fourth order Trotter decomposition i...
by Johannes
05 Nov 2018, 19:52
Forum: Implementations
Topic: Lattice design issue
Replies: 4
Views: 13745

Re: Lattice design issue

I've updated the main repository with quite some changes in the models, so let me comment on this once more. Making the jungle of classes even worse, I've added two more classes: a common base Model and the CouplingMPOModel . Moreover, I've update most of the models in TeNPy to use this new Coupling...
by Johannes
25 Oct 2018, 19:45
Forum: HowTos and FAQ for TeNPy
Topic: Extracting matrix elements of exp(-dt*H_bond)
Replies: 5
Views: 7956

Re: Extracting matrix elements of exp(-dt*H_bond)

Yes, I understood that, so probably I wasn't clear enough. Let me try again by writing code: U_bond = eng._U[0][i] # this is the np_conserved Array representing exp(-dt* H_bond) on bond (i-1, i) U_bond[0, 0, 0, 0] # the entry corresponding to spin up on each site U_bond_np = U_bond.to_ndarray() # co...
by Johannes
25 Oct 2018, 08:28
Forum: HowTos and FAQ for TeNPy
Topic: Extracting matrix elements of exp(-dt*H_bond)
Replies: 5
Views: 7956

Re: Extracting matrix elements of exp(-dt*H_bond)

You can just directly read out the coefficients of an np_conserved Array A in the same way as for a numpy Array, for example A[0, 1] will give you a float, if A is a matrix with 2 indices. Even slices are supported, e.g. for A[:, 2] the result will be a np_conserved Array of dimension 1. If you pref...
by Johannes
19 Oct 2018, 15:09
Forum: Implementations
Topic: Multi-Site Expectation Value
Replies: 6
Views: 17080

Re: Multi-Site Expectation Value

It takes multiple onsite operators acting on n neighboring sites. To do that with MPS.expecation_value(), you need to generate a full n-site operator before by Hand, which becomes impossible for n > 15. This function contracts in a different order than the MPS.expectation_value(), so it stays "...
by Johannes
18 Oct 2018, 09:05
Forum: HowTos and FAQ for TeNPy
Topic: Implementing 'new' models
Replies: 7
Views: 9639

Re: Implementing 'new' models

It seemed not to be that hard after all, following your suggestions. That's what I hoped :) ... and the results completely disagree with those I got from the simple iTEBD code for the preceding ref. ... And that shouldn't happen :? Do you need to truncate strongly? Is there symmetry breaking? Or a ...
by Johannes
17 Oct 2018, 08:04
Forum: HowTos and FAQ for TeNPy
Topic: Implementing 'new' models
Replies: 7
Views: 9639

Re: Implementing 'new' models

Oh oh :o But there's a simple solution: update your TeNPy source to the newest version with a git pull (and if necessary, compile the np_conserved parts again). Since we are still in the 0.XX version numbers, I allowed myself to do a few backwards incompatible change(s). Moving the "bc" ke...