DFT-EFE
 
Loading...
Searching...
No Matches
KohnShamEigenSolver.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2021. *
3 * The Regents of the University of Michigan and DFT-EFE developers. *
4 * *
5 * This file is part of the DFT-EFE code. *
6 * *
7 * DFT-EFE is free software: you can redistribute it and/or modify *
8 * it under the terms of the Lesser GNU General Public License as *
9 * published by the Free Software Foundation, either version 3 of *
10 * the License, or (at your option) any later version. *
11 * *
12 * DFT-EFE is distributed in the hope that it will be useful, but *
13 * WITHOUT ANY WARRANTY; without even the implied warranty *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
15 * See the Lesser GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License at the top level of DFT-EFE distribution. If not, see *
19 * <https://www.gnu.org/licenses/>. *
20 ******************************************************************************/
21
22/*
23 * @author Avirup Sircar
24 */
25
26#ifndef dftefeKohnShamEigenSolver_h
27#define dftefeKohnShamEigenSolver_h
28
36#include <memory>
38#include <utils/Profiler.h>
39
40namespace dftefe
41{
42 namespace ksdft
43 {
54 template <typename ValueTypeOperator,
55 typename ValueTypeOperand,
56 utils::MemorySpace memorySpace>
58 : public linearAlgebra::HermitianIterativeEigenSolver<ValueTypeOperator,
59 ValueTypeOperand,
60 memorySpace>
61 {
62 public:
69 using ValueType = typename linearAlgebra::HermitianIterativeEigenSolver<
70 ValueTypeOperator,
71 ValueTypeOperand,
72 memorySpace>::ValueType;
73 using RealType = typename linearAlgebra::HermitianIterativeEigenSolver<
74 ValueTypeOperator,
75 ValueTypeOperand,
76 memorySpace>::RealType;
77 using OpContext = typename linearAlgebra::HermitianIterativeEigenSolver<
78 ValueTypeOperator,
79 ValueTypeOperand,
80 memorySpace>::OpContext;
81
82 public:
90 const size_type numElectrons,
91 const double smearingTemperature,
92 const double fermiEnergyTolerance,
93 const double fracOccupancyTolerance,
94 const double eigenSolveResidualTolerance,
95 const size_type maxChebyshevFilterPass,
97 &waveFunctionSubspaceGuess,
100 bool isResidualChebyshevFilter = true,
101 const size_type waveFunctionBatchSize = 0,
102 const OpContext &MLanczos =
104 ValueTypeOperand,
105 memorySpace>(),
106 const OpContext &MInvLanczos =
108 ValueTypeOperand,
109 memorySpace>(),
112 bool storeIntermediateSubspaces = false);
113
119
120 void
123 &waveFunctionSubspaceGuess,
125 const OpContext & MLanczos =
127 ValueTypeOperand,
128 memorySpace>(),
129 const OpContext &MInvLanczos =
131 ValueTypeOperand,
132 memorySpace>());
133
134 void
135 reinitBounds(double wantedSpectrumLowerBound,
136 double wantedSpectrumUpperBound);
137
140
141 std::vector<RealType>
143
144 std::vector<RealType>
146
147 void
148 setChebyPolyScalingFactor(double scalingFactor);
149
150 void
152
153 void
155
157 solve(const OpContext & kohnShamOperator,
158 std::vector<RealType> &kohnShamEnergies,
160 & kohnShamWaveFunctions,
161 bool computeWaveFunctions = false,
162 const OpContext &M =
164 ValueTypeOperand,
165 memorySpace>(),
166 const OpContext &MInv =
168 ValueTypeOperand,
169 memorySpace>()) override;
170
173
176
177 private:
178 std::vector<double>
180 const OpContext &kohnShamOperator,
182 & kohnShamWaveFunctions,
183 const OpContext &M);
184
198 std::vector<RealType> d_fracOccupancy;
199 std::vector<RealType> d_eigSolveResNorm;
209
210 std::shared_ptr<
212 ValueTypeOperand,
213 memorySpace>>
215
222
224 std::shared_ptr<linearAlgebra::MultiVector<ValueType, memorySpace>>
229
232
233 }; // end of class KohnShamEigenSolver
234 } // namespace ksdft
235} // end of namespace dftefe
237#endif // dftefeKohnShamEigenSolver_h
Definition: KohnShamEigenSolver.h:61
RealType getFermiEnergy()
Definition: KohnShamEigenSolver.t.cpp:545
utils::MemoryStorage< ValueType, memorySpace > d_kohnShamEnergiesMemspace
Definition: KohnShamEigenSolver.h:227
std::shared_ptr< linearAlgebra::MultiVector< ValueType, memorySpace > > d_MXBatchSmall
Definition: KohnShamEigenSolver.h:226
typename linearAlgebra::HermitianIterativeEigenSolver< ValueTypeOperator, ValueTypeOperand, memorySpace >::OpContext OpContext
Definition: KohnShamEigenSolver.h:80
std::shared_ptr< linearAlgebra::MultiVector< ValueType, memorySpace > > d_HXBatch
Definition: KohnShamEigenSolver.h:225
bool d_isSolved
Definition: KohnShamEigenSolver.h:201
typename linearAlgebra::HermitianIterativeEigenSolver< ValueTypeOperator, ValueTypeOperand, memorySpace >::ValueType ValueType
define ValueType as the superior (bigger set) of the ValueTypeOperator and ValueTypeOperand (e....
Definition: KohnShamEigenSolver.h:72
size_type d_maxChebyshevFilterPass
Definition: KohnShamEigenSolver.h:189
const linearAlgebra::ElpaScalapackManager * d_elpaScala
Definition: KohnShamEigenSolver.h:231
std::shared_ptr< linearAlgebra::ChebyshevFilteredEigenSolver< ValueTypeOperator, ValueTypeOperand, memorySpace > > d_chfsi
Definition: KohnShamEigenSolver.h:214
std::shared_ptr< linearAlgebra::MultiVector< ValueType, memorySpace > > d_HXBatchSmall
Definition: KohnShamEigenSolver.h:225
double d_eigenSolveResidualTolerance
Definition: KohnShamEigenSolver.h:188
linearAlgebra::OrthogonalizationType d_orthoType
Definition: KohnShamEigenSolver.h:230
const size_type d_numElectrons
Definition: KohnShamEigenSolver.h:202
double d_smearingTemperature
Definition: KohnShamEigenSolver.h:185
bool d_isBoundKnown
Definition: KohnShamEigenSolver.h:206
linearAlgebra::EigenSolverError solve(const OpContext &kohnShamOperator, std::vector< RealType > &kohnShamEnergies, linearAlgebra::MultiVector< ValueType, memorySpace > &kohnShamWaveFunctions, bool computeWaveFunctions=false, const OpContext &M=linearAlgebra::IdentityOperatorContext< ValueTypeOperator, ValueTypeOperand, memorySpace >(), const OpContext &MInv=linearAlgebra::IdentityOperatorContext< ValueTypeOperator, ValueTypeOperand, memorySpace >()) override
Definition: KohnShamEigenSolver.t.cpp:214
void setResidualChebyshevFilterFlag(bool flag)
Definition: KohnShamEigenSolver.t.cpp:204
const OpContext * d_MInvLanczos
Definition: KohnShamEigenSolver.h:197
void setChebyshevPolynomialDegree(size_type chebyPolyDeg)
Definition: KohnShamEigenSolver.t.cpp:193
utils::ConditionalOStream d_rootCout
Definition: KohnShamEigenSolver.h:203
linearAlgebra::MultiVector< ValueType, memorySpace > & getFilteredSubspace()
Definition: KohnShamEigenSolver.t.cpp:712
std::vector< RealType > getEigenSolveResidualNorm()
Definition: KohnShamEigenSolver.t.cpp:694
const OpContext * d_MLanczos
Definition: KohnShamEigenSolver.h:196
bool d_setChebyPolDegExternally
Definition: KohnShamEigenSolver.h:208
std::shared_ptr< linearAlgebra::MultiVector< ValueType, memorySpace > > d_MXBatch
Definition: KohnShamEigenSolver.h:225
linearAlgebra::MultiVector< ValueType, memorySpace > & getOrthogonalizedFilteredSubspace()
Definition: KohnShamEigenSolver.t.cpp:730
std::vector< RealType > d_fracOccupancy
Definition: KohnShamEigenSolver.h:198
RealType d_fermiEnergy
Definition: KohnShamEigenSolver.h:200
linearAlgebra::Vector< ValueTypeOperand, memorySpace > * d_lanczosGuess
Definition: KohnShamEigenSolver.h:195
std::vector< RealType > d_eigSolveResNorm
Definition: KohnShamEigenSolver.h:199
~KohnShamEigenSolver()=default
Default Destructor.
std::shared_ptr< linearAlgebra::MultiVector< ValueType, memorySpace > > d_waveFnBatch
Definition: KohnShamEigenSolver.h:225
double d_wantedSpectrumLowerBound
Definition: KohnShamEigenSolver.h:204
void reinitBasis(linearAlgebra::MultiVector< ValueTypeOperand, memorySpace > &waveFunctionSubspaceGuess, linearAlgebra::Vector< ValueTypeOperand, memorySpace > &lanczosGuess, const OpContext &MLanczos=linearAlgebra::IdentityOperatorContext< ValueTypeOperator, ValueTypeOperand, memorySpace >(), const OpContext &MInvLanczos=linearAlgebra::IdentityOperatorContext< ValueTypeOperator, ValueTypeOperand, memorySpace >())
Definition: KohnShamEigenSolver.t.cpp:103
void reinitBounds(double wantedSpectrumLowerBound, double wantedSpectrumUpperBound)
Definition: KohnShamEigenSolver.t.cpp:169
void setChebyPolyScalingFactor(double scalingFactor)
Definition: KohnShamEigenSolver.t.cpp:183
size_type d_numWantedEigenvalues
Definition: KohnShamEigenSolver.h:191
utils::Profiler d_p
Definition: KohnShamEigenSolver.h:219
double d_chebyPolyScalingFactor
Definition: KohnShamEigenSolver.h:207
size_type d_waveFunctionBatchSize
Definition: KohnShamEigenSolver.h:192
bool d_isResidualChebyFilter
Definition: KohnShamEigenSolver.h:220
linearAlgebra::MultiVector< ValueType, memorySpace > * d_filteredSubspace
Definition: KohnShamEigenSolver.h:218
typename linearAlgebra::HermitianIterativeEigenSolver< ValueTypeOperator, ValueTypeOperand, memorySpace >::RealType RealType
Definition: KohnShamEigenSolver.h:76
std::vector< double > getLinearEigenSolveResidual(const OpContext &kohnShamOperator, const linearAlgebra::MultiVector< ValueType, memorySpace > &kohnShamWaveFunctions, const OpContext &M)
Definition: KohnShamEigenSolver.t.cpp:574
const bool d_storeIntermediateSubspaces
Definition: KohnShamEigenSolver.h:221
double d_fracOccupancyTolerance
Definition: KohnShamEigenSolver.h:187
size_type d_chebyshevPolynomialDegree
Definition: KohnShamEigenSolver.h:190
std::shared_ptr< linearAlgebra::MultiVector< ValueType, memorySpace > > d_waveFnBatchSmall
Definition: KohnShamEigenSolver.h:225
std::vector< RealType > getFractionalOccupancy()
Definition: KohnShamEigenSolver.t.cpp:561
linearAlgebra::MultiVector< ValueTypeOperand, memorySpace > * d_waveFunctionSubspaceGuess
Definition: KohnShamEigenSolver.h:194
double d_fermiEnergyTolerance
Definition: KohnShamEigenSolver.h:186
size_type d_batchSizeSmall
Definition: KohnShamEigenSolver.h:223
linearAlgebra::MultiVector< ValueType, memorySpace > * d_filteredSubspaceOrtho
Definition: KohnShamEigenSolver.h:217
double d_wantedSpectrumUpperBound
Definition: KohnShamEigenSolver.h:205
utils::MemoryStorage< ValueType, memorySpace > d_nOnes
Definition: KohnShamEigenSolver.h:228
A derived class of OperatorContext to encapsulate the action of a discrete operator on vectors,...
Definition: ChebyshevFilteredEigenSolver.h:70
Manager class for ELPA and ScaLAPACK.
Definition: ElpaScalapackManager.h:43
Abstract class to encapsulate the action of a discrete operator on vectors, matrices,...
Definition: IdentityOperatorContext.h:53
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
Provides an interface to print based on whether a certain condition is met or not....
Definition: ConditionalOStream.h:47
Definition: MemoryStorage.h:38
Definition: Profiler.h:44
OrthogonalizationType
Definition: ChebyshevFilteredEigenSolver.h:46
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
unsigned int size_type
Definition: TypeConfig.h:8
Definition: LinearAlgebraTypes.h:147