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
5#ifndef PSEUDOPOT_UPF_H
6#define PSEUDOPOT_UPF_H
7
8#include <string>
9
10#include "atom_pseudo.h"
11#include "source_base/matrix.h"
13
14class AtomPseudoTest;
15class AtomSpecTest;
16class NCPPTest;
17class ReadPPTest;
18
26{
29 friend class AtomPseudoTest;
30 friend class AtomSpecTest;
31 friend class NCPPTest;
32 friend class ReadPPTest;
33
34public:
44
49
54
55 std::string relativistic;
57 double xmin;
58 double rmax;
59 double zmesh;
60 double dx;
62 int lloc;
64 bool q_with_l;
65 int nqf;
66
68 bool coulomb_potential = false;
70 std::vector<int> kbeta = {};
71 std::vector<std::string> els_beta = {};
72 std::vector<int> nchi = {};
73 std::vector<double> epseu = {};
74 std::vector<double> rcut_chi = {};
75 std::vector<double> rcutus_chi = {};
76 std::vector<double> rinner = {};
79 std::vector<double> rcut = {};
80 std::vector<double> rcutus = {};
81
82 int nd;
83
85 int spd_loc;
86 int iTB_s;
87 int iTB_p;
88 int iTB_d;
89
98 int init_pseudo_reader(const std::string& fn, std::string& type, Atom_pseudo& pp);
99
106 void print_pseudo_upf(std::ofstream& ofs, Atom_pseudo& pp);
107
116 int average_p(const double& lambda, Atom_pseudo& pp, const bool lspinorb);
117
125
132 void set_upf_q(Atom_pseudo& pp);
133
140 void complete_default(Atom_pseudo& pp, const double pseudo_rcut);
141
142 private:
143 bool mesh_changed = false;
144
151 void skip_number(std::ifstream& ifs, bool mesh_changed);
152
160 int read_pseudo_upf(std::ifstream& ifs, Atom_pseudo& pp);
161
169 int read_pseudo_vwr(std::ifstream& ifs, Atom_pseudo& pp);
170
179 int read_pseudo_blps(std::ifstream& ifs, Atom_pseudo& pp);
180
187 void read_pseudo_header(std::ifstream& ifs, Atom_pseudo& pp);
188
195 void read_pseudo_mesh(std::ifstream& ifs, Atom_pseudo& pp);
196
203 void read_pseudo_nlcc(std::ifstream& ifs, Atom_pseudo& pp);
204
211 void read_pseudo_local(std::ifstream& ifs, Atom_pseudo& pp);
212
219 void read_pseudo_nl(std::ifstream& ifs, Atom_pseudo& pp);
220
227 void read_pseudo_pswfc(std::ifstream& ifs, Atom_pseudo& pp);
228
235 void read_pseudo_rhoatom(std::ifstream& ifs, Atom_pseudo& pp);
236
243 void read_pseudo_addinfo(std::ifstream& ifs, Atom_pseudo& pp);
244
251 void read_pseudo_so(std::ifstream& ifs, Atom_pseudo& pp);
252
254
261 int read_pseudo_upf201(std::ifstream& ifs, Atom_pseudo& pp);
262
269 void read_pseudo_upf201_header(std::ifstream& ifs, Atom_pseudo& pp);
270
277 void read_pseudo_upf201_mesh(std::ifstream& ifs, Atom_pseudo& pp);
278
285 void read_pseudo_upf201_nonlocal(std::ifstream& ifs, Atom_pseudo& pp);
286
293 void read_pseudo_upf201_pswfc(std::ifstream& ifs, Atom_pseudo& pp);
294
301 void read_pseudo_upf201_so(std::ifstream& ifs, Atom_pseudo& pp);
302
311 void getnameval(std::ifstream&, int&, std::string*, std::string*);
312
313 // complete default
314 // void complete_default(Atom_pseudo& pp);
315 void complete_default_atom(Atom_pseudo& pp, const double pseudo_rcut);
317};
318
328namespace pseudopot
329{
330
332int set_pseudo_type(const std::string& fn, std::string& type);
333
335std::string& trim(std::string& in_str);
336
345void setqfnew(const int& nqf,
346 const int& mesh,
347 const int& l,
348 const int& n,
349 const double* qfcoef,
350 const double* r,
351 double* rho);
352
355
356} // namespace pseudopot
357
358#endif //pseudopot_upf class
Atom_pseudo class for atom pseudopotential data.
Definition atom_pseudo_test.cpp:29
Definition atom_spec_test.cpp:34
Atom_pseudo class for atom pseudopotential data.
Definition atom_pseudo.h:17
Definition matrix.h:15
double float array
Definition realarray.h:21
Definition pseudo_nc_test.cpp:27
friend class AtomSpecTest
Definition read_pp.h:30
double rmax
the maximum radius of the mesh
Definition read_pp.h:58
bool coulomb_potential
Dynamic arrays.
Definition read_pp.h:68
void getnameval(std::ifstream &, int &, std::string *, std::string *)
Get name-value pair from input stream.
Definition read_pp_upf201.cpp:110
void read_pseudo_addinfo(std::ifstream &ifs, Atom_pseudo &pp)
Read pseudopotential additional info.
int init_pseudo_reader(const std::string &fn, std::string &type, Atom_pseudo &pp)
Initialize pseudopotential reader.
Definition read_pp.cpp:25
void complete_default_atom(Atom_pseudo &pp, const double pseudo_rcut)
Definition read_pp_complete.cpp:88
void read_pseudo_local(std::ifstream &ifs, Atom_pseudo &pp)
Read pseudopotential local potential.
Definition read_pp_upf100.cpp:274
void read_pseudo_so(std::ifstream &ifs, Atom_pseudo &pp)
Read pseudopotential spin-orbit coupling.
Definition read_pp_upf100.cpp:481
std::vector< double > rcut_chi
rcut_chi(nwfc) cutoff inner radius
Definition read_pp.h:74
void set_upf_q(Atom_pseudo &pp)
Set UPF Q function.
Definition read_pp.cpp:422
double zmesh
the nuclear charge used for mesh
Definition read_pp.h:59
int nd
nl_5 // Number of nonzero Dij
Definition read_pp.h:82
void print_pseudo_upf(std::ofstream &ofs, Atom_pseudo &pp)
Print pseudopotential information.
Definition read_pp_upf100.cpp:514
std::string relativistic
relativistic: no, scalar, full
Definition read_pp.h:55
void read_pseudo_upf201_pswfc(std::ifstream &ifs, Atom_pseudo &pp)
Read UPF201 pseudo wavefunctions.
Definition read_pp_upf201.cpp:705
int spd_loc
VWR format.
Definition read_pp.h:85
int read_pseudo_vwr(std::ifstream &ifs, Atom_pseudo &pp)
Read VWR format pseudopotential.
Definition read_pp_vwr.cpp:16
bool q_with_l
if .true. qfunc is pseudized in
Definition read_pp.h:64
ModuleBase::realArray qfcoef
qfcoef(nbeta,nbeta,2*lmax+1,nqf) coefficients for Q for |r|<r_L
Definition read_pp.h:78
void complete_default(Atom_pseudo &pp, const double pseudo_rcut)
Complete default values.
Definition read_pp_complete.cpp:3
void read_pseudo_nlcc(std::ifstream &ifs, Atom_pseudo &pp)
Read pseudopotential NLCC.
Definition read_pp_upf100.cpp:262
void read_pseudo_nl(std::ifstream &ifs, Atom_pseudo &pp)
Read pseudopotential non-local potential.
Definition read_pp_upf100.cpp:287
int read_pseudo_upf201(std::ifstream &ifs, Atom_pseudo &pp)
UPF201 format.
Definition read_pp_upf201.cpp:5
std::vector< double > rinner
rinner(2*lmax+1) r_L
Definition read_pp.h:76
void set_empty_element(Atom_pseudo &pp)
Set empty element for BSSE.
Definition read_pp.cpp:395
int iTB_d
TB d orbital index.
Definition read_pp.h:88
int average_p(const double &lambda, Atom_pseudo &pp, const bool lspinorb)
Average pseudopotential.
Definition read_pp.cpp:109
void skip_number(std::ifstream &ifs, bool mesh_changed)
Skip the last number if the mesh is even.
Definition read_pp.cpp:486
void read_pseudo_pswfc(std::ifstream &ifs, Atom_pseudo &pp)
Read pseudopotential pseudo wavefunctions.
Definition read_pp_upf100.cpp:451
int lmax_rho
maximum angular momentum component in rho (should be 2*lmax)
Definition read_pp.h:56
void read_pseudo_header(std::ifstream &ifs, Atom_pseudo &pp)
Read pseudopotential header.
Definition read_pp_upf100.cpp:143
friend class NCPPTest
Definition read_pp.h:31
friend class ReadPPTest
Definition read_pp.h:32
int lloc
Definition read_pp.h:62
std::vector< double > rcutus
ultrasoft cut-off radius (nbeta)
Definition read_pp.h:80
~Pseudopot_upf()
Destructor.
Definition read_pp.cpp:21
std::vector< std::string > els_beta
els_beta(nwfc):label for the beta
Definition read_pp.h:71
void read_pseudo_rhoatom(std::ifstream &ifs, Atom_pseudo &pp)
Read pseudopotential atomic charge density.
Definition read_pp_upf100.cpp:470
double xmin
the minimum x of the linear mesh
Definition read_pp.h:57
std::vector< double > epseu
epseu(nwfc) pseudo one-particle energy
Definition read_pp.h:73
void read_pseudo_upf201_mesh(std::ifstream &ifs, Atom_pseudo &pp)
Read UPF201 mesh.
Definition read_pp_upf201.cpp:365
double dx
Definition read_pp.h:60
int iTB_p
TB p orbital index.
Definition read_pp.h:87
Pseudopot_upf()
Default constructor.
Definition read_pp.cpp:17
bool mesh_changed
if the mesh is even, it will be changed to odd
Definition read_pp.h:143
void read_pseudo_mesh(std::ifstream &ifs, Atom_pseudo &pp)
Read pseudopotential mesh.
Definition read_pp_upf100.cpp:231
std::vector< double > rcutus_chi
rcutus_chi(nwfc) ultrasoft outer radius
Definition read_pp.h:75
std::vector< int > kbeta
kbeta(nbeta):number of mesh points for projector i (must be .le. mesh )
Definition read_pp.h:70
int iTB_s
TB s orbital index.
Definition read_pp.h:86
ModuleBase::matrix chi
chi(nwfc,mesh) atomic wavefcts
Definition read_pp.h:69
std::vector< double > rcut
cut-off radius(nbeta)
Definition read_pp.h:79
std::vector< int > nchi
nchi(nwfc) value of pseudo-n for wavefcts
Definition read_pp.h:72
int read_pseudo_blps(std::ifstream &ifs, Atom_pseudo &pp)
Read BLPS format pseudopotential.
Definition read_pp_blps.cpp:5
void complete_default_vl(Atom_pseudo &pp)
Definition read_pp_complete.cpp:153
int nqf
number of Q coefficients
Definition read_pp.h:65
void read_pseudo_upf201_header(std::ifstream &ifs, Atom_pseudo &pp)
Read UPF201 header.
Definition read_pp_upf201.cpp:198
ModuleBase::matrix qfunc
qfunc(nbeta*(nbeta+1)/2,mesh) Q_{mu,nu}(|r|) function for |r|> r_L
Definition read_pp.h:77
friend class AtomPseudoTest
the unit tests drive the private format readers and the complete_default_* helpers directly; see sour...
Definition read_pp.h:29
int read_pseudo_upf(std::ifstream &ifs, Atom_pseudo &pp)
Read UPF format pseudopotential.
Definition read_pp_upf100.cpp:5
void read_pseudo_upf201_so(std::ifstream &ifs, Atom_pseudo &pp)
Read UPF201 spin-orbit coupling.
Definition read_pp_upf201.cpp:843
void read_pseudo_upf201_nonlocal(std::ifstream &ifs, Atom_pseudo &pp)
Read UPF201 non-local potential.
Definition read_pp_upf201.cpp:453
Definition read_pp_test.cpp:64
Helpers that the pseudopotential reader uses but that hold no state.
Definition read_pp.h:329
void complete_default_h(Atom_pseudo &pp)
Fill in the header-level defaults of an Atom_pseudo.
Definition read_pp_complete.cpp:31
int set_pseudo_type(const std::string &fn, std::string &type)
Set pseudopotential type based on the file's header line.
Definition read_pp.cpp:71
void setqfnew(const int &nqf, const int &mesh, const int &l, const int &n, const double *qfcoef, const double *r, double *rho)
Compute the Q function from its polynomial expansion (r < rinner).
Definition read_pp.cpp:466
std::string & trim(std::string &in_str)
Remove every tab and space from a string, in place.
Definition read_pp.cpp:97