Skip to content

Commit

Permalink
Make it possible to print the kinetic and total energies with any pre…
Browse files Browse the repository at this point in the history
…cision
  • Loading branch information
lorenzo-rovigatti committed Sep 17, 2024
1 parent 51def37 commit f42d61d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Observables/KineticEnergy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ number KineticEnergy::get_kinetic_energy() {
std::string KineticEnergy::get_output_string(llint curr_step) {
number K = get_kinetic_energy();

return Utils::sformat("% 10.6lf", K);
return Utils::sformat(_number_formatter, K);
}
3 changes: 2 additions & 1 deletion src/Observables/TotalEnergy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ std::string TotalEnergy::get_output_string(llint curr_step) {
number U = get_U(curr_step);
number K = get_K(curr_step);

return Utils::sformat("% 10.6lf % 10.6lf % 10.6lf", U, K, U + K);
std::string format = Utils::sformat("%s %s %s", _number_formatter.c_str(), _number_formatter.c_str(), _number_formatter.c_str());
return Utils::sformat(format, U, K, U + K);
}

number TotalEnergy::get_U(llint curr_step) {
Expand Down

0 comments on commit f42d61d

Please sign in to comment.