sisl.mixing.AdaptivePulayMixer

class sisl.mixing.AdaptivePulayMixer(weight: Tuple[float | int, float | int] = (0.03, 0.5), history: int | History = 2, metric: Callable[[Any, Any], Any] | None = None)

Bases: AdaptiveDIISMixer

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 \(\mathbf 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

Parameters:
  • weight (Tuple[TypeWeight, TypeWeight]) –

  • history (TypeArgHistory) –

  • metric (Optional[TypeMetric]) –

__call__(f: T, df: T, delta: Any | None = None, append: bool = True) T

Append data to the history (omitting None values)!

Parameters:
  • f (T) –

  • df (T) –

  • delta (Any | None) –

  • append (bool) –

Return type:

T

__init__(weight: Tuple[float | int, float | int] = (0.03, 0.5), history: int | History = 2, metric: Callable[[Any, Any], Any] | None = None)
Parameters:
adjust_weight(lagrange: Any, offset: float | int = 13, spread: float | int = 7) None

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

Parameters:
Return type:

None

coefficients() ndarray[Any, dtype[_ScalarType_co]]

Calculate coefficients and adjust weights according to a Lagrange multiplier

Return type:

ndarray[Any, dtype[_ScalarType_co]]

property history: History

History object tracked by this mixer

mix(coefficients: ndarray[Any, dtype[_ScalarType_co]]) Any

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

Parameters:

coefficients (ndarray) – coefficients used for extrapolation

Return type:

Any

set_history(history: int | History) None

Replace the current history in the mixer with a new one

Parameters:

history (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: float | int)

Set a new weight for this mixer

Parameters:

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

solve_lagrange() Tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]]

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

Return type:

Tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]]

property weight: float | int

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