ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
psi_init.h
Go to the documentation of this file.
1#ifndef PSI_INIT_H
2#define PSI_INIT_H
5
6namespace psi
7{
8
9// This class is used to initialize the wavefunction
10template <typename T, typename Device = base_device::DEVICE_CPU>
12{
13 public:
14 PSIInit(const std::string& init_wfc_in,
15 const std::string& ks_solver_in,
16 const std::string& basis_type_in,
17 const int& rank,
18 const UnitCell& ucell,
19 const Structure_Factor& sf,
20 const K_Vectors& kv_in,
24
26 void prepare_init(const int& random_seed);
27
28 //------------------------ only for psi_initializer --------------------
37 void initialize_psi(Psi<std::complex<double>>* psi,
38 psi::Psi<T, Device>* kspw_psi,
40 std::ofstream& ofs_running);
41
46 void initialize_lcao_in_pw(Psi<T>* psi_local, std::ofstream& ofs_running);
47
48 // psi_initializer<T, Device>* psi_initer = nullptr;
49 // change to use smart pointer to manage the memory, and avoid memory leak
50 // while the std::make_unique() is not supported till C++14,
51 // so use the new and std::unique_ptr to manage the memory, but this makes new-delete not symmetric
52 std::unique_ptr<psi_initializer<T>> psi_initer;
53
54 private:
55 // wavefunction initialization type
56 std::string init_wfc = "none";
57
58 // Kohn-Sham solver type
59 std::string ks_solver = "none";
60
61 // basis type
62 std::string basis_type = "none";
63
64 // pw basis
66
67 // parallel kpoints
68 const K_Vectors& kv;
69
70 // unit cell
72
73 // structure factor
75
76 // nonlocal pseudopotential
78
79 Device* ctx = {};
80 base_device::DEVICE_CPU* cpu_ctx = {};
81 const int rank;
82
83 //-------------------------OP--------------------------------------------
86};
87
89void allocate_psi(Psi<std::complex<double>>*& psi, const int& nks, const std::vector<int>& ngk, const int& nbands, const int& npwx);
90
91} // namespace psi
92#endif
Definition klist.h:13
Special pw_basis class. It includes different k-points.
Definition pw_basis_k.h:57
Definition structure_factor.h:11
Definition unitcell.h:16
Definition hamilt.h:16
Definition VNL_in_pw.h:21
Definition psi_init.h:12
std::string ks_solver
Definition psi_init.h:59
Device * ctx
device
Definition psi_init.h:79
const UnitCell & ucell
Definition psi_init.h:71
base_device::DEVICE_CPU * cpu_ctx
CPU device.
Definition psi_init.h:80
void initialize_psi(Psi< std::complex< double > > *psi, psi::Psi< T, Device > *kspw_psi, hamilt::Hamilt< T, Device > *p_hamilt, std::ofstream &ofs_running)
initialize the wavefunction
Definition psi_init.cpp:85
std::string init_wfc
Definition psi_init.h:56
const int rank
MPI rank.
Definition psi_init.h:81
void initialize_lcao_in_pw(Psi< T > *psi_local, std::ofstream &ofs_running)
initialize NAOs in plane wave basis, only for LCAO_IN_PW
Definition psi_init.cpp:234
std::unique_ptr< psi_initializer< T > > psi_initer
Definition psi_init.h:52
const K_Vectors & kv
Definition psi_init.h:68
const Structure_Factor & sf
Definition psi_init.h:74
std::string basis_type
Definition psi_init.h:62
const pseudopot_cell_vnl & nlpp
Definition psi_init.h:77
void prepare_init(const int &random_seed)
prepare the wavefunction initialization
Definition psi_init.cpp:37
const ModulePW::PW_Basis_K & pw_wfc
Definition psi_init.h:65
~PSIInit()
Definition psi_init.h:23
Definition psi.h:37
Definition exx_lip.h:23
void allocate_psi(Psi< std::complex< double > > *&psi, const int &nks, const std::vector< int > &ngk, const int &nbands, const int &npwx)
allocate the wavefunction
Definition psi_init.cpp:245