DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
ExcSSDFunctionalBaseClass.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (c) 2017-2025 The Regents of the University of Michigan and DFT-FE
4// authors.
5//
6// This file is part of the DFT-FE code.
7//
8// The DFT-FE code is free software; you can use it, redistribute
9// it, and/or modify it under the terms of the GNU Lesser General
10// Public License as published by the Free Software Foundation; either
11// version 2.1 of the License, or (at your option) any later version.
12// The full text of the license can be found in the file LICENSE at
13// the top level of the DFT-FE distribution.
14//
15// ---------------------------------------------------------------------
16//
17
18#ifndef DFTFE_EXCSSDFUNCTIONALBASECLASS_H
19#define DFTFE_EXCSSDFUNCTIONALBASECLASS_H
20
21#include "AuxDensityMatrix.h"
22#include <vector>
23#include <fstream>
24#include <iostream>
25namespace dftfe
26{
27 enum class ExcFamilyType
28 {
29 /*
30 LLMGGA: Includes only Laplacian of the electron-density
31 TauMGGA: Includes only kinetic energy density
32 MGGA: Includes both the Laplacian of the electron-density and kinetic energy
33 density
34 */
42 };
43
45 {
49 };
50
51
52 /*
53 * XC attributes for the derivatives for the remainder functional
54 *
55 */
56
58 {
59 e, // energy density per unit volume for the remainder functional
60 vSpinUp, // the local multiplicative potential for spin up arising from
61 // remainder functional
62 vSpinDown, // the local multiplicative potential for spin down arising from
63 // remainder functional
71 };
72
73
74
75 /**
76 * @brief This class provides the structure for all
77 * Exc functionals that can be written as a combination of
78 * functional of Single Slater determinant that results in a
79 * non-multiplicative potential plus a remainder functional
80 * dependent on density and Tau.
81 *
82 * Exc = S{\phi} + R [\rho, \tau]
83 * @author Vishal Subramanian, Sambit Das
84 */
85 template <dftfe::utils::MemorySpace memorySpace>
87 {
88 public:
90 const densityFamilyType densityFamType,
91 const std::vector<DensityDescriptorDataAttributes>
92 &densityDescriptorAttributesList);
94 const densityFamilyType densityFamType,
95 const std::vector<DensityDescriptorDataAttributes>
96 &densityDescriptorAttributesList,
97 const std::vector<WfcDescriptorDataAttributes>
98 &wfcDescriptorAttributesList);
99
101
102 const std::vector<DensityDescriptorDataAttributes> &
104
107
108
109 /*
110 * @brief The apply function that will be called in HX().
111 * The distribute() and updateGhostValues() for src
112 * has to be called before this function.
113 * Similarly for dst, accumulateLocallyOwned() should be called in HX()
114 * after this function is called. param[in] src The input vector param[out]
115 * dst The output vector param[in] inputVecSize The size of the input vector
116 * param[in] kPointIndex the k point for which the HX() is called
117 * param[in] spinIndex the spin index for which the HX() is called
118 */
119 virtual void
122 &src,
124 const dftfe::uInt inputVecSize,
125 const dftfe::uInt kPointIndex,
126 const dftfe::uInt spinIndex) = 0;
127
128 /*
129 * @brief The apply function that will be called in HXCheby() with single precision.
130 * The distribute() and updateGhostValues() for src
131 * has to be called before this function.
132 * Similarly for dst, accumulateLocallyOwned() should be called in HX()
133 * after this function is called. param[in] src The input vector param[out]
134 * dst The output vector param[in] inputVecSize The size of the input vector
135 * param[in] kPointIndex the k point for which the HX() is called
136 * param[in] spinIndex the spin index for which the HX() is called
137 */
138 virtual void
141 memorySpace> &src,
143 &dst,
144 const dftfe::uInt inputVecSize,
145 const dftfe::uInt kPointIndex,
146 const dftfe::uInt spinIndex) = 0;
147
148 /*
149 * @brief The function that updates the Wave function dependent part
150 * of the Exc functional and its derivative wrt \psi
151 */
152 virtual void
154 const std::shared_ptr<AuxDensityMatrix<memorySpace>> &auxDensityMatrixPtr,
155 const std::vector<double> &kPointWeights) = 0;
156
157
158 /*
159 * @brief The function that computes the Wave function dependent part
160 * of the Exc functional energy
161 */
162 virtual void
164 const std::shared_ptr<AuxDensityMatrix<memorySpace>> &auxDensityMatrix,
165 const std::vector<double> &kPointWeights) = 0;
166
167 /*
168 * @brief Returns the Wavefunction dependent part of the Exc energy.
169 */
170 virtual double
172
173 /*
174 * @brief Returns the Expectation value of the WaveFunctionDependentExcFuncDerWrtPsi
175 * While using band energy approach to compute the total free energy
176 * the expectation of the WaveFunctionDependentExcFuncDerWrtPsi is included
177 * in the band energy. Hence it has to be subtracted and the correct energy
178 * has to be added to the free energy.
179 */
180 virtual double
182
183
184
185 /**
186 * x and c denotes exchange and correlation respectively.
187 * This function computes the rho and tau dependent part of
188 * the Exc functional energy density and its partial derivatives
189 */
190 virtual void
192 AuxDensityMatrix<memorySpace> &auxDensityMatrix,
193 const std::pair<dftfe::uInt, dftfe::uInt> &quadIndexRange,
194 std::unordered_map<xcRemainderOutputDataAttributes, std::vector<double>>
195 &xDataOut,
196 std::unordered_map<xcRemainderOutputDataAttributes, std::vector<double>>
197 &cDataout) const = 0;
198
199
201 getExcFamilyType() const;
202
203 virtual void
205 const std::vector<xcRemainderOutputDataAttributes> &outputDataAttributes)
206 const = 0;
207
208 virtual void
210
211 protected:
212 const std::vector<DensityDescriptorDataAttributes>
214
215 const std::vector<WfcDescriptorDataAttributes>
217
220 };
221} // namespace dftfe
222
224#endif // DFTFE_EXCSSDFUNCTIONALBASECLASS_H
Definition AuxDensityMatrix.h:40
const std::vector< WfcDescriptorDataAttributes > d_wfcDescriptorAttributesList
Definition ExcSSDFunctionalBaseClass.h:216
virtual void computeWaveFunctionDependentExcEnergy(const std::shared_ptr< AuxDensityMatrix< memorySpace > > &auxDensityMatrix, const std::vector< double > &kPointWeights)=0
densityFamilyType getDensityBasedFamilyType() const
Definition ExcSSDFunctionalBaseClass.t.cc:61
virtual void computeRhoTauDependentXCData(AuxDensityMatrix< memorySpace > &auxDensityMatrix, const std::pair< dftfe::uInt, dftfe::uInt > &quadIndexRange, std::unordered_map< xcRemainderOutputDataAttributes, std::vector< double > > &xDataOut, std::unordered_map< xcRemainderOutputDataAttributes, std::vector< double > > &cDataout) const =0
virtual double getWaveFunctionDependentExcEnergy()=0
ExcSSDFunctionalBaseClass(const ExcFamilyType excFamType, const densityFamilyType densityFamType, const std::vector< DensityDescriptorDataAttributes > &densityDescriptorAttributesList)
Definition ExcSSDFunctionalBaseClass.t.cc:25
virtual void updateWaveFunctionDependentFuncDerWrtPsi(const std::shared_ptr< AuxDensityMatrix< memorySpace > > &auxDensityMatrixPtr, const std::vector< double > &kPointWeights)=0
virtual double getExpectationOfWaveFunctionDependentExcFuncDerWrtPsi()=0
virtual void checkInputOutputDataAttributesConsistency(const std::vector< xcRemainderOutputDataAttributes > &outputDataAttributes) const =0
virtual ~ExcSSDFunctionalBaseClass()
Definition ExcSSDFunctionalBaseClass.t.cc:49
virtual void applyWaveFunctionDependentFuncDerWrtPsi(const dftfe::linearAlgebra::MultiVector< dataTypes::number, memorySpace > &src, dftfe::linearAlgebra::MultiVector< dataTypes::number, memorySpace > &dst, const dftfe::uInt inputVecSize, const dftfe::uInt kPointIndex, const dftfe::uInt spinIndex)=0
virtual void applyWaveFunctionDependentFuncDerWrtPsi(const dftfe::linearAlgebra::MultiVector< dataTypes::numberFP32, memorySpace > &src, dftfe::linearAlgebra::MultiVector< dataTypes::numberFP32, memorySpace > &dst, const dftfe::uInt inputVecSize, const dftfe::uInt kPointIndex, const dftfe::uInt spinIndex)=0
virtual void reinitKPointDependentVariables(dftfe::uInt kPointIndex)=0
ExcFamilyType getExcFamilyType() const
Definition ExcSSDFunctionalBaseClass.t.cc:54
densityFamilyType d_densityFamilyType
Definition ExcSSDFunctionalBaseClass.h:219
ExcFamilyType d_ExcFamilyType
Definition ExcSSDFunctionalBaseClass.h:218
const std::vector< DensityDescriptorDataAttributes > d_densityDescriptorAttributesList
Definition ExcSSDFunctionalBaseClass.h:213
const std::vector< DensityDescriptorDataAttributes > & getDensityDescriptorAttributesList() const
Definition ExcSSDFunctionalBaseClass.t.cc:68
An class template to encapsulate a MultiVector. A MultiVector is a collection of vectors belonging t...
Definition MultiVector.h:127
float numberFP32
Definition dftfeDataTypes.h:43
Definition pseudoPotentialToDftfeConverter.cc:34
xcRemainderOutputDataAttributes
Definition ExcSSDFunctionalBaseClass.h:58
@ pdeLaplacianSpinDown
Definition ExcSSDFunctionalBaseClass.h:68
@ pdeSigma
Definition ExcSSDFunctionalBaseClass.h:66
@ pdeLaplacianSpinUp
Definition ExcSSDFunctionalBaseClass.h:67
@ vSpinUp
Definition ExcSSDFunctionalBaseClass.h:60
@ vSpinDown
Definition ExcSSDFunctionalBaseClass.h:62
@ pdeDensitySpinDown
Definition ExcSSDFunctionalBaseClass.h:65
@ pdeDensitySpinUp
Definition ExcSSDFunctionalBaseClass.h:64
@ pdeTauSpinUp
Definition ExcSSDFunctionalBaseClass.h:69
@ e
Definition ExcSSDFunctionalBaseClass.h:59
@ pdeTauSpinDown
Definition ExcSSDFunctionalBaseClass.h:70
std::uint32_t uInt
Definition TypeConfig.h:10
densityFamilyType
Definition ExcSSDFunctionalBaseClass.h:45
ExcFamilyType
Definition ExcSSDFunctionalBaseClass.h:28
@ DFTPlusU
Definition ExcSSDFunctionalBaseClass.h:39
@ HYBRID
Definition ExcSSDFunctionalBaseClass.h:38
@ GGA
Definition ExcSSDFunctionalBaseClass.h:36
@ MGGA
Definition ExcSSDFunctionalBaseClass.h:40
@ LDA
Definition ExcSSDFunctionalBaseClass.h:35
@ LLMGGA
Definition ExcSSDFunctionalBaseClass.h:37
@ TauMGGA
Definition ExcSSDFunctionalBaseClass.h:41