Search found 422 matches

by Johannes
15 Oct 2019, 15:15
Forum: HowTos and FAQ for TeNPy
Topic: finite open, finite periodic and infinite periodic chains
Replies: 10
Views: 9464

Re: finite open, finite periodic and infinite periodic chains

is there a way to have a finite periodic chain (so a ring) for the BoseHubbard model? Kind of. We do not support finite MPS with periodic boundaries for the MPS itself i.e. writing | \Psi\rangle = \sum Tr(A^{\sigma_1} \cdots A^{\sigma_L}) | \sigma_1 \cdots \sigma_L\rangle This is a form which is us...
by Johannes
30 Sep 2019, 09:51
Forum: HowTos and FAQ for TeNPy
Topic: print msg into file
Replies: 6
Views: 6559

Re: print msg into file

I've added the `flush=True` to the print statements during the loops of TEBD and DMRG in ce32fd1fc30073918371717beea110083bab8cd1 On my workstation, the flush causes the output to appear immediately. If you redirect to a file on a network-shared file system, there might be a delay of the change bein...
by Johannes
27 Sep 2019, 07:22
Forum: HowTos and FAQ for TeNPy
Topic: About four-site coupling terms
Replies: 2
Views: 3234

Re: About four-site coupling terms

Welcome! There is a way to add such couplings, namly with add_multi_coupling of the tenpy.models.model.MultiCouplingModel instead of just the add_coupling of the tenpy.models.model.CouplingModel . The tenpy.models.toric_code.ToricCode is an example where this is used. Take a look at this topic for m...
by Johannes
26 Sep 2019, 13:02
Forum: HowTos and FAQ for TeNPy
Topic: print msg into file
Replies: 6
Views: 6559

Re: print msg into file

There's also a

Code: Select all

flush=True
option to print().
by Johannes
26 Sep 2019, 12:44
Forum: HowTos and FAQ for TeNPy
Topic: print msg into file
Replies: 6
Views: 6559

Re: print msg into file

Still, there are ways around this. You're describing the problem that the file is "buffered", which Linux/Python does automatically to avoid unnecessary hard disk usage slowing down the execution of the program. However, this can be switched off. For python, try to use the -u option for th...
by Johannes
20 Sep 2019, 14:02
Forum: HowTos and FAQ for TeNPy
Topic: correlation length in idmrg
Replies: 1
Views: 2870

Re: correlation length in idmrg

A such enormous correlation length \xi > 10^10 means that the second eigenvalue of the transfer matrix is 1 up to numerical errors. The reason is that the state you get is a cat state, i.e. a superposition of all |+x \rangle and all |-x \rangle states. See also the discussion in viewtopic.php?f=7&am...
by Johannes
13 Sep 2019, 15:30
Forum: HowTos and FAQ for TeNPy
Topic: iDMRG is not working properly with next-nearest neighbor complex hopping in the Haldane model
Replies: 6
Views: 6812

Re: iDMRG is not working properly with next-nearest neighbor complex hopping in the Haldane model

Welcome Dhiman, and sorry for not answering earlier. You might want to take a look at the tenpy.models.haldane.FermionicHaldaneModel and the tenpy.models.haldane.BosonicHaldaneModel . Both are based on the Hamiltonian from the paper 1407.6985 discussing the fermionic model. As far as I see from a qu...
by Johannes
13 Sep 2019, 14:10
Forum: HowTos and FAQ for TeNPy
Topic: how to write a three-site interaction?
Replies: 4
Views: 31617

Re: how to write a three-site interaction?

Thanks for the clear answer, Umberto :)

Just as little side node: lambda is a special keyword in python.
The usual convention is to append an underscore in such a case, i.e., use lambda_ instead as a variable name ;-)
by Johannes
13 Sep 2019, 14:05
Forum: HowTos and FAQ for TeNPy
Topic: print msg into file
Replies: 6
Views: 6559

Re: print msg into file

There are different standard ways to do this (On all computing clusters I know, there is at least an option to do it automatically). Let me point out a few which should suffice your needs: If you start your program from a Linux console, it's very easy: you can use the > at the and of any command to ...
by Johannes
13 Sep 2019, 13:15
Forum: Implementations
Topic: TEBD for time-dependent Hamiltonians
Replies: 2
Views: 11250

Re: TEBD for time-dependent Hamiltonians

Looks like a good thing. Actually, if you update your local repository, you'll find that the code for the FermiHubbardModel has been moved to tenpy.models.hubbard.FermiHubbardModel . There it says for u1, u2, dx in self.lat.nearest_neighbors: self.add_coupling(-t, u1, 'Cdu', u2, 'Cu', dx) self.add_c...
by Johannes
07 Aug 2019, 09:33
Forum: HowTos and FAQ for TeNPy
Topic: How to assign different hopping parameter 't' to different sites
Replies: 1
Views: 2873

Re: How to assign different hopping parameter 't' to different sites

You don't need to modify the unit_cell , if the kind of sites (Fermions with or without spin, Bosons, spins,...) doesn't change. Instead, you can give a hopping parameter t which is not just a single number, but an array, specifying at which site you want hopping with which strength. Take a look at ...
by Johannes
29 Jul 2019, 13:35
Forum: HowTos and FAQ for TeNPy
Topic: Error when using kroneckerproduct option for GroupedSite
Replies: 5
Views: 4860

Re: Error when using kroneckerproduct option for GroupedSite

