Skip to content

Commit e9c4323

Browse files
committed
fix deepks test
1 parent bad2cab commit e9c4323

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

source/module_deepks/LCAO_deepks_vdelta.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ void LCAO_Deepks::cal_e_delta_band(const std::vector<ModuleBase::matrix> &dm,
395395
if (mu >= 0 && nu >= 0)
396396
{
397397
const int index=nu*nrow+mu;
398-
for (int is = 0; is < GlobalV::NSPIN; ++is)
398+
for (int is = 0; is < dm.size(); ++is) //dm.size() == GlobalV::NSPIN
399399
{
400400
this->e_delta_band += dm[is](nu, mu) * this->H_V_delta[index];
401401
}

source/module_deepks/test/LCAO_deepks_test.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,17 @@ void test_deepks::check_psialpha(void)
5454

5555
void test_deepks::read_dm(void)
5656
{
57-
ifstream ifs("dm");
58-
dm.create(GlobalV::NLOCAL,GlobalV::NLOCAL);
57+
ifstream ifs("dm");
58+
dm.resize(1);
59+
dm[0].create(GlobalV::NLOCAL, GlobalV::NLOCAL);
5960

6061
for (int mu=0;mu<GlobalV::NLOCAL;mu++)
6162
{
6263
for (int nu=0;nu<GlobalV::NLOCAL;nu++)
6364
{
6465
double c;
6566
ifs >> c;
66-
dm(mu,nu)=c;
67+
dm[0](mu,nu)=c;
6768
}
6869
}
6970
}
@@ -96,7 +97,7 @@ void test_deepks::check_pdm(void)
9697
if(GlobalV::GAMMA_ONLY_LOCAL)
9798
{
9899
this->read_dm();
99-
this->ld.cal_projected_DM(dm,
100+
this->ld.cal_projected_DM(dm[0],
100101
ucell,
101102
ORB,
102103
Test_Deepks::GridD,
@@ -124,7 +125,7 @@ void test_deepks::check_gdmx(void)
124125
this->ld.init_gdmx(ucell.nat);
125126
if(GlobalV::GAMMA_ONLY_LOCAL)
126127
{
127-
this->ld.cal_gdmx(dm,
128+
this->ld.cal_gdmx(dm[0],
128129
ucell,
129130
ORB,
130131
Test_Deepks::GridD,
@@ -288,7 +289,7 @@ void test_deepks::check_f_delta()
288289
svnl_dalpha.create(3,3);
289290
if(GlobalV::GAMMA_ONLY_LOCAL)
290291
{
291-
ld.cal_f_delta_gamma(dm,
292+
ld.cal_f_delta_gamma(dm[0],
292293
ucell,
293294
ORB,
294295
Test_Deepks::GridD,

source/module_deepks/test/LCAO_deepks_test.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class test_deepks
5656
int ntype=0;
5757
int nnr;
5858

59-
ModuleBase::matrix dm;
59+
std::vector<ModuleBase::matrix> dm;
6060
std::vector<ModuleBase::ComplexMatrix> dm_k;
6161

6262
//preparation

0 commit comments

Comments
 (0)