DFT-EFE
 
Loading...
Searching...
No Matches
ElectrostaticONCVNonLocFE.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 dftefeElectrostaticONCVNonLocFE_h
27#define dftefeElectrostaticONCVNonLocFE_h
28
44
45namespace dftefe
46{
47 namespace ksdft
48 {
49 template <typename ValueTypeBasisData,
50 typename ValueTypeBasisCoeff,
51 typename ValueTypeWaveFnBasis,
52 typename ValueTypeWaveFnCoeff,
53 utils::MemorySpace memorySpace,
54 size_type dim>
56 : public ElectrostaticFE<ValueTypeBasisData,
57 ValueTypeBasisCoeff,
58 ValueTypeWaveFnBasis,
59 memorySpace,
60 dim>
61 {
62 public:
63 using ValueType = typename ElectrostaticFE<ValueTypeBasisData,
64 ValueTypeBasisCoeff,
65 ValueTypeWaveFnBasis,
66 memorySpace,
67 dim>::ValueType;
68 using Storage = typename ElectrostaticFE<ValueTypeBasisData,
69 ValueTypeBasisCoeff,
70 ValueTypeWaveFnBasis,
71 memorySpace,
72 dim>::Storage;
73 using RealType = typename ElectrostaticFE<ValueTypeBasisData,
74 ValueTypeBasisCoeff,
75 ValueTypeWaveFnBasis,
76 memorySpace,
77 dim>::RealType;
78
79 public:
83 // used if analytical vself canellation route taken
85 const std::vector<utils::Point> &atomCoordinates,
86 const std::vector<double> & atomCharges,
87 const std::vector<std::string> & atomSymbolVec,
88 const std::shared_ptr<atoms::AtomSphericalDataContainer>
89 atomSphericalDataContainerPSP,
90 const double &smearedChargeRadius,
92 & electronChargeDensity,
93 std::shared_ptr<const basis::FEBasisManager<ValueTypeBasisCoeff,
94 ValueTypeBasisData,
96 dim>> feBMTotalCharge,
97 std::shared_ptr<const basis::FEBasisManager<ValueTypeWaveFnCoeff,
98 ValueTypeWaveFnBasis,
99 memorySpace,
100 dim>> feBMWaveFn,
101 std::shared_ptr<
103 feBDTotalChargeStiffnessMatrix,
104 std::shared_ptr<
106 feBDNuclearChargeRhs,
107 std::shared_ptr<
109 feBDElectronicChargeRhs,
110 std::shared_ptr<
112 feBDHamiltonian,
113 std::shared_ptr<
115 feBDAtomCenterNonLocalOperator,
117 linAlgOpContext,
118 const size_type maxCellBlock,
119 const size_type maxWaveFnBlock,
120 const bool useDealiiMatrixFreePoissonSolve = true);
121
122 // used if delta rho approach is taken with phi total from 1D KS solve
123 // with analytical vself energy cancellation
125 const std::vector<utils::Point> &atomCoordinates,
126 const std::vector<double> & atomCharges,
127 const std::vector<std::string> & atomSymbolVec,
128 const std::shared_ptr<atoms::AtomSphericalDataContainer>
129 atomSphericalDataContainerPSP,
130 const double &smearedChargeRadius,
132 &atomicTotalElectroPotentialFunction,
134 &atomicElectronicChargeDensityFunction,
135 std::shared_ptr<const basis::FEBasisManager<ValueTypeBasisCoeff,
136 ValueTypeBasisData,
138 dim>>
139 feBMTotalCharge, // will be same as bc of totalCharge -
140 // atomicTotalCharge
141 std::shared_ptr<const basis::FEBasisManager<ValueTypeWaveFnCoeff,
142 ValueTypeWaveFnBasis,
143 memorySpace,
144 dim>> feBMWaveFn,
145 std::shared_ptr<
147 feBDTotalChargeStiffnessMatrix,
148 std::shared_ptr<
150 feBDNuclearChargeRhs,
151 std::shared_ptr<
153 feBDElectronicChargeRhs,
154 std::shared_ptr<
156 feBDHamiltonian,
157 std::shared_ptr<
159 feBDAtomCenterNonLocalOperator,
161 linAlgOpContext,
162 const size_type maxCellBlock,
163 const size_type maxWaveFnBlock,
164 const std::unordered_map<std::string,
165 std::shared_ptr<atoms::AtomTCIASpline>>
166 fieldToTCIASplineMap = {},
167 const bool useDealiiMatrixFreePoissonSolve = true);
168
170
171 // // used if analytical vself canellation route taken
172 void
174 const std::vector<utils::Point> & atomCoordinates,
175 std::shared_ptr<const basis::FEBasisManager<ValueTypeBasisCoeff,
176 ValueTypeBasisData,
178 dim>> feBMTotalCharge,
179 std::shared_ptr<const basis::FEBasisManager<ValueTypeWaveFnCoeff,
180 ValueTypeWaveFnBasis,
181 memorySpace,
182 dim>> feBMWaveFn,
183 std::shared_ptr<
185 feBDTotalChargeStiffnessMatrix,
186 std::shared_ptr<
188 feBDNuclearChargeRhs,
189 std::shared_ptr<
191 feBDElectronicChargeRhs,
192 std::shared_ptr<
194 feBDHamiltonian,
195 std::shared_ptr<
197 feBDAtomCenterNonLocalOperator);
198
199 // used if delta rho approach is taken with phi total from 1D KS solve
200 // with analytical vself energy cancellation
201 void
203 const std::vector<utils::Point> &atomCoordinates,
205 &atomicTotalElectroPotentialFunction,
207 &atomicElectronicChargeDensityFunction,
208 std::shared_ptr<const basis::FEBasisManager<ValueTypeBasisCoeff,
209 ValueTypeBasisData,
211 dim>> feBMTotalCharge,
212 std::shared_ptr<const basis::FEBasisManager<ValueTypeWaveFnCoeff,
213 ValueTypeWaveFnBasis,
214 memorySpace,
215 dim>> feBMWaveFn,
216 std::shared_ptr<
218 feBDTotalChargeStiffnessMatrix,
219 std::shared_ptr<
221 feBDNuclearChargeRhs,
222 std::shared_ptr<
224 feBDElectronicChargeRhs,
225 std::shared_ptr<
227 feBDHamiltonian,
228 std::shared_ptr<
230 feBDAtomCenterNonLocalOperator);
231
232 void
235 &electronChargeDensity);
236
237 void
238 getLocal(Storage &cellWiseStorage) const override;
239
240 void
244 bool updateGhostX,
245 bool updateGhostY) const override;
246
247 bool
248 hasLocalComponent() const override;
249
250 bool
251 hasNonLocalComponent() const override;
252
253 void
255 const std::vector<RealType> &occupation,
257
259 getEnergy() const override;
260
262 getFunctionalDerivative() const override;
263
264 std::shared_ptr<
265 const basis::AtomCenterNonLocalOpContextFE<ValueTypeWaveFnBasis,
266 ValueTypeWaveFnCoeff,
267 memorySpace,
268 dim>>
270
271 private:
272 std::shared_ptr<linearAlgebra::LinAlgOpContext<memorySpace>>
274 std::shared_ptr<atoms::AtomSphericalDataContainer>
276 std::shared_ptr<const atoms::AtomSevereFunction<memorySpace>>
278 std::shared_ptr<
279 const basis::AtomCenterNonLocalOpContextFE<ValueTypeWaveFnBasis,
280 ValueTypeWaveFnCoeff,
281 memorySpace,
282 dim>>
284 std::shared_ptr<ElectrostaticLocalFE<ValueTypeBasisData,
285 ValueTypeBasisCoeff,
286 ValueTypeWaveFnBasis,
287 memorySpace,
288 dim>>
296 const std::vector<std::string> d_atomSymbolVec;
298
299 std::shared_ptr<linearAlgebra::MultiVector<ValueType, memorySpace>>
301 std::shared_ptr<const utils::mpi::MPIPatternP2P<memorySpace>>
303
304 }; // end of class ElectrostaticONCVNonLocFE
305 } // end of namespace ksdft
306} // end of namespace dftefe
308#endif // dftefeElectrostaticONCVNonLocFE_h
Definition: AtomSuperpositionFunction.h:55
Definition: AtomCenterNonLocalOpContextFE.h:50
An abstract class to store and access data for a given basis, such as the basis function values on a ...
Definition: FEBasisDataStorage.h:54
An abstract class to encapsulate the partitioning of a finite element basis across multiple processor...
Definition: FEBasisManager.h:44
A derived class of linearAlgebra::OperatorContext to encapsulate the action of a discrete operator on...
Definition: ElectrostaticFE.h:65
Definition: ElectrostaticLocalFE.h:60
Definition: ElectrostaticONCVNonLocFE.h:61
bool hasNonLocalComponent() const override
Definition: ElectrostaticONCVNonLocFE.t.cpp:563
utils::ConditionalOStream d_rootCout
Definition: ElectrostaticONCVNonLocFE.h:292
std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > d_mpiPatternP2P
Definition: ElectrostaticONCVNonLocFE.h:302
bool hasLocalComponent() const override
Definition: ElectrostaticONCVNonLocFE.t.cpp:546
void getLocal(Storage &cellWiseStorage) const override
Definition: ElectrostaticONCVNonLocFE.t.cpp:501
RealType getEnergy() const override
Definition: ElectrostaticONCVNonLocFE.t.cpp:723
const utils::mpi::MPIComm d_mpiComm
Definition: ElectrostaticONCVNonLocFE.h:293
std::shared_ptr< linearAlgebra::MultiVector< ValueType, memorySpace > > d_YBatchSmall
Definition: ElectrostaticONCVNonLocFE.h:300
void reinitField(const quadrature::QuadratureValuesContainer< RealType, memorySpaceHost > &electronChargeDensity)
Definition: ElectrostaticONCVNonLocFE.t.cpp:482
std::shared_ptr< const basis::AtomCenterNonLocalOpContextFE< ValueTypeWaveFnBasis, ValueTypeWaveFnCoeff, memorySpace, dim > > getAtomCenterNonLocalOpContextFE() const
Definition: ElectrostaticONCVNonLocFE.t.cpp:767
const size_type d_maxWaveFnBlock
Definition: ElectrostaticONCVNonLocFE.h:295
std::shared_ptr< atoms::AtomSphericalDataContainer > d_atomSphericalDataContainerPSP
Definition: ElectrostaticONCVNonLocFE.h:275
void applyNonLocal(linearAlgebra::MultiVector< ValueTypeWaveFnCoeff, memorySpace > &X, linearAlgebra::MultiVector< ValueTypeWaveFnCoeff, memorySpace > &Y, bool updateGhostX, bool updateGhostY) const override
Definition: ElectrostaticONCVNonLocFE.t.cpp:519
std::shared_ptr< linearAlgebra::MultiVector< ValueType, memorySpace > > d_YBatch
Definition: ElectrostaticONCVNonLocFE.h:300
void reinitBasis(const std::vector< utils::Point > &atomCoordinates, std::shared_ptr< const basis::FEBasisManager< ValueTypeBasisCoeff, ValueTypeBasisData, memorySpaceHost, dim > > feBMTotalCharge, std::shared_ptr< const basis::FEBasisManager< ValueTypeWaveFnCoeff, ValueTypeWaveFnBasis, memorySpace, dim > > feBMWaveFn, std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeBasisData, memorySpaceHost > > feBDTotalChargeStiffnessMatrix, std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeBasisData, memorySpaceHost > > feBDNuclearChargeRhs, std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeBasisData, memorySpaceHost > > feBDElectronicChargeRhs, std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeWaveFnBasis, memorySpace > > feBDHamiltonian, std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeWaveFnBasis, memorySpace > > feBDAtomCenterNonLocalOperator)
Definition: ElectrostaticONCVNonLocFE.t.cpp:316
std::shared_ptr< linearAlgebra::MultiVector< ValueType, memorySpace > > d_psiBatch
Definition: ElectrostaticONCVNonLocFE.h:300
typename ElectrostaticFE< ValueTypeBasisData, ValueTypeBasisCoeff, ValueTypeWaveFnBasis, memorySpace, dim >::RealType RealType
Definition: ElectrostaticONCVNonLocFE.h:77
const std::vector< std::string > d_atomSymbolVec
Definition: ElectrostaticONCVNonLocFE.h:296
const quadrature::QuadratureValuesContainer< ValueType, memorySpace > & getFunctionalDerivative() const override
Definition: ElectrostaticONCVNonLocFE.t.cpp:746
void evalEnergy(const std::vector< RealType > &occupation, linearAlgebra::MultiVector< ValueTypeWaveFnCoeff, memorySpace > &X)
Definition: ElectrostaticONCVNonLocFE.t.cpp:582
RealType d_energy
Definition: ElectrostaticONCVNonLocFE.h:290
std::shared_ptr< linearAlgebra::LinAlgOpContext< memorySpace > > d_linAlgOpContext
Definition: ElectrostaticONCVNonLocFE.h:273
const size_type d_numComponents
Definition: ElectrostaticONCVNonLocFE.h:291
typename ElectrostaticFE< ValueTypeBasisData, ValueTypeBasisCoeff, ValueTypeWaveFnBasis, memorySpace, dim >::Storage Storage
Definition: ElectrostaticONCVNonLocFE.h:72
std::shared_ptr< linearAlgebra::MultiVector< ValueType, memorySpace > > d_psiBatchSmall
Definition: ElectrostaticONCVNonLocFE.h:300
bool d_isNonLocPSP
Definition: ElectrostaticONCVNonLocFE.h:297
std::shared_ptr< const basis::AtomCenterNonLocalOpContextFE< ValueTypeWaveFnBasis, ValueTypeWaveFnCoeff, memorySpace, dim > > d_atomNonLocOpContext
Definition: ElectrostaticONCVNonLocFE.h:283
std::shared_ptr< const atoms::AtomSevereFunction< memorySpace > > d_atomVLocFunction
Definition: ElectrostaticONCVNonLocFE.h:277
typename ElectrostaticFE< ValueTypeBasisData, ValueTypeBasisCoeff, ValueTypeWaveFnBasis, memorySpace, dim >::ValueType ValueType
Definition: ElectrostaticONCVNonLocFE.h:67
const size_type d_maxCellBlock
Definition: ElectrostaticONCVNonLocFE.h:294
std::shared_ptr< ElectrostaticLocalFE< ValueTypeBasisData, ValueTypeBasisCoeff, ValueTypeWaveFnBasis, memorySpace, dim > > d_electrostaticLocal
Definition: ElectrostaticONCVNonLocFE.h:289
Definition: LinAlgOpContext.h:52
An class template to encapsulate a MultiVector. A MultiVector is a collection of vectors belonging t...
Definition: MultiVector.h:134
Definition: QuadratureValuesContainer.h:39
Provides an interface to print based on whether a certain condition is met or not....
Definition: ConditionalOStream.h:47
int MPIComm
Definition: MPITypes.h:84
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
std::uint64_t size_type
Definition: TypeConfig.h:9
static constexpr utils::MemorySpace memorySpaceHost
Definition: Defaults.h:185