Search found 422 matches

by Johannes
29 Mar 2021, 21:20
Forum: HowTos and FAQ for TeNPy
Topic: Get excited states in different symmetry sectors
Replies: 3
Views: 2354

Re: Get excited states in different symmetry sectors

Yes: just run DMRG with an initial state in the symmetry sector you're interested in.
DMRG doesn't switch charge sectors, so the charge sector of the final state is determined by your initial state.
by Johannes
29 Mar 2021, 17:10
Forum: HowTos and FAQ for TeNPy
Topic: Calculate Energy Expectation on Ladder
Replies: 3
Views: 2527

Re: Calculate Energy Expectation on Ladder

There are more ways to get the expectation value \(E = \langle \psi | H | \psi\rangle \) of a given state than just through H_bonds: when you have a model, you can evaluate the MPO expectation value with M.H_MPO.expectation_value(psi).
Does this answer your question?
by Johannes
25 Mar 2021, 21:11
Forum: HowTos and FAQ for TeNPy
Topic: Dynamical spin Structure Factor/ Excitation Spectrum of Spin Ladder
Replies: 15
Views: 9619

Re: Dynamical spin Structure Factor/ Excitation Spectrum of Spin Ladder

Would you mind to provide a traceback? An "incompatible LegCharge" means it's trying to contract two legs with different charges somewhere, not necessarily in the MPS bonds.
by Johannes
23 Mar 2021, 18:32
Forum: HowTos and FAQ for TeNPy
Topic: Dynamical spin Structure Factor/ Excitation Spectrum of Spin Ladder
Replies: 15
Views: 9619

Re: Dynamical spin Structure Factor/ Excitation Spectrum of Spin Ladder

To be clear: you need to evolve this for much longer than just a few steps, and continuously take measurements for C_ij(t) . In the end, you can then fourier-transform C_ij(t) , both in space and time, to get C_k(\omega) , which is what you're really interested in, right? The maximal time you reach ...
by Johannes
23 Mar 2021, 18:21
Forum: HowTos and FAQ for TeNPy
Topic: Particle Number Conservation
Replies: 7
Views: 4122

Re: Particle Number Conservation

It seems there's something gone wrong beforehand; if you try psi.test_sanity() before the psi0.apply_local_op(...) , it will likely give you an error, right? If this code is inside a loop, make sure you have actual copies psi0 = psi.copy() , not just new references. That being said: in what way can ...
by Johannes
22 Mar 2021, 23:58
Forum: HowTos and FAQ for TeNPy
Topic: Excited states using tenpy
Replies: 13
Views: 8444

Re: Excited states using tenpy

Sounds like you're after the bc_shift . With bc_shift=['open', -1] for finite MPS or bc_shift=['periodic', -1] for infinite MPS, couplings in "y-direction" of the lattice wind like a helix around the cylinder. More details in this userguide section . It might also be useful to look at the ...
by Johannes
22 Mar 2021, 23:43
Forum: HowTos and FAQ for TeNPy
Topic: TDVP run time issue
Replies: 3
Views: 2666

Re: TDVP run time issue

1) Glad that this helped. Watch out for the new version of TeNPy that will be released in the next few days! 2) You're more than welcome to contribute! There's plenty of things to be done. Hmm, I'm not completely sure, but it might just be that chi=500 is too small to reach that time. I did some sim...
by Johannes
22 Mar 2021, 21:50
Forum: HowTos and FAQ for TeNPy
Topic: np conserved module
Replies: 3
Views: 3079

Re: np conserved module

If your model is conserving Sz, you should also make sure you conserve Sz during the time evolution for speedup. In this case, the expectation value splits up into \langle g.s. | \sigma_j^x(t)\sigma_0^x(0)|g.s. \rangle = \langle g.s. | \sigma_j^+(t)\sigma_0^-(0)|g.s. \rangle + \langle g.s. | \sigma_...
by Johannes
22 Mar 2021, 21:36
Forum: HowTos and FAQ for TeNPy
Topic: Particle Number Conservation
Replies: 7
Views: 4122

Re: Particle Number Conservation

As far as I understand the error message, it claims that strength_vals is an integer array and hence can not divided by 2. in place . On your side, there's a very easy fix: specifying g = 1. as a float instead of g = 1 as an int - as you do in the default parameters. On TeNPy side, this is likely so...
by Johannes
22 Mar 2021, 17:58
Forum: HowTos and FAQ for TeNPy
Topic: Particle Number Conservation
Replies: 7
Views: 4122

Re: Particle Number Conservation

