DFT-EFE
 
Loading...
Searching...
No Matches
ElectrostaticLocalFE.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 dftefeElectrostaticLocalFE_h
27#define dftefeElectrostaticLocalFE_h
28
39
40namespace dftefe
41{
42 namespace ksdft
43 {
44 template <typename ValueTypeBasisData,
45 typename ValueTypeBasisCoeff,
46 typename ValueTypeWaveFnBasisData,
47 utils::MemorySpace memorySpace,
48 size_type dim>
50 : public ElectrostaticFE<ValueTypeBasisData,
51 ValueTypeBasisCoeff,
52 ValueTypeWaveFnBasisData,
53 memorySpace,
54 dim>
55 {
56 public:
57 using ValueType = typename ElectrostaticFE<ValueTypeBasisData,
58 ValueTypeBasisCoeff,
59 ValueTypeWaveFnBasisData,
60 memorySpace,
61 dim>::ValueType;
62 using Storage = typename ElectrostaticFE<ValueTypeBasisData,
63 ValueTypeBasisCoeff,
64 ValueTypeWaveFnBasisData,
65 memorySpace,
66 dim>::Storage;
67 using RealType = typename ElectrostaticFE<ValueTypeBasisData,
68 ValueTypeBasisCoeff,
69 ValueTypeWaveFnBasisData,
70 memorySpace,
71 dim>::RealType;
72
73 public:
78 std::vector<utils::Point> atomCoordinates,
79 std::vector<double> atomCharges,
80 std::vector<double> smearedChargeRadius,
82 & electronChargeDensity,
83 std::shared_ptr<const basis::FEBasisManager<ValueTypeBasisCoeff,
84 ValueTypeBasisData,
85 memorySpace,
86 dim>> feBMTotalCharge,
87 std::shared_ptr<
89 feBDTotalChargeStiffnessMatrix,
90 std::shared_ptr<
92 feBDTotalChargeRhs,
93 std::shared_ptr<
94 const basis::FEBasisDataStorage<ValueTypeWaveFnBasisData,
95 memorySpace>> feBDHamiltonian,
96 const utils::ScalarSpatialFunctionReal &externalPotentialFunction,
98 linAlgOpContext,
99 const size_type maxCellTimesNumVecs);
100
102 std::vector<utils::Point> atomCoordinates,
103 std::vector<double> atomCharges,
104 std::vector<double> smearedChargeRadius,
106 & electronChargeDensity,
107 std::shared_ptr<const basis::FEBasisManager<ValueTypeBasisCoeff,
108 ValueTypeBasisData,
109 memorySpace,
110 dim>> feBMTotalCharge,
111 std::shared_ptr<
113 feBDTotalChargeStiffnessMatrix,
114 std::shared_ptr<
116 feBDTotalChargeRhs,
117 std::shared_ptr<
119 feBDNuclearChargeStiffnessMatrix,
120 std::shared_ptr<
122 feBDNuclearChargeRhs,
123 std::shared_ptr<
124 const basis::FEBasisDataStorage<ValueTypeWaveFnBasisData,
125 memorySpace>> feBDHamiltonian,
126 const utils::ScalarSpatialFunctionReal &externalPotentialFunction,
128 linAlgOpContext,
129 const size_type maxCellTimesNumVecs);
130
131
133
134 void
136 std::vector<utils::Point> atomCoordinates,
137 std::shared_ptr<const basis::FEBasisManager<ValueTypeBasisCoeff,
138 ValueTypeBasisData,
139 memorySpace,
140 dim>> feBMTotalCharge,
141 std::shared_ptr<
143 feBDTotalChargeStiffnessMatrix,
144 std::shared_ptr<
146 feBDTotalChargeRhs,
147 std::shared_ptr<
148 const basis::FEBasisDataStorage<ValueTypeWaveFnBasisData,
149 memorySpace>> feBDHamiltonian);
150
151 void
153 std::vector<utils::Point> atomCoordinates,
154 std::shared_ptr<const basis::FEBasisManager<ValueTypeBasisCoeff,
155 ValueTypeBasisData,
156 memorySpace,
157 dim>> feBMTotalCharge,
158 std::shared_ptr<
160 feBDTotalChargeStiffnessMatrix,
161 std::shared_ptr<
163 feBDTotalChargeRhs,
164 std::shared_ptr<
166 feBDNuclearChargeStiffnessMatrix,
167 std::shared_ptr<
169 feBDNuclearChargeRhs,
170 std::shared_ptr<
171 const basis::FEBasisDataStorage<ValueTypeWaveFnBasisData,
172 memorySpace>> feBDHamiltonian);
173
174 void
177 &electronChargeDensity);
178
179 void
180 getLocal(Storage &cellWiseStorage) const override;
181
182 void
183 evalEnergy();
184
185 /*
186 RealType
187 getTotalChargePotentialTimesRho() const;
188 */
189
191 getEnergy() const override;
192
193 private:
194 /* Solves the nuclear potential problem, gets \sum \integral b_sm*V_sm ,
195 * gets \sum \integral V_sm * rho, \sum V_smAtRhoQuadPts
196 */
197 void
199 std::shared_ptr<
201 feBDNuclearChargeStiffnessMatrix,
202 std::shared_ptr<
204 feBDNuclearChargeRhs);
205
208 std::vector<utils::Point> d_atomCoordinates;
210 const std::vector<double> d_atomCharges;
211 const std::vector<double> d_smearedChargeRadius;
232 std::vector<linearAlgebra::MultiVector<ValueType, memorySpace> *>
234 std::vector<std::shared_ptr<basis::FEBasisManager<ValueTypeBasisCoeff,
235 ValueTypeBasisData,
236 memorySpace,
237 dim>>>
239 std::shared_ptr<const basis::FEBasisOperations<ValueTypeBasisCoeff,
240 ValueTypeBasisData,
241 memorySpace,
242 dim>>
244 std::shared_ptr<const basis::FEBasisManager<ValueTypeBasisCoeff,
245 ValueTypeBasisData,
246 memorySpace,
247 dim>>
249 std::shared_ptr<
252 std::shared_ptr<
255 std::shared_ptr<
258 std::shared_ptr<const basis::FEBasisOperations<ValueTypeBasisCoeff,
259 ValueTypeWaveFnBasisData,
260 memorySpace,
261 dim>>
263 std::shared_ptr<linearAlgebra::LinAlgOpContext<memorySpace>>
265 std::vector<RealType> d_nuclearChargeQuad;
267 std::shared_ptr<
269 ValueTypeBasisCoeff,
270 memorySpace,
271 dim>>
273 std::shared_ptr<
275 ValueTypeBasisCoeff,
276 memorySpace,
277 dim>>
279
280 }; // end of class ElectrostaticLocalFE
281 } // end of namespace ksdft
282} // end of namespace dftefe
284#endif // dftefeElectrostaticLocalFE_h
An abstract class to store and access data for a given basis, such as the basis function values on a ...
Definition: FEBasisDataStorage.h:53
An abstract class to encapsulate the partitioning of a finite element basis across multiple processor...
Definition: FEBasisManager.h:44
Definition: FEBasisOperations.h:57
A derived class of linearAlgebra::LinearSolverFunction to encapsulate the Poisson partial differentia...
Definition: PoissonLinearSolverFunctionFE.h:76
A derived class of linearAlgebra::OperatorContext to encapsulate the action of a discrete operator on...
Definition: ElectrostaticFE.h:64
Definition: ElectrostaticLocalFE.h:55
void getLocal(Storage &cellWiseStorage) const override
Definition: ElectrostaticLocalFE.t.cpp:917
void reinitBasis(std::vector< utils::Point > atomCoordinates, std::shared_ptr< const basis::FEBasisManager< ValueTypeBasisCoeff, ValueTypeBasisData, memorySpace, dim > > feBMTotalCharge, std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeBasisData, memorySpace > > feBDTotalChargeStiffnessMatrix, std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeBasisData, memorySpace > > feBDTotalChargeRhs, std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeWaveFnBasisData, memorySpace > > feBDHamiltonian)
Definition: ElectrostaticLocalFE.t.cpp:646
typename ElectrostaticFE< ValueTypeBasisData, ValueTypeBasisCoeff, ValueTypeWaveFnBasisData, memorySpace, dim >::ValueType ValueType
Definition: ElectrostaticLocalFE.h:61
RealType d_energy
Definition: ElectrostaticLocalFE.h:212
~ElectrostaticLocalFE()
Definition: ElectrostaticLocalFE.t.cpp:311
const size_type d_numAtoms
Definition: ElectrostaticLocalFE.h:209
std::vector< utils::Point > d_atomCoordinates
Definition: ElectrostaticLocalFE.h:208
void evalEnergy()
Definition: ElectrostaticLocalFE.t.cpp:1097
std::vector< linearAlgebra::MultiVector< ValueType, memorySpace > * > d_nuclearChargesPotential
Definition: ElectrostaticLocalFE.h:233
quadrature::QuadratureValuesContainer< ValueType, memorySpace > * d_totalAuxChargePotentialQuad
Definition: ElectrostaticLocalFE.h:223
std::shared_ptr< electrostatics::PoissonLinearSolverFunctionFE< ValueTypeBasisData, ValueTypeBasisCoeff, memorySpace, dim > > d_linearSolverFunction
Definition: ElectrostaticLocalFE.h:272
std::vector< RealType > d_nuclearChargeQuad
Definition: ElectrostaticLocalFE.h:265
quadrature::QuadratureValuesContainer< RealType, memorySpace > * d_nuclearChargesDensity
Definition: ElectrostaticLocalFE.h:219
quadrature::QuadratureValuesContainer< ValueType, memorySpace > * d_totalAuxChargePotAtbSmearQuad
Definition: ElectrostaticLocalFE.h:225
linearAlgebra::MultiVector< ValueType, memorySpace > * d_totalChargePotential
Definition: ElectrostaticLocalFE.h:215
quadrature::QuadratureValuesContainer< ValueType, memorySpace > * d_nuclearCorrectionPotAtRhoQuad
Definition: ElectrostaticLocalFE.h:229
const std::vector< double > d_atomCharges
Definition: ElectrostaticLocalFE.h:210
const size_type d_numComponents
Definition: ElectrostaticLocalFE.h:207
quadrature::QuadratureValuesContainer< RealType, memorySpace > * d_totalChargeDensity
Definition: ElectrostaticLocalFE.h:217
std::shared_ptr< linearAlgebra::LinAlgOpContext< memorySpace > > d_linAlgOpContext
Definition: ElectrostaticLocalFE.h:264
std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeBasisData, memorySpace > > d_feBDNuclearChargeRhs
Definition: ElectrostaticLocalFE.h:257
typename ElectrostaticFE< ValueTypeBasisData, ValueTypeBasisCoeff, ValueTypeWaveFnBasisData, memorySpace, dim >::RealType RealType
Definition: ElectrostaticLocalFE.h:71
std::shared_ptr< const basis::FEBasisOperations< ValueTypeBasisCoeff, ValueTypeWaveFnBasisData, memorySpace, dim > > d_feBasisOpHamiltonian
Definition: ElectrostaticLocalFE.h:262
quadrature::QuadratureValuesContainer< ValueType, memorySpace > * d_nuclearCorrectionPotQuad
Definition: ElectrostaticLocalFE.h:227
std::shared_ptr< const basis::FEBasisOperations< ValueTypeBasisCoeff, ValueTypeBasisData, memorySpace, dim > > d_feBasisOp
Definition: ElectrostaticLocalFE.h:243
bool d_isNumerical
Definition: ElectrostaticLocalFE.h:206
void reinitField(const quadrature::QuadratureValuesContainer< RealType, memorySpace > &electronChargeDensity)
Definition: ElectrostaticLocalFE.t.cpp:843
quadrature::QuadratureValuesContainer< ValueType, memorySpace > * d_totalChargePotentialQuad
Definition: ElectrostaticLocalFE.h:231
typename ElectrostaticFE< ValueTypeBasisData, ValueTypeBasisCoeff, ValueTypeWaveFnBasisData, memorySpace, dim >::Storage Storage
Definition: ElectrostaticLocalFE.h:66
const quadrature::QuadratureValuesContainer< ValueType, memorySpace > * d_electronChargeDensity
Definition: ElectrostaticLocalFE.h:221
size_type d_cellTimesNumVecPoisson
Definition: ElectrostaticLocalFE.h:266
std::shared_ptr< const basis::FEBasisManager< ValueTypeBasisCoeff, ValueTypeBasisData, memorySpace, dim > > d_feBMTotalCharge
Definition: ElectrostaticLocalFE.h:248
std::vector< std::shared_ptr< basis::FEBasisManager< ValueTypeBasisCoeff, ValueTypeBasisData, memorySpace, dim > > > d_feBMNuclearCharge
Definition: ElectrostaticLocalFE.h:238
const std::vector< double > d_smearedChargeRadius
Definition: ElectrostaticLocalFE.h:211
std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeBasisData, memorySpace > > d_feBDTotalChargeStiffnessMatrix
Definition: ElectrostaticLocalFE.h:251
std::shared_ptr< electrostatics::PoissonLinearSolverFunctionFE< ValueTypeBasisData, ValueTypeBasisCoeff, memorySpace, dim > > d_linearSolverFunctionNuclear
Definition: ElectrostaticLocalFE.h:278
RealType getEnergy() const override
Definition: ElectrostaticLocalFE.t.cpp:1307
std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeBasisData, memorySpace > > d_feBDTotalChargeRhs
Definition: ElectrostaticLocalFE.h:254
const utils::ScalarSpatialFunctionReal & d_externalPotentialFunction
Definition: ElectrostaticLocalFE.h:213
void nuclearPotentialSolve(std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeBasisData, memorySpace > > feBDNuclearChargeStiffnessMatrix, std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeBasisData, memorySpace > > feBDNuclearChargeRhs)
Definition: ElectrostaticLocalFE.t.cpp:950
Definition: LinAlgOpContext.h:38
An class template to encapsulate a MultiVector. A MultiVector is a collection of vectors belonging t...
Definition: MultiVector.h:134
Definition: QuadratureValuesContainer.h:39
Definition: Function.h:10
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
unsigned int size_type
Definition: TypeConfig.h:8