Skip to content

Commit e7917d4

Browse files
authored
Add "#TOTAL ENERGY#" after each ion step (#6342)
* add #TOTAL ENERGY# for each ion step * fix bug
1 parent adaa38e commit e7917d4

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

source/source_esolver/esolver_dp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void ESolver_DP::runner(UnitCell& ucell, const int istep)
9797
const double fact_v = rescaling / (ucell.omega * ModuleBase::Ry_to_eV);
9898

9999
dp_potential *= fact_e;
100-
GlobalV::ofs_running << " final etot is " << std::setprecision(11) << dp_potential * ModuleBase::Ry_to_eV << " eV"
100+
GlobalV::ofs_running << " #TOTAL ENERGY# " << std::setprecision(11) << dp_potential * ModuleBase::Ry_to_eV << " eV"
101101
<< std::endl;
102102

103103
for (int i = 0; i < ucell.nat; ++i)

source/source_esolver/esolver_lj.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void ESolver_LJ::runner(UnitCell& ucell, const int istep)
7777
}
7878

7979
lj_potential /= 2.0;
80-
GlobalV::ofs_running << " final etot is " << std::setprecision(11) << lj_potential * ModuleBase::Ry_to_eV << " eV"
80+
GlobalV::ofs_running << " #TOTAL ENERGY# " << std::setprecision(11) << lj_potential * ModuleBase::Ry_to_eV << " eV"
8181
<< std::endl;
8282

8383
// Post treatment for virial

source/source_io/output_log.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ void output_convergence_after_scf(const bool &convergence, double& energy, std::
1919
{
2020
ofs_running << " #SCF IS CONVERGED#" << std::endl;
2121
// ofs_running << " final etot is " << std::setprecision(11) << energy * ModuleBase::Ry_to_eV << " eV" << std::endl;
22+
ofs_running << " #TOTAL ENERGY# " << std::setprecision(11) << energy * ModuleBase::Ry_to_eV << " eV" << std::endl;
2223
}
2324
else
2425
{

source/source_io/test/outputlog_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ TEST(OutputConvergenceAfterSCFTest, TestConvergence) {
3636
std::string file_content = ss.str();
3737
ifs_running.close();
3838

39-
std::string expected_content = " #SCF IS CONVERGED#\n";
39+
std::string expected_content = " #SCF IS CONVERGED#\n #TOTAL ENERGY# 27.211396 eV\n";
4040

4141
EXPECT_EQ(file_content, expected_content);
42-
std::remove("test_output_convergence.txt");
42+
//std::remove("test_output_convergence.txt");
4343
}
4444

4545
TEST(OutputConvergenceAfterSCFTest, TestNotConvergence) {
@@ -62,7 +62,7 @@ TEST(OutputConvergenceAfterSCFTest, TestNotConvergence) {
6262

6363
EXPECT_EQ(file_content, expected_content);
6464
EXPECT_EQ(screen_output, expected_content_screen);
65-
std::remove("test_output_convergence_noconvergence.txt");
65+
//std::remove("test_output_convergence_noconvergence.txt");
6666
}
6767

6868
// Test the output_efermi function

0 commit comments

Comments
 (0)