Search found 422 matches

by Johannes
22 Nov 2023, 09:55
Forum: HowTos and FAQ for TeNPy
Topic: How to build a pure entangled initial state
Replies: 2
Views: 14931

Re: How to build a pure entangled initial state

Indeed, Markus is right that singlets are only one example of entangled states. But they're only entangled on pairs of sites, so for more than 2 sites they're "product states" again. Really, you need to clarify which entangled state you want - there are plenty. For example, you could also ...
by Johannes
31 Oct 2023, 14:02
Forum: Implementations
Topic: Entanglement Entropy for len(segment)>20
Replies: 1
Views: 25655

Re: Entanglement Entropy for len(segment)>20

There is a good reason for this, since it's exponentially expensive with the number of sites L in the segment, both in memory \mathcal{O}(d^{2L}) and CPU time \mathcal{O}(d^{3L}) ! Each additional site quadruples your computational cost. If you're reaching that limit, it might be better to use the e...
by Johannes
31 Oct 2023, 13:49
Forum: HowTos and FAQ for TeNPy
Topic: How to model anisotropic exchange J, single-ion anisotropy and DMI for DMRG?
Replies: 3
Views: 16864

Re: How to model anisotropic exchange J, single-ion anisotropy and DMI for DMRG?

Yes, for the DM interaction, you need to write out the cross product explicitly and add the Dx/Dy/Dz terms separately. Note that you got the signs in the cross product wrong, c.f. the code below. Again, I'm not sure if I understood correctly - it seems you want the D to depend on which pairs of NN y...
by Johannes
26 Oct 2023, 15:31
Forum: HowTos and FAQ for TeNPy
Topic: W-state as MPS
Replies: 3
Views: 16673

Re: W-state as MPS

The XX model has charge conservation of total Sz. In the zero-particle sector, you can map it exactly to a single-particle fermion hopping, and the ground state is the W state. However, this is not true in the sector of higher filling when you have peridoic boundary conditions: for the coupling goin...
by Johannes
25 Oct 2023, 15:15
Forum: HowTos and FAQ for TeNPy
Topic: W-state as MPS
Replies: 3
Views: 16673

Re: W-state as MPS

You can write this analytically as a bond-dimension 2 MPS. You can see that you need bond dimension 2, since you always have either exactly one or no 1 on the left/right of any of the two cuts (between the first two sites, or the second two sites). The Schmidt decomposition between the last two site...
by Johannes
25 Oct 2023, 10:31
Forum: HowTos and FAQ for TeNPy
Topic: purification method for Fermi Hubbard model
Replies: 1
Views: 13199

Re: purification method for Fermi Hubbard model

I'm not sure why you say this. The from_infiniteT method should already work with other sites, including FermionSite or SpinHalfFermionSite. It's straightforward to adjust the purification.py example to use another model like e.g. the tenpy.models.fermions.FermionChain and measure N instead of Sz. T...
by Johannes
25 Oct 2023, 10:05
Forum: HowTos and FAQ for TeNPy
Topic: Fermion Sites From Two Samples
Replies: 1
Views: 13256

Re: Fermion Sites From Two Samples

You can still use the tenpy.networks.site.set_common_charges (the multi_sites_combine_charges is deprecated) to do that. If you specify new_charges='independent' , it does exactly what you're asking for: it conserves the total charge on the f1 sites separate from the one of the f2 site. I'm not sure...
by Johannes
25 Oct 2023, 09:24
Forum: HowTos and FAQ for TeNPy
Topic: How to model anisotropic exchange J, single-ion anisotropy and DMI for DMRG?
Replies: 3
Views: 16864

Re: How to model anisotropic exchange J, single-ion anisotropy and DMI for DMRG?

Not sure what your question is - you already have a loop over the coupling_axis , that you didn't include in your sample code. Just read out different model_params and explicitly use those instead of the plain J1/J2 for the various terms, e.g. def init_terms(self, model_params): Jxx = model_params.g...
by Johannes
25 Oct 2023, 09:08
Forum: HowTos and FAQ for TeNPy
Topic: Problemm calculating H bonds
Replies: 3
Views: 15432

