Skip to content

Commit 143d3fc

Browse files
committed
Fix: misuse of '=' in assertion
1 parent 43dd0ae commit 143d3fc

File tree

2 files changed

+47
-47
lines changed

2 files changed

+47
-47
lines changed

source/src_io/bessel_basis.cpp

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Bessel_Basis::~Bessel_Basis()
1717

1818

1919
// the function is called in numerical_basis.
20-
void Bessel_Basis::init(
20+
void Bessel_Basis::init(
2121
const bool start_from_file,
2222
const double &ecutwfc,
2323
const int &ntype,
@@ -57,7 +57,7 @@ void Bessel_Basis::init(
5757
// GlobalV::ofs_running << "\n" << TableOne.ptr[i];
5858
// }
5959

60-
if( start_from_file )
60+
if( start_from_file )
6161
{
6262
// setup C4
6363
this->allocate_C4(ntype, lmax_in, GlobalC::ucell.nmax, Ecut_number);
@@ -80,7 +80,7 @@ double Bessel_Basis::Polynomial_Interpolation2
8080
const int iq = static_cast<int>(position);
8181
/*
8282
if(iq >= kmesh-4)
83-
{
83+
{
8484
std::cout << "\n iq = " << iq;
8585
std::cout << "\n kmesh = " << kmesh;
8686
ModuleBase::QUIT();
@@ -117,7 +117,7 @@ double Bessel_Basis::Polynomial_Interpolation(
117117
return y;
118118
}
119119

120-
void Bessel_Basis::init_Faln(
120+
void Bessel_Basis::init_Faln(
121121
const int &ntype,
122122
const int &lmax,
123123
const int &nmax,
@@ -195,7 +195,7 @@ void Bessel_Basis::init_TableOne(
195195
double *g = new double[rmesh]; // smooth function
196196
double *function = new double[rmesh];
197197
double *en = new double[ecut_number];
198-
198+
199199
for(int ir=0; ir<rmesh; ir++)
200200
{
201201
r[ir] = static_cast<double>(ir) * dr;
@@ -205,7 +205,7 @@ void Bessel_Basis::init_TableOne(
205205
g[ir] = 1.0 - std::exp(-( (r[ir]-rcut)*(r[ir]-rcut)/2.0/sigma_in/sigma_in ) );
206206
}
207207
}
208-
208+
209209
//caoyu add 2021-3-10
210210
//=========output .orb format=============
211211
std::stringstream ss;
@@ -215,9 +215,9 @@ void Bessel_Basis::init_TableOne(
215215
ofs << std::setiosflags(ios::left) << std::setw(28) << "Energy Cutoff(Ry)" << ecut << std::endl;
216216
ofs << std::setiosflags(ios::left) << std::setw(28) << "Radius Cutoff(a.u.)" << rcut << std::endl;
217217
ofs << std::setiosflags(ios::left) << std::setw(28) << "Lmax" << lmax << std::endl;
218-
for (int l = 0; l < lmax + 1; l++)
218+
for (int l = 0; l < lmax + 1; l++)
219219
{
220-
switch (l)
220+
switch (l)
221221
{
222222
case 0:
223223
ofs << std::setiosflags(ios::left) << std::setw(28) << "Number of Sorbitals-->" << ecut_number << std::endl;
@@ -250,25 +250,25 @@ void Bessel_Basis::init_TableOne(
250250

251251
// calculate eigenvalue for l
252252
ModuleBase::Sphbes::Spherical_Bessel_Roots(ecut_number, l, tolerence, en, rcut);
253-
// for (int ie=0; ie<ecut_number; ie++)
253+
// for (int ie=0; ie<ecut_number; ie++)
254254
// {
255255
// std::cout << "\n en[" << ie << "]=" << en[ie];
256256
// }
257257

258258
// for each eigenvalue
259259
for (int ie=0; ie<ecut_number; ie++)
260260
{
261-
// calculate J_{l}( en[ir]*r)
261+
// calculate J_{l}( en[ir]*r)
262262
ModuleBase::Sphbes::Spherical_Bessel(rmesh, r, en[ie], l, jle);
263263

264264
//caoyu add 2021-3-10
265265
//=========output .orb format=============
266266
ofs << std::setiosflags(ios::right) << std::setw(20) << "Type"<< std::setw(20) << "L" << std::setw(20) << "N" << std::endl;
267267
ofs << std::setiosflags(ios::right) << std::setw(20) << "0"<< std::setw(20) << l << std::setw(20) << ie << std::endl;
268-
for (int ir = 0; ir < rmesh; ir++)
269-
{
270-
ofs << std::setiosflags(ios::scientific)
271-
<< std::setprecision(12) << jle[ir]<< " "; if ((ir+1) % 4 == 0) ofs << std::endl;
268+
for (int ir = 0; ir < rmesh; ir++)
269+
{
270+
ofs << std::setiosflags(ios::scientific)
271+
<< std::setprecision(12) << jle[ir]<< " "; if ((ir+1) % 4 == 0) ofs << std::endl;
272272
}
273273
ofs << std::endl;
274274
//=========output .orb format=============
@@ -283,7 +283,7 @@ void Bessel_Basis::init_TableOne(
283283
// ss << GlobalV::global_out_dir << l << "." << ie << ".txt";
284284
// std::ofstream ofs(ss.str().c_str());
285285

286-
// for(int ir=0; ir<rmesh; ir++) ofs << r[ir] << " " << jle[ir] << " " << jle[ir]*g[ir] << std::endl;
286+
// for(int ir=0; ir<rmesh; ir++) ofs << r[ir] << " " << jle[ir] << " " << jle[ir]*g[ir] << std::endl;
287287

288288
// ofs.close();
289289
//====== output ========
@@ -296,7 +296,7 @@ void Bessel_Basis::init_TableOne(
296296
jle[ir] *= g[ir];
297297
}
298298
}
299-
299+
300300
for(int ik=0; ik<kmesh; ik++)
301301
{
302302
// calculate J_{l}( ik*dk*r )
@@ -307,15 +307,15 @@ void Bessel_Basis::init_TableOne(
307307
{
308308
function[ir] = jle[ir] * jlk[ir];
309309
}
310-
310+
311311
// make table value
312312
ModuleBase::Integral::Simpson_Integral(rmesh, function, rab, this->TableOne(l, ie, ik) );
313313
}
314-
314+
315315
}// end ie
316316
}// end ;
317-
318-
if (ofs)
317+
318+
if (ofs)
319319
{
320320
ofs.close(); //caoyu add 2020-3-10
321321
}
@@ -345,7 +345,7 @@ void Bessel_Basis::readin_C4(
345345

346346
std::ifstream ifs( name.c_str() );
347347

348-
if(!ifs)
348+
if(!ifs)
349349
{
350350
GlobalV::ofs_warning << " File name : " << name << std::endl;
351351
ModuleBase::WARNING_QUIT("Bessel_Basis::readin_C4","Can not find file.");
@@ -366,8 +366,8 @@ void Bessel_Basis::readin_C4(
366366
//std::cout << "\n" << std::setw(5) << it << std::setw(5) << il << std::setw(5) << in;
367367
//std::cout << "\n file=" << filec4;
368368
std::ifstream inc4( filec4.c_str() );
369-
370-
if(!inc4)
369+
370+
if(!inc4)
371371
{
372372
GlobalV::ofs_warning << " File name : " << filec4 << std::endl;
373373
ModuleBase::WARNING_QUIT("Bessel_Basis::readin_C4","Can not find file.");
@@ -377,16 +377,16 @@ void Bessel_Basis::readin_C4(
377377
{
378378
double tmp_ecut;
379379
double tmp_rcut;
380-
double tmp_enumber;
380+
double tmp_enumber;
381381
double tmp_tolerence;
382-
ModuleBase::GlobalFunc::READ_VALUE( inc4, tmp_ecut);
383-
ModuleBase::GlobalFunc::READ_VALUE( inc4, tmp_rcut);
384-
ModuleBase::GlobalFunc::READ_VALUE( inc4, tmp_enumber);
385-
ModuleBase::GlobalFunc::READ_VALUE( inc4, tmp_tolerence);
386-
assert( tmp_ecut = this->ecut );
387-
assert( tmp_rcut = this->rcut );
388-
assert( tmp_enumber = this->Ecut_number);
389-
assert( tmp_tolerence = this->tolerence );
382+
ModuleBase::GlobalFunc::READ_VALUE( inc4, tmp_ecut);
383+
ModuleBase::GlobalFunc::READ_VALUE( inc4, tmp_rcut);
384+
ModuleBase::GlobalFunc::READ_VALUE( inc4, tmp_enumber);
385+
ModuleBase::GlobalFunc::READ_VALUE( inc4, tmp_tolerence);
386+
assert( tmp_ecut == this->ecut );
387+
assert( tmp_rcut == this->rcut );
388+
assert( tmp_enumber == this->Ecut_number);
389+
assert( tmp_tolerence == this->tolerence );
390390
}
391391

392392
bool find = false;
@@ -403,7 +403,7 @@ void Bessel_Basis::readin_C4(
403403
int tmp_type, tmp_l, tmp_n;
404404
inc4 >> tmp_type >> tmp_l >> tmp_n;
405405
//std::cout << "\n Find T=" << tmp_type << " L=" << tmp_l << " N=" << tmp_n;
406-
406+
407407
if(tmp_l == il && tmp_n == in)
408408
//if(tmp_type == it && tmp_l == il && tmp_n == in) // mohan modify 2009-11-29
409409
{
@@ -443,12 +443,12 @@ void Bessel_Basis::readin_C4(
443443

444444
void Bessel_Basis::allocate_C4(
445445
const int &ntype,
446-
const int &lmax,
446+
const int &lmax,
447447
const int &nmax,
448448
const int &ecut_number)
449449
{
450450
ModuleBase::TITLE("Bessel_Basis","allocate_C4");
451-
451+
452452
this->C4.create(ntype, lmax+1, nmax, ecut_number);
453453

454454
for(int it=0; it<ntype; it++)
@@ -471,7 +471,7 @@ void Bessel_Basis::bcast(void)
471471
{
472472
#ifdef __MPI
473473
ModuleBase::TITLE("Bessel_Basis", "bcast");
474-
474+
475475
Parallel_Common::bcast_double( ecut );
476476
Parallel_Common::bcast_double( rcut );
477477
Parallel_Common::bcast_double( tolerence );
@@ -513,7 +513,7 @@ void Bessel_Basis::readin(const std::string &name)
513513
ifs.close();
514514
}
515515
#ifdef __MPI
516-
Parallel_Common::bcast_bool(smooth);
516+
Parallel_Common::bcast_bool(smooth);
517517
Parallel_Common::bcast_double(sigma);
518518
Parallel_Common::bcast_double(ecut);
519519
Parallel_Common::bcast_double(rcut);

source/src_lcao/LCAO_diago.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Diago_LCAO_Matrix::Diago_LCAO_Matrix(LCAO_Matrix* lm) :
1212
Diago_LCAO_Matrix::~Diago_LCAO_Matrix() {}
1313

1414
void Diago_LCAO_Matrix::solve_complex_matrix(
15-
const int &ik,
15+
const int &ik,
1616
Local_Orbital_wfc &lowf)
1717
{
1818
ModuleBase::TITLE("Diago_LCAO_Matrix","solve_complex_matrix");
@@ -51,7 +51,7 @@ void Diago_LCAO_Matrix::using_HPSEPS_complex(const int &ik, Local_Orbital_wfc &l
5151

5252
this->diago_complex_begin(ik, lowf, this->LM->Hloc2.data(), this->LM->Sloc2.data(), this->LM->Sdiag2.data(), GlobalC::wf.ekb[ik]);
5353

54-
//added by zhengdy-soc, rearrange the wfc_k_grid from [up,down,up,down...] to [up,up...down,down...],
54+
//added by zhengdy-soc, rearrange the wfc_k_grid from [up,down,up,down...] to [up,up...down,down...],
5555
if(GlobalV::NSPIN==4)
5656
{
5757
int row = GlobalC::GridT.lgd;
@@ -78,7 +78,7 @@ void Diago_LCAO_Matrix::using_LAPACK_complex(const int &ik, std::complex<double>
7878
{
7979
ModuleBase::TITLE("Diago_LCAO_Matrix","using_LAPACK_complex");
8080

81-
assert(GlobalV::NPROC = 1);
81+
assert(GlobalV::NPROC == 1);
8282

8383
ModuleBase::ComplexMatrix Htmp(GlobalV::NLOCAL,GlobalV::NLOCAL);
8484
ModuleBase::ComplexMatrix Stmp(GlobalV::NLOCAL,GlobalV::NLOCAL);
@@ -163,7 +163,7 @@ void Diago_LCAO_Matrix::using_LAPACK(const int &ik, Local_Orbital_wfc &lowf)cons
163163
// @@@@@@@
164164
// out.printrm("Lapack_H", Htmp);
165165
// out.printrm("Lapack_S", Stmp);
166-
166+
167167
int itype=1;
168168
int lwork=3*GlobalV::NLOCAL-1;// tmp
169169
double* w = new double[GlobalV::NLOCAL];
@@ -187,13 +187,13 @@ void Diago_LCAO_Matrix::using_LAPACK(const int &ik, Local_Orbital_wfc &lowf)cons
187187
for(int i=0; i<GlobalV::NBANDS; i++)
188188
{
189189
// eigenvalues
190-
GlobalC::wf.ekb[ik][i] = w[i];
190+
GlobalC::wf.ekb[ik][i] = w[i];
191191
for(int j=0; j<GlobalV::NLOCAL; j++)
192192
{
193193
lowf.wfc_k_grid[ik][i][j] = Htmp(j,i);
194194
}
195195
}
196-
196+
197197

198198
// @@@@@@@
199199
// test
@@ -220,14 +220,14 @@ void Diago_LCAO_Matrix::using_LAPACK(const int &ik, Local_Orbital_wfc &lowf)cons
220220

221221
//LiuXh add 2021-09-06, clear memory, totwfc not used now
222222
void Diago_LCAO_Matrix::solve_double_matrix(
223-
const int &ik,
223+
const int &ik,
224224
Local_Orbital_wfc &lowf)
225225
{
226226
ModuleBase::TITLE("Diago_LCAO_Matrix","solve_double_matrix");
227227
ModuleBase::timer::tick("Diago_LCAO_Matrix","solve_double_matrix");
228228
time_t time_start = time(NULL);
229229

230-
230+
231231
if(GlobalV::KS_SOLVER=="lapack")
232232
{
233233
//this->using_LAPACK(ik, wfc);
@@ -240,7 +240,7 @@ void Diago_LCAO_Matrix::solve_double_matrix(
240240
#endif
241241
else
242242
{
243-
std::cout << " Diago_LCAO_Matrix, diago_type = " << GlobalV::KS_SOLVER << std::endl;
243+
std::cout << " Diago_LCAO_Matrix, diago_type = " << GlobalV::KS_SOLVER << std::endl;
244244
ModuleBase::WARNING_QUIT("Diago_LCAO_Matrix::init","Check ks_solver.");
245245
}
246246

@@ -263,7 +263,7 @@ void Diago_LCAO_Matrix::using_HPSEPS_double(const int &ik, Local_Orbital_wfc &lo
263263
HS_Matrix::saving_HS(this->LM->Hloc.data(), this->LM->Sloc.data(), bit, this->out_mat_hs, "data-"+std::to_string(ik), *lowf.ParaV);
264264
GlobalV::ofs_running << std::setprecision(6);
265265

266-
// Distribution of matrix for
266+
// Distribution of matrix for
267267
// prallel eigensolver.
268268
this->diago_double_begin(ik, lowf, this->LM->Hloc.data(), this->LM->Sloc.data(), this->LM->Sdiag.data(), GlobalC::wf.ekb[ik]);
269269

0 commit comments

Comments
 (0)