ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
LCAO_Deepks< T > Class Template Reference

#include <LCAO_deepks.h>

Collaboration diagram for LCAO_Deepks< T >:

Public Member Functions

int get_hr_cal ()
 
void set_hr_cal (bool cal)
 
 LCAO_Deepks ()
 
 ~LCAO_Deepks ()
 
void init (const LCAO_Orbitals &orb, const int nat, const int ntype, const int nks, const Parallel_Orbitals &pv_in, std::vector< int > na, std::ofstream &ofs)
 
void allocate_V_delta (const int nat, const int nks=1)
 Allocate memory for correction to Hamiltonian.
 
void init_DMR (const UnitCell &ucell, const LCAO_Orbitals &orb, const Parallel_Orbitals &pv, const Grid_Driver &GridD)
 Initialize the dm_r container.
 
void dpks_cal_e_delta_band (const std::vector< std::vector< T > > &dm, const int nks)
 a temporary interface for cal_e_delta_band
 

Public Attributes

double E_delta = 0.0
 (Unit: Ry) Correction energy provided by NN
 
double e_delta_band = 0.0
 (Unit: Ry) $tr(\rho H_\delta), \rho = \sum_i{c_{i, \mu}c_{i,\nu}} $
 
std::vector< std::vector< T > > V_delta
 
int lmaxd = 0
 
int nmaxd = 0
 
int inlmax = 0
 
int n_descriptor
 
int des_per_atom
 
std::vector< int > inl2l
 
ModuleBase::IntArrayinl_index
 
bool init_pdm = false
 
torch::jit::script::Module model_deepks
 
std::vector< hamilt::HContainer< double > * > phialpha
 
hamilt::HContainer< double > * dm_r = nullptr
 
std::vector< torch::Tensor > pdm
 
double ** gedm
 dE/dD, autograd from loaded model(E: Ry)
 

Private Member Functions

void init_index (const int ntype, const int nat, std::vector< int > na, const int tot_inl, const LCAO_Orbitals &orb, std::ofstream &ofs)
 

Private Attributes

bool hr_cal = true
 
const Parallel_Orbitalspv
 

Detailed Description

template<typename T>
class LCAO_Deepks< T >

The LCAO_Deepks contains subroutines for implementation of the DeePKS method in atomic basis. In essential, it is a machine-learned correction term to the XC potential in the form of delta_V=|alpha> V(D) <alpha|, where D is a list of descriptors The subroutines may be roughly grouped into 3 types

  1. generation of projected density matrices pdm=sum_i,occ <phi_i|alpha><alpha|phi_i> and then descriptors D=eig(pdm) as well as their gradients with regard to atomic position, gdmx = d/dX (pdm) and grad_vx = d/dX (D)
  2. loading the model, which requires interfaces with libtorch
  3. applying the correction potential, delta_V, in Kohn-Sham Hamiltonian and calculation of energy, force, stress

For details of DeePKS method, you can refer to DeePKS paper.

Constructor & Destructor Documentation

◆ LCAO_Deepks()

template<typename T >
LCAO_Deepks< T >::LCAO_Deepks ( )
explicit

◆ ~LCAO_Deepks()

template<typename T >
LCAO_Deepks< T >::~LCAO_Deepks ( )

Member Function Documentation

◆ allocate_V_delta()

template<typename T >
void LCAO_Deepks< T >::allocate_V_delta ( const int  nat,
const int  nks = 1 
)

Allocate memory for correction to Hamiltonian.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dpks_cal_e_delta_band()

template<typename T >
void LCAO_Deepks< T >::dpks_cal_e_delta_band ( const std::vector< std::vector< T > > &  dm,
const int  nks 
)

a temporary interface for cal_e_delta_band

Here is the call graph for this function:

◆ get_hr_cal()

template<typename T >
int LCAO_Deepks< T >::get_hr_cal ( )
inline

◆ init()

template<typename T >
void LCAO_Deepks< T >::init ( const LCAO_Orbitals orb,
const int  nat,
const int  ntype,
const int  nks,
const Parallel_Orbitals pv_in,
std::vector< int >  na,
std::ofstream &  ofs 
)

Allocate memory and calculate the index of descriptor in all atoms. (only for descriptor part, not including scf)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_DMR()

template<typename T >
void LCAO_Deepks< T >::init_DMR ( const UnitCell ucell,
const LCAO_Orbitals orb,
const Parallel_Orbitals pv,
const Grid_Driver GridD 
)

Initialize the dm_r container.

Here is the call graph for this function:

◆ init_index()

template<typename T >
void LCAO_Deepks< T >::init_index ( const int  ntype,
const int  nat,
std::vector< int >  na,
const int  tot_inl,
const LCAO_Orbitals orb,
std::ofstream &  ofs 
)
private

◆ set_hr_cal()

template<typename T >
void LCAO_Deepks< T >::set_hr_cal ( bool  cal)
inline

Member Data Documentation

◆ des_per_atom

template<typename T >
int LCAO_Deepks< T >::des_per_atom

◆ dm_r

template<typename T >
hamilt::HContainer<double>* LCAO_Deepks< T >::dm_r = nullptr

◆ E_delta

template<typename T >
double LCAO_Deepks< T >::E_delta = 0.0

(Unit: Ry) Correction energy provided by NN

◆ e_delta_band

template<typename T >
double LCAO_Deepks< T >::e_delta_band = 0.0

(Unit: Ry) $tr(\rho H_\delta), \rho = \sum_i{c_{i, \mu}c_{i,\nu}} $

◆ gedm

template<typename T >
double** LCAO_Deepks< T >::gedm

dE/dD, autograd from loaded model(E: Ry)

◆ hr_cal

template<typename T >
bool LCAO_Deepks< T >::hr_cal = true
private

◆ init_pdm

template<typename T >
bool LCAO_Deepks< T >::init_pdm = false

◆ inl2l

template<typename T >
std::vector<int> LCAO_Deepks< T >::inl2l

◆ inl_index

template<typename T >
ModuleBase::IntArray* LCAO_Deepks< T >::inl_index

◆ inlmax

template<typename T >
int LCAO_Deepks< T >::inlmax = 0

◆ lmaxd

template<typename T >
int LCAO_Deepks< T >::lmaxd = 0

◆ model_deepks

template<typename T >
torch::jit::script::Module LCAO_Deepks< T >::model_deepks

◆ n_descriptor

template<typename T >
int LCAO_Deepks< T >::n_descriptor

◆ nmaxd

template<typename T >
int LCAO_Deepks< T >::nmaxd = 0

◆ pdm

template<typename T >
std::vector<torch::Tensor> LCAO_Deepks< T >::pdm

◆ phialpha

template<typename T >
std::vector<hamilt::HContainer<double>*> LCAO_Deepks< T >::phialpha

◆ pv

template<typename T >
const Parallel_Orbitals* LCAO_Deepks< T >::pv
private

◆ V_delta

template<typename T >
std::vector<std::vector<T> > LCAO_Deepks< T >::V_delta

Correction term to the Hamiltonian matrix: $\langle\phi|V_\delta|\phi\rangle$ The first dimension is for k-points V_delta(k)


The documentation for this class was generated from the following files: