diff --git a/source/source_basis/module_pw/pw_transform_k_dsp.cpp b/source/source_basis/module_pw/pw_transform_k_dsp.cpp index 1449943550..8262073895 100644 --- a/source/source_basis/module_pw/pw_transform_k_dsp.cpp +++ b/source/source_basis/module_pw/pw_transform_k_dsp.cpp @@ -83,7 +83,7 @@ void PW_Basis_K::recip2real_dsp(const std::complex* in, { const int one = 1; const std::complex factor1 = std::complex(factor, 0); - zaxpy_(&nrxx, &factor1, auxr, &one, out, &one); + BlasConnector::axpy(nrxx, factor1, auxr, one, out, one); } else { diff --git a/source/source_io/unk_overlap_lcao.cpp b/source/source_io/unk_overlap_lcao.cpp index 9c0752aa83..c4badd40ad 100644 --- a/source/source_io/unk_overlap_lcao.cpp +++ b/source/source_io/unk_overlap_lcao.cpp @@ -607,7 +607,7 @@ std::complex unkOverlap_lcao::det_berryphase(const UnitCell& ucell, int* ipiv = new int[para_orb.nrow]; int info = 0; - pzgetrf_(&occBands, &occBands, out_matrix, &one, &one, para_orb.desc, ipiv, &info); + ScalapackConnector::getrf(occBands, occBands, out_matrix, one, one, para_orb.desc, ipiv, &info); for (int i = 0; i < occBands; i++) // global { diff --git a/source/source_lcao/module_deepks/deepks_orbpre.cpp b/source/source_lcao/module_deepks/deepks_orbpre.cpp index 6736a7f9b0..282ef92c64 100644 --- a/source/source_lcao/module_deepks/deepks_orbpre.cpp +++ b/source/source_lcao/module_deepks/deepks_orbpre.cpp @@ -247,11 +247,11 @@ void DeePKS_domain::cal_orbital_precalc(const std::vector& dm_hl, { for (int m2 = 0; m2 < nm; ++m2) // m1 = 1 for s, 3 for p, 5 for d { - accessor[ik][inl][m1][m2] += ddot_(&row_size, + accessor[ik][inl][m1][m2] += BlasConnector::dot(row_size, p_g1dmt + index * row_size * nks, - &inc, + inc, s_1t.data() + index * row_size, - &inc); + inc); index++; } } diff --git a/source/source_lcao/module_deepks/deepks_pdm.cpp b/source/source_lcao/module_deepks/deepks_pdm.cpp index b6551116d0..edbfec8ef8 100644 --- a/source/source_lcao/module_deepks/deepks_pdm.cpp +++ b/source/source_lcao/module_deepks/deepks_pdm.cpp @@ -19,6 +19,7 @@ #include "deepks_pdm.h" #include "source_base/constants.h" #include "source_base/libm/libm.h" +#include "source_base/module_external/blas_connector.h" #include "source_base/timer.h" #include "source_lcao/module_hcontainer/atom_pair.h" #ifdef __MPI @@ -402,11 +403,11 @@ void DeePKS_domain::cal_pdm(bool& init_pdm, { for (int m2 = 0; m2 < nm; ++m2) // m1 = 1 for s, 3 for p, 5 for d { - accessor[m1][m2] += ddot_(&row_size, - g_1dmt.data() + index * row_size, - &inc, - s_1t.data() + index * row_size, - &inc); + accessor[m1][m2] += BlasConnector::dot(row_size, + g_1dmt.data() + index * row_size, + inc, + s_1t.data() + index * row_size, + inc); index++; } } @@ -428,11 +429,11 @@ void DeePKS_domain::cal_pdm(bool& init_pdm, { // ddot_: dot product of two vectors // inc means the increment of the index - accessor[iproj * nproj + jproj] += ddot_(&row_size, - g_1dmt.data() + index * row_size, - &inc, - s_1t.data() + index * row_size, - &inc); + accessor[iproj * nproj + jproj] += BlasConnector::dot(row_size, + g_1dmt.data() + index * row_size, + inc, + s_1t.data() + index * row_size, + inc); index++; } } diff --git a/source/source_lcao/module_dftu/dftu_force.cpp b/source/source_lcao/module_dftu/dftu_force.cpp index 3dc90223d0..02bfdff5a8 100644 --- a/source/source_lcao/module_dftu/dftu_force.cpp +++ b/source/source_lcao/module_dftu/dftu_force.cpp @@ -23,52 +23,6 @@ #include -extern "C" -{ - // I'm not sure what's happenig here, but the interface in scalapack_connecter.h - // does not seem to work, so I'll use this one here - void pzgemm_(const char* transa, - const char* transb, - const int* M, - const int* N, - const int* K, - const std::complex* alpha, - const std::complex* A, - const int* IA, - const int* JA, - const int* DESCA, - const std::complex* B, - const int* IB, - const int* JB, - const int* DESCB, - const std::complex* beta, - std::complex* C, - const int* IC, - const int* JC, - const int* DESCC); - - void pdgemm_(const char* transa, - const char* transb, - const int* M, - const int* N, - const int* K, - const double* alpha, - const double* A, - const int* IA, - const int* JA, - const int* DESCA, - const double* B, - const int* IB, - const int* JB, - const int* DESCB, - const double* beta, - double* C, - const int* IC, - const int* JC, - const int* DESCC); -} - - void Plus_U::force_stress(const UnitCell& ucell, const Grid_Driver& gd, std::vector>* dmk_d, // mohan modify 2025-11-02 @@ -161,10 +115,10 @@ void Plus_U::force_stress(const UnitCell& ucell, #ifdef __MPI - pzgemm_(&transT, &transN, &nlocal, &nlocal, &nlocal, - &alpha, (*dmk_c)[ik].data(), &one_int, &one_int, // important to add (), 20251103 - pv.desc, VU, &one_int, &one_int, pv.desc, &beta, - &rho_VU[0], &one_int, &one_int, pv.desc); + ScalapackConnector::gemm(transT, transN, nlocal, nlocal, nlocal, + alpha, (*dmk_c)[ik].data(), one_int, one_int, + pv.desc, VU, one_int, one_int, pv.desc, beta, + &rho_VU[0], one_int, one_int, pv.desc); #endif delete[] VU; @@ -237,24 +191,24 @@ void Plus_U::cal_force_k(const UnitCell& ucell, this->folding_matrix_k(ucell, gd, fsr, pv, ik, dim + 1, 0, &dSm_k[0], kvec_d); #ifdef __MPI - pzgemm_(&transN, - &transC, - &PARAM.globalv.nlocal, - &PARAM.globalv.nlocal, - &PARAM.globalv.nlocal, - &one, + ScalapackConnector::gemm(transN, + transC, + PARAM.globalv.nlocal, + PARAM.globalv.nlocal, + PARAM.globalv.nlocal, + one, &dSm_k[0], - &one_int, - &one_int, + one_int, + one_int, pv.desc, rho_VU, - &one_int, - &one_int, + one_int, + one_int, pv.desc, - &zero, + zero, &dm_VU_dSm[0], - &one_int, - &one_int, + one_int, + one_int, pv.desc); #endif @@ -275,24 +229,24 @@ void Plus_U::cal_force_k(const UnitCell& ucell, } // end ir #ifdef __MPI - pzgemm_(&transN, - &transN, - &PARAM.globalv.nlocal, - &PARAM.globalv.nlocal, - &PARAM.globalv.nlocal, - &one, + ScalapackConnector::gemm(transN, + transN, + PARAM.globalv.nlocal, + PARAM.globalv.nlocal, + PARAM.globalv.nlocal, + one, &dSm_k[0], - &one_int, - &one_int, + one_int, + one_int, pv.desc, rho_VU, - &one_int, - &one_int, + one_int, + one_int, pv.desc, - &zero, + zero, &dm_VU_dSm[0], - &one_int, - &one_int, + one_int, + one_int, pv.desc); #endif @@ -371,24 +325,24 @@ void Plus_U::cal_stress_k(const UnitCell& ucell, this->folding_matrix_k(ucell, gd, fsr, pv, ik, dim1 + 4, dim2, &dSR_k[0], kvec_d); #ifdef __MPI - pzgemm_(&transN, - &transN, - &nlocal, - &nlocal, - &nlocal, - &minus_half, + ScalapackConnector::gemm(transN, + transN, + nlocal, + nlocal, + nlocal, + minus_half, rho_VU, - &one_int, - &one_int, + one_int, + one_int, pv.desc, &dSR_k[0], - &one_int, - &one_int, + one_int, + one_int, pv.desc, - &zero, + zero, &dm_VU_sover[0], - &one_int, - &one_int, + one_int, + one_int, pv.desc); #endif