@@ -73,7 +73,7 @@ void Diago_CG::diag
7373
7474 this ->hpw ->h_1psi (dim , phi_m, hphi, sphi);
7575
76- e[m] = this -> ddot_real (dim, phi_m, hphi );
76+ e[m] = ModuleBase::GlobalFunc:: ddot_real (dim, phi_m, hphi );
7777
7878 int iter = 0 ;
7979 double gg_last = 0.0 ;
@@ -185,9 +185,9 @@ void Diago_CG::calculate_gradient(
185185
186186 // Update lambda !
187187 // (4) <psi|SPH|psi >
188- const double eh = this -> ddot_real ( dim, spsi, g);
188+ const double eh = ModuleBase::GlobalFunc:: ddot_real ( dim, spsi, g);
189189 // (5) <psi|SPS|psi >
190- const double es = this -> ddot_real ( dim, spsi, ppsi);
190+ const double es = ModuleBase::GlobalFunc:: ddot_real ( dim, spsi, ppsi);
191191 const double lambda = eh / es;
192192
193193 // Update g!
@@ -274,7 +274,7 @@ void Diago_CG::calculate_gamma_cg(
274274 // (1) Update gg_inter!
275275 // gg_inter = <g|psg>
276276 // Attention : the 'g' in psg is getted last time
277- gg_inter = this -> ddot_real ( dim, g, psg);// b means before
277+ gg_inter = ModuleBase::GlobalFunc:: ddot_real ( dim, g, psg);// b means before
278278 }
279279
280280 // (2) Update for psg!
@@ -289,7 +289,7 @@ void Diago_CG::calculate_gamma_cg(
289289
290290 // (3) Update gg_now!
291291 // gg_now = < g|P|sg > = < g|psg >
292- const double gg_now = this -> ddot_real ( dim, g, psg);
292+ const double gg_now = ModuleBase::GlobalFunc:: ddot_real ( dim, g, psg);
293293
294294 if (iter==0 )
295295 {
@@ -344,12 +344,12 @@ bool Diago_CG::update_psi(
344344 if (test_cg==1 ) ModuleBase::TITLE (" Diago_CG" ," update_psi" );
345345 // ModuleBase::timer::tick("Diago_CG","update");
346346 this ->hpw ->h_1psi (dim, cg, hcg, scg);
347- cg_norm = sqrt ( this -> ddot_real (dim, cg, scg) );
347+ cg_norm = sqrt ( ModuleBase::GlobalFunc:: ddot_real (dim, cg, scg) );
348348
349349 if (cg_norm < 1.0e-10 ) return 1 ;
350350
351- const double a0 = this -> ddot_real (dim, psi_m, hcg) * 2.0 / cg_norm;
352- const double b0 = this -> ddot_real (dim, cg, hcg) / ( cg_norm * cg_norm ) ;
351+ const double a0 = ModuleBase::GlobalFunc:: ddot_real (dim, psi_m, hcg) * 2.0 / cg_norm;
352+ const double b0 = ModuleBase::GlobalFunc:: ddot_real (dim, cg, hcg) / ( cg_norm * cg_norm ) ;
353353
354354 const double e0 = eigenvalue;
355355
@@ -448,7 +448,7 @@ void Diago_CG::schmit_orth
448448 // qianrui replace 2021-3-15
449449 char trans2=' N' ;
450450 zgemv_ (&trans2,&dim,&m,&ModuleBase::NEG_ONE,psi.c ,&dmx,lagrange,&inc,&ModuleBase::ONE,psi_m,&inc);
451- psi_norm -= ddot_real (m,lagrange,lagrange,false );
451+ psi_norm -= ModuleBase::GlobalFunc:: ddot_real (m,lagrange,lagrange,false );
452452 // ======================================================================
453453 /* for (int j = 0; j < m; j++)
454454 {
@@ -484,33 +484,3 @@ void Diago_CG::schmit_orth
484484 // ModuleBase::timer::tick("Diago_CG","schmit_orth");
485485 return ;
486486}
487-
488-
489- double Diago_CG::ddot_real
490- (
491- const int &dim,
492- const std::complex <double >* psi_L,
493- const std::complex <double >* psi_R,
494- const bool reduce
495- )
496- {
497- // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
498- // qianrui modify 2021-3-14
499- // Note that ddot_(2*dim,a,1,b,1) = REAL( zdotc_(dim,a,1,b,1) )
500- int dim2=2 *dim;
501- double *pL,*pR;
502- pL=(double *)psi_L;
503- pR=(double *)psi_R;
504- double result=BlasConnector::dot (dim2,pL,1 ,pR,1 );
505- if (reduce) Parallel_Reduce::reduce_double_pool ( result );
506- return result;
507- // ======================================================================
508- /* std::complex<double> result(0,0);
509- for (int i=0;i<dim;i++)
510- {
511- result += conj( psi_L[i] ) * psi_R[i];
512- }
513- Parallel_Reduce::reduce_complex_double_pool( result );
514- return result.real();*/
515- // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
516- }
0 commit comments