DensityMatrixMixer

class tenpy.algorithms.dmrg.DensityMatrixMixer(mixer_params)[source]

Bases: tenpy.algorithms.dmrg.Mixer

Mixer based on density matrices.

This mixer constructs density matrices as described in the original paper [White2005].

Methods

get_xL(self, wL_leg, Id_L, Id_R)

Generate the coupling of the MPO legs for the reduced density matrix.

get_xR(self, wR_leg, Id_L, Id_R)

Generate the coupling of the MPO legs for the reduced density matrix.

mix_rho_L(self, engine, theta, i0, mix_enabled)

Calculated mixed reduced density matrix for left site.

mix_rho_R(self, engine, theta, i0, mix_enabled)

Calculated mixed reduced density matrix for left site.

perturb_svd(self, engine, theta, i0, …)

Mix extra terms to theta and perform an SVD.

update_amplitude(self, sweeps)

Update the amplitude, possibly disable the mixer.

perturb_svd(self, engine, theta, i0, update_LP, update_RP)[source]

Mix extra terms to theta and perform an SVD.

We calculate the left and right reduced density using the mixer (which might include applications of H). These density matrices are diagonalized and truncated such that we effectively perform a svd for the case mixer.amplitude=0.

Parameters
engineSingleSiteDMRGEngine | TwoSiteDMRGEngine

The DMRG engine calling the mixer.

thetaArray

The optimized wave function, prepared for svd.

i0int

Site index; theta lives on i0, i0+1.

update_LPbool

Whether to calculate the next env.LP[i0+1].

update_RPbool

Whether to calculate the next env.RP[i0].

Returns
UArray

Left-canonical part of theta. Labels '(vL.p0)', 'vR'.

S1D ndarray | 2D Array

Without mixer just the singluar values of the array; with mixer it might be a general matrix; see comment above.

VHArray

Right-canonical part of theta. Labels 'vL', '(p1.vR)'.

errTruncationError

The truncation error introduced.

mix_rho_L(self, engine, theta, i0, mix_enabled)[source]

Calculated mixed reduced density matrix for left site.

Pictorially:

|     mix_enabled=False           mix_enabled=True
|
|    .---theta---.            .---theta-------.
|    |   |   |   |            |   |   |       |
|            |   |           LP---H0--H1--.   |
|    |   |   |   |            |   |   |   |   |
|    .---theta*--.                    |   xR  |
|                             |   |   |   |   |
|                            LP*--H0*-H1*-.   |
|                             |   |   |       |
|                             .---theta*------.
Parameters
engineEngine

The DMRG engine calling the mixer.

thetaArray

Ground state of the effective Hamiltonian, prepared for svd.

i0int

Site index; theta lives on i0, i0+1.

mix_enabledbool

Whether we should perturb the density matrix.

Returns
rho_LArray

A (hermitian) square array with labels '(vL.p0)', '(vL*.p0*)', Mainly the reduced density matrix of the left part, but with some additional mixing.

mix_rho_R(self, engine, theta, i0, mix_enabled)[source]

Calculated mixed reduced density matrix for left site.

Pictorially:

|     mix_enabled=False           mix_enabled=True
|
|    .---theta---.           .------theta---.
|    |   |   |   |           |      |   |   |
|    |   |                   |   .--H0--H1--RP
|    |   |   |   |           |   |  |   |   |
|    .---theta*--.           |  wL  |
|                            |   |  |   |   |
|                            |   .--H0*-H1*-RP*
|                            |      |   |   |
|                            .------theta*--.
Parameters
engineEngine

The DMRG engine calling the mixer.

thetaArray

Ground state of the effective Hamiltonian, prepared for svd.

i0int

Site index; theta lives on i0, i0+1.

mix_enabledbool

Whether we should perturb the density matrix.

Returns
rho_RArray

A (hermitian) square array with labels '(p1.vR)', '(p1*.vR*)'. Mainly the reduced density matrix of the right part, but with some additional mixing.

get_xR(self, wR_leg, Id_L, Id_R)[source]

Generate the coupling of the MPO legs for the reduced density matrix.

Parameters
wR_legLegCharge

LegCharge to be connected to.

IdLint | None

Index within the leg for which the MPO has only identities to the left.

IdRint | None

Index within the leg for which the MPO has only identities to the right.

Returns
mixed_xRArray

Connection of the MPOs on the right for the reduced density matrix rhoL. Labels ('wL', 'wL*').

add_separate_Idbool

If Id_L is None, we can’t include the identity into mixed_xR, so it has to be added directly in mix_rho_L().

get_xL(self, wL_leg, Id_L, Id_R)[source]

Generate the coupling of the MPO legs for the reduced density matrix.

Parameters
wL_legLegCharge

LegCharge to be connected to.

Id_Lint | None

Index within the leg for which the MPO has only identities to the left.

Id_Rint | None

Index within the leg for which the MPO has only identities to the right.

Returns
mixed_xLArray

Connection of the MPOs on the left for the reduced density matrix rhoR. Labels ('wR', 'wR*').

add_separate_Idbool

If Id_R is None, we can’t include the identity into mixed_xL, so it has to be added directly in mix_rho_R().

update_amplitude(self, sweeps)

Update the amplitude, possibly disable the mixer.

Parameters
sweepsint

The number of performed sweeps, to check if we need to disable the mixer.

Returns
mixerMixer | None

Returns self if we should continue mixing, or None, if the mixer should be disabled.