Merge branch 'master' into neighlist-interface-updates

This commit is contained in:
Axel Kohlmeyer
2021-04-03 10:18:28 -04:00
289 changed files with 12577 additions and 3257 deletions

View File

@ -1,5 +1,14 @@
include(GTest)
# check if we can run the compiled executable and whether it prints
# the LAMMPS version header in the output for an empty input
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/in.empty "")
add_test(NAME RunLammps
COMMAND $<TARGET_FILE:lmp> -log none -echo none -in in.empty
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_tests_properties(RunLammps PROPERTIES
PASS_REGULAR_EXPRESSION "^LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]\\)")
if(BUILD_MPI)
function(add_mpi_test)
set(MPI_TEST_NUM_PROCS 1)

View File

@ -191,7 +191,7 @@ TEST(MPI, multi_partition)
EXPECT_EQ(lammps_extract_setting(lmp, "world_rank"), 0);
char *part_id = (char *)lammps_extract_variable(lmp, "partition", nullptr);
ASSERT_THAT(part_id, StrEq(std::to_string(me+1)));
ASSERT_THAT(part_id, StrEq(std::to_string(me + 1)));
lammps_close(lmp);
};

View File

@ -1,5 +1,31 @@
# build LAMMPS plugins, but not on Windows
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND PKG_PLUGIN)
ExternalProject_Add(plugins
SOURCE_DIR "${LAMMPS_DIR}/examples/plugins"
BINARY_DIR ${CMAKE_BINARY_DIR}/build-plugins
INSTALL_DIR ${CMAKE_BINARY_DIR}
CMAKE_ARGS ${CMAKE_REQUEST_PIC}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
BUILD_BYPRODUCTS <BINARY_DIR>/morse2plugin${CMAKE_SHARED_MODULE_SUFFIX}
<BINARY_DIR>/nve2plugin${CMAKE_SHARED_MODULE_SUFFIX}
<BINARY_DIR>/helloplugin${CMAKE_SHARED_MODULE_SUFFIX}
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different
<BINARY_DIR>/morse2plugin${CMAKE_SHARED_MODULE_SUFFIX}
<BINARY_DIR>/nve2plugin${CMAKE_SHARED_MODULE_SUFFIX}
<BINARY_DIR>/helloplugin${CMAKE_SHARED_MODULE_SUFFIX}
${CMAKE_CURRENT_BINARY_DIR}
TEST_COMMAND "")
endif()
add_executable(test_simple_commands test_simple_commands.cpp)
if(PKG_PLUGIN)
add_dependencies(test_simple_commands plugins)
endif()
target_link_libraries(test_simple_commands PRIVATE lammps GTest::GMock GTest::GTest)
add_test(NAME SimpleCommands COMMAND test_simple_commands WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
@ -11,6 +37,10 @@ add_executable(test_groups test_groups.cpp)
target_link_libraries(test_groups PRIVATE lammps GTest::GMock GTest::GTest)
add_test(NAME Groups COMMAND test_groups WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_executable(test_variables test_variables.cpp)
target_link_libraries(test_variables PRIVATE lammps GTest::GMock GTest::GTest)
add_test(NAME Variables COMMAND test_variables WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_executable(test_kim_commands test_kim_commands.cpp)
if(KIM_EXTRA_UNITTESTS)
if(CURL_FOUND)

View File

@ -22,6 +22,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "../testing/core.h"
#include <cstring>
#include <vector>
@ -29,12 +30,6 @@
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
bool verbose = false;
#if defined(OMPI_MAJOR_VERSION)
const bool have_openmpi = true;
#else
const bool have_openmpi = false;
#endif
using LAMMPS_NS::utils::split_words;
namespace LAMMPS_NS {
@ -42,54 +37,22 @@ using ::testing::ExitedWithCode;
using ::testing::MatchesRegex;
using ::testing::StrEq;
#define TEST_FAILURE(errmsg, ...) \
if (Info::has_exceptions()) { \
::testing::internal::CaptureStdout(); \
ASSERT_ANY_THROW({__VA_ARGS__}); \
auto mesg = ::testing::internal::GetCapturedStdout(); \
if (verbose) std::cout << mesg; \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} else { \
if (!have_openmpi) { \
::testing::internal::CaptureStdout(); \
ASSERT_DEATH({__VA_ARGS__}, ""); \
auto mesg = ::testing::internal::GetCapturedStdout(); \
if (verbose) std::cout << mesg; \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} \
}
class GroupTest : public ::testing::Test {
class GroupTest : public LAMMPSTest {
protected:
LAMMPS *lmp;
Group *group;
Domain *domain;
void SetUp() override
{
const char *args[] = {"GroupTest", "-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();
group = lmp->group;
testbinary = "GroupTest";
LAMMPSTest::SetUp();
group = lmp->group;
domain = lmp->domain;
}
void TearDown() override
{
if (!verbose) ::testing::internal::CaptureStdout();
delete lmp;
if (!verbose) ::testing::internal::GetCapturedStdout();
std::cout.flush();
}
void command(const std::string &cmd) { lmp->input->one(cmd); }
void atomic_system()
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("units real");
command("lattice sc 1.0 origin 0.125 0.125 0.125");
command("region box block -2 2 -2 2 -2 2");
@ -101,23 +64,25 @@ protected:
command("region top block INF INF -2.0 -1.0 INF INF");
command("set region left type 2");
command("set region right type 3");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
}
void molecular_system()
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("fix props all property/atom mol rmass q");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
atomic_system();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("variable molid atom floor(id/4)+1");
command("variable charge atom 2.0*sin(PI/32*id)");
command("set atom * mol v_molid");
command("set atom * charge v_charge");
command("set type 1 mass 0.5");
command("set type 2*4 mass 2.0");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
}
};
@ -131,7 +96,7 @@ TEST_F(GroupTest, EmptyDelete)
{
atomic_system();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("group new1 empty");
command("group new2 empty");
command("group new2 empty");
@ -143,16 +108,16 @@ TEST_F(GroupTest, EmptyDelete)
command("compute 1 new3 ke");
command("dump 1 new4 atom 50 dump.melt");
command("atom_modify first new5");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_EQ(group->ngroup, 7);
TEST_FAILURE(".*ERROR: Illegal group command.*", command("group new3 xxx"););
TEST_FAILURE(".*ERROR: Illegal group command.*", command("group new3 empty xxx"););
TEST_FAILURE(".*ERROR: Group command requires atom attribute molecule.*",
command("group new2 include molecule"););
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
group->assign("new1 delete");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_EQ(group->ngroup, 6);
TEST_FAILURE(".*ERROR: Illegal group command.*", command("group new2 delete xxx"););
@ -172,13 +137,13 @@ TEST_F(GroupTest, RegionClear)
{
atomic_system();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("group one region left");
command("group two region right");
command("group three empty");
command("group four region left");
command("group four region right");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_EQ(group->count(group->find("one")), 16);
ASSERT_EQ(group->count(group->find("two")), 16);
ASSERT_EQ(group->count(group->find("three")), 0);
@ -189,20 +154,20 @@ TEST_F(GroupTest, RegionClear)
TEST_FAILURE(".*ERROR: Illegal group command.*", command("group three region left xxx"););
TEST_FAILURE(".*ERROR: Group region ID does not exist.*", command("group four region dummy"););
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("group one clear");
command("group two clear");
command("group three clear");
command("group four clear");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_EQ(group->count(group->find("one")), 0);
ASSERT_EQ(group->count(group->find("two")), 0);
ASSERT_EQ(group->count(group->find("three")), 0);
ASSERT_EQ(group->count(group->find("four")), 0);
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("delete_atoms region box");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_EQ(group->count(group->find("all")), 0);
}
@ -214,7 +179,7 @@ TEST_F(GroupTest, SelectRestart)
for (int i = 0; i < lmp->atom->natoms; ++i)
flags[i] = i & 1;
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("group one region left");
command("group two region right");
group->create("half", flags);
@ -224,7 +189,7 @@ TEST_F(GroupTest, SelectRestart)
command("group five subtract all half four");
command("group top region top");
command("group six intersect half top");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_EQ(group->count(group->find("one")), 16);
ASSERT_EQ(group->count(group->find("two")), 16);
ASSERT_EQ(group->count(group->find("three")), 0);
@ -235,12 +200,12 @@ TEST_F(GroupTest, SelectRestart)
ASSERT_EQ(group->count(group->find("half"), domain->find_region("top")), 8);
ASSERT_DOUBLE_EQ(group->mass(group->find("half"), domain->find_region("top")), 8.0);
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("write_restart group.restart");
command("clear");
command("read_restart group.restart");
unlink("group.restart");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
group = lmp->group;
ASSERT_EQ(group->count(group->find("one")), 16);
ASSERT_EQ(group->count(group->find("two")), 16);
@ -250,11 +215,11 @@ TEST_F(GroupTest, SelectRestart)
ASSERT_EQ(group->count(group->find("five")), 16);
ASSERT_DOUBLE_EQ(group->mass(group->find("six")), 8.0);
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("group four clear");
command("group five clear");
command("group six clear");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Group ID does not exist.*", command("group four union one two xxx"););
TEST_FAILURE(".*ERROR: Group ID does not exist.*",
@ -267,14 +232,14 @@ TEST_F(GroupTest, Molecular)
{
molecular_system();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("group one region left");
command("group two region right");
command("group half id 1:1000:2");
command("group top region top");
command("group three intersect half top");
command("group three include molecule");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_EQ(group->count(group->find("one")), 16);
ASSERT_EQ(group->count(group->find("two")), 16);
ASSERT_EQ(group->count(group->find("three")), 15);
@ -290,36 +255,36 @@ TEST_F(GroupTest, Dynamic)
{
atomic_system();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("variable step atom id<=step");
command("group half id 1:1000:2");
command("group grow dynamic half var step every 1");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_EQ(group->count(group->find("grow")), 0);
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("run 10 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_EQ(group->count(group->find("grow")), 5);
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("group grow dynamic half var step every 1");
command("run 10 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_EQ(group->count(group->find("grow")), 10);
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("group grow static");
command("run 10 post no");
command("group part variable step");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_EQ(group->count(group->find("grow")), 10);
ASSERT_EQ(group->count(group->find("part")), 30);
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("group grow dynamic half var step every 1");
command("run 10 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_EQ(group->count(group->find("grow")), 20);
TEST_FAILURE(".*ERROR: Cannot subtract groups using a dynamic group.*",
command("group chunk subtract half grow"););
@ -328,10 +293,10 @@ TEST_F(GroupTest, Dynamic)
TEST_FAILURE(".*ERROR: Cannot intersect groups using a dynamic group.*",
command("group chunk intersect half grow"););
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("group grow delete");
command("variable ramp equal step");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_EQ(group->ngroup, 4);
TEST_FAILURE(".*ERROR: Group dynamic cannot reference itself.*",
@ -351,7 +316,7 @@ int main(int argc, char **argv)
MPI_Init(&argc, &argv);
::testing::InitGoogleMock(&argc, argv);
if (have_openmpi && !LAMMPS_NS::Info::has_exceptions())
if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions())
std::cout << "Warning: using OpenMPI without exceptions. "
"Death tests will be skipped\n";

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,7 @@
#include "utils.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "../testing/core.h"
#include <cstdio>
#include <cstring>
@ -32,12 +33,6 @@
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
bool verbose = false;
#if defined(OMPI_MAJOR_VERSION)
const bool have_openmpi = true;
#else
const bool have_openmpi = false;
#endif
using LAMMPS_NS::utils::split_words;
namespace LAMMPS_NS {
@ -45,49 +40,22 @@ using ::testing::ExitedWithCode;
using ::testing::MatchesRegex;
using ::testing::StrEq;
#define TEST_FAILURE(errmsg, ...) \
if (Info::has_exceptions()) { \
::testing::internal::CaptureStdout(); \
ASSERT_ANY_THROW({__VA_ARGS__}); \
auto mesg = ::testing::internal::GetCapturedStdout(); \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} else { \
if (!have_openmpi) { \
::testing::internal::CaptureStdout(); \
ASSERT_DEATH({__VA_ARGS__}, ""); \
auto mesg = ::testing::internal::GetCapturedStdout(); \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} \
}
class LatticeRegionTest : public ::testing::Test {
class LatticeRegionTest : public LAMMPSTest {
protected:
LAMMPS *lmp;
void SetUp() override
{
const char *args[] = {"LatticeRegionTest", "-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);
lmp->input->one("units metal");
if (!verbose) ::testing::internal::GetCapturedStdout();
}
void TearDown() override
{
if (!verbose) ::testing::internal::CaptureStdout();
delete lmp;
if (!verbose) ::testing::internal::GetCapturedStdout();
testbinary = "LatticeRegionTest";
LAMMPSTest::SetUp();
command("units metal");
}
};
TEST_F(LatticeRegionTest, lattice_none)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice none 2.0");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice none 2.0");
END_HIDE_OUTPUT();
auto lattice = lmp->domain->lattice;
ASSERT_EQ(lattice->style, Lattice::NONE);
ASSERT_EQ(lattice->xlattice, 2.0);
@ -96,15 +64,15 @@ TEST_F(LatticeRegionTest, lattice_none)
ASSERT_EQ(lattice->nbasis, 0);
ASSERT_EQ(lattice->basis, nullptr);
TEST_FAILURE(".*ERROR: Illegal lattice command.*", lmp->input->one("lattice"););
TEST_FAILURE(".*ERROR: Illegal lattice command.*", lmp->input->one("lattice xxx"););
TEST_FAILURE(".*ERROR: Illegal lattice command.*", lmp->input->one("lattice none 1.0 origin"););
TEST_FAILURE(".*ERROR: Expected floating point.*", lmp->input->one("lattice none xxx"););
TEST_FAILURE(".*ERROR: Illegal lattice command.*", command("lattice"););
TEST_FAILURE(".*ERROR: Illegal lattice command.*", command("lattice xxx"););
TEST_FAILURE(".*ERROR: Illegal lattice command.*", command("lattice none 1.0 origin"););
TEST_FAILURE(".*ERROR: Expected floating point.*", command("lattice none xxx"););
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units lj");
lmp->input->one("lattice none 1.0");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("units lj");
command("lattice none 1.0");
END_HIDE_OUTPUT();
lattice = lmp->domain->lattice;
ASSERT_EQ(lattice->xlattice, 1.0);
ASSERT_EQ(lattice->ylattice, 1.0);
@ -113,10 +81,9 @@ TEST_F(LatticeRegionTest, lattice_none)
TEST_F(LatticeRegionTest, lattice_sc)
{
::testing::internal::CaptureStdout();
lmp->input->one("lattice sc 1.0 spacing 1.5 2.0 3.0");
auto output = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << output;
BEGIN_CAPTURE_OUTPUT();
command("lattice sc 1.0 spacing 1.5 2.0 3.0");
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, MatchesRegex(".*Lattice spacing in x,y,z = 1.50* 2.0* 3.0*.*"));
auto lattice = lmp->domain->lattice;
@ -124,10 +91,9 @@ TEST_F(LatticeRegionTest, lattice_sc)
ASSERT_EQ(lattice->ylattice, 2.0);
ASSERT_EQ(lattice->zlattice, 3.0);
::testing::internal::CaptureStdout();
lmp->input->one("lattice sc 2.0");
output = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << output;
BEGIN_CAPTURE_OUTPUT();
command("lattice sc 2.0");
output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, MatchesRegex(".*Lattice spacing in x,y,z = 2.0* 2.0* 2.0*.*"));
lattice = lmp->domain->lattice;
@ -151,43 +117,42 @@ TEST_F(LatticeRegionTest, lattice_sc)
ASSERT_EQ(lattice->basis[0][2], 0.0);
TEST_FAILURE(".*ERROR: Illegal lattice command.*",
lmp->input->one("lattice sc 1.0 origin 1.0 1.0 1.0"););
command("lattice sc 1.0 origin 1.0 1.0 1.0"););
TEST_FAILURE(".*ERROR: Illegal lattice command.*", command("lattice sc 1.0 origin 1.0"););
TEST_FAILURE(".*ERROR: Illegal lattice command.*",
lmp->input->one("lattice sc 1.0 origin 1.0"););
TEST_FAILURE(".*ERROR: Illegal lattice command.*",
lmp->input->one("lattice sc 1.0 origin 0.0 0.0 0.0 xxx"););
command("lattice sc 1.0 origin 0.0 0.0 0.0 xxx"););
TEST_FAILURE(".*ERROR: Expected floating point.*",
lmp->input->one("lattice sc 1.0 origin xxx 1.0 1.0"););
command("lattice sc 1.0 origin xxx 1.0 1.0"););
TEST_FAILURE(".*ERROR: Lattice orient vectors are not orthogonal.*",
lmp->input->one("lattice sc 1.0 orient x 2 2 0"););
command("lattice sc 1.0 orient x 2 2 0"););
TEST_FAILURE(".*ERROR: Lattice orient vectors are not right-handed.*",
lmp->input->one("lattice sc 1.0 orient y 0 -1 0"););
command("lattice sc 1.0 orient y 0 -1 0"););
TEST_FAILURE(".*ERROR: Lattice spacings are invalid.*",
lmp->input->one("lattice sc 1.0 spacing 0.0 1.0 1.0"););
command("lattice sc 1.0 spacing 0.0 1.0 1.0"););
TEST_FAILURE(".*ERROR: Lattice spacings are invalid.*",
lmp->input->one("lattice sc 1.0 spacing 1.0 -0.1 1.0"););
command("lattice sc 1.0 spacing 1.0 -0.1 1.0"););
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units lj");
lmp->input->one("lattice sc 2.0");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("units lj");
command("lattice sc 2.0");
END_HIDE_OUTPUT();
lattice = lmp->domain->lattice;
ASSERT_DOUBLE_EQ(lattice->xlattice, pow(0.5, 1.0 / 3.0));
ASSERT_DOUBLE_EQ(lattice->ylattice, pow(0.5, 1.0 / 3.0));
ASSERT_DOUBLE_EQ(lattice->zlattice, pow(0.5, 1.0 / 3.0));
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("dimension 2");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("dimension 2");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*",
lmp->input->one("lattice sc 1.0"););
command("lattice sc 1.0"););
}
TEST_F(LatticeRegionTest, lattice_bcc)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice bcc 4.2 orient x 1 1 0 orient y -1 1 0");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice bcc 4.2 orient x 1 1 0 orient y -1 1 0");
END_HIDE_OUTPUT();
auto lattice = lmp->domain->lattice;
ASSERT_EQ(lattice->style, Lattice::BCC);
ASSERT_DOUBLE_EQ(lattice->xlattice, sqrt(2.0) * 4.2);
@ -201,18 +166,18 @@ TEST_F(LatticeRegionTest, lattice_bcc)
ASSERT_EQ(lattice->basis[1][1], 0.5);
ASSERT_EQ(lattice->basis[1][2], 0.5);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("dimension 2");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("dimension 2");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*",
lmp->input->one("lattice bcc 1.0"););
command("lattice bcc 1.0"););
}
TEST_F(LatticeRegionTest, lattice_fcc)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice fcc 3.5 origin 0.5 0.5 0.5");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice fcc 3.5 origin 0.5 0.5 0.5");
END_HIDE_OUTPUT();
auto lattice = lmp->domain->lattice;
ASSERT_EQ(lattice->style, Lattice::FCC);
ASSERT_DOUBLE_EQ(lattice->xlattice, 3.5);
@ -233,24 +198,23 @@ TEST_F(LatticeRegionTest, lattice_fcc)
ASSERT_EQ(lattice->basis[3][2], 0.5);
TEST_FAILURE(".*ERROR: Invalid option in lattice command for non-custom style.*",
lmp->input->one("lattice fcc 1.0 basis 0.0 0.0 0.0"););
command("lattice fcc 1.0 basis 0.0 0.0 0.0"););
TEST_FAILURE(".*ERROR: Invalid option in lattice command for non-custom style.*",
lmp->input->one("lattice fcc 1.0 a1 0.0 1.0 0.0"););
TEST_FAILURE(".*ERROR: Illegal lattice command.*",
lmp->input->one("lattice fcc 1.0 orient w 1 0 0"););
command("lattice fcc 1.0 a1 0.0 1.0 0.0"););
TEST_FAILURE(".*ERROR: Illegal lattice command.*", command("lattice fcc 1.0 orient w 1 0 0"););
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("dimension 2");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("dimension 2");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*",
lmp->input->one("lattice fcc 1.0"););
command("lattice fcc 1.0"););
}
TEST_F(LatticeRegionTest, lattice_hcp)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice hcp 3.0 orient z 0 0 1");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice hcp 3.0 orient z 0 0 1");
END_HIDE_OUTPUT();
auto lattice = lmp->domain->lattice;
ASSERT_EQ(lattice->style, Lattice::HCP);
ASSERT_DOUBLE_EQ(lattice->xlattice, 3.0);
@ -280,21 +244,21 @@ TEST_F(LatticeRegionTest, lattice_hcp)
ASSERT_DOUBLE_EQ(lattice->a3[2], sqrt(8.0 / 3.0));
TEST_FAILURE(".*ERROR: Invalid option in lattice command for non-custom style.*",
lmp->input->one("lattice hcp 1.0 a2 0.0 1.0 0.0"););
command("lattice hcp 1.0 a2 0.0 1.0 0.0"););
TEST_FAILURE(".*ERROR: Invalid option in lattice command for non-custom style.*",
lmp->input->one("lattice hcp 1.0 a3 0.0 1.0 0.0"););
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("dimension 2");
if (!verbose) ::testing::internal::GetCapturedStdout();
command("lattice hcp 1.0 a3 0.0 1.0 0.0"););
BEGIN_HIDE_OUTPUT();
command("dimension 2");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*",
lmp->input->one("lattice hcp 1.0"););
command("lattice hcp 1.0"););
}
TEST_F(LatticeRegionTest, lattice_diamond)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice diamond 4.1 orient x 1 1 2 orient y -1 1 0 orient z -1 -1 1");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice diamond 4.1 orient x 1 1 2 orient y -1 1 0 orient z -1 -1 1");
END_HIDE_OUTPUT();
auto lattice = lmp->domain->lattice;
ASSERT_EQ(lattice->style, Lattice::DIAMOND);
ASSERT_DOUBLE_EQ(lattice->xlattice, 6.6952719636073539);
@ -335,19 +299,19 @@ TEST_F(LatticeRegionTest, lattice_diamond)
ASSERT_EQ(lattice->a3[1], 0.0);
ASSERT_EQ(lattice->a3[2], 1.0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("dimension 2");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("dimension 2");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*",
lmp->input->one("lattice diamond 1.0"););
command("lattice diamond 1.0"););
}
TEST_F(LatticeRegionTest, lattice_sq)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("dimension 2");
lmp->input->one("lattice sq 3.0");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("dimension 2");
command("lattice sq 3.0");
END_HIDE_OUTPUT();
auto lattice = lmp->domain->lattice;
ASSERT_EQ(lattice->style, Lattice::SQ);
ASSERT_DOUBLE_EQ(lattice->xlattice, 3.0);
@ -358,23 +322,22 @@ TEST_F(LatticeRegionTest, lattice_sq)
ASSERT_EQ(lattice->basis[0][1], 0.0);
ASSERT_EQ(lattice->basis[0][2], 0.0);
TEST_FAILURE(
".*ERROR: Lattice settings are not compatible with 2d simulation.*",
lmp->input->one("lattice sq 1.0 orient x 1 1 2 orient y -1 1 0 orient z -1 -1 1"););
TEST_FAILURE(".*ERROR: Lattice settings are not compatible with 2d simulation.*",
command("lattice sq 1.0 orient x 1 1 2 orient y -1 1 0 orient z -1 -1 1"););
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("dimension 3");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("dimension 3");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*",
lmp->input->one("lattice sq 1.0"););
command("lattice sq 1.0"););
}
TEST_F(LatticeRegionTest, lattice_sq2)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("dimension 2");
lmp->input->one("lattice sq2 2.0");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("dimension 2");
command("lattice sq2 2.0");
END_HIDE_OUTPUT();
auto lattice = lmp->domain->lattice;
ASSERT_EQ(lattice->style, Lattice::SQ2);
ASSERT_DOUBLE_EQ(lattice->xlattice, 2.0);
@ -388,19 +351,19 @@ TEST_F(LatticeRegionTest, lattice_sq2)
ASSERT_EQ(lattice->basis[1][1], 0.5);
ASSERT_EQ(lattice->basis[1][2], 0.0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("dimension 3");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("dimension 3");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*",
lmp->input->one("lattice sq2 1.0"););
command("lattice sq2 1.0"););
}
TEST_F(LatticeRegionTest, lattice_hex)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("dimension 2");
lmp->input->one("lattice hex 2.0");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("dimension 2");
command("lattice hex 2.0");
END_HIDE_OUTPUT();
auto lattice = lmp->domain->lattice;
ASSERT_EQ(lattice->style, Lattice::HEX);
ASSERT_DOUBLE_EQ(lattice->xlattice, 2.0);
@ -423,34 +386,34 @@ TEST_F(LatticeRegionTest, lattice_hex)
ASSERT_EQ(lattice->a3[1], 0.0);
ASSERT_EQ(lattice->a3[2], 1.0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("dimension 3");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("dimension 3");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Lattice style incompatible with simulation dimension.*",
lmp->input->one("lattice hex 1.0"););
command("lattice hex 1.0"););
}
TEST_F(LatticeRegionTest, lattice_custom)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("variable a equal 4.34");
lmp->input->one("variable b equal $a*sqrt(3.0)");
lmp->input->one("variable c equal $a*sqrt(8.0/3.0)");
lmp->input->one("variable t equal 1.0/3.0");
lmp->input->one("variable f equal 5.0/6.0");
lmp->input->one("lattice custom 1.0 "
"a1 $a 0.0 0.0 "
"a2 0.0 $b 0.0 "
"a3 0.0 0.0 $c "
"basis 0.0 0.0 0.0 "
"basis 0.5 0.5 0.0 "
"basis $t 0.0 0.5 "
"basis $f 0.5 0.5 "
"basis 0.0 0.0 0.625 "
"basis 0.5 0.5 0.625 "
"basis $t 0.0 0.125 "
"basis $f 0.5 0.125 ");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("variable a equal 4.34");
command("variable b equal $a*sqrt(3.0)");
command("variable c equal $a*sqrt(8.0/3.0)");
command("variable t equal 1.0/3.0");
command("variable f equal 5.0/6.0");
command("lattice custom 1.0 "
"a1 $a 0.0 0.0 "
"a2 0.0 $b 0.0 "
"a3 0.0 0.0 $c "
"basis 0.0 0.0 0.0 "
"basis 0.5 0.5 0.0 "
"basis $t 0.0 0.5 "
"basis $f 0.5 0.5 "
"basis 0.0 0.0 0.625 "
"basis 0.5 0.5 0.625 "
"basis $t 0.0 0.125 "
"basis $f 0.5 0.125 ");
END_HIDE_OUTPUT();
auto lattice = lmp->domain->lattice;
ASSERT_EQ(lattice->style, Lattice::CUSTOM);
ASSERT_DOUBLE_EQ(lattice->xlattice, 4.34);
@ -492,48 +455,48 @@ TEST_F(LatticeRegionTest, lattice_custom)
ASSERT_DOUBLE_EQ(lattice->a3[2], 4.34 * sqrt(8.0 / 3.0));
TEST_FAILURE(".*ERROR: Illegal lattice command.*",
lmp->input->one("lattice custom 1.0 basis -0.1 0 0"););
command("lattice custom 1.0 basis -0.1 0 0"););
TEST_FAILURE(".*ERROR: Illegal lattice command.*",
lmp->input->one("lattice custom 1.0 basis 0.0 1.0 0"););
command("lattice custom 1.0 basis 0.0 1.0 0"););
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("dimension 2");
if (!verbose) ::testing::internal::GetCapturedStdout();
TEST_FAILURE(".*ERROR: No basis atoms in lattice.*", lmp->input->one("lattice custom 1.0"););
BEGIN_HIDE_OUTPUT();
command("dimension 2");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: No basis atoms in lattice.*", command("lattice custom 1.0"););
TEST_FAILURE(".*ERROR: Lattice settings are not compatible with 2d simulation.*",
lmp->input->one("lattice custom 1.0 origin 0.5 0.5 0.5 basis 0.0 0.0 0.0"););
command("lattice custom 1.0 origin 0.5 0.5 0.5 basis 0.0 0.0 0.0"););
TEST_FAILURE(".*ERROR: Lattice settings are not compatible with 2d simulation.*",
lmp->input->one("lattice custom 1.0 a1 1.0 1.0 1.0 basis 0.0 0.0 0.0"););
command("lattice custom 1.0 a1 1.0 1.0 1.0 basis 0.0 0.0 0.0"););
TEST_FAILURE(".*ERROR: Lattice settings are not compatible with 2d simulation.*",
lmp->input->one("lattice custom 1.0 a2 1.0 1.0 1.0 basis 0.0 0.0 0.0"););
command("lattice custom 1.0 a2 1.0 1.0 1.0 basis 0.0 0.0 0.0"););
TEST_FAILURE(".*ERROR: Lattice settings are not compatible with 2d simulation.*",
lmp->input->one("lattice custom 1.0 a3 1.0 1.0 1.0 basis 0.0 0.0 0.0"););
command("lattice custom 1.0 a3 1.0 1.0 1.0 basis 0.0 0.0 0.0"););
}
TEST_F(LatticeRegionTest, region_fail)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice none 2.0");
lmp->input->one("region box block 0 1 0 1 0 1");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice none 2.0");
command("region box block 0 1 0 1 0 1");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Create_atoms command before simulation box is defined.*",
lmp->input->one("create_atoms 1 box"););
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("create_box 1 box");
if (!verbose) ::testing::internal::GetCapturedStdout();
command("create_atoms 1 box"););
BEGIN_HIDE_OUTPUT();
command("create_box 1 box");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Cannot create atoms with undefined lattice.*",
lmp->input->one("create_atoms 1 box"););
command("create_atoms 1 box"););
}
TEST_F(LatticeRegionTest, region_block_lattice)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice sc 1.5");
lmp->input->one("region box block 0 2 0 2 0 2 units lattice");
lmp->input->one("create_box 1 box");
lmp->input->one("create_atoms 1 box");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice sc 1.5");
command("region box block 0 2 0 2 0 2 units lattice");
command("create_box 1 box");
command("create_atoms 1 box");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->domain->triclinic, 0);
auto x = lmp->atom->x;
@ -554,12 +517,12 @@ TEST_F(LatticeRegionTest, region_block_lattice)
TEST_F(LatticeRegionTest, region_block_box)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice sc 1.5 origin 0.75 0.75 0.75");
lmp->input->one("region box block 0 2 0 2 0 2 units box");
lmp->input->one("create_box 1 box");
lmp->input->one("create_atoms 1 box");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice sc 1.5 origin 0.75 0.75 0.75");
command("region box block 0 2 0 2 0 2 units box");
command("create_box 1 box");
command("create_atoms 1 box");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->domain->triclinic, 0);
auto x = lmp->atom->x;
@ -571,93 +534,93 @@ TEST_F(LatticeRegionTest, region_block_box)
TEST_F(LatticeRegionTest, region_cone)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice fcc 2.5 origin 0.5 0.5 0.5");
lmp->input->one("region box cone x 1.0 1.0 0.5 2.1 0.0 2.0");
lmp->input->one("create_box 1 box");
lmp->input->one("create_atoms 1 region box");
lmp->input->one("write_dump all atom init.lammpstrj");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice fcc 2.5 origin 0.5 0.5 0.5");
command("region box cone x 1.0 1.0 0.5 2.1 0.0 2.0");
command("create_box 1 box");
command("create_atoms 1 region box");
command("write_dump all atom init.lammpstrj");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->domain->triclinic, 0);
ASSERT_EQ(lmp->atom->natoms, 42);
}
TEST_F(LatticeRegionTest, region_cylinder)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice fcc 2.5 origin 0.5 0.5 0.5");
lmp->input->one("region box cylinder z 1.0 1.0 2.1 0.0 2.0 ");
lmp->input->one("create_box 1 box");
lmp->input->one("create_atoms 1 region box");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice fcc 2.5 origin 0.5 0.5 0.5");
command("region box cylinder z 1.0 1.0 2.1 0.0 2.0 ");
command("create_box 1 box");
command("create_atoms 1 region box");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->domain->triclinic, 0);
ASSERT_EQ(lmp->atom->natoms, 114);
}
TEST_F(LatticeRegionTest, region_prism)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice bcc 2.5 origin 0.75 0.75 0.75");
lmp->input->one("region box prism 0 2 0 2 0 2 0.5 0.0 0.0");
lmp->input->one("create_box 1 box");
lmp->input->one("create_atoms 1 box");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice bcc 2.5 origin 0.75 0.75 0.75");
command("region box prism 0 2 0 2 0 2 0.5 0.0 0.0");
command("create_box 1 box");
command("create_atoms 1 box");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->domain->triclinic, 1);
ASSERT_EQ(lmp->atom->natoms, 16);
}
TEST_F(LatticeRegionTest, region_sphere)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice fcc 2.5 origin 0.5 0.5 0.5");
lmp->input->one("region box sphere 1.0 1.0 1.0 1.1");
lmp->input->one("create_box 1 box");
lmp->input->one("create_atoms 1 region box");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice fcc 2.5 origin 0.5 0.5 0.5");
command("region box sphere 1.0 1.0 1.0 1.1");
command("create_box 1 box");
command("create_atoms 1 region box");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->domain->triclinic, 0);
ASSERT_EQ(lmp->atom->natoms, 14);
}
TEST_F(LatticeRegionTest, region_union)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice fcc 2.5 origin 0.5 0.5 0.5");
lmp->input->one("region part1 sphere 2.0 1.0 1.0 1.1");
lmp->input->one("region part2 block 0.0 2.0 0.0 2.0 0.0 2.0");
lmp->input->one("region box union 2 part1 part2");
lmp->input->one("create_box 1 box");
lmp->input->one("create_atoms 1 region box");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice fcc 2.5 origin 0.5 0.5 0.5");
command("region part1 sphere 2.0 1.0 1.0 1.1");
command("region part2 block 0.0 2.0 0.0 2.0 0.0 2.0");
command("region box union 2 part1 part2");
command("create_box 1 box");
command("create_atoms 1 region box");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->domain->triclinic, 0);
ASSERT_EQ(lmp->atom->natoms, 67);
}
TEST_F(LatticeRegionTest, region_intersect)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice fcc 2.5 origin 0.5 0.5 0.5");
lmp->input->one("region part1 sphere 2.0 1.0 1.0 1.8");
lmp->input->one("region part2 block 0.0 2.0 0.0 2.0 0.0 2.0");
lmp->input->one("region box intersect 2 part1 part2");
lmp->input->one("create_box 1 box");
lmp->input->one("create_atoms 1 region box");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice fcc 2.5 origin 0.5 0.5 0.5");
command("region part1 sphere 2.0 1.0 1.0 1.8");
command("region part2 block 0.0 2.0 0.0 2.0 0.0 2.0");
command("region box intersect 2 part1 part2");
command("create_box 1 box");
command("create_atoms 1 region box");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->domain->triclinic, 0);
ASSERT_EQ(lmp->atom->natoms, 21);
}
TEST_F(LatticeRegionTest, region_plane)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("lattice fcc 2.5 origin 0.5 0.5 0.5");
lmp->input->one("region box block 0.0 2.0 0.0 2.0 0.0 2.0");
lmp->input->one("region part1 plane 0.5 1.0 0.0 0.75 0.0 0.0");
lmp->input->one("region part2 plane 1.5 1.0 0.0 0.75 0.0 0.0 side out");
lmp->input->one("region atoms intersect 2 part1 part2");
lmp->input->one("create_box 1 box");
lmp->input->one("create_atoms 1 region atoms");
lmp->input->one("write_dump all atom init.lammpstrj");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("lattice fcc 2.5 origin 0.5 0.5 0.5");
command("region box block 0.0 2.0 0.0 2.0 0.0 2.0");
command("region part1 plane 0.5 1.0 0.0 0.75 0.0 0.0");
command("region part2 plane 1.5 1.0 0.0 0.75 0.0 0.0 side out");
command("region atoms intersect 2 part1 part2");
command("create_box 1 box");
command("create_atoms 1 region atoms");
command("write_dump all atom init.lammpstrj");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->domain->triclinic, 0);
ASSERT_EQ(lmp->atom->natoms, 16);
}
@ -669,7 +632,7 @@ int main(int argc, char **argv)
MPI_Init(&argc, &argv);
::testing::InitGoogleMock(&argc, argv);
if (have_openmpi && !LAMMPS_NS::Info::has_exceptions())
if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions())
std::cout << "Warning: using OpenMPI without exceptions. "
"Death tests will be skipped\n";

