DFT-EFE
 
Loading...
Searching...
No Matches
RDM1FE.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 Bikash Kanungo
24 */
25
26#ifndef dftefe_RDM1FE_h
27#define dftefe_RDM1FE_h
28
29// C++ standard libraries
30#include <vector>
31#include <set>
32#include <utility>
33#include <unordered_map>
34#include <memory>
35#include <ksdft/RDM1Spectral.h>
40
41namespace dftefe
42{
43 namespace ksdft
44 {
50 template <typename ValueTypeBasisData,
51 typename ValueTypeBasisCoeff,
53 size_type dim>
54 class RDM1FE
55 : public RDM1Spectral<
56 linearAlgebra::blasLapack::scalar_type<ValueTypeBasisData,
57 ValueTypeBasisCoeff>,
58 memorySpace>
59 {
60 public:
61 using ValueType =
63 ValueTypeBasisCoeff>;
65
66 public:
67 virtual ~RDM1FE() = default;
68
69 RDM1FE(std::shared_ptr<
71 feBasisDataStorage,
72 const basis::FEBasisManager<ValueTypeBasisCoeff,
73 ValueTypeBasisData,
74 memorySpace,
75 dim> &feBMPsi,
77 linAlgOpContext,
78 const MPI_Comm & mpiCommDomain,
79 const size_type cellBlockSize,
80 const size_type waveFuncBatchSize,
81 const SpinMode spinMode = SpinMode::Unpolarized,
82 const bool isSOC = false,
83 const std::vector<double> &kPointCoords = std::vector<double>{},
84 const std::vector<double> &kPointWeights = std::vector<double>{});
85
86 void
87 reinit(std::shared_ptr<
89 feBasisDataStorage,
90 const basis::FEBasisManager<ValueTypeBasisCoeff,
91 ValueTypeBasisData,
92 memorySpace,
93 dim> &feBMPsi);
94
95 void
96 setEvalDescrFlag(const bool evalFlag) override;
97
98 void
100 const std::set<DensityDescrAttr> & densityAttrs,
101 const std::set<WfcDescrAttr> & wfcAttrs,
102 std::unordered_map<DensityDescrAttr, AttrStorage> &densityAttrVals,
103 std::unordered_map<WfcDescrAttr, AttrStorage> & wfcAttrVals);
104
105 void
107 const std::unordered_map<DensityDescrAttr, AttrStorage>
108 & densityAttrVals,
109 const std::unordered_map<WfcDescrAttr, AttrStorage> &wfcAttrVals);
110
111 void
113 const std::set<DensityObsAttr> &densityObsAttrs,
114 std::unordered_map<DensityObsAttr, std::vector<std::vector<double>>>
115 &densityObsAttrVals);
116
117 bool
118 isSpinPolarized() const;
119
120 bool
121 isNonCollinear() const;
122
123 bool
124 isSOC() const;
125
127 getnKSOrbs() const;
128
129 std::vector<double>
130 getkPointCoords() const;
131
132 std::vector<double>
133 getkPointWeights() const;
134
135 std::unique_ptr<RDM1<ValueType, memorySpace>>
136 clone() const;
137
138 std::shared_ptr<
140 getFEBasisDataStorage() const;
141
142 const basis::FEBasisManager<ValueTypeBasisCoeff,
143 ValueTypeBasisData,
144 memorySpace,
145 dim> &
146 getFEBasisManager() const;
147
148 private:
149 std::shared_ptr<
152 const basis::FEBasisManager<ValueTypeBasisCoeff,
153 ValueTypeBasisData,
154 memorySpace,
156 std::shared_ptr<linearAlgebra::LinAlgOpContext<memorySpace>>
158 std::shared_ptr<DensityCalculator<ValueTypeBasisData,
159 ValueTypeBasisCoeff,
160 memorySpace,
161 dim>>
163
164 std::vector<double> d_kPointCoords;
165 std::vector<double> d_kPointWeights;
169 std::reference_wrapper<const MPI_Comm> d_mpiCommDomain;
172 std::unordered_map<DensityDescrAttr, AttrStorage> d_densityAttrVals;
173 std::unordered_map<WfcDescrAttr, AttrStorage> d_wfcAttrVals;
174 }; // end of RDM1FE class
175
176 } // namespace ksdft
177} // namespace dftefe
178#include "RDM1FE.t.cpp"
179#endif // dftefe_RDM1FE_h
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
Definition: DensityCalculator.h:43
Class to store the one-particle reduced density matrix using its spectral (eigen) representation in t...
Definition: RDM1FE.h:59
bool isSpinPolarized() const
Definition: RDM1FE.t.cpp:108
bool isSOC() const
Definition: RDM1FE.t.cpp:129
bool d_isSOC
Definition: RDM1FE.h:168
bool d_isNonCollinear
Definition: RDM1FE.h:167
std::vector< double > getkPointCoords() const
Definition: RDM1FE.t.cpp:152
void setEvalDescrFlag(const bool evalFlag) override
Definition: RDM1FE.t.cpp:174
size_type d_waveFuncBatchSize
Definition: RDM1FE.h:171
std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeBasisData, memorySpace > > d_feBasisDataStorage
Definition: RDM1FE.h:151
void getDescriptors(const std::set< DensityDescrAttr > &densityAttrs, const std::set< WfcDescrAttr > &wfcAttrs, std::unordered_map< DensityDescrAttr, AttrStorage > &densityAttrVals, std::unordered_map< WfcDescrAttr, AttrStorage > &wfcAttrVals)
Definition: RDM1FE.t.cpp:185
bool d_isSpinPolarized
Definition: RDM1FE.h:166
std::vector< double > d_kPointWeights
Definition: RDM1FE.h:165
std::shared_ptr< DensityCalculator< ValueTypeBasisData, ValueTypeBasisCoeff, memorySpace, dim > > d_densCalc
Definition: RDM1FE.h:162
bool isNonCollinear() const
Definition: RDM1FE.t.cpp:119
void reinit(std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeBasisData, memorySpace > > feBasisDataStorage, const basis::FEBasisManager< ValueTypeBasisCoeff, ValueTypeBasisData, memorySpace, dim > &feBMPsi)
Definition: RDM1FE.t.cpp:88
void getDensityObs(const std::set< DensityObsAttr > &densityObsAttrs, std::unordered_map< DensityObsAttr, std::vector< std::vector< double > > > &densityObsAttrVals)
Definition: RDM1FE.t.cpp:351
const basis::FEBasisManager< ValueTypeBasisCoeff, ValueTypeBasisData, memorySpace, dim > * d_feBMPsiPtr
Definition: RDM1FE.h:155
virtual ~RDM1FE()=default
std::shared_ptr< linearAlgebra::LinAlgOpContext< memorySpace > > d_linAlgOpContext
Definition: RDM1FE.h:157
const basis::FEBasisManager< ValueTypeBasisCoeff, ValueTypeBasisData, memorySpace, dim > & getFEBasisManager() const
Definition: RDM1FE.t.cpp:521
std::reference_wrapper< const MPI_Comm > d_mpiCommDomain
Definition: RDM1FE.h:169
std::unordered_map< DensityDescrAttr, AttrStorage > d_densityAttrVals
Definition: RDM1FE.h:172
std::unique_ptr< RDM1< ValueType, memorySpace > > clone() const
Definition: RDM1FE.t.cpp:325
void setDescriptors(const std::unordered_map< DensityDescrAttr, AttrStorage > &densityAttrVals, const std::unordered_map< WfcDescrAttr, AttrStorage > &wfcAttrVals)
Definition: RDM1FE.t.cpp:307
std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeBasisData, memorySpace > > getFEBasisDataStorage() const
Definition: RDM1FE.t.cpp:508
std::vector< double > d_kPointCoords
Definition: RDM1FE.h:164
linearAlgebra::blasLapack::scalar_type< ValueTypeBasisData, ValueTypeBasisCoeff > ValueType
Definition: RDM1FE.h:63
std::vector< double > getkPointWeights() const
Definition: RDM1FE.t.cpp:163
std::unordered_map< WfcDescrAttr, AttrStorage > d_wfcAttrVals
Definition: RDM1FE.h:173
size_type d_cellBlockSize
Definition: RDM1FE.h:170
typename RDM1< ValueType, memorySpace >::AttrStorage AttrStorage
Definition: RDM1FE.h:64
size_type getnKSOrbs() const
Definition: RDM1FE.t.cpp:141
Intermediate abstract class that stores the spectral (eigen) decomposition of the one-particle reduce...
Definition: RDM1Spectral.h:46
std::vector< dftefe::quadrature::QuadratureValuesContainer< double, dftefe::utils::MemorySpace::HOST > > AttrStorage
Definition: RDM1.h:59
Definition: LinAlgOpContext.h:52
DensityObsAttr
Definition: KSAttributes.h:48
SpinMode
Definition: KSAttributes.h:55
typeInternal::scalar_type< ValueType1, ValueType2 > scalar_type
Definition: BlasLapackTypedef.h:183
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
std::uint64_t size_type
Definition: TypeConfig.h:9