Re: Problemm calculating H bonds

Indeed, by adding the extra spin site on the center, you get a next-nearest neighbor hopping, so you can't use a NearestNeighborModel anymore. There's two ways to proceed: 1) Drop the inheritance from the NearestNeighborModel to not generate the H_bond. This means you can't use TEBD anymore, but the...
by Johannes
23 Aug 2023, 15:32
Forum: HowTos and FAQ for TeNPy
Topic: Product of Operators
Replies: 3
Views: 16607

Re: Product of Operators

very naively, you can multiply out all the products such that you're left with a sum of terms, many of which are long-range. Less naively, you'd try to rewrite it in the nearest-neighbor version O_k = \prod_{\langle i, k\rangle} (1-n_i n_k ) B_k mentioned above, and multiply that out to get sums of...
by Johannes
22 Aug 2023, 07:14
Forum: HowTos and FAQ for TeNPy
Topic: Expectation value of an operator
Replies: 1
Views: 12843

Re: Expectation value of an operator

Ho did you get O(t)? Currently, I don't think there is TEBD code to Heisenberg-Evolve an operator - did you write that yourself? I presume you have O in the form of an MPO then? For a TeNPy MPO, it's simply expectation_value , e.g. E = H.expectation_value(psi) , or for finite systems MPOEnvironment(...
by Johannes
21 Aug 2023, 14:00
Forum: HowTos and FAQ for TeNPy
Topic: Product of Operators
Replies: 3
Views: 16607

Re: Product of Operators

At a glimplse, this looks horrible for DMRG, because each term is non-local, giving you an immense MPO bond dimension if you implement it naively. Do you have only those terms, i.e. is H=\left(\prod_{\langle i, j \rangle} (1-n_i n_j) \right) H^0 with a "usual" H^0 ? It looks like you're tr...
by Johannes
21 Aug 2023, 13:12
Forum: HowTos and FAQ for TeNPy
Topic: imaginary time evolution with TDVP
Replies: 1
Views: 4808

Re: imaginary time evolution with TDVP

That's currently not supported at the moment, as imaginary time evolution is generally much slower than variational methods like DMRG.
Why would you prefer TDVP over DMRG?
by Johannes
02 Aug 2023, 16:26
Forum: HowTos and FAQ for TeNPy
Topic: Particle Number Conservation in tJ model
Replies: 1
Views: 8772

Re: Particle Number Conservation in tJ model

The tenpy.models.tj_model.tJModel defines the options cons_N and cons_Sz - just set them as you need them, and make sure your initial state is in the charge sector you want - for the initial product state you wrote, you get average density of 2/4 = 1/2 and spin Sz=0. You can also easily define a cus...
by Johannes
02 Aug 2023, 15:30
Forum: HowTos and FAQ for TeNPy
Topic: How to use the 'sort_mpo_legs' feature
Replies: 1
Views: 5250

Re: How to use the 'sort_mpo_legs' feature

The MPO tensors in W are sparse, and without the 'sort_mpo_legs': True, we try to capture that, resulting in fewer small blocks for tensordots involving a H.get_W(i) rather than bigger blocks (as dictated by charge conservation). For this benchmark comparison, we wanted to compare "apples to ap...
by Johannes
02 Aug 2023, 15:15
Forum: Algorithms
Topic: How are periodic boundary conditions implemented?
Replies: 3
Views: 12094

Re: How are periodic boundary conditions implemented?

I learned the trick in private communications from Ian McCulloch several years back, but I'm also not sure who was the first to suggest/use it, sor I can't provide a reference...
by Johannes
17 Jul 2023, 16:57
Forum: HowTos and FAQ for TeNPy
Topic: Calculating Time Evolution Only Once
Replies: 4
Views: 7905

Re: Calculating Time Evolution Only Once

I'd always try to exploit "trivial" parallelization first, where you can just distribute jobs (say for different Hamiltonian parameters, or in your case different initial states) to different nodes on a cluster. If you can't do that because you're working on a local machine, keep it as ind...
by Johannes
17 Jul 2023, 16:31
Forum: HowTos and FAQ for TeNPy
Topic: DMRG on 2D triangular lattice for J1-J2 spin-1/2 model
Replies: 1
Views: 4973

Re: DMRG on 2D triangular lattice for J1-J2 spin-1/2 model

You need to be aware of symmetries in your system. The SU(2)-symmetric heisenberg interactions in particular preserve the total Sz spin, and the ferromagnetic all-up state (a) in your picture is an exact eigenstate. Hence, when you start from this state, DMRG just doens't update it - that's why your...
by Johannes
17 Jul 2023, 10:14
Forum: HowTos and FAQ for TeNPy
Topic: Calculating Time Evolution Only Once
Replies: 4
Views: 7905

Re: Calculating Time Evolution Only Once

I'm not sure if I understand your question correctly - do you suggest to write U(t) as an MPO? Unfortunately, it doesn't work that way. Writing down the full time evolution operator (say as an MPO) for large t is much more expensive than just applying it to a given state: it requires exponentiating ...
by Johannes
17 Jul 2023, 08:41
Forum: Implementations
Topic: Defining a New Operator when Inheriting CouplingMPOModel
Replies: 1
Views: 8187

Re: Defining a New Operator when Inheriting CouplingMPOModel

The issue here is that you directly pass the full Ladder instance in the model_params, which already has the site defined - hence the model doesn't call init_sites anymore. Try to use model_params = dict( lattice='Ladder', L=20, U=1., bc_MPS='finite' ) and overwrite init_lattice if you need to adjus...
by Johannes
20 Jun 2023, 18:26
Forum: HowTos and FAQ for TeNPy
Topic: Save evolution with hdf5
Replies: 1
Views: 1465

Re: Save evolution with hdf5

First of all, I would in general advise you to think about the extra amount of storage you need for this, and whether this is sensible, of whether it's easier to re-run the time evolution when you decide that you really need extra measurements. At least think about whether you want to save it at *ev...
by Johannes
20 Jun 2023, 10:09
Forum: HowTos and FAQ for TeNPy
Topic: state overlap(probability)
Replies: 11
Views: 7856

Re: state overlap(probability)

Just 'up'. I forgot to copy over corresponding line in the example, see the edit above ;-)
You can also put the index directly, if you know it - but be aware of the sorting of charges....
by Johannes
20 Jun 2023, 10:07
Forum: HowTos and FAQ for TeNPy
Topic: Infinite DMRG with conserved charges
Replies: 2
Views: 2132

