sisl.mixing.AndersonMixer

class sisl.mixing.AndersonMixer[source]

Bases: BaseHistoryWeightMixer

Anderson mixing

The Anderson mixing assumes that the mixed input/output are linearly related. Hence

\[|\bar{n}^{m}_{\mathrm{in}/\mathrm{out}\rangle = (1 - \beta)|n^{m}_{\mathrm{in}/\mathrm{out}\rangle + \beta|n^{m-1}_{\mathrm{in}/\mathrm{out}\rangle\]

Here the optimal choice β is calculated as:

δi=fioutfiinβ=δi|δiδi1δiδi1|δiδi1

Finally the resulting output becomes:

|nm+1=(1α)|n¯inm+α|n¯outm

See [5] for more details.

Methods

set_history(history)

Replace the current history in the mixer with a new one

set_weight(weight)

Set a new weight for this mixer

Attributes

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)[source]

Calculate a new variable f using input and output of the functional

Parameters:
  • f (object) – input variable for the functional

  • df (object) – derivative of the functional

  • delta (Any | None)

  • append (bool)

Return type:

T

set_history(history)

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)

Set a new weight for this mixer

Parameters:

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

property history: History

History object tracked by this mixer

property weight: float | int

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