|
1 | | -///klist : adapted from klist from source_pw/module_pwdft |
2 | | -///deals with k point sampling |
| 1 | +/// klist : adapted from klist from source_pw/module_pwdft |
| 2 | +/// deals with k point sampling |
3 | 3 |
|
4 | | -#include "source_base/vector3.h" |
| 4 | +#include "source_base/global_function.h" |
5 | 5 | #include "source_base/matrix3.h" |
6 | 6 | #include "source_base/memory.h" |
7 | | -#include "source_base/global_function.h" |
8 | | -#include <iostream> |
| 7 | +#include "source_base/vector3.h" |
| 8 | + |
9 | 9 | #include <fstream> |
| 10 | +#include <iostream> |
10 | 11 |
|
11 | 12 | namespace Test_Deepks |
12 | 13 | { |
13 | 14 | class K_Vectors |
14 | 15 | { |
15 | | -public: |
16 | | - |
17 | | - ModuleBase::Vector3<double> *kvec_c; // Cartesian coordinates of k points |
18 | | - std::vector<ModuleBase::Vector3<double>> kvec_d; // Direct coordinates of k points |
| 16 | + public: |
| 17 | + ModuleBase::Vector3<double>* kvec_c; // Cartesian coordinates of k points |
| 18 | + std::vector<ModuleBase::Vector3<double>> kvec_d; // Direct coordinates of k points |
19 | 19 |
|
20 | | - double *wk; // wk, weight of k points |
| 20 | + double* wk; // wk, weight of k points |
21 | 21 |
|
22 | | - int *isk; // distinguish spin up and down k points |
| 22 | + int* isk; // distinguish spin up and down k points |
23 | 23 |
|
24 | | - int nkstot; // total number of k points |
| 24 | + int nkstot; // total number of k points |
25 | 25 |
|
26 | | - int nmp[3]; // Number of Monhorst-Pack |
| 26 | + int nmp[3]; // Number of Monhorst-Pack |
27 | 27 |
|
28 | 28 | K_Vectors(); |
29 | 29 | ~K_Vectors(); |
30 | 30 |
|
31 | | - void set( |
32 | | - const std::string &k_file_name, |
33 | | - const int& nspin, |
34 | | - const ModuleBase::Matrix3 &reciprocal_vec, |
35 | | - const ModuleBase::Matrix3 &latvec, |
36 | | - bool &GAMMA_ONLY_LOCAL, |
37 | | - std::ofstream &ofs_running, |
38 | | - std::ofstream &ofs_warning); |
| 31 | + void set(const std::string& k_file_name, |
| 32 | + const int& nspin, |
| 33 | + const ModuleBase::Matrix3& reciprocal_vec, |
| 34 | + const ModuleBase::Matrix3& latvec, |
| 35 | + bool& GAMMA_ONLY_LOCAL, |
| 36 | + std::ofstream& ofs_running, |
| 37 | + std::ofstream& ofs_warning); |
39 | 38 |
|
40 | | -private: |
| 39 | + private: |
41 | 40 | int nspin; |
42 | 41 | bool kc_done; |
43 | 42 | bool kd_done; |
44 | | - double koffset[3]; // used only in automatic k-points. |
45 | | - std::string k_kword; //LiuXh add 20180619 |
46 | | - int k_nkstot; //LiuXh add 20180619 |
| 43 | + double koffset[3]; // used only in automatic k-points. |
| 44 | + std::string k_kword; // LiuXh add 20180619 |
| 45 | + int k_nkstot; // LiuXh add 20180619 |
47 | 46 |
|
48 | 47 | // step 1 : generate kpoints |
49 | | - bool read_kpoints( |
50 | | - const std::string &fn, |
51 | | - bool &GAMMA_ONLY_LOCAL, |
52 | | - std::ofstream &ofs_warning, |
53 | | - std::ofstream &ofs_running); |
54 | | - void Monkhorst_Pack(const int *nmp_in,const double *koffset_in,const int tipo); |
55 | | - double Monkhorst_Pack_formula( const int &k_type, const double &offset, |
56 | | - const int& n, const int &dim); |
| 48 | + bool read_kpoints(const std::string& fn, |
| 49 | + bool& GAMMA_ONLY_LOCAL, |
| 50 | + std::ofstream& ofs_warning, |
| 51 | + std::ofstream& ofs_running); |
| 52 | + void Monkhorst_Pack(const int* nmp_in, const double* koffset_in, const int tipo); |
| 53 | + double Monkhorst_Pack_formula(const int& k_type, const double& offset, const int& n, const int& dim); |
57 | 54 |
|
58 | 55 | // step 2 : set both kvec and kved; normalize weight |
59 | | - void set_both_kvec(const ModuleBase::Matrix3 &G,const ModuleBase::Matrix3 &Rm, std::ofstream &ofs_running); |
60 | | - void renew(const int &kpoint_number); |
61 | | - void normalize_wk( const int °spin ); |
| 56 | + void set_both_kvec(const ModuleBase::Matrix3& G, const ModuleBase::Matrix3& Rm, std::ofstream& ofs_running); |
| 57 | + void renew(const int& kpoint_number); |
| 58 | + void normalize_wk(const int& degspin); |
62 | 59 |
|
63 | 60 | // step 3 : *2 or *4 kpoints. |
64 | 61 | // *2 for LSDA |
65 | 62 | // *4 for non-collinear |
66 | | - void set_kup_and_kdw(std::ofstream &ofs_running); |
| 63 | + void set_kup_and_kdw(std::ofstream& ofs_running); |
67 | 64 |
|
68 | 65 | // step 4 |
69 | 66 | // print k lists. |
70 | | - void print_klists(std::ofstream &fn_running); |
| 67 | + void print_klists(std::ofstream& fn_running); |
71 | 68 | }; |
72 | | -} |
| 69 | +} // namespace Test_Deepks |
0 commit comments