|
1 | 1 | #include "diago_cg.h" |
2 | | -#include "global.h" |
3 | 2 | #include "../src_parallel/parallel_reduce.h" |
4 | 3 | #include "../module_base/timer.h" |
| 4 | +#include "module_base/constants.h" |
| 5 | +#include "module_base/blas_connector.h" |
5 | 6 |
|
6 | 7 | int Diago_CG::moved = 0; |
7 | 8 |
|
8 | 9 |
|
9 | | -Diago_CG::Diago_CG() |
| 10 | +Diago_CG::Diago_CG(Hamilt_PW* phamilt) |
10 | 11 | { |
| 12 | + this->hpw = phamilt; |
11 | 13 | test_cg=0; |
12 | 14 | } |
13 | 15 | Diago_CG::~Diago_CG() {} |
@@ -66,10 +68,10 @@ void Diago_CG::diag |
66 | 68 | if (test_cg>2) GlobalV::ofs_running << "Diagonal Band : " << m << std::endl; |
67 | 69 | for (int i=0; i<dim; i++) phi_m[i] = phi(m, i); |
68 | 70 |
|
69 | | - GlobalC::hm.hpw.s_1psi(dim, phi_m, sphi); // sphi = S|psi(m)> |
| 71 | + this->hpw->s_1psi(dim, phi_m, sphi); // sphi = S|psi(m)> |
70 | 72 | this->schmit_orth(dim, dmx, m, phi, sphi, phi_m); |
71 | 73 |
|
72 | | - GlobalC::hm.hpw.h_1psi(dim , phi_m, hphi, sphi); |
| 74 | + this->hpw->h_1psi(dim , phi_m, hphi, sphi); |
73 | 75 |
|
74 | 76 | e[m] = this->ddot_real(dim, phi_m, hphi ); |
75 | 77 |
|
@@ -210,7 +212,7 @@ void Diago_CG::orthogonal_gradient( const int &dim, const int &dmx, |
210 | 212 | if (test_cg==1) ModuleBase::TITLE("Diago_CG","orthogonal_gradient"); |
211 | 213 | //ModuleBase::timer::tick("Diago_CG","orth_grad"); |
212 | 214 |
|
213 | | - GlobalC::hm.hpw.s_1psi(dim , g, sg); |
| 215 | + this->hpw->s_1psi(dim , g, sg); |
214 | 216 | int inc=1; |
215 | 217 | //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
216 | 218 | //qianrui replace 2021-3-15 |
@@ -341,7 +343,7 @@ bool Diago_CG::update_psi( |
341 | 343 | { |
342 | 344 | if (test_cg==1) ModuleBase::TITLE("Diago_CG","update_psi"); |
343 | 345 | //ModuleBase::timer::tick("Diago_CG","update"); |
344 | | - GlobalC::hm.hpw.h_1psi(dim, cg, hcg, scg); |
| 346 | + this->hpw->h_1psi(dim, cg, hcg, scg); |
345 | 347 | cg_norm = sqrt( this->ddot_real(dim, cg, scg) ); |
346 | 348 |
|
347 | 349 | if (cg_norm < 1.0e-10 ) return 1; |
@@ -476,7 +478,7 @@ void Diago_CG::schmit_orth |
476 | 478 | { |
477 | 479 | psi_m[ig] /= psi_norm; |
478 | 480 | } |
479 | | - GlobalC::hm.hpw.s_1psi(dim, psi_m, sphi); // sphi = S|psi(m)> |
| 481 | + this->hpw->s_1psi(dim, psi_m, sphi); // sphi = S|psi(m)> |
480 | 482 |
|
481 | 483 | delete [] lagrange ; |
482 | 484 | //ModuleBase::timer::tick("Diago_CG","schmit_orth"); |
|
0 commit comments