Mixer

Inheritance Diagram

Inheritance diagram of tenpy.algorithms.dmrg.Mixer

Methods

Mixer.__init__(options)

Initialize self.

Mixer.perturb_svd(engine, theta, i0, …)

Perturb the wave function and perform an SVD with truncation.

Mixer.update_amplitude(sweeps)

Update the amplitude, possibly disable the mixer.

class tenpy.algorithms.dmrg.Mixer(options)[source]

Bases: object

Base class of a general Mixer.

Since DMRG performs only local updates of the state, it can get stuck in “local minima”, in particular if the Hamiltonain is long-range – which is the case if one maps a 2D system (“infinite cylinder”) to 1D – or if one wants to do single-site updates (currently not implemented in TeNPy). The idea of the mixer is to perturb the state with the terms of the Hamiltonian which have contributions in both the “left” and “right” side of the system. In that way, it adds fluctuation of the quantum numbers and non-zero contributions of the long-range terms - leading to a significantly improved convergence of DMRG.

The strength of the perturbation is given by the amplitude of the mixer. A good strategy is to choose an initially significant amplitude and let it decay until the perturbation becomes completely irrelevant and the mixer gets disabled.

This original idea of the mixer was introduced in [white2005]. [hubig2015] discusses the mixer and provides an improved version.

Parameters
  • env (MPOEnvironment) – Environment for contraction <psi|H|psi> for later

  • options (dict) – Optional parameters as described in the following table. see Mixer

Options

config Mixer
option summary

amplitude

Initial strength of the mixer. (Should be << 1.)

decay

To slowly turn off the mixer, we divide `amplitude` by `decay` [...]

disable_after

We disable the mixer completely after this number of sweeps.

option amplitude: float

Initial strength of the mixer. (Should be << 1.)

option decay: float

To slowly turn off the mixer, we divide amplitude by decay after each sweep. (Should be >= 1.)

option disable_after: int

We disable the mixer completely after this number of sweeps.

amplitude

Current amplitude for mixing.

Type

float

decay

Factor by which amplitude is divided after each sweep.

Type

float

disable_after

The number of sweeps after which the mixer should be disabled.

Type

int

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

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

Perturb the wave function and perform an SVD with truncation.

Parameters
  • engine (DMRGEngine) – The DMRG engine calling the mixer.

  • theta (Array) – The optimized wave function, prepared for svd.

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

  • update_LP (bool) – Whether to calculate the next env.LP[i0+1].

  • update_RP (bool) – Whether to calculate the next env.RP[i0].

Returns

  • U (Array) – Left-canonical part of theta. Labels '(vL.p0)', 'vR'.

  • S (1D ndarray | 2D Array) – Without mixer just the singluar values of the array; with mixer it might be a general matrix; see comment above.

  • VH (Array) – Right-canonical part of theta. Labels 'vL', '(vR.p1)'.

  • err (TruncationError) – The truncation error introduced.