From b6d10cd3942421c23a25aeebd7dd0049e84df009 Mon Sep 17 00:00:00 2001 From: chn Date: Wed, 27 Sep 2023 21:20:04 +0800 Subject: [PATCH] bug fix --- include/ufo/ufo.impl.hpp | 22 +++++++++++----------- src/ufo.cpp | 10 +++++----- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/ufo/ufo.impl.hpp b/include/ufo/ufo.impl.hpp index dfa0794..e3282c4 100644 --- a/include/ufo/ufo.impl.hpp +++ b/include/ufo/ufo.impl.hpp @@ -211,18 +211,18 @@ inline void Output::write(std::string filename, std::string format, unsigned per frequency_to_weight.erase(it_lower, it_upper); frequency_to_weight[frequency_sum / weight_sum] = weight_sum; } - auto& _ = output.QPointData.emplace_back(); - _.QPoint = qpoint->QPoint; - _.Source = qpoint->Source; - _.SourceIndex_ = qpoint->SourceIndex_; - for (auto [frequency, weight] : frequency_to_weight) - if (weight > 0.1) - { - auto& __ = _.ModeData.emplace_back(); - __.Frequency = frequency; - __.Weight = weight; - } } + auto& _ = output.QPointData.emplace_back(); + _.QPoint = qpoint->QPoint; + _.Source = qpoint->Source; + _.SourceIndex_ = qpoint->SourceIndex_; + for (auto [frequency, weight] : frequency_to_weight) + if (weight > 0.1) + { + auto& __ = _.ModeData.emplace_back(); + __.Frequency = frequency; + __.Weight = weight; + } } output.write(filename, "yaml", 3); } diff --git a/src/ufo.cpp b/src/ufo.cpp index 37bde3a..b73e8a6 100644 --- a/src/ufo.cpp +++ b/src/ufo.cpp @@ -7,7 +7,7 @@ int main(int argc, const char** argv) std::cerr << "Reading input file..." << std::flush; Input input(argv[1]); - std::cerr << "Done." << std::endl; + std::cerr << " Done." << std::endl; // 反折叠的原理: 将超胞中的原子运动状态, 投影到一组平面波构成的基矢中. // 每一个平面波的波矢由两部分相加得到: 一部分是单胞倒格子的整数倍, 所取的个数有一定任意性, 论文中建议取大约单胞中原子个数那么多个; @@ -56,7 +56,7 @@ int main(int argc, const char** argv) std::execution::par, input.QPointData.begin(), input.QPointData.end(), projection_coefficient.begin(), [&](const auto& qpoint_data) { - std::osyncstream(std::cerr) << fmt::format("\rCalculating projection coefficient...({}/{})", + std::osyncstream(std::cerr) << fmt::format("\rCalculating projection coefficient... ({}/{})", finished_qpoint, input.QPointData.size()) << std::flush; std::vector> projection_coefficient(qpoint_data.ModeData.size()); // 这里, qpoint_data 和 projection_coefficient 均指对应于一个 q 点的数据 @@ -81,7 +81,7 @@ int main(int argc, const char** argv) finished_qpoint, input.QPointData.size()) << std::flush; return projection_coefficient; }); - std::cerr << "Done." << std::endl; + std::cerr << " Done." << std::endl; // 填充输出对象 std::cerr << "Filling output object..." << std::flush; @@ -166,10 +166,10 @@ int main(int argc, const char** argv) } } } - std::cerr << "Done." << std::endl; + std::cerr << " Done." << std::endl; std::cerr << "Writing output file..." << std::flush; for (auto& output_file : input.QPointDataOutputFile) output.write(output_file.FileName, output_file.Format); - std::cerr << "Done." << std::endl; + std::cerr << " Done." << std::endl; }