ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
get_pchg_pw.h
Go to the documentation of this file.
1#ifndef GET_PCHG_PW_H
2#define GET_PCHG_PW_H
3
7#include "source_cell/klist.h"
9#include "source_psi/psi.h"
11
12#include <complex>
13#include <string>
14#include <vector>
15
16namespace ModuleIO
17{
25template <typename T, typename Device>
27{
28 public:
31 const ModulePW::PW_Basis_K& pw_wfc,
32 const ModulePW::PW_Basis& pw_rho,
33 const ModulePW::PW_Basis& pw_rhod,
34 const pseudopot_cell_vnl& ppcell,
35 const int nspin,
36 const int global_nbands);
37
43 void begin(UnitCell* ucell,
44 const Parallel_Grid& pgrid,
45 const K_Vectors& kv,
46 const std::vector<int>& out_pchg,
47 const std::string& global_out_dir,
48 const bool if_separate_k,
49 const bool noncolin,
50 std::ofstream& ofs_running) const;
51
52 private:
58 const int nspin_;
59 const int global_nbands_;
60
61 // Defined in the implementation to keep device buffers out of this header.
62 class Workspace;
63
64 // Validate the binary selector and return a zero-padded global band mask.
65 std::vector<int> select_bands(const std::vector<int>& selection, const std::string& parameter_name) const;
66
67 // Transform the owner's band and broadcast each local real-space slab.
68 void transform_band(const int global_band, const int ik, const Parallel::ParaBandOutput& band_output, Workspace* work) const;
69 // The returned data belongs to the selected workspace component and is valid
70 // until that component is transformed again or the workspace is destroyed.
71 const std::complex<double>* transform_wfc(const T* coefficients, const int ik, const int component, Workspace* work) const;
72
73 void write_separate(const int band,
74 const UnitCell& ucell,
75 const Parallel_Grid& pgrid,
76 const K_Vectors& kv,
77 const std::string& out_dir,
78 const bool noncolin,
79 const Parallel::ParaBandOutput& band_output,
80 std::ofstream& ofs_running,
81 Workspace* work) const;
82 void write_summed(const int band,
83 UnitCell* ucell,
84 const Parallel_Grid& pgrid,
85 const K_Vectors& kv,
86 const std::string& out_dir,
87 const bool noncolin,
88 const Parallel::ParaBandOutput& band_output,
89 std::ofstream& ofs_running,
90 Workspace* work) const;
91
92 void calc_density(const int spin_index, const double weight, const bool noncolin, const bool accumulate, Workspace* work) const;
93 void accumulate_uspp(const int band,
94 const int ik,
95 const int spin,
96 const double weight,
97 const Parallel::ParaBandOutput& band_output,
98 Workspace* work) const;
99 void add_augmentation(const UnitCell& ucell, Workspace* work) const;
100 void sum_pools(const Parallel_Grid& pgrid, Workspace* work) const;
101 void symmetrize(UnitCell* ucell, Workspace* work) const;
102
103 void write_cube(const int band,
104 const int component,
105 const int k_number,
106 const UnitCell& ucell,
107 const Parallel_Grid& pgrid,
108 const std::string& out_dir,
109 const bool separate_k,
110 const std::vector<double>& values,
111 std::ofstream& ofs_running) const;
112};
113} // namespace ModuleIO
114
115#endif // GET_PCHG_PW_H
Class for k-points management.
Definition klist.h:20
Definition get_pchg_pw.cpp:20
const int global_nbands_
Definition get_pchg_pw.h:59
const std::complex< double > * transform_wfc(const T *coefficients, const int ik, const int component, Workspace *work) const
Definition get_pchg_pw.cpp:195
void write_separate(const int band, const UnitCell &ucell, const Parallel_Grid &pgrid, const K_Vectors &kv, const std::string &out_dir, const bool noncolin, const Parallel::ParaBandOutput &band_output, std::ofstream &ofs_running, Workspace *work) const
Definition get_pchg_pw.cpp:233
void calc_density(const int spin_index, const double weight, const bool noncolin, const bool accumulate, Workspace *work) const
Definition get_pchg_pw.cpp:299
void add_augmentation(const UnitCell &ucell, Workspace *work) const
Definition get_pchg_pw.cpp:394
const ModulePW::PW_Basis & pw_rho_
Definition get_pchg_pw.h:55
void begin(UnitCell *ucell, const Parallel_Grid &pgrid, const K_Vectors &kv, const std::vector< int > &out_pchg, const std::string &global_out_dir, const bool if_separate_k, const bool noncolin, std::ofstream &ofs_running) const
Write selected bands, either per k-point or after k summation and symmetry.
Definition get_pchg_pw.cpp:113
Get_pchg_pw(const psi::Psi< T, Device > &psi, const ModulePW::PW_Basis_K &pw_wfc, const ModulePW::PW_Basis &pw_rho, const ModulePW::PW_Basis &pw_rhod, const pseudopot_cell_vnl &ppcell, const int nspin, const int global_nbands)
Bind the wavefunction, grids, and global band/spin configuration.
Definition get_pchg_pw.cpp:101
void accumulate_uspp(const int band, const int ik, const int spin, const double weight, const Parallel::ParaBandOutput &band_output, Workspace *work) const
Definition get_pchg_pw.cpp:355
const ModulePW::PW_Basis_K & pw_wfc_
Definition get_pchg_pw.h:54
const psi::Psi< T, Device > & psi_
Definition get_pchg_pw.h:53
void write_cube(const int band, const int component, const int k_number, const UnitCell &ucell, const Parallel_Grid &pgrid, const std::string &out_dir, const bool separate_k, const std::vector< double > &values, std::ofstream &ofs_running) const
Definition get_pchg_pw.cpp:459
const int nspin_
Definition get_pchg_pw.h:58
void write_summed(const int band, UnitCell *ucell, const Parallel_Grid &pgrid, const K_Vectors &kv, const std::string &out_dir, const bool noncolin, const Parallel::ParaBandOutput &band_output, std::ofstream &ofs_running, Workspace *work) const
Definition get_pchg_pw.cpp:269
void symmetrize(UnitCell *ucell, Workspace *work) const
Definition get_pchg_pw.cpp:431
std::vector< int > select_bands(const std::vector< int > &selection, const std::string &parameter_name) const
Definition get_pchg_pw.cpp:155
const ModulePW::PW_Basis & pw_rhod_
Definition get_pchg_pw.h:56
const pseudopot_cell_vnl & ppcell_
Definition get_pchg_pw.h:57
void sum_pools(const Parallel_Grid &pgrid, Workspace *work) const
Definition get_pchg_pw.cpp:421
void transform_band(const int global_band, const int ik, const Parallel::ParaBandOutput &band_output, Workspace *work) const
Definition get_pchg_pw.cpp:172
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
Describe replicated or contiguous band-group storage.
Definition para_band_output.h:22
Definition parallel_grid.h:8
Provide the basic information about unitcell.
Definition unitcell.h:16
Definition vnl_pw.h:23
Definition psi.h:37
#define T
Definition exp.cpp:237
Internal helpers shared by the R-space sparse text writers. Declared here (instead of duplicated in e...
Definition csr_reader.cpp:8
Definition diag_lcao.h:14