I've just added a the function from_MPOModel, which has an example how to use it.
Does that help?
by Johannes
29 Jul 2019, 09:17
Forum: HowTos and FAQ for TeNPy
Topic: periodic conditions
Replies: 7
Views: 6105

Re: periodic conditions

Could it be that the tenpy you are importing is an old version?
The all_onsite_terms was only introduced fairly recently.
by Johannes
26 Jul 2019, 12:27
Forum: HowTos and FAQ for TeNPy
Topic: Error when using kroneckerproduct option for GroupedSite
Replies: 5
Views: 4860

Re: Error when using kroneckerproduct option for GroupedSite

Hi Jack, welcome to TeNPy! (the sites are hardcore bosons, which I've created by simply removing the JW entries in the FermionSite class, I hope this is correct?) The more straightforward way for HardcodeBosons would be to use the tenpy.networks.site.BosonSite with the default Nmax=1 . Here is the i...
by Johannes
08 Jul 2019, 12:26
Forum: HowTos and FAQ for TeNPy
Topic: Finite Chain with different unit cell at the beginning
Replies: 4
Views: 5389

Re: Finite Chain with different unit cell at the beginning

I've opened Issue #77 to keep track of this task, in case you or someone else wants to give it a try ;)
by Johannes
06 Jul 2019, 17:21
Forum: Implementations
Topic: How to contribute
Replies: 0
Views: 15663

How to contribute

Hi all, so far, I've kept a ToDo-list for myself. Considering, that the list got longer instead of shorter (although I spent much time working on it), I decided to try a different approach: I open up to the community and give out small tasks to be done as issues on github. If you feel like you got a...
by Johannes
04 Jul 2019, 16:14
Forum: HowTos and FAQ for TeNPy
Topic: Finite Chain with different unit cell at the beginning
Replies: 4
Views: 5389

Re: Finite Chain with different unit cell at the beginning

Currently, there's nothing like that. I started thinking about it (and even writing the code for the , but then became busy implementing other stuff. First of all, the algorithms like DMRG don't care about the lattice, but only about the generated MPO and lat.mps_sites() defining the Hilbert space. ...
by Johannes
02 Jul 2019, 13:42
Forum: HowTos and FAQ for TeNPy
Topic: Some questions about the svd_theta
Replies: 7
Views: 6690

Re: Some questions about the svd_theta

You can only split legs that were combined previously. In TeNPy, you can see that those legs store the charge data as tenpy.linalg.charges.LegPipe instead of tenpy.linalg.charges.LegCharge . Those pipes have the additional data needed to split the legs. The matrices generated by SVD, say A_ij = U_ik...
by Johannes
01 Jul 2019, 08:29
Forum: HowTos and FAQ for TeNPy
Topic: Some questions about the svd_theta
Replies: 7
Views: 6690

Re: Some questions about the svd_theta

The conversion to_ndarray discards information (namely: which index corresponds to which charges? what are the charge blocks we have?). Thus it cannot be reverted (at least not after subsequent tensordot/svd/...) and should be avoided at all. Instead you should use the functions provided by tenpy.li...
by Johannes
28 Jun 2019, 09:45
Forum: HowTos and FAQ for TeNPy
Topic: Possible issue with single-site TDVP
Replies: 2
Views: 3617

Re: Possible issue with single-site TDVP

Thanks to [mention]mpsforphysics[/mention] for fixing this!
by Johannes
28 Jun 2019, 09:41
Forum: HowTos and FAQ for TeNPy
Topic: norm_tol parameter for DMRG
Replies: 2
Views: 8074

Re: norm_tol parameter for DMRG

1) No, it doesn't. The problem is that bringing the state into canonical form during the DMRG run will screw up the environments. Thus, the `norm_tol` is only checking if the final state returned by DMRG is in canonical form. It tries to ensure the canonical form by performing a few more environment...
by Johannes
28 Jun 2019, 09:25
Forum: HowTos and FAQ for TeNPy
Topic: DMRG sweep problems
Replies: 5
Views: 5805

Re: DMRG sweep problems

This jumping sure looks very wrong and strange. Any chance you could provide a simple example code where this happens? Do you expect a (nearly) degenerate ground state in this case? Than it might just be jumping around between different solutions. It might help to use 'chi_list' to gradually increas...
by Johannes
28 Jun 2019, 08:48
Forum: HowTos and FAQ for TeNPy
Topic: Some questions about the svd_theta
Replies: 7
Views: 6690

Re: Some questions about the svd_theta

Hi Qicheng, how exactly do you want to extract the correlation length from the B? For a finite system, this is a somewhat ill-defined question, because you have no (guaranteed) periodicity. You might want to look at the correlation functions directly and fit an exponential to that. For an infinite s...
by Johannes
28 May 2019, 20:07
Forum: HowTos and FAQ for TeNPy
Topic: periodic conditions
Replies: 7
Views: 6105

Re: periodic conditions

Exactly as in the example you posted: just specify an array/list as "strength" in add_coupling. In fact, you don't even need to define your own model, if you're happy with the XXZ Chain /SpinChain with alternating strength: from tenpy.models.xxz_chain import XXZChain model_params = { 'bc_M...
by Johannes
28 May 2019, 08:34
Forum: HowTos and FAQ for TeNPy
Topic: periodic conditions
Replies: 7
Views: 6105

Re: periodic conditions

Welcome! The first argument of add_coupling is the strenght of the coupling. It can be a single value (if the strength is uniform all over the chain/lattice), but also a numpy array or something convertible a numpy array (which is the case here). The different values just indicate that the strength ...