ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
get_wf_pw.h
Go to the documentation of this file.
1#ifndef GET_WF_PW_H
2#define GET_WF_PW_H
3
7#include "source_cell/klist.h"
9#include "source_psi/psi.h"
10
11#include <complex>
12#include <string>
13#include <vector>
14
15namespace ModuleIO
16{
24template <typename T, typename Device>
26{
27 public:
30 const ModulePW::PW_Basis_K& pw_wfc,
31 const ModulePW::PW_Basis& pw_rho,
32 const ModulePW::PW_Basis& pw_rhod,
33 const int nspin,
34 const int global_nbands);
35
42 void begin(const UnitCell& ucell,
43 const Parallel_Grid& pgrid,
44 const K_Vectors& kv,
45 const std::vector<int>& out_wfc_norm,
46 const std::vector<int>& out_wfc_re_im,
47 const std::string& global_out_dir,
48 std::ofstream& ofs_running) const;
49
50 private:
55 const int nspin_;
56 const int global_nbands_;
57
58 // Defined in the implementation to keep device buffers out of this header.
59 class Workspace;
60
61 // Validate the binary selector and return a zero-padded global band mask.
62 std::vector<int> select_bands(const std::vector<int>& selection, const std::string& parameter_name) const;
63
64 // Transform the owner's band and broadcast each local real-space slab.
65 void transform_band(const int global_band, const int ik, const Parallel::ParaBandOutput& band_output, Workspace* work) const;
66 // The returned data belongs to the selected workspace component and is valid
67 // until that component is transformed again or the workspace is destroyed.
68 const std::complex<double>* transform_wfc(const T* coefficients, const int ik, const int component, Workspace* work) const;
69
70 void write_norm(const int band,
71 const UnitCell& ucell,
72 const Parallel_Grid& pgrid,
73 const K_Vectors& kv,
74 const std::string& out_dir,
75 const Parallel::ParaBandOutput& band_output,
76 std::ofstream& ofs_running,
77 Workspace* work) const;
78 void write_complex(const int band,
79 const UnitCell& ucell,
80 const Parallel_Grid& pgrid,
81 const K_Vectors& kv,
82 const std::string& out_dir,
83 const Parallel::ParaBandOutput& band_output,
84 std::ofstream& ofs_running,
85 Workspace* work) const;
86
87 void calc_norm(const int spin_index, const double scale, Workspace* work) const;
88 void calc_phase(const int ik, const K_Vectors& kv, std::vector<std::complex<double>>* phase) const;
89 void calc_component(const std::vector<std::complex<double>>& component,
90 const std::vector<std::complex<double>>& phase,
91 const double scale,
92 std::vector<double>* real,
93 std::vector<double>* imag) const;
94
95 void write_cube(const int band,
96 const int component,
97 const int k_number,
98 const std::string& part,
99 const UnitCell& ucell,
100 const Parallel_Grid& pgrid,
101 const std::string& out_dir,
102 const std::vector<double>& values,
103 std::ofstream& ofs_running) const;
104};
105} // namespace ModuleIO
106
107#endif // GET_WF_PW_H
Class for k-points management.
Definition klist.h:20
Definition get_wf_pw.cpp:21
void write_norm(const int band, const UnitCell &ucell, const Parallel_Grid &pgrid, const K_Vectors &kv, const std::string &out_dir, const Parallel::ParaBandOutput &band_output, std::ofstream &ofs_running, Workspace *work) const
Definition get_wf_pw.cpp:207
void calc_phase(const int ik, const K_Vectors &kv, std::vector< std::complex< double > > *phase) const
Definition get_wf_pw.cpp:279
const ModulePW::PW_Basis & pw_rhod_
Definition get_wf_pw.h:54
void write_cube(const int band, const int component, const int k_number, const std::string &part, const UnitCell &ucell, const Parallel_Grid &pgrid, const std::string &out_dir, const std::vector< double > &values, std::ofstream &ofs_running) const
Definition get_wf_pw.cpp:313
const std::complex< double > * transform_wfc(const T *coefficients, const int ik, const int component, Workspace *work) const
Definition get_wf_pw.cpp:169
void write_complex(const int band, const UnitCell &ucell, const Parallel_Grid &pgrid, const K_Vectors &kv, const std::string &out_dir, const Parallel::ParaBandOutput &band_output, std::ofstream &ofs_running, Workspace *work) const
Definition get_wf_pw.cpp:232
Get_wf_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 int nspin, const int global_nbands)
Bind the wavefunction, grids, and global band/spin configuration.
Definition get_wf_pw.cpp:71
void begin(const UnitCell &ucell, const Parallel_Grid &pgrid, const K_Vectors &kv, const std::vector< int > &out_wfc_norm, const std::vector< int > &out_wfc_re_im, const std::string &global_out_dir, std::ofstream &ofs_running) const
Write independently selected norm and Re/Im cubes for every k-point.
Definition get_wf_pw.cpp:82
void calc_component(const std::vector< std::complex< double > > &component, const std::vector< std::complex< double > > &phase, const double scale, std::vector< double > *real, std::vector< double > *imag) const
Definition get_wf_pw.cpp:297
const ModulePW::PW_Basis & pw_rho_
Definition get_wf_pw.h:53
const ModulePW::PW_Basis_K & pw_wfc_
Definition get_wf_pw.h:52
const psi::Psi< T, Device > & psi_
Definition get_wf_pw.h:51
std::vector< int > select_bands(const std::vector< int > &selection, const std::string &parameter_name) const
Definition get_wf_pw.cpp:129
void calc_norm(const int spin_index, const double scale, Workspace *work) const
Definition get_wf_pw.cpp:266
void transform_band(const int global_band, const int ik, const Parallel::ParaBandOutput &band_output, Workspace *work) const
Definition get_wf_pw.cpp:146
const int global_nbands_
Definition get_wf_pw.h:56
const int nspin_
Definition get_wf_pw.h:55
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 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