View File

@ -21,6 +21,7 @@
#include "utils.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "../testing/core.h"
#include <cstdio>
#include <mpi.h>
@ -28,12 +29,6 @@
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
bool verbose = false;
#if defined(OMPI_MAJOR_VERSION)
const bool have_openmpi = true;
#else
const bool have_openmpi = false;
#endif
using LAMMPS_NS::utils::split_words;
namespace LAMMPS_NS {
@ -41,49 +36,22 @@ using ::testing::MatchesRegex;
#define GETIDX(i) lmp->atom->map(i)
#define TEST_FAILURE(errmsg, ...) \
if (Info::has_exceptions()) { \
::testing::internal::CaptureStdout(); \
ASSERT_ANY_THROW({__VA_ARGS__}); \
auto mesg = ::testing::internal::GetCapturedStdout(); \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} else { \
if (!have_openmpi) { \
::testing::internal::CaptureStdout(); \
ASSERT_DEATH({__VA_ARGS__}, ""); \
auto mesg = ::testing::internal::GetCapturedStdout(); \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} \
}
#define STRINGIFY(val) XSTR(val)
#define XSTR(val) #val
class ResetIDsTest : public ::testing::Test {
class ResetIDsTest : public LAMMPSTest {
protected:
LAMMPS *lmp;
void SetUp() override
{
const char *args[] = {"ResetIDsTest", "-log", "none", "-nocite", "-echo", "screen"};
char **argv = (char **)args;
int argc = sizeof(args) / sizeof(char *);
if (!verbose) ::testing::internal::CaptureStdout();
lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
Info *info = new Info(lmp);
testbinary = "ResetIDsTest";
LAMMPSTest::SetUp();
if (info->has_style("atom", "full")) {
lmp->input->one("variable input_dir index " STRINGIFY(TEST_INPUT_FOLDER));
lmp->input->one("include ${input_dir}/in.fourmol");
BEGIN_HIDE_OUTPUT();
command("variable input_dir index " STRINGIFY(TEST_INPUT_FOLDER));
command("include ${input_dir}/in.fourmol");
END_HIDE_OUTPUT();
}
delete info;
if (!verbose) ::testing::internal::GetCapturedStdout();
}
void TearDown() override
{
if (!verbose) ::testing::internal::CaptureStdout();
delete lmp;
if (!verbose) ::testing::internal::GetCapturedStdout();
}
};
@ -124,9 +92,9 @@ TEST_F(ResetIDsTest, MolIDAll)
// the original data file has two different molecule IDs
// for two residues of the same molecule/fragment.
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("reset_mol_ids all");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("reset_mol_ids all");
END_HIDE_OUTPUT();
ASSERT_EQ(molid[GETIDX(1)], 1);
ASSERT_EQ(molid[GETIDX(2)], 1);
@ -166,12 +134,12 @@ TEST_F(ResetIDsTest, DeletePlusAtomID)
auto molid = lmp->atom->molecule;
// delete two water molecules
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("group allwater molecule 3:6");
lmp->input->one("group twowater molecule 4:6:2");
lmp->input->one("delete_atoms group twowater compress no bond yes");
lmp->input->one("reset_mol_ids all");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("group allwater molecule 3:6");
command("group twowater molecule 4:6:2");
command("delete_atoms group twowater compress no bond yes");
command("reset_mol_ids all");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->atom->natoms, 23);
ASSERT_EQ(lmp->atom->map_tag_max, 26);
@ -228,9 +196,9 @@ TEST_F(ResetIDsTest, DeletePlusAtomID)
ASSERT_GE(GETIDX(25), 0);
ASSERT_GE(GETIDX(26), 0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("reset_atom_ids");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("reset_atom_ids");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->atom->map_tag_max, 23);
for (int i = 1; i <= 23; ++i)
@ -244,11 +212,11 @@ TEST_F(ResetIDsTest, PartialOffset)
auto molid = lmp->atom->molecule;
// delete two water molecules
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("group allwater molecule 3:6");
lmp->input->one("group nowater subtract all allwater");
lmp->input->one("reset_mol_ids allwater offset 4");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("group allwater molecule 3:6");
command("group nowater subtract all allwater");
command("reset_mol_ids allwater offset 4");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->atom->natoms, 29);
ASSERT_EQ(lmp->atom->map_tag_max, 29);
@ -282,9 +250,9 @@ TEST_F(ResetIDsTest, PartialOffset)
ASSERT_EQ(molid[GETIDX(28)], 8);
ASSERT_EQ(molid[GETIDX(29)], 8);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("reset_mol_ids nowater offset 0");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("reset_mol_ids nowater offset 0");
END_HIDE_OUTPUT();
ASSERT_EQ(molid[GETIDX(1)], 1);
ASSERT_EQ(molid[GETIDX(2)], 1);
@ -324,13 +292,13 @@ TEST_F(ResetIDsTest, DeleteAdd)
auto molid = lmp->atom->molecule;
// delete two water molecules
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("group allwater molecule 3:6");
lmp->input->one("group twowater molecule 4:6:2");
lmp->input->one("group nowater subtract all allwater");
lmp->input->one("delete_atoms group twowater compress no bond yes mol yes");
lmp->input->one("reset_mol_ids allwater");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("group allwater molecule 3:6");
command("group twowater molecule 4:6:2");
command("group nowater subtract all allwater");
command("delete_atoms group twowater compress no bond yes mol yes");
command("reset_mol_ids allwater");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->atom->natoms, 23);
ASSERT_EQ(lmp->atom->map_tag_max, 26);
@ -387,17 +355,17 @@ TEST_F(ResetIDsTest, DeleteAdd)
ASSERT_GE(GETIDX(25), 0);
ASSERT_GE(GETIDX(26), 0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("reset_atom_ids sort yes");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("reset_atom_ids sort yes");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->atom->map_tag_max, 23);
for (int i = 1; i <= 23; ++i)
ASSERT_GE(GETIDX(i), 0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("reset_mol_ids nowater offset 1");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("reset_mol_ids nowater offset 1");
END_HIDE_OUTPUT();
ASSERT_EQ(molid[GETIDX(1)], 2);
ASSERT_EQ(molid[GETIDX(2)], 2);
@ -423,13 +391,13 @@ TEST_F(ResetIDsTest, DeleteAdd)
ASSERT_EQ(molid[GETIDX(22)], 4);
ASSERT_EQ(molid[GETIDX(23)], 4);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("create_atoms 1 single 0.0 0.0 0.0");
lmp->input->one("create_atoms 2 single 1.0 0.0 0.0");
lmp->input->one("create_atoms 3 single 2.0 0.0 0.0");
lmp->input->one("create_atoms 4 single 3.0 0.0 0.0");
lmp->input->one("reset_mol_ids all single yes");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("create_atoms 1 single 0.0 0.0 0.0");
command("create_atoms 2 single 1.0 0.0 0.0");
command("create_atoms 3 single 2.0 0.0 0.0");
command("create_atoms 4 single 3.0 0.0 0.0");
command("reset_mol_ids all single yes");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->atom->natoms, 27);
ASSERT_EQ(lmp->atom->map_tag_max, 27);
@ -441,9 +409,9 @@ TEST_F(ResetIDsTest, DeleteAdd)
ASSERT_EQ(molid[GETIDX(26)], 6);
ASSERT_EQ(molid[GETIDX(27)], 7);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("reset_mol_ids all single no");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("reset_mol_ids all single no");
END_HIDE_OUTPUT();
ASSERT_EQ(molid[GETIDX(21)], 3);
ASSERT_EQ(molid[GETIDX(22)], 3);
@ -453,9 +421,9 @@ TEST_F(ResetIDsTest, DeleteAdd)
ASSERT_EQ(molid[GETIDX(26)], 0);
ASSERT_EQ(molid[GETIDX(27)], 0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("reset_mol_ids all compress no single yes");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("reset_mol_ids all compress no single yes");
END_HIDE_OUTPUT();
ASSERT_EQ(molid[GETIDX(21)], 21);
ASSERT_EQ(molid[GETIDX(22)], 21);
@ -471,21 +439,21 @@ TEST_F(ResetIDsTest, TopologyData)
if (lmp->atom->natoms == 0) GTEST_SKIP();
// delete two water molecules
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("group allwater molecule 3:6");
lmp->input->one("group twowater molecule 4:6:2");
lmp->input->one("group nowater subtract all allwater");
lmp->input->one("delete_atoms group twowater compress no bond yes mol yes");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("group allwater molecule 3:6");
command("group twowater molecule 4:6:2");
command("group nowater subtract all allwater");
command("delete_atoms group twowater compress no bond yes mol yes");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->atom->natoms, 23);
ASSERT_EQ(lmp->atom->map_tag_max, 26);
auto num_bond = lmp->atom->num_bond;
auto num_angle = lmp->atom->num_angle;
auto bond_atom = lmp->atom->bond_atom;
auto angle_atom1 = lmp->atom->angle_atom1;
auto angle_atom2 = lmp->atom->angle_atom2;
auto angle_atom3 = lmp->atom->angle_atom3;
auto num_bond = lmp->atom->num_bond;
auto num_angle = lmp->atom->num_angle;
auto bond_atom = lmp->atom->bond_atom;
auto angle_atom1 = lmp->atom->angle_atom1;
auto angle_atom2 = lmp->atom->angle_atom2;
auto angle_atom3 = lmp->atom->angle_atom3;
ASSERT_EQ(num_bond[GETIDX(1)], 2);
ASSERT_EQ(bond_atom[GETIDX(1)][0], 2);
ASSERT_EQ(bond_atom[GETIDX(1)][1], 3);
@ -560,16 +528,16 @@ TEST_F(ResetIDsTest, TopologyData)
ASSERT_EQ(angle_atom2[GETIDX(24)][0], 24);
ASSERT_EQ(angle_atom3[GETIDX(24)][0], 26);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("reset_atom_ids sort yes");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("reset_atom_ids sort yes");
END_HIDE_OUTPUT();
num_bond = lmp->atom->num_bond;
num_angle = lmp->atom->num_angle;
bond_atom = lmp->atom->bond_atom;
angle_atom1 = lmp->atom->angle_atom1;
angle_atom2 = lmp->atom->angle_atom2;
angle_atom3 = lmp->atom->angle_atom3;
num_bond = lmp->atom->num_bond;
num_angle = lmp->atom->num_angle;
bond_atom = lmp->atom->bond_atom;
angle_atom1 = lmp->atom->angle_atom1;
angle_atom2 = lmp->atom->angle_atom2;
angle_atom3 = lmp->atom->angle_atom3;
ASSERT_EQ(num_bond[GETIDX(1)], 2);
ASSERT_EQ(bond_atom[GETIDX(1)][0], 3);
ASSERT_EQ(bond_atom[GETIDX(1)][1], 2);
@ -658,61 +626,60 @@ TEST_F(ResetIDsTest, DeathTests)
{
if (lmp->atom->natoms == 0) GTEST_SKIP();
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", lmp->input->one("reset_mol_ids"););
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", command("reset_mol_ids"););
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*",
lmp->input->one("reset_mol_ids all offset 1 1"););
command("reset_mol_ids all offset 1 1"););
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*",
lmp->input->one("reset_mol_ids all offset -2"););
command("reset_mol_ids all offset -2"););
TEST_FAILURE(".*ERROR on proc 0: Expected integer.*", command("reset_mol_ids all offset xxx"););
TEST_FAILURE(".*ERROR on proc 0: Expected integer.*",
lmp->input->one("reset_mol_ids all offset xxx"););
TEST_FAILURE(".*ERROR on proc 0: Expected integer.*",
lmp->input->one("reset_mol_ids all compress yes single no offset xxx"););
command("reset_mol_ids all compress yes single no offset xxx"););
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", command("reset_mol_ids all offset"););
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*",
lmp->input->one("reset_mol_ids all offset"););
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*",
lmp->input->one("reset_mol_ids all compress"););
command("reset_mol_ids all compress"););
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*",
lmp->input->one("reset_mol_ids all compress xxx"););
command("reset_mol_ids all compress xxx"););
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*", command("reset_mol_ids all single"););
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*",
lmp->input->one("reset_mol_ids all single"););
TEST_FAILURE(".*ERROR: Illegal reset_mol_ids command.*",
lmp->input->one("reset_mol_ids all single xxx"););
command("reset_mol_ids all single xxx"););
}
TEST(ResetMolIds, CMDFail)
{
LAMMPS *lmp;
const char *args[] = {"ResetIDsTest", "-log", "none", "-nocite", "-echo", "screen"};
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();
TEST_FAILURE(".*ERROR: Reset_mol_ids command before simulation box is.*",
lmp->input->one("reset_mol_ids all"););
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("atom_modify id no");
lmp->input->one("region box block 0 1 0 1 0 1");
lmp->input->one("create_box 1 box");
if (!verbose) ::testing::internal::GetCapturedStdout();
TEST_FAILURE(".*ERROR: Cannot use reset_mol_ids unless.*",
lmp->input->one("reset_mol_ids all"););
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("region box block 0 1 0 1 0 1");
lmp->input->one("create_box 1 box");
if (!verbose) ::testing::internal::GetCapturedStdout();
TEST_FAILURE(".*ERROR: Can only use reset_mol_ids.*", lmp->input->one("reset_mol_ids all"););
if (!verbose) ::testing::internal::CaptureStdout();
delete lmp;
if (!verbose) ::testing::internal::GetCapturedStdout();
class ResetMolIDsTest : public LAMMPSTest {
protected:
void SetUp() override
{
testbinary = "ResetIDsTest";
LAMMPSTest::SetUp();
}
};
TEST_F(ResetMolIDsTest, FailBeforeBox)
{
TEST_FAILURE(".*ERROR: Reset_mol_ids command before simulation box is.*",
command("reset_mol_ids all"););
}
TEST_F(ResetMolIDsTest, FailMissingId)
{
BEGIN_HIDE_OUTPUT();
command("atom_modify id no");
command("region box block 0 1 0 1 0 1");
command("create_box 1 box");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Cannot use reset_mol_ids unless.*", command("reset_mol_ids all"););
}
TEST_F(ResetMolIDsTest, FailOnlyMolecular)
{
BEGIN_HIDE_OUTPUT();
command("clear");
command("region box block 0 1 0 1 0 1");
command("create_box 1 box");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Can only use reset_mol_ids.*", command("reset_mol_ids all"););
}
} // namespace LAMMPS_NS
int main(int argc, char **argv)
@ -720,7 +687,7 @@ int main(int argc, char **argv)
MPI_Init(&argc, &argv);
::testing::InitGoogleMock(&argc, argv);
if (have_openmpi && !LAMMPS_NS::Info::has_exceptions())
if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions())
std::cout << "Warning: using OpenMPI without exceptions. "
"Death tests will be skipped\n";

View File

@ -24,6 +24,7 @@
#include "fmt/format.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "../testing/core.h"
#include <cstdio>
#include <cstring>
@ -34,11 +35,6 @@
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
bool verbose = false;
#if defined(OMPI_MAJOR_VERSION)
const bool have_openmpi = true;
#else
const bool have_openmpi = false;
#endif
using LAMMPS_NS::utils::split_words;
@ -47,46 +43,12 @@ using ::testing::ExitedWithCode;
using ::testing::MatchesRegex;
using ::testing::StrEq;
#define TEST_FAILURE(errmsg, ...) \
if (Info::has_exceptions()) { \
::testing::internal::CaptureStdout(); \
ASSERT_ANY_THROW({__VA_ARGS__}); \
auto mesg = ::testing::internal::GetCapturedStdout(); \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} else { \
if (!have_openmpi) { \
::testing::internal::CaptureStdout(); \
ASSERT_DEATH({__VA_ARGS__}, ""); \
auto mesg = ::testing::internal::GetCapturedStdout(); \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} \
}
class SimpleCommandsTest : public ::testing::Test {
protected:
LAMMPS *lmp;
void SetUp() override
{
const char *args[] = {"SimpleCommandsTest", "-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();
}
void TearDown() override
{
if (!verbose) ::testing::internal::CaptureStdout();
delete lmp;
if (!verbose) ::testing::internal::GetCapturedStdout();
}
class SimpleCommandsTest : public LAMMPSTest {
};
TEST_F(SimpleCommandsTest, UnknownCommand)
{
TEST_FAILURE(".*ERROR: Unknown command.*", lmp->input->one("XXX one two"););
TEST_FAILURE(".*ERROR: Unknown command.*", command("XXX one two"););
}
TEST_F(SimpleCommandsTest, Echo)
@ -94,47 +56,47 @@ TEST_F(SimpleCommandsTest, Echo)
ASSERT_EQ(lmp->input->echo_screen, 1);
ASSERT_EQ(lmp->input->echo_log, 0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("echo none");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("echo none");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->input->echo_screen, 0);
ASSERT_EQ(lmp->input->echo_log, 0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("echo both");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("echo both");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->input->echo_screen, 1);
ASSERT_EQ(lmp->input->echo_log, 1);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("echo screen");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("echo screen");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->input->echo_screen, 1);
ASSERT_EQ(lmp->input->echo_log, 0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("echo log");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("echo log");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->input->echo_screen, 0);
ASSERT_EQ(lmp->input->echo_log, 1);
TEST_FAILURE(".*ERROR: Illegal echo command.*", lmp->input->one("echo"););
TEST_FAILURE(".*ERROR: Illegal echo command.*", lmp->input->one("echo xxx"););
TEST_FAILURE(".*ERROR: Illegal echo command.*", command("echo"););
TEST_FAILURE(".*ERROR: Illegal echo command.*", command("echo xxx"););
}
TEST_F(SimpleCommandsTest, Log)
{
ASSERT_EQ(lmp->logfile, nullptr);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("log simple_command_test.log");
lmp->input->one("print 'test1'");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("log simple_command_test.log");
command("print 'test1'");
END_HIDE_OUTPUT();
ASSERT_NE(lmp->logfile, nullptr);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("log none");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("log none");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->logfile, nullptr);
std::string text;
@ -144,14 +106,14 @@ TEST_F(SimpleCommandsTest, Log)
in.close();
ASSERT_THAT(text, StrEq("test1"));
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("log simple_command_test.log append");
lmp->input->one("print 'test2'");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("log simple_command_test.log append");
command("print 'test2'");
END_HIDE_OUTPUT();
ASSERT_NE(lmp->logfile, nullptr);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("log none");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("log none");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->logfile, nullptr);
in.open("simple_command_test.log");
@ -162,7 +124,7 @@ TEST_F(SimpleCommandsTest, Log)
in.close();
remove("simple_command_test.log");
TEST_FAILURE(".*ERROR: Illegal log command.*", lmp->input->one("log"););
TEST_FAILURE(".*ERROR: Illegal log command.*", command("log"););
}
TEST_F(SimpleCommandsTest, Newton)
@ -170,82 +132,79 @@ TEST_F(SimpleCommandsTest, Newton)
// default setting is "on" for both
ASSERT_EQ(lmp->force->newton_pair, 1);
ASSERT_EQ(lmp->force->newton_bond, 1);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("newton off");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("newton off");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->force->newton_pair, 0);
ASSERT_EQ(lmp->force->newton_bond, 0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("newton on off");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("newton on off");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->force->newton_pair, 1);
ASSERT_EQ(lmp->force->newton_bond, 0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("newton off on");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("newton off on");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->force->newton_pair, 0);
ASSERT_EQ(lmp->force->newton_bond, 1);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("newton on");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("newton on");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->force->newton_pair, 1);
ASSERT_EQ(lmp->force->newton_bond, 1);
}
TEST_F(SimpleCommandsTest, Partition)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("echo none");
if (!verbose) ::testing::internal::GetCapturedStdout();
TEST_FAILURE(".*ERROR: Illegal partition command .*",
lmp->input->one("partition xxx 1 echo none"););
BEGIN_HIDE_OUTPUT();
command("echo none");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Illegal partition command .*", command("partition xxx 1 echo none"););
TEST_FAILURE(".*ERROR: Numeric index 2 is out of bounds.*",
lmp->input->one("partition yes 2 echo none"););
command("partition yes 2 echo none"););
::testing::internal::CaptureStdout();
lmp->input->one("partition yes 1 print 'test'");
auto text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
BEGIN_CAPTURE_OUTPUT();
command("partition yes 1 print 'test'");
auto text = END_CAPTURE_OUTPUT();
ASSERT_THAT(text, StrEq("test\n"));
::testing::internal::CaptureStdout();
lmp->input->one("partition no 1 print 'test'");
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
BEGIN_CAPTURE_OUTPUT();
command("partition no 1 print 'test'");
text = END_CAPTURE_OUTPUT();
ASSERT_THAT(text, StrEq(""));
}
TEST_F(SimpleCommandsTest, Quit)
{
::testing::internal::CaptureStdout();
lmp->input->one("echo none");
::testing::internal::GetCapturedStdout();
TEST_FAILURE(".*ERROR: Expected integer .*", lmp->input->one("quit xxx"););
BEGIN_HIDE_OUTPUT();
command("echo none");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Expected integer .*", command("quit xxx"););
// the following tests must be skipped with OpenMPI due to using threads
if (have_openmpi) GTEST_SKIP();
ASSERT_EXIT(lmp->input->one("quit"), ExitedWithCode(0), "");
ASSERT_EXIT(lmp->input->one("quit 9"), ExitedWithCode(9), "");
if (Info::get_mpi_vendor() == "Open MPI") GTEST_SKIP();
ASSERT_EXIT(command("quit"), ExitedWithCode(0), "");
ASSERT_EXIT(command("quit 9"), ExitedWithCode(9), "");
}
TEST_F(SimpleCommandsTest, ResetTimestep)
{
ASSERT_EQ(lmp->update->ntimestep, 0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("reset_timestep 10");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("reset_timestep 10");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->update->ntimestep, 10);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("reset_timestep 0");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("reset_timestep 0");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->update->ntimestep, 0);
TEST_FAILURE(".*ERROR: Timestep must be >= 0.*", lmp->input->one("reset_timestep -10"););
TEST_FAILURE(".*ERROR: Illegal reset_timestep .*", lmp->input->one("reset_timestep"););
TEST_FAILURE(".*ERROR: Illegal reset_timestep .*", lmp->input->one("reset_timestep 10 10"););
TEST_FAILURE(".*ERROR: Expected integer .*", lmp->input->one("reset_timestep xxx"););
TEST_FAILURE(".*ERROR: Timestep must be >= 0.*", command("reset_timestep -10"););
TEST_FAILURE(".*ERROR: Illegal reset_timestep .*", command("reset_timestep"););
TEST_FAILURE(".*ERROR: Illegal reset_timestep .*", command("reset_timestep 10 10"););
TEST_FAILURE(".*ERROR: Expected integer .*", command("reset_timestep xxx"););
}
TEST_F(SimpleCommandsTest, Suffix)
@ -254,93 +213,92 @@ TEST_F(SimpleCommandsTest, Suffix)
ASSERT_EQ(lmp->suffix, nullptr);
ASSERT_EQ(lmp->suffix2, nullptr);
TEST_FAILURE(".*ERROR: May only enable suffixes after defining one.*",
lmp->input->one("suffix on"););
TEST_FAILURE(".*ERROR: May only enable suffixes after defining one.*", command("suffix on"););
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("suffix one");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("suffix one");
END_HIDE_OUTPUT();
ASSERT_THAT(lmp->suffix, StrEq("one"));
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("suffix hybrid two three");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("suffix hybrid two three");
END_HIDE_OUTPUT();
ASSERT_THAT(lmp->suffix, StrEq("two"));
ASSERT_THAT(lmp->suffix2, StrEq("three"));
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("suffix four");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("suffix four");
END_HIDE_OUTPUT();
ASSERT_THAT(lmp->suffix, StrEq("four"));
ASSERT_EQ(lmp->suffix2, nullptr);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("suffix off");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("suffix off");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->suffix_enable, 0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("suffix on");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("suffix on");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->suffix_enable, 1);
TEST_FAILURE(".*ERROR: Illegal suffix command.*", lmp->input->one("suffix"););
TEST_FAILURE(".*ERROR: Illegal suffix command.*", lmp->input->one("suffix hybrid"););
TEST_FAILURE(".*ERROR: Illegal suffix command.*", lmp->input->one("suffix hybrid one"););
TEST_FAILURE(".*ERROR: Illegal suffix command.*", command("suffix"););
TEST_FAILURE(".*ERROR: Illegal suffix command.*", command("suffix hybrid"););
TEST_FAILURE(".*ERROR: Illegal suffix command.*", command("suffix hybrid one"););
}
TEST_F(SimpleCommandsTest, Thermo)
{
ASSERT_EQ(lmp->output->thermo_every, 0);
ASSERT_EQ(lmp->output->var_thermo, nullptr);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("thermo 2");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("thermo 2");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->output->thermo_every, 2);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("variable step equal logfreq(10,3,10)");
lmp->input->one("thermo v_step");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("variable step equal logfreq(10,3,10)");
command("thermo v_step");
END_HIDE_OUTPUT();
ASSERT_THAT(lmp->output->var_thermo, StrEq("step"));
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("thermo 10");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("thermo 10");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->output->thermo_every, 10);
ASSERT_EQ(lmp->output->var_thermo, nullptr);
TEST_FAILURE(".*ERROR: Illegal thermo command.*", lmp->input->one("thermo"););
TEST_FAILURE(".*ERROR: Illegal thermo command.*", lmp->input->one("thermo -1"););
TEST_FAILURE(".*ERROR: Expected integer.*", lmp->input->one("thermo xxx"););
TEST_FAILURE(".*ERROR: Illegal thermo command.*", command("thermo"););
TEST_FAILURE(".*ERROR: Illegal thermo command.*", command("thermo -1"););
TEST_FAILURE(".*ERROR: Expected integer.*", command("thermo xxx"););
}
TEST_F(SimpleCommandsTest, TimeStep)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("timestep 1");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("timestep 1");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->update->dt, 1.0);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("timestep 0.1");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("timestep 0.1");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->update->dt, 0.1);
// zero timestep is legal and works (atoms don't move)
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("timestep 0.0");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("timestep 0.0");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->update->dt, 0.0);
// negative timestep also creates a viable MD.
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("timestep -0.1");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("timestep -0.1");
END_HIDE_OUTPUT();
ASSERT_EQ(lmp->update->dt, -0.1);
TEST_FAILURE(".*ERROR: Illegal timestep command.*", lmp->input->one("timestep"););
TEST_FAILURE(".*ERROR: Expected floating point.*", lmp->input->one("timestep xxx"););
TEST_FAILURE(".*ERROR: Illegal timestep command.*", command("timestep"););
TEST_FAILURE(".*ERROR: Expected floating point.*", command("timestep xxx"););
}
TEST_F(SimpleCommandsTest, Units)
@ -352,35 +310,108 @@ TEST_F(SimpleCommandsTest, Units)
ASSERT_THAT(lmp->update->unit_style, StrEq("lj"));
for (std::size_t i = 0; i < num; ++i) {
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one(fmt::format("units {}", names[i]));
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("units {}", names[i]));
END_HIDE_OUTPUT();
ASSERT_THAT(lmp->update->unit_style, StrEq(names[i]));
ASSERT_EQ(lmp->update->dt, dt[i]);
}
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
END_HIDE_OUTPUT();
ASSERT_THAT(lmp->update->unit_style, StrEq("lj"));
TEST_FAILURE(".*ERROR: Illegal units command.*", lmp->input->one("units unknown"););
TEST_FAILURE(".*ERROR: Illegal units command.*", command("units unknown"););
}
#if defined(LMP_PLUGIN)
TEST_F(SimpleCommandsTest, Plugin)
{
#if defined(__APPLE__)
std::string loadfmt("plugin load {}plugin.dylib");
#else
std::string loadfmt("plugin load {}plugin.so");
#endif
::testing::internal::CaptureStdout();
lmp->input->one(fmt::format(loadfmt, "hello"));
auto text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, MatchesRegex(".*Loading plugin: Hello world command.*"));
::testing::internal::CaptureStdout();
lmp->input->one(fmt::format(loadfmt, "xxx"));
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, MatchesRegex(".*Open of file xxx.* failed.*"));
::testing::internal::CaptureStdout();
lmp->input->one(fmt::format(loadfmt, "nve2"));
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, MatchesRegex(".*Loading plugin: NVE2 variant fix style.*"));
::testing::internal::CaptureStdout();
lmp->input->one("plugin list");
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, MatchesRegex(".*1: command style plugin hello"
".*2: fix style plugin nve2.*"));
::testing::internal::CaptureStdout();
lmp->input->one(fmt::format(loadfmt, "hello"));
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, MatchesRegex(".*Ignoring load of command style hello: "
"must unload existing hello plugin.*"));
::testing::internal::CaptureStdout();
lmp->input->one("plugin unload command hello");
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, MatchesRegex(".*Unloading command style hello.*"));
::testing::internal::CaptureStdout();
lmp->input->one("plugin unload pair nve2");
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, MatchesRegex(".*Ignoring unload of pair style nve2: "
"not loaded from a plugin.*"));
::testing::internal::CaptureStdout();
lmp->input->one("plugin unload fix nve2");
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, MatchesRegex(".*Unloading fix style nve2.*"));
::testing::internal::CaptureStdout();
lmp->input->one("plugin unload fix nve");
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, MatchesRegex(".*Ignoring unload of fix style nve: "
"not loaded from a plugin.*"));
::testing::internal::CaptureStdout();
lmp->input->one("plugin list");
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, MatchesRegex(".*Currently loaded plugins.*"));
}
#endif
TEST_F(SimpleCommandsTest, Shell)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("shell putenv TEST_VARIABLE=simpletest");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("shell putenv TEST_VARIABLE=simpletest");
END_HIDE_OUTPUT();
char *test_var = getenv("TEST_VARIABLE");
ASSERT_NE(test_var, nullptr);
ASSERT_THAT(test_var, StrEq("simpletest"));
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("shell putenv TEST_VARIABLE=simpletest");
lmp->input->one("shell putenv TEST_VARIABLE2=simpletest2 OTHER_VARIABLE=2");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("shell putenv TEST_VARIABLE=simpletest");
command("shell putenv TEST_VARIABLE2=simpletest2 OTHER_VARIABLE=2");
END_HIDE_OUTPUT();
char *test_var2 = getenv("TEST_VARIABLE2");
char *other_var = getenv("OTHER_VARIABLE");
@ -398,32 +429,30 @@ TEST_F(SimpleCommandsTest, CiteMe)
lmp->citeme = new LAMMPS_NS::CiteMe(lmp, CiteMe::TERSE, CiteMe::TERSE, nullptr);
::testing::internal::CaptureStdout();
BEGIN_CAPTURE_OUTPUT();
lmp->citeme->add("test citation one:\n 1\n");
lmp->citeme->add("test citation two:\n 2\n");
lmp->citeme->add("test citation one:\n 1\n");
lmp->citeme->flush();
std::string text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
std::string text = END_CAPTURE_OUTPUT();
// find the two unique citations, but not the third
ASSERT_THAT(text, MatchesRegex(".*one.*two.*"));
ASSERT_THAT(text, Not(MatchesRegex(".*one.*two.*one.*")));
::testing::internal::CaptureStdout();
BEGIN_CAPTURE_OUTPUT();
lmp->citeme->add("test citation one:\n 0\n");
lmp->citeme->add("test citation two:\n 2\n");
lmp->citeme->add("test citation three:\n 3\n");
lmp->citeme->flush();
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
text = END_CAPTURE_OUTPUT();
// find the forth (only differs in long citation) and sixth added citation
ASSERT_THAT(text, MatchesRegex(".*one.*three.*"));
ASSERT_THAT(text, Not(MatchesRegex(".*two.*")));
::testing::internal::CaptureStdout();
BEGIN_CAPTURE_OUTPUT();
lmp->citeme->add("test citation one:\n 1\n");
lmp->citeme->add("test citation two:\n 2\n");
lmp->citeme->add("test citation one:\n 0\n");
@ -431,8 +460,7 @@ TEST_F(SimpleCommandsTest, CiteMe)
lmp->citeme->add("test citation three:\n 3\n");
lmp->citeme->flush();
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
text = END_CAPTURE_OUTPUT();
// no new citation. no CITE-CITE-CITE- lines
ASSERT_THAT(text, Not(MatchesRegex(".*CITE-CITE-CITE-CITE.*")));
@ -444,7 +472,7 @@ int main(int argc, char **argv)
MPI_Init(&argc, &argv);
::testing::InitGoogleMock(&argc, argv);
if (have_openmpi && !LAMMPS_NS::Info::has_exceptions())
if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions())
std::cout << "Warning: using OpenMPI without exceptions. "
"Death tests will be skipped\n";

