@@ -90,7 +90,7 @@ Magnetism::~Magnetism() { delete[] this->start_magnetization; }
90
90
* possible of an element
91
91
* - CalNelec: UnitCell::cal_nelec
92
92
* - calculate the total number of valence electrons from psp files
93
- * - CalNbands: elecstate::ElecState:: cal_nbands()
93
+ * - CalNbands: elecstate::cal_nbands()
94
94
* - calculate the number of bands
95
95
*/
96
96
@@ -406,22 +406,22 @@ TEST_F(UcellTest, CalNelec) {
406
406
EXPECT_EQ (1 , ucell->atoms [0 ].na );
407
407
EXPECT_EQ (2 , ucell->atoms [1 ].na );
408
408
double nelec = 0 ;
409
- cal_nelec (ucell->atoms , ucell->ntype , nelec);
409
+ elecstate:: cal_nelec (ucell->atoms , ucell->ntype , nelec);
410
410
EXPECT_DOUBLE_EQ (6 , nelec);
411
411
}
412
412
413
413
TEST_F (UcellTest, CalNbands)
414
414
{
415
415
std::vector<double > nelec_spin (2 , 5.0 );
416
- cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
416
+ elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
417
417
EXPECT_EQ (PARAM.input .nbands , 6 );
418
418
}
419
419
420
420
TEST_F (UcellTest, CalNbandsFractionElec)
421
421
{
422
422
PARAM.input .nelec = 9.5 ;
423
423
std::vector<double > nelec_spin (2 , 5.0 );
424
- cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
424
+ elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
425
425
EXPECT_EQ (PARAM.input .nbands , 6 );
426
426
}
427
427
@@ -430,22 +430,22 @@ TEST_F(UcellTest, CalNbandsSOC)
430
430
PARAM.input .lspinorb = true ;
431
431
PARAM.input .nbands = 0 ;
432
432
std::vector<double > nelec_spin (2 , 5.0 );
433
- cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
433
+ elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
434
434
EXPECT_EQ (PARAM.input .nbands , 20 );
435
435
}
436
436
437
437
TEST_F (UcellTest, CalNbandsSDFT)
438
438
{
439
439
PARAM.input .esolver_type = " sdft" ;
440
440
std::vector<double > nelec_spin (2 , 5.0 );
441
- EXPECT_NO_THROW (cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands ));
441
+ EXPECT_NO_THROW (elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands ));
442
442
}
443
443
444
444
TEST_F (UcellTest, CalNbandsLCAO)
445
445
{
446
446
PARAM.input .basis_type = " lcao" ;
447
447
std::vector<double > nelec_spin (2 , 5.0 );
448
- EXPECT_NO_THROW (cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands ));
448
+ EXPECT_NO_THROW (elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands ));
449
449
}
450
450
451
451
TEST_F (UcellTest, CalNbandsLCAOINPW)
@@ -454,7 +454,7 @@ TEST_F(UcellTest, CalNbandsLCAOINPW)
454
454
PARAM.sys .nlocal = PARAM.input .nbands - 1 ;
455
455
std::vector<double > nelec_spin (2 , 5.0 );
456
456
testing::internal::CaptureStdout ();
457
- EXPECT_EXIT (cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands ), ::testing::ExitedWithCode (1 ), " " );
457
+ EXPECT_EXIT (elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands ), ::testing::ExitedWithCode (1 ), " " );
458
458
output = testing::internal::GetCapturedStdout ();
459
459
EXPECT_THAT (output, testing::HasSubstr (" NLOCAL < NBANDS" ));
460
460
}
@@ -464,7 +464,7 @@ TEST_F(UcellTest, CalNbandsWarning1)
464
464
PARAM.input .nbands = PARAM.input .nelec / 2 - 1 ;
465
465
std::vector<double > nelec_spin (2 , 5.0 );
466
466
testing::internal::CaptureStdout ();
467
- EXPECT_EXIT (cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands ), ::testing::ExitedWithCode (1 ), " " );
467
+ EXPECT_EXIT (elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands ), ::testing::ExitedWithCode (1 ), " " );
468
468
output = testing::internal::GetCapturedStdout ();
469
469
EXPECT_THAT (output, testing::HasSubstr (" Too few bands!" ));
470
470
}
@@ -477,7 +477,7 @@ TEST_F(UcellTest, CalNbandsWarning2)
477
477
nelec_spin[0 ] = (PARAM.input .nelec + PARAM.input .nupdown ) / 2.0 ;
478
478
nelec_spin[1 ] = (PARAM.input .nelec - PARAM.input .nupdown ) / 2.0 ;
479
479
testing::internal::CaptureStdout ();
480
- EXPECT_EXIT (cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands ), ::testing::ExitedWithCode (1 ), " " );
480
+ EXPECT_EXIT (elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands ), ::testing::ExitedWithCode (1 ), " " );
481
481
output = testing::internal::GetCapturedStdout ();
482
482
EXPECT_THAT (output, testing::HasSubstr (" Too few spin up bands!" ));
483
483
}
@@ -490,7 +490,7 @@ TEST_F(UcellTest, CalNbandsWarning3)
490
490
nelec_spin[0 ] = (PARAM.input .nelec + PARAM.input .nupdown ) / 2.0 ;
491
491
nelec_spin[1 ] = (PARAM.input .nelec - PARAM.input .nupdown ) / 2.0 ;
492
492
testing::internal::CaptureStdout ();
493
- EXPECT_EXIT (cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands ), ::testing::ExitedWithCode (1 ), " " );
493
+ EXPECT_EXIT (elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands ), ::testing::ExitedWithCode (1 ), " " );
494
494
output = testing::internal::GetCapturedStdout ();
495
495
EXPECT_THAT (output, testing::HasSubstr (" Too few spin down bands!" ));
496
496
}
@@ -500,7 +500,7 @@ TEST_F(UcellTest, CalNbandsSpin1)
500
500
PARAM.input .nspin = 1 ;
501
501
PARAM.input .nbands = 0 ;
502
502
std::vector<double > nelec_spin (2 , 5.0 );
503
- cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
503
+ elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
504
504
EXPECT_EQ (PARAM.input .nbands , 15 );
505
505
}
506
506
@@ -510,7 +510,7 @@ TEST_F(UcellTest, CalNbandsSpin1LCAO)
510
510
PARAM.input .nbands = 0 ;
511
511
PARAM.input .basis_type = " lcao" ;
512
512
std::vector<double > nelec_spin (2 , 5.0 );
513
- cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
513
+ elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
514
514
EXPECT_EQ (PARAM.input .nbands , 6 );
515
515
}
516
516
@@ -519,7 +519,7 @@ TEST_F(UcellTest, CalNbandsSpin4)
519
519
PARAM.input .nspin = 4 ;
520
520
PARAM.input .nbands = 0 ;
521
521
std::vector<double > nelec_spin (2 , 5.0 );
522
- cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
522
+ elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
523
523
EXPECT_EQ (PARAM.input .nbands , 30 );
524
524
}
525
525
@@ -529,7 +529,7 @@ TEST_F(UcellTest, CalNbandsSpin4LCAO)
529
529
PARAM.input .nbands = 0 ;
530
530
PARAM.input .basis_type = " lcao" ;
531
531
std::vector<double > nelec_spin (2 , 5.0 );
532
- cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
532
+ elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
533
533
EXPECT_EQ (PARAM.input .nbands , 6 );
534
534
}
535
535
@@ -538,7 +538,7 @@ TEST_F(UcellTest, CalNbandsSpin2)
538
538
PARAM.input .nspin = 2 ;
539
539
PARAM.input .nbands = 0 ;
540
540
std::vector<double > nelec_spin (2 , 5.0 );
541
- cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
541
+ elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
542
542
EXPECT_EQ (PARAM.input .nbands , 16 );
543
543
}
544
544
@@ -548,7 +548,7 @@ TEST_F(UcellTest, CalNbandsSpin2LCAO)
548
548
PARAM.input .nbands = 0 ;
549
549
PARAM.input .basis_type = " lcao" ;
550
550
std::vector<double > nelec_spin (2 , 5.0 );
551
- cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
551
+ elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands );
552
552
EXPECT_EQ (PARAM.input .nbands , 6 );
553
553
}
554
554
@@ -558,7 +558,7 @@ TEST_F(UcellTest, CalNbandsGaussWarning)
558
558
std::vector<double > nelec_spin (2 , 5.0 );
559
559
PARAM.input .smearing_method = " gaussian" ;
560
560
testing::internal::CaptureStdout ();
561
- EXPECT_EXIT (cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands ), ::testing::ExitedWithCode (1 ), " " );
561
+ EXPECT_EXIT (elecstate:: cal_nbands (PARAM.input .nelec , PARAM.sys .nlocal , nelec_spin, PARAM.input .nbands ), ::testing::ExitedWithCode (1 ), " " );
562
562
output = testing::internal::GetCapturedStdout ();
563
563
EXPECT_THAT (output, testing::HasSubstr (" for smearing, num. of bands > num. of occupied bands" ));
564
564
}
0 commit comments