Skip to content

Commit 28ce913

Browse files
committed
update test for relax_new
1 parent 555bec6 commit 28ce913

File tree

2 files changed

+36
-534
lines changed

2 files changed

+36
-534
lines changed

source/module_relax/relax_new/test/relax_test.cpp

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class Test_RELAX : public testing::Test
177177
std::ifstream stress_file("./support/stress.txt");
178178
std::ifstream energy_file("./support/stress.txt");
179179

180-
int nstep = 66;
180+
int nstep = 3;
181181
int nat = 5;
182182
double energy;
183183
PARAM.input.stress_thr = 0.01;
@@ -211,7 +211,6 @@ class Test_RELAX : public testing::Test
211211

212212
PARAM.input.fixed_ibrav = false;
213213
rl.relax_step(ucell,force_in,stress_in,energy);
214-
215214
result.push_back(ucell.atoms[0].taud[0].x);
216215
result.push_back(ucell.atoms[0].taud[0].y);
217216
result.push_back(ucell.atoms[0].taud[0].z);
@@ -303,12 +302,43 @@ class Test_RELAX : public testing::Test
303302

304303
TEST_F(Test_RELAX, relax_new)
305304
{
306-
int size = 1584;
305+
int size = 72;
307306
double tmp;
308-
std::ifstream result_ref("./support/result_ref.txt");
307+
std::vector<double> result_ref=
308+
{
309+
0.5000000586,0.4999998876,0.009364595811,
310+
0.9999999281,1.901333279e-07,0.5476035454,
311+
3.782097706e-07,0.4999999285,0.4770375874,
312+
0.4999997826,2.072311863e-07,0.477037871,
313+
0.9999998523,0.9999997866,0.9349574003,
314+
// paramter for taud after first relaxation
315+
4.006349654,-1.93128788e-07,5.793863639e-07,
316+
-1.93128788e-07,4.006354579,-3.86257576e-07,
317+
6.757962549e-07,-4.505308366e-07,3.966870038,
318+
// paramter for latvec after first relaxation
319+
0.5000000566,0.4999998916,0.009177239183,
320+
0.9999999308,1.832935626e-07,0.5467689737,
321+
3.647769323e-07,0.4999999311,0.4771204124,
322+
0.4999997903,1.998879545e-07,0.4771206859,
323+
0.9999998574,0.9999997943,0.9358136888,
324+
// paramter for taud after second relaxation
325+
3.999761277,-1.656764727e-07,4.97029418e-07,
326+
-1.656764727e-07,3.999765501,-3.313529453e-07,
327+
5.797351131e-07,-3.864900754e-07,4.010925071,
328+
// paramter for latvec after second relaxation
329+
0.500000082,0.4999999574,0.01057784352,
330+
0.9999999149,1.939640249e-07,0.5455830599,
331+
3.795967781e-07,0.4999998795,0.4765373919,
332+
0.4999998037,2.756298268e-07,0.4765374602,
333+
0.9999998196,0.9999996936,0.9367652445,
334+
// paramter for taud after third relaxation
335+
4.017733155,-1.420363309e-07,2.637046077e-07,
336+
-1.420364243e-07,4.017735987,3.126225134e-07,
337+
3.479123171e-07,2.578467568e-07,4.011674933
338+
// paramter for latvec after third relaxation
339+
};
309340
for(int i=0;i<size;i++)
310341
{
311-
result_ref >> tmp;
312-
EXPECT_NEAR(tmp,result[i],1e-8);
342+
EXPECT_NEAR(result_ref[i],result[i],1e-8);
313343
}
314344
}

0 commit comments

Comments
 (0)