PulayMixer

class PulayMixer(noncollinear_mixing=None, restart_strategy=None, history_storage=None, noncollinear_restart=None)

Class for representing a Pulay mixer.

Parameters:
  • noncollinear_mixing (bool) – A special routine is used for the noncollinear mixing if this flag is used.
    Default: False

  • restart_strategy (NoRestart | AdaptiveHistoryRestart) – The restart strategy for the SCF loop.
    Default: None

  • history_storage (Duplicated | Distributed) – Flag indicating whether the history should be stored on each process (Duplicated) or distributed across all processes (Distributed).
    Default: Automatic: Distributed in the absence of a preconditioner and noncollinear mixing. Duplicated otherwise.
    Deprecated: from v2020.9, input will be ignored. When noncollinear_mixing is True, storage will be Duplicated, otherwise we use distributed storage.

  • noncollinear_restart
    Deprecated: from v2016.0, use noncollinear_mixing instead.

historyStorage()
Returns:

The flag indicating how the history is stored.

Return type:

Duplicated | Distributed

noncollinearMixing()
Returns:

True if the non-collinear restart mixing algorithm should be used.

Return type:

bool

noncollinearRestart()


Deprecated: from v2016.0, use noncollinearMixing() instead.

Returns:

True if the non-collinear restart mixing algorithm should be used.

Return type:

bool

restartStrategy()
Returns:

The restart strategy.

Return type:

NoRestart | AdaptiveHistoryRestart

uniqueString()

Return a unique string representing the state of the object.

Usage Examples

Set up a Pulay mixer with automatic memory distribution

# Iteration control parameters with automatic Pulay mixer
mixer=PulayMixer()
iteration_control_parameters=IterationControlParameters(algorithm=mixer)

Set up a Pulay mixer that uses the non-collinear restart mixing algorithm (and thus non-distributed history storage)

# Iteration control parameters with Pulay mixer (non-collinear mixing)
mixer=PulayMixer(noncollinear_mixing=True)
iteration_control_parameters=IterationControlParameters(algorithm=mixer)

Set up a Pulay mixer with explicitly distributed memory

# Iteration control parameters with distributed Pulay mixer.
mixer=PulayMixer(history_storage=Distributed)
iteration_control_parameters=IterationControlParameters(algorithm=mixer)

Notes

PulayMixer implements the Pulay-Kerker method [1].

In the Pulay mixing scheme the best guess for the next input is given by,

\[h_{n+1}^\mathrm{in} = \eta \sum_{i=n-n^\mathrm{hist}}^{n} \alpha_i h_i^\mathrm{out} + (1-\eta) \sum_{i=1}^{n-n^\mathrm{hist}} \alpha_i h_i^\mathrm{in}\]

where \(h_i^\mathrm{in}\) is the input value and \(h_i^\mathrm{out}\) is the output value of the mixing_variable at iteration \(i\). Currently there is support for using HamiltonianVariable for mixing. The parameter \(\eta\) is the damping_factor and \(n^\mathrm{hist}\) the number_of_history_steps used for finding the input value for the next iteration. The variables \(\alpha_i\) are obtained by minimizing the residual error of the mixing_variable assuming a linear relation between the residual errors of different iteration numbers.

The PulayMixer is available in both a memory-distributed and a non-memory-distributed version. The non-distributed version has a slight performance advantage, but in cases where the SCF history uses a considerable amount of memory, the distributed version can be used to avoid being memory limited.

In the default case, memory distribution is activated if the stored history would use more than 50 MB. However, memory distribution cannot be used when either a preconditioner or non-collinear mixing is used. In those cases, memory distribution will be disabled by default. If memory distribution was explicitly requested with history_storage=Distributed, an exception will be raised when the mixer is used. This is to avoid exceeding the expected memory usage by silently falling back to duplicated history storage.