17#ifndef DFTFE_MIXINGCLASS_H
18#define DFTFE_MIXINGCLASS_H
53 const MPI_Comm &mpi_comm_domain,
65 const std::vector<mixingVariable> mixingVariablesList);
101 const bool performMPIReduce,
102 const double mixingValue,
103 const bool adaptMixingValue);
111 const double *inputVariableToInHist,
120 const double *inputVariableToResidualHist,
129 double *outputVariable,
135 double *outputVariable,
141 double *inputVariable,
142 double *outputVariable,
162 const bool isPerformMixing,
163 const bool isMPIAllReduce,
164 std::vector<double> &A,
165 std::vector<double> &c);
void clearHistory()
Clears all the the history.
std::vector< double > d_A
Definition mixingClass.h:167
const MPI_Comm d_mpi_comm_domain
Definition mixingClass.h:184
bool d_anyMixingParameterAdaptive
Definition mixingClass.h:188
void getOptimizedResidual(const mixingVariable mixingVariableName, double *outputVariable, const dftfe::uInt lenVar)
std::map< mixingVariable, bool > d_adaptMixingParameter
Definition mixingClass.h:187
void addVariableToInHist(const mixingVariable mixingVariableName, const double *inputVariableToInHist, const dftfe::uInt length)
Adds to the input history.
const MPI_Comm d_mpi_comm_parent
Definition mixingClass.h:184
void computeAndersonMixingCoeff(const std::vector< mixingVariable > mixingVariablesList)
Computes the mixing coefficients.
MixingScheme(const MPI_Comm &mpi_comm_parent, const MPI_Comm &mpi_comm_domain, const dftfe::uInt verbosity)
dftfe::uInt lengthOfHistory()
bool d_adaptiveMixingParameterDecAllIterations
Definition mixingClass.h:190
std::vector< double > d_c
Definition mixingClass.h:167
std::map< mixingVariable, std::deque< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > > d_variableHistoryResidual
Definition mixingClass.h:175
dealii::ConditionalOStream pcout
conditional stream object
Definition mixingClass.h:198
bool d_adaptiveMixingParameterDecLastIteration
Definition mixingClass.h:189
std::map< mixingVariable, std::deque< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > > d_variableHistoryIn
Definition mixingClass.h:175
double d_cFinal
Definition mixingClass.h:168
void mixVariable(const mixingVariable mixingVariableName, double *outputVariable, const dftfe::uInt lenVar)
Computes the input for the next iteration based on the anderson coefficients.
dftfe::uInt d_mixingHistory
Definition mixingClass.h:192
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 vari...
void popOldHistory(dftfe::uInt mixingHistory)
Deletes the old history if the length exceeds max length of history.
bool d_adaptiveMixingParameterIncAllIterations
Definition mixingClass.h:191
std::map< mixingVariable, bool > d_performMixing
Definition mixingClass.h:193
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 th...
void mixPreconditionedResidual(const mixingVariable mixingVariableName, double *inputVariable, double *outputVariable, const dftfe::uInt lenVar)
const dftfe::Int d_verbosity
Definition mixingClass.h:194
std::map< mixingVariable, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_vectorDotProductWeights
Definition mixingClass.h:181
void computeAdaptiveAndersonMixingParameter()
Computes the adaptive mixing parameter.
std::map< mixingVariable, bool > d_performMPIReduce
Definition mixingClass.h:182
std::map< mixingVariable, double > d_mixingParameter
Definition mixingClass.h:186
void addVariableToResidualHist(const mixingVariable mixingVariableName, const double *inputVariableToResidualHist, const dftfe::uInt length)
Adds to the residual history.
Definition MemoryStorage.h:33
Definition pseudoPotentialToDftfeConverter.cc:34
mixingVariable
Enum class that stores he list of variables that will can be used in the mixing scheme.
Definition mixingClass.h:32
@ magZ
Definition mixingClass.h:35
@ gradMagZ
Definition mixingClass.h:36
@ tau
Definition mixingClass.h:38
@ gradRho
Definition mixingClass.h:34
@ rho
Definition mixingClass.h:33
@ hubbardOccupation
Definition mixingClass.h:37
@ tauMagZ
Definition mixingClass.h:39
std::uint32_t uInt
Definition TypeConfig.h:10
std::int32_t Int
Definition TypeConfig.h:11