ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
op_pw_exx.h
Go to the documentation of this file.
1#ifndef OPEXXPW_H
2#define OPEXXPW_H
3
4#include "op_pw.h"
11#include "source_cell/klist.h"
13#include "source_psi/psi.h"
14
15#include <memory>
16#include <utility>
17#include <vector>
18
20struct General_Exx_Info;
21
22namespace hamilt
23{
24
25template <typename T, typename Device>
26class OperatorEXXPW : public OperatorPW<T, Device>
27{
28 private:
29 using Real = typename GetTypeReal<T>::type;
30
31 public:
33 const int *isk_in,
34 const ModulePW::PW_Basis_K *wfcpw_in,
35 const ModulePW::PW_Basis *rhopw_in,
36 K_Vectors *kv_in,
37 const UnitCell *ucell,
38 const General_Exx_Info &exx_info,
39 const int nspin_in,
40 const int kpar_in,
41 const int my_rank_in,
42 const int my_pool_in);
43
44 template <typename T_in, typename Device_in = Device>
45 explicit OperatorEXXPW(const OperatorEXXPW<T_in, Device_in> *op_exx);
46
47 virtual ~OperatorEXXPW();
48
49 virtual void act(
50 const int nbands,
51 const int nbasis,
52 const int npol,
53 const T *tmpsi_in,
54 T *tmhpsi,
55 const int ngk_ik = 0,
56 const bool is_first_node = false) const override;
57
58 double cal_exx_energy(psi::Psi<T, Device> *psi_) const;
59
60 void set_psi(psi::Psi<T, Device> &psi_in) const { psi = psi_in; }
61
62 void set_wg(const ModuleBase::matrix *wg_in) { wg = wg_in; }
63
64 // The source orbitals remain fixed while target states are diagonalized.
65 // Takes ownership of the frozen ensemble: the operator keeps observer pointers
66 // to these objects, so their lifetime must match the operator's own.
67 void set_source(
68 std::unique_ptr<ModulePW::PW_Basis_K> source_basis,
69 std::unique_ptr<K_Vectors> source_points,
70 const psi::Psi<T, Device> &source_psi,
71 ModuleBase::matrix source_weights);
72
73 void construct_ace() const;
74
75 bool first_iter = true;
76 bool separate_loop = false;
79
80 static std::vector<Real> fock_div, erfc_div;
81
82 private:
83 const int *isk = nullptr;
84 const ModulePW::PW_Basis_K *wfcpw = nullptr;
86 const K_Vectors *source_points_ = nullptr;
87 // Owned frozen SCF source for hybrid NSCF; null in ordinary SCF, where the
88 // observer pointers above alias wfcpw/kv instead.
89 std::unique_ptr<ModulePW::PW_Basis_K> owned_source_basis_;
90 std::unique_ptr<K_Vectors> owned_source_points_;
92 const ModulePW::PW_Basis *rhopw = nullptr;
93 ModulePW::PW_Basis *rhopw_dev = nullptr; // for device
94 const UnitCell *ucell = nullptr;
96
97 // INPUT/runtime configuration snapshotted at construction, so the
98 // operator never touches the global parameter objects itself
99 int nspin_ = 1;
100 double ecut_exx_ = 0.0; // resolved EXX cutoff (Ry)
101 bool ecutexx_user_set_ = false; // gates the small-grid fallback warnings
102 int exx_batch_size_ = 0; // band chunk width, 0 = all bands
103 bool exxace_ = false;
104 int my_rank_ = 0; // world rank, gates the one-time reports
105 int my_pool_ = 0; // k-point pool of this rank
106
107 std::vector<int> get_q_points(const int ik) const;
108 const T *get_pw(const int m, const int iq) const;
109
110 void multiply_potential(T *density_recip, int ik, int iq) const;
111
112 void act_op(
113 const int nbands,
114 const int nbasis,
115 const int npol,
116 const T *tmpsi_in,
117 T *tmhpsi,
118 const int ngk_ik = 0,
119 const bool is_first_node = false) const;
120
121 // Both active and idle ACE pools join the same source-q broadcasts.
122 // has_kpoint identifies a local target k point in the current spin channel.
123 void act_op_kpar(
124 const int nbands,
125 const int nbasis,
126 const T *tmpsi_in,
127 T *tmhpsi,
128 const int ispin,
129 const bool has_kpoint) const;
130
131 void act_op_ace(
132 const int nbands,
133 const int nbasis,
134 const int npol,
135 const T *tmpsi_in,
136 T *tmhpsi,
137 const int ngk_ik = 0,
138 const bool is_first_node = false) const;
139
140 double cal_exx_energy_op(psi::Psi<T, Device> *psi_) const;
141
142 double cal_exx_energy_ace(psi::Psi<T, Device> *psi_) const;
143
144 void cal_density_recip(const T *psi_nk_real, const T *psi_mq_real, double omega) const;
145
147 const T *rho_recip,
148 T *rho_real,
149 bool add = false,
150 Real factor = 1.0) const;
151
152 mutable int cnt = 0;
153
154 mutable bool potential_got = false;
155
156 // pws
157 // mutable std::vector<std::unique_ptr<T[]>> pws;
158
159 // k vectors
160 K_Vectors *kv = nullptr;
161
162 // psi
165
166 // real space memory
167 T *psi_nk_real = nullptr;
168 T *psi_mq_real = nullptr;
169 // cache of psi_nk in real space for all bands on the active grid
170 mutable T *psi_nk_real_cache = nullptr;
171 mutable int psi_nk_cache_size = 0; // number of bands currently allocated in the cache
172
173 // ---- EXX FFT grid + band-batch layer ----
174 // All EXX PW entry points (act_op, act_op_kpar,
175 // cal_exx_energy_op) share one code path built on these primitives; the
176 // batched kernels are a specialization of the per-band operations,
177 // selected inside the primitives (exx_grid_active). The active real-space
178 // grid is the small ecut_exx box when usable, else the wfcpw box;
179 // callers must not branch on this themselves.
180 void maybe_setup_exx_grid() const;
181 // whether the map-based (batched-kernel) path can run at all: the small
182 // grid is usable, or the full box is local to this rank
183 bool exx_grid_active() const;
184 // band chunk width of one batched round, 1..nbands: the exx_batch_size
185 // INPUT (0 = all bands). Only meaningful when exx_grid_active(); the
186 // result is independent of the chunking.
187 int exx_band_chunk(const int nbands) const;
188 int exx_grid_size() const { return exx_sg_ok ? sg_nxyz : wfcpw->nrxx; }
189 // G-vector -> active FFT box index maps, hiding the grid choice: the
190 // small-grid maps when exx_sg_ok, the basis's own ig2ixyz arrays on CUDA,
191 // and the host-built full-box maps (full_map_*) on CPU otherwise
192 const int *active_map_rho() const;
193 const int *active_map_wfc(const int ik) const;
194 // fill psi_nk_real_cache: all bands of psi_in at k-point ik, real space on
195 // the active grid
197 const int nbands,
198 const int nbasis,
199 const T *psi_in,
200 const int ik) const;
201 // psi_mq_real: single band psi_m at k-point iq, real space on the active
202 // grid (psi_m points to a band block with row stride psi_stride)
203 void wfc_to_real_exx(const T *psi_m, const int iq, const int psi_stride) const;
204 // tmhpsi += factor * V_x|psi> for all bands; needs psi_nk_real_cache and
205 // psi_mq_real filled, and `pot` holding the Coulomb kernel for (ik, iq)
207 const int nbands,
208 const int nbasis,
209 const int iq,
210 const Real factor,
211 T *tmhpsi) const;
212 // pair densities psi_nk* psi_mq of bands [start, start+count) in the
213 // rhopw_dev G-space; pair_density(n) then returns band n (global index)
214 // without recomputation
215 void prepare_pair_densities(const int start, const int count) const;
216 const T *pair_density(const int n) const;
217
218 // Small EXX FFT grid sized by ecut_exx (like QE's dfftt): when usable, the
219 // batched path runs all FFTs on this smaller grid instead of the wfcpw grid.
220 // Requires all |k+G|^2 < ecut_exx (otherwise the wavefunctions do not fit).
221 // Available on CPU and CUDA; on ROCm the GPU path keeps the full grid
222 // (exx_sg_ok stays false there).
223 void setup_exx_small_grid() const;
224 // host-built full-box maps for the batched path on CPU when the small
225 // grid is not active (the GPU bases own these as ig2ixyz*)
226 void setup_full_grid_maps() const;
227 mutable bool exx_sg_init = false;
228 mutable bool exx_sg_ok = false;
229 mutable int sg_nx = 0, sg_ny = 0, sg_nz = 0, sg_nxyz = 0;
230 mutable int *sg_map_rho = nullptr; // rhopw_dev G-vector ig -> small box index [rhopw_dev->npw]
231 mutable int *sg_map_wfc = nullptr; // wfcpw (G+k) ig -> small box index [npwk_max * nks]
232 mutable int *full_map_rho = nullptr; // rhopw_dev G-vector ig -> full box index (CPU only)
233 mutable int *full_map_wfc = nullptr; // wfcpw (G+k) ig -> full box index (CPU only)
234
235 // Batched n-band loop of act_op / act_op_kpar: all bands of one
236 // (iq, m_iband) pair are processed with batched FFTs and a handful of
237 // kernel launches instead of ~8 launches per band. Requires the psi_nk
238 // real-space cache and a local (non-distributed) FFT box. `factor` is the
239 // full accumulation weight (including hybrid_alpha and the k/q weights).
241 const int nbands,
242 const int nbasis,
243 const T *psi_mq_real,
244 const Real factor,
245 T *tmhpsi) const;
246
247 // reciprocal-space density of bands [0, nbands) of the nk_real block
248 // (rhopw_dev G-space), ends up in dens_pw_batch
249 void calc_density_pw_nbatched(const int nbands, const T *nk_real, const T *psi_mq_real) const;
250
251 mutable void *exx_fft_plan = nullptr; // batched FFT plan (void* to keep FFTW/cuFFT out of the header)
252 mutable void *exx_fft_plan1 = nullptr; // batch-1 FFT plan (psi_mq on the active grid)
253 mutable int exx_fft_plan_nx = 0; // grid dims the plans were created for
254 mutable int exx_fft_plan_ny = 0;
255 mutable int exx_fft_plan_nz = 0;
256 mutable T *dens_box_batch = nullptr; // band-chunk * nxyz box buffer
257 mutable T *dens_pw_batch = nullptr; // band-chunk * npw (rhopw_dev) plane-wave buffer
258 mutable int exx_batch_alloc = 0; // band chunk width the buffers/plan are allocated for
259 mutable int dens_chunk_base = 0; // global band index of dens_pw_batch[0]
260
261 // create/recreate the batched FFT plans and work buffers for the active grid
262 void ensure_exx_batch(const int nbands) const;
263 T *density_real = nullptr;
264 T *h_psi_real = nullptr;
265 // density recip space memory
266 T *density_recip = nullptr;
267 // h_psi recip space memory
268 T *h_psi_recip = nullptr;
269 Real *pot = nullptr;
270
271 // Lin Lin's ACE memory, 10.1021/acs.jctc.6b00092
272 mutable T *h_psi_ace = nullptr; // H \Psi, W in the paper
273 mutable T *psi_h_psi_ace = nullptr; // \Psi^{\dagger} H \Psi, M in the paper
274 mutable T *L_ace = nullptr; // cholesky(-M).L, L in the paper
275 mutable std::vector<T *> Xi_ace_k; // L^{-1} (H \Psi)^{\dagger}, \Xi in the paper
276 // mutable T* Xi_ace = nullptr; // L^{-1} (H \Psi)^{\dagger}, \Xi in the paper
277
278 mutable std::map<int, std::vector<int>> q_points;
279
280 // occupational number
282
283 // mutable bool update_psi = false;
284
285 Device *ctx = {};
286 base_device::DEVICE_CPU *cpu_ctx = {};
288
312
314};
315
316// Explicit specializations must be declared before any implicit instantiation.
317// The extern template declarations below would otherwise instantiate the
318// generic cal_density_recip / rho_recip2real members.
319template <>
321 const std::complex<double> *psi_nk_real, const std::complex<double> *psi_mq_real, double omega) const;
322
323template <>
325 const std::complex<float> *psi_nk_real, const std::complex<float> *psi_mq_real, double omega) const;
326
327template <>
329 const std::complex<double> *rho_recip,
330 std::complex<double> *rho_real,
331 bool add,
332 double factor) const;
333
334template <>
336 const std::complex<float> *rho_recip,
337 std::complex<float> *rho_real,
338 bool add,
339 float factor) const;
340
341#if ((defined __CUDA) || (defined __ROCM))
342template <>
343void OperatorEXXPW<std::complex<double>, base_device::DEVICE_GPU>::cal_density_recip(
344 const std::complex<double> *psi_nk_real, const std::complex<double> *psi_mq_real, double omega) const;
345
346template <>
347void OperatorEXXPW<std::complex<float>, base_device::DEVICE_GPU>::cal_density_recip(
348 const std::complex<float> *psi_nk_real, const std::complex<float> *psi_mq_real, double omega) const;
349
350template <>
351void OperatorEXXPW<std::complex<double>, base_device::DEVICE_GPU>::rho_recip2real(
352 const std::complex<double> *rho_recip,
353 std::complex<double> *rho_real,
354 bool add,
355 double factor) const;
356
357template <>
358void OperatorEXXPW<std::complex<float>, base_device::DEVICE_GPU>::rho_recip2real(
359 const std::complex<float> *rho_recip,
360 std::complex<float> *rho_real,
361 bool add,
362 float factor) const;
363#endif
364
365extern template class OperatorEXXPW<std::complex<float>, base_device::DEVICE_CPU>;
366extern template class OperatorEXXPW<std::complex<double>, base_device::DEVICE_CPU>;
367#if ((defined __CUDA) || (defined __ROCM))
368extern template class OperatorEXXPW<std::complex<float>, base_device::DEVICE_GPU>;
369extern template class OperatorEXXPW<std::complex<double>, base_device::DEVICE_GPU>;
370#endif
371
372template <typename Real, typename Device>
374 const K_Vectors *kv,
377 Real *pot,
378 double tpiba,
380 double ucell_omega,
381 int ik,
382 int iq,
383 bool is_stress,
384 const CoulombParam &coulomb_param_in);
385
386template <typename Real, typename Device>
388 const K_Vectors *kv,
391 Real *pot,
392 double tpiba,
394 double ucell_omega,
395 int ik,
396 int iq,
397 const CoulombParam &coulomb_param_in);
398
399double exx_divergence(
401 double erfc_omega,
402 const K_Vectors *kv,
405 double tpiba,
407 double ucell_omega);
408
409} // namespace hamilt
410
411#endif // OPEXXPW_H
Class for k-points management.
Definition klist.h:20
Definition matrix.h:15
Special pw_basis class. It includes different k-points.
Definition pw_basis_k.h:56
A class which can convert a function of "r" to the corresponding linear superposition of plane waves ...
Definition pw_basis.h:60
Provide the basic information about unitcell.
Definition unitcell.h:16
bool first_iter
Definition op_pw_exx.h:75
container::kernels::lapack_potrf< T, ct_Device > lapack_potrf
Definition op_pw_exx.h:310
T * dens_pw_batch
Definition op_pw_exx.h:257
T * h_psi_real
Definition op_pw_exx.h:264
base_device::memory::resize_memory_op< Real, Device > resmem_real_op
Definition op_pw_exx.h:296
void multiply_potential(T *density_recip, int ik, int iq) const
Definition op_pw_exx.cpp:978
int psi_nk_cache_size
Definition op_pw_exx.h:171
void apply_fock_all_bands(const int nbands, const int nbasis, const int iq, const Real factor, T *tmhpsi) const
Definition op_pw_exx.cpp:597
void * exx_fft_plan1
Definition op_pw_exx.h:252
int nspin_
Definition op_pw_exx.h:99
bool separate_loop
Definition op_pw_exx.h:76
const int * isk
Definition op_pw_exx.h:83
void set_wg(const ModuleBase::matrix *wg_in)
Definition op_pw_exx.h:62
bool exx_grid_active() const
Definition op_pw_exx.cpp:483
T * density_recip
Definition op_pw_exx.h:266
int sg_nz
Definition op_pw_exx.h:229
int exx_fft_plan_ny
Definition op_pw_exx.h:254
int exx_fft_plan_nz
Definition op_pw_exx.h:255
int my_pool_
Definition op_pw_exx.h:105
T * density_real
Definition op_pw_exx.h:263
int exx_grid_size() const
Definition op_pw_exx.h:188
base_device::memory::set_memory_op< Real, Device > setmem_real_op
Definition op_pw_exx.h:291
void set_source(std::unique_ptr< ModulePW::PW_Basis_K > source_basis, std::unique_ptr< K_Vectors > source_points, const psi::Psi< T, Device > &source_psi, ModuleBase::matrix source_weights)
Definition op_pw_exx.cpp:239
Real hybrid_alpha
Definition op_pw_exx.h:77
base_device::memory::resize_memory_op< int, Device > resmem_int_op
Definition op_pw_exx.h:306
base_device::memory::synchronize_memory_op< Real, Device, base_device::DEVICE_CPU > syncmem_real_c2d_op
Definition op_pw_exx.h:304
ModulePW::PW_Basis * rhopw_dev
Definition op_pw_exx.h:93
void cache_psi_nk_real(const int nbands, const int nbasis, const T *psi_in, const int ik) const
Definition op_pw_exx.cpp:545
base_device::memory::set_memory_op< Real, base_device::DEVICE_CPU > setmem_real_cpu_op
Definition op_pw_exx.h:292
int exx_fft_plan_nx
Definition op_pw_exx.h:253
int * full_map_rho
Definition op_pw_exx.h:232
Real tpiba
Definition op_pw_exx.h:95
base_device::memory::synchronize_memory_op< int, base_device::DEVICE_CPU, Device > syncmem_int_d2h_op
Definition op_pw_exx.h:309
base_device::memory::synchronize_memory_op< T, Device, base_device::DEVICE_CPU > syncmem_complex_c2d_op
Definition op_pw_exx.h:302
void ensure_exx_batch(const int nbands) const
Definition op_pw_exx.cpp:849
base_device::memory::synchronize_memory_op< int, Device, base_device::DEVICE_CPU > syncmem_int_h2d_op
Definition op_pw_exx.h:308
base_device::memory::synchronize_memory_op< T, Device, Device > syncmem_complex_op
Definition op_pw_exx.h:295
base_device::memory::synchronize_memory_op< T, base_device::DEVICE_CPU, Device > syncmem_complex_d2c_op
Definition op_pw_exx.h:303
static std::vector< Real > erfc_div
Definition op_pw_exx.h:80
std::vector< T * > Xi_ace_k
Definition op_pw_exx.h:275
base_device::memory::delete_memory_op< T, Device > delmem_complex_op
Definition op_pw_exx.h:294
bool exxace_
Definition op_pw_exx.h:103
base_device::memory::resize_memory_op< T, Device > resmem_complex_op
Definition op_pw_exx.h:293
int cnt
Definition op_pw_exx.h:152
bool exx_sg_init
Definition op_pw_exx.h:227
double ecut_exx_
Definition op_pw_exx.h:100
T * dens_box_batch
Definition op_pw_exx.h:256
void cal_density_recip(const T *psi_nk_real, const T *psi_mq_real, double omega) const
double cal_exx_energy_op(psi::Psi< T, Device > *psi_) const
Definition op_pw_exx.cpp:1048
const T * pair_density(const int n) const
Definition op_pw_exx.cpp:641
std::map< int, std::vector< int > > q_points
Definition op_pw_exx.h:278
base_device::AbacusDevice_t device
Definition op_pw_exx.h:287
bool exx_sg_ok
Definition op_pw_exx.h:228
const K_Vectors * source_points_
Definition op_pw_exx.h:86
T * psi_nk_real
Definition op_pw_exx.h:167
base_device::memory::synchronize_memory_op< Real, base_device::DEVICE_CPU, Device > syncmem_real_d2c_op
Definition op_pw_exx.h:305
const ModuleBase::matrix * wg
Definition op_pw_exx.h:164
int exx_batch_alloc
Definition op_pw_exx.h:258
virtual ~OperatorEXXPW()
Definition op_pw_exx.cpp:137
base_device::memory::delete_memory_op< Real, Device > delmem_real_op
Definition op_pw_exx.h:297
void setup_exx_small_grid() const
Definition op_pw_exx.cpp:652
std::unique_ptr< K_Vectors > owned_source_points_
Definition op_pw_exx.h:90
void rho_recip2real(const T *rho_recip, T *rho_real, bool add=false, Real factor=1.0) const
bool ecutexx_user_set_
Definition op_pw_exx.h:101
const ModuleBase::matrix * p_wg
Definition op_pw_exx.h:281
T * psi_nk_real_cache
Definition op_pw_exx.h:170
int exx_batch_size_
Definition op_pw_exx.h:102
Device * ctx
Definition op_pw_exx.h:285
container::kernels::lapack_trtri< T, ct_Device > lapack_trtri
Definition op_pw_exx.h:311
void construct_ace() const
Definition op_pw_exx_ace.cpp:54
int * sg_map_wfc
Definition op_pw_exx.h:231
int sg_nx
Definition op_pw_exx.h:229
const int * active_map_rho() const
Definition op_pw_exx.cpp:513
void act_op(const int nbands, const int nbasis, const int npol, const T *tmpsi_in, T *tmhpsi, const int ngk_ik=0, const bool is_first_node=false) const
Definition op_pw_exx.cpp:290
void act_op_kpar(const int nbands, const int nbasis, const T *tmpsi_in, T *tmhpsi, const int ispin, const bool has_kpoint) const
Definition op_pw_exx.cpp:354
int * sg_map_rho
Definition op_pw_exx.h:230
const T * get_pw(const int m, const int iq) const
Definition op_pw_exx.cpp:992
int my_rank_
Definition op_pw_exx.h:104
ModuleBase::vector_add_vector_op< T, Device, Real > vec_add_vec_complex_op
Definition op_pw_exx.h:300
double cal_exx_energy_ace(psi::Psi< T, Device > *psi_) const
Definition op_pw_exx_ace.cpp:196
ModuleBase::axpy_op< T, Device > axpy_complex_op
Definition op_pw_exx.h:299
void maybe_setup_exx_grid() const
Definition op_pw_exx.cpp:453
ModuleBase::dot_real_op< T, Device > dot_op
Definition op_pw_exx.h:301
typename ct::PsiToContainer< Device >::type ct_Device
Definition op_pw_exx.h:289
void calc_density_pw_nbatched(const int nbands, const T *nk_real, const T *psi_mq_real) const
Definition op_pw_exx.cpp:917
int * full_map_wfc
Definition op_pw_exx.h:233
static std::vector< Real > fock_div
Definition op_pw_exx.h:80
int exx_band_chunk(const int nbands) const
Definition op_pw_exx.cpp:503
void * exx_fft_plan
Definition op_pw_exx.h:251
void wfc_to_real_exx(const T *psi_m, const int iq, const int psi_stride) const
Definition op_pw_exx.cpp:582
const ModulePW::PW_Basis_K * wfcpw
Definition op_pw_exx.h:84
T * h_psi_recip
Definition op_pw_exx.h:268
OperatorEXXPW(const int *isk_in, const ModulePW::PW_Basis_K *wfcpw_in, const ModulePW::PW_Basis *rhopw_in, K_Vectors *kv_in, const UnitCell *ucell, const General_Exx_Info &exx_info, const int nspin_in, const int kpar_in, const int my_rank_in, const int my_pool_in)
Definition op_pw_exx.cpp:37
const ModulePW::PW_Basis * rhopw
Definition op_pw_exx.h:92
base_device::memory::delete_memory_op< int, Device > delmem_int_op
Definition op_pw_exx.h:307
void set_psi(psi::Psi< T, Device > &psi_in) const
Definition op_pw_exx.h:60
void act_op_ace(const int nbands, const int nbasis, const int npol, const T *tmpsi_in, T *tmhpsi, const int ngk_ik=0, const bool is_first_node=false) const
Definition op_pw_exx_ace.cpp:11
const ModulePW::PW_Basis_K * source_basis_
Definition op_pw_exx.h:85
void setup_full_grid_maps() const
Definition op_pw_exx.cpp:810
T * h_psi_ace
Definition op_pw_exx.h:272
int sg_nxyz
Definition op_pw_exx.h:229
int dens_chunk_base
Definition op_pw_exx.h:259
ModuleBase::matrix owned_source_weights_
Definition op_pw_exx.h:91
void apply_exx_nbatched(const int nbands, const int nbasis, const T *psi_mq_real, const Real factor, T *tmhpsi) const
Definition op_pw_exx.cpp:877
bool gamma_extrapolation
Definition op_pw_exx.h:313
double cal_exx_energy(psi::Psi< T, Device > *psi_) const
Definition op_pw_exx.cpp:1035
CoulombParam coulomb_param
Definition op_pw_exx.h:78
Real * pot
Definition op_pw_exx.h:269
ModuleBase::gemm_op< T, Device > gemm_complex_op
Definition op_pw_exx.h:298
base_device::DEVICE_CPU * cpu_ctx
Definition op_pw_exx.h:286
std::vector< int > get_q_points(const int ik) const
Definition op_pw_exx.cpp:934
base_device::memory::set_memory_op< T, Device > setmem_complex_op
Definition op_pw_exx.h:290
int sg_ny
Definition op_pw_exx.h:229
K_Vectors * kv
Definition op_pw_exx.h:160
T * psi_mq_real
Definition op_pw_exx.h:168
T * psi_h_psi_ace
Definition op_pw_exx.h:273
typename GetTypeReal< T >::type Real
Definition op_pw_exx.h:29
void prepare_pair_densities(const int start, const int count) const
Definition op_pw_exx.cpp:629
std::unique_ptr< ModulePW::PW_Basis_K > owned_source_basis_
Definition op_pw_exx.h:89
T * L_ace
Definition op_pw_exx.h:274
bool potential_got
Definition op_pw_exx.h:154
const UnitCell * ucell
Definition op_pw_exx.h:94
const int * active_map_wfc(const int ik) const
Definition op_pw_exx.cpp:529
virtual void act(const int nbands, const int nbasis, const int npol, const T *tmpsi_in, T *tmhpsi, const int ngk_ik=0, const bool is_first_node=false) const override
Definition op_pw_exx.cpp:206
Definition op_pw.h:9
int ik
Definition operator.h:123
virtual void add(Operator *next)
Definition operator.cpp:117
bool is_first_node
Definition operator.h:131
Definition psi.h:37
std::map< Conv_Coulomb_Pot_K::Coulomb_Type, std::vector< std::map< std::string, std::string > > > CoulombParam
Definition coulomb_config.h:29
#define T
Definition exp.cpp:237
Coulomb_Type
Definition coulomb_config.h:11
AbacusDevice_t
Definition types.h:12
Definition wf_op.cpp:6
void get_exx_stress_potential(const K_Vectors *kv, const ModulePW::PW_Basis_K *wfcpw, ModulePW::PW_Basis *rhopw_dev, Real *pot, double tpiba, bool gamma_extrapolation, double ucell_omega, int ik, int iq, const CoulombParam &coulomb_param_in)
Definition op_pw_exx_pot.cpp:264
double exx_divergence(Conv_Coulomb_Pot_K::Coulomb_Type coulomb_type, double erfc_omega, const K_Vectors *kv, const ModulePW::PW_Basis_K *wfcpw, ModulePW::PW_Basis *rhopw_dev, double tpiba, bool gamma_extrapolation, double ucell_omega)
Definition op_pw_exx_pot.cpp:444
void get_exx_potential(const K_Vectors *kv, const ModulePW::PW_Basis_K *wfcpw, ModulePW::PW_Basis *rhopw_dev, Real *pot, double tpiba, bool gamma_extrapolation, double ucell_omega, int ik, int iq, bool is_stress, const CoulombParam &coulomb_param_in)
Definition op_pw_exx_pot.cpp:60
Definition diag_lcao.h:14
Definition general_exx_info.h:11
T type
Definition macros.h:8
Definition math_kernel_op.h:178
Definition math_kernel_op.h:230
Definition math_kernel_op.h:298
Definition math_kernel_op.h:197
Definition memory_op.h:115
Definition memory_op.h:17
Definition memory_op.h:31
T type
Definition tensor_types.h:76
Definition lapack.h:36
Definition lapack.h:25
iclock::time_point start
Definition test_partition.cpp:22