sisl.mixing.DIISMixer
- class sisl.mixing.DIISMixer
Bases:
BaseHistoryWeightMixer
Direct inversion of the iterative subspace (DIIS mixing)
This mixing method (also known as Pulay mixing) estimates the next trial function given a set of previously inputs and derivatives of those inputs.
Its implementation is general in the sense that one can manually define which values are used for the subspace. I.e. generally the subspace metric is calculated using:
And then the mixing coefficients is calculated using the regular method for a matrix
. Generally the metric is calculated using , however, by calling the object with an optional 3rd argument, the metric will use that argument instead of but still use when extrapolating the coefficients. This may be useful for testing various metrics based on alternate values.Alternatively one can pass a metric argument that can pre-process the
variable.- Parameters:
weight (
float
, optional) – weight used for the derivative of the functional. The mixer will use a weight of for the old valuehistory (
int
orHistory
, optional) – how many history steps it will use in the estimation of the new functionalmetric (
callable
, optional) – the metric used for the two values, defaults tolambda a, b: a.ravel().conj().dot(b.ravel).real
Methods
Calculate coefficients of the Lagrangian
mix
(coefficients)Calculate a new variable
using history and input coefficientsset_history
(history)Replace the current history in the mixer with a new one
set_weight
(weight)Set a new weight for this mixer
Calculate the coefficients according to Pulay's method, return everything + Lagrange multiplier
Attributes
History object tracked by this mixer
This mixers mixing weight, the weight is the fractional contribution of the derivative
- __call__(f, df, delta=None, append=True)[source]
Append data to the history (omitting None values)!
- coefficients()[source]
Calculate coefficients of the Lagrangian
- Return type:
npt.NDArray[np.float64]
- mix(coefficients)[source]
Calculate a new variable
using history and input coefficients- Parameters:
coefficients (
numpy.ndarray
) – coefficients used for extrapolation- Return type:
- set_history(history)
Replace the current history in the mixer with a new one
- 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