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{
36
38 {
42 };
43
44
45 /*
46 * XC attributes for the derivatives for the remainder functional
47 *
48 */
49
51 {
52 e, // energy density per unit volume for the remainder functional
53 vSpinUp, // the local multiplicative potential for spin up arising from
54 // remainder functional
55 vSpinDown, // the local multiplicative potential for spin down arising from
56 // remainder functional
64 };
65
66
67
68 /**
69 * @brief This class provides the structure for all
70 * Exc functionals that can be written as a combination of
71 * functional of Single Slater determinant that results in a
72 * non-multiplicative potential plus a remainder functional
73 * dependent on density and Tau.
74 *
75 * Exc = S{\phi} + R [\rho, \tau]
76 * @author Vishal Subramanian, Sambit Das
77 */
78 template <dftfe::utils::MemorySpace memorySpace>
80 {
81 public:
83 const densityFamilyType densityFamType,
84 const std::vector<DensityDescriptorDataAttributes>
85 &densityDescriptorAttributesList);
86
88
89 const std::vector<DensityDescriptorDataAttributes> &
91
94
95
96 /*
97 * @brief The apply function that will be called in HX().
98 * The distribute() and updateGhostValues() for src
99 * has to be called before this function.
100 * Similarly for dst, accumulateLocallyOwned() should be called in HX()
101 * after this function is called. param[in] src The input vector param[out]
102 * dst The output vector param[in] inputVecSize The size of the input vector
103 * param[in] kPointIndex the k point for which the HX() is called
104 * param[in] spinIndex the spin index for which the HX() is called
105 */
106 virtual void
109 & src,
111 const unsigned int inputVecSize,
112 const unsigned int kPointIndex,
113 const unsigned int spinIndex) = 0;
114
115 /*
116 * @brief The apply function that will be called in HXCheby() with single precision.
117 * The distribute() and updateGhostValues() for src
118 * has to be called before this function.
119 * Similarly for dst, accumulateLocallyOwned() should be called in HX()
120 * after this function is called. param[in] src The input vector param[out]
121 * dst The output vector param[in] inputVecSize The size of the input vector
122 * param[in] kPointIndex the k point for which the HX() is called
123 * param[in] spinIndex the spin index for which the HX() is called
124 */
125 virtual void
128 memorySpace> &src,
130 & dst,
131 const unsigned int inputVecSize,
132 const unsigned int kPointIndex,
133 const unsigned int spinIndex) = 0;
134
135 /*
136 * @brief The function that updates the Wave function dependent part
137 * of the Exc functional and its derivative wrt \psi
138 */
139 virtual void
141 const std::shared_ptr<AuxDensityMatrix<memorySpace>> &auxDensityMatrixPtr,
142 const std::vector<double> & kPointWeights) = 0;
143
144
145 /*
146 * @brief The function that computes the Wave function dependent part
147 * of the Exc functional energy
148 */
149 virtual void
151 const std::shared_ptr<AuxDensityMatrix<memorySpace>> &auxDensityMatrix,
152 const std::vector<double> & kPointWeights) = 0;
153
154 /*
155 * @brief Returns the Wavefunction dependent part of the Exc energy.
156 */
157 virtual double
159
160 /*
161 * @brief Returns the Expectation value of the WaveFunctionDependentExcFuncDerWrtPsi
162 * While using band energy approach to compute the total free energy
163 * the expectation of the WaveFunctionDependentExcFuncDerWrtPsi is included
164 * in the band energy. Hence it has to be subtracted and the correct energy
165 * has to be added to the free energy.
166 */
167 virtual double
169
170 /**
171 * x and c denotes exchange and correlation respectively.
172 * This function computes the rho and tau dependent part of
173 * the Exc functional energy density and its partial derivatives
174 */
175 virtual void
177 AuxDensityMatrix<memorySpace> &auxDensityMatrix,
178 const std::vector<double> & quadPoints,
179 std::unordered_map<xcRemainderOutputDataAttributes, std::vector<double>>
180 &xDataOut,
181 std::unordered_map<xcRemainderOutputDataAttributes, std::vector<double>>
182 &cDataout) const = 0;
183
185 getExcFamilyType() const;
186
187 virtual void
189 const std::vector<xcRemainderOutputDataAttributes> &outputDataAttributes)
190 const = 0;
191
192 virtual void
193 reinitKPointDependentVariables(unsigned int kPointIndex) = 0;
194
195 protected:
196 const std::vector<DensityDescriptorDataAttributes>
198
201 };
202} // namespace dftfe
203
205#endif // DFTFE_EXCSSDFUNCTIONALBASECLASS_H
Definition AuxDensityMatrix.h:33
virtual void applyWaveFunctionDependentFuncDerWrtPsi(const dftfe::linearAlgebra::MultiVector< dataTypes::numberFP32, memorySpace > &src, dftfe::linearAlgebra::MultiVector< dataTypes::numberFP32, memorySpace > &dst, const unsigned int inputVecSize, const unsigned int kPointIndex, const unsigned int spinIndex)=0
virtual void computeWaveFunctionDependentExcEnergy(const std::shared_ptr< AuxDensityMatrix< memorySpace > > &auxDensityMatrix, const std::vector< double > &kPointWeights)=0
densityFamilyType getDensityBasedFamilyType() const
Definition ExcSSDFunctionalBaseClass.t.cc:48
virtual double getWaveFunctionDependentExcEnergy()=0
ExcSSDFunctionalBaseClass(const ExcFamilyType excFamType, const densityFamilyType densityFamType, const std::vector< DensityDescriptorDataAttributes > &densityDescriptorAttributesList)
Definition ExcSSDFunctionalBaseClass.t.cc:25
virtual void reinitKPointDependentVariables(unsigned int kPointIndex)=0
virtual void updateWaveFunctionDependentFuncDerWrtPsi(const std::shared_ptr< AuxDensityMatrix< memorySpace > > &auxDensityMatrixPtr, const std::vector< double > &kPointWeights)=0
virtual void computeRhoTauDependentXCData(AuxDensityMatrix< memorySpace > &auxDensityMatrix, const std::vector< double > &quadPoints, std::unordered_map< xcRemainderOutputDataAttributes, std::vector< double > > &xDataOut, std::unordered_map< xcRemainderOutputDataAttributes, std::vector< double > > &cDataout) const =0
virtual double getExpectationOfWaveFunctionDependentExcFuncDerWrtPsi()=0
virtual void checkInputOutputDataAttributesConsistency(const std::vector< xcRemainderOutputDataAttributes > &outputDataAttributes) const =0
virtual ~ExcSSDFunctionalBaseClass()
Definition ExcSSDFunctionalBaseClass.t.cc:36
virtual void applyWaveFunctionDependentFuncDerWrtPsi(const dftfe::linearAlgebra::MultiVector< dataTypes::number, memorySpace > &src, dftfe::linearAlgebra::MultiVector< dataTypes::number, memorySpace > &dst, const unsigned int inputVecSize, const unsigned int kPointIndex, const unsigned int spinIndex)=0
ExcFamilyType getExcFamilyType() const
Definition ExcSSDFunctionalBaseClass.t.cc:41
densityFamilyType d_densityFamilyType
Definition ExcSSDFunctionalBaseClass.h:200
ExcFamilyType d_ExcFamilyType
Definition ExcSSDFunctionalBaseClass.h:199
const std::vector< DensityDescriptorDataAttributes > d_densityDescriptorAttributesList
Definition ExcSSDFunctionalBaseClass.h:197
const std::vector< DensityDescriptorDataAttributes > & getDensityDescriptorAttributesList() const
Definition ExcSSDFunctionalBaseClass.t.cc:55
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:45
Definition pseudoPotentialToDftfeConverter.cc:34
xcRemainderOutputDataAttributes
Definition ExcSSDFunctionalBaseClass.h:51
@ pdeLaplacianSpinDown
Definition ExcSSDFunctionalBaseClass.h:61
@ pdeSigma
Definition ExcSSDFunctionalBaseClass.h:59
@ pdeLaplacianSpinUp
Definition ExcSSDFunctionalBaseClass.h:60
@ vSpinUp
Definition ExcSSDFunctionalBaseClass.h:53
@ vSpinDown
Definition ExcSSDFunctionalBaseClass.h:55
@ pdeDensitySpinDown
Definition ExcSSDFunctionalBaseClass.h:58
@ pdeDensitySpinUp
Definition ExcSSDFunctionalBaseClass.h:57
@ pdeTauSpinUp
Definition ExcSSDFunctionalBaseClass.h:62
@ e
Definition ExcSSDFunctionalBaseClass.h:52
@ pdeTauSpinDown
Definition ExcSSDFunctionalBaseClass.h:63
densityFamilyType
Definition ExcSSDFunctionalBaseClass.h:38
ExcFamilyType
Definition ExcSSDFunctionalBaseClass.h:28
@ DFTPlusU
Definition ExcSSDFunctionalBaseClass.h:33
@ HYBRID
Definition ExcSSDFunctionalBaseClass.h:32
@ GGA
Definition ExcSSDFunctionalBaseClass.h:30
@ MGGA
Definition ExcSSDFunctionalBaseClass.h:34
@ LDA
Definition ExcSSDFunctionalBaseClass.h:29
@ LLMGGA
Definition ExcSSDFunctionalBaseClass.h:31