DFT-FE 1.3.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
oncvClass.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// @author Kartick Ramakrishnan, Sambit Das
18//
19
20#ifndef DFTFE_ONCVCLASS_H
21#define DFTFE_ONCVCLASS_H
22
24namespace dftfe
25{
26 template <typename ValueType, dftfe::utils::MemorySpace memorySpace>
27 class oncvClass : public pseudopotentialBaseClass<ValueType, memorySpace>
28 {
29 public:
30 oncvClass(const MPI_Comm &mpi_comm_parent,
31 const std::string &scratchFolderName,
32 const std::set<dftfe::uInt> &atomTypes,
33 const bool floatingNuclearCharges,
34 const dftfe::uInt nOMPThreads,
35 const std::map<dftfe::uInt, dftfe::uInt> &atomAttributes,
36 const bool reproducibleOutput,
37 const dftfe::Int verbosity,
38 const bool useDevice,
39 const bool memOptMode);
40 /**
41 * @brief Initialises all the data members with addresses/values to/of dftClass.
42 * @param[in] densityQuadratureId quadratureId for density.
43 * @param[in] localContributionQuadratureId quadratureId for local/zero
44 * potential
45 * @param[in] nuclearChargeQuadratureIdElectro quadratureId for nuclear
46 * charges
47 * @param[in] densityQuadratureIdElectro quadratureId for density in
48 * Electrostatics mesh
49 * @param[in] excFunctionalPtr address XC functional pointer
50 * @param[in] numEigenValues number of eigenvalues
51 * @param[in] atomLocations atomic Coordinates
52 * @param[in] imageIds image IDs of periodic cell
53 * @param[in] periodicCoords coordinates of image atoms
54 */
55
56 void
58 std::shared_ptr<
60 FEBasisOperations<ValueType, double, dftfe::utils::MemorySpace::HOST>>
61 basisOperationsHostPtr,
62#if defined(DFTFE_WITH_DEVICE)
63 std::shared_ptr<
65 double,
67 basisOperationsDevicePtr,
68#endif
69 std::shared_ptr<
71 BLASWrapperPtrHost,
72#if defined(DFTFE_WITH_DEVICE)
73 std::shared_ptr<
75 BLASWrapperPtrDevice,
76#endif
77 dftfe::uInt densityQuadratureId,
78 dftfe::uInt localContributionQuadratureId,
79 dftfe::uInt sparsityPatternQuadratureId,
80 dftfe::uInt nlpspQuadratureId,
81 dftfe::uInt densityQuadratureIdElectro,
82 std::shared_ptr<excManager<memorySpace>> excFunctionalPtr,
83 const std::vector<std::vector<double>> &atomLocations,
84 dftfe::uInt numEigenValues,
85 const bool singlePrecNonLocalOperator,
86 const bool floatingNuclearCharges,
87 const bool computeForce,
88 const bool computeStress);
89
90 /**
91 * @brief Initialises all the data members with addresses/values to/of dftClass.
92 * @param[in] densityQuadratureId quadratureId for density.
93 * @param[in] localContributionQuadratureId quadratureId for local/zero
94 * potential
95 * @param[in] nuclearChargeQuadratureIdElectro quadratureId for nuclear
96 * charges
97 * @param[in] densityQuadratureIdElectro quadratureId for density in
98 * Electrostatics mesh
99 * @param[in] bQuadValuesAllAtoms address of nuclear charge field
100 * @param[in] excFunctionalPtr address XC functional pointer
101 * @param[in] numEigenValues number of eigenvalues
102 * @param[in] atomLocations atomic Coordinates
103 * @param[in] imageIds image IDs of periodic cell
104 * @param[in] periodicCoords coordinates of image atoms
105 */
106 void
108 const std::vector<dftfe::Int> &imageIds,
109 const std::vector<std::vector<double>> &periodicCoords,
110 const std::vector<double> &kPointWeights,
111 const std::vector<double> &kPointCoordinates,
112 const bool updateNonlocalSparsity);
113
114
115 void
117 const std::vector<dftfe::Int> &imageIds,
118 const std::vector<std::vector<double>> &periodicCoords,
119 const std::vector<double> &kPointWeights,
120 const std::vector<double> &kPointCoordinates,
121 const bool updateNonlocalSparsity,
122 const std::map<dftfe::uInt, std::vector<dftfe::Int>> &sparsityPattern,
123 const std::vector<std::vector<dealii::CellId>>
124 &elementIdsInAtomCompactSupport,
125 const std::vector<std::vector<dftfe::uInt>>
126 &elementIndexesInAtomCompactSupport,
127 const std::vector<dftfe::uInt> &atomIdsInCurrentProcess,
128 dftfe::uInt numberElements);
129
130
131 /**
132 * @brief Initialises local potential
133 */
134 void
136
137 void
139 double rad,
140 std::vector<double> &Val);
141
142 double
144
145 double
147
148 void
150 double rad,
151 std::vector<double> &Val);
152
153 double
155
156 double
158
159 double
161
162 double
164
165 bool
167 // Returns the number of Projectors for the given atomID in cooridnates List
170 // Returns the Total Number of atoms with support in the processor
173 // Returns the atomID in coordinates list for the iAtom index.
176
177
181
182
183 const std::shared_ptr<
186
189 memorySpace> &
192
193
194 const std::shared_ptr<AtomicCenteredNonLocalOperator<
196 memorySpace>>
198
199 void
201 const std::vector<std::vector<double>> &atomCoordinates);
202
203 const std::map<dftfe::uInt, dftfe::uInt> &
205
206
207 private:
208 /**
209 * @brief Converts the periodic image data structure to relevant form for the container class
210 * @param[in] atomLocations atomic Coordinates
211 * @param[in] imageIds image IDs of periodic cell
212 * @param[in] periodicCoords coordinates of image atoms
213 * @param[out] imageIdsTemp image IDs of periodic cell
214 * @param[out] imageCoordsTemp coordinates of image atoms
215 */
216 void
217 setImageCoordinates(const std::vector<std::vector<double>> &atomLocations,
218 const std::vector<dftfe::Int> &imageIds,
219 const std::vector<std::vector<double>> &periodicCoords,
220 std::vector<dftfe::uInt> &imageIdsTemp,
221 std::vector<double> &imageCoordsTemp);
222 /**
223 * @brief Creating Density splines for all atomTypes
224 */
225 void
227
228 void
230 void
232 void
234
235 std::shared_ptr<
238#if defined(DFTFE_WITH_DEVICE)
239 std::shared_ptr<
241 d_BLASWrapperDevicePtr;
242#endif
243 std::vector<std::vector<double>> d_nonLocalPseudoPotentialConstants;
244 std::map<dftfe::uInt, std::vector<double>>
249 memorySpace>
251
254 std::vector<std::shared_ptr<AtomCenteredSphericalFunctionBase>>
256 std::shared_ptr<AtomCenteredSphericalFunctionContainer>
258 std::map<std::pair<dftfe::uInt, dftfe::uInt>,
259 std::shared_ptr<AtomCenteredSphericalFunctionBase>>
261
262 // parallel communication objects
263 const MPI_Comm d_mpiCommParent;
265
266 // conditional stream object
267 dealii::ConditionalOStream pcout;
276 std::shared_ptr<excManager<memorySpace>> d_excManagerPtr;
277 std::shared_ptr<
278 dftfe::basis::
279 FEBasisOperations<ValueType, double, dftfe::utils::MemorySpace::HOST>>
281#if defined(DFTFE_WITH_DEVICE)
282 std::shared_ptr<
283 dftfe::basis::
284 FEBasisOperations<ValueType, double, dftfe::utils::MemorySpace::DEVICE>>
285 d_BasisOperatorDevicePtr;
286#endif
287
288 std::map<dftfe::uInt, bool> d_atomTypeCoreFlagMap;
292 std::vector<std::vector<double>> d_atomLocations;
293 std::set<dftfe::uInt> d_atomTypes;
294 std::map<dftfe::uInt, std::vector<dftfe::uInt>> d_atomTypesList;
296 std::vector<dftfe::Int> d_imageIds;
297 std::vector<std::vector<double>> d_imagePositions;
300
301 // Creating Object for Atom Centerd Nonlocal Operator
302 std::shared_ptr<AtomicCenteredNonLocalOperator<ValueType, memorySpace>>
304
305 std::shared_ptr<AtomicCenteredNonLocalOperator<
307 memorySpace>>
309
310
311 std::vector<std::shared_ptr<AtomCenteredSphericalFunctionBase>>
313 std::vector<
314 std::map<dftfe::uInt, std::shared_ptr<AtomCenteredSphericalFunctionBase>>>
316 std::vector<
317 std::map<dftfe::uInt, std::shared_ptr<AtomCenteredSphericalFunctionBase>>>
319 std::vector<
320 std::map<dftfe::uInt, std::shared_ptr<AtomCenteredSphericalFunctionBase>>>
323 /// FIXME: eventually it should be a map of atomic number to struct-
324 /// {valence number, mesh input etc}
325 std::map<dftfe::uInt, dftfe::uInt> d_atomTypeAtributes;
326 std::vector<std::vector<double>> d_atomLocationsInterestPseudopotential;
327 std::map<dftfe::uInt, dftfe::uInt>
329
330
331
332 }; // end of class
333} // end of namespace dftfe
334#endif // DFTFE_PSEUDOPOTENTIALBASE_H
Definition AtomicCenteredNonLocalOperator.h:66
Definition FEBasisOperations.h:85
Definition excManager.h:28
Definition BLASWrapper.h:35
std::vector< std::vector< double > > d_atomLocationsInterestPseudopotential
Definition oncvClass.h:326
std::map< dftfe::uInt, dftfe::uInt > d_atomTypeAtributes
Definition oncvClass.h:325
std::vector< std::map< dftfe::uInt, std::shared_ptr< AtomCenteredSphericalFunctionBase > > > d_atomicCoreDensityVector
Definition oncvClass.h:321
double getRadialLocalPseudo(dftfe::uInt Znum, double rad)
std::vector< std::map< dftfe::uInt, std::shared_ptr< AtomCenteredSphericalFunctionBase > > > d_atomicValenceDensityVector
Definition oncvClass.h:318
void createAtomCenteredSphericalFunctionsForDensities()
Creating Density splines for all atomTypes.
const dftfe::utils::MemoryStorage< ValueType, memorySpace > & getCouplingMatrix(CouplingType couplingtype=CouplingType::HamiltonianEntries)
dftfe::uInt d_nuclearChargeQuadratureIdElectro
Definition oncvClass.h:272
dftfe::uInt d_densityQuadratureId
Definition oncvClass.h:270
double getRadialCoreDensity(dftfe::uInt Znum, double rad)
dftfe::Int d_verbosity
Definition oncvClass.h:291
void computeNonlocalPseudoPotentialConstants()
oncvClass(const MPI_Comm &mpi_comm_parent, const std::string &scratchFolderName, const std::set< dftfe::uInt > &atomTypes, const bool floatingNuclearCharges, const dftfe::uInt nOMPThreads, const std::map< dftfe::uInt, dftfe::uInt > &atomAttributes, const bool reproducibleOutput, const dftfe::Int verbosity, const bool useDevice, const bool memOptMode)
const std::shared_ptr< AtomicCenteredNonLocalOperator< ValueType, memorySpace > > getNonLocalOperator()
void setImageCoordinates(const std::vector< std::vector< double > > &atomLocations, const std::vector< dftfe::Int > &imageIds, const std::vector< std::vector< double > > &periodicCoords, std::vector< dftfe::uInt > &imageIdsTemp, std::vector< double > &imageCoordsTemp)
Converts the periodic image data structure to relevant form for the container class.
std::vector< std::vector< double > > d_nonLocalPseudoPotentialConstants
Definition oncvClass.h:243
void getRadialCoreDensity(dftfe::uInt Znum, double rad, std::vector< double > &Val)
std::shared_ptr< excManager< memorySpace > > d_excManagerPtr
Definition oncvClass.h:276
std::map< dftfe::uInt, dftfe::uInt > d_atomIdPseudopotentialInterestToGlobalId
Definition oncvClass.h:328
dftfe::uInt d_localContributionQuadratureId
Definition oncvClass.h:271
std::set< dftfe::uInt > d_atomTypes
Definition oncvClass.h:293
std::map< dftfe::uInt, std::vector< dftfe::uInt > > d_atomTypesList
Definition oncvClass.h:294
std::shared_ptr< AtomicCenteredNonLocalOperator< ValueType, memorySpace > > d_nonLocalOperator
Definition oncvClass.h:303
void createAtomCenteredSphericalFunctionsForLocalPotential()
bool d_HamiltonianCouplingMatrixSinglePrecEntriesUpdated
Definition oncvClass.h:253
void initialiseNonLocalContribution(const std::vector< dftfe::Int > &imageIds, const std::vector< std::vector< double > > &periodicCoords, const std::vector< double > &kPointWeights, const std::vector< double > &kPointCoordinates, const bool updateNonlocalSparsity, const std::map< dftfe::uInt, std::vector< dftfe::Int > > &sparsityPattern, const std::vector< std::vector< dealii::CellId > > &elementIdsInAtomCompactSupport, const std::vector< std::vector< dftfe::uInt > > &elementIndexesInAtomCompactSupport, const std::vector< dftfe::uInt > &atomIdsInCurrentProcess, dftfe::uInt numberElements)
dftfe::uInt getTotalNumberOfSphericalFunctionsForAtomId(dftfe::uInt atomId)
std::map< dftfe::uInt, std::vector< double > > d_atomicNonLocalPseudoPotentialConstants
Definition oncvClass.h:245
std::vector< std::vector< double > > d_atomLocations
Definition oncvClass.h:292
void initialise(std::shared_ptr< dftfe::basis::FEBasisOperations< ValueType, double, dftfe::utils::MemorySpace::HOST > > basisOperationsHostPtr, std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > BLASWrapperPtrHost, dftfe::uInt densityQuadratureId, dftfe::uInt localContributionQuadratureId, dftfe::uInt sparsityPatternQuadratureId, dftfe::uInt nlpspQuadratureId, dftfe::uInt densityQuadratureIdElectro, std::shared_ptr< excManager< memorySpace > > excFunctionalPtr, const std::vector< std::vector< double > > &atomLocations, dftfe::uInt numEigenValues, const bool singlePrecNonLocalOperator, const bool floatingNuclearCharges, const bool computeForce, const bool computeStress)
Initialises all the data members with addresses/values to/of dftClass.
std::vector< std::vector< double > > d_imagePositions
Definition oncvClass.h:297
dftfe::utils::MemoryStorage< ValueType, memorySpace > d_couplingMatrixEntries
Definition oncvClass.h:246
const MPI_Comm d_mpiCommParent
Definition oncvClass.h:263
bool d_singlePrecNonLocalOperator
Definition oncvClass.h:290
dftfe::utils::MemoryStorage< typename dftfe::dataTypes::singlePrecType< ValueType >::type, memorySpace > d_couplingMatrixEntriesSinglePrec
Definition oncvClass.h:250
std::shared_ptr< AtomCenteredSphericalFunctionContainer > d_atomicProjectorFnsContainer
Definition oncvClass.h:257
std::vector< std::shared_ptr< AtomCenteredSphericalFunctionBase > > d_atomicProjectorFnsVector
Definition oncvClass.h:312
double getRadialValenceDensity(dftfe::uInt Znum, double rad)
bool d_HamiltonianCouplingMatrixEntriesUpdated
Definition oncvClass.h:252
bool d_floatingNuclearCharges
Definition oncvClass.h:289
void determineAtomsOfInterstPseudopotential(const std::vector< std::vector< double > > &atomCoordinates)
const std::shared_ptr< AtomicCenteredNonLocalOperator< typename dftfe::dataTypes::singlePrecType< ValueType >::type, memorySpace > > getNonLocalOperatorSinglePrec()
const std::map< dftfe::uInt, dftfe::uInt > & getPSPAtomIdToGlobalIdMap()
void initialiseNonLocalContribution(const std::vector< dftfe::Int > &imageIds, const std::vector< std::vector< double > > &periodicCoords, const std::vector< double > &kPointWeights, const std::vector< double > &kPointCoordinates, const bool updateNonlocalSparsity)
Initialises all the data members with addresses/values to/of dftClass.
std::shared_ptr< AtomicCenteredNonLocalOperator< typename dftfe::dataTypes::singlePrecType< ValueType >::type, memorySpace > > d_nonLocalOperatorSinglePrec
Definition oncvClass.h:308
void getRadialValenceDensity(dftfe::uInt Znum, double rad, std::vector< double > &Val)
bool coreNuclearDensityPresent(dftfe::uInt Znum)
std::vector< std::map< dftfe::uInt, std::shared_ptr< AtomCenteredSphericalFunctionBase > > > d_atomicLocalPotVector
Definition oncvClass.h:315
dftfe::uInt d_numEigenValues
Definition oncvClass.h:298
std::vector< std::shared_ptr< AtomCenteredSphericalFunctionBase > > d_atomicWaveFnsVector
Definition oncvClass.h:255
std::shared_ptr< dftfe::linearAlgebra::BLASWrapper< dftfe::utils::MemorySpace::HOST > > d_BLASWrapperHostPtr
Definition oncvClass.h:237
void initLocalPotential()
Initialises local potential.
dealii::ConditionalOStream pcout
Definition oncvClass.h:267
dftfe::uInt d_densityQuadratureIdElectro
Definition oncvClass.h:273
void createAtomCenteredSphericalFunctionsForProjectors()
bool d_reproducible_output
Definition oncvClass.h:322
dftfe::uInt d_nlpspQuadratureId
Definition oncvClass.h:275
bool d_memoryOptMode
Definition oncvClass.h:269
bool d_useDevice
Definition oncvClass.h:268
dftfe::uInt getAtomIdInCurrentProcessor(dftfe::uInt iAtom)
dftfe::uInt d_nOMPThreads
Definition oncvClass.h:299
std::shared_ptr< dftfe::basis::FEBasisOperations< ValueType, double, dftfe::utils::MemorySpace::HOST > > d_BasisOperatorHostPtr
Definition oncvClass.h:280
double getRmaxValenceDensity(dftfe::uInt Znum)
std::map< std::pair< dftfe::uInt, dftfe::uInt >, std::shared_ptr< AtomCenteredSphericalFunctionBase > > d_atomicProjectorFnsMap
Definition oncvClass.h:260
dftfe::uInt getTotalNumberOfAtomsInCurrentProcessor()
std::map< dftfe::uInt, bool > d_atomTypeCoreFlagMap
Definition oncvClass.h:288
double getRmaxLocalPot(dftfe::uInt Znum)
double getRmaxCoreDensity(dftfe::uInt Znum)
std::vector< dftfe::Int > d_imageIds
Definition oncvClass.h:296
const dftfe::utils::MemoryStorage< typename dftfe::dataTypes::singlePrecType< ValueType >::type, memorySpace > & getCouplingMatrixSinglePrec(CouplingType couplingtype=CouplingType::HamiltonianEntries)
dftfe::uInt d_sparsityPatternQuadratureId
Definition oncvClass.h:274
std::string d_dftfeScratchFolderName
Definition oncvClass.h:295
const dftfe::uInt d_this_mpi_process
Definition oncvClass.h:264
Definition pseudopotentialBaseClass.h:60
Definition MemoryStorage.h:33
Definition FEBasisOperations.h:30
@ DEVICE
Definition MemorySpaceType.h:36
Definition pseudoPotentialToDftfeConverter.cc:34
CouplingType
Definition pseudopotentialBaseClass.h:48
@ HamiltonianEntries
Definition pseudopotentialBaseClass.h:49
std::uint32_t uInt
Definition TypeConfig.h:10
std::int32_t Int
Definition TypeConfig.h:11
T type
Definition dftfeDataTypes.h:112