ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
sto_wf.h
Go to the documentation of this file.
1#ifndef STOCHASTIC_WF_H
2#define STOCHASTIC_WF_H
3
5#include "source_cell/klist.h"
6#include "source_psi/psi.h"
7
8//----------------------------------------------
9// Generate stochastic wave functions
10//----------------------------------------------
11template <typename T, typename Device = base_device::DEVICE_CPU>
13{
14 public:
16
18
19 void init(K_Vectors* p_kv, const int npwx_in);
20
21 // origin stochastic wavefunctions in CPU
23 // origin stochastic wavefunctions in GPU or CPU
25 // stochastic wavefunctions after in reciprocal space orthogonalized with KS wavefunctions
27 // sqrt(f(H))|chi>
29 int nchi = 0;
30 int* nchip = nullptr;
31 int nchip_max = 0;
32 int nks = 0;
33 int npwx = 0;
34 int nbands_diag = 0;
35 int nbands_total = 0;
36 std::vector<int> ngk;
37 public:
38 // Tn(H)|chi>
40 // allocate chiallorder
41 void allocate_chiallorder(const int& norder);
42 // chiallorder cost too much memories and should be cleaned after scf.
43 void clean_chiallorder();
44
45 public:
46 // init stochastic orbitals
47 void init_sto_orbitals(const int seed_in);
48 // init stochastic orbitals from a large Ecut
49 // It can test the convergence of SDFT with respect to Ecut
50 void init_sto_orbitals_Ecut(const int seed_in,
51 const K_Vectors& kv,
52 const ModulePW::PW_Basis_K& wfcpw,
53 const int max_ecut);
54 // allocate chi0
55 void allocate_chi0();
56 // update stochastic orbitals
57 void update_sto_orbitals(const int seed_in);
58 // init complete orbitals
59 void init_com_orbitals();
60 // sync chi0 from CPU to GPU
61 void sync_chi0();
62
63 protected:
66};
67#endif
Definition klist.h:13
Special pw_basis class. It includes different k-points.
Definition pw_basis_k.h:57
Definition sto_wf.h:13
psi::Psi< T, Device > * chiallorder
Definition sto_wf.h:39
std::vector< int > ngk
ngk in klist
Definition sto_wf.h:36
~Stochastic_WF()
Definition hsolver_supplementary_mock.h:108
void init_com_orbitals()
Definition sto_wf.cpp:166
void clean_chiallorder()
Definition sto_wf.cpp:60
psi::Psi< T, Device > * chiortho
Definition sto_wf.h:26
psi::Psi< T, Device > * chi0
Definition sto_wf.h:24
void init_sto_orbitals_Ecut(const int seed_in, const K_Vectors &kv, const ModulePW::PW_Basis_K &wfcpw, const int max_ecut)
Definition sto_wf.cpp:296
int nks
number of k-points
Definition sto_wf.h:32
void allocate_chi0()
Definition sto_wf.cpp:83
int npwx
max ngk[ik] in all processors
Definition sto_wf.h:33
int nchi
Total number of stochatic obitals.
Definition sto_wf.h:29
Stochastic_WF()
Definition hsolver_supplementary_mock.h:99
void sync_chi0()
Definition sto_wf.cpp:372
void update_sto_orbitals(const int seed_in)
Definition sto_wf.cpp:135
void init_sto_orbitals(const int seed_in)
Definition sto_wf.cpp:67
int nbands_diag
number of bands obtained from diagonalization
Definition sto_wf.h:34
int nbands_total
number of bands in total, nbands_total=nchi+nbands_diag;
Definition sto_wf.h:35
int * nchip
The number of stochatic orbitals in current process of each k point.
Definition sto_wf.h:30
psi::Psi< T, Device > * shchi
Definition sto_wf.h:28
psi::Psi< T, base_device::DEVICE_CPU > * chi0_cpu
Definition sto_wf.h:22
int nchip_max
Max number of stochastic orbitals among all k points.
Definition sto_wf.h:31
void init(K_Vectors *p_kv, const int npwx_in)
Definition hsolver_supplementary_mock.h:117
void allocate_chiallorder(const int &norder)
Definition sto_wf.cpp:49
Definition psi.h:37
Definition memory_op.h:31