Skip to content

Commit b80edb3

Browse files
committed
fix : pzgemv_ and pzgemm_ used double* for alpha and beta parameters but
not complex<double>* , this would cause error in GNU compiler.
1 parent 55d3c09 commit b80edb3

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

source/src_io/energy_dos.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ void energy::perform_dos(Local_Orbital_wfc &lowf, LCAO_Hamilt &uhm)
368368

369369
const int NB= i+1;
370370

371-
const double one_float=1.0, zero_float=0.0;
371+
const double one_float[2]={1.0, 0.0}, zero_float[2]={0.0, 0.0};
372372
const int one_int=1;
373373
// const int two_int=2;
374374
const char T_char='T'; // N_char='N',U_char='U'
@@ -377,10 +377,10 @@ void energy::perform_dos(Local_Orbital_wfc &lowf, LCAO_Hamilt &uhm)
377377
pzgemv_(
378378
&T_char,
379379
&GlobalV::NLOCAL,&GlobalV::NLOCAL,
380-
&one_float,
380+
&one_float[0],
381381
uhm.LM->Sloc2.data(), &one_int, &one_int, pv->desc,
382382
Dwfc.c, &one_int, &NB, pv->desc, &one_int,
383-
&zero_float,
383+
&zero_float[0],
384384
Mulk[0].c, &one_int, &NB, pv->desc,
385385
&one_int);
386386
#endif

source/src_io/mulliken_charge.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ void Mulliken_Charge::cal_mulliken(LCAO_Hamilt &uhm)
196196

197197
const int NB= i+1;
198198

199-
const double one_float=1.0, zero_float=0.0;
199+
const double one_float[2]={1.0, 0.0}, zero_float[2]={0.0, 0.0};
200200
const int one_int=1;
201201
// const int two_int=2;
202202

@@ -206,10 +206,10 @@ void Mulliken_Charge::cal_mulliken(LCAO_Hamilt &uhm)
206206
pzgemv_(
207207
&T_char,
208208
&GlobalV::NLOCAL,&GlobalV::NLOCAL,
209-
&one_float,
209+
&one_float[0],
210210
uhm.LM->Sloc2.data(), &one_int, &one_int, pv->desc,
211211
Dwf.c, &one_int, &NB, pv->desc, &one_int,
212-
&zero_float,
212+
&zero_float[0],
213213
mud[0].c, &one_int, &NB, pv->desc,
214214
&one_int);
215215
#endif

source/src_io/unk_overlap_lcao.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -738,19 +738,19 @@ std::complex<double> unkOverlap_lcao::det_berryphase(const int ik_L, const int i
738738
char transb = 'N';
739739
int occBands = occ_bands;
740740
int nlocal = GlobalV::NLOCAL;
741-
double alpha=1.0, beta=0.0;
741+
double alpha[2]={1.0, 0.0}, beta[2]={0.0, 0.0};
742742
int one = 1;
743743
#ifdef __MPI
744-
pzgemm_(&transa,&transb,&occBands,&nlocal,&nlocal,&alpha,
744+
pzgemm_(&transa,&transb,&occBands,&nlocal,&nlocal,&alpha[0],
745745
lowf.wfc_k.at(ik_L).c,&one,&one,lowf.ParaV->desc,
746746
midmatrix,&one,&one,lowf.ParaV->desc,
747-
&beta,
747+
&beta[0],
748748
C_matrix,&one,&one,lowf.ParaV->desc);
749749

750-
pzgemm_(&transb,&transb,&occBands,&occBands,&nlocal,&alpha,
750+
pzgemm_(&transb,&transb,&occBands,&occBands,&nlocal,&alpha[0],
751751
C_matrix,&one,&one,lowf.ParaV->desc,
752752
lowf.wfc_k.at(ik_R).c,&one,&one,lowf.ParaV->desc,
753-
&beta,
753+
&beta[0],
754754
out_matrix,&one,&one,lowf.ParaV->desc);
755755

756756
//int *ipiv = new int[ lowf.ParaV->nrow+lowf.ParaV->desc[4] ];

source/src_lcao/LCAO_evolve.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ int Evolve_LCAO_Matrix::using_ScaLAPACK_complex(const int &ik, ModuleBase::Compl
416416
char transb = 'T'; //This place requires subsequent testing of different transb.
417417
int descb = 0;
418418

419-
double alpha_1 = 1.0;
420-
double beta_1 = 0.0;
419+
double alpha_1[2] = {1.0, 0.0};
420+
double beta_1[2] = {0.0, 0.0};
421421

422422
//cout << "*Htmp2: " << *Htmp2 << endl;
423423
//cout << "begin06:" << endl;
@@ -426,10 +426,10 @@ int Evolve_LCAO_Matrix::using_ScaLAPACK_complex(const int &ik, ModuleBase::Compl
426426
pzgemm_(
427427
&transa, &transb,
428428
&GlobalV::NLOCAL, &GlobalV::NLOCAL, &GlobalV::NLOCAL,
429-
&alpha_1,
429+
&alpha_1[0],
430430
Htmp2, &one_int, &one_int, this->LM->ParaV->desc,
431431
Htmp1, &one_int, &one_int, this->LM->ParaV->desc,
432-
&beta_1,
432+
&beta_1[0],
433433
Htmp3, &one_int, &one_int, this->LM->ParaV->desc);
434434

435435

@@ -439,10 +439,10 @@ int Evolve_LCAO_Matrix::using_ScaLAPACK_complex(const int &ik, ModuleBase::Compl
439439
pzgemv_(
440440
&transa,
441441
&GlobalV::NLOCAL, &GlobalV::NLOCAL,
442-
&alpha_1,
442+
&alpha_1[0],
443443
Htmp3, &one_int, &one_int, this->LM->ParaV->desc,
444444
wfc_2d.c, &one_int, &one_int, this->LM->ParaV->desc, &one_int,
445-
&beta_1,
445+
&beta_1[0],
446446
wfc_2d.c, &one_int, &one_int, this->LM->ParaV->desc, &one_int
447447
);
448448

source/src_lcao/dm_2d.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,18 @@ void Local_Orbital_Charge::cal_dm(const ModuleBase::matrix& wg, // wg(ik,ib),
135135
BlasConnector::scal( wg_wfc.nc, wg_local[ir], wg_wfc.c+ir*wg_wfc.nc, 1 );
136136
}
137137
// C++: dm(iw1,iw2) = wfc(ib,iw1).T * wg_wfc(ib,iw2)
138-
const double one_float=1.0, zero_float=0.0;
138+
const double one_float[2]={1.0, 0.0}, zero_float[2]={0.0, 0.0};
139139
const int one_int=1;
140140
const char N_char='N', T_char='T';
141141
dm_k[ik].create( this->ParaV->ncol, this->ParaV->nrow );
142142
#ifdef __MPI
143143
pzgemm_(
144144
&N_char, &T_char,
145145
&GlobalV::NLOCAL, &GlobalV::NLOCAL, &wg.nc,
146-
&one_float,
146+
&one_float[0],
147147
wg_wfc.c, &one_int, &one_int, this->ParaV->desc_wfc,
148148
wfc_k[ik].c, &one_int, &one_int, this->ParaV->desc_wfc,
149-
&zero_float,
149+
&zero_float[0],
150150
dm_k[ik].c, &one_int, &one_int, this->ParaV->desc);
151151
#else
152152
const int lda=GlobalV::NLOCAL;

0 commit comments

Comments
 (0)