Skip to content

Commit dce3681

Browse files
authored
Remove uncapsulted scalapack functions in dftu_occup.cpp (#6099)
1 parent 7d65d73 commit dce3681

File tree

1 file changed

+46
-28
lines changed

1 file changed

+46
-28
lines changed

source/module_hamilt_lcao/module_dftu/dftu_occup.cpp

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,7 @@
55
#ifdef __LCAO
66
#include "module_hamilt_lcao/hamilt_lcaodft/hamilt_lcao.h"
77
#endif
8-
9-
extern "C"
10-
{
11-
//I'm not sure what's happenig here, but the interface in scalapack_connecter.h
12-
//does not seem to work, so I'll use this one here
13-
void pzgemm_(
14-
const char *transa, const char *transb,
15-
const int *M, const int *N, const int *K,
16-
const std::complex<double> *alpha,
17-
const std::complex<double> *A, const int *IA, const int *JA, const int *DESCA,
18-
const std::complex<double> *B, const int *IB, const int *JB, const int *DESCB,
19-
const std::complex<double> *beta,
20-
std::complex<double> *C, const int *IC, const int *JC, const int *DESCC);
21-
22-
void pdgemm_(
23-
const char *transa, const char *transb,
24-
const int *M, const int *N, const int *K,
25-
const double *alpha,
26-
const double *A, const int *IA, const int *JA, const int *DESCA,
27-
const double *B, const int *IB, const int *JB, const int *DESCB,
28-
const double *beta,
29-
double *C, const int *IC, const int *JC, const int *DESCC);
30-
}
8+
#include "module_base/scalapack_connector.h"
319

3210
namespace ModuleDFTU
3311
{
@@ -189,7 +167,27 @@ void DFTU::cal_occup_m_k(const int iter,
189167
}
190168

191169
#ifdef __MPI
192-
pzgemm_(&transN,
170+
ScalapackConnector::gemm(transN,
171+
transT,
172+
PARAM.globalv.nlocal,
173+
PARAM.globalv.nlocal,
174+
PARAM.globalv.nlocal,
175+
alpha,
176+
s_k_pointer,
177+
one_int,
178+
one_int,
179+
&this->paraV->desc[0],
180+
dm_k[ik].data(),
181+
//dm_k[ik].c,
182+
one_int,
183+
one_int,
184+
&this->paraV->desc[0],
185+
beta,
186+
srho.data(),
187+
one_int,
188+
one_int,
189+
&this->paraV->desc[0]);
190+
/*pzgemm_(&transN,
193191
&transT,
194192
&PARAM.globalv.nlocal,
195193
&PARAM.globalv.nlocal,
@@ -208,7 +206,7 @@ void DFTU::cal_occup_m_k(const int iter,
208206
&srho[0],
209207
&one_int,
210208
&one_int,
211-
this->paraV->desc);
209+
this->paraV->desc);*/
212210
#endif
213211

214212
const int spin = kv.isk[ik];
@@ -399,7 +397,7 @@ void DFTU::cal_occup_m_gamma(const int iter,
399397

400398
//=================Part 1======================
401399
// call PBLAS routine to calculate the product of the S and density matrix
402-
const char transN = 'N', transT = 'T';
400+
char transN = 'N', transT = 'T';
403401
const int one_int = 1;
404402
const double alpha = 1.0, beta = 0.0;
405403

@@ -410,7 +408,27 @@ void DFTU::cal_occup_m_gamma(const int iter,
410408
double* s_gamma_pointer = dynamic_cast<hamilt::HamiltLCAO<double, double>*>(p_ham)->getSk();
411409

412410
#ifdef __MPI
413-
pdgemm_(&transN,
411+
ScalapackConnector::gemm(transN,
412+
transT,
413+
PARAM.globalv.nlocal,
414+
PARAM.globalv.nlocal,
415+
PARAM.globalv.nlocal,
416+
alpha,
417+
s_gamma_pointer,
418+
one_int,
419+
one_int,
420+
&this->paraV->desc[0],
421+
dm_gamma[is].data(),
422+
//dm_gamma[is].c,
423+
one_int,
424+
one_int,
425+
&this->paraV->desc[0],
426+
beta,
427+
srho.data(),
428+
one_int,
429+
one_int,
430+
&this->paraV->desc[0]);
431+
/*pdgemm_(&transN,
414432
&transT,
415433
&PARAM.globalv.nlocal,
416434
&PARAM.globalv.nlocal,
@@ -429,7 +447,7 @@ void DFTU::cal_occup_m_gamma(const int iter,
429447
&srho[0],
430448
&one_int,
431449
&one_int,
432-
this->paraV->desc);
450+
this->paraV->desc);*/
433451
#endif
434452

435453
for (int it = 0; it < ucell.ntype; it++)

0 commit comments

Comments
 (0)