DFT-EFE
 
Loading...
Searching...
No Matches
FractionalOccupancyFunction.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 dftefeFractionalOccupancyFunction_h
27#define dftefeFractionalOccupancyFunction_h
28
32
33namespace dftefe
34{
35 namespace ksdft
36 {
37 double
38 fermiDirac(const double eigenValue,
39 const double fermiEnergy,
40 const double kb,
41 const double T);
42
43 double
44 fermiDiracDer(const double eigenValue,
45 const double fermiEnergy,
46 const double kb,
47 const double T);
48
52 {
53 public:
57 FractionalOccupancyFunction(const std::vector<double> &eigenValues,
58 const size_type numElectrons,
59 const double kb,
60 const double T,
61 const double initialGuess);
62
64
65 const double
66 getValue(double &x) const override;
67
68 const double
69 getForce(double &x) const override;
70
71 void
72 setSolution(const double &x) override;
73
74 void
75 getSolution(double &solution) override;
76
77 const double &
78 getInitialGuess() const override;
79
80 const double
81 getLowerBound() const override;
82
83 const double
84 getUpperBound() const override;
85
86 private:
87 // Computes d_lowerBound/d_upperBound: starts from
88 // [min(d_eigenValues), max(d_eigenValues)] and, if that does not
89 // already bracket a root of getValue(), expands both ends outward
90 // by the bracket's own width and rechecks - repeated up to 1000
91 // times before giving up (throws otherwise). This bracket
92 // construction is only valid because getValue() (a sum of
93 // Fermi-Dirac sigmoids) is strictly monotonic in x - a property
94 // specific to this function, not something the generic
95 // BisectionSolver can assume for an arbitrary BisectionSolverFunction,
96 // which is why this lives here rather than there.
97 void
99
100 double d_x;
102 std::vector<double> d_eigenValues;
104 double d_kb;
105 double d_T;
108
109 }; // end of class FractionalOccupancyFunction
110 } // end of namespace ksdft
111} // end of namespace dftefe
112#endif // dftefeFractionalOccupancyFunction_h
Definition: FractionalOccupancyFunction.h:52
const double getUpperBound() const override
Upper end of the bracketing interval. See getLowerBound().
Definition: FractionalOccupancyFunction.cpp:166
double d_initialGuess
Definition: FractionalOccupancyFunction.h:101
const double & getInitialGuess() const override
Definition: FractionalOccupancyFunction.cpp:149
const double getForce(double &x) const override
Definition: FractionalOccupancyFunction.cpp:125
void setSolution(const double &x) override
Definition: FractionalOccupancyFunction.cpp:137
std::vector< double > d_eigenValues
Definition: FractionalOccupancyFunction.h:102
void getSolution(double &solution) override
Definition: FractionalOccupancyFunction.cpp:143
double d_kb
Definition: FractionalOccupancyFunction.h:104
const double getLowerBound() const override
Lower end of an interval known to bracket the root, i.e. getValue(getLowerBound()) and getValue(getUp...
Definition: FractionalOccupancyFunction.cpp:160
double d_x
Definition: FractionalOccupancyFunction.h:100
double d_T
Definition: FractionalOccupancyFunction.h:105
void computeBracket()
Definition: FractionalOccupancyFunction.cpp:58
const double getValue(double &x) const override
Definition: FractionalOccupancyFunction.cpp:112
size_type d_numElectrons
Definition: FractionalOccupancyFunction.h:103
double d_upperBound
Definition: FractionalOccupancyFunction.h:107
double d_lowerBound
Definition: FractionalOccupancyFunction.h:106
Interface a class must implement to have its root found by BisectionSolver. Unlike NewtonRaphsonSolve...
Definition: BisectionSolverFunction.h:45
Definition: NewtonRaphsonSolverFunction.h:38
double fermiDirac(const double eigenValue, const double fermiEnergy, const double kb, const double T)
Definition: FractionalOccupancyFunction.cpp:14
double fermiDiracDer(const double eigenValue, const double fermiEnergy, const double kb, const double T)
Definition: FractionalOccupancyFunction.cpp:25
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
std::uint64_t size_type
Definition: TypeConfig.h:9