DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
|
This class performs the anderson mixing in a variable agnostic way This class takes can take different input variables as input in a std::vector format and computes the mixing coefficients These coefficients can then be used to compute the new variable at the start of the SCF. More...
#include <mixingClass.h>
Public Member Functions | |
MixingScheme (const MPI_Comm &mpi_comm_parent, const MPI_Comm &mpi_comm_domain, const unsigned int verbosity) | |
unsigned int | lengthOfHistory () |
void | computeAndersonMixingCoeff (const std::vector< mixingVariable > mixingVariablesList) |
Computes the mixing coefficients. | |
void | computeAdaptiveAndersonMixingParameter () |
Computes the adaptive mixing parameter. | |
void | popOldHistory (unsigned int mixingHistory) |
Deletes the old history if the length exceeds max length of history. | |
void | clearHistory () |
Clears all the the history. | |
void | addMixingVariable (const mixingVariable mixingVariableList, const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &weightDotProducts, const bool performMPIReduce, const double mixingValue, const bool adaptMixingValue) |
This function is used to add the mixing variables and its corresponding JxW values For dependent variables which are not used in mixing, the weightDotProducts is set to a vector of size zero. Later the dependent variables can be mixed with the same mixing coefficients. | |
void | addVariableToInHist (const mixingVariable mixingVariableName, const double *inputVariableToInHist, const unsigned int length) |
Adds to the input history. | |
void | addVariableToResidualHist (const mixingVariable mixingVariableName, const double *inputVariableToResidualHist, const unsigned int length) |
Adds to the residual history. | |
void | mixVariable (const mixingVariable mixingVariableName, double *outputVariable, const unsigned int lenVar) |
Computes the input for the next iteration based on the anderson coefficients. | |
void | getOptimizedResidual (const mixingVariable mixingVariableName, double *outputVariable, const unsigned int lenVar) |
void | mixPreconditionedResidual (const mixingVariable mixingVariableName, double *inputVariable, double *outputVariable, const unsigned int lenVar) |
Private Member Functions | |
void | computeMixingMatrices (const std::deque< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > &inHist, const std::deque< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > &outHist, const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > &weightDotProducts, const bool isPerformMixing, const bool isMPIAllReduce, std::vector< double > &A, std::vector< double > &c) |
Computes the matrix A and c vector that will be needed for anderson mixing. This function computes the A and c values for each variable which will be then added up in computeAndersonMixingCoeff() | |
This class performs the anderson mixing in a variable agnostic way This class takes can take different input variables as input in a std::vector format and computes the mixing coefficients These coefficients can then be used to compute the new variable at the start of the SCF.
dftfe::MixingScheme::MixingScheme | ( | const MPI_Comm & | mpi_comm_parent, |
const MPI_Comm & | mpi_comm_domain, | ||
const unsigned int | verbosity ) |
void dftfe::MixingScheme::addMixingVariable | ( | const mixingVariable | mixingVariableList, |
const dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > & | weightDotProducts, | ||
const bool | performMPIReduce, | ||
const double | mixingValue, | ||
const bool | adaptMixingValue ) |
This function is used to add the mixing variables and its corresponding JxW values For dependent variables which are not used in mixing, the weightDotProducts is set to a vector of size zero. Later the dependent variables can be mixed with the same mixing coefficients.
void dftfe::MixingScheme::addVariableToInHist | ( | const mixingVariable | mixingVariableName, |
const double * | inputVariableToInHist, | ||
const unsigned int | length ) |
Adds to the input history.
void dftfe::MixingScheme::addVariableToResidualHist | ( | const mixingVariable | mixingVariableName, |
const double * | inputVariableToResidualHist, | ||
const unsigned int | length ) |
Adds to the residual history.
void dftfe::MixingScheme::clearHistory | ( | ) |
Clears all the the history.
void dftfe::MixingScheme::computeAdaptiveAndersonMixingParameter | ( | ) |
Computes the adaptive mixing parameter.
void dftfe::MixingScheme::computeAndersonMixingCoeff | ( | const std::vector< mixingVariable > | mixingVariablesList | ) |
Computes the mixing coefficients.
|
private |
Computes the matrix A and c vector that will be needed for anderson mixing. This function computes the A and c values for each variable which will be then added up in computeAndersonMixingCoeff()
void dftfe::MixingScheme::getOptimizedResidual | ( | const mixingVariable | mixingVariableName, |
double * | outputVariable, | ||
const unsigned int | lenVar ) |
unsigned int dftfe::MixingScheme::lengthOfHistory | ( | ) |
void dftfe::MixingScheme::mixPreconditionedResidual | ( | const mixingVariable | mixingVariableName, |
double * | inputVariable, | ||
double * | outputVariable, | ||
const unsigned int | lenVar ) |
void dftfe::MixingScheme::mixVariable | ( | const mixingVariable | mixingVariableName, |
double * | outputVariable, | ||
const unsigned int | lenVar ) |
Computes the input for the next iteration based on the anderson coefficients.
void dftfe::MixingScheme::popOldHistory | ( | unsigned int | mixingHistory | ) |
Deletes the old history if the length exceeds max length of history.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
conditional stream object