ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
pot_ml_exx.h
Go to the documentation of this file.
1#ifndef POT_ML_EXX_H
2#define POT_ML_EXX_H
3
4#ifdef __MLALGO
5
6#include "pot_base.h"
9
10namespace elecstate
11{
12
13class ML_EXX : public ML_Base
14{
15public:
16 ML_EXX();
17 virtual ~ML_EXX();
18
19 void set_para(const Input_para& inp, const UnitCell* ucell_in, const ModulePW::PW_Basis* rho_basis_in);
20
21 void ml_potential(const double * const * prho, const ModulePW::PW_Basis *pw_rho, ModuleBase::matrix &rpotential);
22
23 // output all parameters
24 void generateTrainData(const double * const *prho, const ModulePW::PW_Basis *pw_rho, const double *veff);
25 void localTest(const double * const *prho, const ModulePW::PW_Basis *pw_rho);
26
27 void init_data(
28 const int &nkernel,
29 const bool &of_ml_gamma,
30 const bool &of_ml_p,
31 const bool &of_ml_q,
32 const bool &of_ml_tanhp,
33 const bool &of_ml_tanhq,
34 const std::vector<int> &of_ml_gammanl_,
35 const std::vector<int> &of_ml_pnl,
36 const std::vector<int> &of_ml_qnl,
37 const std::vector<int> &of_ml_xi,
38 const std::vector<int> &of_ml_tanhxi,
39 const std::vector<int> &of_ml_tanhxi_nl,
40 const std::vector<int> &of_ml_tanh_pnl,
41 const std::vector<int> &of_ml_tanh_qnl,
42 const std::vector<int> &of_ml_tanhp_nl,
43 const std::vector<int> &of_ml_tanhq_nl
44 );
45
46 double ml_exx_energy = 0.0;
47};
48
49
50class PotML_EXX : public PotBase
51{
52 public:
53 PotML_EXX(const ModulePW::PW_Basis* rho_basis_in, const UnitCell* ucell_in)
54 {
55 this->rho_basis_ = rho_basis_in;
56 this->dynamic_mode = true;
57 this->fixed_mode = false;
58
59 this->ml_exx.set_para(PARAM.inp, ucell_in, rho_basis_in);
60 }
62
63 void cal_v_eff(const Charge*const chg, const UnitCell*const ucell, ModuleBase::matrix& v_eff) override
64 {
65 if (PARAM.inp.of_ml_local_test) this->ml_exx.localTest(chg->rho, this->rho_basis_);
66 this->ml_exx.ml_potential(chg->rho, this->rho_basis_, v_eff);
67 }
68
69 double get_energy() const override { return this->ml_exx.ml_exx_energy; }
70
71private:
73};
74
75
76}
77#endif
78#endif
Definition charge.h:17
double ** rho
Definition charge.h:36
Definition ml_base.h:17
int nkernel
Definition ml_base.h:116
Definition matrix.h:18
A class which can convert a function of "r" to the corresponding linear superposition of plane waves ...
Definition pw_basis.h:56
const Input_para & inp
Definition parameter.h:26
Definition unitcell.h:15
Definition pot_ml_exx.h:14
double ml_exx_energy
Definition pot_ml_exx.h:46
void localTest(const double *const *prho, const ModulePW::PW_Basis *pw_rho)
For test.
Definition pot_ml_exx.cpp:180
void ml_potential(const double *const *prho, const ModulePW::PW_Basis *pw_rho, ModuleBase::matrix &rpotential)
Get the potential of ML KEDF, and add it into rpotential.
Definition pot_ml_exx.cpp:104
ML_EXX()
Definition pot_ml_exx.cpp:12
void generateTrainData(const double *const *prho, const ModulePW::PW_Basis *pw_rho, const double *veff)
Generate training data for ML KEDF.
Definition pot_ml_exx.cpp:151
void set_para(const Input_para &inp, const UnitCell *ucell_in, const ModulePW::PW_Basis *rho_basis_in)
Definition pot_ml_exx.cpp:20
void init_data(const int &nkernel, const bool &of_ml_gamma, const bool &of_ml_p, const bool &of_ml_q, const bool &of_ml_tanhp, const bool &of_ml_tanhq, const std::vector< int > &of_ml_gammanl_, const std::vector< int > &of_ml_pnl, const std::vector< int > &of_ml_qnl, const std::vector< int > &of_ml_xi, const std::vector< int > &of_ml_tanhxi, const std::vector< int > &of_ml_tanhxi_nl, const std::vector< int > &of_ml_tanh_pnl, const std::vector< int > &of_ml_tanh_qnl, const std::vector< int > &of_ml_tanhp_nl, const std::vector< int > &of_ml_tanhq_nl)
Initialize the data for ML KEDF, and generate the mapping between descriptor and kernel.
Definition pot_ml_exx_label.cpp:27
virtual ~ML_EXX()
Definition pot_ml_exx.cpp:18
Definition pot_base.h:22
const ModulePW::PW_Basis * rho_basis_
Definition pot_base.h:37
bool dynamic_mode
Definition pot_base.h:34
bool fixed_mode
Definition pot_base.h:33
Definition pot_ml_exx.h:51
ML_EXX ml_exx
Definition pot_ml_exx.h:72
double get_energy() const override
Definition pot_ml_exx.h:69
~PotML_EXX()
Definition pot_ml_exx.h:61
PotML_EXX(const ModulePW::PW_Basis *rho_basis_in, const UnitCell *ucell_in)
Definition pot_ml_exx.h:53
void cal_v_eff(const Charge *const chg, const UnitCell *const ucell, ModuleBase::matrix &v_eff) override
Definition pot_ml_exx.h:63
Definition read_atoms_helper_test.cpp:11
Parameter PARAM
Definition parameter.cpp:3
Definition input_parameter.h:12
bool of_ml_local_test
Test: read in the density, and output the F and Pauli potential.
Definition input_parameter.h:255