26#ifndef dftefeKohnShamDFT_h
27#define dftefeKohnShamDFT_h
45 template <
typename ValueTypeElectrostaticsCoeff,
46 typename ValueTypeElectrostaticsBasis,
47 typename ValueTypeWaveFunctionCoeff,
48 typename ValueTypeWaveFunctionBasis,
55 std::variant<Hamiltonian<float, memorySpace> *,
62 ValueTypeWaveFunctionBasis>;
65 ValueTypeWaveFunctionCoeff>;
70 using OpContext =
typename linearAlgebra::HermitianIterativeEigenSolver<
78 const std::vector<utils::Point> &atomCoordinates,
79 const std::vector<double> & atomCharges,
80 const std::vector<double> & smearedChargeRadius,
84 const double smearingTemperature,
85 const double fermiEnergyTolerance,
86 const double fracOccupancyTolerance,
87 const double eigenSolveResidualTolerance,
88 const double scfDensityResidualNormTolerance,
91 const bool evaluateEnergyEverySCF,
94 const double mixingParameter,
95 const bool isAdaptiveAndersonMixingParameter,
98 &electronChargeDensityInput,
103 ValueTypeElectrostaticsBasis,
105 dim>> feBMTotalCharge,
107 ValueTypeWaveFunctionBasis,
114 feBDTotalChargeStiffnessMatrix,
117 memorySpace>> feBDNuclearChargeRhs,
120 memorySpace>> feBDElectronicChargeRhs,
124 memorySpace>> feBDKineticHamiltonian,
128 feBDElectrostaticsHamiltonian,
131 memorySpace>> feBDEXCHamiltonian,
150 bool isResidualChebyshevFilter =
true);
155 const std::vector<utils::Point> &atomCoordinates,
156 const std::vector<double> & atomCharges,
157 const std::vector<double> & smearedChargeRadius,
161 const double smearingTemperature,
162 const double fermiEnergyTolerance,
163 const double fracOccupancyTolerance,
164 const double eigenSolveResidualTolerance,
165 const double scfDensityResidualNormTolerance,
168 const bool evaluateEnergyEverySCF,
171 const double mixingParameter,
172 const bool isAdaptiveAndersonMixingParameter,
175 &electronChargeDensityInput,
180 ValueTypeElectrostaticsBasis,
182 dim>> feBMTotalCharge,
184 ValueTypeWaveFunctionBasis,
191 feBDTotalChargeStiffnessMatrix,
194 memorySpace>> feBDNuclearChargeRhs,
197 memorySpace>> feBDElectronicChargeRhs,
201 feBDNuclChargeStiffnessMatrixNumSol,
204 memorySpace>> feBDNuclChargeRhsNumSol,
208 memorySpace>> feBDKineticHamiltonian,
212 feBDElectrostaticsHamiltonian,
215 memorySpace>> feBDEXCHamiltonian,
234 bool isResidualChebyshevFilter =
true);
238 const std::vector<utils::Point> &atomCoordinates,
239 const std::vector<double> & atomCharges,
240 const std::vector<double> & smearedChargeRadius,
244 const double smearingTemperature,
245 const double fermiEnergyTolerance,
246 const double fracOccupancyTolerance,
247 const double eigenSolveResidualTolerance,
248 const double scfDensityResidualNormTolerance,
251 const bool evaluateEnergyEverySCF,
254 const double mixingParameter,
255 const bool isAdaptiveAndersonMixingParameter,
258 &electronChargeDensityInput,
261 ValueTypeElectrostaticsCoeff,
262 memorySpace> &atomicTotalElecPotNuclearQuad,
264 ValueTypeElectrostaticsCoeff,
265 memorySpace> &atomicTotalElecPotElectronicQuad,
269 ValueTypeElectrostaticsBasis,
271 dim>> feBMTotalCharge,
273 ValueTypeWaveFunctionBasis,
280 feBDTotalChargeStiffnessMatrix,
283 memorySpace>> feBDNuclearChargeRhs,
286 memorySpace>> feBDElectronicChargeRhs,
290 memorySpace>> feBDKineticHamiltonian,
294 feBDElectrostaticsHamiltonian,
297 memorySpace>> feBDEXCHamiltonian,
316 bool isResidualChebyshevFilter =
true);
335 ValueTypeWaveFunctionCoeff,
341 ValueTypeWaveFunctionBasis,
346 ValueTypeWaveFunctionCoeff,
351 ValueTypeElectrostaticsCoeff,
352 ValueTypeWaveFunctionBasis,
356 std::shared_ptr<
KineticFE<ValueTypeWaveFunctionBasis,
357 ValueTypeWaveFunctionCoeff,
363 ValueTypeWaveFunctionBasis,
382 std::shared_ptr<linearAlgebra::LinAlgOpContext<memorySpace>>
401 ValueTypeElectrostaticsBasis,
402 ValueTypeWaveFunctionCoeff,
403 ValueTypeWaveFunctionBasis,
An abstract class to store and access data for a given basis, such as the basis function values on a ...
Definition: FEBasisDataStorage.h:54
An abstract class to encapsulate the partitioning of a finite element basis across multiple processor...
Definition: FEBasisManager.h:44
Definition: DensityCalculator.h:42
Definition: ElectrostaticExcFE.h:54
Definition: ElectrostaticLocalFE.h:57
Definition: ExchangeCorrelationFE.h:51
Definition: Hamiltonian.h:35
Definition: KineticFE.h:48
Definition: KohnShamDFT.h:52
const utils::mpi::MPIComm & d_mpiCommDomain
Definition: KohnShamDFT.h:380
std::vector< RealType > d_kohnShamEnergies
Definition: KohnShamDFT.h:367
linearAlgebra::Vector< ValueTypeWaveFunctionCoeff, memorySpace > d_lanczosGuess
Definition: KohnShamDFT.h:385
linearAlgebra::blasLapack::real_type< ValueType > RealType
Definition: KohnShamDFT.h:69
const size_type d_numElectrons
Definition: KohnShamDFT.h:388
bool d_isOEFEBasis
Definition: KohnShamDFT.h:408
const OpContext * d_MContext
Definition: KohnShamDFT.h:379
const size_type d_numWantedEigenvalues
Definition: KohnShamDFT.h:327
bool d_isSolved
Definition: KohnShamDFT.h:396
std::shared_ptr< const basis::FEBasisManager< ValueTypeWaveFunctionCoeff, ValueTypeWaveFunctionBasis, memorySpace, dim > > d_feBMWaveFn
Definition: KohnShamDFT.h:366
std::vector< RealType > d_occupation
Definition: KohnShamDFT.h:328
linearAlgebra::MultiVector< ValueType, memorySpace > * d_kohnShamWaveFunctions
Definition: KohnShamDFT.h:369
MixingScheme< RealType, RealType > d_mixingScheme
Definition: KohnShamDFT.h:381
linearAlgebra::blasLapack::scalar_type< ValueTypeOperator, ValueTypeOperator > ValueType
Definition: KohnShamDFT.h:68
bool d_isAdaptiveAndersonMixingParameter
Definition: KohnShamDFT.h:373
std::variant< Hamiltonian< float, memorySpace > *, Hamiltonian< double, memorySpace > *, Hamiltonian< std::complex< float >, memorySpace > *, Hamiltonian< std::complex< double >, memorySpace > * > HamiltonianPtrVariant
Definition: KohnShamDFT.h:58
std::shared_ptr< ElectrostaticLocalFE< ValueTypeElectrostaticsBasis, ValueTypeElectrostaticsCoeff, ValueTypeWaveFunctionBasis, memorySpace, dim > > d_hamitonianElec
Definition: KohnShamDFT.h:355
utils::MemoryStorage< RealType, utils::MemorySpace::HOST > d_jxwDataHost
Definition: KohnShamDFT.h:330
quadrature::QuadratureValuesContainer< RealType, memorySpace > d_densityOutQuadValues
Definition: KohnShamDFT.h:376
size_type d_mixingHistory
Definition: KohnShamDFT.h:371
std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeWaveFunctionBasis, memorySpace > > d_feBDEXCHamiltonian
Definition: KohnShamDFT.h:393
bool d_isResidualChebyshevFilter
Definition: KohnShamDFT.h:407
double d_mixingParameter
Definition: KohnShamDFT.h:372
RealType d_groundStateEnergy
Definition: KohnShamDFT.h:395
size_type d_numMaxSCFIter
Definition: KohnShamDFT.h:378
typename linearAlgebra::HermitianIterativeEigenSolver< ValueTypeOperator, ValueTypeOperand, memorySpace >::OpContext OpContext
Definition: KohnShamDFT.h:73
std::shared_ptr< linearAlgebra::LinAlgOpContext< memorySpace > > d_linAlgOpContext
Definition: KohnShamDFT.h:383
std::shared_ptr< KineticFE< ValueTypeWaveFunctionBasis, ValueTypeWaveFunctionCoeff, memorySpace, dim > > d_hamitonianKin
Definition: KohnShamDFT.h:360
linearAlgebra::blasLapack::scalar_type< ValueTypeElectrostaticsBasis, ValueTypeWaveFunctionBasis > ValueTypeOperator
Definition: KohnShamDFT.h:62
quadrature::QuadratureValuesContainer< RealType, memorySpace > d_densityInQuadValues
Definition: KohnShamDFT.h:376
std::shared_ptr< KohnShamEigenSolver< ValueTypeOperator, ValueTypeOperand, memorySpace > > d_ksEigSolve
Definition: KohnShamDFT.h:333
bool d_evaluateEnergyEverySCF
Definition: KohnShamDFT.h:374
utils::ConditionalOStream d_rootCout
Definition: KohnShamDFT.h:370
std::shared_ptr< ElectrostaticExcFE< ValueTypeElectrostaticsCoeff, ValueTypeElectrostaticsBasis, ValueTypeWaveFunctionCoeff, ValueTypeWaveFunctionBasis, memorySpace, dim > > d_hamiltonianElectroExc
Definition: KohnShamDFT.h:406
utils::Profiler d_p
Definition: KohnShamDFT.h:397
const double d_SCFTol
Definition: KohnShamDFT.h:329
void solve()
Definition: KohnShamDFT.t.cpp:1110
std::shared_ptr< KohnShamOperatorContextFE< ValueTypeOperator, ValueTypeOperand, ValueTypeWaveFunctionBasis, memorySpace, dim > > d_hamitonianOperator
Definition: KohnShamDFT.h:344
quadrature::QuadratureValuesContainer< RealType, memorySpace > d_densityResidualQuadValues
Definition: KohnShamDFT.h:377
bool d_isPSPCalculation
Definition: KohnShamDFT.h:398
const OpContext * d_MInvContext
Definition: KohnShamDFT.h:379
std::shared_ptr< DensityCalculator< ValueTypeWaveFunctionBasis, ValueTypeWaveFunctionCoeff, memorySpace, dim > > d_densCalc
Definition: KohnShamDFT.h:338
double getGroundStateEnergy()
Definition: KohnShamDFT.t.cpp:1474
linearAlgebra::MultiVector< ValueTypeWaveFunctionCoeff, memorySpace > d_waveFunctionSubspaceGuess
Definition: KohnShamDFT.h:387
std::shared_ptr< ExchangeCorrelationFE< ValueTypeWaveFunctionBasis, ValueTypeWaveFunctionCoeff, memorySpace, dim > > d_hamitonianXC
Definition: KohnShamDFT.h:349
linearAlgebra::blasLapack::scalar_type< ValueTypeElectrostaticsCoeff, ValueTypeWaveFunctionCoeff > ValueTypeOperand
Definition: KohnShamDFT.h:65
Definition: KohnShamEigenSolver.h:61
A derived class of linearAlgebra::OperatorContext to encapsulate the action of a discrete Kohn-Sham o...
Definition: KohnShamOperatorContextFE.h:63
This class performs the anderson mixing in a variable agnostic way This class takes can take differen...
Definition: MixingScheme.h:61
Abstract class to encapsulate the action of a discrete operator on vectors, matrices,...
Definition: IdentityOperatorContext.h:53
Definition: LinAlgOpContext.h:38
An class template to encapsulate a MultiVector. A MultiVector is a collection of vectors belonging t...
Definition: MultiVector.h:134
A class that encapsulates a vector. This is a vector in the mathematical sense and not in the sense o...
Definition: Vector.h:122
Definition: QuadratureValuesContainer.h:39
Provides an interface to print based on whether a certain condition is met or not....
Definition: ConditionalOStream.h:47
Definition: Function.h:10
Definition: MemoryStorage.h:38
Definition: Profiler.h:44
blas::scalar_type< ValueType1, ValueType2 > scalar_type
Definition: BlasLapackTypedef.h:70
blas::real_type< ValueType > real_type
Definition: BlasLapackTypedef.h:64
int MPIComm
Definition: MPITypes.h:83
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
unsigned int size_type
Definition: TypeConfig.h:8