View File

@ -0,0 +1,528 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "lammps.h"
#include "atom.h"
#include "domain.h"
#include "group.h"
#include "info.h"
#include "input.h"
#include "math_const.h"
#include "region.h"
#include "variable.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "../testing/core.h"
#include <cstring>
#include <vector>
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
bool verbose = false;
using LAMMPS_NS::MathConst::MY_PI;
using LAMMPS_NS::utils::split_words;
namespace LAMMPS_NS {
using ::testing::ExitedWithCode;
using ::testing::MatchesRegex;
using ::testing::StrEq;
class VariableTest : public LAMMPSTest {
protected:
Group *group;
Domain *domain;
Variable *variable;
void SetUp() override
{
testbinary = "VariableTest";
args = {"-log", "none", "-echo", "screen", "-nocite", "-v", "num", "1"};
LAMMPSTest::SetUp();
group = lmp->group;
domain = lmp->domain;
variable = lmp->input->variable;
}
void TearDown() override
{
LAMMPSTest::TearDown();
unlink("test_variable.file");
unlink("test_variable.atomfile");
}
void atomic_system()
{
BEGIN_HIDE_OUTPUT();
command("units real");
command("lattice sc 1.0 origin 0.125 0.125 0.125");
command("region box block -2 2 -2 2 -2 2");
command("create_box 8 box");
command("create_atoms 1 box");
command("mass * 1.0");
command("region left block -2.0 -1.0 INF INF INF INF");
command("region right block 0.5 2.0 INF INF INF INF");
command("region top block INF INF -2.0 -1.0 INF INF");
command("set region left type 2");
command("set region right type 3");
END_HIDE_OUTPUT();
}
void molecular_system()
{
BEGIN_HIDE_OUTPUT();
command("fix props all property/atom mol rmass q");
END_HIDE_OUTPUT();
atomic_system();
BEGIN_HIDE_OUTPUT();
command("variable molid atom floor(id/4)+1");
command("variable charge atom 2.0*sin(PI/32*id)");
command("set atom * mol v_molid");
command("set atom * charge v_charge");
command("set type 1 mass 0.5");
command("set type 2*4 mass 2.0");
END_HIDE_OUTPUT();
}
void file_vars()
{
FILE *fp = fopen("test_variable.file", "w");
fputs("# test file for file style variable\n\n\none\n two \n\n"
"three # with comment\nfour ! with non-comment\n"
"# comments only\n five\n#END\n",
fp);
fclose(fp);
fp = fopen("test_variable.atomfile", "w");
fputs("# test file for atomfile style variable\n\n"
"4 # four lines\n4 0.5 #with comment\n"
"2 -0.5 \n3 1.5\n1 -1.5\n\n"
"2\n10 1.0 # test\n13 1.0\n\n######\n"
"4\n1 4.0 # test\n2 3.0\n3 2.0\n4 1.0\n#END\n",
fp);
fclose(fp);
}
};
TEST_F(VariableTest, CreateDelete)
{
file_vars();
ASSERT_EQ(variable->nvar, 1);
BEGIN_HIDE_OUTPUT();
command("variable one index 1 2 3 4");
command("variable two equal 1");
command("variable two equal 2");
command("variable three string four");
command("variable three string three");
command("variable four1 loop 4");
command("variable four2 loop 2 4");
command("variable five1 loop 100 pad");
command("variable five2 loop 10 200 pad");
command("variable six world one");
command("variable seven format two \"%5.2f\"");
command("variable eight getenv PWD");
command("variable eight getenv XXXXX");
command("variable nine file test_variable.file");
command("variable ten internal 1.0");
command("variable ten internal 10.0");
command("variable ten1 universe 1 2 3 4");
command("variable ten2 uloop 4");
command("variable ten3 uloop 4 pad");
command("variable dummy index 0");
command("variable file equal is_file(MYFILE)");
END_HIDE_OUTPUT();
ASSERT_EQ(variable->nvar, 18);
BEGIN_HIDE_OUTPUT();
command("variable dummy delete");
END_HIDE_OUTPUT();
ASSERT_EQ(variable->nvar, 17);
ASSERT_THAT(variable->retrieve("three"), StrEq("three"));
variable->set_string("three", "four");
ASSERT_THAT(variable->retrieve("three"), StrEq("four"));
ASSERT_THAT(variable->retrieve("four2"), StrEq("2"));
ASSERT_THAT(variable->retrieve("five1"), StrEq("001"));
ASSERT_THAT(variable->retrieve("seven"), StrEq(" 2.00"));
ASSERT_THAT(variable->retrieve("ten"), StrEq("1"));
ASSERT_THAT(variable->retrieve("eight"), StrEq(""));
variable->internal_set(variable->find("ten"), 2.5);
ASSERT_THAT(variable->retrieve("ten"), StrEq("2.5"));
ASSERT_THAT(variable->retrieve("file"), StrEq("0"));
FILE *fp = fopen("MYFILE","w");
fputs(" ",fp);
fclose(fp);
ASSERT_THAT(variable->retrieve("file"), StrEq("1"));
unlink("MYFILE");
ASSERT_THAT(variable->retrieve("file"), StrEq("0"));
ASSERT_EQ(variable->equalstyle(variable->find("one")), 0);
ASSERT_EQ(variable->equalstyle(variable->find("two")), 1);
ASSERT_EQ(variable->equalstyle(variable->find("ten")), 1);
ASSERT_EQ(variable->internalstyle(variable->find("two")), 0);
ASSERT_EQ(variable->internalstyle(variable->find("ten")), 1);
TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable"););
TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy index"););
TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy delete xxx"););
TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy loop -1"););
TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy loop 10 1"););
TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy xxxx"););
TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*",
command("variable two string xxx"););
TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*",
command("variable two getenv xxx"););
TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*",
command("variable one equal 2"););
TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*",
command("variable one internal 2"););
TEST_FAILURE(".*ERROR: Cannot use atomfile-style variable unless an atom map exists.*",
command("variable eleven atomfile test_variable.atomfile"););
TEST_FAILURE(".*ERROR on proc 0: Cannot open file variable file test_variable.xxx.*",
command("variable nine1 file test_variable.xxx"););
TEST_FAILURE(".*ERROR: World variable count doesn't match # of partitions.*",
command("variable ten10 world xxx xxx"););
TEST_FAILURE(".*ERROR: All universe/uloop variables must have same # of values.*",
command("variable ten4 uloop 2"););
TEST_FAILURE(".*ERROR: Incorrect conversion in format string.*",
command("variable ten11 format two \"%08f\""););
TEST_FAILURE(".*ERROR: Variable name 'ten@12' must have only alphanumeric characters or.*",
command("variable ten@12 index one two three"););
TEST_FAILURE(".*ERROR: Variable evaluation before simulation box is defined.*",
variable->compute_equal("c_thermo_press"););
TEST_FAILURE(".*ERROR: Invalid variable reference v_unknown in variable formula.*",
variable->compute_equal("v_unknown"););
}
TEST_F(VariableTest, AtomicSystem)
{
HIDE_OUTPUT([&] { command("atom_modify map array"); });
atomic_system();
file_vars();
BEGIN_HIDE_OUTPUT();
command("variable one index 1 2 3 4");
command("variable id atom type");
command("variable id atom id");
command("variable ten atomfile test_variable.atomfile");
command("compute press all pressure NULL pair");
command("compute rg all gyration");
command("compute vacf all vacf");
command("fix press all ave/time 1 1 1 c_press mode vector");
command("fix rg all ave/time 1 1 1 c_rg mode vector");
command("fix vacf all ave/time 1 1 1 c_vacf mode vector");
command("variable press vector f_press");
command("variable rg vector f_rg");
command("variable vacf vector f_vacf");
command("variable press vector f_press+0.0");
command("variable self vector v_self+f_press");
command("variable circle vector f_press+v_circle");
command("variable sum vector v_press+v_rg");
command("variable sum2 vector v_vacf+v_rg");
command("variable pmax equal max(v_press)");
command("variable psum equal sum(v_press)");
command("variable rgmax equal max(v_rg)");
command("variable rgsum equal sum(v_rg)");
command("variable loop equal v_loop+1");
command("run 0 post no");
END_HIDE_OUTPUT();
ASSERT_EQ(variable->atomstyle(variable->find("one")), 0);
ASSERT_EQ(variable->atomstyle(variable->find("id")), 1);
ASSERT_EQ(variable->atomstyle(variable->find("ten")), 1);
ASSERT_EQ(variable->vectorstyle(variable->find("one")), 0);
ASSERT_EQ(variable->vectorstyle(variable->find("press")), 1);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_pmax"), 0.0);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_psum"), 0.0);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_rgmax"), 1.25);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_rgsum"), 3.75);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_sum[1]"), 1.25);
TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*",
command("variable one atom x"););
TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*",
command("variable one vector f_press"););
TEST_FAILURE(".*ERROR on proc 0: Cannot open file variable file test_variable.xxx.*",
command("variable ten1 atomfile test_variable.xxx"););
TEST_FAILURE(".*ERROR: Variable loop: has a circular dependency.*",
variable->compute_equal("v_loop"););
TEST_FAILURE(".*Variable self: Vector-style variable in equal-style variable formula.*",
variable->compute_equal("v_self"););
TEST_FAILURE(".*ERROR: Variable sum2: Inconsistent lengths in vector-style variable.*",
variable->compute_equal("max(v_sum2)"););
}
TEST_F(VariableTest, Expressions)
{
atomic_system();
BEGIN_HIDE_OUTPUT();
command("variable one index 1");
command("variable two equal 2");
command("variable three equal v_one+v_two");
command("variable four equal PI");
command("variable five equal version");
command("variable six equal XXX");
command("variable seven equal -v_one");
command("variable eight equal v_three-0.5");
command("variable nine equal v_two*(v_one+v_three)");
command("variable ten equal (1.0/v_two)^2");
command("variable eleven equal v_three%2");
command("variable twelve equal 1==2");
command("variable ten3 equal 1!=v_two");
command("variable ten4 equal 1<2");
command("variable ten5 equal 2>1");
command("variable ten6 equal (1<=v_one)&&(v_ten>=0.2)");
command("variable ten7 equal !(1<v_two)");
command("variable ten8 equal 1|^0");
command("variable ten9 equal v_one-v_ten9");
command("variable ten10 internal 100.0");
command("variable ten11 equal (1!=1)+(2<1)+(2<=1)+(1>2)+(1>=2)+(1&&0)+(0||0)+(1|^1)+10^0");
command("variable ten12 equal yes+no+on+off+true+false");
command("variable err1 equal v_one/v_ten7");
command("variable err2 equal v_one%v_ten7");
command("variable err3 equal v_ten7^-v_one");
variable->set("dummy index 1 2");
END_HIDE_OUTPUT();
int ivar = variable->find("one");
ASSERT_FALSE(variable->equalstyle(ivar));
ivar = variable->find("two");
ASSERT_TRUE(variable->equalstyle(ivar));
ASSERT_DOUBLE_EQ(variable->compute_equal(ivar), 2.0);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_three"), 3.0);
ASSERT_FLOAT_EQ(variable->compute_equal("v_four"), MY_PI);
ASSERT_GE(variable->compute_equal("v_five"), 20210310);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_seven"), -1);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_eight"), 2.5);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_nine"), 8);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten"), 0.25);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_eleven"), 1);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_twelve"), 0);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten3"), 1);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten4"), 1);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten5"), 1);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten6"), 1);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten7"), 0);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten8"), 1);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten10"), 100);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten11"), 1);
ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten12"), 3);
TEST_FAILURE(".*ERROR: Variable six: Invalid thermo keyword 'XXX' in variable formula.*",
command("print \"${six}\""););
TEST_FAILURE(".*ERROR: Variable ten9: has a circular dependency.*",
command("print \"${ten9}\""););
TEST_FAILURE(".*ERROR on proc 0: Variable err1: Divide by 0 in variable formula.*",
command("print \"${err1}\""););
TEST_FAILURE(".*ERROR on proc 0: Variable err2: Modulo 0 in variable formula.*",
command("print \"${err2}\""););
TEST_FAILURE(".*ERROR on proc 0: Variable err3: Invalid power expression in variable formula.*",
command("print \"${err3}\""););
}
TEST_F(VariableTest, Functions)
{
atomic_system();
file_vars();
BEGIN_HIDE_OUTPUT();
command("variable seed index 643532");
command("variable one index 1");
command("variable two equal random(1,2,v_seed)");
command("variable three equal atan2(v_one,1)");
command("variable four equal atan2()");
command("variable five equal sqrt(v_one+v_one)");
command("variable six equal exp(ln(0.1))");
command("variable seven equal abs(log(1.0/100.0))");
command("variable eight equal 0.5*PI");
command("variable nine equal round(sin(v_eight)+cos(v_eight))");
command("variable ten equal floor(1.85)+ceil(1.85)");
command("variable ten1 equal tan(v_eight/2.0)");
command("variable ten2 equal asin(-1.0)+acos(0.0)");
command("variable ten3 equal floor(100*random(0.2,0.8,v_seed)+1)");
END_HIDE_OUTPUT();
ASSERT_GT(variable->compute_equal(variable->find("two")), 0.99);
ASSERT_LT(variable->compute_equal(variable->find("two")), 2.01);
ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("three")), 0.25 * MY_PI);
ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("five")), sqrt(2.0));
ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("six")), 0.1);
ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("seven")), 2);
ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("nine")), 1);
ASSERT_DOUBLE_EQ(variable->compute_equal(variable->find("ten")), 3);
ASSERT_FLOAT_EQ(variable->compute_equal(variable->find("ten1")), 1);
ASSERT_GT(variable->compute_equal(variable->find("ten3")), 19);
ASSERT_LT(variable->compute_equal(variable->find("ten3")), 81);
TEST_FAILURE(".*ERROR: Variable four: Invalid syntax in variable formula.*",
command("print \"${four}\""););
}
TEST_F(VariableTest, IfCommand)
{
BEGIN_HIDE_OUTPUT();
command("variable one index 1");
END_HIDE_OUTPUT();
BEGIN_CAPTURE_OUTPUT();
command("if 1>0 then 'print \"bingo!\"'");
auto text = END_CAPTURE_OUTPUT();
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
BEGIN_CAPTURE_OUTPUT();
command("if 1>2 then 'print \"bingo!\"' else 'print \"nope?\"'");
text = END_CAPTURE_OUTPUT();
ASSERT_THAT(text, MatchesRegex(".*nope\?.*"));
BEGIN_CAPTURE_OUTPUT();
command("if (1<=0) then 'print \"bingo!\"' else 'print \"nope?\"'");
text = END_CAPTURE_OUTPUT();
ASSERT_THAT(text, MatchesRegex(".*nope\?.*"));
BEGIN_CAPTURE_OUTPUT();
command("if (-1.0e-1<0.0E+0)|^(1<0) then 'print \"bingo!\"'");
text = END_CAPTURE_OUTPUT();
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
BEGIN_CAPTURE_OUTPUT();
command("if (${one}==1.0)&&(2>=1) then 'print \"bingo!\"'");
text = END_CAPTURE_OUTPUT();
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
BEGIN_CAPTURE_OUTPUT();
command("if !((${one}!=1.0)||(2|^1)) then 'print \"missed\"' else 'print \"bingo!\"'");
text = END_CAPTURE_OUTPUT();
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
BEGIN_CAPTURE_OUTPUT();
command("if (1>=2)&&(0&&1) then 'print \"missed\"' else 'print \"bingo!\"'");
text = END_CAPTURE_OUTPUT();
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
BEGIN_CAPTURE_OUTPUT();
command("if !1 then 'print \"missed\"' else 'print \"bingo!\"'");
text = END_CAPTURE_OUTPUT();
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
BEGIN_CAPTURE_OUTPUT();
command("if !(a==b) then 'print \"bingo!\"'");
text = END_CAPTURE_OUTPUT();
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
BEGIN_CAPTURE_OUTPUT();
command("if x==x|^1==0 then 'print \"bingo!\"'");
text = END_CAPTURE_OUTPUT();
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
BEGIN_CAPTURE_OUTPUT();
command("if x!=x|^a!=b then 'print \"bingo!\"'");
text = END_CAPTURE_OUTPUT();
ASSERT_THAT(text, MatchesRegex(".*bingo!.*"));
TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*",
command("if () then 'print \"bingo!\"'"););
TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*",
command("if \"1 1\" then 'print \"bingo!\"'"););
TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*",
command("if 1a then 'print \"bingo!\"'"););
TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*",
command("if 1=<2 then 'print \"bingo!\"'"););
TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*",
command("if 1!=a then 'print \"bingo!\"'"););
TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*",
command("if 1&<2 then 'print \"bingo!\"'"););
TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*",
command("if 1|<2 then 'print \"bingo!\"'"););
TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*",
command("if (1)( then 'print \"bingo!\"'"););
TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*",
command("if (1)1 then 'print \"bingo!\"'"););
TEST_FAILURE(".*ERROR: Invalid Boolean syntax in if command.*",
command("if (v_one==1.0)&&(2>=1) then 'print \"bingo!\"'"););
}
TEST_F(VariableTest, NextCommand)
{
file_vars();
BEGIN_HIDE_OUTPUT();
command("variable one index 1 2");
command("variable two equal 2");
command("variable three file test_variable.file");
command("variable four loop 2 4");
command("variable five index 1 2");
END_HIDE_OUTPUT();
ASSERT_DOUBLE_EQ(variable->compute_equal("v_one"), 1);
ASSERT_THAT(variable->retrieve("three"), StrEq("one"));
BEGIN_HIDE_OUTPUT();
command("next one");
command("next three");
END_HIDE_OUTPUT();
ASSERT_DOUBLE_EQ(variable->compute_equal("v_one"), 2);
ASSERT_THAT(variable->retrieve("three"), StrEq("two"));
ASSERT_GE(variable->find("one"), 0);
BEGIN_HIDE_OUTPUT();
command("next one");
command("next three");
END_HIDE_OUTPUT();
// index style variable is deleted if no more next element
ASSERT_EQ(variable->find("one"), -1);
ASSERT_GE(variable->find("three"), 0);
BEGIN_HIDE_OUTPUT();
command("next three");
command("next three");
command("next three");
END_HIDE_OUTPUT();
// file style variable is deleted if no more next element
ASSERT_EQ(variable->find("three"), -1);
TEST_FAILURE(".*ERROR: Illegal next command.*", command("next"););
TEST_FAILURE(".*ERROR: Invalid variable 'xxx' in next command.*", command("next xxx"););
TEST_FAILURE(".*ERROR: Invalid variable style with next command.*", command("next two"););
TEST_FAILURE(".*ERROR: All variables in next command must have same style.*",
command("next five four"););
}
} // namespace LAMMPS_NS
int main(int argc, char **argv)
{
MPI_Init(&argc, &argv);
::testing::InitGoogleMock(&argc, argv);
if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions())
std::cout << "Warning: using OpenMPI without exceptions. "
"Death tests will be skipped\n";
// handle arguments passed via environment variable
if (const char *var = getenv("TEST_ARGS")) {
std::vector<std::string> env = split_words(var);
for (auto arg : env) {
if (arg == "-v") {
verbose = true;
}
}
}
if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true;
int rv = RUN_ALL_TESTS();
MPI_Finalize();
return rv;
}

View File

@ -307,7 +307,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
// init_forces
block.clear();
auto f = lmp->atom->f;
auto f = lmp->atom->f;
for (int i = 1; i <= natoms; ++i) {
const int j = lmp->atom->map(i);
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);
@ -327,7 +327,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
writer.emit_block("run_stress", block);
block.clear();
f = lmp->atom->f;
f = lmp->atom->f;
for (int i = 1; i <= natoms; ++i) {
const int j = lmp->atom->map(i);
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);

View File

@ -307,7 +307,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
// init_forces
block.clear();
auto f = lmp->atom->f;
auto f = lmp->atom->f;
for (int i = 1; i <= natoms; ++i) {
const int j = lmp->atom->map(i);
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);
@ -327,7 +327,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
writer.emit_block("run_stress", block);
block.clear();
f = lmp->atom->f;
f = lmp->atom->f;
for (int i = 1; i <= natoms; ++i) {
const int j = lmp->atom->map(i);
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);

View File

@ -53,17 +53,17 @@ TestConfigReader::TestConfigReader(TestConfig &config) : YamlReader(), config(co
consumers["global_scalar"] = &TestConfigReader::global_scalar;
consumers["global_vector"] = &TestConfigReader::global_vector;
consumers["bond_style"] = &TestConfigReader::bond_style;
consumers["bond_coeff"] = &TestConfigReader::bond_coeff;
consumers["angle_style"] = &TestConfigReader::angle_style;
consumers["angle_coeff"] = &TestConfigReader::angle_coeff;
consumers["bond_style"] = &TestConfigReader::bond_style;
consumers["bond_coeff"] = &TestConfigReader::bond_coeff;
consumers["angle_style"] = &TestConfigReader::angle_style;
consumers["angle_coeff"] = &TestConfigReader::angle_coeff;
consumers["dihedral_style"] = &TestConfigReader::dihedral_style;
consumers["dihedral_coeff"] = &TestConfigReader::dihedral_coeff;
consumers["improper_style"] = &TestConfigReader::improper_style;
consumers["improper_coeff"] = &TestConfigReader::improper_coeff;
consumers["init_energy"] = &TestConfigReader::init_energy;
consumers["run_energy"] = &TestConfigReader::run_energy;
consumers["equilibrium"] = &TestConfigReader::equilibrium;
consumers["init_energy"] = &TestConfigReader::init_energy;
consumers["run_energy"] = &TestConfigReader::run_energy;
consumers["equilibrium"] = &TestConfigReader::equilibrium;
}
void TestConfigReader::prerequisites(const yaml_event_t &event)

View File

@ -310,7 +310,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
// init_forces
block.clear();
auto f = lmp->atom->f;
auto f = lmp->atom->f;
for (int i = 1; i <= natoms; ++i) {
const int j = lmp->atom->map(i);
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);
@ -330,7 +330,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
writer.emit_block("run_stress", block);
block.clear();
f = lmp->atom->f;
f = lmp->atom->f;
for (int i = 1; i <= natoms; ++i) {
const int j = lmp->atom->map(i);
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);

View File

@ -301,7 +301,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
// init_forces
block.clear();
auto f = lmp->atom->f;
auto f = lmp->atom->f;
for (int i = 1; i <= natoms; ++i) {
const int j = lmp->atom->map(i);
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);
@ -321,7 +321,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
writer.emit_block("run_stress", block);
block.clear();
f = lmp->atom->f;
f = lmp->atom->f;
for (int i = 1; i <= natoms; ++i) {
const int j = lmp->atom->map(i);
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);

View File

