Search found 260 matches

by Johannes
08 Jun 2021, 03:14
Forum: HowTos and FAQ for TeNPy
Topic: Custom (sum of) Operators
Replies: 1
Views: 175

Re: Custom (sum of) Operators

A bit late, but better late than never ;-) apply_local_op accepts an operator that acts on n neighboring sites, for example for two sites with legs 'p0', 'p1', 'p0*', 'p1*' . You can use the brand-new function tenpy.networks.site.kron to create the corresponding bond operator from the single-site op...
by Johannes
08 Jun 2021, 02:49
Forum: HowTos and FAQ for TeNPy
Topic: If/How to avoid: "final DMRG state not in canonical form..."
Replies: 2
Views: 124

Re: If/How to avoid: "final DMRG state not in canonical form..."

You shouldn't trust expectation values/correlation functions that were calculated from an MPS that is not in canonical form, because these functions implicitly assume that psi is in canonical form. When your DMRG is really converged and doesn't change the state during the sweep any more, you would e...
by Johannes
08 Jun 2021, 02:31
Forum: Implementations
Topic: Keeping number of particles fixed at edges
Replies: 1
Views: 211

Re: Keeping number of particles fixed at edges

The answer comes probably a bit too late, but anyways: How do you want to "fix" the states outside? If you imagine to project them to the local basis states with exactly 0/2 sites, you would have a product state with the rest. The hopping term wouldn't contribute, and you can just calculat...
by Johannes
08 Jun 2021, 02:13
Forum: Implementations
Topic: wave function from MPS
Replies: 1
Views: 94

Re: wave function from MPS

They will only depend on the charge conservation you're using.

I guess you're aware of this, but just to be clear: when you do this, you write down all 2^L states, so you could just as well use exact diagonalization....
by Johannes
08 Jun 2021, 02:05
Forum: HowTos and FAQ for TeNPy
Topic: Finite state machine MPO
Replies: 1
Views: 65

Re: Finite state machine MPO

Hi Pablo, there is a way to do it more effiently, although I only did that numerically: I created the AKLT model by just defining bond terms, and then initializing the MPO from these bond terms - there's a function in TeNPy to automatically do the SVD of the bond term to get the MPO. Take a look at ...
by Johannes
08 Jun 2021, 01:48
Forum: HowTos and FAQ for TeNPy
Topic: dmrg.run() claims quartic Hamiltonian is zero
Replies: 1
Views: 72

Re: dmrg.run() claims quartic Hamiltonian is zero

It's a problem of the inital state and charge conservation, not the jordan wigner strings. TwoSiteDMRG updates two sites in the subspace created by projecting H to the current psi (i.e. your initial state) on other sites; this projection will render H zero because each term in H has at least two C/C...
by Johannes
08 Jun 2021, 01:40
Forum: Algorithms
Topic: Mapping of Spinful Fermion to Spinless fermion
Replies: 2
Views: 126

Re: Mapping of Spinful Fermion to Spinless fermion

Yes, that's right.
I tried to explain this in the section "spinful fermions" of the Jordan-Wigner user guide you referenced.
If you have a suggestion how to formulate this a bit clearer, feel free to submit a corresponding pull request on github!
by Johannes
08 Jun 2021, 01:36
Forum: HowTos and FAQ for TeNPy
Topic: [RESOLVED] Issue in purification method (normalization of temperature and/or timescales?)
Replies: 5
Views: 145

Re: [RESOLVED] Issue in purification method (normalization of temperature and/or timescales?)

rubenv Good catch, the fix is of course correct. Let me explain: The variation compression needs a copy of the old psi to compress against, and that copy is made during the class intialization, more precisely in [tenpyclass=tenpy.algorithms.mps_common.VariationalApplyMPO]init_env[/inline]. So it mo...
by Johannes
13 Apr 2021, 23:58
Forum: HowTos and FAQ for TeNPy
Topic: finite open, finite periodic and infinite periodic chains
Replies: 10
Views: 3458

Re: finite open, finite periodic and infinite periodic chains

Whoa, I wasn't aware that you want to run it for non-hermitian H. Lancos implicitly assumes that H is hermitian! For that reason at least TeNPy's implementation of TDVP (which uses Lancos to do the local time evolution) does not work for that case! Dropping the hermiticity of H is in general very da...
by Johannes
13 Apr 2021, 23:24
Forum: HowTos and FAQ for TeNPy
Topic: Energy gap for infinite system using segment DMRG?
Replies: 2
Views: 282

Re: Energy gap for infinite system using segment DMRG?

Hi Ruben, you're right, the DMRG code supports segment boundary conditions already. Right now, you need to extract the left and right environment from a previous DMRG run, and then specify it in resume_data['init_env_data'] to the subsequent DMRG run by hand. There's still some subtleties, e.g. how ...
by Johannes
01 Apr 2021, 19:12
Forum: HowTos and FAQ for TeNPy
Topic: RuntimeWarning and how to fix it
Replies: 3
Views: 345

Re: RuntimeWarning and how to fix it

Update:
when trying to install TeNPy on a cluster with the Intel Python distribution, we encountered the same runtime warnings.
Looking into this now...
by Johannes
01 Apr 2021, 18:33
Forum: HowTos and FAQ for TeNPy
Topic: Dynamical spin Structure Factor/ Excitation Spectrum of Spin Ladder
Replies: 15
Views: 1269

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

Sorry, I didn't realize you were looking at infinite MPS. For an infinite MPS, the leg between unit cells is non-trivial, and in general changes when you do a time evolution. This is where the error is coming from: when you initialize the MPSEnvironment, it needs to know how to connect the left-/rig...
by Johannes
30 Mar 2021, 21:50
Forum: HowTos and FAQ for TeNPy
Topic: Get excited states in different symmetry sectors
Replies: 3
Views: 289

Re: Get excited states in different symmetry sectors

For single-site DMRG to work you need to enable the "mixer" by setting dmrg_params['mixer']=True , otherwise it cannot grow the bond dimension. Be warned that the default mixer_params might still disable the mixer too early for larger/more correlated systems. I've just released a bugfix ve...
by Johannes
29 Mar 2021, 21:20
Forum: HowTos and FAQ for TeNPy
Topic: Get excited states in different symmetry sectors
Replies: 3
Views: 289

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

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

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

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

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: 11
Views: 1254

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

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

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

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

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: 10
Views: 29815

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

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