Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redirect print_summary to LAMMPS log #1324

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions source/lmp/pair_deepmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ void
PairDeepMD::print_summary(const string pre) const
{
if (comm->me == 0){
// capture cout to a string, then call LAMMPS's utils::logmesg
// https://stackoverflow.com/a/4043813/9567349
std::stringstream buffer;
std::streambuf *sbuf = std::cout.rdbuf();
std::cout.rdbuf(buffer.rdbuf());

cout << "Summary of lammps deepmd module ..." << endl;
cout << pre << ">>> Info of deepmd-kit:" << endl;
deep_pot.print_summary(pre);
Expand All @@ -279,6 +285,9 @@ PairDeepMD::print_summary(const string pre) const
cout << pre << "build float prec: " << STR_FLOAT_PREC << endl;
cout << pre << "build with tf inc: " << STR_TensorFlow_INCLUDE_DIRS << endl;
cout << pre << "build with tf lib: " << STR_TensorFlow_LIBRARY << endl;

std::cout.rdbuf(sbuf);
utils::logmesg(lmp, buffer.str());
}
}

Expand Down