@ -307,7 +307,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
// init_forces
block.clear();
auto f = lmp->atom->f;
auto f = lmp->atom->f;
for (int i = 1; i <= natoms; ++i) {
const int j = lmp->atom->map(i);
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);
@ -330,7 +330,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
writer.emit_block("run_stress", block);
block.clear();
f = lmp->atom->f;
f = lmp->atom->f;
for (int i = 1; i <= natoms; ++i) {
const int j = lmp->atom->map(i);
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);
@ -829,9 +829,8 @@ TEST(PairStyle, intel)
GTEST_SKIP();
}
if ((test_config.pair_style == "rebo")
|| utils::strmatch(test_config.pair_style, "^dpd")
|| utils::strmatch(test_config.pair_style, "^tersoff.* shift ")) {
if ((test_config.pair_style == "rebo") || utils::strmatch(test_config.pair_style, "^dpd") ||
utils::strmatch(test_config.pair_style, "^tersoff.* shift ")) {
std::cerr << "Skipping pair style " << lmp->force->pair_style << "\n";
if (!verbose) ::testing::internal::CaptureStdout();
cleanup_lammps(lmp, test_config);

View File

@ -0,0 +1,86 @@
---
lammps_version: 10 Mar 2021
date_generated: Tue Mar 23 08:05:02 202
epsilon: 1e-14
prerequisites: ! |
atom full
dihedral table/cut
pre_commands: ! ""
post_commands: ! ""
input_file: in.fourmol
dihedral_style: table/cut linear 3600
dihedral_coeff: ! |
1 aat 1.00 170 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_1
2 aat 1.00 170 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_2
3 aat 0.50 175 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_3
4 aat 1.00 170 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_4
5 aat 0.25 170 175 ${input_dir}/harmonic_dihedral.txt HARMONIC_5
extract: ! ""
natoms: 29
init_energy: 552.225725624496
init_stress: ! |-
-7.4008882268909986e+01 1.3648518393804071e+02 -6.2476301669130748e+01 3.4620215707793108e+01 1.3017899329318067e+02 1.9706621502063012e+02
init_forces: ! |2
1 -8.1198888996808620e+01 7.1073378215839497e+01 -1.1918247546822441e+02
2 3.8575810899979956e+01 -1.9920126773772417e+01 1.8847596663648414e+01
3 1.0913741754895571e+02 -7.1292512160682776e+01 7.5572753355603993e+01
4 -4.7848742793736733e+01 -7.5245295675494663e+00 6.4464643610526949e+01
5 -1.5539692023725792e+01 5.7172364237479494e+00 -1.3226941634858840e+00
6 -1.1355716924924745e+02 -8.6143836335725510e+01 -5.7299648623432482e+00
7 4.1372375526613887e+01 4.5139121695653614e+01 -7.4310043691848229e+00
8 2.1399043677828325e+02 1.8625470581545247e+02 -3.3675100353189755e+00
9 5.2653582674682809e+01 5.6583201775589529e+01 -2.5669664860295835e+01
10 -4.7984520275438535e+02 -5.1382692638722949e+02 -1.3749287390453020e+02
11 1.6539670687119863e+02 1.4091972117987351e+02 -1.2657881071783035e+02
12 3.4200742496423310e+01 1.2794076077133660e+02 2.3610219433759886e+02
13 1.8270592580559917e+00 4.1997746033241778e+00 8.8146411631557697e+00
14 1.8694466162959706e+01 -2.6013807510038696e+01 -9.2498849040619788e+00
15 -6.2869548680867373e+00 2.1284514172388507e+00 -6.4318098210331209e+00
16 -1.0694908795819050e+02 -5.9251517113768401e+01 1.0405679351593225e+01
17 1.7537714042702788e+02 1.4401690395071051e+02 2.8249184624181581e+01
18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
run_energy: 549.782031215547
run_stress: ! |-
-7.5056949042919044e+01 1.3698944188847955e+02 -6.1932492845560127e+01 3.3581673544215263e+01 1.2888596290133776e+02 1.9565093507759894e+02
run_forces: ! |2
1 -8.1850261118769851e+01 7.1565857666082792e+01 -1.1998194154132169e+02
2 3.8942730288029111e+01 -2.0139091742218607e+01 1.9096837462073495e+01
3 1.0933304895917627e+02 -7.1974713700542679e+01 7.7222647280784500e+01
4 -4.7578796179763913e+01 -7.4260553823873163e+00 6.4056709071407184e+01
5 -1.5573770424692153e+01 5.7360778752676689e+00 -1.3292716784107659e+00
6 -1.1205401245818740e+02 -8.3930835846975214e+01 -6.4629873083122060e+00
7 4.1368235883807785e+01 4.5098977123947911e+01 -7.4207495093494247e+00
8 2.1112963982593271e+02 1.8319846795829790e+02 -4.5077247269703236e+00
9 5.2596180125216748e+01 5.6303309547815658e+01 -2.5556604563933746e+01
10 -4.8079664429997507e+02 -5.1197713825609452e+02 -1.3418905325289452e+02
11 1.6804796981040414e+02 1.4157399298542791e+02 -1.2667138198231208e+02
12 3.3945852325507303e+01 1.2661718822016165e+02 2.3437614824953252e+02
13 1.8225699822433148e+00 4.1983174055270061e+00 8.8273571873798709e+00
14 1.8256498023781354e+01 -2.5354302062650923e+01 -8.9739201991677255e+00
15 -6.2761226111239754e+00 2.1261045368019413e+00 -6.4368032911012207e+00
16 -1.0841619930894663e+02 -6.1089982213467948e+01 9.6877249595793860e+00
17 1.7710308117736014e+02 1.4547382588500676e+02 2.8263013843016775e+01
18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
...

View File

@ -0,0 +1,86 @@
---
lammps_version: 10 Mar 2021
date_generated: Tue Mar 23 08:06:45 202
epsilon: 1e-14
prerequisites: ! |
atom full
dihedral table/cut
pre_commands: ! ""
post_commands: ! ""
input_file: in.fourmol
dihedral_style: table/cut spline 3600
dihedral_coeff: ! |
1 aat 1.00 170 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_1
2 aat 1.00 170 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_2
3 aat 0.50 175 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_3
4 aat 1.00 170 180 ${input_dir}/harmonic_dihedral.txt HARMONIC_4
5 aat 0.25 170 175 ${input_dir}/harmonic_dihedral.txt HARMONIC_5
extract: ! ""
natoms: 29
init_energy: 552.218725263499
init_stress: ! |-
-7.4019824552159534e+01 1.3649499111894895e+02 -6.2475166566789284e+01 3.4617375151088808e+01 1.3019745657214429e+02 1.9709007795400348e+02
init_forces: ! |2
1 -8.1213286444115909e+01 7.1080525227994045e+01 -1.1918872501604099e+02
2 3.8585732128399350e+01 -1.9925249987601369e+01 1.8852444035804549e+01
3 1.0914957240045973e+02 -7.1293677289031876e+01 7.5564572526931997e+01
4 -4.7856039321211888e+01 -7.5256880640368262e+00 6.4474469548287303e+01
5 -1.5540068306011690e+01 5.7173997377718440e+00 -1.3227187051350375e+00
6 -1.1356202282295826e+02 -8.6148464023143134e+01 -5.7287967059654719e+00
7 4.1373182001548223e+01 4.5140001882310173e+01 -7.4311492797065428e+00
8 2.1400860040790070e+02 1.8627156816363441e+02 -3.3695416437372394e+00
9 5.2656207239745335e+01 5.6586006420025306e+01 -2.5670940543260770e+01
10 -4.7989294342864497e+02 -5.1388484267202580e+02 -1.3749831844924219e+02
11 1.6541995228367492e+02 1.4093778373411678e+02 -1.2659553837843652e+02
12 3.4200230035629019e+01 1.2795430859179336e+02 2.3612094879489862e+02
13 1.8271828366360419e+00 4.2000586675545639e+00 8.8152373675940172e+00
14 1.8695088969660507e+01 -2.6014674160815950e+01 -9.2501930642549315e+00
15 -6.2873518284233292e+00 2.1285858083405422e+00 -6.4322159275576647e+00
16 -1.0696654386912348e+02 -5.9261377200437906e+01 1.0407194734343612e+01
17 1.7540250771683571e+02 1.4403773516355190e+02 2.8253270705477313e+01
18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
run_energy: 549.770211120194
run_stress: ! |-
-7.5054671721636595e+01 1.3699895801893166e+02 -6.1944286297295179e+01 3.3587137063275613e+01 1.2891678447538322e+02 1.9568224888755336e+02
run_forces: ! |2
1 -8.1862157367941563e+01 7.1571534225465314e+01 -1.1998648925690665e+02
2 3.8950856557592253e+01 -2.0143295233943885e+01 1.9100831488650599e+01
3 1.0934424273562679e+02 -7.1974764063434151e+01 7.7213177208305225e+01
4 -4.7585717040630072e+01 -7.4272048534134285e+00 6.4066017644735453e+01
5 -1.5574231365780285e+01 5.7363230482123928e+00 -1.3292888747698781e+00
6 -1.1207625383797915e+02 -8.3953260935523502e+01 -6.4560404254467478e+00
7 4.1369305653963607e+01 4.5100137884474947e+01 -7.4209393875477607e+00
8 2.1117769556228862e+02 1.8324468258252551e+02 -4.5178766251241402e+00
9 5.2599757474211380e+01 5.6307064747883963e+01 -2.5558323416528047e+01
10 -4.8085705384233728e+02 -5.1205238742034794e+02 -1.3420522978505346e+02
11 1.6806394787511115e+02 1.4159239612328381e+02 -1.2668631632096621e+02
12 3.3951439786882119e+01 1.2663190154365350e+02 2.3440594816333368e+02
13 1.8227069769227078e+00 4.1986314416593373e+00 8.8280212719479678e+00
14 1.8256647570003278e+01 -2.5354504765353397e+01 -8.9739916559242712e+00
15 -6.2764595167862440e+00 2.1262187967343880e+00 -6.4371500960467092e+00
16 -1.0842617323615015e+02 -6.1092389588080550e+01 9.6917320121684938e+00
17 1.7712144601500279e+02 1.4548891646620359e+02 2.8265918055172548e+01
18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
...

View File

@ -0,0 +1,86 @@
---
lammps_version: 10 Mar 2021
date_generated: Mon Mar 22 21:19:05 202
epsilon: 1e-14
prerequisites: ! |
atom full
dihedral table
pre_commands: ! ""
post_commands: ! ""
input_file: in.fourmol
dihedral_style: table linear 3600
dihedral_coeff: ! |
1 ${input_dir}/harmonic_dihedral.txt HARMONIC_1
2 ${input_dir}/harmonic_dihedral.txt HARMONIC_2
3 ${input_dir}/harmonic_dihedral.txt HARMONIC_3
4 ${input_dir}/harmonic_dihedral.txt HARMONIC_4
5 ${input_dir}/harmonic_dihedral.txt HARMONIC_5
extract: ! ""
natoms: 29
init_energy: 789.184256783584
init_stress: ! |-
-1.6165501104216639e+02 -7.4114380315441565e+01 2.3576939135760787e+02 -2.3488521541598647e+02 3.4341737187983938e+02 -1.5959461001900144e+02
init_forces: ! |2
1 -2.1498835469576278e+01 4.0242705861631180e+01 -9.0007821437717382e+01
2 -8.2018888113291979e+00 4.2353656629457461e+00 -4.0073270940910781e+00
3 9.1203773212580060e+01 -1.3765900530865244e+02 8.1977349479812418e+01
4 -4.8195100042546727e+01 -8.0451084249021534e+00 6.4747111681716376e+01
5 -6.2251242080533295e+01 2.2803637398534534e+01 -5.3285420895267421e+00
6 9.1265646559106216e+01 1.3743040689865262e+02 -3.9343488033831335e+01
7 -4.7432736093120091e+01 -5.1202947877496094e+01 8.4096202947719512e+00
8 2.2566883016909227e+02 1.6219571012359663e+02 5.7664673263129927e+01
9 -2.0799357954651114e+00 5.0308583175017674e+00 -7.5442843674616533e-01
10 -4.0472227269030174e+02 -4.7265020465440665e+02 -9.9994880868353093e+01
11 3.9893735247972799e+01 2.0808487532188158e+02 -1.3663466833430391e+02
12 6.2491147091194719e+01 7.0245646325825419e+01 1.9568453298435855e+02
13 2.9232948128895806e+01 6.7196393653186874e+01 1.4103425861049234e+02
14 7.2097046578806413e+01 -1.0032480603588586e+02 -3.5673090473056490e+01
15 -1.0059127788938771e+02 3.4055222675821568e+01 -1.0290895713652986e+02
16 -9.2256978542416007e+01 -1.2565565388894508e+02 -6.3113527034307076e+01
17 1.7537714042702783e+02 1.4401690395071046e+02 2.8249184624181567e+01
18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
run_energy: 786.199103735512
run_stress: ! |-
-1.5979555001643004e+02 -7.4781079673606996e+01 2.3457662969003690e+02 -2.3349637150864024e+02 3.4159374485946643e+02 -1.5956254217954015e+02
run_forces: ! |2
1 -2.2291107377203105e+01 4.0666970718627333e+01 -9.0497211256380396e+01
2 -7.6875363073287559e+00 3.9737486142840055e+00 -3.7620801734312614e+00
3 9.2103819928191996e+01 -1.3743335232167533e+02 8.2431881459386020e+01
4 -4.8290666517219691e+01 -8.1170776132331781e+00 6.4779991104261541e+01
5 -6.2246983418905813e+01 2.2813785810311227e+01 -5.3751809499241965e+00
6 9.1087481738151070e+01 1.3760819705271160e+02 -3.9500650484032505e+01
7 -4.6891554381909977e+01 -5.0621074446115216e+01 8.3775716071879351e+00
8 2.2268693398316259e+02 1.5891760123847899e+02 5.7199245600838793e+01
9 -1.3435027007714808e+00 5.5949363550589339e+00 -1.0517595721340651e+00
10 -4.0565110153193677e+02 -4.7084401363160805e+02 -9.7618847422734831e+01
11 4.2251495153612957e+01 2.0872309038043886e+02 -1.3675117078222070e+02
12 6.2352820175292266e+01 6.8729440749361473e+01 1.9366789701210121e+02
13 2.9032540154457664e+01 6.7387205615336427e+01 1.4127076790322786e+02
14 7.1580926568596425e+01 -9.9385928393915108e+01 -3.5110636800452511e+01
15 -1.0011174024358218e+02 3.3796455380232061e+01 -1.0280446675457922e+02
16 -9.3357186802666320e+01 -1.2692958041908989e+02 -6.3465822450651899e+01
17 1.7677536158005910e+02 1.4511959491079591e+02 2.8210471959538260e+01
18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
...

View File

@ -0,0 +1,86 @@
---
lammps_version: 10 Mar 2021
date_generated: Mon Mar 22 21:19:05 202
epsilon: 1e-14
prerequisites: ! |
atom full
dihedral table
pre_commands: ! ""
post_commands: ! ""
input_file: in.fourmol
dihedral_style: table spline 3600
dihedral_coeff: ! |
1 ${input_dir}/harmonic_dihedral.txt HARMONIC_1
2 ${input_dir}/harmonic_dihedral.txt HARMONIC_2
3 ${input_dir}/harmonic_dihedral.txt HARMONIC_3
4 ${input_dir}/harmonic_dihedral.txt HARMONIC_4
5 ${input_dir}/harmonic_dihedral.txt HARMONIC_5
extract: ! ""
natoms: 29
init_energy: 789.17395865366
init_stress: ! |-
-1.6167160198618581e+02 -7.4120077515581954e+01 2.3579167950176785e+02 -2.3490764576822448e+02 3.4342184840668585e+02 -1.5962456212434762e+02
init_forces: ! |2
1 -2.1511698354927645e+01 4.0249060385771472e+01 -9.0013321064696271e+01
2 -8.1931699818042816e+00 4.2308633547530370e+00 -4.0030671970615401e+00
3 9.1213724085941266e+01 -1.3766351443388791e+02 8.1969246814730084e+01
4 -4.8202572709944334e+01 -8.0465316616826055e+00 6.4757081268568328e+01
5 -6.2252471687916213e+01 2.2804485237535822e+01 -5.3285277358374286e+00
6 9.1271091175285207e+01 1.3743691094855717e+02 -3.9344000146381845e+01
7 -4.7435622491834799e+01 -5.1206081227011012e+01 8.4101355534202042e+00
8 2.2568717307036252e+02 1.6221073791401761e+02 5.7667169771245945e+01
9 -2.0794865262354030e+00 5.0314964866185363e+00 -7.5468527912272698e-01
10 -4.0476567716026062e+02 -4.7270660864081441e+02 -9.9999223852109083e+01
11 3.9909170153607846e+01 2.0810704891869841e+02 -1.3665197982219311e+02
12 6.2493704712199360e+01 7.0253447706808217e+01 1.9569964315907762e+02
13 2.9234925386176613e+01 6.7200938680873065e+01 1.4104379788150430e+02
14 7.2099736473223771e+01 -1.0032854908984555e+02 -3.5674421413108355e+01
15 -1.0059762925477315e+02 3.4057372933448626e+01 -1.0291545484092256e+02
16 -9.2273704605935819e+01 -1.2566881267739232e+02 -6.3115663802590909e+01
17 1.7540250771683569e+02 1.4403773516355182e+02 2.8253270705477295e+01
18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
run_energy: 786.186636054773
run_stress: ! |-
-1.5982910389343505e+02 -7.4774149450379937e+01 2.3460325334381506e+02 -2.3353349487854388e+02 3.4161194489304893e+02 -1.5958869300328692e+02
run_forces: ! |2
1 -2.2302877568136338e+01 4.0672550148970281e+01 -9.0501596555606994e+01
2 -7.6795596366469354e+00 3.9696255711631245e+00 -3.7581781934774909e+00
3 9.2113037896352481e+01 -1.3743858578373496e+02 8.2424527928857074e+01
4 -4.8297128431903225e+01 -8.1171172458509702e+00 6.4789088257516795e+01
5 -6.2249945655197145e+01 2.2813353706915890e+01 -5.3758960971523750e+00
6 9.1082266941280153e+01 1.3760435384789912e+02 -3.9497610389853719e+01
7 -4.6896901941201634e+01 -5.0626903993409201e+01 8.3785409954385486e+00
8 2.2272760597411565e+02 1.5895499661752211e+02 5.7194518486415930e+01
9 -1.3424389468966993e+00 5.5961120653727576e+00 -1.0522843110369067e+00
10 -4.0569661746613480e+02 -4.7090645573337184e+02 -9.7628440089732422e+01
11 4.2260633619776542e+01 2.0874271121537350e+02 -1.3676519708069108e+02
12 6.2351939732772273e+01 6.8740733319529681e+01 1.9368291661547465e+02
13 2.9034913906341565e+01 6.7392732862315881e+01 1.4128237934676201e+02
14 7.1584708176938221e+01 -9.9391162142709391e+01 -3.5112483055478720e+01
15 -1.0011391207749671e+02 3.3797184006896543e+01 -1.0280672266200776e+02
16 -9.3370883891440556e+01 -1.2693997492906119e+02 -6.3467168010540369e+01
17 1.7679515936747723e+02 1.4513584646617855e+02 2.8213604815112788e+01
18 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
19 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
21 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
22 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
23 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
24 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
25 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
26 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
27 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
28 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
29 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00
...

View File

@ -0,0 +1,78 @@
---
lammps_version: 10 Mar 2021
date_generated: Thu Mar 25 14:07:45 202
epsilon: 1e-14
prerequisites: ! |
atom full
fix adapt
pre_commands: ! |
variable scale equal ramp(0.5,1.0)
post_commands: ! |
fix move all nve
pair_style coul/long 8.0
pair_coeff * *
kspace_style pppm 1.0e-5
fix test solute adapt 1 pair coul/long scale * * v_scale kspace v_scale scale no
input_file: in.fourmol
natoms: 29
run_pos: ! |2
1 -2.7585387890471996e-01 2.4721267521182790e+00 -1.7590741140808724e-01
2 3.0525219871189541e-01 2.9567528136379986e+00 -8.4936576402532038e-01
3 -6.9505003051265457e-01 1.2527081545845018e+00 -6.1997181046584049e-01
4 -1.5812017862079175e+00 1.4837803436802379e+00 -1.2534501022240629e+00
5 -9.0698616844921520e-01 9.2696438488362154e-01 3.9881670647678125e-01
6 2.9475212358066677e-01 2.3090672513870800e-01 -1.2850129871041163e+00
7 3.3910265413162427e-01 -9.8304106880631008e-03 -2.4646152989509647e+00
8 1.1651505006204030e+00 -4.8743821011767707e-01 -6.7114884751728299e-01
9 1.3774263981599719e+00 -2.5621838794437357e-01 2.7183404529472238e-01
10 2.0205575722774203e+00 -1.4247755749375353e+00 -9.7170370274694495e-01
11 1.7878178367325690e+00 -1.9913978116155537e+00 -1.8882122011553970e+00
12 3.0049755926663213e+00 -4.9113386667261005e-01 -1.6222548793223990e+00
13 4.0509873346708982e+00 -8.9189599256758900e-01 -1.6399664169684836e+00
14 2.6067290768076905e+00 -4.1787776166657575e-01 -2.6628987151232200e+00
15 2.9696220092443193e+00 5.5371700758037623e-01 -1.2345762790291681e+00
16 2.6502758794398509e+00 -2.3947260224551123e+00 3.7979604817656068e-02
17 2.2329379457566403e+00 -2.1019011639091216e+00 1.1489747581405534e+00
18 2.1370039459092824e+00 3.0160650231380983e+00 -3.5182461434707273e+00
19 1.5358245580755947e+00 2.6253262982024990e+00 -4.2345405067543185e+00
20 2.7723206208610200e+00 3.6917660744997280e+00 -3.9324445897897893e+00
21 4.9046698830002544e+00 -4.0744208992376789e+00 -3.6231785861154941e+00
22 4.3619404928241057e+00 -4.2118418466324723e+00 -4.4549778550789503e+00
23 5.7375471428283742e+00 -3.5861419285984151e+00 -3.8743083628403299e+00
24 2.0685472614153846e+00 3.1534292413678289e+00 3.1539268144873454e+00
25 1.3099248377134609e+00 3.2652552015323466e+00 2.5158443987470833e+00
26 2.5769610944059931e+00 4.0046351067750248e+00 3.2209102828198946e+00
27 -1.9616446495134594e+00 -4.3541288139763008e+00 2.1089564303871438e+00
28 -2.7409194780982360e+00 -4.0232390590132754e+00 1.5874446954442702e+00
29 -1.3169303967683006e+00 -3.6019395338314788e+00 2.2736834157327834e+00
run_vel: ! |2
1 3.2647934948866072e-03 -1.0659515509476220e-03 -3.5596416446573862e-03
2 6.5461183155830240e-04 5.3408204488965814e-04 3.7281153774905299e-03
3 5.5824606761867453e-04 6.8767077705354802e-03 2.6081254050903369e-03
4 -3.0104306057251481e-03 -6.3737880755571717e-03 -5.7689309472175711e-04
5 -1.0695603162793169e-02 -9.3124438941875488e-03 -3.5561825582117166e-03
6 9.7217275192988716e-04 2.4037242875343898e-03 -1.4804194461220557e-03
7 -9.8813125701116859e-04 7.1676860005907047e-05 -4.9726864557309155e-04
8 5.7695861497255153e-04 -2.8105851335220203e-03 5.2330664783477206e-03
9 -1.4995649604676725e-03 3.1649947790849786e-06 2.0412648677152027e-03
10 1.5839012837707146e-03 3.0321007338515189e-03 -4.0872484640111792e-03
11 -4.7758918532801661e-03 -2.6593274143911529e-03 -1.1550198582046794e-03
12 9.0128567357444442e-04 -1.2761751259519178e-03 -2.0871137241467094e-03
13 2.1567295863873783e-03 5.8607859346030983e-03 -7.1626599947017036e-04
14 3.5355218381749455e-03 -5.7850299516532602e-03 -3.4518030258956843e-03
15 -1.7110094580322296e-03 -6.3503642729395085e-03 5.8528583997245172e-03
16 -1.3548756014535996e-03 1.4721717701533786e-03 3.4684968840172224e-03
17 1.2456371869895035e-03 7.2712506650925211e-05 -1.0263875344785681e-03
18 -7.6671852987712384e-04 -6.2725590016584319e-04 -1.7887461816215443e-03
19 1.5144560879023705e-03 -2.7339688331763923e-03 8.2529894052008699e-03
20 3.1192665056846264e-03 3.0118796973856330e-03 3.9267694079263664e-03
21 -8.3441863827979606e-04 5.2127470504020413e-04 -1.3858761585700890e-03
22 -3.4781949993989694e-03 -3.5196597997799125e-03 6.4236038889072932e-03
23 -1.5073299456798523e-04 -5.2285186251896619e-03 4.8604614163606421e-03
24 -6.9684359242923175e-05 1.0646658518855285e-03 -9.5542384314521332e-04
25 5.4585615099357566e-03 -5.7013984855115978e-03 3.7920245454784174e-03
26 -1.8076492725572590e-03 -4.1945707008573113e-03 4.0407648570027713e-03
27 -3.5547747026063570e-05 1.1321728960280906e-03 -6.3187029759558986e-04
28 -4.2637774879869998e-05 -1.6726973615869391e-03 2.4434056859341056e-03
29 -3.5302833519675510e-03 -2.4353648747156768e-03 2.8116576375086392e-03
...

View File

@ -0,0 +1,77 @@
---
lammps_version: 10 Mar 2021
date_generated: Thu Mar 25 14:01:17 202
epsilon: 1e-14
prerequisites: ! |
atom full
fix adapt
pre_commands: ! |
variable epsilon equal ramp(0.01,0.03)
post_commands: ! |
fix move all nve
pair_style lj/cut 8.0
pair_coeff * * 0.02 2.5
fix test solute adapt 1 pair lj/cut epsilon * * v_epsilon scale no
input_file: in.fourmol
natoms: 29
run_pos: ! |2
1 -3.2551307172152166e-01 2.4346451341937119e+00 -1.1396829659429568e-01
2 4.8617926885321056e-01 3.1070882859405997e+00 -1.0606347736697450e+00
3 -6.4277692336189840e-01 1.2540574692558419e+00 -6.5067148095539729e-01
4 -1.7124546848614086e+00 1.5199062846474698e+00 -1.3466731463120185e+00
5 -9.4318702684092770e-01 8.7036167560098177e-01 5.8107949039715845e-01
6 2.8417536732521353e-01 2.4411028847076369e-01 -1.2672995916002334e+00
7 3.3978105928826102e-01 -1.3702127966002052e-02 -2.4842417404954271e+00
8 1.1448702036571965e+00 -5.1199787721085332e-01 -7.6207631323785585e-01
9 1.4560807143664061e+00 -1.7028374483027719e-01 6.2141359752210135e-01
10 2.0382797810616289e+00 -1.4042635759560305e+00 -9.2654260470655225e-01
11 1.7519024690839582e+00 -2.0813293238835207e+00 -2.0333284515052927e+00
12 2.9787289051059695e+00 -5.2434906497210465e-01 -1.5904467995849627e+00
13 4.1953422217253049e+00 -9.4830119722648354e-01 -1.6427468797605889e+00
14 2.5500081793995157e+00 -4.0614435033397922e-01 -2.8121984203395161e+00
15 2.9657048145111777e+00 7.0300473914796602e-01 -1.1808819862439999e+00
16 2.6579963051616033e+00 -2.4005456919625914e+00 2.0005383723547647e-02
17 2.2277056239576578e+00 -2.0984522178633980e+00 1.1635464820238732e+00
18 2.1302246968151799e+00 2.9885050666882940e+00 -3.4237069257450177e+00
19 1.3456038469693135e+00 2.5038497935542385e+00 -4.4658170467307343e+00
20 2.9896625556783665e+00 3.9232215029072903e+00 -4.0788037150506025e+00
21 4.8757906644427553e+00 -4.1085999726993636e+00 -3.5248264027627227e+00
22 4.1728425444281765e+00 -4.2576916791274551e+00 -4.7519930504553214e+00
23 6.0419888290998678e+00 -3.4039201576442903e+00 -3.9699675670526715e+00
24 2.0885027685082749e+00 3.0623262332232590e+00 3.2053854817911325e+00
25 1.0405778226848383e+00 3.3092074961772369e+00 2.2889143046855063e+00
26 2.7667223704388135e+00 4.3243759349108064e+00 3.2424899041692892e+00
27 -1.9442324574216177e+00 -4.4528190486931383e+00 2.1453601072505339e+00
28 -3.0374110711029547e+00 -3.8950976773182124e+00 1.3869509742028494e+00
29 -1.0900141540951092e+00 -3.3361017662313661e+00 2.3288506481859019e+00
run_vel: ! |2
1 -2.6363966609802322e-02 -2.1121682067821074e-02 3.6083903537541533e-02
2 1.1439082425218627e-01 9.6059686259844332e-02 -1.2808582493334400e-01
3 4.1111553959541365e-02 4.8218907676123458e-03 -2.0053345127339979e-02
4 -1.1200342113854607e-01 2.3479218026487367e-02 -7.8322526982440521e-02
5 -3.8701176979056742e-02 -5.4238808461352553e-02 1.3872068929223944e-01
6 -1.2123879257604515e-02 1.8312769875475924e-02 1.5946869603522588e-02
7 -2.8033909635229349e-04 -4.1270986674540478e-03 -2.1849258860351647e-02
8 -1.0170253112050078e-02 -1.7528863700725254e-02 -4.2491773012772370e-02
9 4.5241065101710616e-02 5.1469831376004180e-02 2.0995899436627763e-01
10 1.8368003566726739e-02 1.4179451083200369e-02 2.9470727636806446e-02
11 -3.2659358322720752e-02 -7.3493919093785873e-02 -1.1457396195350034e-01
12 -2.1332063889491135e-02 -2.8577988202947827e-02 2.3932097053094816e-02
13 1.2690181040869375e-01 -4.2622009579717637e-02 -3.2122980905022864e-03
14 -4.3986665577866770e-02 4.1189150738941797e-03 -1.2884939606320925e-01
15 -5.1087806082402770e-03 1.2103885273247751e-01 5.1598463273012998e-02
16 7.2721700595591750e-03 -5.1107380318211630e-03 -1.6206172124102816e-02
17 -4.5383051620802401e-03 3.8550131312268723e-03 1.5203146179855118e-02
18 -3.4035600174367278e-03 -1.6724199163900926e-02 5.8534078947667954e-02
19 -1.2309357029421318e-01 -8.2342186011711699e-02 -1.4270564232030267e-01
20 1.3831939524791759e-01 1.4683346823701657e-01 -8.6190510762895065e-02
21 -1.8190109221215101e-02 -2.0433705925500686e-02 5.9790597332019774e-02
22 -1.2248854674722252e-01 -3.2562959165287515e-02 -1.7942350258565937e-01
23 1.8820938314857302e-01 1.0738920901878871e-01 -5.3571267428950652e-02
24 1.3241508666550663e-02 -5.5202622564252735e-02 3.1590984003367552e-02
25 -1.6538995535147813e-01 2.1577200806135906e-02 -1.3992038866639564e-01
26 1.1598773628387443e-01 1.9315924859017630e-01 1.7906411933036825e-02
27 9.5161140946472839e-03 -6.0207807869183290e-02 2.1271816291477584e-02
28 -1.8165131190419664e-01 7.5944941014218031e-02 -1.2012012232111549e-01
29 1.3987378313944554e-01 1.6482908858701009e-01 3.7930623655713772e-02
...

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,158 @@
---
lammps_version: 10 Mar 2021
date_generated: Wed Mar 24 12:18:23 202
epsilon: 5e-13
prerequisites: ! |
pair mliap
pair zbl
pre_commands: ! |
variable newton_pair delete
variable newton_pair index on
post_commands: ! ""
input_file: in.manybody
pair_style: hybrid/overlay zbl 4.0 4.8 mliap model nn Ta06A.nn.mliap.model descriptor
sna Ta06A.mliap.descriptor
pair_coeff: ! |
1*8 1*8 zbl 73 73
* * mliap Ta Ta Ta Ta Ta Ta Ta Ta
extract: ! ""
natoms: 64
init_vdwl: -473.569864629026
init_coul: 0
init_stress: ! |2-
3.9989504688551500e+02 4.0778136516736993e+02 4.3596322435184823e+02 -2.5242497284339720e+01 1.2811620806363655e+02 2.8644673361821793e+00
init_forces: ! |2
1 -3.7538180163781538e+00 8.8612947043788708e+00 6.7712977816732263e+00
2 -7.6696525239232596e+00 -3.7674335682223203e-01 -5.7958054718422760e+00
3 -2.9221261341045079e-01 -1.2984917885683813e+00 2.2320440844884399e+00
4 -4.7103509354198474e+00 9.2783458784125941e+00 4.3108702582741429e+00
5 -2.0331946400488916e+00 -2.9593716047756180e+00 -1.6136351145373196e+00
6 1.8086748683348572e+00 4.6479727629048675e+00 3.0425695895915184e-01
7 -3.0573043543220644e+00 -4.0575899915120264e+00 1.5283788878527900e+00
8 2.7148403621334427e-01 1.3063473238306007e+00 -1.1268098385676173e+00
9 5.2043326273129953e-01 -2.9340446386399996e+00 -7.6461969078455834e+00
10 -6.2786875145099508e-01 5.6606570005199308e-02 -5.3746300485699576e+00
11 8.1946917251451818e+00 -6.7267140406524675e+00 2.5930013855034630e+00
12 -1.4328402235895087e+01 -8.0774309292156197e+00 -7.6980199570965677e+00
13 -3.2260600618006614e+00 1.3854745225224621e+01 -1.8038061855949390e+00
14 -2.9498732270039856e+00 8.5589611530655674e+00 2.0530716609447816e-01
15 -8.6349846297038031e+00 9.1996942753987270e+00 -9.5905201240123024e+00
16 3.7310502876344778e+00 1.9788328492752776e+00 1.5687925430243098e+01
17 5.0755393464331471e+00 6.1278868384113423e+00 -1.0750955741273682e+01
18 1.7371660543384140e+00 3.0620693584379239e+00 7.2701166654624991e+00
19 -2.9132243097469201e+00 -1.1018213008189437e+00 -2.8349170179881567e+00
20 -1.6464048708371479e+01 2.4791517492525559e+00 3.4072780064525732e-01
21 3.9250706073854098e+00 -1.0562396695052145e+00 -9.1632104209006702e+00
22 -1.5634125465245701e+01 8.9090677007239911e+00 -1.2750204519006148e+01
23 2.8936071278420723e+00 5.3816164530412767e+00 7.4597216732837071e+00
24 3.1860163425620680e+00 4.7170150104555253e+00 6.3461114127051133e+00
25 8.8078411119652245e-01 -1.4554648001614754e+00 1.6812657581308246e+00
26 -1.8170871697803546e+00 -3.7700946621067644e-01 6.2457161242680581e-01
27 4.3406014531279231e+00 -2.9009678649007267e+00 5.2435008444617139e+00
28 -7.0542478046177770e-01 1.0981989037209707e+00 1.3116499712117630e+01
29 -6.6151960592236154e+00 1.6410275382967996e+00 -1.0570398181017497e+00
30 -3.6949627314218070e+00 2.0505225752289262e+00 -1.5676706969561256e+00
31 -3.1645464836586603e+00 3.4678442856969571e-01 -3.0903933004746946e+00
32 -7.8831496558114571e+00 4.7917666582558249e-01 8.5821461480119510e-01
33 1.0742815926879523e+01 -5.8142728701457189e+00 9.7282423280124952e+00
34 -1.3523086688998047e+00 -1.1117518205645105e-01 1.6057041203339644e+00
35 2.5212001799950716e+00 -2.2938190564661185e+00 5.7029334689777986e+00
36 1.7666626040313700e+00 -4.4698105712986091e+00 2.0563602888032650e-01
37 -3.8714388913204467e+00 5.6357721515897250e+00 -6.6078854304621775e+00
38 1.4632813171776671e+00 -3.3182377007830244e-01 -8.4412322782161375e-01
39 4.1718406489245972e+00 -6.3270387696640586e+00 -1.1208012916569135e+01
40 9.5193696695210637e+00 -7.0213638399035432e+00 -1.5692669012530696e+00
41 2.4000089474497699e-01 1.0045144396502914e+00 -2.3032449685213630e+00
42 -9.4741999244791426e+00 -6.3134658287662750e+00 -3.6928028439517893e+00
43 2.7218639962411728e-01 -1.3813634477251096e+01 5.5147832931992291e-01
44 8.0196107396135208e+00 -8.1793730426384545e+00 3.5131695854462590e+00
45 -1.8910274064701343e-01 3.9137627573846219e+00 -7.4450993876429399e+00
46 -3.5282857552811575e+00 -5.1713579630178099e+00 1.2477491203990510e+01
47 5.1131478665605341e+00 2.3800985688973459e+00 5.1348001359881970e+00
48 2.1755560727357057e+00 2.9996491762493216e+00 -9.9575511910097214e-01
49 -2.3978299788760209e+00 -1.2283692236805253e+01 -8.3755937565454435e+00
50 3.6161933080447888e+00 5.6291551969069182e+00 -6.9709721613230968e-01
51 -3.0166275666360352e+00 1.1037977712957442e+01 8.8691052932904171e+00
52 1.2943573147098917e+01 -1.1745909799528654e+01 1.6522312348562508e+01
53 5.8389424736085775e+00 7.5295796786576226e+00 5.5403096028203525e+00
54 4.6678942858445893e+00 -5.7948610984030058e+00 -4.7138910958393971e+00
55 4.9846400582125163e+00 -8.4400769236810902e+00 -6.5776931744173313e+00
56 -3.5699586538966939e-02 1.5545384984529795e+00 -5.2139902048630429e+00
57 2.1375440189892982e+00 -1.3001299791681296e+00 -8.9740026386466654e-01
58 5.2652486142639416e+00 -2.5529130533710997e+00 2.0016357749193905e-01
59 9.0343971306644377e+00 4.2302611807585224e+00 -1.8088550980511922e+00
60 -5.1586404521695464e+00 -1.5178664164309549e+01 -9.8559725391424795e+00
61 9.6892046530364073e-01 3.6493959386458350e+00 -8.3809793809505195e-01
62 -6.2693637951458694e+00 5.5593866650560679e+00 -4.0417158962655781e+00
63 5.8570431431678962e+00 -6.2896068000076317e+00 -3.8788666930728688e+00
64 7.5837965251215369e+00 7.5954689486766096e+00 1.6804021764142011e+01
run_vdwl: -473.666568306022
run_coul: 0
run_stress: ! |2-
3.9951053758431499e+02 4.0757094669497650e+02 4.3599209936956868e+02 -2.5012844114476398e+01 1.2751742945242590e+02 3.9821818278564844e+00
run_forces: ! |2
1 -3.7832595710893155e+00 8.8212124103655292e+00 6.7792549500694745e+00
2 -7.6693903913873163e+00 -4.4331479267505980e-01 -5.8319844453604492e+00
3 -3.5652510811236748e-01 -1.2843261396638010e+00 2.3164336943032460e+00
4 -4.6688281400123417e+00 9.2569804046918627e+00 4.2532553525093961e+00
5 -2.0698377683688305e+00 -3.0068940885360655e+00 -1.5557558367041349e+00
6 1.9121936983089021e+00 4.6485144224151016e+00 3.8302570899366983e-01
7 -3.0000564919294019e+00 -3.9598169423628935e+00 1.4730795882443171e+00
8 2.2616298546615310e-01 1.3160780554993146e+00 -1.1365737437456360e+00
9 4.5475496885290934e-01 -3.0115904820513633e+00 -7.6802788934953448e+00
10 -6.5754023848348220e-01 4.3910855294922169e-02 -5.2814927356947416e+00
11 8.0870811363765238e+00 -6.6478157150338770e+00 2.5239196033647513e+00
12 -1.4266979871278297e+01 -7.9890391049193692e+00 -7.6506348180232058e+00
13 -3.0605842642063994e+00 1.3809674690005217e+01 -1.6731082107132822e+00
14 -3.0058694850615257e+00 8.5169039650285132e+00 1.8498544937038552e-01
15 -8.6057398167379340e+00 9.1431278151038597e+00 -9.5164336499508586e+00
16 3.7105123804670184e+00 1.9684880085511294e+00 1.5628485674431591e+01
17 5.0446625217738115e+00 6.1086935560886335e+00 -1.0684670022014132e+01
18 1.6342572076662352e+00 3.0978003138559700e+00 7.3023410755539730e+00
19 -2.9853538081785418e+00 -1.1736228416330263e+00 -2.8772549755196275e+00
20 -1.6354717680325663e+01 2.4069036913441169e+00 2.5852528541413577e-01
21 3.9596059647558470e+00 -1.1309140461374385e+00 -9.2411865520092746e+00
22 -1.5578599385494211e+01 8.8837889458923414e+00 -1.2717012806950681e+01
23 2.9286474436436607e+00 5.4115499463398438e+00 7.4875237575502283e+00
24 3.2309052666659346e+00 4.6724691716691664e+00 6.3076914533727404e+00
25 8.7447853599857761e-01 -1.4447800235404800e+00 1.6369348219913344e+00
26 -1.8229284577405889e+00 -3.3721763232208768e-01 6.1531223202321172e-01
27 4.3482945496099807e+00 -2.9274873379719288e+00 5.2404893120488989e+00
28 -7.6160360457911214e-01 1.1530752576673735e+00 1.3094542130299224e+01
29 -6.6257114998810200e+00 1.6523572981586176e+00 -1.0670925651816274e+00
30 -3.6586042068050459e+00 2.0111737944853250e+00 -1.5501355511382873e+00
31 -3.1601602861552482e+00 3.3256891161094693e-01 -3.0724685917071382e+00
32 -7.8275016718590731e+00 4.4236506496773642e-01 8.3868054333668041e-01
33 1.0688722918141039e+01 -5.7920158261872583e+00 9.6923706747923646e+00
34 -1.3525464452783258e+00 -1.0575652830645854e-01 1.6380965403350563e+00
35 2.5193832475087721e+00 -2.2598987796878789e+00 5.6810280412635601e+00
36 1.7111787089042565e+00 -4.4473718671663391e+00 9.6398513850121076e-02
37 -3.8563809307986823e+00 5.6131073606614059e+00 -6.6177968130852260e+00
38 1.5064516388374909e+00 -3.1694753678232956e-01 -8.3526359314898979e-01
39 4.1314418694153812e+00 -6.2751004763663678e+00 -1.1210904504268449e+01
40 9.5830290785144836e+00 -7.0395435048262769e+00 -1.6267459470122683e+00
41 3.1375436243120802e-01 1.0622164383329200e+00 -2.2467935230672076e+00
42 -9.4881290346220375e+00 -6.3542967900678029e+00 -3.7436081761319060e+00
43 2.2855728522521823e-01 -1.3797673758210431e+01 5.1169123226999269e-01
44 8.0135824689800454e+00 -8.1618220152116709e+00 3.4767795780208774e+00
45 -2.2793629160624870e-01 3.8533578964252726e+00 -7.3720918772105994e+00
46 -3.5217473183911405e+00 -5.1375353430494126e+00 1.2535347493777751e+01
47 5.1244898311428937e+00 2.3801653011346930e+00 5.1114297013297003e+00
48 2.1906793040748171e+00 3.0345200169741182e+00 -1.0179863236095192e+00
49 -2.4788694934316329e+00 -1.2411071815396923e+01 -8.4971983039341392e+00
50 3.6569038614206466e+00 5.6055766933888798e+00 -7.2525721879624516e-01
51 -3.1071936932427051e+00 1.1143003955179145e+01 8.9003301745210983e+00
52 1.2953816665492676e+01 -1.1681525536724189e+01 1.6495289315845085e+01
53 5.8923317047264643e+00 7.6559750818830006e+00 5.7413363341910788e+00
54 4.6456819257039355e+00 -5.7613868673147293e+00 -4.6785882460677595e+00
55 4.9036275837635479e+00 -8.4131355466563491e+00 -6.4652425471547437e+00
56 -2.5919766291264371e-02 1.4942725648609447e+00 -5.1846171304946838e+00
57 2.1354464802186661e+00 -1.3197172317543322e+00 -8.9084444403811647e-01
58 5.2496503717062382e+00 -2.5023030575014631e+00 1.2534239362101771e-01
59 9.1088663289515797e+00 4.2501608997098561e+00 -1.8293706034164023e+00
60 -5.2377119984886820e+00 -1.5252944642880552e+01 -9.9884309435445626e+00
61 9.8418569822230928e-01 3.6718229831397404e+00 -7.9620939417097958e-01
62 -6.2529671270584286e+00 5.5348777429740972e+00 -3.9890515783571203e+00
63 5.8510809377900035e+00 -6.3420520892802621e+00 -3.9437203585924383e+00
64 7.6647749161376320e+00 7.7322248465188412e+00 1.6865884297614787e+01
...

View File

@ -0,0 +1,158 @@
---
lammps_version: 10 Mar 2021
date_generated: Wed Mar 24 12:24:38 202
epsilon: 5e-13
prerequisites: ! |
pair mliap
pair zbl
pre_commands: ! |
variable newton_pair delete
variable newton_pair index on
post_commands: ! ""
input_file: in.manybody
pair_style: hybrid/overlay zbl 4.0 4.8 mliap model quadratic W.quadratic.mliap.model
descriptor sna W.quadratic.mliap.descriptor
pair_coeff: ! |
1*8 1*8 zbl 74 74
* * mliap W W W W W W W W
extract: ! ""
natoms: 64
init_vdwl: 310.670038860846
init_coul: 0
init_stress: ! |2-
5.6259528842196187e+02 5.7316629871796738e+02 5.8790591480137323e+02 -1.8189500835315549e+01 1.3614672500307736e+02 5.6212035897053383e+00
init_forces: ! |2
1 -1.7332406552612252e+00 9.6965139437668633e+00 5.8109280039223741e+00
2 -8.4506855506966403e+00 1.7517630868906400e+00 -5.8585143024763751e+00
3 1.3067558540335114e+00 2.4533443839399922e+00 -5.3832194918864029e-01
4 -5.4997504048583030e+00 8.6507394288895618e+00 3.5210921442144869e+00
5 -5.4578004799253836e+00 -3.8166835957403560e+00 -1.9324965001410375e+00
6 1.8068295611859355e+00 7.7167110612740411e+00 2.2464754671860354e+00
7 -1.4615233556948404e+00 -4.5523205969121312e+00 5.2307165009286525e+00
8 1.3470528830761590e+00 1.1150099302890997e+00 -2.4124956929134638e+00
9 1.8536678547304528e+00 -5.9192817641183115e+00 -8.9231779770120117e+00
10 -1.6830129533144051e+00 -2.0004948002622096e+00 -6.7940188134883588e+00
11 9.3899899055663916e+00 -9.6096061996623181e+00 5.4294046031393410e+00
12 -1.8440182258152287e+01 -9.1578611598783599e+00 -6.9019373206621033e+00
13 -1.4789077352315048e+00 1.6126223605834220e+01 -2.3399418562200816e+00
14 -5.1192810384232743e+00 7.8887975887856649e+00 2.7987351355628833e+00
15 -1.1432288954023196e+01 1.2052925891647078e+01 -7.6561230955500186e+00
16 4.9875199325917112e+00 -7.9756500980837031e-01 1.5348327626794408e+01
17 3.0326448198662455e+00 1.0247763080256838e+01 -1.3162357502394531e+01
18 1.1912120343158321e+00 3.8795028741303881e+00 9.7535980505837134e+00
19 -4.1904376957856400e+00 -3.2045372808825174e+00 -1.1178952155997879e+00
20 -2.0524722840954009e+01 1.3584987641399842e+00 1.2643890965526294e+00
21 7.8962692301193274e+00 3.0756220916596053e+00 -1.0060035052224105e+01
22 -1.6638865872488534e+01 7.3242501928548176e+00 -1.1470088145525292e+01
23 3.1098873977160020e+00 8.9978923066815906e+00 7.3796685128197010e+00
24 3.7623303590129575e+00 3.9470381598445985e+00 8.3456006313463575e+00
25 2.7135762879995773e+00 1.2688233449033359e-01 2.7652325878214103e+00
26 -2.5567333671028858e+00 -1.5012729784955012e+00 3.8180756571583805e+00
27 5.4933629833598179e+00 -3.5852699914334007e-01 5.6772577899252621e+00
28 2.1583223591405485e+00 2.5602854563986126e+00 1.2987493211097293e+01
29 -9.3928065614100227e+00 8.1231719788253520e-01 -3.4139694444606663e+00
30 -6.5111025810175223e+00 3.9239227943865140e+00 -1.9909323666256402e+00
31 -4.5532920832558466e+00 2.9334735012590949e+00 -2.2603005294374805e+00
32 -1.1131319171235056e+01 4.0773060096293179e-01 2.3495354245782185e-01
33 1.1946312975015427e+01 -4.8997346173109610e+00 8.5135451343035555e+00
34 2.2567306848110924e-01 -9.7924723339198039e-01 1.7583322195512454e+00
35 2.8580692192724184e+00 -9.9224668537616911e-01 8.1615215594264985e+00
36 -9.5804648131257442e-02 -6.2355391184959963e+00 -1.1533359083409473e+00
37 -5.1866584177272408e+00 5.2276382338316552e+00 -9.4551207183301855e+00
38 -1.1543907922565189e+00 -1.2217116705851163e+00 7.8535042419588308e-01
39 7.5764294215464227e+00 -4.6563914581780939e+00 -1.4559998851452969e+01
40 1.1962426631242364e+01 -6.5095442931054395e+00 -3.2593809840204688e+00
41 4.2161422225881529e-01 -1.4729246940628351e+00 -4.8653082075157528e+00
42 -1.2872945210845128e+01 -6.7834573750437004e+00 -6.3019087398505946e-01
43 2.5785048972790117e+00 -1.6923099420445759e+01 -1.3360019377139212e+00
44 1.2291023950270986e+01 -1.2191603864766963e+01 2.7304006094143318e+00
45 -1.2398099447130371e+00 5.0658390044921555e+00 -9.2322482748129762e+00
46 -1.4311260929166141e+00 -5.6910264552445193e+00 1.3277999978308035e+01
47 6.2057343183031417e+00 3.7310981833648289e+00 4.8205098133270914e+00
48 3.3963650236743295e+00 2.0831245825926228e+00 -1.2673031459768591e+00
49 -1.8543360773247199e+00 -1.3380317233196116e+01 -8.4112300152561250e+00
50 -1.9920275269520710e-01 7.0107508582593869e+00 -2.6708325452002271e+00
51 -9.3660629689657249e-01 1.1809167034995344e+01 9.8986119959157612e+00
52 1.2220659999225337e+01 -1.2024509026677922e+01 1.4962970527017067e+01
53 7.4348387428600198e+00 7.7548706874243649e+00 4.1933368746931752e+00
54 7.0105713161150085e+00 -7.7007180274608169e+00 -6.5961935960226112e+00
55 3.2473798770902653e+00 -9.0385173613511878e+00 -8.5508326243716120e+00
56 4.2348804882267466e-01 4.3169490550492495e-01 -5.3478203134943731e+00
57 3.5009508489349979e+00 -3.3027079935021968e+00 -2.1184761311459956e+00
58 9.2468424036384231e+00 -4.5181490794556876e+00 2.4559890235342761e+00
59 9.9448793924013952e+00 4.5973129034833260e+00 -2.2322113512955504e+00
60 -3.6986806985028280e+00 -1.7543528229443428e+01 -1.0133821358926038e+01
61 -2.2233420196353229e+00 6.0781304306653574e+00 -1.8495331839082056e+00
62 -1.2719363808848012e+01 8.6073749589883608e+00 -4.9797073704539283e+00
63 7.9457470990016770e+00 -9.7673000016796276e+00 -4.3317841246475552e-01
64 9.3812874011747454e+00 7.3062141638106093e+00 2.1744814847410481e+01
run_vdwl: 310.495392494539
run_coul: 0
run_stress: ! |2-
5.6245390685235475e+02 5.7310155923142815e+02 5.8811705982147669e+02 -1.8382792415481248e+01 1.3530908723557451e+02 6.7996805811527254e+00
run_forces: ! |2
1 -1.7474911328125362e+00 9.6453508706584969e+00 5.8264070485591564e+00
2 -8.4157283593600489e+00 1.6574874271599898e+00 -5.8310589262897814e+00
3 1.2088949261773574e+00 2.4669650164003505e+00 -4.1375090165872641e-01
4 -5.4649039359012761e+00 8.6435152499830856e+00 3.4462094837625115e+00
5 -5.4958328716797862e+00 -3.8484174335646353e+00 -1.8816778997456991e+00
6 1.9551787223560284e+00 7.7494231202147503e+00 2.2973472684776728e+00
7 -1.4123397167898091e+00 -4.4576559389423105e+00 5.1606908467828738e+00
8 1.3003903361118314e+00 1.1090418970773539e+00 -2.4122402377787160e+00
9 1.7752795626830657e+00 -5.9789440759859360e+00 -8.9434548975396595e+00
10 -1.7012447055310522e+00 -1.9935230569531357e+00 -6.6673307006625988e+00
11 9.2689566064779427e+00 -9.5287746372607316e+00 5.4104731087638704e+00
12 -1.8405278855921495e+01 -9.0991584859228194e+00 -6.8488708319775853e+00
13 -1.2996763830273808e+00 1.6069530823653931e+01 -2.2707313142490793e+00
14 -5.1882033738262070e+00 7.8832636277485548e+00 2.7916487158318102e+00
15 -1.1433449800945827e+01 1.2015094164432849e+01 -7.5825275115016781e+00
16 4.9454676036434462e+00 -7.8102971145205025e-01 1.5266194219606220e+01
17 3.0052148409052588e+00 1.0222703724442866e+01 -1.3093555057589381e+01
18 1.0836570454713836e+00 3.9100837051064552e+00 9.7948718675854156e+00
19 -4.2707464401127355e+00 -3.2934173316232527e+00 -1.1211010156027728e+00
20 -2.0392897715847305e+01 1.3054265260795233e+00 1.1968830911637141e+00
21 7.9027972563135283e+00 2.9933448022464120e+00 -1.0141811195436880e+01
22 -1.6575655480795024e+01 7.3026015885081472e+00 -1.1453084247555879e+01
23 3.1438035132341287e+00 9.0208182590437627e+00 7.4001520562013852e+00
24 3.8345333002034385e+00 3.8688922268567087e+00 8.2635479168723016e+00
25 2.6893003750410522e+00 1.3495734265712933e-01 2.6770556576379549e+00
26 -2.5895248886874898e+00 -1.4293305889359713e+00 3.8291245405081260e+00
27 5.5060054332311656e+00 -4.1092061919393136e-01 5.6759895801356688e+00
28 2.1307408306936098e+00 2.6175526554889608e+00 1.2958660769748445e+01
29 -9.3633952447569087e+00 8.2665579439215930e-01 -3.4012747321257448e+00
30 -6.4533544693943297e+00 3.8387646522939547e+00 -2.0200114390690862e+00
31 -4.5312579127038672e+00 2.9434281499085380e+00 -2.2589125870011584e+00
32 -1.1081437585586908e+01 3.5221507626974347e-01 1.7034641632139044e-01
33 1.1876109082707279e+01 -4.8655564590595244e+00 8.4901635945810785e+00
34 1.9834861495951994e-01 -9.7867922827610787e-01 1.7689988369185765e+00
35 2.8755972285806117e+00 -9.4201232104253185e-01 8.1427329437299605e+00
36 -1.7696676342095063e-01 -6.2050030582426956e+00 -1.2610314329006926e+00
37 -5.1523185432926066e+00 5.1647495629610471e+00 -9.4596116018450456e+00
38 -1.0982182558331921e+00 -1.1973914898033993e+00 8.2357032136004271e-01
39 7.5153819798537249e+00 -4.6353686206926801e+00 -1.4561478300809743e+01
40 1.2018485301986439e+01 -6.4889114819969862e+00 -3.3179507002516861e+00
41 5.3906537639254815e-01 -1.3597164515464635e+00 -4.7572664553057376e+00
42 -1.2853367469523606e+01 -6.8243263403454719e+00 -7.0954222980753212e-01
43 2.5285681786651231e+00 -1.6882295131334587e+01 -1.3986624925913076e+00
44 1.2309710907856807e+01 -1.2175400941985238e+01 2.6677164515852514e+00
45 -1.3287685848983446e+00 4.9721749381786715e+00 -9.1534484515246355e+00
46 -1.4302864380872948e+00 -5.6407929749476793e+00 1.3337675572559966e+01
47 6.2320161927247124e+00 3.7264499027617033e+00 4.8100453121557578e+00
48 3.4140183611989756e+00 2.1640838168269934e+00 -1.2936781336070275e+00
49 -1.9593115645555264e+00 -1.3493991739193522e+01 -8.5023532432195843e+00
50 -1.6811489988289596e-01 6.9681072464297396e+00 -2.7188888125967106e+00
51 -1.0469270161190001e+00 1.1884430462587432e+01 9.9090099481589125e+00
52 1.2258922313552624e+01 -1.1933013587721307e+01 1.4931067313457525e+01
53 7.4707442724281288e+00 7.8432472024360917e+00 4.3940747538426654e+00
54 6.9725677862692397e+00 -7.6678940689959383e+00 -6.5509217426800008e+00
55 3.1754349262716173e+00 -9.0126325358351416e+00 -8.4265432974728931e+00
56 4.0310136221619780e-01 3.3628916654912500e-01 -5.3158911291318605e+00
57 3.5009222797756716e+00 -3.3989600099867601e+00 -2.1369392158489036e+00
58 9.2532114410873234e+00 -4.4437952950838877e+00 2.3641140155667579e+00
59 1.0015845748025313e+01 4.6123938091542342e+00 -2.2569748666852796e+00
60 -3.7800808893756161e+00 -1.7584651166860183e+01 -1.0234679510276377e+01
61 -2.1980530287652753e+00 6.1071583911470810e+00 -1.7912415049492632e+00
62 -1.2705161798029133e+01 8.5765301471185520e+00 -4.9056271749898661e+00
63 7.9321561763633355e+00 -9.8033451737328594e+00 -4.9729640856821433e-01
64 9.4795662420049851e+00 7.4221786097433808e+00 2.1786648548971794e+01
...

View File

@ -1,6 +1,6 @@
---
lammps_version: 24 Aug 2020
date_generated: Tue Sep 15 09:44:10 202
lammps_version: 10 Mar 2021
date_generated: Fri Apr 2 15:14:43 202
epsilon: 5e-14
prerequisites: ! |
atom full
@ -9,22 +9,22 @@ pre_commands: ! ""
post_commands: ! ""
input_file: in.fourmol
pair_style: born 8.0
pair_coeff: ! "1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613
141.547923828784 \n1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663
4.09225030876458 \n1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725
403.51858739517 \n1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061
303.336540547726 \n1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061
303.336540547726 \n2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071
0.177172207445923 \n2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284
17.5662073921955 \n2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855
0.000703093129207124 \n2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145
12.548008396489 \n3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117
1019.38354056979 \n3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624
778.254162800904 \n3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624
778.254162800904 \n4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722\n"
pair_coeff: ! |
1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784
1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458
1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517
1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726
1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726
2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923
2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955
2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124
2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489
3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979
3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904
3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904
4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
extract: ! |
a 2
c 2

View File

@ -1,6 +1,6 @@
---
lammps_version: 24 Aug 2020
date_generated: Tue Sep 15 09:44:10 202
lammps_version: 10 Mar 2021
date_generated: Fri Apr 2 15:14:43 202
epsilon: 5e-14
prerequisites: ! |
atom full
@ -9,22 +9,22 @@ pre_commands: ! ""
post_commands: ! ""
input_file: in.fourmol
pair_style: born/coul/dsf 0.25 8.0
pair_coeff: ! "1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613
141.547923828784 \n1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663
4.09225030876458 \n1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725
403.51858739517 \n1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061
303.336540547726 \n1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061
303.336540547726 \n2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071
0.177172207445923 \n2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284
17.5662073921955 \n2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855
0.000703093129207124 \n2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145
12.548008396489 \n3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117
1019.38354056979 \n3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624
778.254162800904 \n3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624
778.254162800904 \n4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722\n"
pair_coeff: ! |
1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784
1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458
1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517
1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726
1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726
2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923
2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955
2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124
2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489
3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979
3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904
3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904
4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
extract: ! ""
natoms: 29
init_vdwl: 225.01325775005

View File

@ -1,6 +1,6 @@
---
lammps_version: 24 Aug 2020
date_generated: Tue Sep 15 09:44:10 202
lammps_version: 10 Mar 2021
date_generated: Fri Apr 2 15:14:43 202
epsilon: 7.5e-14
prerequisites: ! |
atom full
@ -14,22 +14,22 @@ post_commands: ! |
kspace_modify compute no
input_file: in.fourmol
pair_style: born/coul/long 8.0
pair_coeff: ! "1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613
141.547923828784 \n1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663
4.09225030876458 \n1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725
403.51858739517 \n1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061
303.336540547726 \n1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061
303.336540547726 \n2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071
0.177172207445923 \n2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284
17.5662073921955 \n2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855
0.000703093129207124 \n2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145
12.548008396489 \n3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117
1019.38354056979 \n3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624
778.254162800904 \n3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624
778.254162800904 \n4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n"
pair_coeff: ! |
1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784
1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458
1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517
1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726
1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726
2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923
2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955
2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124
2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489
3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979
3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904
3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904
4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
extract: ! |
cut_coul 0
natoms: 29

View File

@ -1,6 +1,6 @@
---
lammps_version: 24 Aug 2020
date_generated: Tue Sep 15 09:44:10 202
lammps_version: 10 Mar 2021
date_generated: Fri Apr 2 15:14:43 202
epsilon: 5e-14
prerequisites: ! |
atom full
@ -15,22 +15,22 @@ post_commands: ! |
kspace_modify pressure/scalar no # required for USER-OMP with msm
input_file: in.fourmol
pair_style: born/coul/msm 12.0
pair_coeff: ! "1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613
141.547923828784 \n1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663
4.09225030876458 \n1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725
403.51858739517 \n1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061
303.336540547726 \n1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061
303.336540547726 \n2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071
0.177172207445923 \n2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284
17.5662073921955 \n2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855
0.000703093129207124 \n2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145
12.548008396489 \n3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117
1019.38354056979 \n3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624
778.254162800904 \n3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624
778.254162800904 \n4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n"
pair_coeff: ! |
1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784
1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458
1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517
1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726
1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726
2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923
2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955
2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124
2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489
3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979
3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904
3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904
4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
extract: ! |
cut_coul 0
natoms: 29

View File

@ -1,6 +1,6 @@
---
lammps_version: 24 Aug 2020
date_generated: Tue Sep 15 09:44:10 202
lammps_version: 10 Mar 2021
date_generated: Fri Apr 2 15:14:43 202
epsilon: 5e-14
prerequisites: ! |
atom full
@ -15,22 +15,22 @@ post_commands: ! |
kspace_modify pressure/scalar no # required for USER-OMP with msm
input_file: in.fourmol
pair_style: born/coul/msm 12.0
pair_coeff: ! "1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613
141.547923828784 \n1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663
4.09225030876458 \n1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725
403.51858739517 \n1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061
303.336540547726 \n1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061
303.336540547726 \n2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071
0.177172207445923 \n2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284
17.5662073921955 \n2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855
0.000703093129207124 \n2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145
12.548008396489 \n3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117
1019.38354056979 \n3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624
778.254162800904 \n3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624
778.254162800904 \n4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n"
pair_coeff: ! |
1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784
1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458
1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517
1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726
1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726
2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923
2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955
2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124
2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489
3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979
3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904
3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904
4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
extract: ! |
cut_coul 0
natoms: 29

View File

@ -1,6 +1,6 @@
---
lammps_version: 24 Aug 2020
date_generated: Tue Sep 15 09:44:11 202
lammps_version: 10 Mar 2021
date_generated: Fri Apr 2 15:14:44 202
epsilon: 5e-14
prerequisites: ! |
atom full
@ -9,22 +9,22 @@ pre_commands: ! ""
post_commands: ! ""
input_file: in.fourmol
pair_style: born/coul/wolf 0.25 8.0
pair_coeff: ! "1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613
141.547923828784 \n1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663
4.09225030876458 \n1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725
403.51858739517 \n1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061
303.336540547726 \n1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061
303.336540547726 \n2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071
0.177172207445923 \n2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284
17.5662073921955 \n2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855
0.000703093129207124 \n2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145
12.548008396489 \n3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117
1019.38354056979 \n3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624
778.254162800904 \n3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624
778.254162800904 \n4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722 \n5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912
592.979935420722\n"
pair_coeff: ! |
1 1 2.51937098847838 0.148356076521964 1.82166848001002 29.0375806150613 141.547923828784
1 2 2.87560097202631 0.103769845319212 1.18949647259382 1.7106306969663 4.09225030876458
1 3 2.73333746288062 0.169158133709025 2.06291417638668 63.7180294456725 403.51858739517
1 4 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726
1 5 2.51591531388789 0.166186965980131 2.01659390849669 49.622913109061 303.336540547726
2 2 1.0594557710255 0.281261664467988 0.314884389172266 0.271080184997071 0.177172207445923
2 3 2.12127488295383 0.124576922646243 1.46526793359105 5.10367785279284 17.5662073921955
2 4 0.523836115049206 0.140093804714855 0.262040872137659 0.00432916334694855 0.000703093129207124
2 5 2.36887234111228 0.121604450909563 1.39946581861656 3.82529730669145 12.548008396489
3 3 2.81831917530019 0.189944649028137 2.31041576143228 127.684271782117 1019.38354056979
3 4 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904
3 5 2.5316180773506 0.186976803503293 2.26748506873271 100.602835334624 778.254162800904
4 4 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
4 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
5 5 2.63841820292211 0.184008285863681 2.19742633928911 79.1465822481912 592.979935420722
extract: ! ""
natoms: 29
init_vdwl: 225.01325775005

View File

@ -0,0 +1,99 @@
---
lammps_version: 10 Mar 2021
date_generated: Thu Apr 1 12:05:31 202
epsilon: 7.5e-14
prerequisites: ! |
atom full
pair lj/switch3/coulgauss/long
kspace ewald
pre_commands: ! ""
post_commands: ! |
pair_modify mix arithmetic
pair_modify table 0
kspace_style ewald 1.0e-6
kspace_modify gewald 0.3
kspace_modify compute no
input_file: in.fourmol
pair_style: lj/switch3/coulgauss/long 8.0 2.0
pair_coeff: ! |
1 1 0.02 2.5 1.0
2 2 0.005 1.0 0.7
2 4 0.005 0.5 0.7
3 3 0.02 3.2 1.3
4 4 0.015 3.1 1.2
5 5 0.015 3.1 1.2
extract: ! |
epsilon 2
sigma 2
gamma 2
cut_coul 0
natoms: 29
init_vdwl: 749.239201392283
init_coul: 262.63137433058
init_stress: ! |2-
2.1905445805730942e+03 2.1830788072793757e+03 4.6581902800701146e+03 -7.4288115309776367e+02 2.6990012828168151e+01 6.7591505796334252e+02
init_forces: ! |2
1 -2.2440985285095003e+01 2.6839510386427128e+02 3.3548778459373403e+02
2 1.6014525975608947e+02 1.2916401608538342e+02 -1.9007855889522560e+02
3 -1.3523588460187835e+02 -3.8701969631758487e+02 -1.4563951593124975e+02
4 -8.1626375608064503e+00 2.0129840978934559e+00 -5.9838237090267477e+00
5 -3.2509810426586694e+00 -3.8006496952690405e+00 1.2238094761779506e+01
6 -8.3272100467340556e+02 9.6240884847023358e+02 1.1512799880160530e+03
7 5.9109223946129624e+01 -3.3613343492781996e+02 -1.7166010182633938e+03
8 1.4374025374023395e+02 -1.0687979059788748e+02 3.9897084761513247e+02
9 8.0822098286061347e+01 8.1693084015402164e+01 3.5446319638063176e+02
10 5.3122611725677234e+02 -6.1057993090036803e+02 -1.8379536842135653e+02
11 -3.0599394771020791e+00 -5.2185583295434022e+00 -1.0179624348800495e+01
12 1.9237456341967800e+01 1.0181865500248987e+01 -6.1597937746835436e+00
13 8.3909903723672699e+00 -3.3718280449484173e+00 -3.3038121588715319e-01
14 -4.1292661630995928e+00 9.9336707464018092e-01 -9.3350058002796388e+00
15 4.2168785095757555e-01 8.7977955328786113e+00 2.0699990715180956e+00
16 4.6411046171725997e+02 -3.3264571918035432e+02 -1.1912223271773271e+03
17 -4.5697820722395699e+02 3.2194358869766086e+02 1.2030903913181610e+03
18 -2.9720972086277636e-01 1.7565528490258597e+00 2.4294604263813859e+00
19 -2.6658339749427125e+00 -3.5543359860963246e+00 -7.0028176604540848e-01
20 2.3030703223874878e+00 1.6788085961460804e+00 8.8715814688464914e-02
21 -7.2491063430524989e+01 -8.0704358691908013e+01 2.2713112476019884e+02
22 -1.1047017798074540e+02 -2.7622195109041627e+01 -1.7106972908159221e+02
23 1.8254515612066885e+02 1.0874225091685935e+02 -5.5558584096022528e+01
24 3.7139490938880684e+01 -2.1182968679989389e+02 1.1239472278345924e+02
25 -1.5173442669154963e+02 2.2482896227152501e+01 -1.2683235954885029e+02
26 1.1404997762743471e+02 1.8910942097520967e+02 1.3865307057956501e+01
27 5.1263700969024825e+01 -2.2708329767472884e+02 9.0733209359745530e+01
28 -1.8280634435959598e+02 7.6676771027308675e+01 -1.2320543486529729e+02
29 1.3193901693998819e+02 1.5040612832512986e+02 3.2448964935598738e+01
run_vdwl: 719.395943067584
run_coul: 262.577357625246
run_stress: ! |2-
2.1439469903049130e+03 2.1388099416476502e+03 4.3901771762143671e+03 -7.2215136136852652e+02 4.3981220891989977e+01 6.3726346095247902e+02
run_forces: ! |2
1 -1.9342111296614632e+01 2.6536048036936916e+02 3.2628113020689460e+02
2 1.5478381002242270e+02 1.2483653341336152e+02 -1.8332859341112297e+02
3 -1.3348486669886435e+02 -3.7921582819403795e+02 -1.4287155661999228e+02
4 -8.1288301070929982e+00 2.0080316198654273e+00 -5.9722562656827858e+00
5 -3.2351829753164845e+00 -3.7719427860922665e+00 1.2190138978995325e+01
6 -8.0768848311420356e+02 9.2016491680294996e+02 1.0274658369925041e+03
7 5.6698550383493917e+01 -3.1122940570534678e+02 -1.5733988978986536e+03
8 1.3387241605110836e+02 -9.8275697925936129e+01 3.8773060932891792e+02
9 7.8389121495727082e+01 7.8858365413426057e+01 3.4347185476758511e+02
10 5.2128680605857573e+02 -5.9933944295277558e+02 -1.8148565911030960e+02
11 -3.0663895518130402e+00 -5.1690166614639725e+00 -1.0127704831021171e+01
12 1.9218490979542565e+01 1.0175625089829989e+01 -6.2912885237383334e+00
13 8.3443094714464650e+00 -3.3361880724739623e+00 -3.2980152351128239e-01
14 -4.0925411684752673e+00 9.7261482089301243e-01 -9.2160488176079518e+00
15 4.0396689631175081e-01 8.8125643989717197e+00 2.0895512608739368e+00
16 4.3558458306026108e+02 -3.1347365130054965e+02 -1.1153604445579856e+03
17 -4.2831293616595980e+02 3.0256033131579363e+02 1.1274168049543377e+03
18 -3.0240289244505925e-01 1.7692205043557692e+00 2.4421829464376694e+00
19 -2.6549690010635465e+00 -3.5598277436632562e+00 -6.9536112330149602e-01
20 2.2933819335528716e+00 1.6713255394851048e+00 7.9301163390346582e-02
21 -7.1399138479900728e+01 -7.8808617837125738e+01 2.2288288096726535e+02
22 -1.0872540509179575e+02 -2.7364445523270156e+01 -1.6789056923341974e+02
23 1.7970587875020576e+02 1.0659054948727307e+02 -5.4485902397030543e+01
24 3.8719492068991073e+01 -2.1018768384060851e+02 1.1276643199107306e+02
25 -1.5234502496218383e+02 2.2328379592897981e+01 -1.2741458364942766e+02
26 1.1307896673604499e+02 1.8762340967163530e+02 1.4075792400442774e+01
27 5.0253213702344411e+01 -2.2292638222448988e+02 8.8474597952361989e+01
28 -1.7928804250876811e+02 7.5155358290636585e+01 -1.2061205300179266e+02
29 1.2943333640446872e+02 1.4777042443708973e+02 3.2113607053518280e+01
...

View File

@ -0,0 +1,99 @@
---
lammps_version: 10 Mar 2021
date_generated: Thu Apr 1 12:05:32 202
epsilon: 5e-13
prerequisites: ! |
atom full
pair lj/switch3/coulgauss/long
kspace ewald
pre_commands: ! ""
post_commands: ! |
pair_modify mix arithmetic
pair_modify table 16
kspace_style ewald 1.0e-6
kspace_modify gewald 0.3
kspace_modify compute no
input_file: in.fourmol
pair_style: lj/switch3/coulgauss/long 8.0 2.0
pair_coeff: ! |
1 1 0.02 2.5 1.0
2 2 0.005 1.0 0.7
2 4 0.005 0.5 0.7
3 3 0.02 3.2 1.3
4 4 0.015 3.1 1.2
5 5 0.015 3.1 1.2
extract: ! |
epsilon 2
sigma 2
gamma 2
cut_coul 0
natoms: 29
init_vdwl: 749.239201392283
init_coul: 262.631410551483
init_stress: ! |2-
2.1905446008358158e+03 2.1830788130354440e+03 4.6581902934947393e+03 -7.4288114980317005e+02 2.6990022323315568e+01 6.7591506205400140e+02
init_forces: ! |2
1 -2.2440986789065228e+01 2.6839510344190973e+02 3.3548778280211798e+02
2 1.6014525925595575e+02 1.2916401535280644e+02 -1.9007855755707530e+02
3 -1.3523588449321372e+02 -3.8701969643290909e+02 -1.4563951605577458e+02
4 -8.1626375642225835e+00 2.0129845605828729e+00 -5.9838235187927911e+00
5 -3.2509808748500135e+00 -3.8006487477814463e+00 1.2238094996907998e+01
6 -8.3272100512926681e+02 9.6240884941333036e+02 1.1512799862203640e+03
7 5.9109223148516158e+01 -3.3613343497406407e+02 -1.7166010203250210e+03
8 1.4374025301066052e+02 -1.0687979086260394e+02 3.9897084965667705e+02
9 8.0822100084645626e+01 8.1693083424499093e+01 3.5446319827945621e+02
10 5.3122611737361080e+02 -6.1057993046376589e+02 -1.8379536902952145e+02
11 -3.0599395914956227e+00 -5.2185576282473036e+00 -1.0179624244755713e+01
12 1.9237456510724858e+01 1.0181865558167726e+01 -6.1597946782797850e+00
13 8.3909904522091470e+00 -3.3718281778746344e+00 -3.3038108557256562e-01
14 -4.1292663075103953e+00 9.9336695410995779e-01 -9.3350056582436061e+00
15 4.2168780003223016e-01 8.7977952410479840e+00 2.0699996667940117e+00
16 4.6411046291217519e+02 -3.3264572037764498e+02 -1.1912223268528312e+03
17 -4.5697820745668372e+02 3.2194358895792664e+02 1.2030903912557251e+03
18 -2.9720916995537250e-01 1.7565528041526848e+00 2.4294595600637425e+00
19 -2.6658359770891962e+00 -3.5543374045750902e+00 -7.0028189781643846e-01
20 2.3030721439983917e+00 1.6788097920639553e+00 8.8716903513438167e-02
21 -7.2491063802446362e+01 -8.0704358127081790e+01 2.2713112533044830e+02
22 -1.1047018068190837e+02 -2.7622196765220032e+01 -1.7106973071745716e+02
23 1.8254515931328083e+02 1.0874225209184637e+02 -5.5558583211276250e+01
24 3.7139491235265282e+01 -2.1182968640787311e+02 1.1239472233677957e+02
25 -1.5173442866720330e+02 2.2482894929853938e+01 -1.2683236039424271e+02
26 1.1404997991795076e+02 1.8910942242955088e+02 1.3865308691923977e+01
27 5.1263700853661504e+01 -2.2708329750901160e+02 9.0733209165823396e+01
28 -1.8280634707113845e+02 7.6676770092406045e+01 -1.2320543608135794e+02
29 1.3193901956336219e+02 1.5040612883439849e+02 3.2448966441423750e+01
run_vdwl: 719.3959430344
run_coul: 262.577390407319
run_stress: ! |2-
2.1439470065972137e+03 2.1388099427650550e+03 4.3901771876285757e+03 -7.2215135528838152e+02 4.3981227731157169e+01 6.3726346514781233e+02
run_forces: ! |2
1 -1.9342112777764044e+01 2.6536047986408227e+02 3.2628112882188066e+02
2 1.5478380987853197e+02 1.2483653254176838e+02 -1.8332859191802055e+02
3 -1.3348486656752218e+02 -3.7921582829992821e+02 -1.4287155674732023e+02
4 -8.1288300595478145e+00 2.0080320707984289e+00 -5.9722560784187575e+00
5 -3.2351826602132863e+00 -3.7719418655198664e+00 1.2190139134122882e+01
6 -8.0768848338103430e+02 9.2016491733383600e+02 1.0274658351618857e+03
7 5.6698550307468736e+01 -3.1122940556308856e+02 -1.5733989002062301e+03
8 1.3387241574644310e+02 -9.8275698627583083e+01 3.8773061254696188e+02
9 7.8389123166777367e+01 7.8858364582844956e+01 3.4347185682031875e+02
10 5.2128680625044581e+02 -5.9933944258147972e+02 -1.8148565985727146e+02
11 -3.0663897393660062e+00 -5.1690158790311020e+00 -1.0127704822035417e+01
12 1.9218491178640956e+01 1.0175625315025894e+01 -6.2912900026938683e+00
13 8.3443096072761875e+00 -3.3361882591914980e+00 -3.2980142478029900e-01
14 -4.0925412507338894e+00 9.7261457606495283e-01 -9.2160486509597419e+00
15 4.0396659601733209e-01 8.8125640821770475e+00 2.0895518255992327e+00
16 4.3558458334132916e+02 -3.1347365174745744e+02 -1.1153604446371062e+03
17 -4.2831293628122177e+02 3.0256033223226825e+02 1.1274168046352991e+03
18 -3.0240272912362937e-01 1.7692204105371876e+00 2.4421821828695935e+00
19 -2.6549708608109603e+00 -3.5598291696654596e+00 -6.9536106786938656e-01
20 2.2933837220124476e+00 1.6713266856927325e+00 7.9302040608548133e-02
21 -7.1399139014949796e+01 -7.8808617040884513e+01 2.2288288163778361e+02
22 -1.0872540740988465e+02 -2.7364447046562592e+01 -1.6789057060588300e+02
23 1.7970588157677136e+02 1.0659055047797085e+02 -5.4485901626092641e+01
24 3.8719492028250940e+01 -2.1018768371930031e+02 1.1276643093423978e+02
25 -1.5234502685835807e+02 2.2328378412375191e+01 -1.2741458439419397e+02
26 1.1307896905891306e+02 1.8762341114219453e+02 1.4075794088855011e+01
27 5.0253213439313768e+01 -2.2292638208302930e+02 8.8474597770747309e+01
28 -1.7928804514846018e+02 7.5155357340410589e+01 -1.2061205423392185e+02
29 1.2943333884079848e+02 1.4777042481467481e+02 3.2113608671625300e+01
...

View File

@ -0,0 +1,99 @@
---
lammps_version: 10 Mar 2021
date_generated: Thu Apr 1 12:40:49 202
epsilon: 7.5e-14
prerequisites: ! |
atom full
pair mm3/switch3/coulgauss/long
kspace ewald
pre_commands: ! ""
post_commands: ! |
pair_modify mix arithmetic
pair_modify table 0
kspace_style ewald 1.0e-6
kspace_modify gewald 0.3
kspace_modify compute no
input_file: in.fourmol
pair_style: mm3/switch3/coulgauss/long 8.0 2.0
pair_coeff: ! |
1 1 0.02 2.5 1.0
2 2 0.005 1.0 0.7
2 4 0.005 0.5 0.7
3 3 0.02 3.2 1.3
4 4 0.015 3.1 1.2
5 5 0.015 3.1 1.2
extract: ! |
epsilon 2
sigma 2
gamma 2
cut_coul 0
natoms: 29
init_vdwl: 38.1287498820824
init_coul: 262.63137433058
init_stress: ! |-
-9.1891442318066098e+01 -1.3287972066289731e+02 -3.2601698046780012e+02 3.0074181349476991e+01 -4.6650805915669622e+00 -8.2199038214680613e+01
init_forces: ! |2
1 2.0409906927303840e+00 -1.8543276343677643e+01 -3.5869856577020748e+01
2 -1.8468129335667530e+01 -1.7027855689261912e+01 2.0713359151753043e+01
3 1.0001881298085964e+01 5.9235891506906007e+01 2.4372336208613245e+01
4 -4.5761624241138597e+00 -9.8945397153998949e-01 -3.3785801701857485e+00
5 -3.6934402656902114e+00 -4.0696606560869748e+00 3.8826787260480975e+00
6 7.6754814037515942e+01 -9.5808744511121716e+01 -9.3227045949147495e+01
7 -2.1177649780159676e+01 2.8793163914062454e+01 1.2529350681895039e+02
8 -2.1450096176689623e+01 1.0356391751725083e+01 -2.8955420955058667e+01
9 -8.2497939748793154e+00 -1.3077027567751550e+01 -3.6173491871315754e+01
10 -5.3511691146997535e+01 6.0900974965221437e+01 1.8391821307129032e+01
11 -1.3170240621133327e+00 -3.2364695484525727e+00 -4.4029422841407655e+00
12 2.5797191091185894e+01 -7.5496414014335278e-01 -2.6346161145571760e+00
13 3.3781782842360095e+00 -7.7635850626588521e-01 -6.1835215466770443e-01
14 -2.5357285341105120e-02 9.3547318559063564e-01 -4.9468893910982210e+00
15 4.2707742121454375e+00 4.7941154645598454e+00 -1.2015244265327498e+00
16 -3.6573746563916743e+01 1.8565541369425805e+01 1.1446966549457964e+02
17 4.3913383545862132e+01 -3.3849656320211224e+01 -9.5337593733730870e+01
18 2.6570097579579910e+00 6.2826343323709564e+00 -1.0356872257658154e+00
19 -2.6993382209993975e+00 -3.5969189205658059e+00 -6.8072388138355555e-01
20 2.3243788182239480e+00 1.6918048474772680e+00 1.0886178998340870e-01
21 8.8572294982176594e+00 1.1602893199785523e+01 -3.0057630309158139e+01
22 1.2429506519553414e+01 2.1605554971279792e+00 2.1808499086967526e+01
23 -2.1432721217228789e+01 -1.3678275101206289e+01 8.4081109687741140e+00
24 -3.9016922943010681e+00 2.9074424568745080e+01 -1.3996421656066522e+01
25 1.7462841196067998e+01 -4.6818042132561875e+00 1.5548837958928004e+01
26 -1.2984517260341663e+01 -2.4211628682033979e+01 -4.8885242451183231e-01
27 -7.1989693245110757e+00 3.0862600015720503e+01 -1.2113492397573609e+01
28 2.1728885747832702e+01 -1.1241487657358419e+01 1.5185683466068600e+01
29 -1.4356735366664552e+01 -1.9712882789785066e+01 -3.0642394558798047e+00
run_vdwl: 37.7351028273436
run_coul: 262.634961661768
run_stress: ! |-
-9.3272108018189712e+01 -1.3382217126586661e+02 -3.2672293936615591e+02 2.9759545957029179e+01 -4.9209094100413031e+00 -8.2642487904188499e+01
run_forces: ! |2
1 2.0020649788635687e+00 -1.8597539511786593e+01 -3.5898845980394640e+01
2 -1.8527112215088330e+01 -1.7111766426267462e+01 2.0691354848190322e+01
3 1.0099460867786970e+01 5.9365750003142132e+01 2.4423492212473526e+01
4 -4.5756546931309785e+00 -9.8171265309239830e-01 -3.3833947541955820e+00
5 -3.6935770918861186e+00 -4.0701905608402482e+00 3.8892344342573999e+00
6 7.6571694717448139e+01 -9.5745009991872053e+01 -9.3149401161723290e+01
7 -2.1146519945476555e+01 2.8805358955193604e+01 1.2508940744689353e+02
8 -2.1038405837727929e+01 9.9856756739362105e+00 -2.8916679506818486e+01
9 -8.2725059756602182e+00 -1.3032514603603040e+01 -3.6169609418536254e+01
10 -5.3760826931047106e+01 6.1170224214358463e+01 1.8495907821099792e+01
11 -1.3253792323264064e+00 -3.2541587509559888e+00 -4.4355038136226383e+00
12 2.5785718250683153e+01 -7.4878886859791716e-01 -2.6134474044331246e+00
13 3.3829109925579108e+00 -7.7854283145617098e-01 -6.1471416338880658e-01
14 -4.1269999117458912e-02 9.3253553809356449e-01 -4.9663548861610076e+00
15 4.2930245502032669e+00 4.8016878244809185e+00 -1.2067988554549580e+00
16 -3.6783956118288792e+01 1.8760442771705005e+01 1.1514035612976591e+02
17 4.4141165055486525e+01 -3.4054760176447999e+01 -9.5996384977569576e+01
18 2.6593312590300169e+00 6.2866044197349034e+00 -1.0406390620860617e+00
19 -2.6868912576483734e+00 -3.5919428389901107e+00 -6.7199629496476021e-01
20 2.3122559534773646e+00 1.6848231900639974e+00 1.0223174367536356e-01
21 9.0047861017105912e+00 1.1657532054221129e+01 -3.0300252008113389e+01
22 1.2602723597354565e+01 2.2333302149108087e+00 2.1993415039821400e+01
23 -2.1752703090839589e+01 -1.3807398281546009e+01 8.4647717981317978e+00
24 -4.1597044706741348e+00 2.9600068810024190e+01 -1.4377966609809059e+01
25 1.8008123772533907e+01 -4.7255601865067156e+00 1.6011744232774660e+01
26 -1.3270414090792938e+01 -2.4692000422804888e+01 -5.6774111520305048e-01
27 -7.3472295182173077e+00 3.1133794558171346e+01 -1.2191686027733443e+01
28 2.2002916813161221e+01 -1.1345147346836630e+01 1.5336216642368582e+01
29 -1.4484026442375008e+01 -1.9880794776432037e+01 -3.1367163092441239e+00
...

View File

@ -0,0 +1,99 @@
---
lammps_version: 10 Mar 2021
date_generated: Thu Apr 1 12:40:49 202
epsilon: 5e-13
prerequisites: ! |
atom full
pair mm3/switch3/coulgauss/long
kspace ewald
pre_commands: ! ""
post_commands: ! |
pair_modify mix arithmetic
pair_modify table 16
kspace_style ewald 1.0e-6
kspace_modify gewald 0.3
kspace_modify compute no
input_file: in.fourmol
pair_style: mm3/switch3/coulgauss/long 8.0 2.0
pair_coeff: ! |
1 1 0.02 2.5 1.0
2 2 0.005 1.0 0.7
2 4 0.005 0.5 0.7
3 3 0.02 3.2 1.3
4 4 0.015 3.1 1.2
5 5 0.015 3.1 1.2
extract: ! |
epsilon 2
sigma 2
gamma 2
cut_coul 0
natoms: 29
init_vdwl: 38.1287498820824
init_coul: 262.631410551483
init_stress: ! |-
-9.1891422055344222e+01 -1.3287971490682878e+02 -3.2601696704317601e+02 3.0074184644070325e+01 -4.6650710964193243e+00 -8.2199034124021594e+01
init_forces: ! |2
1 2.0409891887601410e+00 -1.8543276766039128e+01 -3.5869858368636784e+01
2 -1.8468129835801221e+01 -1.7027856421838862e+01 2.0713360489903284e+01
3 1.0001881406750512e+01 5.9235891391581845e+01 2.4372336084088403e+01
4 -4.5761624275299884e+00 -9.8945350885057237e-01 -3.3785799799517919e+00
5 -3.6934400978815565e+00 -4.0696597085993824e+00 3.8826789611765924e+00
6 7.6754813581654659e+01 -9.5808743568025008e+01 -9.3227047744836440e+01
7 -2.1177650577773125e+01 2.8793163867818368e+01 1.2529350475732382e+02
8 -2.1450096906263081e+01 1.0356391487008732e+01 -2.8955418913514073e+01
9 -8.2497921762950064e+00 -1.3077028158654645e+01 -3.6173489972491325e+01
10 -5.3511691030159355e+01 6.0900975401823587e+01 1.8391820698964121e+01
11 -1.3170241765068751e+00 -3.2364688471564778e+00 -4.4029421800959856e+00
12 2.5797191259942942e+01 -7.5496408222462352e-01 -2.6346170181534139e+00
13 3.3781783640778875e+00 -7.7635863919210357e-01 -6.1835202435311720e-01
14 -2.5357429751907436e-02 9.3547306506041328e-01 -4.9468892490621892e+00
15 4.2707741612200945e+00 4.7941151727292111e+00 -1.2015238312568339e+00
16 -3.6573745369001358e+01 1.8565540172135101e+01 1.1446966581907569e+02
17 4.3913383313135455e+01 -3.3849656059945403e+01 -9.5337593796166914e+01
18 2.6570103088653938e+00 6.2826342874977836e+00 -1.0356880920834588e+00
19 -2.6993402231458812e+00 -3.5969203390445723e+00 -6.8072401315458542e-01
20 2.3243806398348510e+00 1.6918060433951427e+00 1.0886287880838207e-01
21 8.8572291262962786e+00 1.1602893764611768e+01 -3.0057629738908702e+01
22 1.2429503818390431e+01 2.1605538409495715e+00 2.1808497451102578e+01
23 -2.1432718024616804e+01 -1.3678273926219282e+01 8.4081118535203938e+00
24 -3.9016919979164766e+00 2.9074424960765882e+01 -1.3996422102746218e+01
25 1.7462839220414320e+01 -4.6818055105547502e+00 1.5548837113535589e+01
26 -1.2984514969825625e+01 -2.4211627227692777e+01 -4.8885079054435532e-01
27 -7.1989694398744213e+00 3.0862600181437756e+01 -1.2113492591495778e+01
28 2.1728883036290242e+01 -1.1241488592261051e+01 1.5185682250007966e+01
29 -1.4356732743290538e+01 -1.9712882280516450e+01 -3.0642379500547996e+00
run_vdwl: 37.735102831577
run_coul: 262.634996567417
run_stress: ! |-
-9.3272087816450096e+01 -1.3382216892660497e+02 -3.2672292496064199e+02 2.9759550012391575e+01 -4.9209020012813669e+00 -8.2642482482441096e+01
run_forces: ! |2
1 2.0020633315697571e+00 -1.8597540312576371e+01 -3.5898847150887825e+01
2 -1.8527112685977595e+01 -1.7111767435468980e+01 2.0691356245503808e+01
3 1.0099461000123771e+01 5.9365749899001820e+01 2.4423492074447349e+01
4 -4.5756545930134305e+00 -9.8171217238369679e-01 -3.3833945796207656e+00
5 -3.6935769629718820e+00 -4.0701894718259650e+00 3.8892346120926988e+00
6 7.6571693742405060e+01 -9.5745009619986718e+01 -9.3149402824851791e+01
7 -2.1146520723115522e+01 2.8805359357005347e+01 1.2508940510400312e+02
8 -2.1038406658511651e+01 9.9856753020536395e+00 -2.8916677199745425e+01
9 -8.2725040661224440e+00 -1.3032515389877304e+01 -3.6169607187530971e+01
10 -5.3760826866916233e+01 6.1170224662661617e+01 1.8495907188455345e+01
11 -1.3253793686585611e+00 -3.2541579724226799e+00 -4.4355037885599886e+00
12 2.5785718921609639e+01 -7.4878876652861359e-01 -2.6134482478760357e+00
13 3.3829110641517599e+00 -7.7854300168776425e-01 -6.1471395974905052e-01
14 -4.1270221660368221e-02 9.3253524130353482e-01 -4.9663546372704301e+00
15 4.2930244204525003e+00 4.8016875903370053e+00 -1.2067983339497499e+00
16 -3.6783955303667234e+01 1.8760441796324653e+01 1.1514035663250905e+02
17 4.4141164796979076e+01 -3.4054759175778408e+01 -9.5996385613193283e+01
18 2.6593320216432965e+00 6.2866046080770897e+00 -1.0406402388907743e+00
19 -2.6868932719674365e+00 -3.5919446222505456e+00 -6.7199643833073341e-01
20 2.3122579672731871e+00 1.6848245740968735e+00 1.0223265461108680e-01
21 9.0047857933168434e+00 1.1657532538116142e+01 -3.0300251561127794e+01
22 1.2602721079420199e+01 2.2333285795234898e+00 2.1993413545558095e+01
23 -2.1752700027690018e+01 -1.3807397168507773e+01 8.4647725463156984e+00
24 -4.1597043845955195e+00 2.9600069115788433e+01 -1.4377967328816560e+01
25 1.8008122136440438e+01 -4.7255613901672264e+00 1.6011743726111732e+01
26 -1.3270411937489305e+01 -2.4691999045812377e+01 -5.6773953378636655e-01
27 -7.3472299042491755e+00 3.1133794605717583e+01 -1.2191686159483819e+01
28 2.2002914561082278e+01 -1.1345148097691201e+01 1.5336215539418586e+01
29 -1.4484023859861420e+01 -1.9880794227041598e+01 -3.1367150853552728e+00
...

View File

@ -1,6 +1,6 @@
---
lammps_version: 24 Aug 2020
date_generated: Tue Sep 15 09:44:19 202
lammps_version: 10 Mar 2021
date_generated: Fri Apr 2 15:27:01 202
epsilon: 5e-14
prerequisites: ! |
atom full
@ -9,17 +9,22 @@ pre_commands: ! ""
post_commands: ! ""
input_file: in.fourmol
pair_style: morse 8.0
pair_coeff: ! "1 1 0.0202798941614106 2.78203488021395 2.725417159299 \n1 2 0.0101167811264648
3.9793050302425 1.90749569018897 \n1 3 0.0202934330695928 2.43948720203264 3.10711749999622
\n1 4 0.0175731334238374 2.48316585521317 3.05258880102438 \n1 5 0.0175731334238374
2.48316585521317 3.05258880102438 \n2 2 0.00503064360487288 6.98433077606902 1.08960295117864
\n2 3 0.0101296013842819 3.31380153807866 2.28919067558352 \n2 4 0.00497405122588691
14.0508902925745 0.544416409093563 \n2 5 0.00877114211614446 3.39491256196178 2.23466262511073
\n3 3 0.0203039874239943 2.17204344301477 3.48881895084762 \n3 4 0.0175825321440736
2.20660439192238 3.43428999287994 \n3 5 0.0175825321440736 2.20660439192238 3.43428999287994
\n4 4 0.0152259201379927 2.24227873774009 3.37976131582396 \n4 5 0.0152259201379927
2.24227873774009 3.37976131582396 \n5 5 0.0152259201379927 2.24227873774009 3.37976131582396
\n"
pair_coeff: ! |
1 1 0.0202798941614106 2.78203488021395 2.725417159299
1 2 0.0101167811264648 3.9793050302425 1.90749569018897
1 3 0.0202934330695928 2.43948720203264 3.10711749999622
1 4 0.0175731334238374 2.48316585521317 3.05258880102438
1 5 0.0175731334238374 2.48316585521317 3.05258880102438
2 2 0.00503064360487288 6.98433077606902 1.08960295117864
2 3 0.0101296013842819 3.31380153807866 2.28919067558352
2 4 0.00497405122588691 14.0508902925745 0.544416409093563
2 5 0.00877114211614446 3.39491256196178 2.23466262511073
3 3 0.0203039874239943 2.17204344301477 3.48881895084762
3 4 0.0175825321440736 2.20660439192238 3.43428999287994
3 5 0.0175825321440736 2.20660439192238 3.43428999287994
4 4 0.0152259201379927 2.24227873774009 3.37976131582396
4 5 0.0152259201379927 2.24227873774009 3.37976131582396
5 5 0.0152259201379927 2.24227873774009 3.37976131582396
extract: ! |
d0 2
r0 2

View File

@ -1,6 +1,6 @@
---
lammps_version: 24 Aug 2020
date_generated: Tue Sep 15 09:44:19 202
lammps_version: 10 Mar 2021
date_generated: Fri Apr 2 15:27:01 202
epsilon: 5e-14
prerequisites: ! |
atom full
@ -9,17 +9,22 @@ pre_commands: ! ""
post_commands: ! ""
input_file: in.fourmol
pair_style: morse/smooth/linear 8.0
pair_coeff: ! "1 1 0.0202798941614106 2.78203488021395 2.725417159299 \n1 2 0.0101167811264648
3.9793050302425 1.90749569018897 \n1 3 0.0202934330695928 2.43948720203264 3.10711749999622
\n1 4 0.0175731334238374 2.48316585521317 3.05258880102438 \n1 5 0.0175731334238374
2.48316585521317 3.05258880102438 \n2 2 0.00503064360487288 6.98433077606902 1.08960295117864
\n2 3 0.0101296013842819 3.31380153807866 2.28919067558352 \n2 4 0.00497405122588691
14.0508902925745 0.544416409093563 \n2 5 0.00877114211614446 3.39491256196178 2.23466262511073
\n3 3 0.0203039874239943 2.17204344301477 3.48881895084762 \n3 4 0.0175825321440736
2.20660439192238 3.43428999287994 \n3 5 0.0175825321440736 2.20660439192238 3.43428999287994
\n4 4 0.0152259201379927 2.24227873774009 3.37976131582396 \n4 5 0.0152259201379927
2.24227873774009 3.37976131582396 \n5 5 0.0152259201379927 2.24227873774009 3.37976131582396
\n"
pair_coeff: ! |
1 1 0.0202798941614106 2.78203488021395 2.725417159299
1 2 0.0101167811264648 3.9793050302425 1.90749569018897
1 3 0.0202934330695928 2.43948720203264 3.10711749999622
1 4 0.0175731334238374 2.48316585521317 3.05258880102438
1 5 0.0175731334238374 2.48316585521317 3.05258880102438
2 2 0.00503064360487288 6.98433077606902 1.08960295117864
2 3 0.0101296013842819 3.31380153807866 2.28919067558352
2 4 0.00497405122588691 14.0508902925745 0.544416409093563
2 5 0.00877114211614446 3.39491256196178 2.23466262511073
3 3 0.0203039874239943 2.17204344301477 3.48881895084762
3 4 0.0175825321440736 2.20660439192238 3.43428999287994
3 5 0.0175825321440736 2.20660439192238 3.43428999287994
4 4 0.0152259201379927 2.24227873774009 3.37976131582396
4 5 0.0152259201379927 2.24227873774009 3.37976131582396
5 5 0.0152259201379927 2.24227873774009 3.37976131582396
extract: ! |
d0 2
r0 2

View File

@ -45,14 +45,14 @@ public:
void enable_triclinic()
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("change_box all triclinic");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
}
void generate_dump(std::string dump_file, std::string dump_modify_options, int ntimesteps)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id all {} 1 {}", dump_style, dump_file));
if (!dump_modify_options.empty()) {
@ -60,7 +60,7 @@ public:
}
command(fmt::format("run {}", ntimesteps));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
}
void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file,
@ -76,7 +76,7 @@ public:
std::string text_modify_options, std::string compressed_modify_options,
int ntimesteps)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id0 all {} 1 {} {}", dump_style, text_file, text_options));
command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_file, compressed_options));
@ -89,17 +89,17 @@ public:
}
command(fmt::format("run {}", ntimesteps));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
}
std::string convert_compressed_to_text(std::string compressed_file)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
std::string converted_file = compressed_file.substr(0, compressed_file.find_last_of('.'));
std::string cmdline =
fmt::format("{} -d -c {} > {}", COMPRESS_BINARY, compressed_file, converted_file);
system(cmdline.c_str());
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
return converted_file;
}
};

