@@ -97,9 +97,14 @@ TEST_F(IstateInfoTest, OutIstateInfoS1)
9797 ++i;
9898 }
9999
100- // write eigenvalues and occupations
101- const int istep_in = -1 ;
102- ModuleIO::write_eig_file (ekb, wg, *kv, istep_in);
100+ {
101+ std::ofstream stale_file (" eig_occ.txt" );
102+ stale_file << " stale calculation" << std::endl;
103+ }
104+
105+ // A new calculation truncates stale output, then later ionic steps append.
106+ ModuleIO::write_eig_file (ekb, wg, *kv, 0 );
107+ ModuleIO::write_eig_file (ekb, wg, *kv, 1 );
103108
104109 // check the output files
105110 std::ifstream ifs;
@@ -108,7 +113,11 @@ TEST_F(IstateInfoTest, OutIstateInfoS1)
108113 EXPECT_THAT (str, testing::HasSubstr (" Electronic state energy (eV) and occupations" ));
109114 EXPECT_THAT (str, testing::HasSubstr (" spin=1 k-point=1/10 Cartesian=0.0000000 0.0000000 0.0000000 (299 plane wave)" ));
110115 EXPECT_THAT (str, testing::HasSubstr (" 1 2.040854700000000 0.000000000000000" ));
116+ EXPECT_THAT (str, testing::Not (testing::HasSubstr (" stale calculation" )));
117+ EXPECT_THAT (str, testing::HasSubstr (" 1 # ionic step" ));
118+ EXPECT_THAT (str, testing::HasSubstr (" 2 # ionic step" ));
111119 ifs.close ();
120+
112121 remove (" eig_occ.txt" );
113122}
114123
0 commit comments