1212#include " source_base/global_function.h"
1313#include " source_base/vector3.h"
1414#include " source_cell/klist.h"
15- #include " source_lcao/wavefunc_in_pw.h"
1615#include " source_base/module_external/lapack_connector.h"
1716#include " source_base/parallel_global.h"
1817#include " source_io/module_parameter/parameter.h"
@@ -325,14 +324,14 @@ void Exx_Lip<T, Device>::qkg2_exp(const int ik, const int iq)
325324 else
326325 { this ->recip_qkg2 [ig] = 1.0 / qkg2; }
327326 this ->sum2_factor += this ->recip_qkg2 [ig] * std::exp (-info.lambda * qkg2);
328- this ->recip_qkg2 [ig] = sqrt (this ->recip_qkg2 [ig]);
327+ this ->recip_qkg2 [ig] = std:: sqrt (this ->recip_qkg2 [ig]);
329328 }
330329 else if (Conv_Coulomb_Pot_K::Ccp_Type::Erfc == info.ccp_type )
331330 {
332331 if (std::abs (qkg2) < 1e-10 )
333332 { this ->recip_qkg2 [ig] = 1.0 / (2 * info.hse_omega ); }
334333 else
335- { this ->recip_qkg2 [ig] = sqrt ((1 - std::exp (-qkg2 / (4 * info.hse_omega * info.hse_omega ))) / qkg2); }
334+ { this ->recip_qkg2 [ig] = std:: sqrt ((1 - std::exp (-qkg2 / (4 * info.hse_omega * info.hse_omega ))) / qkg2); }
336335 }
337336 else
338337 {
@@ -348,13 +347,13 @@ void Exx_Lip<T, Device>::b_cal(const int ik, const int iq, const int ib)
348347 ModuleBase::timer::start (" Exx_Lip" , " b_cal" );
349348 const ModuleBase::Vector3<double > q_minus_k = this ->q_pack ->kv_ptr ->kvec_d [iq] - this ->k_pack ->kv_ptr ->kvec_d [ik];
350349 std::vector<T > mul_tmp (this ->rho_basis ->nrxx );
351- for ( size_t ir=0 ,ix=0 ; ix<this ->rho_basis ->nx ; ++ix)
350+ for ( std:: size_t ir=0 ,ix=0 ; ix<this ->rho_basis ->nx ; ++ix)
352351 {
353352 const Treal phase_x = q_minus_k.x * ix / this ->rho_basis ->nx ;
354- for ( size_t iy=0 ; iy<this ->rho_basis ->ny ; ++iy)
353+ for ( std:: size_t iy=0 ; iy<this ->rho_basis ->ny ; ++iy)
355354 {
356355 const Treal phase_xy = phase_x + q_minus_k.y * iy / this ->rho_basis ->ny ;
357- for ( size_t iz=this ->rho_basis ->startz_current ; iz<this ->rho_basis ->startz_current +this ->rho_basis ->nplane ; ++iz)
356+ for ( std:: size_t iz=this ->rho_basis ->startz_current ; iz<this ->rho_basis ->startz_current +this ->rho_basis ->nplane ; ++iz)
358357 {
359358 const Treal phase_xyz = phase_xy + q_minus_k.z * iz / this ->rho_basis ->nz ;
360359 mul_tmp[ir] = std::exp (-phase_xyz * this ->two_pi_i );
@@ -365,12 +364,12 @@ void Exx_Lip<T, Device>::b_cal(const int ik, const int iq, const int ib)
365364 }
366365
367366 std::vector<T> porter (this ->rho_basis ->nrxx );
368- for (size_t iw=0 ; iw< PARAM .globalv .nlocal ; ++iw)
367+ for (std:: size_t iw=0 ; iw< PARAM .globalv .nlocal ; ++iw)
369368 {
370369 auto & phi_w = this ->phi [iw];
371- for ( size_t ir=0 ; ir<this ->rho_basis ->nrxx ; ++ir)
370+ for ( std:: size_t ir=0 ; ir<this ->rho_basis ->nrxx ; ++ir)
372371 {
373- porter[ir] = conj (phi_w[ir]) * mul_tmp[ir] ;
372+ porter[ir] = std:: conj (phi_w[ir]) * mul_tmp[ir] ;
374373 // porter[ir] = phi_w[ir] * psi_q_b[ir] *exp_tmp[ir] ;
375374 }
376375 T* const b_w = &this ->b [iw * this ->rho_basis ->npw ];
@@ -380,7 +379,7 @@ void Exx_Lip<T, Device>::b_cal(const int ik, const int iq, const int ib)
380379 this ->b0 [iw] = b_w[this ->rho_basis ->ig_gge0 ];
381380 } }
382381
383- for (size_t ig = 0 ; ig < this ->rho_basis ->npw ; ++ig)
382+ for (std:: size_t ig = 0 ; ig < this ->rho_basis ->npw ; ++ig)
384383 { b_w[ig] *= this ->recip_qkg2 [ig]; }
385384 }
386385 ModuleBase::timer::end (" Exx_Lip" , " b_cal" );
@@ -393,7 +392,7 @@ void Exx_Lip<T, Device>::sum3_cal(const int iq, const int ib)
393392 if (gzero_rank_in_pool == GlobalV::RANK_IN_POOL ) {
394393 for (int iw_l = 0 ; iw_l < PARAM .globalv .nlocal ; ++iw_l) {
395394 for (int iw_r = 0 ; iw_r < PARAM .globalv .nlocal ; ++iw_r) {
396- this ->sum3 [iw_l][iw_r] += this ->b0 [iw_l] * conj (this ->b0 [iw_r]) * (Treal)this ->q_pack ->wf_wg (iq, ib);
395+ this ->sum3 [iw_l][iw_r] += this ->b0 [iw_l] * std:: conj (this ->b0 [iw_r]) * (Treal)this ->q_pack ->wf_wg (iq, ib);
397396 } } }
398397 ModuleBase::timer::end (" Exx_Lip" , " sum3_cal" );
399398}
@@ -426,9 +425,9 @@ void Exx_Lip<T, Device>::sum_all(const int ik)
426425 if (Conv_Coulomb_Pot_K::Ccp_Type::Ccp == info.ccp_type || Conv_Coulomb_Pot_K::Ccp_Type::Hf == info.ccp_type )
427426 { MPI_Reduce (&this ->sum2_factor , &sum2_factor_g, 1 , MPI_DOUBLE , MPI_SUM , gzero_rank_in_pool, POOL_WORLD ); }
428427 #endif
429- for (size_t iw_l = 1 ; iw_l < PARAM .globalv .nlocal ; ++iw_l) {
430- for (size_t iw_r = 0 ; iw_r < iw_l; ++iw_r) {
431- this ->sum1 [iw_l * PARAM .globalv .nlocal + iw_r] = conj (this ->sum1 [iw_r * PARAM .globalv .nlocal + iw_l]); // Peize Lin add conj 2019-04-14
428+ for (std:: size_t iw_l = 1 ; iw_l < PARAM .globalv .nlocal ; ++iw_l) {
429+ for (std:: size_t iw_r = 0 ; iw_r < iw_l; ++iw_r) {
430+ this ->sum1 [iw_l * PARAM .globalv .nlocal + iw_r] = std:: conj (this ->sum1 [iw_r * PARAM .globalv .nlocal + iw_l]); // Peize Lin add conj 2019-04-14
432431 } }
433432
434433 for (int iw_l = 0 ; iw_l < PARAM .globalv .nlocal ; ++iw_l)
@@ -441,7 +440,7 @@ void Exx_Lip<T, Device>::sum_all(const int ik)
441440 if (gzero_rank_in_pool == GlobalV::RANK_IN_POOL )
442441 {
443442 this ->exx_matrix [ik][iw_l][iw_r] += spin_fac * (fourpi_div_omega * this ->sum3 [iw_l][iw_r] * sum2_factor_g);
444- this ->exx_matrix [ik][iw_l][iw_r] += spin_fac * (-1 / (Treal)sqrt (info.lambda * ModuleBase::PI ) * (Treal)(this ->q_pack ->kv_ptr ->get_nks () / PARAM .inp .nspin ) * this ->sum3 [iw_l][iw_r]);
443+ this ->exx_matrix [ik][iw_l][iw_r] += spin_fac * (-1 / (Treal)std:: sqrt (info.lambda * ModuleBase::PI ) * (Treal)(this ->q_pack ->kv_ptr ->get_nks () / PARAM .inp .nspin ) * this ->sum3 [iw_l][iw_r]);
445444 }
446445 }
447446 }
@@ -461,7 +460,7 @@ void Exx_Lip<T, Device>::exx_energy_cal()
461460 for ( int iw_l=0 ; iw_l<PARAM .globalv .nlocal ; ++iw_l) {
462461 for ( int iw_r=0 ; iw_r<PARAM .globalv .nlocal ; ++iw_r) {
463462 for ( int ib=0 ; ib<PARAM .inp .nbands ; ++ib) {
464- exx_energy_tmp += (this ->exx_matrix [ik][iw_l][iw_r] * conj ((*this ->k_pack ->hvec_array )(ik, ib, iw_l)) * (*this ->k_pack ->hvec_array )(ik, ib, iw_r)).real () * this ->k_pack ->wf_wg (ik, ib);
463+ exx_energy_tmp += (this ->exx_matrix [ik][iw_l][iw_r] * std:: conj ((*this ->k_pack ->hvec_array )(ik, ib, iw_l)) * (*this ->k_pack ->hvec_array )(ik, ib, iw_r)).real () * this ->k_pack ->wf_wg (ik, ib);
465464 } } } }
466465 #ifdef __MPI
467466 MPI_Allreduce ( &exx_energy_tmp, &this ->exx_energy , 1 , MPI_DOUBLE , MPI_SUM , MPI_COMM_WORLD ); // !!! k_point parallel incompleted. different pools have different kv.set_nks(>) deadlock
0 commit comments