File diff suppressed because it is too large Load Diff

View File

@ -32,14 +32,14 @@ class DumpAtomTest : public MeltTest {
public:
void enable_triclinic()
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("change_box all triclinic");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
}
void generate_dump(std::string dump_file, std::string dump_modify_options, int ntimesteps)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id all {} 1 {}", dump_style, dump_file));
if (!dump_modify_options.empty()) {
@ -47,13 +47,13 @@ public:
}
command(fmt::format("run {}", ntimesteps));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
}
void generate_text_and_binary_dump(std::string text_file, std::string binary_file,
std::string dump_modify_options, int ntimesteps)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id0 all {} 1 {}", dump_style, text_file));
command(fmt::format("dump id1 all {} 1 {}", dump_style, binary_file));
@ -63,15 +63,15 @@ public:
}
command(fmt::format("run {}", ntimesteps));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
}
std::string convert_binary_to_text(std::string binary_file)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
std::string cmdline = fmt::format("{} {}", BINARY2TXT_BINARY, binary_file);
system(cmdline.c_str());
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
return fmt::format("{}.txt", binary_file);
}
};
@ -504,27 +504,27 @@ TEST_F(DumpAtomTest, per_processor_multi_file_run1)
TEST_F(DumpAtomTest, dump_modify_scale_invalid)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("dump id all atom 1 dump.txt");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
TEST_FAILURE(".*Illegal dump_modify command.*", command("dump_modify id scale true"););
}
TEST_F(DumpAtomTest, dump_modify_image_invalid)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("dump id all atom 1 dump.txt");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
TEST_FAILURE(".*Illegal dump_modify command.*", command("dump_modify id image true"););
}
TEST_F(DumpAtomTest, dump_modify_invalid)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("dump id all atom 1 dump.txt");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
TEST_FAILURE(".*Illegal dump_modify command.*", command("dump_modify id true"););
}
@ -534,12 +534,12 @@ TEST_F(DumpAtomTest, write_dump)
auto reference = "dump_ref_run0.melt";
auto dump_file = "write_dump_atom_run0.melt";
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id all atom 1 {}", reference));
command("dump_modify id scale no units yes");
command("run 0");
command("write_dump all atom write_dump_atom_run*.melt modify scale no units yes");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_FILE_EXISTS(reference);
ASSERT_FILE_EXISTS(dump_file);
@ -556,12 +556,12 @@ TEST_F(DumpAtomTest, binary_write_dump)
auto reference = "dump_run0.melt.bin";
auto dump_file = "write_dump_atom_run0_p0.melt.bin";
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id all atom 1 {}", reference));
command("dump_modify id scale no units yes");
command("run 0");
command("write_dump all atom write_dump_atom_run*_p%.melt.bin modify scale no units yes");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
ASSERT_FILE_EXISTS(reference);
ASSERT_FILE_EXISTS(dump_file);

