From 558c7a4e87f813d9bc82659b7dfb1158828c8451 Mon Sep 17 00:00:00 2001 From: Chen Nuo <49788094+Cstandardlib@users.noreply.github.com> Date: Wed, 24 Sep 2025 21:52:43 +0800 Subject: [PATCH] Fix obscure output 1 in scf_iterinfo --- source/source_estate/elecstate_print.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/source_estate/elecstate_print.cpp b/source/source_estate/elecstate_print.cpp index 0cc2d16da6..75a3eed592 100644 --- a/source/source_estate/elecstate_print.cpp +++ b/source/source_estate/elecstate_print.cpp @@ -92,8 +92,8 @@ void print_scf_iterinfo(const std::string& ks_solver, td_fmt.emplace_back(" %" + std::to_string(wrho) + ".4e"); } // time column, trivial - th_fmt.emplace_back(" %" + std::to_string(wtime) + "s\n"); - td_fmt.emplace_back(" %" + std::to_string(wtime) + ".2f\n"); + th_fmt.emplace_back(" %" + std::to_string(wtime) + "s"); + td_fmt.emplace_back(" %" + std::to_string(wtime) + ".2f"); // contents std::vector titles; std::vector values; @@ -141,12 +141,13 @@ void print_scf_iterinfo(const std::string& ks_solver, { buf += FmtCore::format(th_fmt[i].c_str(), titles[i]); } + buf += '\n'; // add a new line after header } for (int i = 0; i < values.size(); i++) { buf += FmtCore::format(td_fmt[i].c_str(), values[i]); } - std::cout << buf << std::fflush; + std::cout << buf << std::endl; // endline and flush }