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 dftfe::uInt verbosity) | |
dftfe::uInt | lengthOfHistory () |
void | computeAndersonMixingCoeff (const std::vector< mixingVariable > mixingVariablesList) |
Computes the mixing coefficients. | |
void | computeAdaptiveAndersonMixingParameter () |
Computes the adaptive mixing parameter. | |
void | popOldHistory (dftfe::uInt 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 dftfe::uInt length) |
Adds to the input history. | |
void | addVariableToResidualHist (const mixingVariable mixingVariableName, const double *inputVariableToResidualHist, const dftfe::uInt length) |
Adds to the residual history. | |
void | mixVariable (const mixingVariable mixingVariableName, double *outputVariable, const dftfe::uInt lenVar) |
Computes the input for the next iteration based on the anderson coefficients. | |
void | getOptimizedResidual (const mixingVariable mixingVariableName, double *outputVariable, const dftfe::uInt lenVar) |
void | mixPreconditionedResidual (const mixingVariable mixingVariableName, double *inputVariable, double *outputVariable, const dftfe::uInt lenVar) |
Public Attributes | |
std::map< mixingVariable, std::deque< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > > | d_variableHistoryIn |
std::map< mixingVariable, std::deque< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > > | d_variableHistoryResidual |
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() | |
Private Attributes | |
std::vector< double > | d_A |
std::vector< double > | d_c |
double | d_cFinal |
std::map< mixingVariable, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > | d_vectorDotProductWeights |
std::map< mixingVariable, bool > | d_performMPIReduce |
const MPI_Comm | d_mpi_comm_domain |
const MPI_Comm | d_mpi_comm_parent |
std::map< mixingVariable, double > | d_mixingParameter |
std::map< mixingVariable, bool > | d_adaptMixingParameter |
bool | d_anyMixingParameterAdaptive |
bool | d_adaptiveMixingParameterDecLastIteration |
bool | d_adaptiveMixingParameterDecAllIterations |
bool | d_adaptiveMixingParameterIncAllIterations |
dftfe::uInt | d_mixingHistory |
std::map< mixingVariable, bool > | d_performMixing |
const dftfe::Int | d_verbosity |
dealii::ConditionalOStream | pcout |
conditional stream object | |
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 dftfe::uInt | 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 dftfe::uInt | length ) |
Adds to the input history.
void dftfe::MixingScheme::addVariableToResidualHist | ( | const mixingVariable | mixingVariableName, |
const double * | inputVariableToResidualHist, | ||
const dftfe::uInt | 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 dftfe::uInt | lenVar ) |
dftfe::uInt dftfe::MixingScheme::lengthOfHistory | ( | ) |
void dftfe::MixingScheme::mixPreconditionedResidual | ( | const mixingVariable | mixingVariableName, |
double * | inputVariable, | ||
double * | outputVariable, | ||
const dftfe::uInt | lenVar ) |
void dftfe::MixingScheme::mixVariable | ( | const mixingVariable | mixingVariableName, |
double * | outputVariable, | ||
const dftfe::uInt | lenVar ) |
Computes the input for the next iteration based on the anderson coefficients.
void dftfe::MixingScheme::popOldHistory | ( | dftfe::uInt | 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 |
std::map< mixingVariable, std::deque< dftfe::utils::MemoryStorage<double, dftfe::utils::MemorySpace::HOST> > > dftfe::MixingScheme::d_variableHistoryIn |
std::map< mixingVariable, std::deque< dftfe::utils::MemoryStorage<double, dftfe::utils::MemorySpace::HOST> > > dftfe::MixingScheme::d_variableHistoryResidual |
|
private |
|
private |
|
private |
conditional stream object