Re: Infinite DMRG with conserved charges

Just to make sure I understand: when you say [b_i,b^\dagger_j]=i\delta_{ij} , was the i supposed to be there??? I guess not, correct? In the Hamiltonians you wrote, each b is acting on the same site j - I think you mean j, j+1 and j+2 (for 3 sites), correct? That said, in your models, you don't coup...
by Johannes
20 Jun 2023, 09:09
Forum: HowTos and FAQ for TeNPy
Topic: Question about poorly conditioned H matrix in KrylovBased
Replies: 6
Views: 1894

Re: Question about poorly conditioned H matrix in KrylovBased

1) What model are you actually using? The site you define has Sz conservation, which you can't use in the Toric code. 2) What intitial state are you using? Is H psi = 0 on that initial state? 3) What's the log output during the DMRG run? 4) Again, are your individual entanglement entropies larger th...
by Johannes
20 Jun 2023, 08:48
Forum: HowTos and FAQ for TeNPy
Topic: state overlap(probability)
Replies: 11
Views: 7856

Re: state overlap(probability)

at a single site only? Then I would suggest to just use apply_local_op with a local operator |x><x|, where x is the state you want to project on. def project_local(psi, i, state): site = psi.sites[i] P = np.zeros(site.dim) P[site.state_index(state)] = 1. proj = npc.diag(P, site.leg, labels=['p', 'p*...