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
35#include <memory>
37
38namespace dftefe
39{
40 namespace ksdft
41 {
52 template <typename ValueTypeOperator,
53 typename ValueTypeOperand,
54 utils::MemorySpace memorySpace>
56 : public linearAlgebra::HermitianIterativeEigenSolver<ValueTypeOperator,
57 ValueTypeOperand,
58 memorySpace>
59 {
60 public:
67 using ValueType = typename linearAlgebra::HermitianIterativeEigenSolver<
68 ValueTypeOperator,
69 ValueTypeOperand,
70 memorySpace>::ValueType;
71 using RealType = typename linearAlgebra::HermitianIterativeEigenSolver<
72 ValueTypeOperator,
73 ValueTypeOperand,
74 memorySpace>::RealType;
75 using OpContext = typename linearAlgebra::HermitianIterativeEigenSolver<
76 ValueTypeOperator,
77 ValueTypeOperand,
78 memorySpace>::OpContext;
79
80 public:
88 const size_type numElectrons,
89 const double smearingTemperature,
90 const double fermiEnergyTolerance,
91 const double fracOccupancyTolerance,
92 const double eigenSolveResidualTolerance,
93 const size_type maxChebyshevFilterPass,
95 &waveFunctionSubspaceGuess,
97 const size_type waveFunctionBlockSize = 0,
98 const OpContext &MLanczos =
100 ValueTypeOperand,
101 memorySpace>(),
102 const OpContext &MInvLanczos =
104 ValueTypeOperand,
105 memorySpace>());
106
112
113 void
116 &waveFunctionSubspaceGuess,
118 const OpContext & MLanczos =
120 ValueTypeOperand,
121 memorySpace>(),
122 const OpContext &MInvLanczos =
124 ValueTypeOperand,
125 memorySpace>());
126
127 void
128 reinitBounds(double wantedSpectrumLowerBound,
129 double wantedSpectrumUpperBound);
130
133
134 std::vector<RealType>
136
137 std::vector<RealType>
139
141 solve(const OpContext & kohnShamOperator,
142 std::vector<RealType> &kohnShamEnergies,
144 & kohnShamWaveFunctions,
145 bool computeWaveFunctions = false,
146 const OpContext &M =
148 ValueTypeOperand,
149 memorySpace>(),
150 const OpContext &MInv =
152 ValueTypeOperand,
153 memorySpace>()) override;
154
157
160
161 private:
175 std::vector<RealType> d_fracOccupancy;
176 std::vector<RealType> d_eigSolveResNorm;
184
188
189 }; // end of class KohnShamEigenSolver
190 } // namespace ksdft
191} // end of namespace dftefe
193#endif // dftefeKohnShamEigenSolver_h
Definition: KohnShamEigenSolver.h:59
RealType getFermiEnergy()
Definition: KohnShamEigenSolver.t.cpp:454
typename linearAlgebra::HermitianIterativeEigenSolver< ValueTypeOperator, ValueTypeOperand, memorySpace >::OpContext OpContext
Definition: KohnShamEigenSolver.h:78
bool d_isSolved
Definition: KohnShamEigenSolver.h:178
typename linearAlgebra::HermitianIterativeEigenSolver< ValueTypeOperator, ValueTypeOperand, memorySpace >::ValueType ValueType
define ValueType as the superior (bigger set) of the ValueTypeOperator and ValueTypeOperand (e....
Definition: KohnShamEigenSolver.h:70
size_type d_maxChebyshevFilterPass
Definition: KohnShamEigenSolver.h:166
double d_eigenSolveResidualTolerance
Definition: KohnShamEigenSolver.h:165
const size_type d_numElectrons
Definition: KohnShamEigenSolver.h:179
double d_smearingTemperature
Definition: KohnShamEigenSolver.h:162
bool d_isBoundKnown
Definition: KohnShamEigenSolver.h:183
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:127
const OpContext * d_MInvLanczos
Definition: KohnShamEigenSolver.h:174
utils::ConditionalOStream d_rootCout
Definition: KohnShamEigenSolver.h:180
linearAlgebra::MultiVector< ValueType, memorySpace > & getFilteredSubspace()
Definition: KohnShamEigenSolver.t.cpp:504
std::vector< RealType > getEigenSolveResidualNorm()
Definition: KohnShamEigenSolver.t.cpp:486
const OpContext * d_MLanczos
Definition: KohnShamEigenSolver.h:173
linearAlgebra::MultiVector< ValueType, memorySpace > & getOrthogonalizedFilteredSubspace()
Definition: KohnShamEigenSolver.t.cpp:522
std::vector< RealType > d_fracOccupancy
Definition: KohnShamEigenSolver.h:175
RealType d_fermiEnergy
Definition: KohnShamEigenSolver.h:177
linearAlgebra::Vector< ValueTypeOperand, memorySpace > * d_lanczosGuess
Definition: KohnShamEigenSolver.h:172
size_type d_waveFunctionBlockSize
Definition: KohnShamEigenSolver.h:169
std::vector< RealType > d_eigSolveResNorm
Definition: KohnShamEigenSolver.h:176
~KohnShamEigenSolver()=default
Default Destructor.
double d_wantedSpectrumLowerBound
Definition: KohnShamEigenSolver.h:181
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:89
void reinitBounds(double wantedSpectrumLowerBound, double wantedSpectrumUpperBound)
Definition: KohnShamEigenSolver.t.cpp:113
size_type d_numWantedEigenvalues
Definition: KohnShamEigenSolver.h:168
linearAlgebra::MultiVector< ValueType, memorySpace > * d_filteredSubspace
Definition: KohnShamEigenSolver.h:187
typename linearAlgebra::HermitianIterativeEigenSolver< ValueTypeOperator, ValueTypeOperand, memorySpace >::RealType RealType
Definition: KohnShamEigenSolver.h:74
double d_fracOccupancyTolerance
Definition: KohnShamEigenSolver.h:164
size_type d_chebyshevPolynomialDegree
Definition: KohnShamEigenSolver.h:167
std::vector< RealType > getFractionalOccupancy()
Definition: KohnShamEigenSolver.t.cpp:470
linearAlgebra::MultiVector< ValueTypeOperand, memorySpace > * d_waveFunctionSubspaceGuess
Definition: KohnShamEigenSolver.h:171
double d_fermiEnergyTolerance
Definition: KohnShamEigenSolver.h:163
linearAlgebra::MultiVector< ValueType, memorySpace > * d_filteredSubspaceOrtho
Definition: KohnShamEigenSolver.h:186
double d_wantedSpectrumUpperBound
Definition: KohnShamEigenSolver.h:182
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:45
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
unsigned int size_type
Definition: TypeConfig.h:8
Definition: LinearAlgebraTypes.h:127