ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
deepks_vdpre.h
Go to the documentation of this file.
1#ifndef DEEPKS_VDPRE_H
2#define DEEPKS_VDPRE_H
3
4#ifdef __MLALGO
5
9#include "source_base/timer.h"
14
15#include <torch/script.h>
16#include <torch/torch.h>
17
18namespace DeePKS_domain
19{
20//------------------------
21// deepks_vdpre.cpp
22//------------------------
23
24// This file contains 3 subroutines for calculating v_delta,
25// 1. cal_v_delta_precalc : v_delta_precalc is used for training with v_delta label,
26// which equals gevdm * v_delta_pdm,
27// v_delta_pdm = overlap * overlap
28// 2. prepare_phialpha : prepare phialpha for outputting npy file
29// 3. prepare_gevdm : prepare gevdm for outputting npy file
30
31// for deepks_v_delta = 1
32// calculates v_delta_precalc
33template <typename TK>
34void cal_v_delta_precalc(const int nlocal,
35 const int lmaxd,
36 const int inlmax,
37 const int nat,
38 const int nks,
39 const std::vector<int>& inl2l,
40 const std::vector<ModuleBase::Vector3<double>>& kvec_d,
41 const std::vector<hamilt::HContainer<double>*> phialpha,
42 const std::vector<torch::Tensor> gevdm,
43 const ModuleBase::IntArray* inl_index,
44 const UnitCell& ucell,
45 const LCAO_Orbitals& orb,
46 const Parallel_Orbitals& pv,
47 const Grid_Driver& GridD,
48 torch::Tensor& v_delta_precalc);
49
50// for deepks_v_delta = 2
51// prepare phialpha for outputting npy file
52template <typename TK>
53void prepare_phialpha(const int nlocal,
54 const int lmaxd,
55 const int inlmax,
56 const int nat,
57 const int nks,
58 const std::vector<ModuleBase::Vector3<double>>& kvec_d,
59 const std::vector<hamilt::HContainer<double>*> phialpha,
60 const UnitCell& ucell,
61 const LCAO_Orbitals& orb,
62 const Parallel_Orbitals& pv,
63 const Grid_Driver& GridD,
64 torch::Tensor& phialpha_out);
65
66// prepare gevdm for outputting npy file
67void prepare_gevdm(const int nat,
68 const int lmaxd,
69 const int inlmax,
70 const LCAO_Orbitals& orb,
71 const std::vector<torch::Tensor>& gevdm_in,
72 torch::Tensor& gevdm_out);
73} // namespace DeePKS_domain
74#endif
75#endif
Definition sltk_grid_driver.h:43
Definition ORB_read.h:19
Integer array.
Definition intarray.h:20
3 elements vector
Definition vector3.h:22
Definition parallel_orbitals.h:9
Definition unitcell.h:16
Definition hcontainer.h:144
Definition deepks_basic.h:14
void prepare_phialpha(const int nlocal, const int lmaxd, const int inlmax, const int nat, const int nks, const std::vector< ModuleBase::Vector3< double > > &kvec_d, const std::vector< hamilt::HContainer< double > * > phialpha, const UnitCell &ucell, const LCAO_Orbitals &orb, const Parallel_Orbitals &pv, const Grid_Driver &GridD, torch::Tensor &phialpha_out)
Definition deepks_vdpre.cpp:175
void cal_v_delta_precalc(const int nlocal, const int lmaxd, const int inlmax, const int nat, const int nks, const std::vector< int > &inl2l, const std::vector< ModuleBase::Vector3< double > > &kvec_d, const std::vector< hamilt::HContainer< double > * > phialpha, const std::vector< torch::Tensor > gevdm, const ModuleBase::IntArray *inl_index, const UnitCell &ucell, const LCAO_Orbitals &orb, const Parallel_Orbitals &pv, const Grid_Driver &GridD, torch::Tensor &v_delta_precalc)
cal_v_delta_precalc : v_delta_precalc is used for training with v_delta label,
Definition deepks_vdpre.cpp:24
void prepare_gevdm(const int nat, const int lmaxd, const int inlmax, const LCAO_Orbitals &orb, const std::vector< torch::Tensor > &gevdm_in, torch::Tensor &gevdm_out)
Definition deepks_vdpre.cpp:270