From 5ddc59d06f7f3e2c1c5f125f600e8c87e9572388 Mon Sep 17 00:00:00 2001 From: dyzheng Date: Sat, 12 Oct 2024 18:22:30 +0800 Subject: [PATCH] Fix: error in UT --- source/module_hsolver/test/hsolver_supplementary_mock.h | 6 ++++++ source/module_hsolver/test/test_hsolver_pw.cpp | 2 ++ source/module_hsolver/test/test_hsolver_sdft.cpp | 2 ++ 3 files changed, 10 insertions(+) diff --git a/source/module_hsolver/test/hsolver_supplementary_mock.h b/source/module_hsolver/test/hsolver_supplementary_mock.h index 95c69e555e..fd7d482d09 100644 --- a/source/module_hsolver/test/hsolver_supplementary_mock.h +++ b/source/module_hsolver/test/hsolver_supplementary_mock.h @@ -57,6 +57,12 @@ void ElecState::init_ks(Charge* chg_in, // pointer for class Charge return; } +Potential::~Potential(){} + +void Potential::cal_v_eff(const Charge*const chg, const UnitCell*const ucell, ModuleBase::matrix& v_eff){} + +void Potential::cal_fixed_v(double* vl_pseudo){} + } // namespace elecstate diff --git a/source/module_hsolver/test/test_hsolver_pw.cpp b/source/module_hsolver/test/test_hsolver_pw.cpp index cc545d8d14..5bbbc4bc0f 100644 --- a/source/module_hsolver/test/test_hsolver_pw.cpp +++ b/source/module_hsolver/test/test_hsolver_pw.cpp @@ -84,6 +84,7 @@ class TestHSolverPW : public ::testing::Test { TEST_F(TestHSolverPW, solve) { // initial memory and data elecstate_test.ekb.create(1, 2); + elecstate_test.pot = new elecstate::Potential; this->ekb_f.resize(2); psi_test_cf.resize(1, 2, 3); psi_test_cd.resize(1, 2, 3); @@ -216,6 +217,7 @@ TEST_F(TestHSolverPW, SolveLcaoInPW) { pwbk.nks = 1; // initial memory and data elecstate_test.ekb.create(1, 2); + elecstate_test.pot = new elecstate::Potential; // 1 kpt, 2 bands, 3 basis psi_test_cf.resize(1, 2, 3); psi_test_cd.resize(1, 2, 3); diff --git a/source/module_hsolver/test/test_hsolver_sdft.cpp b/source/module_hsolver/test/test_hsolver_sdft.cpp index c48db2cee0..4e6aa18bd4 100644 --- a/source/module_hsolver/test/test_hsolver_sdft.cpp +++ b/source/module_hsolver/test/test_hsolver_sdft.cpp @@ -170,6 +170,7 @@ TEST_F(TestHSolverPW_SDFT, solve) { //initial memory and data elecstate_test.ekb.create(1,2); + elecstate_test.pot = new elecstate::Potential; elecstate_test.f_en.eband = 0.0; stowf.nbands_diag = 0; stowf.nbands_total = 0; @@ -213,6 +214,7 @@ TEST_F(TestHSolverPW_SDFT, solve_noband_skipcharge) { //initial memory and data elecstate_test.ekb.create(1,2); + elecstate_test.pot = new elecstate::Potential; elecstate_test.f_en.eband = 0.0; stowf.nbands_diag = 0; stowf.nbands_total = 0;