-
Notifications
You must be signed in to change notification settings - Fork 34
/
chebyshevOrthogonalizedSubspaceIterationSolverDevice.h
155 lines (137 loc) · 5.33 KB
/
chebyshevOrthogonalizedSubspaceIterationSolverDevice.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// ---------------------------------------------------------------------
//
// Copyright (c) 2017-2022 The Regents of the University of Michigan and DFT-FE
// authors.
//
// This file is part of the DFT-FE code.
//
// The DFT-FE code is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the DFT-FE distribution.
//
// ---------------------------------------------------------------------
//
#if defined(DFTFE_WITH_DEVICE)
# ifndef chebyshevOrthogonalizedSubspaceIterationSolverDevice_h
# define chebyshevOrthogonalizedSubspaceIterationSolverDevice_h
# include "deviceDirectCCLWrapper.h"
# include "headers.h"
# include "operator.h"
# include "elpaScalaManager.h"
# include "dftParameters.h"
# include <BLASWrapper.h>
namespace dftfe
{
/**
* @brief Concrete class implementing Chebyshev filtered orthogonalized subspace
* iteration solver.
* @author Sambit Das, Phani Motamarri
*/
class chebyshevOrthogonalizedSubspaceIterationSolverDevice
{
public:
/**
* @brief Constructor.
*
* @param mpi_comm_parent parent mpi communicator
* @param mpi_comm_domain domain decomposition mpi communicator
* @param lowerBoundWantedSpectrum Lower Bound of the Wanted Spectrum.
* @param lowerBoundUnWantedSpectrum Lower Bound of the UnWanted Spectrum.
*/
chebyshevOrthogonalizedSubspaceIterationSolverDevice(
const MPI_Comm & mpi_comm_parent,
const MPI_Comm & mpi_comm_domain,
double lowerBoundWantedSpectrum,
double lowerBoundUnWantedSpectrum,
double upperBoundUnWantedSpectrum,
const dftParameters &dftParams);
/**
* @brief Solve a generalized eigen problem.
*/
double
solve(operatorDFTClass<dftfe::utils::MemorySpace::DEVICE> &operatorMatrix,
const std::shared_ptr<dftfe::linearAlgebra::BLASWrapper<
dftfe::utils::MemorySpace::DEVICE>> & BLASWrapperPtr,
elpaScalaManager & elpaScala,
dataTypes::number * eigenVectorsFlattenedDevice,
dataTypes::number * eigenVectorsRotFracDensityFlattenedDevice,
const unsigned int flattenedSize,
const unsigned int totalNumberWaveFunctions,
std::vector<double> & eigenValues,
std::vector<double> & residuals,
utils::DeviceCCLWrapper &devicecclMpiCommDomain,
const MPI_Comm & interBandGroupComm,
const bool isFirstFilteringCall,
const bool computeResidual,
const bool useMixedPrecOverall = false,
const bool isFirstScf = false);
/**
* @brief Used for XL-BOMD.
*/
void
solveNoRR(
operatorDFTClass<dftfe::utils::MemorySpace::DEVICE> &operatorMatrix,
const std::shared_ptr<
dftfe::linearAlgebra::BLASWrapper<dftfe::utils::MemorySpace::DEVICE>>
& BLASWrapperPtr,
elpaScalaManager & elpaScala,
dataTypes::number * eigenVectorsFlattenedDevice,
const unsigned int flattenedSize,
const unsigned int totalNumberWaveFunctions,
std::vector<double> & eigenValues,
utils::DeviceCCLWrapper &devicecclMpiCommDomain,
const MPI_Comm & interBandGroupComm,
const unsigned int numberPasses,
const bool useMixedPrecOverall);
/**
* @brief Used for LRD preconditioner, also required for XL-BOMD
*/
void
densityMatrixEigenBasisFirstOrderResponse(
operatorDFTClass<dftfe::utils::MemorySpace::DEVICE> &operatorMatrix,
const std::shared_ptr<
dftfe::linearAlgebra::BLASWrapper<dftfe::utils::MemorySpace::DEVICE>>
& BLASWrapperPtr,
dataTypes::number * eigenVectorsFlattenedDevice,
const unsigned int flattenedSize,
const unsigned int totalNumberWaveFunctions,
const std::vector<double> &eigenValues,
const double fermiEnergy,
std::vector<double> & densityMatDerFermiEnergy,
utils::DeviceCCLWrapper & devicecclMpiCommDomain,
const MPI_Comm & interBandGroupComm,
dftfe::elpaScalaManager & elpaScala);
/**
* @brief reinit spectrum bounds
*/
void
reinitSpectrumBounds(double lowerBoundWantedSpectrum,
double lowerBoundUnWantedSpectrum,
double upperBoundUnWantedSpectrum);
private:
const MPI_Comm d_mpiCommParent;
//
// stores lower bound of wanted spectrum
//
double d_lowerBoundWantedSpectrum;
//
// stores lower bound of unwanted spectrum
//
double d_lowerBoundUnWantedSpectrum;
//
// stores upper bound of unwanted spectrum
//
double d_upperBoundUnWantedSpectrum;
const dftParameters &d_dftParams;
//
// variables for printing out and timing
//
dealii::ConditionalOStream pcout;
dealii::TimerOutput computing_timer;
};
} // namespace dftfe
# endif
#endif