ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
read_pp.h
Go to the documentation of this file.
1#ifndef PSEUDOPOT_UPF_H
2#define PSEUDOPOT_UPF_H
3
4#include <string>
5
6#include "atom_pseudo.h"
9
11{
12public:
13 //PP_INFO
14 //PP_HEADER
15 //PP_MESH
16 //PP_NLCC
17 //PP_LOCAL
18 //PP_NONLOCAL
19 //PP_PSWFC
20 //PP_PSRHOATOM
21 //addinfo
22
25
26 std::string relativistic; // relativistic: no, scalar, full
27 int lmax_rho; // maximum angular momentum component in rho (should be 2*lmax)
28 double xmin; // the minimum x of the linear mesh
29 double rmax; // the maximum radius of the mesh
30 double zmesh; // the nuclear charge used for mesh
31 double dx; // the deltax of the linear mesh
32 // The radial grid is: r(i+1) = exp(xmin+i*dx)/zed a.u.
33 int lloc; // L of channel used to generate local potential
34 // (if < 0 it was generated by smoothing AE potential)
35 // double rcloc; // vloc = v_ae for r > rcloc
36 bool q_with_l; // if .true. qfunc is pseudized in
37 int nqf; // number of Q coefficients
38 // bool has_wfc; // if true, UPF contain AE and PS wfc for each beta
39
40 // need 'new' and 'delete'
41 bool coulomb_potential = false; // coulomb potentail : z/r
42 ModuleBase::matrix chi; // chi(nwfc,mesh) atomic wavefcts
43 std::vector<int> kbeta = {}; // kbeta(nbeta):number of mesh points for projector i (must be .le. mesh )
44 std::vector<std::string> els_beta = {}; // els_beta(nwfc):label for the beta
45 std::vector<int> nchi = {}; // nchi(nwfc) value of pseudo-n for wavefcts
46 std::vector<double> epseu = {}; // epseu(nwfc) pseudo one-particle energy
47 std::vector<double> rcut_chi = {}; // rcut_chi(nwfc) cutoff inner radius
48 std::vector<double> rcutus_chi = {}; // rcutus_chi(nwfc) ultrasoft outer radius
49 std::vector<double> rinner = {}; // rinner(2*lmax+1) r_L
50 ModuleBase::matrix qfunc; // qfunc(nbeta*(nbeta+1)/2,mesh) Q_{mu,nu}(|r|) function for |r|> r_L
51 ModuleBase::realArray qfcoef; // qfcoef(nbeta,nbeta,2*lmax+1,nqf) coefficients for Q for |r|<r_L
52 // ModuleBase::matrix aewfc; // wfc(nbeta,mesh) all-electron wfc
53 // ModuleBase::matrix pswfc; // wfc(nbeta,mesh) pseudo wfc
54 std::vector<double> rcut = {}; // cut-off radius(nbeta)
55 std::vector<double> rcutus = {}; // ultrasoft cut-off radius (nbeta)
56
57 int nd; // nl_5 // Number of nonzero Dij
58
59 // the followings are for the vwr format
61 int iTB_s;
62 int iTB_p;
63 int iTB_d;
64
65 // return error
66 int init_pseudo_reader(const std::string& fn, std::string& type, Atom_pseudo& pp);
67 void print_pseudo_upf(std::ofstream& ofs, Atom_pseudo& pp);
68
69 int average_p(const double& lambda, Atom_pseudo& pp); // zhengdy add 2020-10-20
70 void set_empty_element(Atom_pseudo& pp); // Peize Lin add for bsse 2022.04.07
71 void set_upf_q(Atom_pseudo& pp); // liuyu add 2023-09-21
73
74 private:
75 bool mesh_changed = false; // if the mesh is even, it will be changed to odd
76 void skip_number(std::ifstream& ifs, bool mesh_changed); // skip the last number if the mesh is even
77
78 int set_pseudo_type(const std::string& fn, std::string& type);
79 std::string& trim(std::string& in_str);
80 std::string trimend(std::string& in_str);
81
82 int read_pseudo_upf(std::ifstream& ifs, Atom_pseudo& pp);
83 int read_pseudo_vwr(std::ifstream& ifs, Atom_pseudo& pp);
84 int read_pseudo_blps(std::ifstream& ifs, Atom_pseudo& pp); // sunliang added 2021.07.08
85 void read_pseudo_header(std::ifstream& ifs, Atom_pseudo& pp);
86 void read_pseudo_mesh(std::ifstream& ifs, Atom_pseudo& pp);
87 void read_pseudo_nlcc(std::ifstream& ifs, Atom_pseudo& pp);
88 void read_pseudo_local(std::ifstream& ifs, Atom_pseudo& pp);
89 void read_pseudo_nl(std::ifstream& ifs, Atom_pseudo& pp);
90 void read_pseudo_pswfc(std::ifstream& ifs, Atom_pseudo& pp);
91 void read_pseudo_rhoatom(std::ifstream& ifs, Atom_pseudo& pp);
92 void read_pseudo_addinfo(std::ifstream& ifs, Atom_pseudo& pp);
93 void read_pseudo_so(std::ifstream& ifs, Atom_pseudo& pp);
94
95 // upf201
96 int read_pseudo_upf201(std::ifstream& ifs, Atom_pseudo& pp);
97 void read_pseudo_upf201_header(std::ifstream& ifs, Atom_pseudo& pp);
98 void read_pseudo_upf201_mesh(std::ifstream& ifs, Atom_pseudo& pp);
99 void read_pseudo_upf201_nonlocal(std::ifstream& ifs, Atom_pseudo& pp);
100 void read_pseudo_upf201_pswfc(std::ifstream& ifs, Atom_pseudo& pp);
101 // void read_pseudo_upf201_fullwfc(std::ifstream& ifs);
102 void read_pseudo_upf201_so(std::ifstream& ifs, Atom_pseudo& pp);
103 void getnameval(std::ifstream&, int&, std::string*, std::string*);
104
115 void setqfnew(const int& nqf,
116 const int& mesh,
117 const int& l,
118 const int& n,
119 const double* qfcoef,
120 const double* r,
121 double* rho);
122
123 // complete default
124 // void complete_default(Atom_pseudo& pp);
128};
129
130#endif //pseudopot_upf class
Definition atom_pseudo.h:13
Definition matrix.h:19
double float array
Definition realarray.h:21
Definition read_pp.h:11
double rmax
Definition read_pp.h:29
bool coulomb_potential
Definition read_pp.h:41
void getnameval(std::ifstream &, int &, std::string *, std::string *)
Definition read_pp_upf201.cpp:110
void read_pseudo_addinfo(std::ifstream &ifs, Atom_pseudo &pp)
int init_pseudo_reader(const std::string &fn, std::string &type, Atom_pseudo &pp)
Definition read_pp.cpp:22
int average_p(const double &lambda, Atom_pseudo &pp)
Definition read_pp.cpp:114
void read_pseudo_local(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf100.cpp:266
void read_pseudo_so(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf100.cpp:468
std::vector< double > rcut_chi
Definition read_pp.h:47
void set_upf_q(Atom_pseudo &pp)
Definition read_pp.cpp:426
double zmesh
Definition read_pp.h:30
int nd
Definition read_pp.h:57
void print_pseudo_upf(std::ofstream &ofs, Atom_pseudo &pp)
Definition read_pp_upf100.cpp:501
std::string trimend(std::string &in_str)
Definition read_pp.cpp:105
std::string relativistic
Definition read_pp.h:26
void read_pseudo_upf201_pswfc(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf201.cpp:705
int spd_loc
Definition read_pp.h:60
int read_pseudo_vwr(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_vwr.cpp:16
int set_pseudo_type(const std::string &fn, std::string &type)
Definition read_pp.cpp:68
bool q_with_l
Definition read_pp.h:36
ModuleBase::realArray qfcoef
Definition read_pp.h:51
void read_pseudo_nlcc(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf100.cpp:254
void read_pseudo_nl(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf100.cpp:279
int read_pseudo_upf201(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf201.cpp:5
std::vector< double > rinner
Definition read_pp.h:49
void set_empty_element(Atom_pseudo &pp)
Definition read_pp.cpp:399
int iTB_d
Definition read_pp.h:63
void skip_number(std::ifstream &ifs, bool mesh_changed)
Definition read_pp.cpp:490
void read_pseudo_pswfc(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf100.cpp:438
int lmax_rho
Definition read_pp.h:27
void read_pseudo_header(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf100.cpp:141
int lloc
Definition read_pp.h:33
std::vector< double > rcutus
Definition read_pp.h:55
void complete_default(Atom_pseudo &pp)
Definition read_pp_complete.cpp:4
~Pseudopot_upf()
Definition read_pp.cpp:18
std::vector< std::string > els_beta
Definition read_pp.h:44
void read_pseudo_rhoatom(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf100.cpp:457
void setqfnew(const int &nqf, const int &mesh, const int &l, const int &n, const double *qfcoef, const double *r, double *rho)
Computes the Q function from its polynomial expansion (r < rinner)
Definition read_pp.cpp:470
double xmin
Definition read_pp.h:28
std::vector< double > epseu
Definition read_pp.h:46
void read_pseudo_upf201_mesh(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf201.cpp:365
double dx
Definition read_pp.h:31
int iTB_p
Definition read_pp.h:62
Pseudopot_upf()
Definition read_pp.cpp:14
std::string & trim(std::string &in_str)
Definition read_pp.cpp:94
bool mesh_changed
Definition read_pp.h:75
void complete_default_atom(Atom_pseudo &pp)
Definition read_pp_complete.cpp:89
void read_pseudo_mesh(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf100.cpp:223
std::vector< double > rcutus_chi
Definition read_pp.h:48
std::vector< int > kbeta
Definition read_pp.h:43
int iTB_s
Definition read_pp.h:61
ModuleBase::matrix chi
Definition read_pp.h:42
std::vector< double > rcut
Definition read_pp.h:54
std::vector< int > nchi
Definition read_pp.h:45
void complete_default_h(Atom_pseudo &pp)
Definition read_pp_complete.cpp:32
int read_pseudo_blps(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_blps.cpp:5
void complete_default_vl(Atom_pseudo &pp)
Definition read_pp_complete.cpp:153
int nqf
Definition read_pp.h:37
void read_pseudo_upf201_header(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf201.cpp:198
ModuleBase::matrix qfunc
Definition read_pp.h:50
int read_pseudo_upf(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf100.cpp:5
void read_pseudo_upf201_so(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf201.cpp:843
void read_pseudo_upf201_nonlocal(std::ifstream &ifs, Atom_pseudo &pp)
Definition read_pp_upf201.cpp:453