ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
gradient_checks.h
Go to the documentation of this file.
1#ifndef ABACUS_LR_GRADIENT_CHECKS_H
2#define ABACUS_LR_GRADIENT_CHECKS_H
4namespace LR
5{
6// check C_uaC_va-C_uiC_vi of lumo-homo, nocc=1, nk=1
7template<typename T>
8inline void test_dm_diff_H2(const T* dm, const psi::Psi<T>& c, const int nbasis)
9{
10 std::cout << "difference dm cal: " << std::endl;
11 LR_Util::print_value(dm, nbasis, nbasis);
12 std::cout << "difference dm ref: " << std::endl;
13 for (int i = 0;i < nbasis;++i)
14 {
15 for (int j = 0;j < nbasis;++j)
16 {
17 std::cout << c(0, 1, i) * c(0, 1, j) - c(0, 0, i) * c(0, 0, j) << " ";
18 }
19 std::cout << std::endl;
20 }
21}
22
23// check e_aC_uaC_va-e_iC_uiC_vi of lumo-homo, nocc=1, nk=1
24template<typename T>
25inline void test_edm_H2(const T* const edm, const double* const eig_ks, const psi::Psi<T>& c, const int nbasis)
26{
27 std::cout << "edm cal: " << std::endl;
28 LR_Util::print_value(edm, nbasis, nbasis);
29 std::cout << "edm ref: " << std::endl;
30 for (int i = 0;i < nbasis;++i)
31 {
32 for (int j = 0;j < nbasis;++j)
33 {
34 std::cout << eig_ks[1] * c(0, 1, i) * c(0, 1, j) - eig_ks[0] * c(0, 0, i) * c(0, 0, j) << " ";
35 }
36 std::cout << std::endl;
37 }
38}
39
40}
41#endif
Definition psi.h:37
#define T
Definition exp.cpp:237
int print_value(const T *ptr, const int &size)
Definition lr_util_print.h:91
Definition esolver_lr_lcao_tddft.h:28
void test_edm_H2(const T *const edm, const double *const eig_ks, const psi::Psi< T > &c, const int nbasis)
Definition gradient_checks.h:25
void test_dm_diff_H2(const T *dm, const psi::Psi< T > &c, const int nbasis)
Definition gradient_checks.h:8