DFT-EFE
 
Loading...
Searching...
No Matches
RDM1Spectral.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_RDM1Spectral_h
27#define dftefe_RDM1Spectral_h
28
29#include <vector>
30#include <memory>
31#include <ksdft/RDM1.h>
33
34namespace dftefe
35{
36 namespace ksdft
37 {
38 template <typename ValueType, dftefe::utils::MemorySpace memorySpace>
39 class RDM1Access;
40
45 template <typename ValueType, dftefe::utils::MemorySpace memorySpace>
47 {
48 std::unique_ptr<linearAlgebra::MultiVector<ValueType, memorySpace>>
50 std::vector<double> occupancies;
52 };
53
61 template <typename ValueType, dftefe::utils::MemorySpace memorySpace>
62 class RDM1Spectral : public RDM1<ValueType, memorySpace>
63 {
64 public:
66
67 public:
69 virtual ~RDM1Spectral() = default;
70
75 void
77 std::unique_ptr<SpectralRep<ValueType, memorySpace>> spectral);
78
84 getSpectral() const;
85
93 getAccess();
94
95 bool
96 isSpectralSet() const;
97
98 protected:
99 std::unique_ptr<SpectralRep<ValueType, memorySpace>> d_spectral;
101 };
102
109 template <typename ValueType, dftefe::utils::MemorySpace memorySpace>
111 {
113 std::unique_ptr<SpectralRep<ValueType, memorySpace>> d_spectral;
114
115 public:
117 std::unique_ptr<SpectralRep<ValueType, memorySpace>> spectral);
118
119 RDM1Access(const RDM1Access &) = delete;
120 RDM1Access &
121 operator=(const RDM1Access &) = delete;
122
123 RDM1Access(RDM1Access &&other) noexcept;
124
125 ~RDM1Access();
126
128 void
129 returnBack();
130
133 getSpectral();
134 };
135
136 } // namespace ksdft
137} // namespace dftefe
138#include "RDM1Spectral.t.cpp"
139#endif // dftefe_RDM1Spectral_h
Resource Acquisition Is Initialization (RAII) wrapper that temporarily holds the SpectralRep moved ou...
Definition: RDM1Spectral.h:111
void returnBack()
Definition: RDM1Spectral.t.cpp:109
RDM1Spectral< ValueType, memorySpace > * d_owner
Definition: RDM1Spectral.h:112
RDM1Access & operator=(const RDM1Access &)=delete
~RDM1Access()
Definition: RDM1Spectral.t.cpp:101
RDM1Access(const RDM1Access &)=delete
std::unique_ptr< SpectralRep< ValueType, memorySpace > > d_spectral
Definition: RDM1Spectral.h:113
SpectralRep< ValueType, memorySpace > & getSpectral()
Definition: RDM1Spectral.t.cpp:120
Intermediate abstract class that stores the spectral (eigen) decomposition of the one-particle reduce...
Definition: RDM1Spectral.h:63
RDM1Access< ValueType, memorySpace > getAccess()
Resource Acquisition Is Initialization (RAII) access object that moves ownership out for the eigensol...
Definition: RDM1Spectral.t.cpp:63
std::unique_ptr< SpectralRep< ValueType, memorySpace > > d_spectral
Definition: RDM1Spectral.h:99
RDM1Spectral()
Definition: RDM1Spectral.t.cpp:37
virtual ~RDM1Spectral()=default
typename RDM1< ValueType, memorySpace >::AttrStorage AttrStorage
Definition: RDM1Spectral.h:65
bool isSpectralSet() const
Definition: RDM1Spectral.t.cpp:74
bool d_evalFlag
Definition: RDM1Spectral.h:100
const SpectralRep< ValueType, memorySpace > & getSpectral() const
Read-only reference to the spectral data — does not move ownership. Use for Ts / Exc / NLPSP read-onl...
Definition: RDM1Spectral.t.cpp:53
void setSpectral(std::unique_ptr< SpectralRep< ValueType, memorySpace > > spectral)
Store the spectral representation (takes ownership). Sets d_evalFlag = true.
Definition: RDM1Spectral.t.cpp:44
Abstract class for the one-particle reduced density matrix.
Definition: RDM1.h:52
std::vector< dftefe::quadrature::QuadratureValuesContainer< double, dftefe::utils::MemorySpace::HOST > > AttrStorage
Definition: RDM1.h:59
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
std::uint64_t size_type
Definition: TypeConfig.h:9
Plain data bundle holding the KS spectral decomposition: orbitals, occupancies (one vector per k-poin...
Definition: RDM1Spectral.h:47
size_type nKSOrbs
Definition: RDM1Spectral.h:51
std::vector< double > occupancies
Definition: RDM1Spectral.h:50
std::unique_ptr< linearAlgebra::MultiVector< ValueType, memorySpace > > ksOrbs
Definition: RDM1Spectral.h:49