ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
cal_mlkedf_descriptors.h
Go to the documentation of this file.
1#ifndef CAL_MLKEDF_DESCRIPTORS_H
2#define CAL_MLKEDF_DESCRIPTORS_H
3
4#include <vector>
8
9namespace ModuleIO
10{
11
19{
20public:
22
23 void set_para(
24 const int &nx,
25 const double &nelec,
26 const double &tf_weight,
27 const double &vw_weight,
28 const double &chi_p,
29 const double &chi_q,
30 const std::vector<double> &chi_xi,
31 const std::vector<double> &chi_pnl,
32 const std::vector<double> &chi_qnl,
33 const int &nkernel,
34 const std::vector<int> &kernel_type,
35 const std::vector<double> &kernel_scaling,
36 const std::vector<double> &yukawa_alpha,
37 const std::vector<std::string> &kernel_file,
38 const double &omega,
39 ModulePW::PW_Basis *pw_rho);
40 // get input parameters
41 void getGamma(const double * const *prho, std::vector<double> &rgamma);
42 void getP(const double * const *prho, ModulePW::PW_Basis *pw_rho, std::vector<std::vector<double>> &pnablaRho, std::vector<double> &rp);
43 void getQ(const double * const *prho, ModulePW::PW_Basis *pw_rho, std::vector<double> &rq);
44 void getGammanl(const int ikernel, std::vector<double> &pgamma, ModulePW::PW_Basis *pw_rho, std::vector<double> &rgammanl);
45 void getPnl(const int ikernel, std::vector<double> &pp, ModulePW::PW_Basis *pw_rho, std::vector<double> &rpnl);
46 void getQnl(const int ikernel, std::vector<double> &pq, ModulePW::PW_Basis *pw_rho, std::vector<double> &rqnl);
47 // new parameters 2023-02-03
48 void getXi(std::vector<double> &pgamma, std::vector<double> &pgammanl, std::vector<double> &rxi);
49 void getTanhXi(const int ikernel, std::vector<double> &pgamma, std::vector<double> &pgammanl, std::vector<double> &rtanhxi);
50 void getTanhP(std::vector<double> &pp, std::vector<double> &rtanhp);
51 void getTanhQ(std::vector<double> &pq, std::vector<double> &rtanhq);
52 void getTanh_Pnl(const int ikernel, std::vector<double> &ppnl, std::vector<double> &rtanh_pnl);
53 void getTanh_Qnl(const int ikernel, std::vector<double> &pqnl, std::vector<double> &rtanh_qnl);
54 void getTanhP_nl(const int ikernel, std::vector<double> &ptanhp, ModulePW::PW_Basis *pw_rho, std::vector<double> &rtanhp_nl);
55 void getTanhQ_nl(const int ikernel, std::vector<double> &ptanhq, ModulePW::PW_Basis *pw_rho, std::vector<double> &rtanhq_nl);
56 // 2023-03-20
57 void getTanhXi_nl(const int ikernel, std::vector<double> &ptanhxi, ModulePW::PW_Basis *pw_rho, std::vector<double> &rtanhxi_nl);
58
59 void getF_KS(
60 psi::Psi<std::complex<double>> *psi,
63 ModulePW::PW_Basis *pw_rho,
64 UnitCell& ucell,
65 const std::vector<std::vector<double>> &nablaRho,
66 std::vector<double> &rF,
67 std::vector<double> &rpauli
68 );
69 // get intermediate variables of V_Pauli
70 void getNablaRho(const double * const *prho, ModulePW::PW_Basis *pw_rho, std::vector<std::vector<double>> &rnablaRho);
71
72 // tools
73 double MLkernel(double eta, double tf_weight, double vw_weight);
74 double MLkernel_yukawa(double eta, double alpha);
75 void read_kernel(const std::string &fileName, const double& scaling, ModulePW::PW_Basis *pw_rho, double* kernel_);
76 void multiKernel(const int ikernel, double *pinput, ModulePW::PW_Basis *pw_rho, double *routput);
77 void Laplacian(double * pinput, ModulePW::PW_Basis *pw_rho, double * routput);
78 void divergence(double ** pinput, ModulePW::PW_Basis *pw_rho, double * routput);
79
80 void tanh(std::vector<double> &pinput, std::vector<double> &routput, double chi=1.);
81 double dtanh(double tanhx, double chi=1.);
82
83 // new parameters 2023-02-13
84 std::vector<double> chi_xi = {1.0};
85 double chi_p = 1.;
86 double chi_q = 1.;
87 std::vector<double> chi_pnl = {1.0};
88 std::vector<double> chi_qnl = {1.0};
89
90 int nx = 0;
91 double dV = 0.;
92 double rho0 = 0.; // average rho
93 double kF = 0.; // Fermi vector kF = (3 pi^2 rho0)^(1/3)
94 double tkF = 0.; // 2 * kF
95 // double weightml = 1.;
96 const double cTF = 3.0/10.0 * std::pow(3*std::pow(M_PI, 2.0), 2.0/3.0) * 2; // 10/3*(3*pi^2)^{2/3}, multiply by 2 to convert unit from Hartree to Ry, finally in Ry*Bohr^(-2)
97 const double pqcoef = 1.0 / (4.0 * std::pow(3*std::pow(M_PI, 2.0), 2.0/3.0)); // coefficient of p and q
98
99 int nkernel = 1;
100 std::vector<int> kernel_type = {1};
101 std::vector<double> kernel_scaling = {1.0};
102 std::vector<double> yukawa_alpha = {1.0};
103 std::vector<std::string> kernel_file = {"none"};
104 std::vector<std::vector<double>> kernel = {}; // kernel[ikernel][ipw] = kernel value for ikernel and ipw
105};
106
107} // namespace ModuleIO
108
109#endif
A class to calculate the descriptors for ML KEDF. Sun, Liang, and Mohan Chen. Physical Review B 109....
Definition cal_mlkedf_descriptors.h:19
void getGammanl(const int ikernel, std::vector< double > &pgamma, ModulePW::PW_Basis *pw_rho, std::vector< double > &rgammanl)
Definition cal_mlkedf_descriptors.cpp:305
double MLkernel(double eta, double tf_weight, double vw_weight)
Definition cal_mlkedf_descriptors.cpp:79
double chi_p
Definition cal_mlkedf_descriptors.h:85
std::vector< double > kernel_scaling
Definition cal_mlkedf_descriptors.h:101
void getTanhP_nl(const int ikernel, std::vector< double > &ptanhp, ModulePW::PW_Basis *pw_rho, std::vector< double > &rtanhp_nl)
Definition cal_mlkedf_descriptors.cpp:379
void getNablaRho(const double *const *prho, ModulePW::PW_Basis *pw_rho, std::vector< std::vector< double > > &rnablaRho)
Definition cal_mlkedf_descriptors.cpp:500
void getTanhXi_nl(const int ikernel, std::vector< double > &ptanhxi, ModulePW::PW_Basis *pw_rho, std::vector< double > &rtanhxi_nl)
Definition cal_mlkedf_descriptors.cpp:391
double chi_q
Definition cal_mlkedf_descriptors.h:86
double tkF
Definition cal_mlkedf_descriptors.h:94
double dV
Definition cal_mlkedf_descriptors.h:91
void getTanhP(std::vector< double > &pp, std::vector< double > &rtanhp)
Definition cal_mlkedf_descriptors.cpp:355
std::vector< double > chi_pnl
Definition cal_mlkedf_descriptors.h:87
int nx
Definition cal_mlkedf_descriptors.h:90
void getTanh_Qnl(const int ikernel, std::vector< double > &pqnl, std::vector< double > &rtanh_qnl)
Definition cal_mlkedf_descriptors.cpp:373
std::vector< double > yukawa_alpha
Definition cal_mlkedf_descriptors.h:102
void getGamma(const double *const *prho, std::vector< double > &rgamma)
Definition cal_mlkedf_descriptors.cpp:265
void getPnl(const int ikernel, std::vector< double > &pp, ModulePW::PW_Basis *pw_rho, std::vector< double > &rpnl)
Definition cal_mlkedf_descriptors.cpp:310
std::vector< double > chi_qnl
Definition cal_mlkedf_descriptors.h:88
const double pqcoef
Definition cal_mlkedf_descriptors.h:97
void getTanhXi(const int ikernel, std::vector< double > &pgamma, std::vector< double > &pgammanl, std::vector< double > &rtanhxi)
Definition cal_mlkedf_descriptors.cpp:338
void getQnl(const int ikernel, std::vector< double > &pq, ModulePW::PW_Basis *pw_rho, std::vector< double > &rqnl)
Definition cal_mlkedf_descriptors.cpp:315
void getP(const double *const *prho, ModulePW::PW_Basis *pw_rho, std::vector< std::vector< double > > &pnablaRho, std::vector< double > &rp)
Definition cal_mlkedf_descriptors.cpp:273
void getXi(std::vector< double > &pgamma, std::vector< double > &pgammanl, std::vector< double > &rxi)
Definition cal_mlkedf_descriptors.cpp:321
void multiKernel(const int ikernel, double *pinput, ModulePW::PW_Basis *pw_rho, double *routput)
Definition cal_mlkedf_descriptors.cpp:206
void getQ(const double *const *prho, ModulePW::PW_Basis *pw_rho, std::vector< double > &rq)
Definition cal_mlkedf_descriptors.cpp:286
double kF
Definition cal_mlkedf_descriptors.h:93
double rho0
Definition cal_mlkedf_descriptors.h:92
void set_para(const int &nx, const double &nelec, const double &tf_weight, const double &vw_weight, const double &chi_p, const double &chi_q, const std::vector< double > &chi_xi, const std::vector< double > &chi_pnl, const std::vector< double > &chi_qnl, const int &nkernel, const std::vector< int > &kernel_type, const std::vector< double > &kernel_scaling, const std::vector< double > &yukawa_alpha, const std::vector< std::string > &kernel_file, const double &omega, ModulePW::PW_Basis *pw_rho)
Definition cal_mlkedf_descriptors.cpp:6
int nkernel
Definition cal_mlkedf_descriptors.h:99
void getTanhQ_nl(const int ikernel, std::vector< double > &ptanhq, ModulePW::PW_Basis *pw_rho, std::vector< double > &rtanhq_nl)
Definition cal_mlkedf_descriptors.cpp:385
std::vector< int > kernel_type
Definition cal_mlkedf_descriptors.h:100
void Laplacian(double *pinput, ModulePW::PW_Basis *pw_rho, double *routput)
Definition cal_mlkedf_descriptors.cpp:220
void divergence(double **pinput, ModulePW::PW_Basis *pw_rho, double *routput)
Definition cal_mlkedf_descriptors.cpp:234
~Cal_MLKEDF_Descriptors()
Definition cal_mlkedf_descriptors.h:21
void getTanhQ(std::vector< double > &pq, std::vector< double > &rtanhq)
Definition cal_mlkedf_descriptors.cpp:361
void read_kernel(const std::string &fileName, const double &scaling, ModulePW::PW_Basis *pw_rho, double *kernel_)
Definition cal_mlkedf_descriptors.cpp:132
double MLkernel_yukawa(double eta, double alpha)
Definition cal_mlkedf_descriptors.cpp:126
const double cTF
Definition cal_mlkedf_descriptors.h:96
std::vector< std::string > kernel_file
Definition cal_mlkedf_descriptors.h:103
std::vector< std::vector< double > > kernel
Definition cal_mlkedf_descriptors.h:104
void getTanh_Pnl(const int ikernel, std::vector< double > &ppnl, std::vector< double > &rtanh_pnl)
Definition cal_mlkedf_descriptors.cpp:367
double dtanh(double tanhx, double chi=1.)
Definition cal_mlkedf_descriptors.cpp:260
std::vector< double > chi_xi
Definition cal_mlkedf_descriptors.h:84
void tanh(std::vector< double > &pinput, std::vector< double > &routput, double chi=1.)
Definition cal_mlkedf_descriptors.cpp:252
void getF_KS(psi::Psi< std::complex< double > > *psi, elecstate::ElecState *pelec, ModulePW::PW_Basis_K *pw_psi, ModulePW::PW_Basis *pw_rho, UnitCell &ucell, const std::vector< std::vector< double > > &nablaRho, std::vector< double > &rF, std::vector< double > &rpauli)
Definition cal_mlkedf_descriptors.cpp:396
Special pw_basis class. It includes different k-points.
Definition pw_basis_k.h:57
A class which can convert a function of "r" to the corresponding linear superposition of plane waves ...
Definition pw_basis.h:56
Definition unitcell.h:16
Definition elecstate.h:15
Definition psi.h:37
This class has two functions: restart psi from the previous calculation, and write psi to the disk.
Definition cal_dos.h:9
Definition exx_lip.h:23