ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
para_kmesh_world.h
Go to the documentation of this file.
1#ifndef PARA_KMESH_WORLD_H
2#define PARA_KMESH_WORLD_H
3
4#include <complex>
5#include <vector>
6
7#include "para_world.h"
8
9namespace Parallel
10{
11
23{
24public:
31 ParaKmeshWorld(int nkstot, int nspin);
32
33#ifdef __MPI
44 ParaKmeshWorld(const MPI_Comm& comm, int kpar, int my_pool, int nproc, int nkstot, int nspin);
45#endif
46
48 int kpar() const { return kpar_; }
49
51 int my_pool() const { return my_pool_; }
52
54 int rank_in_pool() const { return rank_in_pool_; }
55
57 int nproc() const { return nproc_; }
58
60 int nspin() const { return nspin_; }
61
63 int nkstot() const { return nkstot_; }
64
66 int nks_local() const { return nks_local_; }
67
69 int startk_global() const { return startk_global_; }
70
72 int nks_pool(int pool) const;
73
75 int startk_pool(int pool) const;
76
78 int which_pool(int ik_global) const;
79
81 int startpro_pool(int pool) const;
82
84 int max_nks_pool() const;
85
96 void pool_collection(double& value, const double* wk, int ik) const;
97
106 template <typename T>
107 void pool_collection(T* value, const T* w, int dim, int ik) const;
108
118 void gather_kvec(const std::vector<double>& vec_local, std::vector<double>& vec_global) const;
119
120private:
121 void distribute_kpoints();
122
123 int kpar_ = 1;
124 int my_pool_ = 0;
126 int nproc_ = 1;
127 int nspin_ = 1;
128 int nkstot_ = 0;
129 int nks_local_ = 0;
131
132 std::vector<int> nks_pool_;
133 std::vector<int> startk_pool_;
134 std::vector<int> whichpool_;
135 std::vector<int> startpro_pool_;
136};
137
138} // namespace Parallel
139
140#endif // PARA_KMESH_WORLD_H
void gather_kvec(const std::vector< double > &vec_local, std::vector< double > &vec_global) const
Gather local k-point vectors to global array.
Definition para_kmesh_world.cpp:170
int max_nks_pool() const
Maximum number of k-points across all pools.
Definition para_kmesh_world.cpp:91
int my_pool() const
Pool index of this process.
Definition para_kmesh_world.h:51
std::vector< int > nks_pool_
k-points per pool
Definition para_kmesh_world.h:132
std::vector< int > whichpool_
pool index per k-point
Definition para_kmesh_world.h:134
int kpar_
Definition para_kmesh_world.h:123
int nks_pool(int pool) const
Number of k-points in the given pool.
Definition para_kmesh_world.cpp:67
int rank_in_pool_
Definition para_kmesh_world.h:125
int startpro_pool(int pool) const
First MPI_COMM_WORLD rank of the given pool.
Definition para_kmesh_world.cpp:85
void pool_collection(double &value, const double *wk, int ik) const
Collect a scalar value from the pool that owns k-point ik.
Definition para_kmesh_world.cpp:96
int nproc_
Definition para_kmesh_world.h:126
std::vector< int > startpro_pool_
first world rank per pool
Definition para_kmesh_world.h:135
int nks_local() const
Number of k-points in this pool.
Definition para_kmesh_world.h:66
int startk_pool(int pool) const
Global start index of the given pool's k-points.
Definition para_kmesh_world.cpp:73
int startk_global_
Definition para_kmesh_world.h:130
void distribute_kpoints()
Definition para_kmesh_world.cpp:29
int nkstot_
Definition para_kmesh_world.h:128
int which_pool(int ik_global) const
Which pool owns the given global k-point index.
Definition para_kmesh_world.cpp:79
std::vector< int > startk_pool_
global start index per pool
Definition para_kmesh_world.h:133
int nproc() const
Total number of processes.
Definition para_kmesh_world.h:57
int my_pool_
Definition para_kmesh_world.h:124
int kpar() const
Number of pools.
Definition para_kmesh_world.h:48
int startk_global() const
Global start index of this pool's k-points.
Definition para_kmesh_world.h:69
int nspin() const
Number of spin components.
Definition para_kmesh_world.h:60
int rank_in_pool() const
Rank within the pool.
Definition para_kmesh_world.h:54
ParaKmeshWorld(int nkstot, int nspin)
Construct a serial (single-pool) k-mesh domain.
Definition para_kmesh_world.cpp:9
int nks_local_
Definition para_kmesh_world.h:129
int nkstot() const
Total number of k-points (without spin).
Definition para_kmesh_world.h:63
int nspin_
Definition para_kmesh_world.h:127
MPI_Comm comm() const
Underlying MPI communicator (MPI builds only).
Definition para_world.h:60
ParaWorld(const std::string &tag)
Construct a serial (single-process) domain.
Definition para_world.cpp:6
#define T
Definition exp.cpp:237
Definition para_band_output.cpp:11