Skip to content

Commit 8742d3d

Browse files
committed
fix segment fault in the test
1 parent be57137 commit 8742d3d

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

source/module_relax/relax_new/test/relax_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class Test_SETGRAD : public testing::Test
4949
ucell.atoms[0].taud.resize(nat);
5050
ucell.atoms[0].tau.resize(nat);
5151
ucell.atoms[0].dis.resize(nat);
52+
ucell.atoms[0].mag.resize(nat);
53+
ucell.atoms[0].vel.resize(nat);
5254
ucell.lc = new int[3];
5355

5456
ucell.iat2it[0] = 0;

source/module_relax/relax_old/test/for_test.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ Atom::Atom()
7979
na = 2;
8080
tau.resize(na);
8181
dis.resize(na);
82+
mag.resize(na);
8283
mbl.resize(na);
84+
vel.resize(na);
8385
taud.resize(na);
8486
}
8587
Atom::~Atom()

source/module_relax/relax_old/test/ions_move_cg_test.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,15 @@ class IonsMoveCGTest : public ::testing::Test
4343
for (int it = 0; it < ucell.ntype; it++)
4444
{
4545
Atom* atom = &ucell.atoms[it];
46+
atom->label="test";
4647
for (int ia = 0; ia < atom->na; ia++)
4748
{
49+
atom->mag[ia]= 1;
4850
for (int ik = 0; ik < 3; ++ik)
4951
{
5052
atom->tau[ia][ik] = 1;
5153
atom->mbl[ia][ik] = 1;
54+
atom->vel[ia][ik] = 1;
5255
}
5356
}
5457
}

0 commit comments

Comments
 (0)