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#include "source_psi/psi.h"
10
11namespace ModuleIO
12{
13
21{
22public:
24
25 void set_para(
26 const int &nx,
27 const double &nelec,
28 const double &tf_weight,
29 const double &vw_weight,
30 const double &chi_p,
31 const double &chi_q,
32 const std::vector<double> &chi_xi,
33 const std::vector<double> &chi_pnl,
34 const std::vector<double> &chi_qnl,
35 const int &nkernel,
36 const std::vector<int> &kernel_type,
37 const std::vector<double> &kernel_scaling,
38 const std::vector<double> &yukawa_alpha,
39 const std::vector<std::string> &kernel_file,
40 const double &omega,
41 const ModulePW::PW_Basis *pw_rho);
42 // get input parameters
43 void getGamma(const double * const *prho, std::vector<double> &rgamma);
44 void getP(const double * const *prho, const ModulePW::PW_Basis *pw_rho, std::vector<std::vector<double>> &pnablaRho, std::vector<double> &rp);
45 void getQ(const double * const *prho, const ModulePW::PW_Basis *pw_rho, std::vector<double> &rq);
46 void getGammanl(const int ikernel, std::vector<double> &pgamma, const ModulePW::PW_Basis *pw_rho, std::vector<double> &rgammanl);
47 void getPnl(const int ikernel, std::vector<double> &pp, const ModulePW::PW_Basis *pw_rho, std::vector<double> &rpnl);
48 void getQnl(const int ikernel, std::vector<double> &pq, const ModulePW::PW_Basis *pw_rho, std::vector<double> &rqnl);
49 // new parameters 2023-02-03
50 void getXi(std::vector<double> &pgamma, std::vector<double> &pgammanl, std::vector<double> &rxi);
51 void getTanhXi(const int ikernel, std::vector<double> &pgamma, std::vector<double> &pgammanl, std::vector<double> &rtanhxi);
52 void getTanhP(std::vector<double> &pp, std::vector<double> &rtanhp);
53 void getTanhQ(std::vector<double> &pq, std::vector<double> &rtanhq);
54 void getTanh_Pnl(const int ikernel, std::vector<double> &ppnl, std::vector<double> &rtanh_pnl);
55 void getTanh_Qnl(const int ikernel, std::vector<double> &pqnl, std::vector<double> &rtanh_qnl);
56 void getTanhP_nl(const int ikernel, std::vector<double> &ptanhp, const ModulePW::PW_Basis *pw_rho, std::vector<double> &rtanhp_nl);
57 void getTanhQ_nl(const int ikernel, std::vector<double> &ptanhq, const ModulePW::PW_Basis *pw_rho, std::vector<double> &rtanhq_nl);
58 // 2023-03-20
59 void getTanhXi_nl(const int ikernel, std::vector<double> &ptanhxi, const ModulePW::PW_Basis *pw_rho, std::vector<double> &rtanhxi_nl);
60
61 void getF_KS(
62 psi::Psi<std::complex<double>> *psi,
65 const ModulePW::PW_Basis *pw_rho,
66 UnitCell& ucell,
67 const std::vector<std::vector<double>> &nablaRho,
68 std::vector<double> &rF,
69 std::vector<double> &rpauli
70 );
71 // get intermediate variables of V_Pauli
72 void getNablaRho(const double * const *prho, const ModulePW::PW_Basis *pw_rho, std::vector<std::vector<double>> &rnablaRho);
73
74 // tools
75 double MLkernel(double eta, double tf_weight, double vw_weight);
76 double MLkernel_yukawa(double eta, double alpha);
77 void read_kernel(const std::string &fileName, const double& scaling, const ModulePW::PW_Basis *pw_rho, double* kernel_);
78 void multiKernel(const int ikernel, double *pinput, const ModulePW::PW_Basis *pw_rho, double *routput);
79 void Laplacian(double * pinput, const ModulePW::PW_Basis *pw_rho, double * routput);
80 void divergence(double ** pinput, const ModulePW::PW_Basis *pw_rho, double * routput);
81
82 void tanh(std::vector<double> &pinput, std::vector<double> &routput, double chi=1.);
83 double dtanh(double tanhx, double chi=1.);
84
85 // new parameters 2023-02-13
86 std::vector<double> chi_xi = {1.0};
87 double chi_p = 1.;
88 double chi_q = 1.;
89 std::vector<double> chi_pnl = {1.0};
90 std::vector<double> chi_qnl = {1.0};
91
92 int nx = 0;
93 double dV = 0.;
94 double rho0 = 0.; // average rho
95 double kF = 0.; // Fermi vector kF = (3 pi^2 rho0)^(1/3)
96 double tkF = 0.; // 2 * kF
97 // double weightml = 1.;
98 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)
99 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
100
101 int nkernel = 1;
102 std::vector<int> kernel_type = {1};
103 std::vector<double> kernel_scaling = {1.0};
104 std::vector<double> yukawa_alpha = {1.0};
105 std::vector<std::string> kernel_file = {"none"};
106 std::vector<std::vector<double>> kernel = {}; // kernel[ikernel][ipw] = kernel value for ikernel and ipw
107};
108
109} // namespace ModuleIO
110
111#endif
A class to calculate the descriptors for ML KEDF. Sun, Liang, and Mohan Chen. Physical Review B 109....
Definition cal_mlkedf_descriptors.h:21
void getP(const double *const *prho, const ModulePW::PW_Basis *pw_rho, std::vector< std::vector< double > > &pnablaRho, std::vector< double > &rp)
Definition cal_mlkedf_descriptors.cpp:273
void getTanhQ_nl(const int ikernel, std::vector< double > &ptanhq, const ModulePW::PW_Basis *pw_rho, std::vector< double > &rtanhq_nl)
Definition cal_mlkedf_descriptors.cpp:385
double MLkernel(double eta, double tf_weight, double vw_weight)
Definition cal_mlkedf_descriptors.cpp:79
void Laplacian(double *pinput, const ModulePW::PW_Basis *pw_rho, double *routput)
Definition cal_mlkedf_descriptors.cpp:220
double chi_p
Definition cal_mlkedf_descriptors.h:87
void getGammanl(const int ikernel, std::vector< double > &pgamma, const ModulePW::PW_Basis *pw_rho, std::vector< double > &rgammanl)
Definition cal_mlkedf_descriptors.cpp:305
std::vector< double > kernel_scaling
Definition cal_mlkedf_descriptors.h:103
double chi_q
Definition cal_mlkedf_descriptors.h:88
double tkF
Definition cal_mlkedf_descriptors.h:96
double dV
Definition cal_mlkedf_descriptors.h:93
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:89
int nx
Definition cal_mlkedf_descriptors.h:92
void getTanhXi_nl(const int ikernel, std::vector< double > &ptanhxi, const ModulePW::PW_Basis *pw_rho, std::vector< double > &rtanhxi_nl)
Definition cal_mlkedf_descriptors.cpp:391
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:104
void getGamma(const double *const *prho, std::vector< double > &rgamma)
Definition cal_mlkedf_descriptors.cpp:265
std::vector< double > chi_qnl
Definition cal_mlkedf_descriptors.h:90
const double pqcoef
Definition cal_mlkedf_descriptors.h:99
void getTanhP_nl(const int ikernel, std::vector< double > &ptanhp, const ModulePW::PW_Basis *pw_rho, std::vector< double > &rtanhp_nl)
Definition cal_mlkedf_descriptors.cpp:379
void getTanhXi(const int ikernel, std::vector< double > &pgamma, std::vector< double > &pgammanl, std::vector< double > &rtanhxi)
Definition cal_mlkedf_descriptors.cpp:338
void getXi(std::vector< double > &pgamma, std::vector< double > &pgammanl, std::vector< double > &rxi)
Definition cal_mlkedf_descriptors.cpp:321
double kF
Definition cal_mlkedf_descriptors.h:95
double rho0
Definition cal_mlkedf_descriptors.h:94
void read_kernel(const std::string &fileName, const double &scaling, const ModulePW::PW_Basis *pw_rho, double *kernel_)
Definition cal_mlkedf_descriptors.cpp:132
int nkernel
Definition cal_mlkedf_descriptors.h:101
void getQnl(const int ikernel, std::vector< double > &pq, const ModulePW::PW_Basis *pw_rho, std::vector< double > &rqnl)
Definition cal_mlkedf_descriptors.cpp:315
void getF_KS(psi::Psi< std::complex< double > > *psi, elecstate::ElecState *pelec, ModulePW::PW_Basis_K *pw_psi, const 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
void getQ(const double *const *prho, const ModulePW::PW_Basis *pw_rho, std::vector< double > &rq)
Definition cal_mlkedf_descriptors.cpp:286
std::vector< int > kernel_type
Definition cal_mlkedf_descriptors.h:102
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, const ModulePW::PW_Basis *pw_rho)
Definition cal_mlkedf_descriptors.cpp:6
~Cal_MLKEDF_Descriptors()
Definition cal_mlkedf_descriptors.h:23
void getPnl(const int ikernel, std::vector< double > &pp, const ModulePW::PW_Basis *pw_rho, std::vector< double > &rpnl)
Definition cal_mlkedf_descriptors.cpp:310
void getTanhQ(std::vector< double > &pq, std::vector< double > &rtanhq)
Definition cal_mlkedf_descriptors.cpp:361
void multiKernel(const int ikernel, double *pinput, const ModulePW::PW_Basis *pw_rho, double *routput)
Definition cal_mlkedf_descriptors.cpp:206
double MLkernel_yukawa(double eta, double alpha)
Definition cal_mlkedf_descriptors.cpp:126
const double cTF
Definition cal_mlkedf_descriptors.h:98
void divergence(double **pinput, const ModulePW::PW_Basis *pw_rho, double *routput)
Definition cal_mlkedf_descriptors.cpp:234
std::vector< std::string > kernel_file
Definition cal_mlkedf_descriptors.h:105
std::vector< std::vector< double > > kernel
Definition cal_mlkedf_descriptors.h:106
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:86
void tanh(std::vector< double > &pinput, std::vector< double > &routput, double chi=1.)
Definition cal_mlkedf_descriptors.cpp:252
void getNablaRho(const double *const *prho, const ModulePW::PW_Basis *pw_rho, std::vector< std::vector< double > > &rnablaRho)
Definition cal_mlkedf_descriptors.cpp:500
Special pw_basis class. It includes different k-points.
Definition pw_basis_k.h:56
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:15
Definition elecstate.h:15
Definition psi.h:37
Definition input_help.cpp:10
Definition exx_lip.h:23