ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
parallel_kpoints.h
Go to the documentation of this file.
1#ifndef PARALLEL_KPOINTS_H
2#define PARALLEL_KPOINTS_H
3
8
10{
11 public:
14
15 void kinfo(int& nkstot_in,
16 const int& kpar_in,
17 const int& my_pool_in,
18 const int& rank_in_pool_in,
19 const int& nproc_in,
20 const int& nspin_in);
21
22 // collect value from each pool to wk.
23 void pool_collection(double& value, const double* wk, const int& ik);
24
25 // collect value from each pool to overlap.
26 void pool_collection(double* valuea,
27 double* valueb,
28 const ModuleBase::realArray& a,
29 const ModuleBase::realArray& b,
30 const int& ik);
31 void pool_collection(std::complex<double>* value, const ModuleBase::ComplexArray& w, const int& ik) const;
32 template <class T, class V>
33 void pool_collection_aux(T* value, const V& w, const int& dim, const int& ik) const;
34#ifdef __MPI
41 void gatherkvec(const std::vector<ModuleBase::Vector3<double>>& vec_local,
42 std::vector<ModuleBase::Vector3<double>>& vec_global) const;
43#endif
44
45 // information about pool, dim: KPAR
46 // int* nproc_pool = nullptr; it is not used
47
48 // inforamation about kpoints, dim: KPAR
49 std::vector<int> nks_pool; // number of k-points in each pool, here use k-points without spin
50 std::vector<int> startk_pool; // the first k-point in each pool, here use k-points without spin
51
52 // information about which pool each k-point belongs to,
53 std::vector<int> whichpool; // whichpool[k] : the pool which k belongs to, dim: nkstot_np
54
55 int nkstot_np = 0; // number of k-points without spin, kv.set_nkstot(nkstot_np) * nspin(1 or 2)
56 int nks_np = 0; // number of k-points without spin in the present pool
57
58 // get the first processor in the pool
59 int get_startpro_pool(const int& pool) const
60
61 {
62 return startpro_pool[pool];
63 }
64
65 // get the maximum number of k-points in all pools
66 int get_max_nks_pool() const
67 {
68 return *std::max_element(nks_pool.begin(), nks_pool.end());
69 }
70
71 public:
72 int kpar = 0; // number of pools
73 int my_pool = 0; // the pool index of the present processor
74 int rank_in_pool = 0; // the rank in the present pool
75 int nproc = 1; // number of processors
76 int nspin = 1; // number of spins
77 private:
78 std::vector<int> startpro_pool; // the first processor in each pool
79#ifdef __MPI
80 void get_nks_pool(const int& nkstot);
81 void get_startk_pool(const int& nkstot);
82 void get_whichpool(const int& nkstot);
83
84 void set_startpro_pool();
85#endif
86};
87
88#endif
A basic type of data for complex array.
Definition complexarray.h:15
3 elements vector
Definition vector3.h:22
double float array
Definition realarray.h:21
Definition parallel_kpoints.h:10
void get_whichpool(const int &nkstot)
Definition parallel_kpoints.cpp:47
void get_nks_pool(const int &nkstot)
Definition parallel_kpoints.cpp:63
Parallel_Kpoints()
Definition parallel_kpoints.h:12
~Parallel_Kpoints()
Definition parallel_kpoints.h:13
void pool_collection(double &value, const double *wk, const int &ik)
Definition parallel_kpoints.cpp:132
void set_startpro_pool()
Definition parallel_kpoints.cpp:93
int nspin
Definition parallel_kpoints.h:76
std::vector< int > whichpool
Definition parallel_kpoints.h:53
void kinfo(int &nkstot_in, const int &kpar_in, const int &my_pool_in, const int &rank_in_pool_in, const int &nproc_in, const int &nspin_in)
Definition parallel_kpoints.cpp:7
int nkstot_np
Definition parallel_kpoints.h:55
std::vector< int > nks_pool
Definition parallel_kpoints.h:49
int get_startpro_pool(const int &pool) const
Definition parallel_kpoints.h:59
int nks_np
Definition parallel_kpoints.h:56
void pool_collection_aux(T *value, const V &w, const int &dim, const int &ik) const
Definition parallel_kpoints.cpp:205
int nproc
Definition parallel_kpoints.h:75
std::vector< int > startpro_pool
Definition parallel_kpoints.h:78
int kpar
Definition parallel_kpoints.h:72
std::vector< int > startk_pool
Definition parallel_kpoints.h:50
void gatherkvec(const std::vector< ModuleBase::Vector3< double > > &vec_local, std::vector< ModuleBase::Vector3< double > > &vec_global) const
gather kpoints from all processors
Definition parallel_kpoints.cpp:114
int get_max_nks_pool() const
Definition parallel_kpoints.h:66
int my_pool
Definition parallel_kpoints.h:73
int rank_in_pool
Definition parallel_kpoints.h:74
void get_startk_pool(const int &nkstot)
Definition parallel_kpoints.cpp:81
#define T
Definition exp.cpp:237