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, std::ostream& ofs_running);
20
21 void ml_potential(const double * const * prho, const ModulePW::PW_Basis *pw_rho, ModuleBase::matrix &rpotential);
22
23 void gen_training_data(const double * const *prho, const ModulePW::PW_Basis *pw_rho, const double *veff);
24 void localTest(const double * const *prho, const ModulePW::PW_Basis *pw_rho, std::ostream& ofs_running);
25
26 void init_data(
27 const int &nkernel,
28 const bool &of_ml_gamma,
29 const bool &of_ml_p,
30 const bool &of_ml_q,
31 const bool &of_ml_tanhp,
32 const bool &of_ml_tanhq,
33 const std::vector<int> &of_ml_gammanl_,
34 const std::vector<int> &of_ml_pnl,
35 const std::vector<int> &of_ml_qnl,
36 const std::vector<int> &of_ml_xi,
37 const std::vector<int> &of_ml_tanhxi,
38 const std::vector<int> &of_ml_tanhxi_nl,
39 const std::vector<int> &of_ml_tanh_pnl,
40 const std::vector<int> &of_ml_tanh_qnl,
41 const std::vector<int> &of_ml_tanhp_nl,
42 const std::vector<int> &of_ml_tanhq_nl
43 );
44
45 double ml_exx_energy = 0.0;
46};
47
48
49class PotML_EXX : public PotBase
50{
51 public:
52 PotML_EXX(const ModulePW::PW_Basis* rho_basis_in, const UnitCell* ucell_in)
53 {
54 this->rho_basis_ = rho_basis_in;
55 this->dynamic_mode = true;
56 this->fixed_mode = false;
57
58 this->ml_exx.set_para(PARAM.inp, ucell_in, rho_basis_in, GlobalV::ofs_running);
59 }
61
62 void cal_v_eff(const Charge*const chg, const UnitCell*const ucell, ModuleBase::matrix& v_eff) override
63 {
64 if (PARAM.inp.of_ml_local_test) this->ml_exx.localTest(chg->rho, this->rho_basis_, GlobalV::ofs_running);
65 this->ml_exx.ml_potential(chg->rho, this->rho_basis_, v_eff);
66 }
67
68 double get_energy() const override { return this->ml_exx.ml_exx_energy; }
69
70private:
72};
73
74
75}
76#endif
77#endif
Definition charge.h:24
double ** rho
Definition charge.h:49
int nkernel
Definition ml_base.h:190
ML_Base()
Definition ml_base.cpp:6
Definition matrix.h:15
A class which can convert a function of "r" to the corresponding linear superposition of plane waves ...
Definition pw_basis.h:60
Provide the basic information about unitcell.
Definition unitcell.h:16
Definition pot_ml_exx.h:14
void gen_training_data(const double *const *prho, const ModulePW::PW_Basis *pw_rho, const double *veff)
Generate training data for ML KEDF.
Definition pot_ml_exx.cpp:175
double ml_exx_energy
Definition pot_ml_exx.h:45
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:128
ML_EXX()
Definition pot_ml_exx.cpp:12
void set_para(const Input_para &inp, const UnitCell *ucell_in, const ModulePW::PW_Basis *rho_basis_in, std::ostream &ofs_running)
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
void localTest(const double *const *prho, const ModulePW::PW_Basis *pw_rho, std::ostream &ofs_running)
For test.
Definition pot_ml_exx.cpp:204
virtual ~ML_EXX()
Definition pot_ml_exx.cpp:18
const ModulePW::PW_Basis * rho_basis_
Definition pot_base.h:52
bool dynamic_mode
Definition pot_base.h:49
bool fixed_mode
Definition pot_base.h:48
PotBase()
Definition pot_base.h:26
ML_EXX ml_exx
Definition pot_ml_exx.h:71
double get_energy() const override
Definition pot_ml_exx.h:68
~PotML_EXX()
Definition pot_ml_exx.h:60
PotML_EXX(const ModulePW::PW_Basis *rho_basis_in, const UnitCell *ucell_in)
Definition pot_ml_exx.h:52
void cal_v_eff(const Charge *const chg, const UnitCell *const ucell, ModuleBase::matrix &v_eff) override
Definition pot_ml_exx.h:62
std::ofstream ofs_running
Definition global_variable.cpp:38
Definition read_atoms_hlp_test.cpp:13
Parameter PARAM
Definition parameter.cpp:3
Definition input_parameter.h:13