ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
deepks_spre.h
Go to the documentation of this file.
1#ifndef DEEPKS_SPRE_H
2#define DEEPKS_SPRE_H
3
4#ifdef __MLALGO
5
6#include "deepks_param.h"
10#include "source_base/timer.h"
16
17#include <torch/script.h>
18#include <torch/torch.h>
19
20namespace DeePKS_domain
21{
22//------------------------
23// deepks_spre.cpp
24//------------------------
25
26// This file contains 2 subroutines for calculating,
27// 1. cal_gdmepsl, calculating gdmepsl
28// 2. cal_gvepsl : gvepsl is used for training with stress label, which is derivative of
29// descriptors wrt strain tensor, calculated by
30// d(des)/d\epsilon_{ab} = d(pdm)/d\epsilon_{ab} * d(des)/d(pdm) = gdmepsl * gvdm
31// using einsum
32
33// calculate the gradient of pdm with regard to atomic virial stress tensor
34// d/d\epsilon D_{Inl,mm'}
35template <typename TK>
36void cal_gdmepsl(const int nks,
37 const DeePKS_Param& deepks_param,
38 const std::vector<ModuleBase::Vector3<double>>& kvec_d,
39 std::vector<hamilt::HContainer<double>*> phialpha,
40 const hamilt::HContainer<double>* dmr,
41 const UnitCell& ucell,
42 const LCAO_Orbitals& orb,
43 const Parallel_Orbitals& pv,
44 const Grid_Driver& GridD,
45 torch::Tensor& gdmepsl);
46
47void cal_gvepsl(const int nat,
48 const DeePKS_Param& deepks_param,
49 const std::vector<torch::Tensor>& gevdm,
50 const torch::Tensor& gdmepsl,
51 torch::Tensor& gvepsl,
52 const int rank);
53} // namespace DeePKS_domain
54#endif
55#endif
Definition deepks_basic.h:12
void cal_gdmepsl(const int nks, const DeePKS_Param &deepks_param, const std::vector< ModuleBase::Vector3< double > > &kvec_d, std::vector< hamilt::HContainer< double > * > phialpha, const hamilt::HContainer< double > *dmr, const UnitCell &ucell, const LCAO_Orbitals &orb, const Parallel_Orbitals &pv, const Grid_Driver &GridD, torch::Tensor &gdmepsl)
Definition deepks_spre.cpp:18
void cal_gvepsl(const int nat, const DeePKS_Param &deepks_param, const std::vector< torch::Tensor > &gevdm, const torch::Tensor &gdmepsl, torch::Tensor &gvepsl, const int rank)
Definition deepks_spre.cpp:156
Grid_Driver class for neighbor search interface.