@@ -102,14 +102,14 @@ void gen_dmk(std::vector<std::vector<T>>& dmk, std::vector<double>& efs, int ns
102102
103103TEST (DMKTest, GenFileName) {
104104 std::string fname = ModuleIO::dmk_gen_fname (true , 0 , 0 );
105- EXPECT_EQ (fname, " SPIN1_DM " );
105+ EXPECT_EQ (fname, " dms1_nao.txt " );
106106 fname = ModuleIO::dmk_gen_fname (true , 1 , 1 );
107- EXPECT_EQ (fname, " SPIN2_DM " );
107+ EXPECT_EQ (fname, " dms2_nao.txt " );
108108
109109 fname = ModuleIO::dmk_gen_fname (false , 0 , 0 );
110- EXPECT_EQ (fname, " SPIN1_K1_DM " );
110+ EXPECT_EQ (fname, " dms1k1_nao.txt " );
111111 fname = ModuleIO::dmk_gen_fname (false , 1 , 1 );
112- EXPECT_EQ (fname, " SPIN2_K2_DM " );
112+ EXPECT_EQ (fname, " dms2k2_nao.txt " );
113113};
114114
115115
@@ -139,7 +139,7 @@ TEST(DMKTest,WriteDMK) {
139139 int pass = 0 ;
140140 if (GlobalV::MY_RANK == 0 )
141141 {
142- std::string fn = " SPIN1_DM " ;
142+ std::string fn = " dms1_nao.txt " ;
143143 ifs.open (fn);
144144 std::string str ((std::istreambuf_iterator<char >(ifs)),
145145 std::istreambuf_iterator<char >());
@@ -158,7 +158,7 @@ TEST(DMKTest,WriteDMK) {
158158 testing::HasSubstr (" 1.600e+00 1.700e+00 1.800e+00 1.900e+00\n " ));
159159 ifs.close ();
160160
161- fn = " SPIN2_DM " ;
161+ fn = " dms2_nao.txt " ;
162162 ifs.open (fn);
163163 str = std::string ((std::istreambuf_iterator<char >(ifs)),
164164 std::istreambuf_iterator<char >());
@@ -177,7 +177,7 @@ TEST(DMKTest,WriteDMK) {
177177 testing::HasSubstr (" 2.600e+00 2.700e+00 2.800e+00 2.900e+00\n " ));
178178 ifs.close ();
179179
180- fn = " SPIN1_K1_DM " ;
180+ fn = " dms1k1_nao.txt " ;
181181 ifs.open (fn);
182182 str = std::string ((std::istreambuf_iterator<char >(ifs)),
183183 std::istreambuf_iterator<char >());
@@ -198,7 +198,7 @@ TEST(DMKTest,WriteDMK) {
198198 testing::HasSubstr (" (1.600e+00,1.600e+01) (1.700e+00,1.700e+01) (1.800e+00,1.800e+01) (1.900e+00,1.900e+01)\n " ));
199199 ifs.close ();
200200
201- fn = " SPIN1_K2_DM " ;
201+ fn = " dms1k2_nao.txt " ;
202202 ifs.open (fn);
203203 str = std::string ((std::istreambuf_iterator<char >(ifs)),
204204 std::istreambuf_iterator<char >());
@@ -219,7 +219,7 @@ TEST(DMKTest,WriteDMK) {
219219 testing::HasSubstr (" (2.600e+00,1.610e+01) (2.700e+00,1.710e+01) (2.800e+00,1.810e+01) (2.900e+00,1.910e+01)\n " ));
220220 ifs.close ();
221221
222- fn = " SPIN2_K1_DM " ;
222+ fn = " dms2k1_nao.txt " ;
223223 ifs.open (fn);
224224 str = std::string ((std::istreambuf_iterator<char >(ifs)),
225225 std::istreambuf_iterator<char >());
@@ -240,7 +240,7 @@ TEST(DMKTest,WriteDMK) {
240240 testing::HasSubstr (" (3.600e+00,1.620e+01) (3.700e+00,1.720e+01) (3.800e+00,1.820e+01) (3.900e+00,1.920e+01)\n " ));
241241 ifs.close ();
242242
243- fn = " SPIN2_K2_DM " ;
243+ fn = " dms2k2_nao.txt " ;
244244 ifs.open (fn);
245245 str = std::string ((std::istreambuf_iterator<char >(ifs)),
246246 std::istreambuf_iterator<char >());
@@ -260,12 +260,12 @@ TEST(DMKTest,WriteDMK) {
260260 str,
261261 testing::HasSubstr (" (4.600e+00,1.630e+01) (4.700e+00,1.730e+01) (4.800e+00,1.830e+01) (4.900e+00,1.930e+01)\n " ));
262262 ifs.close ();
263- remove (" SPIN1_DM " );
264- remove (" SPIN2_DM " );
265- remove (" SPIN1_K1_DM " );
266- remove (" SPIN1_K2_DM " );
267- remove (" SPIN2_K1_DM " );
268- remove (" SPIN2_K2_DM " );
263+ remove (" dms1_nao.txt " );
264+ remove (" dms2_nao.txt " );
265+ remove (" dms1k1_nao.txt " );
266+ remove (" dms1k2_nao.txt " );
267+ remove (" dms2k1_nao.txt " );
268+ remove (" dms2k2_nao.txt " );
269269 }
270270
271271 delete ucell;
@@ -274,7 +274,7 @@ TEST(DMKTest,WriteDMK) {
274274};
275275
276276
277-
277+ // no function in the main code calls read_dmk??? mohan note 2025-05-25
278278TEST (DMKTest, ReadDMK) {
279279 int nlocal = 26 ;
280280 std::vector<std::vector<double >> dmk;
@@ -284,9 +284,12 @@ TEST(DMKTest, ReadDMK) {
284284 PARAM.sys .global_out_dir = " ./" ;
285285
286286 init_pv (nlocal, pv);
287- EXPECT_TRUE (ModuleIO::read_dmk (1 , 1 , pv, " ./support/" , dmk));
288- ModuleIO::read_dmk (1 , 1 , pv, " ./support/" , dmk_multik);
289- EXPECT_TRUE (ModuleIO::read_dmk (1 , 1 , pv, " ./support/" , dmk_multik));
287+
288+ std::ofstream ofs_running (" running_log.txt" );
289+
290+ EXPECT_TRUE (ModuleIO::read_dmk (1 , 1 , pv, " ./support/" , dmk, ofs_running));
291+ ModuleIO::read_dmk (1 , 1 , pv, " ./support/" , dmk_multik, ofs_running);
292+ EXPECT_TRUE (ModuleIO::read_dmk (1 , 1 , pv, " ./support/" , dmk_multik, ofs_running));
290293 EXPECT_EQ (dmk.size (), 1 );
291294 EXPECT_EQ (dmk_multik.size (), 1 );
292295 EXPECT_EQ (dmk[0 ].size (), pv.get_local_size ());
@@ -297,6 +300,9 @@ TEST(DMKTest, ReadDMK) {
297300 EXPECT_NEAR (dmk_multik[0 ][1 ].real (), -4.479e-03 , 1e-6 );
298301 EXPECT_NEAR (dmk_multik[0 ][1 ].imag (), 3.208e-04 , 1e-6 );
299302 }
303+
304+ ofs_running.close ();
305+ remove (" running_log.txt" );
300306}
301307
302308
0 commit comments