Skip to content

Commit 7dfebfd

Browse files
committed
fix bug in relax test
1 parent 1eae531 commit 7dfebfd

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

source/module_cell/update_cell.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,9 @@ void setup_cell_after_vc(UnitCell& ucell, std::ofstream& log) {
337337
output::printM3(log,
338338
"Lattice vectors: (Cartesian coordinate: in unit of a_0)",
339339
ucell.latvec);
340-
output::printM3(
341-
log,
342-
"Reciprocal vectors: (Cartesian coordinate: in unit of 2 pi/a_0)",
343-
ucell.G);
340+
output::printM3(log,
341+
"Reciprocal vectors: (Cartesian coordinate: in unit of 2 pi/a_0)",
342+
ucell.G);
344343

345344
return;
346345
}

source/module_relax/relax_new/test/relax_test.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ class Test_SETGRAD : public testing::Test
7272
ucell.atoms[0].taud[1] = 0.0;
7373
ucell.atoms[0].taud[2] = 0.0;
7474

75+
ucell.atoms[0].tau.resize(nat);
76+
7577
ucell.lc[0] = 1;
7678
ucell.lc[1] = 1;
7779
ucell.lc[2] = 1;
@@ -105,11 +107,13 @@ class Test_SETGRAD : public testing::Test
105107
ucell.latvec.Identity();
106108
input.fixed_axes = "a"; //anything other than "None"
107109
input.fixed_ibrav = true;
110+
ucell.latName = "sc";
108111
ucell.lc[0] = 0;
109112
ucell.lc[1] = 0;
110113
ucell.lc[2] = 0;
111114
rl.init_relax(nat);
112115
rl.relax_step(ucell,force_in,stress_in,0.0);
116+
113117
push_result();
114118
}
115119

@@ -167,7 +171,6 @@ class Test_RELAX : public testing::Test
167171
this->setup_cell();
168172

169173
ModuleBase::matrix force_in, stress_in;
170-
171174
force_in.create(nat,3);
172175
stress_in.create(3,3);
173176

@@ -192,6 +195,7 @@ class Test_RELAX : public testing::Test
192195

193196
energy_file >> energy;
194197

198+
PARAM.input.fixed_ibrav = false;
195199
rl.relax_step(ucell,force_in,stress_in,energy);
196200

197201
result.push_back(ucell.atoms[0].taud[0].x);
@@ -253,6 +257,7 @@ class Test_RELAX : public testing::Test
253257
int na = ucell.atoms[i].na;
254258
ucell.atoms[i].mbl.resize(na);
255259
ucell.atoms[i].taud.resize(na);
260+
ucell.atoms[i].tau.resize(na);
256261
for (int j=0;j<na;j++)
257262
{
258263
ucell.atoms[i].mbl[j] = {1,1,1};

0 commit comments

Comments
 (0)