ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
LCAO_deepks_io Namespace Reference

Functions

template<typename TK>
void print_dm (const int nks, const int nlocal, const int nrow, const std::vector< std::vector< TK > > &dm)
 print density matrices
void load_npy_gedm (const int nat, const int des_per_atom, double **gedm, double &e_delta, const int rank)
void save_npy_d (const int nat, const bool deepks_equiv, const DeePKS_Param &deepks_param, const std::string &dm_eig_file, const int rank, const std::vector< torch::Tensor > &descriptor, const std::vector< torch::Tensor > &descriptor_mag={})
 save descriptor
void save_npy_e (const double &e, const std::string &e_file, const int rank, const double unit_scale=Ry2Hartree)
template<typename TK, typename TH>
void save_npy_h (const std::vector< TH > &hamilt, const std::string &h_file, const int nlocal, const int nks, const int rank, const double unit_scale=Ry2Hartree)
void save_matrix2npy (const std::string &file_name, const ModuleBase::matrix &matrix, const int rank, const double &scale=1.0, const char mode='N', const double unit_scale=Ry2Hartree)
template<typename T>
void save_tensor2npy (const std::string &file_name, const torch::Tensor &tensor, const int rank)

Variables

constexpr double Ry2Hartree = 0.5
 others print quantities in .npy format

Function Documentation

◆ load_npy_gedm()

void LCAO_deepks_io::load_npy_gedm ( const int nat,
const int des_per_atom,
double ** gedm,
double & e_delta,
const int rank )
Here is the call graph for this function:

◆ print_dm()

template<typename TK>
void LCAO_deepks_io::print_dm ( const int nks,
const int nlocal,
const int nrow,
const std::vector< std::vector< TK > > & dm )

print density matrices

Here is the caller graph for this function:

◆ save_matrix2npy()

void LCAO_deepks_io::save_matrix2npy ( const std::string & file_name,
const ModuleBase::matrix & matrix,
const int rank,
const double & scale = 1.0,
const char mode = 'N',
const double unit_scale = Ry2Hartree )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_npy_d()

void LCAO_deepks_io::save_npy_d ( const int nat,
const bool deepks_equiv,
const DeePKS_Param & deepks_param,
const std::string & dm_eig_file,
const int rank,
const std::vector< torch::Tensor > & descriptor,
const std::vector< torch::Tensor > & descriptor_mag = {} )

save descriptor

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

◆ save_npy_e()

void LCAO_deepks_io::save_npy_e ( const double & e,
const std::string & e_file,
const int rank,
const double unit_scale = Ry2Hartree )
Parameters
[in]e$E_{base}$ or $E_{tot}$, in Ry
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_npy_h()

template<typename TK, typename TH>
void LCAO_deepks_io::save_npy_h ( const std::vector< TH > & hamilt,
const std::string & h_file,
const int nlocal,
const int nks,
const int rank,
const double unit_scale = Ry2Hartree )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_tensor2npy()

template<typename T>
template void LCAO_deepks_io::save_tensor2npy< double > ( const std::string & file_name,
const torch::Tensor & tensor,
const int rank )
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ Ry2Hartree

double LCAO_deepks_io::Ry2Hartree = 0.5
constexpr

others print quantities in .npy format

This file contains subroutines that contains interface with libnpy since many arrays must be saved in numpy format It also contains subroutines for printing density matrices which is used in unit tests There are 2 subroutines for printing and loading .npy file:

  1. print_dm : print density matrices
  2. load_npy_gedm : load gedm from .npy file
  1. save_npy_d : descriptor -> deepks_dm_eig.npy
  2. save_npy_e : energy
  3. save_npy_h : Hamiltonian
  4. save_matrix2npy : ModuleBase::matrix -> .npy, for force, stress and orbital
  5. save_tensor2npy : torch::Tensor -> .npy, for precalculation variables Ry2Hartree : convert Ry to Hartree, for energy, force, stress, orbital and Hamiltonian, which is consistent with deepks-kit. Used in save_npy_e, save_npy_h and save_matrix2npy by default