View File

@ -340,9 +340,9 @@ TEST_F(DumpAtomCompressTest, compressed_modify_bad_param)
{
if (compression_style != "atom/gz") GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt")));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*",
command("dump_modify id1 compression_level 12");
@ -353,9 +353,9 @@ TEST_F(DumpAtomCompressTest, compressed_modify_multi_bad_param)
{
if (compression_style != "atom/gz") GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt")));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*",
command("dump_modify id1 pad 3 compression_level 12");

View File

@ -30,7 +30,7 @@ public:
void generate_dump(std::string dump_file, std::string fields, std::string dump_modify_options,
int ntimesteps)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id all {} 1 {} {}", dump_style, dump_file, fields));
if (!dump_modify_options.empty()) {
@ -38,7 +38,7 @@ public:
}
command(fmt::format("run {}", ntimesteps));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
}
};
@ -54,9 +54,9 @@ TEST_F(DumpCfgTest, require_multifile)
auto fields =
"mass type xs ys zs id proc procp1 x y z ix iy iz xu yu zu xsu ysu zsu vx vy vz fx fy fz";
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id all cfg 1 {} {}", dump_file, fields));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
TEST_FAILURE(".*Dump cfg requires one snapshot per file.*", command("run 0"););
}

View File

@ -230,9 +230,9 @@ TEST_F(DumpCfgCompressTest, compressed_modify_bad_param)
if (compression_style != "cfg/gz") GTEST_SKIP();
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.cfg"), fields));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*",
command("dump_modify id1 compression_level 12");
@ -244,9 +244,9 @@ TEST_F(DumpCfgCompressTest, compressed_modify_multi_bad_param)
if (compression_style != "cfg/gz") GTEST_SKIP();
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.cfg"), fields));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*",
command("dump_modify id1 pad 3 compression_level 12");

