sisl.mixing.AdaptiveDIISMixer

class sisl.mixing.AdaptiveDIISMixer(weight=(0.03, 0.5), history=2, metric=None)

Bases: DIISMixer

Adapt the mixing weight according to the Lagrange multiplier

The Lagrange multiplier calculated in a DIIS/Pulay mixing scheme is the squared norm of the residual that is minimized using the Lagrange method. It holds information on the closeness of the functional to a minimum.

Thus we can use the Lagrange multiplier to adjust the weight such that for large values we know our next guess (\(f_{\mathrm{new}}\)) will be relatively far from the true saddle point, and for small values we will be close to the saddle point.

Methods

adjust_weight(lagrange[, offset, spread])

Adjust the weight according to the Lagrange multiplier.

coefficients()

Calculate coefficients and adjust weights according to a Lagrange multiplier

mix(coefficients)

Calculate a new variable \(f'\) using history and input coefficients

set_history(history)

Replace the current history in the mixer with a new one

set_weight(weight)

Set a new weight for this mixer

solve_lagrange()

Calculate the coefficients according to Pulay's method, return everything + Lagrange multiplier

history

History object tracked by this mixer

weight

This mixers mixing weight, the weight is the fractional contribution of the derivative

__call__(f, df, delta=None, append=True)

Append data to the history (omitting None values)!

Return type

TypeVar(T)

__init__(weight=(0.03, 0.5), history=2, metric=None)[source]
adjust_weight(lagrange, offset=13, spread=7)[source]

Adjust the weight according to the Lagrange multiplier.

Once close to convergence the Lagrange multiplier will be close to 0, otherwise it will go towards infinity. We here adjust using the Fermi-function to hit the minimum/maximum weight with a suitable spread

Return type

None

coefficients()[source]

Calculate coefficients and adjust weights according to a Lagrange multiplier

Return type

ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]

property history: History

History object tracked by this mixer

mix(coefficients)

Calculate a new variable \(f'\) using history and input coefficients

Parameters

coefficients (numpy.ndarray) – coefficients used for extrapolation

Return type

Any

set_history(history)

Replace the current history in the mixer with a new one

Parameters

history (Union[int, History]) – if an int a new History object will be created with that number of history elements Otherwise the object will be directly attached to the mixer.

Return type

None

set_weight(weight)

Set a new weight for this mixer

Parameters

weight (float) – the new weight for this mixer, it must be bigger than 0

solve_lagrange()

Calculate the coefficients according to Pulay’s method, return everything + Lagrange multiplier

Return type

Tuple[ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]], ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]]

property weight: Union[float, int]

This mixers mixing weight, the weight is the fractional contribution of the derivative