# DensityMatrixMixer¶

Inheritance Diagram Methods

 DensityMatrixMixer.__init__(options) Initialize self. DensityMatrixMixer.get_xL(wL_leg, Id_L, Id_R) Generate the coupling of the MPO legs for the reduced density matrix. DensityMatrixMixer.get_xR(wR_leg, Id_L, Id_R) Generate the coupling of the MPO legs for the reduced density matrix. DensityMatrixMixer.mix_rho_L(engine, theta, …) Calculated mixed reduced density matrix for left site. DensityMatrixMixer.mix_rho_R(engine, theta, …) Calculated mixed reduced density matrix for left site. DensityMatrixMixer.perturb_svd(engine, …) Mix extra terms to theta and perform an SVD. Update the amplitude, possibly disable the mixer.
class tenpy.algorithms.dmrg.DensityMatrixMixer(options)[source]

Mixer based on density matrices.

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

perturb_svd(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
Returns

mix_rho_L(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
• engine (Engine) – The DMRG engine calling the mixer.

• theta (Array) – Ground state of the effective Hamiltonian, prepared for svd.

• i0 (int) – Site index; theta lives on i0, i0+1.

• mix_enabled (bool) – Whether we should perturb the density matrix.

Returns

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

Return type

Array

mix_rho_R(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
• engine (Engine) – The DMRG engine calling the mixer.

• theta (Array) – Ground state of the effective Hamiltonian, prepared for svd.

• i0 (int) – Site index; theta lives on i0, i0+1.

• mix_enabled (bool) – Whether we should perturb the density matrix.

Returns

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

Return type

Array

get_xR(wR_leg, Id_L, Id_R)[source]

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

Parameters
• wR_leg (LegCharge) – LegCharge to be connected to.

• IdL (int | None) – Index within the leg for which the MPO has only identities to the left.

• IdR (int | None) – Index within the leg for which the MPO has only identities to the right.

Returns

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

• add_separate_Id (bool) – 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(wL_leg, Id_L, Id_R)[source]

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

Parameters
• wL_leg (LegCharge) – LegCharge to be connected to.

• Id_L (int | None) – Index within the leg for which the MPO has only identities to the left.

• Id_R (int | None) – Index within the leg for which the MPO has only identities to the right.

Returns

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

• add_separate_Id (bool) – 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(sweeps)[source]

Update the amplitude, possibly disable the mixer.

Parameters

sweeps (int) – The number of performed sweeps, to check if we need to disable the mixer.

Returns

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

Return type

Mixer | None