View File

@ -30,15 +30,15 @@ class DumpCustomTest : public MeltTest {
public:
void enable_triclinic()
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("change_box all triclinic");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
}
void generate_dump(std::string dump_file, std::string fields, std::string dump_modify_options,
int ntimesteps)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id all {} 1 {} {}", dump_style, dump_file, fields));
if (!dump_modify_options.empty()) {
@ -46,14 +46,14 @@ public:
}
command(fmt::format("run {}", ntimesteps));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
}
void generate_text_and_binary_dump(std::string text_file, std::string binary_file,
std::string fields, std::string dump_modify_options,
int ntimesteps)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id0 all {} 1 {} {}", dump_style, text_file, fields));
command(fmt::format("dump id1 all {} 1 {} {}", dump_style, binary_file, fields));
@ -63,15 +63,15 @@ public:
}
command(fmt::format("run {}", ntimesteps));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
}
std::string convert_binary_to_text(std::string binary_file)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
std::string cmdline = fmt::format("{} {}", BINARY2TXT_BINARY, binary_file);
system(cmdline.c_str());
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
return fmt::format("{}.txt", binary_file);
}
};
@ -113,9 +113,9 @@ TEST_F(DumpCustomTest, thresh_run0)
TEST_F(DumpCustomTest, compute_run0)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("compute comp all property/atom x y z");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto dump_file = "dump_custom_compute_run0.melt";
auto fields = "id type x y z c_comp[1] c_comp[2] c_comp[3]";
@ -134,9 +134,9 @@ TEST_F(DumpCustomTest, compute_run0)
TEST_F(DumpCustomTest, fix_run0)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("fix numdiff all numdiff 1 0.0001");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto dump_file = "dump_custom_compute_run0.melt";
auto fields = "id x y z f_numdiff[1] f_numdiff[2] f_numdiff[3]";
@ -155,10 +155,10 @@ TEST_F(DumpCustomTest, fix_run0)
TEST_F(DumpCustomTest, custom_run0)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("fix prop all property/atom i_flag1 d_flag2");
command("compute 1 all property/atom i_flag1 d_flag2");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto dump_file = "dump_custom_custom_run0.melt";
auto fields = "id x y z i_flag1 d_flag2";
@ -242,10 +242,10 @@ TEST_F(DumpCustomTest, binary_triclinic_run1)
TEST_F(DumpCustomTest, with_variable_run1)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("compute 1 all property/atom proc");
command("variable p atom (c_1%10)+1");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto dump_file = "dump_custom_with_variable_run1.melt";
auto fields = "id type x y z v_p";

View File

@ -31,9 +31,9 @@ public:
void SetUp() override {
CompressedDumpTest::SetUp();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("compute comp all pair/local dist eng");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
}
};
@ -205,9 +205,9 @@ TEST_F(DumpLocalCompressTest, compressed_modify_bad_param)
auto fields = "index c_comp[1]";
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.local"), fields));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*",
command("dump_modify id1 compression_level 12");
@ -220,9 +220,9 @@ TEST_F(DumpLocalCompressTest, compressed_modify_multi_bad_param)
auto fields = "index c_comp[1]";
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.local"), fields));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*",
command("dump_modify id1 pad 3 compression_level 12");

View File

@ -191,9 +191,9 @@ TEST_F(DumpXYZCompressTest, compressed_modify_bad_param)
{
if (compression_style != "xyz/gz") GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt.xyz")));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*",
command("dump_modify id1 compression_level 12");
@ -204,9 +204,9 @@ TEST_F(DumpXYZCompressTest, compressed_modify_multi_bad_param)
{
if (compression_style != "xyz/gz") GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt.xyz")));
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*",
command("dump_modify id1 pad 3 compression_level 12");

View File

@ -18,6 +18,7 @@
#include "utils.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "../testing/core.h"
#include <cstring>
#include <mpi.h>
@ -28,28 +29,23 @@ using utils::split_words;
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
bool verbose = false;
class EIMPotentialFileReaderTest : public ::testing::Test {
class EIMPotentialFileReaderTest : public LAMMPSTest {
protected:
LAMMPS *lmp;
PairEIM::Setfl setfl;
static const int nelements = 9;
void SetUp() override
{
const char *args[] = {
"PotentialFileReaderTest", "-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);
lmp->input->one("units metal");
if (!verbose) ::testing::internal::GetCapturedStdout();
testbinary = "EIMPotentialFileReaderTest";
LAMMPSTest::SetUp();
ASSERT_NE(lmp, nullptr);
BEGIN_HIDE_OUTPUT();
command("units metal");
END_HIDE_OUTPUT();
// check if the prerequisite eim pair style is available
Info *info = new Info(lmp);
ASSERT_TRUE(info->has_style("pair", "eim"));
delete info;
int npair = nelements * (nelements + 1) / 2;
setfl.ielement = new int[nelements];
@ -99,17 +95,15 @@ protected:
delete[] setfl.rs;
delete[] setfl.tp;
if (!verbose) ::testing::internal::CaptureStdout();
delete lmp;
if (!verbose) ::testing::internal::GetCapturedStdout();
LAMMPSTest::TearDown();
}
};
TEST_F(EIMPotentialFileReaderTest, global_line)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
EIMPotentialFileReader reader(lmp, "ffield.eim");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
reader.get_global(&setfl);
ASSERT_DOUBLE_EQ(setfl.division, 2.0);
@ -119,9 +113,9 @@ TEST_F(EIMPotentialFileReaderTest, global_line)
TEST_F(EIMPotentialFileReaderTest, element_line_sequential)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
EIMPotentialFileReader reader(lmp, "ffield.eim");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
reader.get_element(&setfl, 0, "Li");
ASSERT_EQ(setfl.ielement[0], 3);
@ -144,9 +138,9 @@ TEST_F(EIMPotentialFileReaderTest, element_line_sequential)
TEST_F(EIMPotentialFileReaderTest, element_line_random)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
EIMPotentialFileReader reader(lmp, "ffield.eim");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
reader.get_element(&setfl, 0, "Id");
ASSERT_EQ(setfl.ielement[0], 53);
@ -160,9 +154,9 @@ TEST_F(EIMPotentialFileReaderTest, element_line_random)
TEST_F(EIMPotentialFileReaderTest, pair_line)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
EIMPotentialFileReader reader(lmp, "ffield.eim");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
reader.get_pair(&setfl, 0, "Li", "Li");
ASSERT_DOUBLE_EQ(setfl.rcutphiA[0], 6.0490e+00);
@ -183,9 +177,9 @@ TEST_F(EIMPotentialFileReaderTest, pair_line)
TEST_F(EIMPotentialFileReaderTest, pair_identical)
{
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
EIMPotentialFileReader reader(lmp, "ffield.eim");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
reader.get_pair(&setfl, 0, "Li", "Na");
reader.get_pair(&setfl, 1, "Na", "Li");

View File

@ -17,6 +17,7 @@
#include "utils.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "../testing/core.h"
#include <cstdio>
#include <mpi.h>
@ -31,43 +32,17 @@ using utils::sfgets;
using utils::sfread;
using utils::split_words;
#if defined(OMPI_MAJOR_VERSION)
const bool have_openmpi = true;
#else
const bool have_openmpi = false;
#endif
#define TEST_FAILURE(errmsg, ...) \
if (Info::has_exceptions()) { \
::testing::internal::CaptureStdout(); \
ASSERT_ANY_THROW({__VA_ARGS__}); \
auto mesg = ::testing::internal::GetCapturedStdout(); \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} else { \
if (!have_openmpi) { \
::testing::internal::CaptureStdout(); \
ASSERT_DEATH({__VA_ARGS__}, ""); \
auto mesg = ::testing::internal::GetCapturedStdout(); \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} \
}
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
bool verbose = false;
class FileOperationsTest : public ::testing::Test {
class FileOperationsTest : public LAMMPSTest {
protected:
LAMMPS *lmp;
void SetUp() override
{
const char *args[] = {"FileOperationsTest", "-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 = "FileOperationsTest";
LAMMPSTest::SetUp();
ASSERT_NE(lmp, nullptr);
FILE *fp = fopen("safe_file_read_test.txt", "wb");
ASSERT_NE(fp, nullptr);
fputs("one line\n", fp);
@ -79,9 +54,7 @@ protected:
void TearDown() override
{
if (!verbose) ::testing::internal::CaptureStdout();
delete lmp;
if (!verbose) ::testing::internal::GetCapturedStdout();
LAMMPSTest::TearDown();
remove("safe_file_read_test.txt");
}
};
@ -154,15 +127,15 @@ TEST_F(FileOperationsTest, safe_fread)
TEST_F(FileOperationsTest, logmesg)
{
char buf[8];
::testing::internal::CaptureStdout();
lmp->input->one("echo none");
::testing::internal::GetCapturedStdout();
::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
command("echo none");
END_HIDE_OUTPUT();
BEGIN_CAPTURE_OUTPUT();
utils::logmesg(lmp, "one\n");
lmp->input->one("log test_logmesg.log");
command("log test_logmesg.log");
utils::logmesg(lmp, "two\n");
lmp->input->one("log none");
std::string out = ::testing::internal::GetCapturedStdout();
command("log none");
std::string out = END_CAPTURE_OUTPUT();
memset(buf, 0, 8);
FILE *fp = fopen("test_logmesg.log", "r");
fread(buf, 1, 8, fp);
@ -177,7 +150,7 @@ int main(int argc, char **argv)
MPI_Init(&argc, &argv);
::testing::InitGoogleMock(&argc, argv);
if (have_openmpi && !LAMMPS_NS::Info::has_exceptions())
if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions())
std::cout << "Warning: using OpenMPI without exceptions. "
"Death tests will be skipped\n";

View File

@ -15,6 +15,7 @@
#include "input.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "../testing/core.h"
#include <cmath>
#include <cstring>
@ -28,41 +29,32 @@ using LAMMPS_NS::utils::split_words;
namespace LAMMPS_NS {
using ::testing::Eq;
class ImageFlagsTest : public ::testing::Test {
class ImageFlagsTest : public LAMMPSTest {
protected:
LAMMPS *lmp;
void SetUp() override
{
const char *args[] = {"ImageFlagsTest", "-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 = "ImageFlagsTest";
LAMMPSTest::SetUp();
ASSERT_NE(lmp, nullptr);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units real");
lmp->input->one("dimension 3");
lmp->input->one("region box block -2 2 -2 2 -2 2");
lmp->input->one("create_box 1 box");
lmp->input->one("create_atoms 1 single 0.0 0.0 0.0 units box");
lmp->input->one("create_atoms 1 single 1.9 -1.9 1.9999 units box");
lmp->input->one("pair_style zero 2.0");
lmp->input->one("pair_coeff * *");
lmp->input->one("mass * 1.0");
lmp->input->one("set atom 1 image -1 2 3");
lmp->input->one("set atom 2 image -2 1 -1");
lmp->input->one("write_data test_image_flags.data");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("units real");
command("dimension 3");
command("region box block -2 2 -2 2 -2 2");
command("create_box 1 box");
command("create_atoms 1 single 0.0 0.0 0.0 units box");
command("create_atoms 1 single 1.9 -1.9 1.9999 units box");
command("pair_style zero 2.0");
command("pair_coeff * *");
command("mass * 1.0");
command("set atom 1 image -1 2 3");
command("set atom 2 image -2 1 -1");
command("write_data test_image_flags.data");
END_HIDE_OUTPUT();
}
void TearDown() override
{
if (!verbose) ::testing::internal::CaptureStdout();
delete lmp;
if (!verbose) ::testing::internal::GetCapturedStdout();
LAMMPSTest::TearDown();
remove("test_image_flags.data");
}
};
@ -70,191 +62,191 @@ protected:
TEST_F(ImageFlagsTest, change_box)
{
auto image = lmp->atom->image;
int imx = (image[0] & IMGMASK) - IMGMAX;
int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
int imz = (image[0] >> IMG2BITS) - IMGMAX;
int imx = (image[0] & IMGMASK) - IMGMAX;
int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
int imz = (image[0] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx, -1);
ASSERT_EQ(imy, 2);
ASSERT_EQ(imz, 3);
ASSERT_EQ(imx,-1);
ASSERT_EQ(imy,2);
ASSERT_EQ(imz,3);
imx = (image[1] & IMGMASK) - IMGMAX;
imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[1] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx,-2);
ASSERT_EQ(imy,1);
ASSERT_EQ(imz,-1);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("change_box all boundary f p p");
if (!verbose) ::testing::internal::GetCapturedStdout();
ASSERT_EQ(imx, -2);
ASSERT_EQ(imy, 1);
ASSERT_EQ(imz, -1);
BEGIN_HIDE_OUTPUT();
command("change_box all boundary f p p");
END_HIDE_OUTPUT();
image = lmp->atom->image;
imx = (image[0] & IMGMASK) - IMGMAX;
imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[0] >> IMG2BITS) - IMGMAX;
imx = (image[0] & IMGMASK) - IMGMAX;
imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[0] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx,0);
ASSERT_EQ(imy,2);
ASSERT_EQ(imz,3);
ASSERT_EQ(imx, 0);
ASSERT_EQ(imy, 2);
ASSERT_EQ(imz, 3);
imx = (image[1] & IMGMASK) - IMGMAX;
imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[1] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx,0);
ASSERT_EQ(imy,1);
ASSERT_EQ(imz,-1);
ASSERT_EQ(imx, 0);
ASSERT_EQ(imy, 1);
ASSERT_EQ(imz, -1);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("change_box all boundary f s p");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("change_box all boundary f s p");
END_HIDE_OUTPUT();
image = lmp->atom->image;
imx = (image[0] & IMGMASK) - IMGMAX;
imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[0] >> IMG2BITS) - IMGMAX;
imx = (image[0] & IMGMASK) - IMGMAX;
imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[0] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx,0);
ASSERT_EQ(imy,0);
ASSERT_EQ(imz,3);
ASSERT_EQ(imx, 0);
ASSERT_EQ(imy, 0);
ASSERT_EQ(imz, 3);
imx = (image[1] & IMGMASK) - IMGMAX;
imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[1] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx,0);
ASSERT_EQ(imy,0);
ASSERT_EQ(imz,-1);
ASSERT_EQ(imx, 0);
ASSERT_EQ(imy, 0);
ASSERT_EQ(imz, -1);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("change_box all boundary p p m");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("change_box all boundary p p m");
END_HIDE_OUTPUT();
image = lmp->atom->image;
imx = (image[0] & IMGMASK) - IMGMAX;
imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[0] >> IMG2BITS) - IMGMAX;
imx = (image[0] & IMGMASK) - IMGMAX;
imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[0] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx,0);
ASSERT_EQ(imy,0);
ASSERT_EQ(imz,0);
ASSERT_EQ(imx, 0);
ASSERT_EQ(imy, 0);
ASSERT_EQ(imz, 0);
imx = (image[1] & IMGMASK) - IMGMAX;
imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[1] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx,0);
ASSERT_EQ(imy,0);
ASSERT_EQ(imz,0);
ASSERT_EQ(imx, 0);
ASSERT_EQ(imy, 0);
ASSERT_EQ(imz, 0);
}
TEST_F(ImageFlagsTest, read_data)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("dimension 3");
lmp->input->one("boundary p p p");
lmp->input->one("pair_style zero 2.0");
lmp->input->one("read_data test_image_flags.data");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("dimension 3");
command("boundary p p p");
command("pair_style zero 2.0");
command("read_data test_image_flags.data");
END_HIDE_OUTPUT();
auto image = lmp->atom->image;
int imx = (image[0] & IMGMASK) - IMGMAX;
int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
int imz = (image[0] >> IMG2BITS) - IMGMAX;
int imx = (image[0] & IMGMASK) - IMGMAX;
int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
int imz = (image[0] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx, -1);
ASSERT_EQ(imy, 2);
ASSERT_EQ(imz, 3);
ASSERT_EQ(imx,-1);
ASSERT_EQ(imy,2);
ASSERT_EQ(imz,3);
imx = (image[1] & IMGMASK) - IMGMAX;
imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[1] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx,-2);
ASSERT_EQ(imy,1);
ASSERT_EQ(imz,-1);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("dimension 3");
lmp->input->one("boundary f p p");
lmp->input->one("pair_style zero 2.0");
lmp->input->one("read_data test_image_flags.data");
if (!verbose) ::testing::internal::GetCapturedStdout();
ASSERT_EQ(imx, -2);
ASSERT_EQ(imy, 1);
ASSERT_EQ(imz, -1);
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("dimension 3");
command("boundary f p p");
command("pair_style zero 2.0");
command("read_data test_image_flags.data");
END_HIDE_OUTPUT();
image = lmp->atom->image;
imx = (image[0] & IMGMASK) - IMGMAX;
imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[0] >> IMG2BITS) - IMGMAX;
imx = (image[0] & IMGMASK) - IMGMAX;
imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[0] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx,0);
ASSERT_EQ(imy,2);
ASSERT_EQ(imz,3);
ASSERT_EQ(imx, 0);
ASSERT_EQ(imy, 2);
ASSERT_EQ(imz, 3);
imx = (image[1] & IMGMASK) - IMGMAX;
imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[1] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx,0);
ASSERT_EQ(imy,1);
ASSERT_EQ(imz,-1);
ASSERT_EQ(imx, 0);
ASSERT_EQ(imy, 1);
ASSERT_EQ(imz, -1);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("dimension 3");
lmp->input->one("boundary p s p");
lmp->input->one("pair_style zero 2.0");
lmp->input->one("read_data test_image_flags.data");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("dimension 3");
command("boundary p s p");
command("pair_style zero 2.0");
command("read_data test_image_flags.data");
END_HIDE_OUTPUT();
image = lmp->atom->image;
imx = (image[0] & IMGMASK) - IMGMAX;
imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[0] >> IMG2BITS) - IMGMAX;
imx = (image[0] & IMGMASK) - IMGMAX;
imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[0] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx,-1);
ASSERT_EQ(imy,0);
ASSERT_EQ(imz,3);
ASSERT_EQ(imx, -1);
ASSERT_EQ(imy, 0);
ASSERT_EQ(imz, 3);
imx = (image[1] & IMGMASK) - IMGMAX;
imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[1] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx,-2);
ASSERT_EQ(imy,0);
ASSERT_EQ(imz,-1);
ASSERT_EQ(imx, -2);
ASSERT_EQ(imy, 0);
ASSERT_EQ(imz, -1);
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("dimension 3");
lmp->input->one("boundary p p m");
lmp->input->one("pair_style zero 2.0");
lmp->input->one("read_data test_image_flags.data");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("dimension 3");
command("boundary p p m");
command("pair_style zero 2.0");
command("read_data test_image_flags.data");
END_HIDE_OUTPUT();
image = lmp->atom->image;
imx = (image[0] & IMGMASK) - IMGMAX;
imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[0] >> IMG2BITS) - IMGMAX;
imx = (image[0] & IMGMASK) - IMGMAX;
imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[0] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx,-1);
ASSERT_EQ(imy,2);
ASSERT_EQ(imz,0);
ASSERT_EQ(imx, -1);
ASSERT_EQ(imy, 2);
ASSERT_EQ(imz, 0);
imx = (image[1] & IMGMASK) - IMGMAX;
imy = (image[1] >> IMGBITS & IMGMASK) - IMGMAX;
imz = (image[1] >> IMG2BITS) - IMGMAX;
ASSERT_EQ(imx,-2);
ASSERT_EQ(imy,1);
ASSERT_EQ(imz,0);
ASSERT_EQ(imx, -2);
ASSERT_EQ(imy, 1);
ASSERT_EQ(imz, 0);
}
} // namespace LAMMPS_NS

