ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
dos_test.h
Go to the documentation of this file.
1#ifndef DOS_TEST_H
2#define DOS_TEST_H
3
4#include<iostream>
5#include<fstream>
7
9{
10public:
11 DosPrepare(int is_in,
12 std::string fa_in,
13 double de_ev_in,
14 double emax_ev_in,
15 double emin_ev_in,
16 double bcoeff_in,
17 int nks_in,
18 int nkstot_in,
19 int nbands_in):
20 is(is_in),fa(fa_in),
21 de_ev(de_ev_in),emax_ev(emax_ev_in),
22 emin_ev(emin_ev_in),bcoeff(bcoeff_in),
23 nks(nks_in),nkstot(nkstot_in),nbands(nbands_in){}
24
25 int is;
26 std::string fa;
27 double de_ev;
28 double emax_ev;
29 double emin_ev;
30 double bcoeff;
31 int nks;
32 int nkstot;
33 int nbands;
34 std::vector<int> isk;
35 std::vector<double> wk;
38
39 void set_isk()
40 {
41 this->isk.reserve(nks);
42 for(int i=0;i<nks;i++)
43 {
44 isk[i] = 0; //spin-unpolarized case, only 1 spin
45 }
46 }
47
48 void read_wk()
49 {
50 this->wk.reserve(nks);
51 std::ifstream ifs;
52 std::string tmpstring;
53 int dummy;
54 double kx,ky,kz;
55 ifs.open("./support/kpoints");
56 while(ifs.good())
57 {
58 getline(ifs,tmpstring);
59 getline(ifs,tmpstring);
60 for(int ik=0; ik<nks; ++ik)
61 {
62 ifs>>dummy >>kx >>ky >>kz >>this->wk[ik];
63 ifs.ignore(150,'\n');
64 ifs.rdstate();
65 }
66 }
67 ifs.close();
68 for(int ik=0; ik<nks; ++ik)
69 {
70 wk[ik] *= 2.0;
71 }
72 }
73
75 {
76 this->ekb.create(nks,nbands);
77 this->wg.create(nks,nbands);
78 std::ifstream ifs;
79 std::string tmpstring;
80 ifs.open("./support/istate.info");
81 int dummy;
82 while(ifs.good())
83 {
84 for(int ik=0; ik<nks; ++ik)
85 {
86 if(ik==0)
87 {
88 getline(ifs,tmpstring);
89 }
90 else
91 {
92 getline(ifs,tmpstring);
93 getline(ifs,tmpstring);
94 getline(ifs,tmpstring);
95 }
96 for(int ib=0; ib<nbands; ++ib)
97 {
98 ifs>> dummy >> this->ekb(ik,ib) >> this->wg(ik,ib);
99 ifs.ignore(150,'\n');
100 }
101 ifs.rdstate();
102 }
103 }
104 ifs.close();
105 this->ekb *= 1.0/ModuleBase::Ry_to_eV;
106 }
107};
108
109#endif
Definition dos_test.h:9
std::vector< double > wk
Definition dos_test.h:35
void read_istate_info()
Definition dos_test.h:74
double emax_ev
Definition dos_test.h:28
ModuleBase::matrix ekb
Definition dos_test.h:36
std::string fa
Definition dos_test.h:26
double de_ev
Definition dos_test.h:27
double bcoeff
Definition dos_test.h:30
int nks
Definition dos_test.h:31
std::vector< int > isk
Definition dos_test.h:34
int is
Definition dos_test.h:25
int nbands
Definition dos_test.h:33
double emin_ev
Definition dos_test.h:29
void set_isk()
Definition dos_test.h:39
void read_wk()
Definition dos_test.h:48
DosPrepare(int is_in, std::string fa_in, double de_ev_in, double emax_ev_in, double emin_ev_in, double bcoeff_in, int nks_in, int nkstot_in, int nbands_in)
Definition dos_test.h:11
int nkstot
Definition dos_test.h:32
ModuleBase::matrix wg
Definition dos_test.h:37
Definition matrix.h:19
void create(const int nrow, const int ncol, const bool flag_zero=true)
Definition matrix.cpp:122
const double Ry_to_eV
Definition constants.h:81