17#ifndef DFTFE_MIXINGCLASS_H
18#define DFTFE_MIXINGCLASS_H
51 const MPI_Comm & mpi_comm_domain,
52 const unsigned int verbosity);
63 const std::vector<mixingVariable> mixingVariablesList);
99 const bool performMPIReduce,
100 const double mixingValue,
101 const bool adaptMixingValue);
109 const double * inputVariableToInHist,
110 const unsigned int length);
118 const double * inputVariableToResidualHist,
119 const unsigned int length);
127 double * outputVariable,
128 const unsigned int lenVar);
133 double * outputVariable,
134 const unsigned int lenVar);
139 double * inputVariable,
140 double * outputVariable,
141 const unsigned int lenVar);
160 const bool isPerformMixing,
161 const bool isMPIAllReduce,
162 std::vector<double> &A,
163 std::vector<double> &c);
void clearHistory()
Clears all the the history.
std::vector< double > d_A
Definition mixingClass.h:165
const MPI_Comm d_mpi_comm_domain
Definition mixingClass.h:179
bool d_anyMixingParameterAdaptive
Definition mixingClass.h:183
std::map< mixingVariable, bool > d_adaptMixingParameter
Definition mixingClass.h:182
void mixVariable(const mixingVariable mixingVariableName, double *outputVariable, const unsigned int lenVar)
Computes the input for the next iteration based on the anderson coefficients.
unsigned int lengthOfHistory()
void popOldHistory(unsigned int mixingHistory)
Deletes the old history if the length exceeds max length of history.
const MPI_Comm d_mpi_comm_parent
Definition mixingClass.h:179
void computeAndersonMixingCoeff(const std::vector< mixingVariable > mixingVariablesList)
Computes the mixing coefficients.
void addVariableToInHist(const mixingVariable mixingVariableName, const double *inputVariableToInHist, const unsigned int length)
Adds to the input history.
bool d_adaptiveMixingParameterDecAllIterations
Definition mixingClass.h:185
std::vector< double > d_c
Definition mixingClass.h:165
std::map< mixingVariable, std::deque< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > > d_variableHistoryResidual
Definition mixingClass.h:172
dealii::ConditionalOStream pcout
conditional stream object
Definition mixingClass.h:193
bool d_adaptiveMixingParameterDecLastIteration
Definition mixingClass.h:184
unsigned int d_mixingHistory
Definition mixingClass.h:187
std::map< mixingVariable, std::deque< dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > > d_variableHistoryIn
Definition mixingClass.h:172
void addVariableToResidualHist(const mixingVariable mixingVariableName, const double *inputVariableToResidualHist, const unsigned int length)
Adds to the residual history.
double d_cFinal
Definition mixingClass.h:166
void getOptimizedResidual(const mixingVariable mixingVariableName, double *outputVariable, const unsigned int lenVar)
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...
bool d_adaptiveMixingParameterIncAllIterations
Definition mixingClass.h:186
std::map< mixingVariable, bool > d_performMixing
Definition mixingClass.h:188
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...
std::map< mixingVariable, dftfe::utils::MemoryStorage< double, dftfe::utils::MemorySpace::HOST > > d_vectorDotProductWeights
Definition mixingClass.h:176
void computeAdaptiveAndersonMixingParameter()
Computes the adaptive mixing parameter.
std::map< mixingVariable, bool > d_performMPIReduce
Definition mixingClass.h:177
std::map< mixingVariable, double > d_mixingParameter
Definition mixingClass.h:181
void mixPreconditionedResidual(const mixingVariable mixingVariableName, double *inputVariable, double *outputVariable, const unsigned int lenVar)
MixingScheme(const MPI_Comm &mpi_comm_parent, const MPI_Comm &mpi_comm_domain, const unsigned int verbosity)
const int d_verbosity
Definition mixingClass.h:189
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
@ gradRho
Definition mixingClass.h:34
@ rho
Definition mixingClass.h:33
@ hubbardOccupation
Definition mixingClass.h:37