View File

@ -19,6 +19,7 @@
#include "utils.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "../testing/core.h"
#include <cstdio>
#include <mpi.h>
@ -33,26 +34,6 @@ using utils::split_words;
#define test_name test_info_->name()
#if defined(OMPI_MAJOR_VERSION)
const bool have_openmpi = true;
#else
const bool have_openmpi = false;
#endif
#define TEST_FAILURE(errmsg, ...) \
if (Info::has_exceptions()) { \
::testing::internal::CaptureStdout(); \
ASSERT_ANY_THROW({__VA_ARGS__}); \
auto mesg = ::testing::internal::GetCapturedStdout(); \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} else { \
if (!have_openmpi) { \
::testing::internal::CaptureStdout(); \
ASSERT_DEATH({__VA_ARGS__}, ""); \
auto mesg = ::testing::internal::GetCapturedStdout(); \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} \
}
static void create_molecule_files()
{
@ -96,27 +77,21 @@ static void create_molecule_files()
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
bool verbose = false;
class MoleculeFileTest : public ::testing::Test {
class MoleculeFileTest : public LAMMPSTest {
protected:
LAMMPS *lmp;
void SetUp() override
{
const char *args[] = {"MoleculeFileTest", "-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);
create_molecule_files();
if (!verbose) ::testing::internal::GetCapturedStdout();
testbinary = "MoleculeFileTest";
LAMMPSTest::SetUp();
ASSERT_NE(lmp, nullptr);
BEGIN_HIDE_OUTPUT();
create_molecule_files();
END_HIDE_OUTPUT();
}
void TearDown() override
{
if (!verbose) ::testing::internal::CaptureStdout();
delete lmp;
if (!verbose) ::testing::internal::GetCapturedStdout();
LAMMPSTest::TearDown();
remove("h2o.mol");
remove("co2.mol");
}
@ -128,22 +103,21 @@ protected:
fputs(content.c_str(), fp);
fclose(fp);
lmp->input->one(fmt::format("molecule {} {} {}", name, file, args));
command(fmt::format("molecule {} {} {}", name, file, args));
remove(file.c_str());
}
};
TEST_F(MoleculeFileTest, nofile)
{
TEST_FAILURE(".*Cannot open molecule file nofile.mol.*",
lmp->input->one("molecule 1 nofile.mol"););
TEST_FAILURE(".*Cannot open molecule file nofile.mol.*", command("molecule 1 nofile.mol"););
}
TEST_F(MoleculeFileTest, badid)
{
TEST_FAILURE(".*Molecule template ID must have only "
"alphanumeric or underscore characters.*",
lmp->input->one("molecule @mol nofile.mol"););
command("molecule @mol nofile.mol"););
}
TEST_F(MoleculeFileTest, badargs)
@ -200,32 +174,29 @@ TEST_F(MoleculeFileTest, nospecial)
TEST_F(MoleculeFileTest, minimal)
{
::testing::internal::CaptureStdout();
BEGIN_CAPTURE_OUTPUT();
run_mol_cmd(test_name, "", "Comment\n1 atoms\n\n Coords\n\n 1 0.0 0.0 0.0\n");
auto output = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << output;
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, MatchesRegex(".*Read molecule template.*1 molecules.*1 atoms.*0 bonds.*"));
}
TEST_F(MoleculeFileTest, twomols)
{
::testing::internal::CaptureStdout();
BEGIN_CAPTURE_OUTPUT();
run_mol_cmd(test_name, "",
"Comment\n2 atoms\n\n"
" Coords\n\n 1 0.0 0.0 0.0\n 2 0.0 0.0 1.0\n"
" Molecules\n\n 1 1\n 2 2\n\n Types\n\n 1 1\n 2 2\n\n");
auto output = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << output;
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, MatchesRegex(".*Read molecule template.*2 molecules.*2 atoms "
"with max type 2.*0 bonds.*"));
}
TEST_F(MoleculeFileTest, twofiles)
{
::testing::internal::CaptureStdout();
lmp->input->one("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0");
auto output = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << output;
BEGIN_CAPTURE_OUTPUT();
command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0");
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, MatchesRegex(".*Read molecule template twomols:.*1 molecules.*3 atoms "
"with max type 2.*2 bonds with max type 1.*"
"1 angles with max type 1.*0 dihedrals.*"
@ -236,11 +207,11 @@ TEST_F(MoleculeFileTest, twofiles)
TEST_F(MoleculeFileTest, bonds)
{
::testing::internal::CaptureStdout();
lmp->input->one("atom_style bond");
lmp->input->one("region box block 0 1 0 1 0 1");
lmp->input->one("create_box 2 box bond/types 2 extra/bond/per/atom 2 "
"extra/special/per/atom 4");
BEGIN_CAPTURE_OUTPUT();
command("atom_style bond");
command("region box block 0 1 0 1 0 1");
command("create_box 2 box bond/types 2 extra/bond/per/atom 2 "
"extra/special/per/atom 4");
run_mol_cmd(test_name, "",
"Comment\n"
"4 atoms\n"
@ -258,19 +229,17 @@ TEST_F(MoleculeFileTest, bonds)
" Bonds\n\n"
" 1 1 1 2\n"
" 2 2 1 3\n\n");
auto output = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << output;
auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, MatchesRegex(".*Read molecule template.*1 molecules.*4 atoms.*type.*2.*"
"2 bonds.*type.*2.*0 angles.*"));
::testing::internal::CaptureStdout();
lmp->input->one("mass * 2.0");
lmp->input->one("create_atoms 0 single 0.5 0.5 0.5 mol bonds 67235");
output = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << output;
BEGIN_CAPTURE_OUTPUT();
command("mass * 2.0");
command("create_atoms 0 single 0.5 0.5 0.5 mol bonds 67235");
output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, MatchesRegex(".*Created 4 atoms.*"));
::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
Molecule *mol = lmp->atom->molecules[0];
ASSERT_EQ(mol->natoms, 4);
ASSERT_EQ(lmp->atom->natoms, 4);
@ -282,8 +251,7 @@ TEST_F(MoleculeFileTest, bonds)
EXPECT_DOUBLE_EQ(mol->com[2], 0.5);
EXPECT_DOUBLE_EQ(mol->maxextent, sqrt(2));
EXPECT_EQ(mol->comatom, 1);
output = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << output;
END_HIDE_OUTPUT();
}
int main(int argc, char **argv)
@ -291,7 +259,7 @@ int main(int argc, char **argv)
MPI_Init(&argc, &argv);
::testing::InitGoogleMock(&argc, argv);
if (have_openmpi && !LAMMPS_NS::Info::has_exceptions())
if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions())
std::cout << "Warning: using OpenMPI without exceptions. "
"Death tests will be skipped\n";

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,45 +43,36 @@ 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);
lmp->input->one("units metal");
lmp->input->one("dimension 3");
lmp->input->one("region box block -4 4 -4 4 -4 4");
lmp->input->one("create_box 2 box");
lmp->input->one("create_atoms 1 single -1.1 1.2 0.0 units box");
lmp->input->one("create_atoms 1 single -1.2 -1.1 0.0 units box");
lmp->input->one("create_atoms 2 single 0.9 1.0 0.0 units box");
lmp->input->one("create_atoms 2 single 1.0 -0.9 0.0 units box");
lmp->input->one("pair_style zero 4.0");
lmp->input->one("pair_coeff * *");
lmp->input->one("mass * 1.0");
lmp->input->one("write_data test_pair_unit_convert.data nocoeff");
lmp->input->one("clear");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("dimension 3");
command("region box block -4 4 -4 4 -4 4");
command("create_box 2 box");
command("create_atoms 1 single -1.1 1.2 0.0 units box");
command("create_atoms 1 single -1.2 -1.1 0.0 units box");
command("create_atoms 2 single 0.9 1.0 0.0 units box");
command("create_atoms 2 single 1.0 -0.9 0.0 units box");
command("pair_style zero 4.0");
command("pair_coeff * *");
command("mass * 1.0");
command("write_data test_pair_unit_convert.data nocoeff");
command("clear");
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");
}
};
@ -90,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style zero 6.0");
lmp->input->one("pair_coeff * *");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -107,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style zero 6.0");
lmp->input->one("pair_coeff * *");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -133,17 +125,17 @@ 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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style lj/cut 6.0");
lmp->input->one("pair_coeff * * 0.01014286346782117 2.0");
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style lj/cut 6.0");
command("pair_coeff * * 0.01014286346782117 2.0");
remove("test.table.metal");
lmp->input->one("pair_write 1 1 1000 r 0.1 6.0 test.table.metal lj_1_1");
lmp->input->one("pair_write 1 2 1000 r 0.1 6.0 test.table.metal lj_1_2");
lmp->input->one("pair_write 2 2 1000 r 0.1 6.0 test.table.metal lj_2_2");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
command("pair_write 1 1 1000 r 0.1 6.0 test.table.metal lj_1_1");
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -154,18 +146,18 @@ TEST_F(PairUnitConvertTest, lj_cut)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style lj/cut 6.0");
lmp->input->one("pair_coeff * * 0.2339 2.0");
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style lj/cut 6.0");
command("pair_coeff * * 0.2339 2.0");
remove("test.table.real");
lmp->input->one("pair_write 1 1 1000 r 0.1 6.0 test.table.real lj_1_1");
lmp->input->one("pair_write 1 2 1000 r 0.1 6.0 test.table.real lj_1_2");
lmp->input->one("pair_write 2 2 1000 r 0.1 6.0 test.table.real lj_2_2");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
command("pair_write 1 1 1000 r 0.1 6.0 test.table.real lj_1_1");
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -184,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam");
lmp->input->one("pair_coeff * * Cu_u3.eam");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -201,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam");
lmp->input->one("pair_coeff * * Cu_u3.eam");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -227,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam/alloy");
lmp->input->one("pair_coeff * * AlCu.eam.alloy Al Cu");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -244,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam/alloy");
lmp->input->one("pair_coeff * * AlCu.eam.alloy Al Cu");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -270,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam/fs");
lmp->input->one("pair_coeff * * FeP_mm.eam.fs Fe P");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -287,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam/fs");
lmp->input->one("pair_coeff * * FeP_mm.eam.fs Fe P");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -313,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam/cd");
lmp->input->one("pair_coeff * * FeCr.cdeam Cr Fe");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -330,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam/cd");
lmp->input->one("pair_coeff * * FeCr.cdeam Cr Fe");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -356,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eim");
lmp->input->one("pair_coeff * * Na Cl ffield.eim Na Cl");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -373,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eim");
lmp->input->one("pair_coeff * * Na Cl ffield.eim Na Cl");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -399,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style gw");
lmp->input->one("pair_coeff * * SiC.gw Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -416,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style gw");
lmp->input->one("pair_coeff * * SiC.gw Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -442,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style gw/zbl");
lmp->input->one("pair_coeff * * SiC.gw.zbl Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -459,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style gw/zbl");
lmp->input->one("pair_coeff * * SiC.gw.zbl Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -485,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style nb3b/harmonic");
lmp->input->one("pair_coeff * * MOH.nb3b.harmonic M O");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -502,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style nb3b/harmonic");
lmp->input->one("pair_coeff * * MOH.nb3b.harmonic M O");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -528,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style sw");
lmp->input->one("pair_coeff * * GaN.sw Ga N");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -545,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style sw");
lmp->input->one("pair_coeff * * GaN.sw Ga N");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -571,15 +563,15 @@ 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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style table linear 1000");
lmp->input->one("pair_coeff 1 1 test.table.metal lj_1_1");
lmp->input->one("pair_coeff 1 2 test.table.metal lj_1_2");
lmp->input->one("pair_coeff 2 2 test.table.metal lj_2_2");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style table linear 1000");
command("pair_coeff 1 1 test.table.metal lj_1_1");
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -590,16 +582,16 @@ TEST_F(PairUnitConvertTest, table_metal2real)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style table linear 1000");
lmp->input->one("pair_coeff 1 1 test.table.metal lj_1_1");
lmp->input->one("pair_coeff 1 2 test.table.metal lj_1_2");
lmp->input->one("pair_coeff 2 2 test.table.metal lj_2_2");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style table linear 1000");
command("pair_coeff 1 1 test.table.metal lj_1_1");
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -618,15 +610,15 @@ 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();
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style table linear 1000");
lmp->input->one("pair_coeff 1 1 test.table.real lj_1_1");
lmp->input->one("pair_coeff 1 2 test.table.real lj_1_2");
lmp->input->one("pair_coeff 2 2 test.table.real lj_2_2");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("units real");
command("read_data test_pair_unit_convert.data");
command("pair_style table linear 1000");
command("pair_coeff 1 1 test.table.real lj_1_1");
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -637,16 +629,16 @@ TEST_F(PairUnitConvertTest, table_real2metal)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style table linear 1000");
lmp->input->one("pair_coeff 1 1 test.table.real lj_1_1");
lmp->input->one("pair_coeff 1 2 test.table.real lj_1_2");
lmp->input->one("pair_coeff 2 2 test.table.real lj_2_2");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("units metal");
command("read_data test_pair_unit_convert.data");
command("pair_style table linear 1000");
command("pair_coeff 1 1 test.table.real lj_1_1");
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -665,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff");
lmp->input->one("pair_coeff * * SiC.tersoff Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -682,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff");
lmp->input->one("pair_coeff * * SiC.tersoff Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -708,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/mod");
lmp->input->one("pair_coeff * * Si.tersoff.mod Si Si");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -725,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/mod");
lmp->input->one("pair_coeff * * Si.tersoff.mod Si Si");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -751,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/mod/c");
lmp->input->one("pair_coeff * * Si.tersoff.modc Si Si");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -768,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/mod/c");
lmp->input->one("pair_coeff * * Si.tersoff.modc Si Si");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -794,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/table");
lmp->input->one("pair_coeff * * SiC.tersoff Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -811,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/table");
lmp->input->one("pair_coeff * * SiC.tersoff Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -837,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/zbl");
lmp->input->one("pair_coeff * * SiC.tersoff.zbl Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -854,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/zbl");
lmp->input->one("pair_coeff * * SiC.tersoff.zbl Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -880,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();
lmp->input->one("package omp 4");
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/zbl/omp");
lmp->input->one("pair_coeff * * SiC.tersoff.zbl Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -898,15 +890,15 @@ TEST_F(PairUnitConvertTest, tersoff_zbl_omp)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("package omp 4");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/zbl/omp");
lmp->input->one("pair_coeff * * SiC.tersoff.zbl Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("clear");
command("package omp 4");
command("units real");
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
@ -925,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();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style vashishta");
lmp->input->one("pair_coeff * * SiC.vashishta Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
// copy pressure, energy, and force from first step
double pold;
@ -942,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();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style vashishta");
lmp->input->one("pair_coeff * * SiC.vashishta Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
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");
END_HIDE_OUTPUT();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);

View File

@ -28,37 +28,17 @@
#include "potential_file_reader.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "../testing/core.h"
#include <cstring>
#include <iostream>
#include <mpi.h>
#include <vector>
#if defined(OMPI_MAJOR_VERSION)
const bool have_openmpi = true;
#else
const bool have_openmpi = false;
#endif
using namespace LAMMPS_NS;
using ::testing::MatchesRegex;
using utils::split_words;
#define TEST_FAILURE(errmsg, ...) \
if (Info::has_exceptions()) { \
::testing::internal::CaptureStdout(); \
ASSERT_ANY_THROW({__VA_ARGS__}); \
auto mesg = ::testing::internal::GetCapturedStdout(); \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} else { \
if (!have_openmpi) { \
::testing::internal::CaptureStdout(); \
ASSERT_DEATH({__VA_ARGS__}, ""); \
auto mesg = ::testing::internal::GetCapturedStdout(); \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} \
}
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
bool verbose = false;
@ -75,36 +55,16 @@ const int LAMMPS_NS::PairNb3bHarmonic::NPARAMS_PER_LINE;
const int LAMMPS_NS::PairVashishta::NPARAMS_PER_LINE;
const int LAMMPS_NS::PairTersoffTable::NPARAMS_PER_LINE;
class PotentialFileReaderTest : public ::testing::Test {
protected:
LAMMPS *lmp;
void SetUp() override
{
const char *args[] = {
"PotentialFileReaderTest", "-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();
}
void TearDown() override
{
if (!verbose) ::testing::internal::CaptureStdout();
delete lmp;
if (!verbose) ::testing::internal::GetCapturedStdout();
}
class PotentialFileReaderTest : public LAMMPSTest {
};
// open for native units
TEST_F(PotentialFileReaderTest, Sw_native)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
BEGIN_HIDE_OUTPUT();
command("units metal");
PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto line = reader.next_line(PairSW::NPARAMS_PER_LINE);
ASSERT_EQ(utils::count_words(line), PairSW::NPARAMS_PER_LINE);
@ -113,10 +73,10 @@ TEST_F(PotentialFileReaderTest, Sw_native)
// open with supported conversion enabled
TEST_F(PotentialFileReaderTest, Sw_conv)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units real");
BEGIN_HIDE_OUTPUT();
command("units real");
PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber", utils::METAL2REAL);
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto line = reader.next_line(PairSW::NPARAMS_PER_LINE);
ASSERT_EQ(utils::count_words(line), PairSW::NPARAMS_PER_LINE);
@ -125,9 +85,9 @@ TEST_F(PotentialFileReaderTest, Sw_conv)
// open without conversion enabled
TEST_F(PotentialFileReaderTest, Sw_noconv)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units real");
if (!verbose) ::testing::internal::GetCapturedStdout();
BEGIN_HIDE_OUTPUT();
command("units real");
END_HIDE_OUTPUT();
TEST_FAILURE(".*ERROR on proc.*potential.*requires metal units but real.*",
PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber", utils::REAL2METAL););
@ -135,10 +95,10 @@ TEST_F(PotentialFileReaderTest, Sw_noconv)
TEST_F(PotentialFileReaderTest, Comb)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
BEGIN_HIDE_OUTPUT();
command("units metal");
PotentialFileReader reader(lmp, "ffield.comb", "COMB");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto line = reader.next_line(PairComb::NPARAMS_PER_LINE);
ASSERT_EQ(utils::count_words(line), PairComb::NPARAMS_PER_LINE);
@ -146,10 +106,10 @@ TEST_F(PotentialFileReaderTest, Comb)
TEST_F(PotentialFileReaderTest, Comb3)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
BEGIN_HIDE_OUTPUT();
command("units metal");
PotentialFileReader reader(lmp, "ffield.comb3", "COMB3");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto line = reader.next_line(PairComb3::NPARAMS_PER_LINE);
ASSERT_EQ(utils::count_words(line), PairComb3::NPARAMS_PER_LINE);
@ -157,10 +117,10 @@ TEST_F(PotentialFileReaderTest, Comb3)
TEST_F(PotentialFileReaderTest, Tersoff)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
BEGIN_HIDE_OUTPUT();
command("units metal");
PotentialFileReader reader(lmp, "Si.tersoff", "Tersoff");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto line = reader.next_line(PairTersoff::NPARAMS_PER_LINE);
ASSERT_EQ(utils::count_words(line), PairTersoff::NPARAMS_PER_LINE);
@ -168,10 +128,10 @@ TEST_F(PotentialFileReaderTest, Tersoff)
TEST_F(PotentialFileReaderTest, TersoffMod)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
BEGIN_HIDE_OUTPUT();
command("units metal");
PotentialFileReader reader(lmp, "Si.tersoff.mod", "Tersoff/Mod");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto line = reader.next_line(PairTersoffMOD::NPARAMS_PER_LINE);
ASSERT_EQ(utils::count_words(line), PairTersoffMOD::NPARAMS_PER_LINE);
@ -179,10 +139,10 @@ TEST_F(PotentialFileReaderTest, TersoffMod)
TEST_F(PotentialFileReaderTest, TersoffModC)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
BEGIN_HIDE_OUTPUT();
command("units metal");
PotentialFileReader reader(lmp, "Si.tersoff.modc", "Tersoff/ModC");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto line = reader.next_line(PairTersoffMODC::NPARAMS_PER_LINE);
ASSERT_EQ(utils::count_words(line), PairTersoffMODC::NPARAMS_PER_LINE);
@ -190,10 +150,10 @@ TEST_F(PotentialFileReaderTest, TersoffModC)
TEST_F(PotentialFileReaderTest, TersoffTable)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
BEGIN_HIDE_OUTPUT();
command("units metal");
PotentialFileReader reader(lmp, "Si.tersoff", "TersoffTable");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto line = reader.next_line(PairTersoffTable::NPARAMS_PER_LINE);
ASSERT_EQ(utils::count_words(line), PairTersoffTable::NPARAMS_PER_LINE);
@ -201,10 +161,10 @@ TEST_F(PotentialFileReaderTest, TersoffTable)
TEST_F(PotentialFileReaderTest, TersoffZBL)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
BEGIN_HIDE_OUTPUT();
command("units metal");
PotentialFileReader reader(lmp, "SiC.tersoff.zbl", "Tersoff/ZBL");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto line = reader.next_line(PairTersoffZBL::NPARAMS_PER_LINE);
ASSERT_EQ(utils::count_words(line), PairTersoffZBL::NPARAMS_PER_LINE);
@ -212,10 +172,10 @@ TEST_F(PotentialFileReaderTest, TersoffZBL)
TEST_F(PotentialFileReaderTest, GW)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
BEGIN_HIDE_OUTPUT();
command("units metal");
PotentialFileReader reader(lmp, "SiC.gw", "GW");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto line = reader.next_line(PairGW::NPARAMS_PER_LINE);
ASSERT_EQ(utils::count_words(line), PairGW::NPARAMS_PER_LINE);
@ -223,10 +183,10 @@ TEST_F(PotentialFileReaderTest, GW)
TEST_F(PotentialFileReaderTest, GWZBL)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
BEGIN_HIDE_OUTPUT();
command("units metal");
PotentialFileReader reader(lmp, "SiC.gw.zbl", "GW/ZBL");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto line = reader.next_line(PairGWZBL::NPARAMS_PER_LINE);
ASSERT_EQ(utils::count_words(line), PairGWZBL::NPARAMS_PER_LINE);
@ -234,10 +194,10 @@ TEST_F(PotentialFileReaderTest, GWZBL)
TEST_F(PotentialFileReaderTest, Nb3bHarmonic)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units real");
BEGIN_HIDE_OUTPUT();
command("units real");
PotentialFileReader reader(lmp, "MOH.nb3b.harmonic", "NB3B Harmonic");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto line = reader.next_line(PairNb3bHarmonic::NPARAMS_PER_LINE);
ASSERT_EQ(utils::count_words(line), PairNb3bHarmonic::NPARAMS_PER_LINE);
@ -245,10 +205,10 @@ TEST_F(PotentialFileReaderTest, Nb3bHarmonic)
TEST_F(PotentialFileReaderTest, Vashishta)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
BEGIN_HIDE_OUTPUT();
command("units metal");
PotentialFileReader reader(lmp, "SiC.vashishta", "Vashishta");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
auto line = reader.next_line(PairVashishta::NPARAMS_PER_LINE);
ASSERT_EQ(utils::count_words(line), PairVashishta::NPARAMS_PER_LINE);
@ -259,38 +219,38 @@ TEST_F(PotentialFileReaderTest, UnitConvert)
PotentialFileReader *reader;
int unit_convert, flag;
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
BEGIN_HIDE_OUTPUT();
command("units metal");
reader = new PotentialFileReader(lmp, "Si.sw", "Stillinger-Weber");
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
unit_convert = reader->get_unit_convert();
ASSERT_EQ(unit_convert, 0);
delete reader;
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
flag = utils::get_supported_conversions(utils::UNKNOWN);
reader = new PotentialFileReader(lmp, "Si.sw", "Stillinger-Weber", flag);
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
unit_convert = reader->get_unit_convert();
ASSERT_EQ(unit_convert, 0);
delete reader;
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
flag = utils::get_supported_conversions(utils::ENERGY);
reader = new PotentialFileReader(lmp, "Si.sw", "Stillinger-Weber", flag);
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
unit_convert = reader->get_unit_convert();
ASSERT_EQ(unit_convert, 0);
delete reader;
if (!verbose) ::testing::internal::CaptureStdout();
BEGIN_HIDE_OUTPUT();
flag = utils::get_supported_conversions(utils::ENERGY);
lmp->input->one("units real");
command("units real");
reader = new PotentialFileReader(lmp, "Si.sw", "Stillinger-Weber", flag);
if (!verbose) ::testing::internal::GetCapturedStdout();
END_HIDE_OUTPUT();
unit_convert = reader->get_unit_convert();
ASSERT_EQ(unit_convert, utils::METAL2REAL);
@ -302,7 +262,7 @@ int main(int argc, char **argv)
MPI_Init(&argc, &argv);
::testing::InitGoogleMock(&argc, argv);
if (have_openmpi && !LAMMPS_NS::Info::has_exceptions())
if (Info::get_mpi_vendor() == "Open MPI" && !LAMMPS_NS::Info::has_exceptions())
std::cout << "Warning: using OpenMPI without exceptions. "
"Death tests will be skipped\n";

View File

@ -19,8 +19,11 @@
#include "variable.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "exceptions.h"
#include <functional>
#include <vector>
#include <string>
using namespace LAMMPS_NS;
@ -48,15 +51,43 @@ class LAMMPSTest : public ::testing::Test {
public:
void command(const std::string &line) { lmp->input->one(line.c_str()); }
void BEGIN_HIDE_OUTPUT() {
if (!verbose) ::testing::internal::CaptureStdout();
}
void END_HIDE_OUTPUT() {
if (!verbose) ::testing::internal::GetCapturedStdout();
}
void BEGIN_CAPTURE_OUTPUT() {
::testing::internal::CaptureStdout();
}
std::string END_CAPTURE_OUTPUT() {
auto output = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << output;
return output;
}
void HIDE_OUTPUT(std::function<void()> f) {
if (!verbose) ::testing::internal::CaptureStdout();
f();
try {
f();
} catch(LAMMPSException & e) {
if (!verbose) std::cout << ::testing::internal::GetCapturedStdout();
throw e;
}
if (!verbose) ::testing::internal::GetCapturedStdout();
}
std::string CAPTURE_OUTPUT(std::function<void()> f) {
::testing::internal::CaptureStdout();
f();
try {
f();
} catch(LAMMPSException & e) {
if (verbose) std::cout << ::testing::internal::GetCapturedStdout();
throw e;
}
auto output = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << output;
return output;
@ -74,20 +105,31 @@ public:
}
protected:
const char *testbinary = "LAMMPSTest";
std::string testbinary = "LAMMPSTest";
std::vector<std::string> args = {"-log", "none", "-echo", "screen", "-nocite"};
LAMMPS *lmp;
Info *info;
void SetUp() override
{
const char *args[] = {testbinary, "-log", "none", "-echo", "screen", "-nocite"};
char **argv = (char **)args;
int argc = sizeof(args) / sizeof(char *);
int argc = args.size() + 1;
char ** argv = new char*[argc];
argv[0] = utils::strdup(testbinary);
for(int i = 1; i < argc; i++) {
argv[i] = utils::strdup(args[i-1]);
}
HIDE_OUTPUT([&] {
lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
info = new Info(lmp);
});
InitSystem();
for(int i = 0; i < argc; i++) {
delete [] argv[i];
argv[i] = nullptr;
}
delete [] argv;
}
virtual void InitSystem() {}
@ -100,6 +142,7 @@ protected:
info = nullptr;
lmp = nullptr;
});
std::cout.flush();
}
};

View File

@ -112,7 +112,7 @@ TEST(Tokenizer, as_vector1)
TEST(Tokenizer, as_vector2)
{
auto list = Tokenizer("a\\b\\c","\\").as_vector();
auto list = Tokenizer("a\\b\\c", "\\").as_vector();
ASSERT_THAT(list[0], Eq("a"));
ASSERT_THAT(list[1], Eq("b"));
ASSERT_THAT(list[2], Eq("c"));
@ -121,14 +121,14 @@ TEST(Tokenizer, as_vector2)
TEST(Tokenizer, as_vector3)
{
auto list = Tokenizer ("a\\","\\").as_vector();
auto list = Tokenizer("a\\", "\\").as_vector();
ASSERT_THAT(list[0], Eq("a"));
ASSERT_EQ(list.size(), 1);
}
TEST(Tokenizer, as_vector4)
{
auto list = Tokenizer ("\\a","\\").as_vector();
auto list = Tokenizer("\\a", "\\").as_vector();
ASSERT_THAT(list[0], Eq("a"));
ASSERT_EQ(list.size(), 1);
}

View File

@ -542,10 +542,12 @@ TEST(Utils, strfind_dot)
TEST(Utils, strfind_kim)
{
ASSERT_THAT(utils::strfind("n3409jfse MO_004835508849_000 aslfjiaf",
"[MS][MO]_\\d\\d\\d+_\\d\\d\\d"), StrEq("MO_004835508849_000"));
ASSERT_THAT(
utils::strfind("n3409jfse MO_004835508849_000 aslfjiaf", "[MS][MO]_\\d\\d\\d+_\\d\\d\\d"),
StrEq("MO_004835508849_000"));
ASSERT_THAT(utils::strfind("VanDuinChakraborty_2003_CHNO__SM_107643900657_000",
"[MS][MO]_\\d\\d\\d+_\\d\\d\\d"), StrEq("SM_107643900657_000"));
"[MS][MO]_\\d\\d\\d+_\\d\\d\\d"),
StrEq("SM_107643900657_000"));
}
TEST(Utils, bounds_case1)