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,
122
123 // used if delta rho approach is taken with phi total from 1D KS solve
124 // with analytical vself energy cancellation
126 const std::vector<utils::Point> &atomCoordinates,
127 const std::vector<double> & atomCharges,
128 const std::vector<std::string> & atomSymbolVec,
129 const std::shared_ptr<atoms::AtomSphericalDataContainer>
130 atomSphericalDataContainerPSP,
131 const double &smearedChargeRadius,
133 &atomicTotalElectroPotentialFunction,
135 &atomicElectronicChargeDensityFunction,
136 std::shared_ptr<const basis::FEBasisManager<ValueTypeBasisCoeff,
137 ValueTypeBasisData,
139 dim>>
140 feBMTotalCharge, // will be same as bc of totalCharge -
141 // atomicTotalCharge
142 std::shared_ptr<const basis::FEBasisManager<ValueTypeWaveFnCoeff,
143 ValueTypeWaveFnBasis,
144 memorySpace,
145 dim>> feBMWaveFn,
146 std::shared_ptr<
148 feBDTotalChargeStiffnessMatrix,
149 std::shared_ptr<
151 feBDNuclearChargeRhs,
152 std::shared_ptr<
154 feBDElectronicChargeRhs,
155 std::shared_ptr<
157 feBDHamiltonian,
158 std::shared_ptr<
160 feBDAtomCenterNonLocalOperator,
162 linAlgOpContext,
163 const size_type maxCellBlock,
164 const size_type maxWaveFnBlock,
165 const std::unordered_map<std::string,
166 std::shared_ptr<atoms::AtomTCIASpline>>
167 fieldToTCIASplineMap = {},
168 const bool useDealiiMatrixFreePoissonSolve = true,
170
172
173 // // used if analytical vself canellation route taken
174 void
176 const std::vector<utils::Point> & atomCoordinates,
177 std::shared_ptr<const basis::FEBasisManager<ValueTypeBasisCoeff,
178 ValueTypeBasisData,
180 dim>> feBMTotalCharge,
181 std::shared_ptr<const basis::FEBasisManager<ValueTypeWaveFnCoeff,
182 ValueTypeWaveFnBasis,
183 memorySpace,
184 dim>> feBMWaveFn,
185 std::shared_ptr<
187 feBDTotalChargeStiffnessMatrix,
188 std::shared_ptr<
190 feBDNuclearChargeRhs,
191 std::shared_ptr<
193 feBDElectronicChargeRhs,
194 std::shared_ptr<
196 feBDHamiltonian,
197 std::shared_ptr<
199 feBDAtomCenterNonLocalOperator);
200
201 // used if delta rho approach is taken with phi total from 1D KS solve
202 // with analytical vself energy cancellation
203 void
205 const std::vector<utils::Point> &atomCoordinates,
207 &atomicTotalElectroPotentialFunction,
209 &atomicElectronicChargeDensityFunction,
210 std::shared_ptr<const basis::FEBasisManager<ValueTypeBasisCoeff,
211 ValueTypeBasisData,
213 dim>> feBMTotalCharge,
214 std::shared_ptr<const basis::FEBasisManager<ValueTypeWaveFnCoeff,
215 ValueTypeWaveFnBasis,
216 memorySpace,
217 dim>> feBMWaveFn,
218 std::shared_ptr<
220 feBDTotalChargeStiffnessMatrix,
221 std::shared_ptr<
223 feBDNuclearChargeRhs,
224 std::shared_ptr<
226 feBDElectronicChargeRhs,
227 std::shared_ptr<
229 feBDHamiltonian,
230 std::shared_ptr<
232 feBDAtomCenterNonLocalOperator);
233
234 void
237 &electronChargeDensity);
238
239 void
240 getLocal(Storage &cellWiseStorage) const override;
241
242 void
246 bool updateGhostX,
247 bool updateGhostY) const override;
248
249 bool
250 hasLocalComponent() const override;
251
252 bool
253 hasNonLocalComponent() const override;
254
255 void
257 const std::vector<RealType> &occupation,
259
261 getEnergy() const override;
262
263 std::vector<quadrature::QuadratureValuesContainer<ValueType, memorySpace>>
264 getFunctionalDerivative() const override;
265
266 std::shared_ptr<
267 const basis::AtomCenterNonLocalOpContextFE<ValueTypeWaveFnBasis,
268 ValueTypeWaveFnCoeff,
269 memorySpace,
270 dim>>
272
273 private:
274 std::shared_ptr<linearAlgebra::LinAlgOpContext<memorySpace>>
276 std::shared_ptr<atoms::AtomSphericalDataContainer>
278 std::shared_ptr<const atoms::AtomSevereFunction<memorySpace>>
280 std::shared_ptr<
281 const basis::AtomCenterNonLocalOpContextFE<ValueTypeWaveFnBasis,
282 ValueTypeWaveFnCoeff,
283 memorySpace,
284 dim>>
286 std::shared_ptr<ElectrostaticLocalFE<ValueTypeBasisData,
287 ValueTypeBasisCoeff,
288 ValueTypeWaveFnBasis,
289 memorySpace,
290 dim>>
298 const std::vector<std::string> d_atomSymbolVec;
301
302 std::shared_ptr<linearAlgebra::MultiVector<ValueType, memorySpace>>
304 std::shared_ptr<const utils::mpi::MPIPatternP2P<memorySpace>>
306
307 const std::vector<double> d_atomCharges;
309
310 }; // end of class ElectrostaticONCVNonLocFE
311 } // end of namespace ksdft
312} // end of namespace dftefe
314#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:66
Definition: ElectrostaticLocalFE.h:62
Definition: ElectrostaticONCVNonLocFE.h:61
bool hasNonLocalComponent() const override
Definition: ElectrostaticONCVNonLocFE.t.cpp:576
utils::ConditionalOStream d_rootCout
Definition: ElectrostaticONCVNonLocFE.h:294
std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > d_mpiPatternP2P
Definition: ElectrostaticONCVNonLocFE.h:305
bool hasLocalComponent() const override
Definition: ElectrostaticONCVNonLocFE.t.cpp:559
void getLocal(Storage &cellWiseStorage) const override
Definition: ElectrostaticONCVNonLocFE.t.cpp:514
RealType getEnergy() const override
Definition: ElectrostaticONCVNonLocFE.t.cpp:744
const utils::mpi::MPIComm d_mpiComm
Definition: ElectrostaticONCVNonLocFE.h:295
std::shared_ptr< linearAlgebra::MultiVector< ValueType, memorySpace > > d_YBatchSmall
Definition: ElectrostaticONCVNonLocFE.h:303
void reinitField(const quadrature::QuadratureValuesContainer< RealType, memorySpaceHost > &electronChargeDensity)
Definition: ElectrostaticONCVNonLocFE.t.cpp:495
std::shared_ptr< const basis::AtomCenterNonLocalOpContextFE< ValueTypeWaveFnBasis, ValueTypeWaveFnCoeff, memorySpace, dim > > getAtomCenterNonLocalOpContextFE() const
Definition: ElectrostaticONCVNonLocFE.t.cpp:788
const size_type d_maxWaveFnBlock
Definition: ElectrostaticONCVNonLocFE.h:297
std::shared_ptr< atoms::AtomSphericalDataContainer > d_atomSphericalDataContainerPSP
Definition: ElectrostaticONCVNonLocFE.h:277
void applyNonLocal(linearAlgebra::MultiVector< ValueTypeWaveFnCoeff, memorySpace > &X, linearAlgebra::MultiVector< ValueTypeWaveFnCoeff, memorySpace > &Y, bool updateGhostX, bool updateGhostY) const override
Definition: ElectrostaticONCVNonLocFE.t.cpp:532
std::shared_ptr< linearAlgebra::MultiVector< ValueType, memorySpace > > d_YBatch
Definition: ElectrostaticONCVNonLocFE.h:303
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:329
std::shared_ptr< linearAlgebra::MultiVector< ValueType, memorySpace > > d_psiBatch
Definition: ElectrostaticONCVNonLocFE.h:303
typename ElectrostaticFE< ValueTypeBasisData, ValueTypeBasisCoeff, ValueTypeWaveFnBasis, memorySpace, dim >::RealType RealType
Definition: ElectrostaticONCVNonLocFE.h:77
SpinMode d_spinMode
Definition: ElectrostaticONCVNonLocFE.h:300
const std::vector< std::string > d_atomSymbolVec
Definition: ElectrostaticONCVNonLocFE.h:298
void evalEnergy(const std::vector< RealType > &occupation, linearAlgebra::MultiVector< ValueTypeWaveFnCoeff, memorySpace > &X)
Definition: ElectrostaticONCVNonLocFE.t.cpp:595
RealType d_energy
Definition: ElectrostaticONCVNonLocFE.h:292
const double d_smearedChargeRadius
Definition: ElectrostaticONCVNonLocFE.h:308
std::vector< quadrature::QuadratureValuesContainer< ValueType, memorySpace > > getFunctionalDerivative() const override
Definition: ElectrostaticONCVNonLocFE.t.cpp:767
std::shared_ptr< linearAlgebra::LinAlgOpContext< memorySpace > > d_linAlgOpContext
Definition: ElectrostaticONCVNonLocFE.h:275
const size_type d_numComponents
Definition: ElectrostaticONCVNonLocFE.h:293
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:303
bool d_isNonLocPSP
Definition: ElectrostaticONCVNonLocFE.h:299
const std::vector< double > d_atomCharges
Definition: ElectrostaticONCVNonLocFE.h:307
std::shared_ptr< const basis::AtomCenterNonLocalOpContextFE< ValueTypeWaveFnBasis, ValueTypeWaveFnCoeff, memorySpace, dim > > d_atomNonLocOpContext
Definition: ElectrostaticONCVNonLocFE.h:285
std::shared_ptr< const atoms::AtomSevereFunction< memorySpace > > d_atomVLocFunction
Definition: ElectrostaticONCVNonLocFE.h:279
typename ElectrostaticFE< ValueTypeBasisData, ValueTypeBasisCoeff, ValueTypeWaveFnBasis, memorySpace, dim >::ValueType ValueType
Definition: ElectrostaticONCVNonLocFE.h:67
const size_type d_maxCellBlock
Definition: ElectrostaticONCVNonLocFE.h:296
std::shared_ptr< ElectrostaticLocalFE< ValueTypeBasisData, ValueTypeBasisCoeff, ValueTypeWaveFnBasis, memorySpace, dim > > d_electrostaticLocal
Definition: ElectrostaticONCVNonLocFE.h:291
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
SpinMode
Definition: KSAttributes.h:55
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:213