Refactoring of more tests

This commit is contained in:
Richard Berger
2021-03-29 14:27:42 -04:00
parent 1752bd0276
commit aaf9aa6d69
19 changed files with 627 additions and 847 deletions

View File

@ -20,6 +20,7 @@
#include "thermo.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "../testing/core.h"
#include <cmath>
#include <cstring>
@ -42,23 +43,17 @@ const double p_convert = 1.01325;
// of data in update.cpp. could be 1.0e-12
const double rel_error = 5.0e-7;
class PairUnitConvertTest : public ::testing::Test {
class PairUnitConvertTest : public LAMMPSTest {
protected:
LAMMPS *lmp;
Info *info;
double fold[4][3];
void SetUp() override
{
const char *args[] = {"PairUnitConvertTest", "-log", "none", "-echo", "screen", "-nocite"};
char **argv = (char **)args;
int argc = sizeof(args) / sizeof(char *);
if (!verbose) ::testing::internal::CaptureStdout();
lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
if (!verbose) ::testing::internal::GetCapturedStdout();
testbinary = "PairUnitConvertTest";
LAMMPSTest::SetUp();
ASSERT_NE(lmp, nullptr);
if (!verbose) ::testing::internal::CaptureStdout();
info = new Info(lmp);
BEGIN_HIDE_OUTPUT();
command("units metal");
command("dimension 3");
command("region box block -4 4 -4 4 -4 4");
@ -72,19 +67,14 @@ protected:
command("mass * 1.0");
command("write_data test_pair_unit_convert.data nocoeff");
command("clear");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
}
void TearDown() override
{
if (!verbose) ::testing::internal::CaptureStdout();
delete info;
delete lmp;
if (!verbose) ::testing::internal::GetCapturedStdout();
LAMMPSTest::TearDown();
remove("test_pair_unit_convert.data");
}
void command(const std::string &cmd) { lmp->input->one(cmd); }
};
TEST_F(PairUnitConvertTest, zero)
@ -92,13 +82,13 @@ TEST_F(PairUnitConvertTest, zero)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "zero")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style zero 6.0");
command("pair_coeff * *");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -109,14 +99,14 @@ TEST_F(PairUnitConvertTest, zero)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style zero 6.0");
command("pair_coeff * *");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -135,7 +125,7 @@ TEST_F(PairUnitConvertTest, lj_cut)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "lj/cut")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style lj/cut 6.0");
@ -145,7 +135,7 @@ TEST_F(PairUnitConvertTest, lj_cut)
command("pair_write 1 2 1000 r 0.1 6.0 test.table.metal lj_1_2");
command("pair_write 2 2 1000 r 0.1 6.0 test.table.metal lj_2_2");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -156,7 +146,7 @@ TEST_F(PairUnitConvertTest, lj_cut)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
@ -167,7 +157,7 @@ TEST_F(PairUnitConvertTest, lj_cut)
command("pair_write 1 2 1000 r 0.1 6.0 test.table.real lj_1_2");
command("pair_write 2 2 1000 r 0.1 6.0 test.table.real lj_2_2");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -186,13 +176,13 @@ TEST_F(PairUnitConvertTest, eam)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "eam")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style eam");
command("pair_coeff * * Cu_u3.eam");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -203,14 +193,14 @@ TEST_F(PairUnitConvertTest, eam)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style eam");
command("pair_coeff * * Cu_u3.eam");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -229,13 +219,13 @@ TEST_F(PairUnitConvertTest, eam_alloy)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "eam/alloy")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style eam/alloy");
command("pair_coeff * * AlCu.eam.alloy Al Cu");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -246,14 +236,14 @@ TEST_F(PairUnitConvertTest, eam_alloy)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style eam/alloy");
command("pair_coeff * * AlCu.eam.alloy Al Cu");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -272,13 +262,13 @@ TEST_F(PairUnitConvertTest, eam_fs)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "eam/fs")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style eam/fs");
command("pair_coeff * * FeP_mm.eam.fs Fe P");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -289,14 +279,14 @@ TEST_F(PairUnitConvertTest, eam_fs)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style eam/fs");
command("pair_coeff * * FeP_mm.eam.fs Fe P");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -315,13 +305,13 @@ TEST_F(PairUnitConvertTest, eam_cd)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "eam/cd")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style eam/cd");
command("pair_coeff * * FeCr.cdeam Cr Fe");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -332,14 +322,14 @@ TEST_F(PairUnitConvertTest, eam_cd)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style eam/cd");
command("pair_coeff * * FeCr.cdeam Cr Fe");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -358,13 +348,13 @@ TEST_F(PairUnitConvertTest, eim)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "eim")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style eim");
command("pair_coeff * * Na Cl ffield.eim Na Cl");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -375,14 +365,14 @@ TEST_F(PairUnitConvertTest, eim)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style eim");
command("pair_coeff * * Na Cl ffield.eim Na Cl");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -401,13 +391,13 @@ TEST_F(PairUnitConvertTest, gw)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "gw")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style gw");
command("pair_coeff * * SiC.gw Si C");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -418,14 +408,14 @@ TEST_F(PairUnitConvertTest, gw)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style gw");
command("pair_coeff * * SiC.gw Si C");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -444,13 +434,13 @@ TEST_F(PairUnitConvertTest, gw_zbl)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "gw/zbl")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style gw/zbl");
command("pair_coeff * * SiC.gw.zbl Si C");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -461,14 +451,14 @@ TEST_F(PairUnitConvertTest, gw_zbl)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style gw/zbl");
command("pair_coeff * * SiC.gw.zbl Si C");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -487,13 +477,13 @@ TEST_F(PairUnitConvertTest, nb3b_harmonic)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "nb3b/harmonic")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style nb3b/harmonic");
command("pair_coeff * * MOH.nb3b.harmonic M O");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -504,14 +494,14 @@ TEST_F(PairUnitConvertTest, nb3b_harmonic)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style nb3b/harmonic");
command("pair_coeff * * MOH.nb3b.harmonic M O");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -530,13 +520,13 @@ TEST_F(PairUnitConvertTest, sw)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "sw")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style sw");
command("pair_coeff * * GaN.sw Ga N");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -547,14 +537,14 @@ TEST_F(PairUnitConvertTest, sw)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style sw");
command("pair_coeff * * GaN.sw Ga N");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -573,7 +563,7 @@ TEST_F(PairUnitConvertTest, table_metal2real)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "table")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style table linear 1000");
@ -581,7 +571,7 @@ TEST_F(PairUnitConvertTest, table_metal2real)
command("pair_coeff 1 2 test.table.metal lj_1_2");
command("pair_coeff 2 2 test.table.metal lj_2_2");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -592,7 +582,7 @@ TEST_F(PairUnitConvertTest, table_metal2real)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
@ -601,7 +591,7 @@ TEST_F(PairUnitConvertTest, table_metal2real)
command("pair_coeff 1 2 test.table.metal lj_1_2");
command("pair_coeff 2 2 test.table.metal lj_2_2");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -620,7 +610,7 @@ TEST_F(PairUnitConvertTest, table_real2metal)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "table")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style table linear 1000");
@ -628,7 +618,7 @@ TEST_F(PairUnitConvertTest, table_real2metal)
command("pair_coeff 1 2 test.table.real lj_1_2");
command("pair_coeff 2 2 test.table.real lj_2_2");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -639,7 +629,7 @@ TEST_F(PairUnitConvertTest, table_real2metal)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units metal");
command("read_data test_pair_unit_convert.data");
@ -648,7 +638,7 @@ TEST_F(PairUnitConvertTest, table_real2metal)
command("pair_coeff 1 2 test.table.real lj_1_2");
command("pair_coeff 2 2 test.table.real lj_2_2");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -667,13 +657,13 @@ TEST_F(PairUnitConvertTest, tersoff)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "tersoff")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style tersoff");
command("pair_coeff * * SiC.tersoff Si C");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -684,14 +674,14 @@ TEST_F(PairUnitConvertTest, tersoff)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style tersoff");
command("pair_coeff * * SiC.tersoff Si C");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -710,13 +700,13 @@ TEST_F(PairUnitConvertTest, tersoff_mod)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "tersoff/mod")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style tersoff/mod");
command("pair_coeff * * Si.tersoff.mod Si Si");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -727,14 +717,14 @@ TEST_F(PairUnitConvertTest, tersoff_mod)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style tersoff/mod");
command("pair_coeff * * Si.tersoff.mod Si Si");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -753,13 +743,13 @@ TEST_F(PairUnitConvertTest, tersoff_mod_c)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "tersoff/mod/c")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style tersoff/mod/c");
command("pair_coeff * * Si.tersoff.modc Si Si");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -770,14 +760,14 @@ TEST_F(PairUnitConvertTest, tersoff_mod_c)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style tersoff/mod/c");
command("pair_coeff * * Si.tersoff.modc Si Si");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -796,13 +786,13 @@ TEST_F(PairUnitConvertTest, tersoff_table)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "tersoff/table")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style tersoff/table");
command("pair_coeff * * SiC.tersoff Si C");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -813,14 +803,14 @@ TEST_F(PairUnitConvertTest, tersoff_table)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style tersoff/table");
command("pair_coeff * * SiC.tersoff Si C");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -839,13 +829,13 @@ TEST_F(PairUnitConvertTest, tersoff_zbl)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "tersoff/zbl")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style tersoff/zbl");
command("pair_coeff * * SiC.tersoff.zbl Si C");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -856,14 +846,14 @@ TEST_F(PairUnitConvertTest, tersoff_zbl)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style tersoff/zbl");
command("pair_coeff * * SiC.tersoff.zbl Si C");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -882,14 +872,14 @@ TEST_F(PairUnitConvertTest, tersoff_zbl_omp)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "tersoff/zbl/omp")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("package omp 4");
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style tersoff/zbl/omp");
command("pair_coeff * * SiC.tersoff.zbl Si C");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -900,7 +890,7 @@ TEST_F(PairUnitConvertTest, tersoff_zbl_omp)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("package omp 4");
command("units real");
@ -908,7 +898,7 @@ TEST_F(PairUnitConvertTest, tersoff_zbl_omp)
command("pair_style tersoff/zbl/omp");
command("pair_coeff * * SiC.tersoff.zbl Si C");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -927,13 +917,13 @@ TEST_F(PairUnitConvertTest, vashishta)
// check if the prerequisite pair style is available
if (!info->has_style("pair", "vashishta")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style vashishta");
command("pair_coeff * * SiC.vashishta Si C");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -944,14 +934,14 @@ TEST_F(PairUnitConvertTest, vashishta)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style vashishta");
command("pair_coeff * * SiC.vashishta Si C");
command("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);