Your couplings preserve the number of fermions and bosons independently , so you want to end up with qnumber=2 charges. Try using charges='independent' when combining the sites. Moreover, you double-count the N-terms compared to the hopping terms by explicitly adding plus_hc=True , at least if you i...
by Johannes
22 Mar 2021, 17:18
Forum: HowTos and FAQ for TeNPy
Topic: Exponentiation of operator / String order parameter
Replies: 11
Views: 97233

Re: Exponentiation of operator / String order parameter

The correlation function is built with the intention that the i and j are multiple values; that's why the position r of opstr[r] is the index inside the MPS, not relative to i : opstrs = [s.Id if j % 2 == 0 else npc.expm(1.j * np.pi * Sz) for j, s in enumerate(psi.sites)] psi.correlation_function(&q...
by Johannes
14 Mar 2021, 19:08
Forum: HowTos and FAQ for TeNPy
Topic: How to use TDVP for one site
Replies: 3
Views: 2662

Re: How to use TDVP for one site

Hi Pablo, The definition of TDVP in the context of MPS means to project the time evolution into the subspace/manifold of MPS at a fixed bond dimension. Single-Site TDVP is doing exactly that: whatever bond dimension you start with, it will keep that bond dimension. That means when you start from a p...
by Johannes
12 Mar 2021, 23:59
Forum: HowTos and FAQ for TeNPy
Topic: Energy gap for Odd and Even length
Replies: 2
Views: 2124

Re: Energy gap for Odd and Even length

Short answer: Honestly, I don't know. From my limited experience with Bose-Hubbard physics, I could certainly imagine this to be a physical effect. Some suggestions for further investigation: Double-check that you're converged in the Nmax parameter of the BosonSite, i.e. how many bosons can occupy a...
by Johannes
12 Mar 2021, 21:12
Forum: HowTos and FAQ for TeNPy
Topic: How to deal with different ChargeInfos
Replies: 2
Views: 2147

Re: How to deal with different ChargeInfos

I'm not completely sure if I understand what you want to do and what you mean with "Gutzwiller projection". As far as I understand, you have found an MPS of SpinHalfFermionSite -based model with both Sz and N conservation. Now you want to "project" into the subspace of fixed part...
by Johannes
12 Mar 2021, 00:59
Forum: HowTos and FAQ for TeNPy
Topic: Using BC_shift on cylinder
Replies: 1
Views: 1550

Re: Using BC_shift on cylinder

Indeed, as far as I understand your question, you're trying to describe what the bc_shift parameter does. This one allows for a (basically) arbitrary shift when going around the cylinder; I guess you want it to be 1 or 2 in the most cases. Have you seen this section of the user-guide that I added a ...
by Johannes
12 Mar 2021, 00:40
Forum: HowTos and FAQ for TeNPy
Topic: Dynamical spin Structure Factor/ Excitation Spectrum of Spin Ladder
Replies: 15
Views: 9619

Re: Dynamical spin Structure Factor/ Excitation Spectrum of Spin Ladder

The MPS.expectation_value method for a given \(|\phi\rangle\) gives you \(\langle\phi|A_i|\phi\rangle\), but you need
\(\langle\psi|A_i|\phi\rangle\) with \(|\phi\rangle = \exp(-i H t) B_j |\psi_0\rangle\).
The latter is exactly what MPSEnvironment.expectation_value provides.
by Johannes
11 Mar 2021, 22:55
Forum: HowTos and FAQ for TeNPy
Topic: Dynamical spin Structure Factor/ Excitation Spectrum of Spin Ladder
Replies: 15
Views: 9619

Re: Dynamical spin Structure Factor/ Excitation Spectrum of Spin Ladder

Your new question is probably the follow up on this, so I guess I'm already a bit too late (Sorry :oops: ), but let me comment anyways. The first "standard" thing to do is to just calculate the next excited states (assuming that you have a finite system) using the "orthogonal_to"...
by Johannes
11 Mar 2021, 08:50
Forum: HowTos and FAQ for TeNPy
Topic: Non-Hermitian problem while using self-defined model
Replies: 2
Views: 2220

Re: Non-Hermitian problem while using self-defined model

Wow, that sounds like some interesting physics! Sometimes, it's helpful to double-check the terms produced by the model. In your case, print(M.all_coupling_terms().to_TermList()) prints -1.00000 * B gJW_0 Bd_1 + -1.00000 * Bd gJWd_0 B_1 + -1.00000 * B gJW_1 Bd_2 + -1.00000 * Bd gJWd_1 B_2 + ... Here...
by Johannes
11 Mar 2021, 03:08
Forum: HowTos and FAQ for TeNPy
Topic: Fourier Transform Product state
Replies: 1
Views: 1896

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: 2178

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: 2472

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: 2472

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: 2518

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: 3079

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: 1846

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....