Merge branch 'lammps:develop' into spica-kk
This commit is contained in:
@ -99,7 +99,6 @@ add_subdirectory(c-library)
|
||||
add_subdirectory(cplusplus)
|
||||
add_subdirectory(fortran)
|
||||
add_subdirectory(python)
|
||||
add_subdirectory(tools)
|
||||
add_subdirectory(force-styles)
|
||||
|
||||
# clang-format support for test sources
|
||||
|
||||
@ -18,6 +18,12 @@ target_compile_definitions(test_library_properties PRIVATE -DTEST_INPUT_FOLDER=$
|
||||
add_test(NAME LibraryProperties COMMAND test_library_properties)
|
||||
set_tests_properties(LibraryProperties PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
|
||||
|
||||
add_executable(test_library_objects test_library_objects.cpp test_main.cpp)
|
||||
target_link_libraries(test_library_objects PRIVATE lammps GTest::GMock)
|
||||
target_compile_definitions(test_library_objects PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_test(NAME LibraryObjects COMMAND test_library_objects)
|
||||
set_tests_properties(LibraryObjects PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
|
||||
|
||||
add_executable(test_library_scatter_gather test_library_scatter_gather.cpp test_main.cpp)
|
||||
target_link_libraries(test_library_scatter_gather PRIVATE lammps GTest::GMock)
|
||||
target_compile_definitions(test_library_scatter_gather PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
@ -25,9 +25,8 @@ protected:
|
||||
|
||||
void SetUp() override
|
||||
{
|
||||
const char *args[] = {"LAMMPS_test", "-log", "none", "-echo", "screen", "-nocite",
|
||||
"-var", "x", "2", "-var", "zpos", "1.5",
|
||||
nullptr};
|
||||
const char *args[] = {"LAMMPS_test", "-log", "none", "-echo", "screen", "-nocite", "-var",
|
||||
"x", "2", "-var", "zpos", "1.5", nullptr};
|
||||
|
||||
char **argv = (char **)args;
|
||||
int argc = (sizeof(args) / sizeof(char *)) - 1;
|
||||
|
||||
@ -18,8 +18,8 @@ extern "C" {
|
||||
typedef int32_t step_t;
|
||||
typedef int32_t tag_t;
|
||||
#elif LAMMPS_SMALLBIG
|
||||
typedef int64_t step_t;
|
||||
typedef int32_t tag_t;
|
||||
using step_t = int64_t;
|
||||
using tag_t = int32_t;
|
||||
#else
|
||||
typedef int64_t step_t;
|
||||
typedef int64_t tag_t;
|
||||
@ -42,10 +42,10 @@ static void callback(void *handle, step_t timestep, int nlocal, tag_t *, double
|
||||
lammps_fix_external_set_vector(handle, "ext", 5, -1.0);
|
||||
lammps_fix_external_set_vector(handle, "ext", 6, 0.25);
|
||||
}
|
||||
double *eatom = new double[nlocal];
|
||||
double **vatom = new double *[nlocal];
|
||||
vatom[0] = new double[nlocal * 6];
|
||||
eatom[0] = 0.0;
|
||||
auto *eatom = new double[nlocal];
|
||||
auto **vatom = new double *[nlocal];
|
||||
vatom[0] = new double[nlocal * 6];
|
||||
eatom[0] = 0.0;
|
||||
vatom[0][0] = vatom[0][1] = vatom[0][2] = vatom[0][3] = vatom[0][4] = vatom[0][5] = 0.0;
|
||||
|
||||
for (int i = 1; i < nlocal; ++i) {
|
||||
@ -107,7 +107,7 @@ TEST(lammps_external, callback)
|
||||
val += *valp;
|
||||
lammps_free(valp);
|
||||
}
|
||||
double *reduce =
|
||||
auto *reduce =
|
||||
(double *)lammps_extract_compute(handle, "sum", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR);
|
||||
output = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << output;
|
||||
|
||||
@ -97,8 +97,8 @@ TEST(MPI, sub_box)
|
||||
EXPECT_EQ(boxhi[1], 2.0);
|
||||
EXPECT_EQ(boxhi[2], 2.0);
|
||||
|
||||
double *sublo = (double *)lammps_extract_global(lmp, "sublo");
|
||||
double *subhi = (double *)lammps_extract_global(lmp, "subhi");
|
||||
auto *sublo = (double *)lammps_extract_global(lmp, "sublo");
|
||||
auto *subhi = (double *)lammps_extract_global(lmp, "subhi");
|
||||
|
||||
ASSERT_NE(sublo, nullptr);
|
||||
ASSERT_NE(subhi, nullptr);
|
||||
@ -172,8 +172,8 @@ TEST(MPI, multi_partition)
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &me);
|
||||
|
||||
const char *args[] = {"LAMMPS_test", "-log", "none", "-partition", "4x1",
|
||||
"-echo", "screen", "-nocite", "-in", "none", nullptr};
|
||||
const char *args[] = {"LAMMPS_test", "-log", "none", "-partition", "4x1", "-echo",
|
||||
"screen", "-nocite", "-in", "none", nullptr};
|
||||
char **argv = (char **)args;
|
||||
int argc = (sizeof(args) / sizeof(char *)) - 1;
|
||||
void *lmp = lammps_open(argc, argv, MPI_COMM_WORLD, nullptr);
|
||||
@ -258,7 +258,7 @@ TEST_F(MPITest, size_rank)
|
||||
|
||||
TEST_F(MPITest, gather)
|
||||
{
|
||||
int64_t natoms = (int64_t)lammps_get_natoms(lmp);
|
||||
auto natoms = (int64_t)lammps_get_natoms(lmp);
|
||||
ASSERT_EQ(natoms, 32);
|
||||
int *p_nlocal = (int *)lammps_extract_global(lmp, "nlocal");
|
||||
int nlocal = *p_nlocal;
|
||||
@ -266,11 +266,11 @@ TEST_F(MPITest, gather)
|
||||
EXPECT_EQ(nlocal, 8);
|
||||
|
||||
// get the entire x on all procs
|
||||
double *x = new double[natoms * 3];
|
||||
auto *x = new double[natoms * 3];
|
||||
lammps_gather(lmp, (char *)"x", 1, 3, x);
|
||||
|
||||
int *tag = (int *)lammps_extract_atom(lmp, "id");
|
||||
double **x_local = (double **)lammps_extract_atom(lmp, "x");
|
||||
int *tag = (int *)lammps_extract_atom(lmp, "id");
|
||||
auto **x_local = (double **)lammps_extract_atom(lmp, "x");
|
||||
|
||||
// each proc checks its local atoms
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
@ -287,10 +287,10 @@ TEST_F(MPITest, gather)
|
||||
|
||||
TEST_F(MPITest, scatter)
|
||||
{
|
||||
int *p_nlocal = (int *)lammps_extract_global(lmp, "nlocal");
|
||||
int nlocal = *p_nlocal;
|
||||
double *x_orig = new double[3 * nlocal];
|
||||
double **x_local = (double **)lammps_extract_atom(lmp, "x");
|
||||
int *p_nlocal = (int *)lammps_extract_global(lmp, "nlocal");
|
||||
int nlocal = *p_nlocal;
|
||||
auto *x_orig = new double[3 * nlocal];
|
||||
auto **x_local = (double **)lammps_extract_atom(lmp, "x");
|
||||
|
||||
// make copy of original local x vector
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
@ -301,8 +301,8 @@ TEST_F(MPITest, scatter)
|
||||
}
|
||||
|
||||
// get the entire x on all procs
|
||||
int64_t natoms = (int64_t)lammps_get_natoms(lmp);
|
||||
double *x = new double[natoms * 3];
|
||||
auto natoms = (int64_t)lammps_get_natoms(lmp);
|
||||
auto *x = new double[natoms * 3];
|
||||
lammps_gather(lmp, (char *)"x", 1, 3, x);
|
||||
|
||||
// shift all coordinates by 0.001
|
||||
|
||||
215
unittest/c-library/test_library_objects.cpp
Normal file
215
unittest/c-library/test_library_objects.cpp
Normal file
@ -0,0 +1,215 @@
|
||||
// unit tests for checking and changing simulation properties through the library interface
|
||||
|
||||
#include "library.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "input.h"
|
||||
#include "lammps.h"
|
||||
#include "lmptype.h"
|
||||
#include "platform.h"
|
||||
#include "variable.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "test_main.h"
|
||||
|
||||
#define STRINGIFY(val) XSTR(val)
|
||||
#define XSTR(val) #val
|
||||
|
||||
using ::LAMMPS_NS::Atom;
|
||||
using ::LAMMPS_NS::bigint;
|
||||
using ::LAMMPS_NS::Input;
|
||||
using ::LAMMPS_NS::tagint;
|
||||
using ::LAMMPS_NS::Variable;
|
||||
using ::testing::HasSubstr;
|
||||
using ::testing::StartsWith;
|
||||
using ::testing::StrEq;
|
||||
|
||||
class LibraryObjects : public ::testing::Test {
|
||||
protected:
|
||||
void *lmp;
|
||||
Variable *variable;
|
||||
std::string INPUT_DIR = STRINGIFY(TEST_INPUT_FOLDER);
|
||||
|
||||
LibraryObjects() = default;
|
||||
~LibraryObjects() override = default;
|
||||
|
||||
void SetUp() override
|
||||
{
|
||||
const char *args[] = {"LAMMPS_test", "-log", "none",
|
||||
"-echo", "screen", "-nocite",
|
||||
"-var", "input_dir", STRINGIFY(TEST_INPUT_FOLDER),
|
||||
nullptr};
|
||||
|
||||
char **argv = (char **)args;
|
||||
int argc = (sizeof(args) / sizeof(char *)) - 1;
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
lmp = lammps_open_no_mpi(argc, argv, nullptr);
|
||||
variable = ((LAMMPS_NS::LAMMPS *)lmp)->input->variable;
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << output;
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
}
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
::testing::internal::CaptureStdout();
|
||||
lammps_close(lmp);
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_THAT(output, HasSubstr("Total wall time:"));
|
||||
if (verbose) std::cout << output;
|
||||
lmp = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(LibraryObjects, variables)
|
||||
{
|
||||
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);
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
lammps_command(lmp, "region box block 0 2 0 2 0 2");
|
||||
lammps_command(lmp, "create_box 1 box");
|
||||
lammps_command(lmp, "mass 1 3.0");
|
||||
lammps_command(lmp, "create_atoms 1 single 1.0 1.0 1.5");
|
||||
lammps_command(lmp, "create_atoms 1 single 0.2 0.1 0.1");
|
||||
lammps_command(lmp, "shell putenv TEST_VARIABLE=simpletest2");
|
||||
lammps_command(lmp, "shell putenv TEST_VARIABLE2=simpletest OTHER_VARIABLE=2");
|
||||
lammps_command(lmp, "variable one index 1 2 3 4");
|
||||
lammps_command(lmp, "variable two equal 1");
|
||||
lammps_command(lmp, "variable two equal 2");
|
||||
lammps_command(lmp, "variable three string four");
|
||||
lammps_command(lmp, "variable three string three");
|
||||
lammps_command(lmp, "variable four1 loop 4");
|
||||
lammps_command(lmp, "variable four2 loop 2 4");
|
||||
lammps_command(lmp, "variable five1 loop 100 pad");
|
||||
lammps_command(lmp, "variable five2 loop 10 200 pad");
|
||||
lammps_command(lmp, "variable six world one");
|
||||
lammps_command(lmp, "variable seven format two \"%5.2f\"");
|
||||
lammps_command(lmp, "variable eight getenv TEST_VARIABLE2");
|
||||
lammps_command(lmp, "variable eight getenv XXX");
|
||||
lammps_command(lmp, "variable nine file test_variable.file");
|
||||
lammps_command(lmp, "variable ten internal 1.0");
|
||||
lammps_command(lmp, "variable ten internal 10.0");
|
||||
lammps_command(lmp, "variable ten1 universe 1 2 3 4");
|
||||
lammps_command(lmp, "variable ten2 uloop 4");
|
||||
lammps_command(lmp, "variable ten3 uloop 4 pad");
|
||||
lammps_command(lmp, "variable ten4 vector [0,1,2,3,5,7,11]");
|
||||
lammps_command(lmp, "variable ten5 vector [0.5,1.25]");
|
||||
lammps_command(lmp, "variable dummy index 0");
|
||||
lammps_command(lmp, "variable file equal is_file(MYFILE)");
|
||||
lammps_command(lmp, "variable iswin equal is_os(^Windows)");
|
||||
lammps_command(lmp, "variable islin equal is_os(^Linux)");
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << output;
|
||||
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "unknown"), -1);
|
||||
void *ptr = lammps_extract_variable(lmp, "unknown", nullptr);
|
||||
EXPECT_EQ(ptr, nullptr);
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "one"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "one", nullptr);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("1"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "two"), LMP_VAR_EQUAL);
|
||||
ptr = lammps_extract_variable(lmp, "two", nullptr);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
EXPECT_THAT(*(double *)ptr, 2.0);
|
||||
lammps_free(ptr);
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "three"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "three", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("three"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "four1"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "four1", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("1"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "four2"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "four2", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("2"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "five1"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "five1", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("001"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "five2"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "five2", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("010"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "six"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "six", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("one"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "seven"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "seven", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq(" 2.00"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "eight"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "eight", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq(""));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "nine"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "nine", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("one"));
|
||||
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten"), LMP_VAR_EQUAL);
|
||||
ptr = lammps_extract_variable(lmp, "ten", nullptr);
|
||||
EXPECT_THAT(*(double *)ptr, 1.0);
|
||||
lammps_free(ptr);
|
||||
variable->internal_set(variable->find("ten"), 2.5);
|
||||
ptr = lammps_extract_variable(lmp, "ten", nullptr);
|
||||
EXPECT_THAT(*(double *)ptr, 2.5);
|
||||
lammps_free(ptr);
|
||||
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten1"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "ten1", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("1"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten2"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "ten2", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("1"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten3"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "ten3", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("1"));
|
||||
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten4"), LMP_VAR_VECTOR);
|
||||
ptr = lammps_extract_variable(lmp, "ten4", (const char *)1);
|
||||
auto *dptr = (double *)lammps_extract_variable(lmp, "ten4", nullptr);
|
||||
EXPECT_EQ((*(int *)ptr), 7);
|
||||
lammps_free(ptr);
|
||||
EXPECT_EQ(dptr[0], 0);
|
||||
EXPECT_EQ(dptr[4], 5);
|
||||
EXPECT_EQ(dptr[6], 11);
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten5"), LMP_VAR_VECTOR);
|
||||
ptr = lammps_extract_variable(lmp, "ten5", (const char *)1);
|
||||
dptr = (double *)lammps_extract_variable(lmp, "ten5", nullptr);
|
||||
EXPECT_EQ((*(int *)ptr), 2);
|
||||
lammps_free(ptr);
|
||||
EXPECT_EQ(dptr[0], 0.5);
|
||||
EXPECT_EQ(dptr[1], 1.25);
|
||||
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "iswin"), LMP_VAR_EQUAL);
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "islin"), LMP_VAR_EQUAL);
|
||||
#if defined(_WIN32)
|
||||
ptr = lammps_extract_variable(lmp, "iswin", NULL);
|
||||
EXPECT_THAT(*(double *)ptr, 1.0);
|
||||
lammps_free(ptr);
|
||||
ptr = lammps_extract_variable(lmp, "islin", NULL);
|
||||
EXPECT_THAT(*(double *)ptr, 0.0);
|
||||
lammps_free(ptr);
|
||||
#elif defined(__linux__)
|
||||
ptr = lammps_extract_variable(lmp, "iswin", nullptr);
|
||||
EXPECT_THAT(*(double *)ptr, 0.0);
|
||||
lammps_free(ptr);
|
||||
ptr = lammps_extract_variable(lmp, "islin", nullptr);
|
||||
EXPECT_THAT(*(double *)ptr, 1.0);
|
||||
lammps_free(ptr);
|
||||
#else
|
||||
ptr = lammps_extract_variable(lmp, "iswin", NULL);
|
||||
EXPECT_THAT(*(double *)ptr, 0.0);
|
||||
lammps_free(ptr);
|
||||
ptr = lammps_extract_variable(lmp, "islin", NULL);
|
||||
EXPECT_THAT(*(double *)ptr, 0.0);
|
||||
lammps_free(ptr);
|
||||
#endif
|
||||
|
||||
LAMMPS_NS::platform::unlink("test_variable.file");
|
||||
}
|
||||
@ -25,7 +25,7 @@ TEST(lammps_open, null_args)
|
||||
int mpi_init = 0;
|
||||
MPI_Initialized(&mpi_init);
|
||||
EXPECT_GT(mpi_init, 0);
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
EXPECT_EQ(lmp->world, MPI_COMM_WORLD);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
EXPECT_EQ(lmp->screen, stdout);
|
||||
@ -53,7 +53,7 @@ TEST(lammps_open, with_args)
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
if (verbose) std::cout << output;
|
||||
EXPECT_EQ(handle, alt_ptr);
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
// MPI STUBS uses no real communicators
|
||||
#if !defined(MPI_STUBS)
|
||||
@ -89,7 +89,7 @@ TEST(lammps_open, with_kokkos)
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
if (verbose) std::cout << output;
|
||||
EXPECT_EQ(handle, alt_ptr);
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
EXPECT_EQ(lmp->world, MPI_COMM_WORLD);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
@ -118,7 +118,7 @@ TEST(lammps_open_no_mpi, no_screen)
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.c_str(), "");
|
||||
EXPECT_EQ(handle, alt_ptr);
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
EXPECT_EQ(lmp->world, MPI_COMM_WORLD);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
@ -138,7 +138,7 @@ TEST(lammps_open_no_mpi, no_screen)
|
||||
TEST(lammps_open_no_mpi, with_omp)
|
||||
{
|
||||
if (!LAMMPS_NS::LAMMPS::is_installed_pkg("OPENMP")) GTEST_SKIP();
|
||||
const char *args[] = {"liblammps", "-pk", "omp", "2", "neigh", "no",
|
||||
const char *args[] = {"liblammps", "-pk", "omp", "2", "neigh", "no",
|
||||
"-sf", "omp", "-log", "none", "-nocite", nullptr};
|
||||
char **argv = (char **)args;
|
||||
int argc = (sizeof(args) / sizeof(char *)) - 1;
|
||||
@ -150,7 +150,7 @@ TEST(lammps_open_no_mpi, with_omp)
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
if (verbose) std::cout << output;
|
||||
EXPECT_EQ(handle, alt_ptr);
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
EXPECT_EQ(lmp->world, MPI_COMM_WORLD);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
@ -179,7 +179,7 @@ TEST(lammps_open_fortran, no_args)
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
if (verbose) std::cout << output;
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
// MPI STUBS uses no real communicators
|
||||
#if !defined(MPI_STUBS)
|
||||
@ -210,7 +210,7 @@ TEST(lammps_open_no_mpi, lammps_error)
|
||||
void *handle = lammps_open_no_mpi(argc, argv, &alt_ptr);
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(handle, alt_ptr);
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
EXPECT_EQ(lmp->world, MPI_COMM_WORLD);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
@ -226,4 +226,3 @@ TEST(lammps_open_no_mpi, lammps_error)
|
||||
output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_THAT(output, HasSubstr("WARNING: test_warning"));
|
||||
}
|
||||
|
||||
|
||||
@ -376,18 +376,18 @@ TEST_F(LibraryProperties, global)
|
||||
EXPECT_EQ((*i_ptr), 2);
|
||||
#else
|
||||
EXPECT_EQ(lammps_extract_global_datatype(lmp, "ntimestep"), LAMMPS_INT64);
|
||||
int64_t *b_ptr = (int64_t *)lammps_extract_global(lmp, "ntimestep");
|
||||
auto *b_ptr = (int64_t *)lammps_extract_global(lmp, "ntimestep");
|
||||
EXPECT_EQ((*b_ptr), 2);
|
||||
#endif
|
||||
|
||||
EXPECT_EQ(lammps_extract_global_datatype(lmp, "dt"), LAMMPS_DOUBLE);
|
||||
double *d_ptr = (double *)lammps_extract_global(lmp, "dt");
|
||||
auto *d_ptr = (double *)lammps_extract_global(lmp, "dt");
|
||||
EXPECT_DOUBLE_EQ((*d_ptr), 0.1);
|
||||
|
||||
EXPECT_EQ(lammps_extract_global_datatype(lmp, "special_lj"), LAMMPS_DOUBLE);
|
||||
EXPECT_EQ(lammps_extract_global_datatype(lmp, "special_coul"), LAMMPS_DOUBLE);
|
||||
double *special_lj = (double *)lammps_extract_global(lmp, "special_lj");
|
||||
double *special_coul = (double *)lammps_extract_global(lmp, "special_coul");
|
||||
auto *special_lj = (double *)lammps_extract_global(lmp, "special_lj");
|
||||
auto *special_coul = (double *)lammps_extract_global(lmp, "special_coul");
|
||||
EXPECT_DOUBLE_EQ(special_lj[0], 1.0);
|
||||
EXPECT_DOUBLE_EQ(special_lj[1], 0.0);
|
||||
EXPECT_DOUBLE_EQ(special_lj[2], 0.5);
|
||||
@ -418,14 +418,14 @@ TEST_F(LibraryProperties, global)
|
||||
EXPECT_EQ(map_style, Atom::MAP_ARRAY);
|
||||
EXPECT_NE(sametag, nullptr);
|
||||
|
||||
tagint *tags = (tagint *)lammps_extract_atom(lmp, "id");
|
||||
tagint sometags[] = {1, 5, 10, 15, 20};
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
int idx = lammps_map_atom(lmp, (const void *)&sometags[i]);
|
||||
EXPECT_EQ(sometags[i], tags[idx]);
|
||||
auto *tags = (tagint *)lammps_extract_atom(lmp, "id");
|
||||
const tagint sometags[] = {1, 5, 10, 15, 20};
|
||||
for (const auto &sometag : sometags) {
|
||||
int idx = lammps_map_atom(lmp, (const void *)&sometag);
|
||||
EXPECT_EQ(sometag, tags[idx]);
|
||||
int nextidx = sametag[idx];
|
||||
if (nextidx >= 0) {
|
||||
EXPECT_EQ(sometags[i], tags[nextidx]);
|
||||
EXPECT_EQ(sometag, tags[nextidx]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -467,6 +467,54 @@ TEST_F(LibraryProperties, global)
|
||||
EXPECT_EQ(map_style, Atom::MAP_ARRAY);
|
||||
};
|
||||
|
||||
TEST_F(LibraryProperties, pair1)
|
||||
{
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
lammps_command(lmp, "region box block 0 1 0 1 0 1");
|
||||
lammps_command(lmp, "create_box 3 box");
|
||||
lammps_command(lmp, "mass * 1.0");
|
||||
lammps_command(lmp, "pair_style lj/cut 3.0");
|
||||
lammps_command(lmp, "pair_coeff 1 1 1.0 1.0");
|
||||
lammps_command(lmp, "pair_coeff 2 2 1.5 2.0");
|
||||
lammps_command(lmp, "pair_coeff 3 3 1.0 3.0");
|
||||
lammps_command(lmp, "run 0 post no");
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(lammps_extract_pair_dimension(lmp, "epsilon"), 2);
|
||||
EXPECT_EQ(lammps_extract_pair_dimension(lmp, "sigma"), 2);
|
||||
EXPECT_EQ(lammps_extract_pair_dimension(lmp, "cut_coul"), -1);
|
||||
auto **sigma = (double **)lammps_extract_pair(lmp, "sigma");
|
||||
EXPECT_DOUBLE_EQ(sigma[1][1], 1.0);
|
||||
EXPECT_DOUBLE_EQ(sigma[2][2], 2.0);
|
||||
EXPECT_DOUBLE_EQ(sigma[3][3], 3.0);
|
||||
EXPECT_DOUBLE_EQ(sigma[1][2], sqrt(2.0));
|
||||
};
|
||||
|
||||
TEST_F(LibraryProperties, pair2)
|
||||
{
|
||||
if (!lammps_has_style(lmp, "pair", "coul/streitz")) GTEST_SKIP();
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
lammps_command(lmp, "units metal");
|
||||
lammps_command(lmp, "atom_style charge");
|
||||
lammps_command(lmp, "region box block 0 1 0 1 0 1");
|
||||
lammps_command(lmp, "create_box 2 box");
|
||||
lammps_command(lmp, "mass * 1.0");
|
||||
lammps_command(lmp, "pair_style coul/streitz 12.0 wolf 0.31");
|
||||
lammps_command(lmp, "pair_coeff * * AlO.streitz Al O");
|
||||
lammps_command(lmp, "run 0 post no");
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(lammps_extract_pair_dimension(lmp, "chi"), 1);
|
||||
EXPECT_EQ(lammps_extract_pair_dimension(lmp, "scale"), 2);
|
||||
EXPECT_EQ(lammps_extract_pair_dimension(lmp, "cut_coul"), 0);
|
||||
EXPECT_DOUBLE_EQ(*((double *)lammps_extract_pair(lmp, "cut_coul")), 12.0);
|
||||
auto *chi = (double *)lammps_extract_pair(lmp, "chi");
|
||||
EXPECT_DOUBLE_EQ(chi[1], 0.0);
|
||||
EXPECT_FLOAT_EQ(chi[2], 5.484763);
|
||||
auto **scale = (double **)lammps_extract_pair(lmp, "scale");
|
||||
EXPECT_DOUBLE_EQ(scale[1][1], 1.0);
|
||||
EXPECT_DOUBLE_EQ(scale[1][2], 1.0);
|
||||
EXPECT_DOUBLE_EQ(scale[2][2], 1.0);
|
||||
};
|
||||
|
||||
TEST_F(LibraryProperties, neighlist)
|
||||
{
|
||||
if (!lammps_has_style(lmp, "pair", "sw")) GTEST_SKIP();
|
||||
@ -655,7 +703,7 @@ TEST_F(AtomProperties, invalid)
|
||||
TEST_F(AtomProperties, mass)
|
||||
{
|
||||
EXPECT_EQ(lammps_extract_atom_datatype(lmp, "mass"), LAMMPS_DOUBLE);
|
||||
double *mass = (double *)lammps_extract_atom(lmp, "mass");
|
||||
auto *mass = (double *)lammps_extract_atom(lmp, "mass");
|
||||
ASSERT_NE(mass, nullptr);
|
||||
ASSERT_DOUBLE_EQ(mass[1], 3.0);
|
||||
}
|
||||
@ -663,7 +711,7 @@ TEST_F(AtomProperties, mass)
|
||||
TEST_F(AtomProperties, id)
|
||||
{
|
||||
EXPECT_EQ(lammps_extract_atom_datatype(lmp, "id"), LAMMPS_TAGINT);
|
||||
tagint *id = (tagint *)lammps_extract_atom(lmp, "id");
|
||||
auto *id = (tagint *)lammps_extract_atom(lmp, "id");
|
||||
ASSERT_NE(id, nullptr);
|
||||
ASSERT_EQ(id[0], 1);
|
||||
ASSERT_EQ(id[1], 2);
|
||||
@ -681,7 +729,7 @@ TEST_F(AtomProperties, type)
|
||||
TEST_F(AtomProperties, position)
|
||||
{
|
||||
EXPECT_EQ(lammps_extract_atom_datatype(lmp, "x"), LAMMPS_DOUBLE_2D);
|
||||
double **x = (double **)lammps_extract_atom(lmp, "x");
|
||||
auto **x = (double **)lammps_extract_atom(lmp, "x");
|
||||
ASSERT_NE(x, nullptr);
|
||||
EXPECT_DOUBLE_EQ(x[0][0], 1.0);
|
||||
EXPECT_DOUBLE_EQ(x[0][1], 1.0);
|
||||
|
||||
@ -67,7 +67,7 @@ TEST_F(GatherProperties, gather_bonds_newton_on)
|
||||
bigint nbonds = *(bigint *)lammps_extract_global(lmp, "nbonds");
|
||||
EXPECT_EQ(nbonds, 24);
|
||||
|
||||
tagint *bonds = new tagint[3 * nbonds];
|
||||
auto *bonds = new tagint[3 * nbonds];
|
||||
lammps_gather_bonds(lmp, bonds);
|
||||
|
||||
#define CHECK_BOND(idx, type, atom1, atom2) \
|
||||
@ -108,7 +108,7 @@ TEST_F(GatherProperties, gather_bonds_newton_off)
|
||||
bigint nbonds = *(bigint *)lammps_extract_global(lmp, "nbonds");
|
||||
EXPECT_EQ(nbonds, 24);
|
||||
|
||||
tagint *bonds = new tagint[3 * nbonds];
|
||||
auto *bonds = new tagint[3 * nbonds];
|
||||
lammps_gather_bonds(lmp, bonds);
|
||||
|
||||
#define CHECK_BOND(idx, type, atom1, atom2) \
|
||||
@ -149,7 +149,7 @@ TEST_F(GatherProperties, gather_angles_newton_on)
|
||||
bigint nangles = *(bigint *)lammps_extract_global(lmp, "nangles");
|
||||
EXPECT_EQ(nangles, 30);
|
||||
|
||||
tagint *angles = new tagint[4 * nangles];
|
||||
auto *angles = new tagint[4 * nangles];
|
||||
lammps_gather_angles(lmp, angles);
|
||||
|
||||
#define CHECK_ANGLE(idx, type, atom1, atom2, atom3) \
|
||||
@ -192,7 +192,7 @@ TEST_F(GatherProperties, gather_angles_newton_off)
|
||||
bigint nangles = *(bigint *)lammps_extract_global(lmp, "nangles");
|
||||
EXPECT_EQ(nangles, 30);
|
||||
|
||||
tagint *angles = new tagint[4 * nangles];
|
||||
auto *angles = new tagint[4 * nangles];
|
||||
lammps_gather_angles(lmp, angles);
|
||||
|
||||
#define CHECK_ANGLE(idx, type, atom1, atom2, atom3) \
|
||||
@ -235,7 +235,7 @@ TEST_F(GatherProperties, gather_dihedrals_newton_on)
|
||||
bigint ndihedrals = *(bigint *)lammps_extract_global(lmp, "ndihedrals");
|
||||
EXPECT_EQ(ndihedrals, 31);
|
||||
|
||||
tagint *dihedrals = new tagint[5 * ndihedrals];
|
||||
auto *dihedrals = new tagint[5 * ndihedrals];
|
||||
lammps_gather_dihedrals(lmp, dihedrals);
|
||||
|
||||
#define CHECK_DIHEDRAL(idx, type, atom1, atom2, atom3, atom4) \
|
||||
@ -276,7 +276,7 @@ TEST_F(GatherProperties, gather_dihedrals_newton_off)
|
||||
bigint ndihedrals = *(bigint *)lammps_extract_global(lmp, "ndihedrals");
|
||||
EXPECT_EQ(ndihedrals, 31);
|
||||
|
||||
tagint *dihedrals = new tagint[5 * ndihedrals];
|
||||
auto *dihedrals = new tagint[5 * ndihedrals];
|
||||
lammps_gather_dihedrals(lmp, dihedrals);
|
||||
|
||||
#define CHECK_DIHEDRAL(idx, type, atom1, atom2, atom3, atom4) \
|
||||
@ -316,7 +316,7 @@ TEST_F(GatherProperties, gather_impropers_newton_on)
|
||||
bigint nimpropers = *(bigint *)lammps_extract_global(lmp, "nimpropers");
|
||||
EXPECT_EQ(nimpropers, 2);
|
||||
|
||||
tagint *impropers = new tagint[5 * nimpropers];
|
||||
auto *impropers = new tagint[5 * nimpropers];
|
||||
lammps_gather_impropers(lmp, impropers);
|
||||
|
||||
#define CHECK_IMPROPER(idx, type, atom1, atom2, atom3, atom4) \
|
||||
@ -349,7 +349,7 @@ TEST_F(GatherProperties, gather_impropers_newton_off)
|
||||
bigint nimpropers = *(bigint *)lammps_extract_global(lmp, "nimpropers");
|
||||
EXPECT_EQ(nimpropers, 2);
|
||||
|
||||
tagint *impropers = new tagint[5 * nimpropers];
|
||||
auto *impropers = new tagint[5 * nimpropers];
|
||||
lammps_gather_impropers(lmp, impropers);
|
||||
|
||||
#define CHECK_IMPROPER(idx, type, atom1, atom2, atom3, atom4) \
|
||||
|
||||
@ -120,14 +120,14 @@ TEST_F(ComputeChunkTest, ChunkAtom)
|
||||
EXPECT_EQ(get_scalar("mols"), 6);
|
||||
EXPECT_EQ(get_scalar("types"), 5);
|
||||
|
||||
auto cbin1d = get_peratom("bin1d");
|
||||
auto cbin2d = get_peratom("bin2d");
|
||||
auto cbin3d = get_peratom("bin3d");
|
||||
auto cbinsph = get_peratom("binsph");
|
||||
auto cbincyl = get_peratom("bincyl");
|
||||
auto cmols = get_peratom("mols");
|
||||
auto ctypes = get_peratom("types");
|
||||
auto tag = get_peratom("tags");
|
||||
auto *cbin1d = get_peratom("bin1d");
|
||||
auto *cbin2d = get_peratom("bin2d");
|
||||
auto *cbin3d = get_peratom("bin3d");
|
||||
auto *cbinsph = get_peratom("binsph");
|
||||
auto *cbincyl = get_peratom("bincyl");
|
||||
auto *cmols = get_peratom("mols");
|
||||
auto *ctypes = get_peratom("types");
|
||||
auto *tag = get_peratom("tags");
|
||||
|
||||
for (int i = 0; i < natoms; ++i) {
|
||||
EXPECT_EQ(cbin1d[i], chunk1d[(int)tag[i]]);
|
||||
@ -180,16 +180,16 @@ TEST_F(ComputeChunkTest, PropertyChunk)
|
||||
command("run 0 post no");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto cprop1 = get_vector("prop1");
|
||||
auto *cprop1 = get_vector("prop1");
|
||||
EXPECT_EQ(cprop1[0], 0);
|
||||
EXPECT_EQ(cprop1[1], 7);
|
||||
EXPECT_EQ(cprop1[2], 16);
|
||||
EXPECT_EQ(cprop1[3], 6);
|
||||
EXPECT_EQ(cprop1[4], 0);
|
||||
|
||||
auto cprop2 = get_vector("prop2");
|
||||
int nempty = 0;
|
||||
int ncount = 0;
|
||||
auto *cprop2 = get_vector("prop2");
|
||||
int nempty = 0;
|
||||
int ncount = 0;
|
||||
for (int i = 0; i < 25; ++i) {
|
||||
if (cprop2[i] == 0)
|
||||
++nempty;
|
||||
@ -199,7 +199,7 @@ TEST_F(ComputeChunkTest, PropertyChunk)
|
||||
EXPECT_EQ(nempty, 17);
|
||||
EXPECT_EQ(ncount, 29);
|
||||
|
||||
auto cprop3 = get_array("prop3");
|
||||
auto *cprop3 = get_array("prop3");
|
||||
EXPECT_EQ(cprop3[0][0], 34);
|
||||
EXPECT_EQ(cprop3[1][0], 38);
|
||||
EXPECT_EQ(cprop3[2][0], 43);
|
||||
@ -250,15 +250,15 @@ TEST_F(ComputeChunkTest, ChunkComputes)
|
||||
command("fix hist2 all ave/time 1 1 1 c_tmp mode vector");
|
||||
command("run 0 post no");
|
||||
END_HIDE_OUTPUT();
|
||||
auto cang = get_array("ang");
|
||||
auto ccom = get_array("com");
|
||||
auto cdip = get_array("dip");
|
||||
auto cgyr = get_vector("gyr");
|
||||
auto cmom = get_array("mom");
|
||||
auto comg = get_array("omg");
|
||||
auto ctmp = get_vector("tmp");
|
||||
auto ctrq = get_array("trq");
|
||||
auto cvcm = get_array("vcm");
|
||||
auto *cang = get_array("ang");
|
||||
auto *ccom = get_array("com");
|
||||
auto *cdip = get_array("dip");
|
||||
auto *cgyr = get_vector("gyr");
|
||||
auto *cmom = get_array("mom");
|
||||
auto *comg = get_array("omg");
|
||||
auto *ctmp = get_vector("tmp");
|
||||
auto *ctrq = get_array("trq");
|
||||
auto *cvcm = get_array("vcm");
|
||||
EXPECT_NEAR(cang[0][0], -0.01906982, EPSILON);
|
||||
EXPECT_NEAR(cang[0][1], -0.02814532, EPSILON);
|
||||
EXPECT_NEAR(cang[0][2], -0.03357393, EPSILON);
|
||||
@ -329,7 +329,7 @@ TEST_F(ComputeChunkTest, ChunkTIP4PComputes)
|
||||
command("fix hist1 all ave/time 1 1 1 c_dip[*] mode vector");
|
||||
command("run 0 post no");
|
||||
END_HIDE_OUTPUT();
|
||||
auto cdip = get_array("dip");
|
||||
auto *cdip = get_array("dip");
|
||||
EXPECT_NEAR(cdip[0][3], 0.35912150, EPSILON);
|
||||
EXPECT_NEAR(cdip[1][3], 0.68453713, EPSILON);
|
||||
EXPECT_NEAR(cdip[2][3], 0.50272643, EPSILON);
|
||||
@ -358,11 +358,11 @@ TEST_F(ComputeChunkTest, ChunkSpreadGlobal)
|
||||
|
||||
const int natoms = lammps_get_natoms(lmp);
|
||||
|
||||
auto cgyr = get_vector("gyr");
|
||||
auto cspr = get_peratom("spr");
|
||||
auto cglb = get_peratom("glb");
|
||||
auto codd = get_peratom("odd");
|
||||
auto ctag = get_peratom("tags");
|
||||
auto *cgyr = get_vector("gyr");
|
||||
auto *cspr = get_peratom("spr");
|
||||
auto *cglb = get_peratom("glb");
|
||||
auto *codd = get_peratom("odd");
|
||||
auto *ctag = get_peratom("tags");
|
||||
|
||||
for (int i = 0; i < natoms; ++i) {
|
||||
EXPECT_EQ(cspr[i], cgyr[chunkmol[(int)ctag[i]] - 1]);
|
||||
@ -389,8 +389,8 @@ TEST_F(ComputeChunkTest, ChunkReduce)
|
||||
|
||||
const int nchunks = get_scalar("mols");
|
||||
|
||||
auto cprp = get_vector("prp");
|
||||
auto cred = get_vector("red");
|
||||
auto *cprp = get_vector("prp");
|
||||
auto *cred = get_vector("red");
|
||||
|
||||
for (int i = 0; i < nchunks; ++i)
|
||||
EXPECT_EQ(cprp[i], cred[i]);
|
||||
|
||||
@ -103,9 +103,9 @@ TEST_F(ComputeGlobalTest, Energy)
|
||||
EXPECT_NEAR(get_scalar("pr1"), 1956948.4735454607, 0.000000005);
|
||||
EXPECT_NEAR(get_scalar("pr2"), 1956916.7725807722, 0.000000005);
|
||||
EXPECT_DOUBLE_EQ(get_scalar("pr3"), 0.0);
|
||||
auto pr1 = get_vector("pr1");
|
||||
auto pr2 = get_vector("pr2");
|
||||
auto pr3 = get_vector("pr3");
|
||||
auto *pr1 = get_vector("pr1");
|
||||
auto *pr2 = get_vector("pr2");
|
||||
auto *pr3 = get_vector("pr3");
|
||||
EXPECT_NEAR(pr1[0], 2150600.9207200543, 0.000000005);
|
||||
EXPECT_NEAR(pr1[1], 1466949.7512112649, 0.000000005);
|
||||
EXPECT_NEAR(pr1[2], 2253294.7487050635, 0.000000005);
|
||||
@ -127,7 +127,7 @@ TEST_F(ComputeGlobalTest, Energy)
|
||||
|
||||
if (has_tally) {
|
||||
EXPECT_NEAR(get_scalar("pe4"), 15425.840923850392, 0.000000005);
|
||||
auto pe5 = get_vector("pe5");
|
||||
auto *pe5 = get_vector("pe5");
|
||||
EXPECT_NEAR(pe5[0], 23803.966677151559, 0.000000005);
|
||||
EXPECT_NEAR(pe5[1], -94.210004432380643, 0.000000005);
|
||||
EXPECT_NEAR(pe5[2], 115.58040355478101, 0.000000005);
|
||||
@ -177,12 +177,12 @@ TEST_F(ComputeGlobalTest, Geometry)
|
||||
command("run 0 post no");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto com1 = get_vector("com1");
|
||||
auto com2 = get_vector("com2");
|
||||
auto mu1 = get_vector("mu1");
|
||||
auto mu2 = get_vector("mu2");
|
||||
auto rg1 = get_vector("rg1");
|
||||
auto rg2 = get_vector("rg2");
|
||||
auto *com1 = get_vector("com1");
|
||||
auto *com2 = get_vector("com2");
|
||||
auto *mu1 = get_vector("mu1");
|
||||
auto *mu2 = get_vector("mu2");
|
||||
auto *rg1 = get_vector("rg1");
|
||||
auto *rg2 = get_vector("rg2");
|
||||
|
||||
EXPECT_NEAR(com1[0], 1.4300952724948282, 0.0000000005);
|
||||
EXPECT_NEAR(com1[1], -0.29759806705328351, 0.0000000005);
|
||||
@ -215,10 +215,10 @@ TEST_F(ComputeGlobalTest, Geometry)
|
||||
EXPECT_NEAR(rg2[4], -5.0315240817290841, 0.0000000005);
|
||||
EXPECT_NEAR(rg2[5], 1.1103378503822141, 0.0000000005);
|
||||
if (has_extra) {
|
||||
auto mom1 = get_vector("mom1");
|
||||
auto mom2 = get_vector("mom2");
|
||||
auto mop1 = get_vector("mop1");
|
||||
auto mop2 = get_array("mop2");
|
||||
auto *mom1 = get_vector("mom1");
|
||||
auto *mom2 = get_vector("mom2");
|
||||
auto *mop1 = get_vector("mop1");
|
||||
auto *mop2 = get_array("mop2");
|
||||
EXPECT_DOUBLE_EQ(mom1[0], 0.0054219056685341164);
|
||||
EXPECT_DOUBLE_EQ(mom1[1], -0.054897225112275558);
|
||||
EXPECT_DOUBLE_EQ(mom1[2], 0.059097392692385661);
|
||||
@ -263,11 +263,11 @@ TEST_F(ComputeGlobalTest, Reduction)
|
||||
command("run 0 post no");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto min = get_vector("min");
|
||||
auto max = get_vector("max");
|
||||
auto sum = get_vector("sum");
|
||||
auto ave = get_vector("ave");
|
||||
auto rep = get_vector("rep");
|
||||
auto *min = get_vector("min");
|
||||
auto *max = get_vector("max");
|
||||
auto *sum = get_vector("sum");
|
||||
auto *ave = get_vector("ave");
|
||||
auto *rep = get_vector("rep");
|
||||
|
||||
EXPECT_DOUBLE_EQ(get_scalar("chg"), 0.51000000000000001);
|
||||
|
||||
@ -318,13 +318,13 @@ TEST_F(ComputeGlobalTest, Counts)
|
||||
command("run 0 post no");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto tsum = get_vector("tsum");
|
||||
auto tcnt = get_vector("tcnt");
|
||||
auto bcnt = get_vector("bcnt");
|
||||
auto bbrk = get_scalar("bcnt");
|
||||
auto acnt = get_vector("acnt");
|
||||
auto dcnt = get_vector("dcnt");
|
||||
auto icnt = get_vector("icnt");
|
||||
auto *tsum = get_vector("tsum");
|
||||
auto *tcnt = get_vector("tcnt");
|
||||
auto *bcnt = get_vector("bcnt");
|
||||
auto bbrk = get_scalar("bcnt");
|
||||
auto *acnt = get_vector("acnt");
|
||||
auto *dcnt = get_vector("dcnt");
|
||||
auto *icnt = get_vector("icnt");
|
||||
|
||||
EXPECT_DOUBLE_EQ(tsum[0], tcnt[0]);
|
||||
EXPECT_DOUBLE_EQ(tsum[1], tcnt[1]);
|
||||
|
||||
@ -341,9 +341,9 @@ TEST_F(GroupTest, VariableFunctions)
|
||||
int three = group->find("three");
|
||||
int four = group->find("four");
|
||||
|
||||
auto right = domain->get_region_by_id("right");
|
||||
auto left = domain->get_region_by_id("left");
|
||||
auto top = domain->get_region_by_id("top");
|
||||
auto *right = domain->get_region_by_id("right");
|
||||
auto *left = domain->get_region_by_id("left");
|
||||
auto *top = domain->get_region_by_id("top");
|
||||
|
||||
EXPECT_EQ(group->count_all(), 64);
|
||||
EXPECT_EQ(group->count(one), 16);
|
||||
|
||||
@ -106,7 +106,7 @@ TEST_F(LabelMapTest, Atoms)
|
||||
EXPECT_EQ(utils::expand_type(FLERR, "**", Atom::ATOM, lmp), nullptr);
|
||||
EXPECT_EQ(utils::expand_type(FLERR, "1*2*", Atom::ATOM, lmp), nullptr);
|
||||
|
||||
auto expanded = utils::expand_type(FLERR, "C1", Atom::ATOM, lmp);
|
||||
auto *expanded = utils::expand_type(FLERR, "C1", Atom::ATOM, lmp);
|
||||
EXPECT_THAT(expanded, StrEq("1"));
|
||||
delete[] expanded;
|
||||
expanded = utils::expand_type(FLERR, "O#", Atom::ATOM, lmp);
|
||||
@ -268,7 +268,7 @@ TEST_F(LabelMapTest, Topology)
|
||||
EXPECT_EQ(atom->lmap->find("N2'-C1\"-N2'", Atom::BOND), -1);
|
||||
platform::unlink("labelmap_topology.inc");
|
||||
|
||||
auto expanded = utils::expand_type(FLERR, "N2'", Atom::ATOM, lmp);
|
||||
auto *expanded = utils::expand_type(FLERR, "N2'", Atom::ATOM, lmp);
|
||||
EXPECT_THAT(expanded, StrEq("2"));
|
||||
delete[] expanded;
|
||||
expanded = utils::expand_type(FLERR, "[C1][C1]", Atom::BOND, lmp);
|
||||
|
||||
@ -54,7 +54,7 @@ TEST_F(LatticeRegionTest, lattice_none)
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("lattice none 2.0");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::NONE);
|
||||
ASSERT_EQ(lattice->xlattice, 2.0);
|
||||
ASSERT_EQ(lattice->ylattice, 2.0);
|
||||
@ -84,7 +84,7 @@ TEST_F(LatticeRegionTest, lattice_sc)
|
||||
auto output = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(output, ContainsRegex(".*Lattice spacing in x,y,z = 1.5.* 2.* 3.*"));
|
||||
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->xlattice, 1.5);
|
||||
ASSERT_EQ(lattice->ylattice, 2.0);
|
||||
ASSERT_EQ(lattice->zlattice, 3.0);
|
||||
@ -152,7 +152,7 @@ TEST_F(LatticeRegionTest, lattice_bcc)
|
||||
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;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::BCC);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, sqrt(2.0) * 4.2);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, sqrt(2.0) * 4.2);
|
||||
@ -177,7 +177,7 @@ TEST_F(LatticeRegionTest, lattice_fcc)
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("lattice fcc 3.5 origin 0.5 0.5 0.5");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::FCC);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, 3.5);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, 3.5);
|
||||
@ -215,7 +215,7 @@ TEST_F(LatticeRegionTest, lattice_hcp)
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("lattice hcp 3.0 orient z 0 0 1");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::HCP);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, 3.0);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, 3.0 * sqrt(3.0));
|
||||
@ -259,7 +259,7 @@ TEST_F(LatticeRegionTest, lattice_diamond)
|
||||
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;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::DIAMOND);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, 6.6952719636073539);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, 5.7982756057296889);
|
||||
@ -312,7 +312,7 @@ TEST_F(LatticeRegionTest, lattice_sq)
|
||||
command("dimension 2");
|
||||
command("lattice sq 3.0");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::SQ);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, 3.0);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, 3.0);
|
||||
@ -338,7 +338,7 @@ TEST_F(LatticeRegionTest, lattice_sq2)
|
||||
command("dimension 2");
|
||||
command("lattice sq2 2.0");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::SQ2);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, 2.0);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, 2.0);
|
||||
@ -364,7 +364,7 @@ TEST_F(LatticeRegionTest, lattice_hex)
|
||||
command("dimension 2");
|
||||
command("lattice hex 2.0");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::HEX);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, 2.0);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, 3.4641016151377544);
|
||||
@ -414,7 +414,7 @@ TEST_F(LatticeRegionTest, lattice_custom)
|
||||
"basis $t 0.0 0.125 "
|
||||
"basis $f 0.5 0.125 ");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::CUSTOM);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, 4.34);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, 4.34 * sqrt(3.0));
|
||||
@ -499,7 +499,7 @@ TEST_F(LatticeRegionTest, region_block_lattice)
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
ASSERT_EQ(lmp->domain->triclinic, 0);
|
||||
auto x = lmp->atom->x;
|
||||
auto *x = lmp->atom->x;
|
||||
ASSERT_EQ(lmp->atom->natoms, 8);
|
||||
ASSERT_DOUBLE_EQ(x[0][0], 0.0);
|
||||
ASSERT_DOUBLE_EQ(x[0][1], 0.0);
|
||||
@ -525,7 +525,7 @@ TEST_F(LatticeRegionTest, region_block_box)
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->domain->triclinic, 0);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto *x = lmp->atom->x;
|
||||
ASSERT_EQ(lmp->atom->natoms, 1);
|
||||
ASSERT_DOUBLE_EQ(x[0][0], 1.125);
|
||||
ASSERT_DOUBLE_EQ(x[0][1], 1.125);
|
||||
|
||||
@ -80,7 +80,7 @@ TEST_F(RegionTest, NoBox)
|
||||
list = domain->get_region_list();
|
||||
EXPECT_EQ(list.size(), 9);
|
||||
|
||||
auto reg = domain->get_region_by_id("reg1");
|
||||
auto *reg = domain->get_region_by_id("reg1");
|
||||
EXPECT_EQ(reg->interior, 1);
|
||||
EXPECT_EQ(reg->scaleflag, 1);
|
||||
EXPECT_EQ(reg->bboxflag, 1);
|
||||
@ -231,17 +231,17 @@ TEST_F(RegionTest, Counts)
|
||||
command("region reg10 prism 0 5 0 5 -5 5 0.0 0.0 0.0"); // same as block
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto x = atom->x;
|
||||
auto reg1 = domain->get_region_by_id("reg1");
|
||||
auto reg2 = domain->get_region_by_id("reg2");
|
||||
auto reg3 = domain->get_region_by_id("reg3");
|
||||
auto reg4 = domain->get_region_by_id("reg4");
|
||||
auto reg5 = domain->get_region_by_id("reg5");
|
||||
auto reg6 = domain->get_region_by_id("reg6");
|
||||
auto reg7 = domain->get_region_by_id("reg7");
|
||||
auto reg8 = domain->get_region_by_id("reg8");
|
||||
auto reg9 = domain->get_region_by_id("reg9");
|
||||
auto reg10 = domain->get_region_by_id("reg10");
|
||||
auto *x = atom->x;
|
||||
auto *reg1 = domain->get_region_by_id("reg1");
|
||||
auto *reg2 = domain->get_region_by_id("reg2");
|
||||
auto *reg3 = domain->get_region_by_id("reg3");
|
||||
auto *reg4 = domain->get_region_by_id("reg4");
|
||||
auto *reg5 = domain->get_region_by_id("reg5");
|
||||
auto *reg6 = domain->get_region_by_id("reg6");
|
||||
auto *reg7 = domain->get_region_by_id("reg7");
|
||||
auto *reg8 = domain->get_region_by_id("reg8");
|
||||
auto *reg9 = domain->get_region_by_id("reg9");
|
||||
auto *reg10 = domain->get_region_by_id("reg10");
|
||||
int count1, count2, count3, count4, count5, count6, count7, count8, count9, count10;
|
||||
count1 = count2 = count3 = count4 = count5 = count6 = count7 = count8 = count9 = count10 = 0;
|
||||
reg1->prematch();
|
||||
|
||||
@ -56,7 +56,7 @@ TEST_F(ResetAtomsIDTest, MolIDAll)
|
||||
{
|
||||
if (lmp->atom->natoms == 0) GTEST_SKIP();
|
||||
|
||||
auto molid = lmp->atom->molecule;
|
||||
auto *molid = lmp->atom->molecule;
|
||||
ASSERT_EQ(molid[GETIDX(1)], 1);
|
||||
ASSERT_EQ(molid[GETIDX(2)], 1);
|
||||
ASSERT_EQ(molid[GETIDX(3)], 1);
|
||||
@ -128,7 +128,7 @@ TEST_F(ResetAtomsIDTest, DeletePlusAtomID)
|
||||
{
|
||||
if (lmp->atom->natoms == 0) GTEST_SKIP();
|
||||
|
||||
auto molid = lmp->atom->molecule;
|
||||
auto *molid = lmp->atom->molecule;
|
||||
|
||||
// delete two water molecules
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
@ -206,7 +206,7 @@ TEST_F(ResetAtomsIDTest, PartialOffset)
|
||||
{
|
||||
if (lmp->atom->natoms == 0) GTEST_SKIP();
|
||||
|
||||
auto molid = lmp->atom->molecule;
|
||||
auto *molid = lmp->atom->molecule;
|
||||
|
||||
// delete two water molecules
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
@ -286,7 +286,7 @@ TEST_F(ResetAtomsIDTest, DeleteAdd)
|
||||
{
|
||||
if (lmp->atom->natoms == 0) GTEST_SKIP();
|
||||
|
||||
auto molid = lmp->atom->molecule;
|
||||
auto *molid = lmp->atom->molecule;
|
||||
|
||||
// delete two water molecules
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
@ -445,12 +445,12 @@ TEST_F(ResetAtomsIDTest, TopologyData)
|
||||
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);
|
||||
|
||||
@ -85,7 +85,7 @@ TEST_F(SetTest, NoBoxNoAtoms)
|
||||
command("create_atoms 1 single 0.5 0.5 0.5");
|
||||
command("compute 0 all property/atom proc");
|
||||
END_HIDE_OUTPUT();
|
||||
auto compute = lmp->modify->get_compute_by_id("0");
|
||||
auto *compute = lmp->modify->get_compute_by_id("0");
|
||||
compute->compute_peratom();
|
||||
ASSERT_EQ(compute->vector_atom[0], 0);
|
||||
|
||||
@ -119,7 +119,7 @@ TEST_F(SetTest, StylesTypes)
|
||||
command("compute 1 all property/atom id type mol");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto compute = lmp->modify->get_compute_by_id("1");
|
||||
auto *compute = lmp->modify->get_compute_by_id("1");
|
||||
ASSERT_NE(compute, nullptr);
|
||||
compute->compute_peratom();
|
||||
|
||||
@ -409,7 +409,7 @@ TEST_F(SetTest, EffPackage)
|
||||
command("compute 2 all property/atom espin eradius");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto compute = lmp->modify->get_compute_by_id("2");
|
||||
auto *compute = lmp->modify->get_compute_by_id("2");
|
||||
ASSERT_NE(compute, nullptr);
|
||||
compute->compute_peratom();
|
||||
|
||||
|
||||
@ -157,6 +157,7 @@ TEST_F(VariableTest, CreateDelete)
|
||||
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("five2"), StrEq("010"));
|
||||
ASSERT_THAT(variable->retrieve("seven"), StrEq(" 2.00"));
|
||||
ASSERT_THAT(variable->retrieve("ten"), StrEq("1"));
|
||||
ASSERT_THAT(variable->retrieve("eight"), StrEq(""));
|
||||
@ -388,8 +389,9 @@ TEST_F(VariableTest, Expressions)
|
||||
command("print \"${err2}\""););
|
||||
TEST_FAILURE(".*ERROR on proc 0: Variable err3: Invalid power expression in variable formula.*",
|
||||
command("print \"${err3}\""););
|
||||
TEST_FAILURE(".*ERROR: Variable one: Mis-matched special function variable in variable formula.*",
|
||||
command("print \"${isrt}\""););
|
||||
TEST_FAILURE(
|
||||
".*ERROR: Variable one: Mis-matched special function variable in variable formula.*",
|
||||
command("print \"${isrt}\""););
|
||||
TEST_FAILURE(".*ERROR: Variable vec4: index 11 exceeds vector size of 10.*",
|
||||
command("print \"${xxxl}\""););
|
||||
}
|
||||
|
||||
@ -22,9 +22,9 @@ protected:
|
||||
LAMMPS *lmp;
|
||||
Input_commands()
|
||||
{
|
||||
const char * args[] = {"LAMMPS_test", nullptr};
|
||||
char ** argv = (char**)args;
|
||||
int argc = 1;
|
||||
const char *args[] = {"LAMMPS_test", nullptr};
|
||||
char **argv = (char **)args;
|
||||
int argc = 1;
|
||||
|
||||
int flag;
|
||||
MPI_Initialized(&flag);
|
||||
|
||||
@ -21,9 +21,9 @@ protected:
|
||||
LAMMPS *lmp;
|
||||
LAMMPS_plain() : lmp(nullptr)
|
||||
{
|
||||
const char * args[] = {"LAMMPS_test", nullptr};
|
||||
char ** argv = (char**)args;
|
||||
int argc = 1;
|
||||
const char *args[] = {"LAMMPS_test", nullptr};
|
||||
char **argv = (char **)args;
|
||||
int argc = 1;
|
||||
|
||||
int flag;
|
||||
MPI_Initialized(&flag);
|
||||
@ -37,7 +37,7 @@ protected:
|
||||
LAMMPS::argv args = {"LAMMPS_test", "-log", "none", "-echo", "both", "-nocite"};
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
}
|
||||
@ -157,9 +157,9 @@ protected:
|
||||
LAMMPS *lmp;
|
||||
LAMMPS_omp() : lmp(nullptr)
|
||||
{
|
||||
const char * args[] = {"LAMMPS_test", nullptr};
|
||||
char ** argv = (char**)args;
|
||||
int argc = 1;
|
||||
const char *args[] = {"LAMMPS_test", nullptr};
|
||||
char **argv = (char **)args;
|
||||
int argc = 1;
|
||||
|
||||
int flag;
|
||||
MPI_Initialized(&flag);
|
||||
@ -238,9 +238,9 @@ protected:
|
||||
LAMMPS *lmp;
|
||||
LAMMPS_kokkos() : lmp(nullptr)
|
||||
{
|
||||
const char * args[] = {"LAMMPS_test", nullptr};
|
||||
char ** argv = (char**)args;
|
||||
int argc = 1;
|
||||
const char *args[] = {"LAMMPS_test", nullptr};
|
||||
char **argv = (char **)args;
|
||||
int argc = 1;
|
||||
|
||||
int flag;
|
||||
MPI_Initialized(&flag);
|
||||
@ -330,7 +330,7 @@ TEST(LAMMPS_init, OpenMP)
|
||||
LAMMPS::argv args = {"LAMMPS_init", "-in", "in.lammps_empty", "-log", "none", "-nocite"};
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
LAMMPS *lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
auto *lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_THAT(output, ContainsRegex(".*using 2 OpenMP thread.*per MPI task.*"));
|
||||
|
||||
@ -361,7 +361,7 @@ TEST(LAMMPS_init, NoOpenMP)
|
||||
LAMMPS::argv args = {"LAMMPS_init", "-in", "in.lammps_class_noomp", "-log", "none", "-nocite"};
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
LAMMPS *lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
auto *lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_THAT(output, ContainsRegex(
|
||||
".*OMP_NUM_THREADS environment is not set.*Defaulting to 1 thread.*"));
|
||||
|
||||
@ -70,7 +70,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
// check if prerequisite styles are available
|
||||
Info *info = new Info(lmp);
|
||||
int nfail = 0;
|
||||
for (auto &prerequisite : cfg.prerequisites) {
|
||||
for (const auto &prerequisite : cfg.prerequisites) {
|
||||
std::string style = prerequisite.second;
|
||||
|
||||
// this is a test for angle styles, so if the suffixed
|
||||
@ -120,7 +120,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("variable input_dir index " + INPUT_FOLDER);
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -129,11 +129,11 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("angle_style " + cfg.angle_style);
|
||||
|
||||
for (auto &angle_coeff : cfg.angle_coeff) {
|
||||
for (const auto &angle_coeff : cfg.angle_coeff) {
|
||||
command("angle_coeff " + angle_coeff);
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -176,12 +176,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
}
|
||||
|
||||
if ((cfg.angle_style.substr(0, 6) == "hybrid") || !lmp->force->angle->writedata) {
|
||||
for (auto &angle_coeff : cfg.angle_coeff) {
|
||||
for (const auto &angle_coeff : cfg.angle_coeff) {
|
||||
command("angle_coeff " + angle_coeff);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
command("variable newton_bond delete");
|
||||
command("variable newton_bond index on");
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -214,10 +214,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file);
|
||||
parse_input_script(input_file);
|
||||
|
||||
for (auto &angle_coeff : cfg.angle_coeff) {
|
||||
for (const auto &angle_coeff : cfg.angle_coeff) {
|
||||
command("angle_coeff " + angle_coeff);
|
||||
}
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
command("run 0 post no");
|
||||
@ -234,7 +234,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
if (!lmp) {
|
||||
std::cerr << "One or more prerequisite styles are not available "
|
||||
"in this LAMMPS configuration:\n";
|
||||
for (auto &prerequisite : config.prerequisites) {
|
||||
for (const auto &prerequisite : config.prerequisites) {
|
||||
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
||||
}
|
||||
return;
|
||||
@ -253,7 +253,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
|
||||
// angle_coeff
|
||||
block.clear();
|
||||
for (auto &angle_coeff : config.angle_coeff) {
|
||||
for (const auto &angle_coeff : config.angle_coeff) {
|
||||
block += angle_coeff + "\n";
|
||||
}
|
||||
writer.emit_block("angle_coeff", block);
|
||||
@ -277,14 +277,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
writer.emit("init_energy", lmp->force->angle->energy);
|
||||
|
||||
// init_stress
|
||||
auto stress = lmp->force->angle->virial;
|
||||
auto *stress = lmp->force->angle->virial;
|
||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
||||
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||
writer.emit_block("init_stress", block);
|
||||
|
||||
// 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]);
|
||||
@ -345,7 +345,7 @@ TEST(AngleStyle, plain)
|
||||
double epsilon = test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto angle = lmp->force->angle;
|
||||
auto *angle = lmp->force->angle;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", angle->virial, test_config.init_stress, epsilon);
|
||||
@ -463,7 +463,7 @@ TEST(AngleStyle, omp)
|
||||
double epsilon = 5.0 * test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto angle = lmp->force->angle;
|
||||
auto *angle = lmp->force->angle;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", angle->virial, test_config.init_stress, 10 * epsilon);
|
||||
@ -751,9 +751,9 @@ TEST(AngleStyle, extract)
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto angle = lmp->force->angle;
|
||||
void *ptr = nullptr;
|
||||
int dim = 0;
|
||||
auto *angle = lmp->force->angle;
|
||||
void *ptr = nullptr;
|
||||
int dim = 0;
|
||||
for (auto extract : test_config.extract) {
|
||||
ptr = angle->extract(extract.first.c_str(), dim);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
|
||||
@ -70,7 +70,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
// check if prerequisite styles are available
|
||||
Info *info = new Info(lmp);
|
||||
int nfail = 0;
|
||||
for (auto &prerequisite : cfg.prerequisites) {
|
||||
for (const auto &prerequisite : cfg.prerequisites) {
|
||||
std::string style = prerequisite.second;
|
||||
|
||||
// this is a test for bond styles, so if the suffixed
|
||||
@ -120,7 +120,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("variable input_dir index " + INPUT_FOLDER);
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -129,11 +129,11 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("bond_style " + cfg.bond_style);
|
||||
|
||||
for (auto &bond_coeff : cfg.bond_coeff) {
|
||||
for (const auto &bond_coeff : cfg.bond_coeff) {
|
||||
command("bond_coeff " + bond_coeff);
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -176,12 +176,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
}
|
||||
|
||||
if ((cfg.bond_style.substr(0, 6) == "hybrid") || !lmp->force->bond->writedata) {
|
||||
for (auto &bond_coeff : cfg.bond_coeff) {
|
||||
for (const auto &bond_coeff : cfg.bond_coeff) {
|
||||
command("bond_coeff " + bond_coeff);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
command("variable newton_bond delete");
|
||||
command("variable newton_bond index on");
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -214,10 +214,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file);
|
||||
parse_input_script(input_file);
|
||||
|
||||
for (auto &bond_coeff : cfg.bond_coeff) {
|
||||
for (const auto &bond_coeff : cfg.bond_coeff) {
|
||||
command("bond_coeff " + bond_coeff);
|
||||
}
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
command("run 0 post no");
|
||||
@ -234,7 +234,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
if (!lmp) {
|
||||
std::cerr << "One or more prerequisite styles are not available "
|
||||
"in this LAMMPS configuration:\n";
|
||||
for (auto &prerequisite : config.prerequisites) {
|
||||
for (const auto &prerequisite : config.prerequisites) {
|
||||
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
||||
}
|
||||
return;
|
||||
@ -253,7 +253,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
|
||||
// bond_coeff
|
||||
block.clear();
|
||||
for (auto &bond_coeff : config.bond_coeff) {
|
||||
for (const auto &bond_coeff : config.bond_coeff) {
|
||||
block += bond_coeff + "\n";
|
||||
}
|
||||
writer.emit_block("bond_coeff", block);
|
||||
@ -277,14 +277,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
writer.emit("init_energy", lmp->force->bond->energy);
|
||||
|
||||
// init_stress
|
||||
auto stress = lmp->force->bond->virial;
|
||||
auto *stress = lmp->force->bond->virial;
|
||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
||||
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||
writer.emit_block("init_stress", block);
|
||||
|
||||
// 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]);
|
||||
@ -345,7 +345,7 @@ TEST(BondStyle, plain)
|
||||
double epsilon = test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto bond = lmp->force->bond;
|
||||
auto *bond = lmp->force->bond;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", bond->virial, test_config.init_stress, epsilon);
|
||||
@ -465,7 +465,7 @@ TEST(BondStyle, omp)
|
||||
double epsilon = 5.0 * test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto bond = lmp->force->bond;
|
||||
auto *bond = lmp->force->bond;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", bond->virial, test_config.init_stress, 10 * epsilon);
|
||||
@ -532,7 +532,6 @@ TEST(BondStyle, omp)
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
};
|
||||
|
||||
|
||||
TEST(BondStyle, numdiff)
|
||||
{
|
||||
if (!LAMMPS::is_installed_pkg("EXTRA-FIX")) GTEST_SKIP();
|
||||
@ -652,7 +651,7 @@ TEST(BondStyle, single)
|
||||
command("pair_coeff * *");
|
||||
|
||||
command("bond_style " + test_config.bond_style);
|
||||
auto bond = lmp->force->bond;
|
||||
auto *bond = lmp->force->bond;
|
||||
|
||||
for (auto &bond_coeff : test_config.bond_coeff) {
|
||||
command("bond_coeff " + bond_coeff);
|
||||
@ -860,9 +859,9 @@ TEST(BondStyle, extract)
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto bond = lmp->force->bond;
|
||||
void *ptr = nullptr;
|
||||
int dim = 0;
|
||||
auto *bond = lmp->force->bond;
|
||||
void *ptr = nullptr;
|
||||
int dim = 0;
|
||||
for (auto extract : test_config.extract) {
|
||||
ptr = bond->extract(extract.first.c_str(), dim);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
|
||||
@ -96,7 +96,7 @@ public:
|
||||
restart_vel.clear();
|
||||
global_vector.clear();
|
||||
}
|
||||
TestConfig(const TestConfig &) = delete;
|
||||
TestConfig(const TestConfig &) = delete;
|
||||
TestConfig &operator=(const TestConfig &) = delete;
|
||||
|
||||
std::string tags_line() const
|
||||
|
||||
@ -22,8 +22,8 @@ class TestConfigReader : public YamlReader<TestConfigReader> {
|
||||
|
||||
public:
|
||||
TestConfigReader(TestConfig &config);
|
||||
TestConfigReader() = delete;
|
||||
const TestConfigReader & operator=(TestConfig &) = delete;
|
||||
TestConfigReader() = delete;
|
||||
const TestConfigReader &operator=(TestConfig &) = delete;
|
||||
|
||||
void skip_tests(const yaml_event_t &event);
|
||||
void prerequisites(const yaml_event_t &event);
|
||||
|
||||
@ -63,12 +63,12 @@ void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
|
||||
LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton = true)
|
||||
{
|
||||
LAMMPS *lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
auto *lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
|
||||
// check if prerequisite styles are available
|
||||
Info *info = new Info(lmp);
|
||||
int nfail = 0;
|
||||
for (auto &prerequisite : cfg.prerequisites) {
|
||||
for (const auto &prerequisite : cfg.prerequisites) {
|
||||
std::string style = prerequisite.second;
|
||||
|
||||
// this is a test for dihedral styles, so if the suffixed
|
||||
@ -118,7 +118,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("variable input_dir index " + INPUT_FOLDER);
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -127,11 +127,11 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("dihedral_style " + cfg.dihedral_style);
|
||||
|
||||
for (auto &dihedral_coeff : cfg.dihedral_coeff) {
|
||||
for (const auto &dihedral_coeff : cfg.dihedral_coeff) {
|
||||
command("dihedral_coeff " + dihedral_coeff);
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -174,12 +174,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
}
|
||||
|
||||
if ((cfg.dihedral_style.substr(0, 6) == "hybrid") || !lmp->force->dihedral->writedata) {
|
||||
for (auto &dihedral_coeff : cfg.dihedral_coeff) {
|
||||
for (const auto &dihedral_coeff : cfg.dihedral_coeff) {
|
||||
command("dihedral_coeff " + dihedral_coeff);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
command("variable newton_bond delete");
|
||||
command("variable newton_bond index on");
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -221,10 +221,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file);
|
||||
parse_input_script(input_file);
|
||||
|
||||
for (auto &dihedral_coeff : cfg.dihedral_coeff) {
|
||||
for (const auto &dihedral_coeff : cfg.dihedral_coeff) {
|
||||
command("dihedral_coeff " + dihedral_coeff);
|
||||
}
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
command("run 0 post no");
|
||||
@ -241,7 +241,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
if (!lmp) {
|
||||
std::cerr << "One or more prerequisite styles are not available "
|
||||
"in this LAMMPS configuration:\n";
|
||||
for (auto &prerequisite : config.prerequisites) {
|
||||
for (const auto &prerequisite : config.prerequisites) {
|
||||
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
||||
}
|
||||
return;
|
||||
@ -260,7 +260,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
|
||||
// dihedral_coeff
|
||||
block.clear();
|
||||
for (auto &dihedral_coeff : config.dihedral_coeff) {
|
||||
for (const auto &dihedral_coeff : config.dihedral_coeff) {
|
||||
block += dihedral_coeff + "\n";
|
||||
}
|
||||
writer.emit_block("dihedral_coeff", block);
|
||||
@ -278,14 +278,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
writer.emit("init_energy", lmp->force->dihedral->energy);
|
||||
|
||||
// init_stress
|
||||
auto stress = lmp->force->dihedral->virial;
|
||||
auto *stress = lmp->force->dihedral->virial;
|
||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
||||
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||
writer.emit_block("init_stress", block);
|
||||
|
||||
// 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]);
|
||||
@ -346,7 +346,7 @@ TEST(DihedralStyle, plain)
|
||||
double epsilon = test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto dihedral = lmp->force->dihedral;
|
||||
auto *dihedral = lmp->force->dihedral;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", dihedral->virial, test_config.init_stress, epsilon);
|
||||
@ -466,7 +466,7 @@ TEST(DihedralStyle, omp)
|
||||
double epsilon = 5.0 * test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto dihedral = lmp->force->dihedral;
|
||||
auto *dihedral = lmp->force->dihedral;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", dihedral->virial, test_config.init_stress,
|
||||
@ -534,7 +534,6 @@ TEST(DihedralStyle, omp)
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
};
|
||||
|
||||
|
||||
TEST(DihedralStyle, numdiff)
|
||||
{
|
||||
if (!LAMMPS::is_installed_pkg("EXTRA-FIX")) GTEST_SKIP();
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
#include "pair.h"
|
||||
#include "platform.h"
|
||||
#include "universe.h"
|
||||
#include "update.h"
|
||||
#include "utils.h"
|
||||
#include "variable.h"
|
||||
|
||||
@ -61,7 +62,7 @@ void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
delete lmp;
|
||||
}
|
||||
|
||||
LAMMPS *init_lammps(LAMMPS::argv & args, const TestConfig &cfg, const bool use_respa = false)
|
||||
LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool use_respa = false)
|
||||
{
|
||||
LAMMPS *lmp;
|
||||
|
||||
@ -70,7 +71,7 @@ LAMMPS *init_lammps(LAMMPS::argv & args, const TestConfig &cfg, const bool use_r
|
||||
// check if prerequisite styles are available
|
||||
Info *info = new Info(lmp);
|
||||
int nfail = 0;
|
||||
for (auto &prerequisite : cfg.prerequisites) {
|
||||
for (const auto &prerequisite : cfg.prerequisites) {
|
||||
std::string style = prerequisite.second;
|
||||
|
||||
// this is a test for fix styles, so if the suffixed
|
||||
@ -96,7 +97,7 @@ LAMMPS *init_lammps(LAMMPS::argv & args, const TestConfig &cfg, const bool use_r
|
||||
};
|
||||
|
||||
command("variable input_dir index " + INPUT_FOLDER);
|
||||
for (auto &pre_command : cfg.pre_commands)
|
||||
for (const auto &pre_command : cfg.pre_commands)
|
||||
command(pre_command);
|
||||
|
||||
std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file);
|
||||
@ -127,7 +128,7 @@ LAMMPS *init_lammps(LAMMPS::argv & args, const TestConfig &cfg, const bool use_r
|
||||
command("group solute molecule 1:2");
|
||||
command("group solvent molecule 3:5");
|
||||
|
||||
for (auto &post_command : cfg.post_commands)
|
||||
for (const auto &post_command : cfg.post_commands)
|
||||
command(post_command);
|
||||
|
||||
command("timestep 0.25");
|
||||
@ -157,9 +158,16 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg, bool use_rmass, bool use
|
||||
|
||||
if (use_respa) command("run_style respa 2 1 bond 1 pair 2");
|
||||
|
||||
for (auto &post_command : cfg.post_commands)
|
||||
for (const auto &post_command : cfg.post_commands)
|
||||
command(post_command);
|
||||
|
||||
auto *ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (ifix && !utils::strmatch(ifix->style, "^move")) {
|
||||
// must be set to trigger calling Fix::reset_dt() with timestep
|
||||
lmp->update->first_update = 1;
|
||||
// test validity of Fix::reset_dt(). With run_style respa there may be segfaults
|
||||
command("timestep 0.25");
|
||||
}
|
||||
command("thermo 2");
|
||||
command("run 4 post no start 0 stop 8");
|
||||
}
|
||||
@ -170,7 +178,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
{
|
||||
// initialize system geometry
|
||||
LAMMPS::argv args = {"FixIntegrate", "-log", "none", "-echo", "screen", "-nocite"};
|
||||
LAMMPS *lmp = init_lammps(args, config);
|
||||
LAMMPS *lmp = init_lammps(args, config);
|
||||
if (!lmp) {
|
||||
std::cerr << "One or more prerequisite styles are not available "
|
||||
"in this LAMMPS configuration:\n";
|
||||
@ -190,40 +198,38 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
// natoms
|
||||
writer.emit("natoms", natoms);
|
||||
|
||||
int ifix = lmp->modify->find_fix("test");
|
||||
if (ifix < 0) {
|
||||
auto *ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
std::cerr << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
exit(1);
|
||||
} else {
|
||||
Fix *fix = lmp->modify->fix[ifix];
|
||||
|
||||
// run_stress, if enabled
|
||||
if (fix->thermo_virial) {
|
||||
auto stress = fix->virial;
|
||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}",
|
||||
stress[0], stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||
if (ifix->thermo_virial) {
|
||||
auto *stress = ifix->virial;
|
||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}",
|
||||
stress[0], stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||
writer.emit_block("run_stress", block);
|
||||
}
|
||||
|
||||
// global scalar
|
||||
if (fix->scalar_flag) {
|
||||
double value = fix->compute_scalar();
|
||||
if (ifix->scalar_flag) {
|
||||
double value = ifix->compute_scalar();
|
||||
writer.emit("global_scalar", value);
|
||||
}
|
||||
|
||||
// global vector
|
||||
if (fix->vector_flag) {
|
||||
int num = fix->size_vector;
|
||||
if (ifix->vector_flag) {
|
||||
int num = ifix->size_vector;
|
||||
block = std::to_string(num);
|
||||
for (int i = 0; i < num; ++i)
|
||||
block += fmt::format(" {}", fix->compute_vector(i));
|
||||
block += fmt::format(" {}", ifix->compute_vector(i));
|
||||
writer.emit_block("global_vector", block);
|
||||
}
|
||||
}
|
||||
|
||||
// run_pos
|
||||
block.clear();
|
||||
auto x = lmp->atom->x;
|
||||
auto *x = lmp->atom->x;
|
||||
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, x[j][0], x[j][1], x[j][2]);
|
||||
@ -232,7 +238,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
|
||||
// run_vel
|
||||
block.clear();
|
||||
auto v = lmp->atom->v;
|
||||
auto *v = lmp->atom->v;
|
||||
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, v[j][0], v[j][1], v[j][2]);
|
||||
@ -283,37 +289,36 @@ TEST(FixTimestep, plain)
|
||||
EXPECT_POSITIONS("run_pos (normal run, verlet)", lmp->atom, test_config.run_pos, epsilon);
|
||||
EXPECT_VELOCITIES("run_vel (normal run, verlet)", lmp->atom, test_config.run_vel, epsilon);
|
||||
|
||||
int ifix = lmp->modify->find_fix("test");
|
||||
if (ifix < 0) {
|
||||
auto *ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
Fix *fix = lmp->modify->fix[ifix];
|
||||
if (fix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (normal run, verlet)", fix->virial, test_config.run_stress,
|
||||
if (ifix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (normal run, verlet)", ifix->virial, test_config.run_stress,
|
||||
epsilon);
|
||||
}
|
||||
|
||||
stats.reset();
|
||||
// global scalar
|
||||
if (fix->scalar_flag) {
|
||||
double value = fix->compute_scalar();
|
||||
if (ifix->scalar_flag) {
|
||||
double value = ifix->compute_scalar();
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_scalar, value, epsilon);
|
||||
}
|
||||
|
||||
// global vector
|
||||
if (fix->vector_flag) {
|
||||
int num = fix->size_vector;
|
||||
if (ifix->vector_flag) {
|
||||
int num = ifix->size_vector;
|
||||
EXPECT_EQ(num, test_config.global_vector.size());
|
||||
|
||||
for (int i = 0; i < num; ++i)
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], fix->compute_vector(i),
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], ifix->compute_vector(i),
|
||||
epsilon);
|
||||
}
|
||||
|
||||
// check t_target for thermostats
|
||||
|
||||
int dim = -1;
|
||||
double *ptr = (double *)fix->extract("t_target", dim);
|
||||
int dim = -1;
|
||||
auto *ptr = (double *)ifix->extract("t_target", dim);
|
||||
if ((ptr != nullptr) && (dim == 0)) {
|
||||
int ivar = lmp->input->variable->find("t_target");
|
||||
if (ivar >= 0) {
|
||||
@ -333,31 +338,30 @@ TEST(FixTimestep, plain)
|
||||
EXPECT_POSITIONS("run_pos (restart, verlet)", lmp->atom, test_config.run_pos, epsilon);
|
||||
EXPECT_VELOCITIES("run_vel (restart, verlet)", lmp->atom, test_config.run_vel, epsilon);
|
||||
|
||||
ifix = lmp->modify->find_fix("test");
|
||||
if (ifix < 0) {
|
||||
ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
Fix *fix = lmp->modify->fix[ifix];
|
||||
if (fix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (restart, verlet)", fix->virial, test_config.run_stress,
|
||||
if (ifix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (restart, verlet)", ifix->virial, test_config.run_stress,
|
||||
epsilon);
|
||||
}
|
||||
|
||||
stats.reset();
|
||||
|
||||
// global scalar
|
||||
if (fix->scalar_flag) {
|
||||
double value = fix->compute_scalar();
|
||||
if (ifix->scalar_flag) {
|
||||
double value = ifix->compute_scalar();
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_scalar, value, epsilon);
|
||||
}
|
||||
|
||||
// global vector
|
||||
if (fix->vector_flag) {
|
||||
int num = fix->size_vector;
|
||||
if (ifix->vector_flag) {
|
||||
int num = ifix->size_vector;
|
||||
EXPECT_EQ(num, test_config.global_vector.size());
|
||||
|
||||
for (int i = 0; i < num; ++i)
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], fix->compute_vector(i),
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], ifix->compute_vector(i),
|
||||
epsilon);
|
||||
}
|
||||
if (print_stats && stats.has_data())
|
||||
@ -372,31 +376,30 @@ TEST(FixTimestep, plain)
|
||||
EXPECT_POSITIONS("run_pos (rmass, verlet)", lmp->atom, test_config.run_pos, epsilon);
|
||||
EXPECT_VELOCITIES("run_vel (rmass, verlet)", lmp->atom, test_config.run_vel, epsilon);
|
||||
|
||||
ifix = lmp->modify->find_fix("test");
|
||||
if (ifix < 0) {
|
||||
ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
Fix *fix = lmp->modify->fix[ifix];
|
||||
if (fix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (rmass, verlet)", fix->virial, test_config.run_stress,
|
||||
if (ifix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (rmass, verlet)", ifix->virial, test_config.run_stress,
|
||||
epsilon);
|
||||
}
|
||||
|
||||
stats.reset();
|
||||
|
||||
// global scalar
|
||||
if (fix->scalar_flag) {
|
||||
double value = fix->compute_scalar();
|
||||
if (ifix->scalar_flag) {
|
||||
double value = ifix->compute_scalar();
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_scalar, value, epsilon);
|
||||
}
|
||||
|
||||
// global vector
|
||||
if (fix->vector_flag) {
|
||||
int num = fix->size_vector;
|
||||
if (ifix->vector_flag) {
|
||||
int num = ifix->size_vector;
|
||||
EXPECT_EQ(num, test_config.global_vector.size());
|
||||
|
||||
for (int i = 0; i < num; ++i)
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], fix->compute_vector(i),
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], ifix->compute_vector(i),
|
||||
epsilon);
|
||||
}
|
||||
if (print_stats && stats.has_data())
|
||||
@ -406,9 +409,9 @@ TEST(FixTimestep, plain)
|
||||
|
||||
// rigid fixes need work to test properly with r-RESPA.
|
||||
// fix nve/limit cannot work with r-RESPA
|
||||
ifix = lmp->modify->find_fix("test");
|
||||
if (!utils::strmatch(lmp->modify->fix[ifix]->style, "^rigid") &&
|
||||
!utils::strmatch(lmp->modify->fix[ifix]->style, "^nve/limit")) {
|
||||
ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (ifix && !utils::strmatch(ifix->style, "^rigid") &&
|
||||
!utils::strmatch(ifix->style, "^nve/limit")) {
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
cleanup_lammps(lmp, test_config);
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
@ -424,31 +427,30 @@ TEST(FixTimestep, plain)
|
||||
EXPECT_POSITIONS("run_pos (normal run, respa)", lmp->atom, test_config.run_pos, epsilon);
|
||||
EXPECT_VELOCITIES("run_vel (normal run, respa)", lmp->atom, test_config.run_vel, epsilon);
|
||||
|
||||
ifix = lmp->modify->find_fix("test");
|
||||
if (ifix < 0) {
|
||||
ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
Fix *fix = lmp->modify->fix[ifix];
|
||||
if (fix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (normal run, respa)", fix->virial, test_config.run_stress,
|
||||
1000 * epsilon);
|
||||
if (ifix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (normal run, respa)", ifix->virial,
|
||||
test_config.run_stress, 1000 * epsilon);
|
||||
}
|
||||
|
||||
stats.reset();
|
||||
|
||||
// global scalar
|
||||
if (fix->scalar_flag) {
|
||||
double value = fix->compute_scalar();
|
||||
if (ifix->scalar_flag) {
|
||||
double value = ifix->compute_scalar();
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_scalar, value, 10 * epsilon);
|
||||
}
|
||||
|
||||
// global vector
|
||||
if (fix->vector_flag) {
|
||||
int num = fix->size_vector;
|
||||
if (ifix->vector_flag) {
|
||||
int num = ifix->size_vector;
|
||||
EXPECT_EQ(num, test_config.global_vector.size());
|
||||
|
||||
for (int i = 0; i < num; ++i)
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], fix->compute_vector(i),
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], ifix->compute_vector(i),
|
||||
10 * epsilon);
|
||||
}
|
||||
if (print_stats && stats.has_data())
|
||||
@ -462,31 +464,30 @@ TEST(FixTimestep, plain)
|
||||
EXPECT_POSITIONS("run_pos (restart, respa)", lmp->atom, test_config.run_pos, epsilon);
|
||||
EXPECT_VELOCITIES("run_vel (restart, respa)", lmp->atom, test_config.run_vel, epsilon);
|
||||
|
||||
ifix = lmp->modify->find_fix("test");
|
||||
if (ifix < 0) {
|
||||
ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
Fix *fix = lmp->modify->fix[ifix];
|
||||
if (fix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (restart, respa)", fix->virial, test_config.run_stress,
|
||||
if (ifix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (restart, respa)", ifix->virial, test_config.run_stress,
|
||||
1000 * epsilon);
|
||||
}
|
||||
|
||||
stats.reset();
|
||||
|
||||
// global scalar
|
||||
if (fix->scalar_flag) {
|
||||
double value = fix->compute_scalar();
|
||||
if (ifix->scalar_flag) {
|
||||
double value = ifix->compute_scalar();
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_scalar, value, 10 * epsilon);
|
||||
}
|
||||
|
||||
// global vector
|
||||
if (fix->vector_flag) {
|
||||
int num = fix->size_vector;
|
||||
if (ifix->vector_flag) {
|
||||
int num = ifix->size_vector;
|
||||
EXPECT_EQ(num, test_config.global_vector.size());
|
||||
|
||||
for (int i = 0; i < num; ++i)
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], fix->compute_vector(i),
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], ifix->compute_vector(i),
|
||||
10 * epsilon);
|
||||
}
|
||||
if (print_stats && stats.has_data())
|
||||
@ -501,31 +502,30 @@ TEST(FixTimestep, plain)
|
||||
EXPECT_POSITIONS("run_pos (rmass, respa)", lmp->atom, test_config.run_pos, epsilon);
|
||||
EXPECT_VELOCITIES("run_vel (rmass, respa)", lmp->atom, test_config.run_vel, epsilon);
|
||||
|
||||
ifix = lmp->modify->find_fix("test");
|
||||
if (ifix < 0) {
|
||||
ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
Fix *fix = lmp->modify->fix[ifix];
|
||||
if (fix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (rmass, respa)", fix->virial, test_config.run_stress,
|
||||
if (ifix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (rmass, respa)", ifix->virial, test_config.run_stress,
|
||||
1000 * epsilon);
|
||||
}
|
||||
|
||||
stats.reset();
|
||||
|
||||
// global scalar
|
||||
if (fix->scalar_flag) {
|
||||
double value = fix->compute_scalar();
|
||||
if (ifix->scalar_flag) {
|
||||
double value = ifix->compute_scalar();
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_scalar, value, 10 * epsilon);
|
||||
}
|
||||
|
||||
// global vector
|
||||
if (fix->vector_flag) {
|
||||
int num = fix->size_vector;
|
||||
if (ifix->vector_flag) {
|
||||
int num = ifix->size_vector;
|
||||
EXPECT_EQ(num, test_config.global_vector.size());
|
||||
|
||||
for (int i = 0; i < num; ++i)
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], fix->compute_vector(i),
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], ifix->compute_vector(i),
|
||||
10 * epsilon);
|
||||
}
|
||||
if (print_stats && stats.has_data())
|
||||
@ -551,7 +551,6 @@ TEST(FixTimestep, omp)
|
||||
LAMMPS::argv args = {"FixTimestep", "-log", "none", "-echo", "screen", "-nocite",
|
||||
"-pk", "omp", "4", "-sf", "omp"};
|
||||
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
LAMMPS *lmp = init_lammps(args, test_config);
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
@ -584,37 +583,36 @@ TEST(FixTimestep, omp)
|
||||
EXPECT_POSITIONS("run_pos (normal run, verlet)", lmp->atom, test_config.run_pos, epsilon);
|
||||
EXPECT_VELOCITIES("run_vel (normal run, verlet)", lmp->atom, test_config.run_vel, epsilon);
|
||||
|
||||
int ifix = lmp->modify->find_fix("test");
|
||||
if (ifix < 0) {
|
||||
auto *ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
Fix *fix = lmp->modify->fix[ifix];
|
||||
if (fix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (normal run, verlet)", fix->virial, test_config.run_stress,
|
||||
if (ifix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (normal run, verlet)", ifix->virial, test_config.run_stress,
|
||||
epsilon);
|
||||
}
|
||||
|
||||
stats.reset();
|
||||
// global scalar
|
||||
if (fix->scalar_flag) {
|
||||
double value = fix->compute_scalar();
|
||||
if (ifix->scalar_flag) {
|
||||
double value = ifix->compute_scalar();
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_scalar, value, epsilon);
|
||||
}
|
||||
|
||||
// global vector
|
||||
if (fix->vector_flag) {
|
||||
int num = fix->size_vector;
|
||||
if (ifix->vector_flag) {
|
||||
int num = ifix->size_vector;
|
||||
EXPECT_EQ(num, test_config.global_vector.size());
|
||||
|
||||
for (int i = 0; i < num; ++i)
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], fix->compute_vector(i),
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], ifix->compute_vector(i),
|
||||
epsilon);
|
||||
}
|
||||
|
||||
// check t_target for thermostats
|
||||
|
||||
int dim = -1;
|
||||
double *ptr = (double *)fix->extract("t_target", dim);
|
||||
int dim = -1;
|
||||
auto *ptr = (double *)ifix->extract("t_target", dim);
|
||||
if ((ptr != nullptr) && (dim == 0)) {
|
||||
int ivar = lmp->input->variable->find("t_target");
|
||||
if (ivar >= 0) {
|
||||
@ -634,31 +632,30 @@ TEST(FixTimestep, omp)
|
||||
EXPECT_POSITIONS("run_pos (restart, verlet)", lmp->atom, test_config.run_pos, epsilon);
|
||||
EXPECT_VELOCITIES("run_vel (restart, verlet)", lmp->atom, test_config.run_vel, epsilon);
|
||||
|
||||
ifix = lmp->modify->find_fix("test");
|
||||
if (ifix < 0) {
|
||||
ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
Fix *fix = lmp->modify->fix[ifix];
|
||||
if (fix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (restart, verlet)", fix->virial, test_config.run_stress,
|
||||
if (ifix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (restart, verlet)", ifix->virial, test_config.run_stress,
|
||||
epsilon);
|
||||
}
|
||||
|
||||
stats.reset();
|
||||
|
||||
// global scalar
|
||||
if (fix->scalar_flag) {
|
||||
double value = fix->compute_scalar();
|
||||
if (ifix->scalar_flag) {
|
||||
double value = ifix->compute_scalar();
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_scalar, value, epsilon);
|
||||
}
|
||||
|
||||
// global vector
|
||||
if (fix->vector_flag) {
|
||||
int num = fix->size_vector;
|
||||
if (ifix->vector_flag) {
|
||||
int num = ifix->size_vector;
|
||||
EXPECT_EQ(num, test_config.global_vector.size());
|
||||
|
||||
for (int i = 0; i < num; ++i)
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], fix->compute_vector(i),
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], ifix->compute_vector(i),
|
||||
epsilon);
|
||||
}
|
||||
if (print_stats && stats.has_data())
|
||||
@ -673,31 +670,30 @@ TEST(FixTimestep, omp)
|
||||
EXPECT_POSITIONS("run_pos (rmass, verlet)", lmp->atom, test_config.run_pos, epsilon);
|
||||
EXPECT_VELOCITIES("run_vel (rmass, verlet)", lmp->atom, test_config.run_vel, epsilon);
|
||||
|
||||
ifix = lmp->modify->find_fix("test");
|
||||
if (ifix < 0) {
|
||||
ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
Fix *fix = lmp->modify->fix[ifix];
|
||||
if (fix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (rmass, verlet)", fix->virial, test_config.run_stress,
|
||||
if (ifix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (rmass, verlet)", ifix->virial, test_config.run_stress,
|
||||
epsilon);
|
||||
}
|
||||
|
||||
stats.reset();
|
||||
|
||||
// global scalar
|
||||
if (fix->scalar_flag) {
|
||||
double value = fix->compute_scalar();
|
||||
if (ifix->scalar_flag) {
|
||||
double value = ifix->compute_scalar();
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_scalar, value, epsilon);
|
||||
}
|
||||
|
||||
// global vector
|
||||
if (fix->vector_flag) {
|
||||
int num = fix->size_vector;
|
||||
if (ifix->vector_flag) {
|
||||
int num = ifix->size_vector;
|
||||
EXPECT_EQ(num, test_config.global_vector.size());
|
||||
|
||||
for (int i = 0; i < num; ++i)
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], fix->compute_vector(i),
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], ifix->compute_vector(i),
|
||||
epsilon);
|
||||
}
|
||||
if (print_stats && stats.has_data())
|
||||
@ -707,8 +703,8 @@ TEST(FixTimestep, omp)
|
||||
|
||||
// rigid fixes need work to test properly with r-RESPA,
|
||||
// also, torque is not supported by respa/omp
|
||||
ifix = lmp->modify->find_fix("test");
|
||||
if (!utils::strmatch(lmp->modify->fix[ifix]->style, "^rigid") && !lmp->atom->torque) {
|
||||
ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (ifix && !utils::strmatch(ifix->style, "^rigid") && !lmp->atom->torque) {
|
||||
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
cleanup_lammps(lmp, test_config);
|
||||
@ -725,31 +721,30 @@ TEST(FixTimestep, omp)
|
||||
EXPECT_POSITIONS("run_pos (normal run, respa)", lmp->atom, test_config.run_pos, epsilon);
|
||||
EXPECT_VELOCITIES("run_vel (normal run, respa)", lmp->atom, test_config.run_vel, epsilon);
|
||||
|
||||
ifix = lmp->modify->find_fix("test");
|
||||
if (ifix < 0) {
|
||||
ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
Fix *fix = lmp->modify->fix[ifix];
|
||||
if (fix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (normal run, respa)", fix->virial, test_config.run_stress,
|
||||
1000 * epsilon);
|
||||
if (ifix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (normal run, respa)", ifix->virial,
|
||||
test_config.run_stress, 1000 * epsilon);
|
||||
}
|
||||
|
||||
stats.reset();
|
||||
|
||||
// global scalar
|
||||
if (fix->scalar_flag) {
|
||||
double value = fix->compute_scalar();
|
||||
if (ifix->scalar_flag) {
|
||||
double value = ifix->compute_scalar();
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_scalar, value, 10 * epsilon);
|
||||
}
|
||||
|
||||
// global vector
|
||||
if (fix->vector_flag) {
|
||||
int num = fix->size_vector;
|
||||
if (ifix->vector_flag) {
|
||||
int num = ifix->size_vector;
|
||||
EXPECT_EQ(num, test_config.global_vector.size());
|
||||
|
||||
for (int i = 0; i < num; ++i)
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], fix->compute_vector(i),
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], ifix->compute_vector(i),
|
||||
10 * epsilon);
|
||||
}
|
||||
if (print_stats && stats.has_data())
|
||||
@ -763,31 +758,30 @@ TEST(FixTimestep, omp)
|
||||
EXPECT_POSITIONS("run_pos (restart, respa)", lmp->atom, test_config.run_pos, epsilon);
|
||||
EXPECT_VELOCITIES("run_vel (restart, respa)", lmp->atom, test_config.run_vel, epsilon);
|
||||
|
||||
ifix = lmp->modify->find_fix("test");
|
||||
if (ifix < 0) {
|
||||
ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
Fix *fix = lmp->modify->fix[ifix];
|
||||
if (fix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (restart, respa)", fix->virial, test_config.run_stress,
|
||||
if (ifix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (restart, respa)", ifix->virial, test_config.run_stress,
|
||||
1000 * epsilon);
|
||||
}
|
||||
|
||||
stats.reset();
|
||||
|
||||
// global scalar
|
||||
if (fix->scalar_flag) {
|
||||
double value = fix->compute_scalar();
|
||||
if (ifix->scalar_flag) {
|
||||
double value = ifix->compute_scalar();
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_scalar, value, 10 * epsilon);
|
||||
}
|
||||
|
||||
// global vector
|
||||
if (fix->vector_flag) {
|
||||
int num = fix->size_vector;
|
||||
if (ifix->vector_flag) {
|
||||
int num = ifix->size_vector;
|
||||
EXPECT_EQ(num, test_config.global_vector.size());
|
||||
|
||||
for (int i = 0; i < num; ++i)
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], fix->compute_vector(i),
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], ifix->compute_vector(i),
|
||||
10 * epsilon);
|
||||
}
|
||||
if (print_stats && stats.has_data())
|
||||
@ -802,31 +796,30 @@ TEST(FixTimestep, omp)
|
||||
EXPECT_POSITIONS("run_pos (rmass, respa)", lmp->atom, test_config.run_pos, epsilon);
|
||||
EXPECT_VELOCITIES("run_vel (rmass, respa)", lmp->atom, test_config.run_vel, epsilon);
|
||||
|
||||
ifix = lmp->modify->find_fix("test");
|
||||
if (ifix < 0) {
|
||||
ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
Fix *fix = lmp->modify->fix[ifix];
|
||||
if (fix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (rmass, respa)", fix->virial, test_config.run_stress,
|
||||
if (ifix->thermo_virial) {
|
||||
EXPECT_STRESS("run_stress (rmass, respa)", ifix->virial, test_config.run_stress,
|
||||
1000 * epsilon);
|
||||
}
|
||||
|
||||
stats.reset();
|
||||
|
||||
// global scalar
|
||||
if (fix->scalar_flag) {
|
||||
double value = fix->compute_scalar();
|
||||
if (ifix->scalar_flag) {
|
||||
double value = ifix->compute_scalar();
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_scalar, value, 10 * epsilon);
|
||||
}
|
||||
|
||||
// global vector
|
||||
if (fix->vector_flag) {
|
||||
int num = fix->size_vector;
|
||||
if (ifix->vector_flag) {
|
||||
int num = ifix->size_vector;
|
||||
EXPECT_EQ(num, test_config.global_vector.size());
|
||||
|
||||
for (int i = 0; i < num; ++i)
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], fix->compute_vector(i),
|
||||
EXPECT_FP_LE_WITH_EPS(test_config.global_vector[i], ifix->compute_vector(i),
|
||||
10 * epsilon);
|
||||
}
|
||||
if (print_stats && stats.has_data())
|
||||
|
||||
@ -70,7 +70,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
// check if prerequisite styles are available
|
||||
Info *info = new Info(lmp);
|
||||
int nfail = 0;
|
||||
for (auto &prerequisite : cfg.prerequisites) {
|
||||
for (const auto &prerequisite : cfg.prerequisites) {
|
||||
std::string style = prerequisite.second;
|
||||
|
||||
// this is a test for improper styles, so if the suffixed
|
||||
@ -120,7 +120,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("variable input_dir index " + INPUT_FOLDER);
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -129,11 +129,11 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("improper_style " + cfg.improper_style);
|
||||
|
||||
for (auto &improper_coeff : cfg.improper_coeff) {
|
||||
for (const auto &improper_coeff : cfg.improper_coeff) {
|
||||
command("improper_coeff " + improper_coeff);
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -176,12 +176,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
}
|
||||
|
||||
if ((cfg.improper_style.substr(0, 6) == "hybrid") || !lmp->force->improper->writedata) {
|
||||
for (auto &improper_coeff : cfg.improper_coeff) {
|
||||
for (const auto &improper_coeff : cfg.improper_coeff) {
|
||||
command("improper_coeff " + improper_coeff);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
command("variable newton_bond delete");
|
||||
command("variable newton_bond index on");
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -214,10 +214,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file);
|
||||
parse_input_script(input_file);
|
||||
|
||||
for (auto &improper_coeff : cfg.improper_coeff) {
|
||||
for (const auto &improper_coeff : cfg.improper_coeff) {
|
||||
command("improper_coeff " + improper_coeff);
|
||||
}
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
command("run 0 post no");
|
||||
@ -234,7 +234,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
if (!lmp) {
|
||||
std::cerr << "One or more prerequisite styles are not available "
|
||||
"in this LAMMPS configuration:\n";
|
||||
for (auto &prerequisite : config.prerequisites) {
|
||||
for (const auto &prerequisite : config.prerequisites) {
|
||||
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
||||
}
|
||||
return;
|
||||
@ -253,7 +253,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
|
||||
// improper_coeff
|
||||
block.clear();
|
||||
for (auto &improper_coeff : config.improper_coeff) {
|
||||
for (const auto &improper_coeff : config.improper_coeff) {
|
||||
block += improper_coeff + "\n";
|
||||
}
|
||||
writer.emit_block("improper_coeff", block);
|
||||
@ -271,14 +271,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
writer.emit("init_energy", lmp->force->improper->energy);
|
||||
|
||||
// init_stress
|
||||
auto stress = lmp->force->improper->virial;
|
||||
auto *stress = lmp->force->improper->virial;
|
||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
||||
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||
writer.emit_block("init_stress", block);
|
||||
|
||||
// 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]);
|
||||
@ -339,7 +339,7 @@ TEST(ImproperStyle, plain)
|
||||
double epsilon = test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto improper = lmp->force->improper;
|
||||
auto *improper = lmp->force->improper;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", improper->virial, test_config.init_stress, epsilon);
|
||||
@ -459,7 +459,7 @@ TEST(ImproperStyle, omp)
|
||||
double epsilon = 5.0 * test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto improper = lmp->force->improper;
|
||||
auto *improper = lmp->force->improper;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", improper->virial, test_config.init_stress,
|
||||
|
||||
@ -130,7 +130,7 @@ void write_yaml_header(YamlWriter *writer, TestConfig *cfg, const char *version)
|
||||
|
||||
// skip tests
|
||||
block.clear();
|
||||
for (auto &skip : cfg->skip_tests) {
|
||||
for (const auto &skip : cfg->skip_tests) {
|
||||
if (block.empty())
|
||||
block = skip;
|
||||
else
|
||||
|
||||
@ -14,9 +14,9 @@
|
||||
#ifndef TEST_MAIN_H
|
||||
#define TEST_MAIN_H
|
||||
|
||||
#include "test_config.h"
|
||||
#include "lammps.h"
|
||||
#include "atom.h"
|
||||
#include "lammps.h"
|
||||
#include "test_config.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -37,9 +37,13 @@ void write_yaml_header(class YamlWriter *writer, TestConfig *cfg, const char *ve
|
||||
EXPECT_PRED_FORMAT2(::testing::DoubleLE, err, eps); \
|
||||
} while (0);
|
||||
|
||||
void EXPECT_STRESS(const std::string & name, double * stress, const stress_t & expected_stress, double epsilon);
|
||||
void EXPECT_FORCES(const std::string & name, LAMMPS_NS::Atom * atom, const std::vector<coord_t> & f_ref, double epsilon);
|
||||
void EXPECT_POSITIONS(const std::string & name, LAMMPS_NS::Atom * atom, const std::vector<coord_t> & x_ref, double epsilon);
|
||||
void EXPECT_VELOCITIES(const std::string & name, LAMMPS_NS::Atom * atom, const std::vector<coord_t> & v_ref, double epsilon);
|
||||
void EXPECT_STRESS(const std::string &name, double *stress, const stress_t &expected_stress,
|
||||
double epsilon);
|
||||
void EXPECT_FORCES(const std::string &name, LAMMPS_NS::Atom *atom,
|
||||
const std::vector<coord_t> &f_ref, double epsilon);
|
||||
void EXPECT_POSITIONS(const std::string &name, LAMMPS_NS::Atom *atom,
|
||||
const std::vector<coord_t> &x_ref, double epsilon);
|
||||
void EXPECT_VELOCITIES(const std::string &name, LAMMPS_NS::Atom *atom,
|
||||
const std::vector<coord_t> &v_ref, double epsilon);
|
||||
|
||||
#endif
|
||||
|
||||
@ -71,7 +71,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
// check if prerequisite styles are available
|
||||
Info *info = new Info(lmp);
|
||||
int nfail = 0;
|
||||
for (auto &prerequisite : cfg.prerequisites) {
|
||||
for (const auto &prerequisite : cfg.prerequisites) {
|
||||
std::string style = prerequisite.second;
|
||||
|
||||
// this is a test for pair styles, so if the suffixed
|
||||
@ -122,7 +122,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("variable input_dir index " + INPUT_FOLDER);
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("pair_style " + cfg.pair_style);
|
||||
|
||||
for (auto &pair_coeff : cfg.pair_coeff) {
|
||||
for (const auto &pair_coeff : cfg.pair_coeff) {
|
||||
command("pair_coeff " + pair_coeff);
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
command("pair_modify table 0");
|
||||
command("pair_modify table/disp 0");
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -188,12 +188,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg, bool nofdotr = false, bo
|
||||
command("pair_style " + cfg.pair_style);
|
||||
}
|
||||
if (!lmp->force->pair->restartinfo || !lmp->force->pair->writedata) {
|
||||
for (auto &pair_coeff : cfg.pair_coeff) {
|
||||
for (const auto &pair_coeff : cfg.pair_coeff) {
|
||||
command("pair_coeff " + pair_coeff);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
if (nofdotr) command("pair_modify nofdotr");
|
||||
@ -217,7 +217,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
command("variable newton_pair delete");
|
||||
command("variable newton_pair index on");
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -227,10 +227,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file);
|
||||
parse_input_script(input_file);
|
||||
|
||||
for (auto &pair_coeff : cfg.pair_coeff) {
|
||||
for (const auto &pair_coeff : cfg.pair_coeff) {
|
||||
command("pair_coeff " + pair_coeff);
|
||||
}
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
command("run 0 post no");
|
||||
@ -287,7 +287,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
writer.emit("init_coul", lmp->force->pair->eng_coul);
|
||||
|
||||
// init_stress
|
||||
auto stress = lmp->force->pair->virial;
|
||||
auto *stress = lmp->force->pair->virial;
|
||||
// avoid false positives on tiny stresses. force to zero instead.
|
||||
for (int i = 0; i < 6; ++i)
|
||||
if (fabs(stress[i]) < 1.0e-13) stress[i] = 0.0;
|
||||
@ -297,7 +297,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]);
|
||||
@ -367,7 +367,7 @@ TEST(PairStyle, plain)
|
||||
if (lmp->force->kspace && lmp->force->kspace->compute_flag)
|
||||
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
||||
#endif
|
||||
auto pair = lmp->force->pair;
|
||||
auto *pair = lmp->force->pair;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", pair->virial, test_config.init_stress, epsilon);
|
||||
@ -547,7 +547,7 @@ TEST(PairStyle, omp)
|
||||
if (lmp->force->kspace && lmp->force->kspace->compute_flag)
|
||||
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
||||
#endif
|
||||
auto pair = lmp->force->pair;
|
||||
auto *pair = lmp->force->pair;
|
||||
ErrorStats stats;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
@ -679,7 +679,7 @@ TEST(PairStyle, kokkos_omp)
|
||||
if (lmp->force->kspace && lmp->force->kspace->compute_flag)
|
||||
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
||||
#endif
|
||||
auto pair = lmp->force->pair;
|
||||
auto *pair = lmp->force->pair;
|
||||
ErrorStats stats;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
@ -821,7 +821,7 @@ TEST(PairStyle, gpu)
|
||||
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
||||
#endif
|
||||
ErrorStats stats;
|
||||
auto pair = lmp->force->pair;
|
||||
auto *pair = lmp->force->pair;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 10 * epsilon);
|
||||
@ -902,7 +902,7 @@ TEST(PairStyle, intel)
|
||||
ASSERT_EQ(lmp->atom->natoms, nlocal);
|
||||
|
||||
ErrorStats stats;
|
||||
auto pair = lmp->force->pair;
|
||||
auto *pair = lmp->force->pair;
|
||||
|
||||
EXPECT_FORCES("init_forces", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress", pair->virial, test_config.init_stress, 10 * epsilon);
|
||||
@ -973,7 +973,7 @@ TEST(PairStyle, opt)
|
||||
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
||||
#endif
|
||||
ErrorStats stats;
|
||||
auto pair = lmp->force->pair;
|
||||
auto *pair = lmp->force->pair;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress", pair->virial, test_config.init_stress, 10 * epsilon);
|
||||
@ -1284,7 +1284,7 @@ TEST(PairStyle, extract)
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto pair = lmp->force->pair;
|
||||
auto *pair = lmp->force->pair;
|
||||
if (!pair->compute_flag) {
|
||||
std::cerr << "Pair style disabled" << std::endl;
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
---
|
||||
lammps_version: 3 Nov 2022
|
||||
date_generated: Thu Dec 1 23:18:00 2022
|
||||
lammps_version: 17 Apr 2024
|
||||
date_generated: Wed May 22 23:39:15 2024
|
||||
epsilon: 5e-11
|
||||
skip_tests:
|
||||
skip_tests: kokkos_omp
|
||||
prerequisites: ! |
|
||||
pair pod
|
||||
pre_commands: ! |
|
||||
@ -15,142 +15,142 @@ pair_coeff: ! |
|
||||
* * Ta_param.pod Ta_coeff.pod Ta Ta Ta Ta Ta Ta Ta Ta
|
||||
extract: ! ""
|
||||
natoms: 64
|
||||
init_vdwl: -528.2910264879091
|
||||
init_vdwl: -410.2384867313104
|
||||
init_coul: 0
|
||||
init_stress: ! |2-
|
||||
8.3402602596264614e+00 2.0643446850903056e+00 1.5678421067854520e+01 -2.9333918215385154e+01 1.1525924506418683e+02 -1.5484432052782759e+00
|
||||
4.9022269500032161e+02 4.9376448227589816e+02 5.3401476248646236e+02 -4.6634637000407110e+01 2.2048539348045341e+02 7.5348803918588310e+00
|
||||
init_forces: ! |2
|
||||
1 -2.3392393040434762e+00 6.6115449678096514e+00 6.3527759473517156e+00
|
||||
2 -6.2200179688845711e+00 -2.3262609632188291e+00 -5.8808304295691327e+00
|
||||
3 5.9926007198108278e-01 1.1403349257840218e+00 -9.4165026520447437e-01
|
||||
4 -4.3700401366848958e+00 6.7048502738679057e+00 3.5634847031773593e+00
|
||||
5 -1.7470266510830950e+00 -2.2743594271203493e+00 2.4630591043738376e-01
|
||||
6 2.7662435046081360e+00 7.4528086029205447e+00 1.6339061500227601e+00
|
||||
7 -2.9166253939568025e+00 -2.4536749402602376e+00 2.3182705383557933e+00
|
||||
8 2.8946709981057628e-01 1.5909888405138495e+00 -2.1105547647724223e+00
|
||||
9 -1.5405949554576286e+00 -6.1324586921740476e+00 -7.0213669939760557e+00
|
||||
10 -1.5334402378809839e+00 -4.4115934928250260e+00 -6.0498836493599777e+00
|
||||
11 8.1115391088463884e+00 -8.3763095375040244e+00 5.2840196513645203e+00
|
||||
12 -1.4493449045465287e+01 -9.0119905221230852e+00 -9.1884252425735404e+00
|
||||
13 -3.1435238028908983e+00 1.5461007451567864e+01 -1.0076469584259284e+00
|
||||
14 -5.4205532111806916e+00 9.9326708251595193e+00 2.2979562969461060e+00
|
||||
15 -1.0589399394041576e+01 9.6706823152119537e+00 -8.9048432574359762e+00
|
||||
16 4.5379777179391692e+00 2.6753273724858251e+00 1.6728868669531220e+01
|
||||
17 2.4231102065317467e+00 6.6764545944727640e+00 -1.0929016615111141e+01
|
||||
18 1.9001246269761145e+00 -3.6109316050143847e-01 9.5729789832831536e+00
|
||||
19 -4.4582683048316527e+00 -3.8337351622472888e+00 -2.3885319247539311e-01
|
||||
20 -1.7234496227840264e+01 3.3880881715108195e+00 1.2553324705664071e+00
|
||||
21 3.8327346102873112e+00 1.3689088998574568e+00 -6.7734781208496067e+00
|
||||
22 -1.7001862101985854e+01 7.9556220149572905e+00 -1.1396344475647043e+01
|
||||
23 2.9704272880493647e+00 5.6280520280509627e+00 4.4599373849291188e+00
|
||||
24 5.1191743796738054e+00 5.2439635854557300e+00 6.9669903792262637e+00
|
||||
25 3.1385438320794972e+00 1.5005115524258683e-01 3.5282799800496791e+00
|
||||
26 -1.4971212625777275e+00 -1.5993407658221612e+00 4.4215766627169029e-02
|
||||
27 5.8677239676274295e+00 -1.3937781993546274e+00 3.0680498990918013e+00
|
||||
28 1.6650007215138052e+00 1.4050177349920281e+00 1.1885511993248887e+01
|
||||
29 -8.9875167123509261e+00 8.8933864134358698e-01 -3.6241931326798387e+00
|
||||
30 -3.4012728709189108e+00 5.3067868144126020e+00 -1.7059788210178979e+00
|
||||
31 -1.6808177204782935e+00 3.6001199301353184e+00 -1.8965796755169291e+00
|
||||
32 -8.4589813130988354e+00 1.4471022875060062e+00 -1.9000039702897311e+00
|
||||
33 1.2004088752851128e+01 -7.6040571970971325e+00 8.9711523713098167e+00
|
||||
34 -5.7853936051884869e-01 -5.5952766750718474e-01 1.8048877814027433e+00
|
||||
35 1.7041340304224681e+00 -2.1620245429916412e+00 7.3832310666592491e+00
|
||||
36 1.0759330410207228e+00 -5.2129028438242146e+00 -1.6618705041668638e+00
|
||||
37 -4.3766428392731020e+00 6.0078246009400225e+00 -6.3940625140062162e+00
|
||||
38 5.0631928812981353e-01 -1.9854379582110893e+00 -8.7394124979891918e-01
|
||||
39 3.9645469430932123e+00 -4.0889983203207603e+00 -9.4674125279283405e+00
|
||||
40 1.1408365247060711e+01 -4.9051255563902521e+00 -3.5203986381487034e+00
|
||||
41 8.9930170478826255e-01 -2.9723940028022749e-01 -2.7822061438575032e+00
|
||||
42 -8.2546434609765491e+00 -5.0786202506116558e+00 -3.1610980747309330e+00
|
||||
43 1.7453841082299018e-01 -1.4317767182746747e+01 9.5388782303919595e-01
|
||||
44 9.2833287607601704e+00 -1.0681022246160646e+01 6.1028355724777370e+00
|
||||
45 -6.8974324969212919e-01 6.3655097649365064e+00 -8.9950272187335738e+00
|
||||
46 -1.9136248882346150e+00 -4.0755806589261594e+00 1.1571248503615134e+01
|
||||
47 6.3780001004629598e+00 5.1350413335416709e+00 2.8185819965629695e+00
|
||||
48 2.3349283531253415e+00 2.1970268162712099e+00 1.6856734874305396e-01
|
||||
49 -2.7493238702004135e+00 -1.1923367561779225e+01 -7.9142306720304925e+00
|
||||
50 2.1137961711743793e+00 7.2552695007878203e+00 -3.0372809596181289e+00
|
||||
51 -4.0124421354950526e+00 8.4837473611119112e+00 8.7141826644925846e+00
|
||||
52 1.1814661298567525e+01 -1.2353995700415600e+01 1.3991622034448220e+01
|
||||
53 5.1071497748726138e+00 7.9192961995549869e+00 3.0451616568663176e+00
|
||||
54 5.7344562859078723e+00 -5.6931437492303356e+00 -4.8826542194642482e+00
|
||||
55 7.3943947205193865e+00 -8.5087783592690300e+00 -9.0269109278555035e+00
|
||||
56 -1.2364980298872756e+00 2.8110998820116406e+00 -5.9239020363740682e+00
|
||||
57 6.7325527399301921e-01 -3.6874160252952128e+00 2.8091898013156175e-02
|
||||
58 7.1394993630780750e+00 -4.6917597169219567e+00 3.7096580604620573e+00
|
||||
59 7.1384731244518367e+00 4.5429051835770045e+00 -3.7696484765066689e+00
|
||||
60 -2.7523129793377530e+00 -1.3097943737066757e+01 -7.8971319483098377e+00
|
||||
61 -1.0075765403185517e+00 3.0273548833080430e+00 7.4229195890612620e-01
|
||||
62 -7.4584126192112432e+00 6.1810894357594544e+00 -4.7073228253497668e+00
|
||||
63 5.5714938235965326e+00 -7.2641750905285418e+00 -1.3520886322174430e-01
|
||||
64 6.4220149841744343e+00 6.1375922336668411e+00 1.4507671903798933e+01
|
||||
run_vdwl: -528.4347251401716
|
||||
1 -6.5309656460745176e+00 1.5136950705258570e+01 1.2830910711300305e+01
|
||||
2 -1.2940507079967830e+01 -3.5631648591238543e+00 -1.0214881372571252e+01
|
||||
3 1.1840607479263618e+00 7.8142238369613634e-02 1.3240303824011606e+00
|
||||
4 -9.0461335840304820e+00 1.6421054745047698e+01 6.4222834402787807e+00
|
||||
5 -4.4455346073705702e+00 -4.1219343948158027e+00 -5.5842666723140122e-01
|
||||
6 3.2213927131196227e+00 1.1032802936344874e+01 3.0883816090681262e+00
|
||||
7 -5.7205216568442898e+00 -6.8544078802481367e+00 5.2674515578636942e+00
|
||||
8 6.0111554116682031e-01 3.4511519325170048e+00 -4.5941525646668211e+00
|
||||
9 -1.4526139655777426e+00 -8.7953804018537447e+00 -1.4636593034048555e+01
|
||||
10 -3.0589120606514926e+00 -5.4340999066836231e+00 -1.1172796666813920e+01
|
||||
11 1.7088277560021435e+01 -1.5276120120148034e+01 8.9060567572450271e+00
|
||||
12 -2.9117544549492202e+01 -2.1064559487005187e+01 -1.8636986170532495e+01
|
||||
13 -6.6893025487697964e+00 2.7843146294204274e+01 -3.5437779307946062e+00
|
||||
14 -7.7405502276036868e+00 1.9431305897646496e+01 2.1526579171664033e+00
|
||||
15 -1.9545657754082125e+01 2.0442371318209393e+01 -2.0523256937154013e+01
|
||||
16 9.5615547920076018e+00 5.4756899497367311e+00 3.5413364373315964e+01
|
||||
17 1.2253504203849257e+01 1.3589807830658817e+01 -2.2500326738186136e+01
|
||||
18 2.2124639486062221e+00 2.2809987521199040e+00 1.5758845653021112e+01
|
||||
19 -6.3950994796785006e+00 -4.8699822827926926e+00 -3.1962502168207942e+00
|
||||
20 -3.3627599797510769e+01 4.5760242653884964e+00 1.1193156541788161e+00
|
||||
21 7.4838568397591079e+00 -5.1207595910489445e-01 -1.4992882449114250e+01
|
||||
22 -3.4449997256078106e+01 2.1741776689366528e+01 -3.0417180343226505e+01
|
||||
23 7.9887113570118933e+00 1.0438063420737590e+01 1.0091519629819238e+01
|
||||
24 9.7852248103822959e+00 9.7889444207140013e+00 1.5136372070559037e+01
|
||||
25 3.5103998923461819e+00 -1.5100586339785624e+00 5.5475098167386134e+00
|
||||
26 -2.3008256029170466e+00 -2.0174388797869449e+00 1.9545086913927323e+00
|
||||
27 1.0039500741707045e+01 -3.1588365173094504e+00 9.3848763376352391e+00
|
||||
28 -1.4083492857943631e+00 4.1375942367837668e+00 2.6358883116452407e+01
|
||||
29 -1.6685913766983656e+01 4.1539019657446268e+00 -3.7537458526927523e+00
|
||||
30 -7.6144642645204907e+00 6.0113715813093060e+00 -3.4564713928280479e+00
|
||||
31 -4.6736071866510853e+00 3.5740208613338460e+00 -3.9804803532942383e+00
|
||||
32 -1.5090127957560838e+01 2.5244087972039599e+00 -4.0536958417737612e-01
|
||||
33 2.2910206651674123e+01 -1.3798345086683828e+01 2.0482484505011463e+01
|
||||
34 -3.2945485908987826e-01 -2.6940721407664836e-01 2.4013911392867491e+00
|
||||
35 4.0268128446735867e+00 -4.2310161488536231e+00 1.1833154238724031e+01
|
||||
36 1.8176664409683010e+00 -9.9717312276132404e+00 -1.0705406852645392e+00
|
||||
37 -8.7538731502277631e+00 1.1752672812645274e+01 -1.1502704798839771e+01
|
||||
38 7.7453544260003293e-01 -2.4965513045447469e+00 -1.2510837732921312e+00
|
||||
39 9.0720516886890437e+00 -1.0241574684450409e+01 -2.0125449908359894e+01
|
||||
40 2.1465855776579673e+01 -1.3945447695026113e+01 -6.8486054161315177e+00
|
||||
41 5.8218260667899235e-01 6.7397922005993927e-03 -4.3763156201017992e+00
|
||||
42 -1.7796616176495530e+01 -1.1876849631671941e+01 -6.5762224655816057e+00
|
||||
43 2.2561922687325264e-01 -2.7952402275494197e+01 2.3071524509277532e+00
|
||||
44 1.8273606348811121e+01 -1.8270176207703763e+01 1.1553297319423622e+01
|
||||
45 -3.0025628389975361e+00 1.0002999257048362e+01 -1.7274093092002033e+01
|
||||
46 -9.9318239294853541e+00 -1.1063063257046228e+01 2.5506588121185374e+01
|
||||
47 1.2015259386911902e+01 7.6825848695752921e+00 7.0333133736024660e+00
|
||||
48 5.7899647779327026e+00 3.2746635122022458e+00 -1.1752244050919269e+00
|
||||
49 -8.9935815020004419e+00 -2.5297833390011153e+01 -1.8128341059967077e+01
|
||||
50 6.1790085074083834e+00 1.1813127434920705e+01 -3.6514228454756243e+00
|
||||
51 -9.2599602619592787e+00 1.9288829774487141e+01 1.8937881926332754e+01
|
||||
52 2.9141853544236550e+01 -2.7494790952397580e+01 3.4660583704205401e+01
|
||||
53 1.1206014879007400e+01 1.7523020000928515e+01 1.2988678958733903e+01
|
||||
54 1.0431466502947194e+01 -1.1687276483271816e+01 -1.1336899434652105e+01
|
||||
55 1.2415001892790189e+01 -1.7878500490336062e+01 -1.6472325204596654e+01
|
||||
56 2.6613894171112085e-01 4.0079831610028149e+00 -9.8746421300278371e+00
|
||||
57 1.5692367582328075e+00 -2.4289345724552045e+00 -9.1995230565583319e-01
|
||||
58 1.1367350546392537e+01 -5.8645633268290105e+00 3.2877167594860066e+00
|
||||
59 1.8898584008894929e+01 1.1671628659054432e+01 -8.5427078178989362e+00
|
||||
60 -1.1387945012612548e+01 -2.9286235529609694e+01 -1.9947277172440270e+01
|
||||
61 -1.4071422389863422e+00 6.4943348750183700e+00 -1.6633123081670118e+00
|
||||
62 -1.2840583041198794e+01 1.2467088032510793e+01 -9.7932585156189589e+00
|
||||
63 1.3563230239150005e+01 -1.2591906395758119e+01 -7.1985326718517948e+00
|
||||
64 1.5316061128145364e+01 1.5709464176394246e+01 3.2563279689814330e+01
|
||||
run_vdwl: -410.95413331281003
|
||||
run_coul: 0
|
||||
run_stress: ! |2-
|
||||
7.7971581234640315e+00 1.8180180509574915e+00 1.5567974498446516e+01 -2.9195299100177184e+01 1.1463660454201184e+02 -5.2901271066816291e-01
|
||||
4.8790084081098820e+02 4.9205993579439655e+02 5.3253514832117412e+02 -4.5873719143318795e+01 2.1842439537916931e+02 9.6108180261237450e+00
|
||||
run_forces: ! |2
|
||||
1 -2.3557887177307792e+00 6.5793731923015173e+00 6.3446661307546002e+00
|
||||
2 -6.2367472254464031e+00 -2.3761037176199591e+00 -5.8990027484700320e+00
|
||||
3 5.3238059272327787e-01 1.1536607145682118e+00 -8.5829897588453263e-01
|
||||
4 -4.3203333339340588e+00 6.6864673083581083e+00 3.4793826832962589e+00
|
||||
5 -1.7840492185151171e+00 -2.3155960934908837e+00 2.7377581222153680e-01
|
||||
6 2.8816106613622541e+00 7.4501692252795770e+00 1.7092006941013815e+00
|
||||
7 -2.8584187538461769e+00 -2.3893423666220168e+00 2.2712697534638027e+00
|
||||
8 2.6439659507712282e-01 1.5681078897310405e+00 -2.1056485467168455e+00
|
||||
9 -1.6108220540466460e+00 -6.1741812147002300e+00 -7.0538474688530526e+00
|
||||
10 -1.5537395777250562e+00 -4.3955446040745887e+00 -5.9667736677685053e+00
|
||||
11 8.0104517885225182e+00 -8.3131733252237368e+00 5.2213147662230943e+00
|
||||
12 -1.4435736887913940e+01 -8.9362068248018307e+00 -9.1408788688901357e+00
|
||||
13 -2.9914115492926050e+00 1.5429230434822207e+01 -9.0984604918070788e-01
|
||||
14 -5.4746584593313159e+00 9.9027748295330564e+00 2.2366269028203853e+00
|
||||
15 -1.0550844601713422e+01 9.6107656645359096e+00 -8.8185763639657502e+00
|
||||
16 4.5023825249444860e+00 2.6965293303384019e+00 1.6638570998809584e+01
|
||||
17 2.3773309428087694e+00 6.6422561690528514e+00 -1.0829016891781128e+01
|
||||
18 1.8114374434267531e+00 -3.0183319744394677e-01 9.6008681727027714e+00
|
||||
19 -4.5474501019651816e+00 -3.8744552075410721e+00 -2.7559291041454143e-01
|
||||
20 -1.7142681562663874e+01 3.3426003047767030e+00 1.1954254910500022e+00
|
||||
21 3.8576154875972057e+00 1.2952295974238952e+00 -6.8418604194700734e+00
|
||||
22 -1.6932518707227068e+01 7.9121058022000454e+00 -1.1375062696143653e+01
|
||||
23 2.9996562341895361e+00 5.6579801576633635e+00 4.4728006000546641e+00
|
||||
24 5.1680026224182871e+00 5.1810573601411045e+00 6.9298319426021155e+00
|
||||
25 3.1353884361512914e+00 1.6058771944664529e-01 3.4758213715479744e+00
|
||||
26 -1.5161565674716488e+00 -1.5510416049393845e+00 5.1443392259165305e-02
|
||||
27 5.8829868840537012e+00 -1.4576271120974353e+00 3.0939941761392094e+00
|
||||
28 1.6230499697020511e+00 1.4636285126942963e+00 1.1875062811913887e+01
|
||||
29 -9.0044083076844927e+00 8.9978643282364112e-01 -3.6333182759219680e+00
|
||||
30 -3.3592923882740333e+00 5.2571864710026954e+00 -1.7077396196968402e+00
|
||||
31 -1.6500480953824879e+00 3.5931111402419305e+00 -1.8893711494790042e+00
|
||||
32 -8.3873358693088083e+00 1.4007390010793448e+00 -1.9140680409249233e+00
|
||||
33 1.1929925271781036e+01 -7.5607293607213562e+00 8.9276374053193166e+00
|
||||
34 -5.8208023141639853e-01 -5.5745007964822024e-01 1.8277744619456637e+00
|
||||
35 1.7136741165547187e+00 -2.1140334235225700e+00 7.3627368355304368e+00
|
||||
36 9.8461575627457365e-01 -5.1895947221609999e+00 -1.7416681629788844e+00
|
||||
37 -4.3479597602556987e+00 5.9771199348457786e+00 -6.4035952128921325e+00
|
||||
38 5.4022686330729042e-01 -1.9715997267295688e+00 -8.5655067815022723e-01
|
||||
39 3.9223699424296088e+00 -4.0527508147694391e+00 -9.4209981476048874e+00
|
||||
40 1.1452927978439993e+01 -4.8883937399550499e+00 -3.5415966186040104e+00
|
||||
41 9.6744931407782142e-01 -2.1966543538862224e-01 -2.7321296820305050e+00
|
||||
42 -8.2423780480934816e+00 -5.1198905741883944e+00 -3.2132369293703431e+00
|
||||
43 1.3449232112837139e-01 -1.4266031489439955e+01 9.0529636113665890e-01
|
||||
44 9.2864716878942914e+00 -1.0653224674860530e+01 6.0756644746289155e+00
|
||||
45 -7.3279419010510516e-01 6.2791577709783972e+00 -8.9108524114379080e+00
|
||||
46 -1.9039679778788625e+00 -4.0528901631980760e+00 1.1630733460046352e+01
|
||||
47 6.3763337760997540e+00 5.1233125844104510e+00 2.8138206914970656e+00
|
||||
48 2.3380859800951628e+00 2.2326450966381390e+00 1.5287384487626418e-01
|
||||
49 -2.8014223230382376e+00 -1.2044581352367127e+01 -8.0347575819620474e+00
|
||||
50 2.1422145518477187e+00 7.2424826745901107e+00 -3.0637741546937911e+00
|
||||
51 -4.1001979259164552e+00 8.5374368127020315e+00 8.7144930213835430e+00
|
||||
52 1.1806523391252540e+01 -1.2284601329073553e+01 1.3944720496276224e+01
|
||||
53 5.1475653317387939e+00 8.0227245379881804e+00 3.2309313222296896e+00
|
||||
54 5.7087433874913218e+00 -5.6601583438330563e+00 -4.8237069484155661e+00
|
||||
55 7.3380406496835295e+00 -8.4939091917007623e+00 -8.9244600192476753e+00
|
||||
56 -1.2296439276523572e+00 2.7286867585656513e+00 -5.9003523038759793e+00
|
||||
57 6.7476852384192298e-01 -3.7254641308262482e+00 2.8703807089098310e-02
|
||||
58 7.1320373971199791e+00 -4.6322478918816286e+00 3.6412286305653043e+00
|
||||
59 7.1937029046281671e+00 4.5742558433451368e+00 -3.7956679883677404e+00
|
||||
60 -2.8288653495291820e+00 -1.3157182815231137e+01 -8.0095169657552905e+00
|
||||
61 -9.9276745329887783e-01 3.0408835454693719e+00 7.7871977254688995e-01
|
||||
62 -7.4381007616019534e+00 6.1448378054475778e+00 -4.6683183548425067e+00
|
||||
63 5.5682593755810563e+00 -7.3119820285913608e+00 -2.0100166481798887e-01
|
||||
64 6.5075012240147911e+00 6.2545959336473818e+00 1.4555696233577285e+01
|
||||
1 -6.5302803795000290e+00 1.5008954908518220e+01 1.2782766637899464e+01
|
||||
2 -1.2934741296371032e+01 -3.6438072106762904e+00 -1.0246581399698554e+01
|
||||
3 1.0643480774329184e+00 1.0989547091417427e-01 1.4801781422346918e+00
|
||||
4 -8.9226910214328239e+00 1.6321523200898003e+01 6.2179284477980232e+00
|
||||
5 -4.5119654536969218e+00 -4.1943337605490028e+00 -4.8629594604243609e-01
|
||||
6 3.4244292871038868e+00 1.1012732723744625e+01 3.2299851721747284e+00
|
||||
7 -5.5862410538320386e+00 -6.6671008844509725e+00 5.1913141572097166e+00
|
||||
8 5.3126458099185025e-01 3.4389030581062028e+00 -4.5870201926573246e+00
|
||||
9 -1.5622177052008701e+00 -8.9020051785312262e+00 -1.4701518090551732e+01
|
||||
10 -3.0591678312765946e+00 -5.4158915784047590e+00 -1.0964556434767903e+01
|
||||
11 1.6768303951099774e+01 -1.5065980362127185e+01 8.6873741539509943e+00
|
||||
12 -2.8813455142674830e+01 -2.0677967398177774e+01 -1.8373258081926309e+01
|
||||
13 -6.2569142109062987e+00 2.7676713246771225e+01 -3.2364279874555373e+00
|
||||
14 -7.8393240949615413e+00 1.9273532542231486e+01 2.1077587433100926e+00
|
||||
15 -1.9352852035481355e+01 2.0180072338350978e+01 -2.0170893936505685e+01
|
||||
16 9.4324861638733104e+00 5.3569724992305350e+00 3.5033266543818804e+01
|
||||
17 1.2060916139212019e+01 1.3441297772382116e+01 -2.2283643611677071e+01
|
||||
18 2.0111753518086517e+00 2.4058400344736341e+00 1.5784276453941457e+01
|
||||
19 -6.5346697411474599e+00 -4.9781337821759220e+00 -3.2673336920063463e+00
|
||||
20 -3.3284105689885557e+01 4.3787585843148262e+00 9.3274022092125008e-01
|
||||
21 7.5368441125225569e+00 -6.6312144471864132e-01 -1.5138365776222530e+01
|
||||
22 -3.4057426354942756e+01 2.1405565842769381e+01 -2.9984321416266358e+01
|
||||
23 8.0469707811206597e+00 1.0477541834191719e+01 1.0131508224936237e+01
|
||||
24 9.8383826417631148e+00 9.6349625198578526e+00 1.5013294254149651e+01
|
||||
25 3.4810928893469715e+00 -1.4841921158444644e+00 5.4642693824111372e+00
|
||||
26 -2.3223608191381340e+00 -1.9382774168314612e+00 1.9587113445207314e+00
|
||||
27 1.0055183772571926e+01 -3.2340066923335420e+00 9.4069162395840653e+00
|
||||
28 -1.4807366090187568e+00 4.2563893473777270e+00 2.6233758242745271e+01
|
||||
29 -1.6703205460657923e+01 4.1651596726989162e+00 -3.7499748242430431e+00
|
||||
30 -7.5315305395260133e+00 5.9234388839590926e+00 -3.4452711570790400e+00
|
||||
31 -4.6531876936546235e+00 3.5592882805052772e+00 -3.9598740266606969e+00
|
||||
32 -1.4944303903312775e+01 2.4471615913038161e+00 -4.2650219550740687e-01
|
||||
33 2.2658757219633507e+01 -1.3584416809504527e+01 2.0208960807112184e+01
|
||||
34 -3.3589165465629545e-01 -2.6107343201152533e-01 2.4480790007625792e+00
|
||||
35 4.0211644744872297e+00 -4.1429951008983439e+00 1.1760815779271793e+01
|
||||
36 1.6800414992388888e+00 -9.9255954579260965e+00 -1.2707502624572800e+00
|
||||
37 -8.6804527612389748e+00 1.1664083566069120e+01 -1.1501862395898650e+01
|
||||
38 8.4680311647032236e-01 -2.4612760516651839e+00 -1.2097356180320062e+00
|
||||
39 8.9453757306916213e+00 -1.0088842671984429e+01 -2.0010220469214108e+01
|
||||
40 2.1504084288180351e+01 -1.3896767860015089e+01 -6.8807964610220305e+00
|
||||
41 7.0920990633236713e-01 1.2470146465265874e-01 -4.2863469697626764e+00
|
||||
42 -1.7782621211784086e+01 -1.1955425533865377e+01 -6.6645896379089864e+00
|
||||
43 1.1161210933461418e-01 -2.7806283629207936e+01 2.1722600588316636e+00
|
||||
44 1.8203724536783220e+01 -1.8177439994718490e+01 1.1405342753966950e+01
|
||||
45 -3.0178433365984279e+00 9.8077736148291894e+00 -1.7038567454709415e+01
|
||||
46 -9.8284407570915224e+00 -1.0940905728232703e+01 2.5546254074522583e+01
|
||||
47 1.1994531752732673e+01 7.6401656163848370e+00 6.9803825716270822e+00
|
||||
48 5.7959428775443431e+00 3.3532761798385975e+00 -1.2090959321884160e+00
|
||||
49 -9.0871621934125741e+00 -2.5525880549057131e+01 -1.8352634645685395e+01
|
||||
50 6.2385949228372839e+00 1.1775731352242135e+01 -3.6905119289093129e+00
|
||||
51 -9.3751646607544306e+00 1.9380398875813281e+01 1.8936970290617868e+01
|
||||
52 2.8857474615857534e+01 -2.7077834887393038e+01 3.4226465823003075e+01
|
||||
53 1.1272120589697714e+01 1.7723730455257613e+01 1.3346433354217156e+01
|
||||
54 1.0332668416350394e+01 -1.1587076788781554e+01 -1.1187068870176809e+01
|
||||
55 1.2173218480738553e+01 -1.7697903958592068e+01 -1.6191659128871123e+01
|
||||
56 2.8687984465975036e-01 3.8573613826299376e+00 -9.8055015944721848e+00
|
||||
57 1.5729444649974420e+00 -2.4852524890772023e+00 -9.1852174894903216e-01
|
||||
58 1.1318588067888333e+01 -5.7432426696637133e+00 3.1502768462440778e+00
|
||||
59 1.8921515215481648e+01 1.1640044816648190e+01 -8.5417711391321323e+00
|
||||
60 -1.1460356409734461e+01 -2.9330410460922113e+01 -2.0104676097775538e+01
|
||||
61 -1.3788623174852395e+00 6.5163432076409729e+00 -1.5956661994290990e+00
|
||||
62 -1.2770749422150793e+01 1.2364427527668891e+01 -9.6757027946868899e+00
|
||||
63 1.3527485731142161e+01 -1.2652030425033526e+01 -7.2614405652239205e+00
|
||||
64 1.5374786151597569e+01 1.5882729911096058e+01 3.2580670961989632e+01
|
||||
...
|
||||
|
||||
@ -22,9 +22,9 @@ class YamlWriter {
|
||||
public:
|
||||
YamlWriter(const char *outfile);
|
||||
virtual ~YamlWriter();
|
||||
YamlWriter() = delete;
|
||||
YamlWriter(const YamlWriter &) = delete;
|
||||
const YamlWriter & operator=(const YamlWriter &) = delete;
|
||||
YamlWriter() = delete;
|
||||
YamlWriter(const YamlWriter &) = delete;
|
||||
const YamlWriter &operator=(const YamlWriter &) = delete;
|
||||
|
||||
// emitters
|
||||
void emit(const std::string &key, const double value);
|
||||
|
||||
@ -101,8 +101,8 @@ public:
|
||||
{
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
std::string converted_file = compressed_file.substr(0, compressed_file.find_last_of('.'));
|
||||
std::string cmdline =
|
||||
fmt::format("\"{}\" -d -c {} > {}", COMPRESS_EXECUTABLE, compressed_file, converted_file);
|
||||
std::string cmdline = fmt::format("\"{}\" -d -c {} > {}", COMPRESS_EXECUTABLE,
|
||||
compressed_file, converted_file);
|
||||
system(cmdline.c_str());
|
||||
END_HIDE_OUTPUT();
|
||||
return converted_file;
|
||||
|
||||
@ -553,8 +553,8 @@ TEST_F(AtomStyleTest, atomic)
|
||||
ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC);
|
||||
ASSERT_EQ(lmp->atom->ntypes, 2);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -642,7 +642,7 @@ TEST_F(AtomStyleTest, atomic)
|
||||
command("replicate 2 2 2");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 16);
|
||||
x = lmp->atom->x;
|
||||
x = lmp->atom->x;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -870,9 +870,9 @@ TEST_F(AtomStyleTest, charge)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 4);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto q = lmp->atom->q;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *q = lmp->atom->q;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -1056,10 +1056,10 @@ TEST_F(AtomStyleTest, sphere)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 4);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto omega = lmp->atom->omega;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
auto *omega = lmp->atom->omega;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -1243,13 +1243,13 @@ TEST_F(AtomStyleTest, ellipsoid)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto ellipsoid = lmp->atom->ellipsoid;
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto avec = dynamic_cast<AtomVecEllipsoid *>(lmp->atom->avec);
|
||||
auto bonus = avec->bonus;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
auto *ellipsoid = lmp->atom->ellipsoid;
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
auto *avec = dynamic_cast<AtomVecEllipsoid *>(lmp->atom->avec);
|
||||
auto *bonus = avec->bonus;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -1571,13 +1571,13 @@ TEST_F(AtomStyleTest, line)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto line = lmp->atom->line;
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto avec = dynamic_cast<AtomVecLine *>(lmp->atom->avec);
|
||||
auto bonus = avec->bonus;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
auto *line = lmp->atom->line;
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
auto *avec = dynamic_cast<AtomVecLine *>(lmp->atom->avec);
|
||||
auto *bonus = avec->bonus;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.0, EPSILON);
|
||||
@ -1853,14 +1853,14 @@ TEST_F(AtomStyleTest, tri)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto tri = lmp->atom->tri;
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto radius = lmp->atom->radius;
|
||||
auto avec = dynamic_cast<AtomVecTri *>(lmp->atom->avec);
|
||||
auto bonus = avec->bonus;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
auto *tri = lmp->atom->tri;
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
auto *radius = lmp->atom->radius;
|
||||
auto *avec = dynamic_cast<AtomVecTri *>(lmp->atom->avec);
|
||||
auto *bonus = avec->bonus;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -2180,7 +2180,7 @@ TEST_F(AtomStyleTest, body_nparticle)
|
||||
|
||||
ASSERT_ATOM_STATE_EQ(lmp->atom, expected);
|
||||
|
||||
auto avec = dynamic_cast<AtomVecBody *>(lmp->atom->avec);
|
||||
auto *avec = dynamic_cast<AtomVecBody *>(lmp->atom->avec);
|
||||
ASSERT_NE(lmp->atom->avec, nullptr);
|
||||
ASSERT_NE(avec->bptr, nullptr);
|
||||
ASSERT_THAT(std::string(avec->bptr->style), Eq("nparticle"));
|
||||
@ -2265,14 +2265,14 @@ TEST_F(AtomStyleTest, body_nparticle)
|
||||
ASSERT_NE(lmp->atom->radius, nullptr);
|
||||
ASSERT_EQ(lmp->atom->mass_setflag, nullptr);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto body = lmp->atom->body;
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto radius = lmp->atom->radius;
|
||||
auto angmom = lmp->atom->angmom;
|
||||
auto bonus = avec->bonus;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
auto *body = lmp->atom->body;
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
auto *radius = lmp->atom->radius;
|
||||
auto *angmom = lmp->atom->angmom;
|
||||
auto *bonus = avec->bonus;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -2832,9 +2832,9 @@ TEST_F(AtomStyleTest, template)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 12);
|
||||
|
||||
auto molecule = lmp->atom->molecule;
|
||||
auto molindex = lmp->atom->molindex;
|
||||
auto molatom = lmp->atom->molatom;
|
||||
auto *molecule = lmp->atom->molecule;
|
||||
auto *molindex = lmp->atom->molindex;
|
||||
auto *molatom = lmp->atom->molatom;
|
||||
|
||||
ASSERT_EQ(molecule[GETIDX(1)], 1);
|
||||
ASSERT_EQ(molecule[GETIDX(2)], 1);
|
||||
@ -2933,9 +2933,9 @@ TEST_F(AtomStyleTest, template)
|
||||
ASSERT_EQ(molatom[GETIDX(11)], -1);
|
||||
ASSERT_EQ(molatom[GETIDX(12)], -1);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
|
||||
EXPECT_NEAR(x[GETIDX(10)][0], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(10)][1], -2.0, EPSILON);
|
||||
@ -3147,7 +3147,7 @@ TEST_F(AtomStyleTest, template_charge)
|
||||
|
||||
ASSERT_ATOM_STATE_EQ(lmp->atom, expected);
|
||||
|
||||
auto hybrid = dynamic_cast<AtomVecHybrid *>(lmp->atom->avec);
|
||||
auto *hybrid = dynamic_cast<AtomVecHybrid *>(lmp->atom->avec);
|
||||
ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid"));
|
||||
ASSERT_EQ(hybrid->nstyles, 2);
|
||||
ASSERT_THAT(std::string(hybrid->keywords[0]), Eq("template"));
|
||||
@ -3247,9 +3247,9 @@ TEST_F(AtomStyleTest, template_charge)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 12);
|
||||
|
||||
auto molecule = lmp->atom->molecule;
|
||||
auto molindex = lmp->atom->molindex;
|
||||
auto molatom = lmp->atom->molatom;
|
||||
auto *molecule = lmp->atom->molecule;
|
||||
auto *molindex = lmp->atom->molindex;
|
||||
auto *molatom = lmp->atom->molatom;
|
||||
|
||||
ASSERT_EQ(molecule[GETIDX(1)], 1);
|
||||
ASSERT_EQ(molecule[GETIDX(2)], 1);
|
||||
@ -3348,10 +3348,10 @@ TEST_F(AtomStyleTest, template_charge)
|
||||
ASSERT_EQ(molatom[GETIDX(11)], -1);
|
||||
ASSERT_EQ(molatom[GETIDX(12)], -1);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto q = lmp->atom->q;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
auto *q = lmp->atom->q;
|
||||
|
||||
EXPECT_NEAR(x[GETIDX(10)][0], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(10)][1], -2.0, EPSILON);
|
||||
@ -3655,9 +3655,9 @@ TEST_F(AtomStyleTest, bond)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto num_bond = lmp->atom->num_bond;
|
||||
auto bond_type = lmp->atom->bond_type;
|
||||
auto bond_atom = lmp->atom->bond_atom;
|
||||
auto *num_bond = lmp->atom->num_bond;
|
||||
auto *bond_type = lmp->atom->bond_type;
|
||||
auto *bond_atom = lmp->atom->bond_atom;
|
||||
|
||||
ASSERT_EQ(num_bond[GETIDX(1)], 2);
|
||||
ASSERT_EQ(num_bond[GETIDX(2)], 0);
|
||||
@ -3714,12 +3714,12 @@ TEST_F(AtomStyleTest, bond)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
num_bond = lmp->atom->num_bond;
|
||||
bond_type = lmp->atom->bond_type;
|
||||
bond_atom = lmp->atom->bond_atom;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
num_bond = lmp->atom->num_bond;
|
||||
bond_type = lmp->atom->bond_type;
|
||||
bond_atom = lmp->atom->bond_atom;
|
||||
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
@ -4013,14 +4013,14 @@ TEST_F(AtomStyleTest, angle)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto num_bond = lmp->atom->num_bond;
|
||||
auto bond_type = lmp->atom->bond_type;
|
||||
auto bond_atom = lmp->atom->bond_atom;
|
||||
auto num_angle = lmp->atom->num_angle;
|
||||
auto angle_type = lmp->atom->angle_type;
|
||||
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 *bond_type = lmp->atom->bond_type;
|
||||
auto *bond_atom = lmp->atom->bond_atom;
|
||||
auto *num_angle = lmp->atom->num_angle;
|
||||
auto *angle_type = lmp->atom->angle_type;
|
||||
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(num_bond[GETIDX(2)], 0);
|
||||
@ -4107,9 +4107,9 @@ TEST_F(AtomStyleTest, angle)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
num_bond = lmp->atom->num_bond;
|
||||
bond_atom = lmp->atom->bond_atom;
|
||||
num_angle = lmp->atom->num_angle;
|
||||
@ -4288,7 +4288,7 @@ TEST_F(AtomStyleTest, full_ellipsoid)
|
||||
|
||||
ASSERT_ATOM_STATE_EQ(lmp->atom, expected);
|
||||
|
||||
auto hybrid = dynamic_cast<AtomVecHybrid *>(lmp->atom->avec);
|
||||
auto *hybrid = dynamic_cast<AtomVecHybrid *>(lmp->atom->avec);
|
||||
ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid"));
|
||||
ASSERT_EQ(hybrid->nstyles, 2);
|
||||
ASSERT_THAT(std::string(hybrid->keywords[0]), Eq("full"));
|
||||
@ -4398,15 +4398,15 @@ TEST_F(AtomStyleTest, full_ellipsoid)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto q = lmp->atom->q;
|
||||
auto type = lmp->atom->type;
|
||||
auto ellipsoid = lmp->atom->ellipsoid;
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *q = lmp->atom->q;
|
||||
auto *type = lmp->atom->type;
|
||||
auto *ellipsoid = lmp->atom->ellipsoid;
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
|
||||
auto avec = dynamic_cast<AtomVecEllipsoid *>(hybrid->styles[1]);
|
||||
auto bonus = avec->bonus;
|
||||
auto *avec = dynamic_cast<AtomVecEllipsoid *>(hybrid->styles[1]);
|
||||
auto *bonus = avec->bonus;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -4768,9 +4768,9 @@ TEST_F(AtomStyleTest, property_atom)
|
||||
ASSERT_EQ(lmp->atom->map_user, Atom::MAP_ARRAY);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 4);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto q = lmp->atom->q;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *q = lmp->atom->q;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -4805,10 +4805,10 @@ TEST_F(AtomStyleTest, property_atom)
|
||||
ASSERT_EQ(lmp->atom->mass_setflag[1], 1);
|
||||
ASSERT_EQ(lmp->atom->mass_setflag[2], 1);
|
||||
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto one = lmp->atom->ivector[0];
|
||||
auto two = lmp->atom->dvector[0];
|
||||
auto three = lmp->atom->dvector[1];
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
auto *one = lmp->atom->ivector[0];
|
||||
auto *two = lmp->atom->dvector[0];
|
||||
auto *three = lmp->atom->dvector[1];
|
||||
|
||||
EXPECT_NEAR(rmass[GETIDX(1)], 4.0, EPSILON);
|
||||
EXPECT_NEAR(rmass[GETIDX(2)], 4.0, EPSILON);
|
||||
@ -4939,7 +4939,7 @@ TEST_F(AtomStyleTest, oxdna)
|
||||
|
||||
ASSERT_ATOM_STATE_EQ(lmp->atom, expected);
|
||||
|
||||
auto hybrid = dynamic_cast<AtomVecHybrid *>(lmp->atom->avec);
|
||||
auto *hybrid = dynamic_cast<AtomVecHybrid *>(lmp->atom->avec);
|
||||
ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid"));
|
||||
ASSERT_EQ(hybrid->nstyles, 3);
|
||||
ASSERT_THAT(std::string(hybrid->keywords[0]), Eq("bond"));
|
||||
@ -5152,14 +5152,14 @@ TEST_F(AtomStyleTest, oxdna)
|
||||
ASSERT_NE(lmp->atom->mass_setflag, nullptr);
|
||||
ASSERT_NE(lmp->atom->id5p, nullptr);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto ellipsoid = lmp->atom->ellipsoid;
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
auto *ellipsoid = lmp->atom->ellipsoid;
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
|
||||
auto avec = dynamic_cast<AtomVecEllipsoid *>(hybrid->styles[1]);
|
||||
auto bonus = avec->bonus;
|
||||
auto *avec = dynamic_cast<AtomVecEllipsoid *>(hybrid->styles[1]);
|
||||
auto *bonus = avec->bonus;
|
||||
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -0.33741452300167507, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], -0.43708835412476305, EPSILON);
|
||||
@ -5328,10 +5328,10 @@ TEST_F(AtomStyleTest, oxdna)
|
||||
EXPECT_NEAR(bonus[9].quat[2], 0.9849325709665359, EPSILON);
|
||||
EXPECT_NEAR(bonus[9].quat[3], -0.0516705065113425, EPSILON);
|
||||
|
||||
auto num_bond = lmp->atom->num_bond;
|
||||
auto bond_type = lmp->atom->bond_type;
|
||||
auto bond_atom = lmp->atom->bond_atom;
|
||||
auto id5p = lmp->atom->id5p;
|
||||
auto *num_bond = lmp->atom->num_bond;
|
||||
auto *bond_type = lmp->atom->bond_type;
|
||||
auto *bond_atom = lmp->atom->bond_atom;
|
||||
auto *id5p = lmp->atom->id5p;
|
||||
|
||||
ASSERT_EQ(num_bond[GETIDX(1)], 1);
|
||||
ASSERT_EQ(num_bond[GETIDX(2)], 1);
|
||||
|
||||
@ -93,15 +93,15 @@ TEST_F(DumpAtomCompressTest, compressed_multi_file_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_run1_*.melt";
|
||||
auto base_name_0 = "multi_file_run1_0.melt";
|
||||
auto base_name_1 = "multi_file_run1_1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *base_name = "multi_file_run1_*.melt";
|
||||
const auto *base_name_0 = "multi_file_run1_0.melt";
|
||||
const auto *base_name_1 = "multi_file_run1_1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
|
||||
if (compression_style == "atom/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "checksum no", 1);
|
||||
@ -133,15 +133,15 @@ TEST_F(DumpAtomCompressTest, compressed_multi_file_with_pad_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_pad_run1_*.melt";
|
||||
auto base_name_0 = "multi_file_pad_run1_000.melt";
|
||||
auto base_name_1 = "multi_file_pad_run1_001.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *base_name = "multi_file_pad_run1_*.melt";
|
||||
const auto *base_name_0 = "multi_file_pad_run1_000.melt";
|
||||
const auto *base_name_1 = "multi_file_pad_run1_001.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "pad 3", 1);
|
||||
|
||||
@ -174,18 +174,18 @@ TEST_F(DumpAtomCompressTest, compressed_multi_file_with_maxfiles_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_maxfiles_run1_*.melt";
|
||||
auto base_name_0 = "multi_file_maxfiles_run1_0.melt";
|
||||
auto base_name_1 = "multi_file_maxfiles_run1_1.melt";
|
||||
auto base_name_2 = "multi_file_maxfiles_run1_2.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
const auto *base_name = "multi_file_maxfiles_run1_*.melt";
|
||||
const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt";
|
||||
const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt";
|
||||
const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "maxfiles 2", 2);
|
||||
|
||||
@ -220,9 +220,9 @@ TEST_F(DumpAtomCompressTest, compressed_with_units_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "with_units_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "with_units_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no units yes", 0);
|
||||
|
||||
@ -244,9 +244,9 @@ TEST_F(DumpAtomCompressTest, compressed_with_time_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "with_time_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "with_time_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no time yes", 0);
|
||||
|
||||
@ -268,9 +268,9 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "tri_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "tri_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
enable_triclinic();
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", 0);
|
||||
@ -293,9 +293,9 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_with_units_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "tri_with_units_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "tri_with_units_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
enable_triclinic();
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no units yes", 0);
|
||||
@ -318,9 +318,9 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_with_time_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "tri_with_time_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "tri_with_time_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
enable_triclinic();
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no time yes", 0);
|
||||
@ -343,9 +343,9 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_with_image_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "tri_with_image_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "tri_with_image_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
enable_triclinic();
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "image yes", 0);
|
||||
@ -396,9 +396,9 @@ TEST_F(DumpAtomCompressTest, compressed_modify_clevel_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "modify_clevel_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "modify_clevel_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "compression_level 3",
|
||||
0);
|
||||
|
||||
@ -51,8 +51,8 @@ TEST_F(DumpCfgTest, invalid_options)
|
||||
|
||||
TEST_F(DumpCfgTest, require_multifile)
|
||||
{
|
||||
auto dump_file = "dump.melt.cfg_run.cfg";
|
||||
auto fields =
|
||||
const auto *dump_file = "dump.melt.cfg_run.cfg";
|
||||
const 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";
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
@ -64,8 +64,8 @@ TEST_F(DumpCfgTest, require_multifile)
|
||||
|
||||
TEST_F(DumpCfgTest, run0)
|
||||
{
|
||||
auto dump_file = "dump_cfg_run*.melt.cfg";
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *dump_file = "dump_cfg_run*.melt.cfg";
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_dump(dump_file, fields, "", 0);
|
||||
|
||||
@ -78,8 +78,8 @@ TEST_F(DumpCfgTest, run0)
|
||||
|
||||
TEST_F(DumpCfgTest, write_dump)
|
||||
{
|
||||
auto dump_file = "dump_cfg_run*.melt.cfg";
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *dump_file = "dump_cfg_run*.melt.cfg";
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("run 0 post no");
|
||||
@ -105,8 +105,8 @@ TEST_F(DumpCfgTest, write_dump)
|
||||
|
||||
TEST_F(DumpCfgTest, unwrap_run0)
|
||||
{
|
||||
auto dump_file = "dump_cfg_unwrap_run*.melt.cfg";
|
||||
auto fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *dump_file = "dump_cfg_unwrap_run*.melt.cfg";
|
||||
const auto *fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_dump(dump_file, fields, "", 0);
|
||||
|
||||
@ -119,8 +119,8 @@ TEST_F(DumpCfgTest, unwrap_run0)
|
||||
|
||||
TEST_F(DumpCfgTest, no_buffer_run0)
|
||||
{
|
||||
auto dump_file = "dump_cfg_no_buffer_run*.melt.cfg";
|
||||
auto fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *dump_file = "dump_cfg_no_buffer_run*.melt.cfg";
|
||||
const auto *fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_dump(dump_file, fields, "buffer no", 0);
|
||||
|
||||
@ -133,8 +133,8 @@ TEST_F(DumpCfgTest, no_buffer_run0)
|
||||
|
||||
TEST_F(DumpCfgTest, no_unwrap_no_buffer_run0)
|
||||
{
|
||||
auto dump_file = "dump_cfg_no_unwrap_no_buffer_run*.melt.cfg";
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *dump_file = "dump_cfg_no_unwrap_no_buffer_run*.melt.cfg";
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_dump(dump_file, fields, "buffer no", 0);
|
||||
|
||||
|
||||
@ -35,14 +35,14 @@ TEST_F(DumpCfgCompressTest, compressed_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "run*.melt.cfg";
|
||||
const auto *base_name = "run*.melt.cfg";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
|
||||
auto base_name_0 = "run0.melt.cfg";
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *base_name_0 = "run0.melt.cfg";
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
if (compression_style == "cfg/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "",
|
||||
@ -69,14 +69,14 @@ TEST_F(DumpCfgCompressTest, compressed_no_buffer_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "no_buffer_run*.melt.cfg";
|
||||
const auto *base_name = "no_buffer_run*.melt.cfg";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
|
||||
auto base_name_0 = "no_buffer_run0.melt.cfg";
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *base_name_0 = "no_buffer_run0.melt.cfg";
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
if (compression_style == "cfg/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "buffer no",
|
||||
@ -103,14 +103,14 @@ TEST_F(DumpCfgCompressTest, compressed_unwrap_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "unwrap_run*.melt.cfg";
|
||||
const auto *base_name = "unwrap_run*.melt.cfg";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
|
||||
auto base_name_0 = "unwrap_run0.melt.cfg";
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *base_name_0 = "unwrap_run0.melt.cfg";
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, "", 0);
|
||||
|
||||
@ -132,16 +132,16 @@ TEST_F(DumpCfgCompressTest, compressed_multi_file_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_run1_*.melt.cfg";
|
||||
auto base_name_0 = "multi_file_run1_0.melt.cfg";
|
||||
auto base_name_1 = "multi_file_run1_1.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *base_name = "multi_file_run1_*.melt.cfg";
|
||||
const auto *base_name_0 = "multi_file_run1_0.melt.cfg";
|
||||
const auto *base_name_1 = "multi_file_run1_1.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
if (compression_style == "cfg/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||
@ -174,16 +174,16 @@ TEST_F(DumpCfgCompressTest, compressed_multi_file_with_pad_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_pad_run1_*.melt.cfg";
|
||||
auto base_name_0 = "multi_file_pad_run1_000.melt.cfg";
|
||||
auto base_name_1 = "multi_file_pad_run1_001.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *base_name = "multi_file_pad_run1_*.melt.cfg";
|
||||
const auto *base_name_0 = "multi_file_pad_run1_000.melt.cfg";
|
||||
const auto *base_name_1 = "multi_file_pad_run1_001.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "pad 3", 1);
|
||||
|
||||
@ -216,19 +216,19 @@ TEST_F(DumpCfgCompressTest, compressed_multi_file_with_maxfiles_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_maxfiles_run1_*.melt.cfg";
|
||||
auto base_name_0 = "multi_file_maxfiles_run1_0.melt.cfg";
|
||||
auto base_name_1 = "multi_file_maxfiles_run1_1.melt.cfg";
|
||||
auto base_name_2 = "multi_file_maxfiles_run1_2.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *base_name = "multi_file_maxfiles_run1_*.melt.cfg";
|
||||
const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt.cfg";
|
||||
const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt.cfg";
|
||||
const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "maxfiles 2", 2);
|
||||
|
||||
@ -263,7 +263,7 @@ 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";
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||
compressed_dump_filename("modify_bad_param_run0_*.melt.cfg"), fields));
|
||||
@ -278,7 +278,7 @@ 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";
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||
compressed_dump_filename("modify_multi_bad_param_run0_*.melt.cfg"),
|
||||
@ -294,13 +294,13 @@ TEST_F(DumpCfgCompressTest, compressed_modify_clevel_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "modify_clevel_run*.melt.cfg";
|
||||
auto base_name_0 = "modify_clevel_run0.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *base_name = "modify_clevel_run*.melt.cfg";
|
||||
const auto *base_name_0 = "modify_clevel_run0.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||
"compression_level 3", 0);
|
||||
|
||||
@ -111,7 +111,7 @@ public:
|
||||
TEST_F(DumpCustomTest, run1)
|
||||
{
|
||||
auto dump_file = dump_filename("run1");
|
||||
auto fields =
|
||||
const auto *fields =
|
||||
"id type proc procp1 mass x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
generate_dump(dump_file, fields, "units yes", 1);
|
||||
@ -128,8 +128,8 @@ TEST_F(DumpCustomTest, run1)
|
||||
|
||||
TEST_F(DumpCustomTest, thresh_run0)
|
||||
{
|
||||
auto dump_file = dump_filename("thresh_run0");
|
||||
auto fields = "id type x y z";
|
||||
auto dump_file = dump_filename("thresh_run0");
|
||||
const auto *fields = "id type x y z";
|
||||
|
||||
generate_dump(dump_file, fields, "units yes thresh x < 1 thresh y < 1 thresh z < 1", 0);
|
||||
|
||||
@ -149,8 +149,8 @@ TEST_F(DumpCustomTest, compute_run0)
|
||||
command("compute comp all property/atom x y z");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto dump_file = dump_filename("compute_run0");
|
||||
auto fields = "id type x y z c_comp[1] c_comp[2] c_comp[3]";
|
||||
auto dump_file = dump_filename("compute_run0");
|
||||
const auto *fields = "id type x y z c_comp[1] c_comp[2] c_comp[3]";
|
||||
|
||||
generate_dump(dump_file, fields, "units yes", 0);
|
||||
|
||||
@ -172,8 +172,8 @@ TEST_F(DumpCustomTest, fix_run0)
|
||||
command("fix numdiff all numdiff 1 0.0001");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto dump_file = dump_filename("fix_run0");
|
||||
auto fields = "id x y z f_numdiff[1] f_numdiff[2] f_numdiff[3]";
|
||||
auto dump_file = dump_filename("fix_run0");
|
||||
const auto *fields = "id x y z f_numdiff[1] f_numdiff[2] f_numdiff[3]";
|
||||
|
||||
generate_dump(dump_file, fields, "units yes", 0);
|
||||
|
||||
@ -194,8 +194,8 @@ TEST_F(DumpCustomTest, custom_run0)
|
||||
command("compute 1 all property/atom i_flag1 d_flag2");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto dump_file = dump_filename("custom_run0");
|
||||
auto fields = "id x y z i_flag1 d_flag2";
|
||||
auto dump_file = dump_filename("custom_run0");
|
||||
const auto *fields = "id x y z i_flag1 d_flag2";
|
||||
|
||||
generate_dump(dump_file, fields, "units yes", 0);
|
||||
|
||||
@ -215,7 +215,8 @@ TEST_F(DumpCustomTest, binary_run1)
|
||||
|
||||
auto text_file = text_dump_filename("run1");
|
||||
auto binary_file = binary_dump_filename("run1");
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
generate_text_and_binary_dump(text_file, binary_file, fields, "units yes", 1);
|
||||
|
||||
@ -234,7 +235,8 @@ TEST_F(DumpCustomTest, binary_run1)
|
||||
TEST_F(DumpCustomTest, triclinic_run1)
|
||||
{
|
||||
auto dump_file = dump_filename("tri_run1");
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
enable_triclinic();
|
||||
|
||||
@ -254,9 +256,9 @@ TEST_F(DumpCustomTest, binary_triclinic_run1)
|
||||
{
|
||||
if (!BINARY2TXT_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto text_file = text_dump_filename("tri_run1");
|
||||
auto binary_file = binary_dump_filename("tri_run1");
|
||||
auto fields = "id type proc x y z xs ys zs xsu ysu zsu vx vy vz fx fy fz";
|
||||
auto text_file = text_dump_filename("tri_run1");
|
||||
auto binary_file = binary_dump_filename("tri_run1");
|
||||
const auto *fields = "id type proc x y z xs ys zs xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
enable_triclinic();
|
||||
|
||||
@ -281,8 +283,8 @@ TEST_F(DumpCustomTest, with_variable_run1)
|
||||
command("variable p atom (c_1%10)+1");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto dump_file = dump_filename("with_variable_run1");
|
||||
auto fields = "id type x y z v_p";
|
||||
auto dump_file = dump_filename("with_variable_run1");
|
||||
const auto *fields = "id type x y z v_p";
|
||||
|
||||
generate_dump(dump_file, fields, "units yes", 1);
|
||||
|
||||
@ -298,8 +300,8 @@ TEST_F(DumpCustomTest, with_variable_run1)
|
||||
|
||||
TEST_F(DumpCustomTest, run1plus1)
|
||||
{
|
||||
auto dump_file = dump_filename("run1plus1");
|
||||
auto fields = "id type x y z";
|
||||
auto dump_file = dump_filename("run1plus1");
|
||||
const auto *fields = "id type x y z";
|
||||
|
||||
generate_dump(dump_file, fields, "units yes", 1);
|
||||
|
||||
@ -315,8 +317,8 @@ TEST_F(DumpCustomTest, run1plus1)
|
||||
|
||||
TEST_F(DumpCustomTest, run2)
|
||||
{
|
||||
auto dump_file = dump_filename("run2");
|
||||
auto fields = "id type x y z";
|
||||
auto dump_file = dump_filename("run2");
|
||||
const auto *fields = "id type x y z";
|
||||
generate_dump(dump_file, fields, "", 2);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -326,8 +328,8 @@ TEST_F(DumpCustomTest, run2)
|
||||
|
||||
TEST_F(DumpCustomTest, rerun)
|
||||
{
|
||||
auto dump_file = dump_filename("rerun");
|
||||
auto fields = "id type xs ys zs";
|
||||
auto dump_file = dump_filename("rerun");
|
||||
const auto *fields = "id type xs ys zs";
|
||||
|
||||
HIDE_OUTPUT([&] {
|
||||
command("fix 1 all nve");
|
||||
@ -358,8 +360,8 @@ TEST_F(DumpCustomTest, rerun)
|
||||
|
||||
TEST_F(DumpCustomTest, rerun_bin)
|
||||
{
|
||||
auto dump_file = binary_dump_filename("rerun");
|
||||
auto fields = "id type xs ys zs";
|
||||
auto dump_file = binary_dump_filename("rerun");
|
||||
const auto *fields = "id type xs ys zs";
|
||||
|
||||
HIDE_OUTPUT([&] {
|
||||
command("fix 1 all nve");
|
||||
|
||||
@ -31,10 +31,11 @@ TEST_F(DumpCustomCompressTest, compressed_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "custom_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *base_name = "custom_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
if (compression_style == "custom/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "units yes",
|
||||
@ -61,10 +62,11 @@ TEST_F(DumpCustomCompressTest, compressed_with_time_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "with_time_custom_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *base_name = "with_time_custom_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
if (compression_style == "custom/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "time yes",
|
||||
@ -91,10 +93,11 @@ TEST_F(DumpCustomCompressTest, compressed_no_buffer_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "no_buffer_custom_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *base_name = "no_buffer_custom_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
if (compression_style == "custom/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "buffer no",
|
||||
@ -121,10 +124,10 @@ TEST_F(DumpCustomCompressTest, compressed_triclinic_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "custom_tri_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto fields = "id type proc x y z xs ys zs xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *base_name = "custom_tri_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *fields = "id type proc x y z xs ys zs xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
enable_triclinic();
|
||||
|
||||
@ -148,16 +151,17 @@ TEST_F(DumpCustomCompressTest, compressed_multi_file_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_run1_*.melt.custom";
|
||||
auto base_name_0 = "multi_file_run1_0.melt.custom";
|
||||
auto base_name_1 = "multi_file_run1_1.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *base_name = "multi_file_run1_*.melt.custom";
|
||||
const auto *base_name_0 = "multi_file_run1_0.melt.custom";
|
||||
const auto *base_name_1 = "multi_file_run1_1.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
if (compression_style == "custom/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||
@ -190,16 +194,17 @@ TEST_F(DumpCustomCompressTest, compressed_multi_file_with_pad_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_pad_run1_*.melt.custom";
|
||||
auto base_name_0 = "multi_file_pad_run1_000.melt.custom";
|
||||
auto base_name_1 = "multi_file_pad_run1_001.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *base_name = "multi_file_pad_run1_*.melt.custom";
|
||||
const auto *base_name_0 = "multi_file_pad_run1_000.melt.custom";
|
||||
const auto *base_name_1 = "multi_file_pad_run1_001.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "pad 3", 1);
|
||||
|
||||
@ -232,19 +237,20 @@ TEST_F(DumpCustomCompressTest, compressed_multi_file_with_maxfiles_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_maxfiles_run1_*.melt.custom";
|
||||
auto base_name_0 = "multi_file_maxfiles_run1_0.melt.custom";
|
||||
auto base_name_1 = "multi_file_maxfiles_run1_1.melt.custom";
|
||||
auto base_name_2 = "multi_file_maxfiles_run1_2.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *base_name = "multi_file_maxfiles_run1_*.melt.custom";
|
||||
const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt.custom";
|
||||
const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt.custom";
|
||||
const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "maxfiles 2", 2);
|
||||
|
||||
@ -279,7 +285,8 @@ TEST_F(DumpCustomCompressTest, compressed_modify_bad_param)
|
||||
{
|
||||
if (compression_style != "custom/gz") GTEST_SKIP();
|
||||
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||
compressed_dump_filename("modify_bad_param_run0_*.melt.custom"), fields));
|
||||
|
||||
@ -292,7 +299,8 @@ TEST_F(DumpCustomCompressTest, compressed_modify_multi_bad_param)
|
||||
{
|
||||
if (compression_style != "custom/gz") GTEST_SKIP();
|
||||
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||
compressed_dump_filename("modify_multi_bad_param_run0_*.melt.custom"),
|
||||
fields));
|
||||
@ -306,11 +314,12 @@ TEST_F(DumpCustomCompressTest, compressed_modify_clevel_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "modify_clevel_run0.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "modify_clevel_run0.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||
"compression_level 3", 0);
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ public:
|
||||
|
||||
TEST_F(DumpLocalTest, run0)
|
||||
{
|
||||
auto dump_file = "dump_local_run0.melt";
|
||||
const auto *dump_file = "dump_local_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -98,7 +98,7 @@ TEST_F(DumpLocalTest, run0)
|
||||
|
||||
TEST_F(DumpLocalTest, label_run0)
|
||||
{
|
||||
auto dump_file = "dump_local_label_run0.melt";
|
||||
const auto *dump_file = "dump_local_label_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "label ELEMENTS", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -110,7 +110,7 @@ TEST_F(DumpLocalTest, label_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, format_line_run0)
|
||||
{
|
||||
auto dump_file = "dump_local_format_line_run0.melt";
|
||||
const auto *dump_file = "dump_local_format_line_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "format line \"%d %20.8g\"", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -123,7 +123,7 @@ TEST_F(DumpLocalTest, format_line_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, format_int_run0)
|
||||
{
|
||||
auto dump_file = "dump_local_format_int_run0.melt";
|
||||
const auto *dump_file = "dump_local_format_int_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "format int \"%20d\"", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -136,7 +136,7 @@ TEST_F(DumpLocalTest, format_int_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, format_float_run0)
|
||||
{
|
||||
auto dump_file = "dump_local_format_float_run0.melt";
|
||||
const auto *dump_file = "dump_local_format_float_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "format float \"%20.5g\"", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -149,7 +149,7 @@ TEST_F(DumpLocalTest, format_float_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, format_column_run0)
|
||||
{
|
||||
auto dump_file = "dump_local_format_column_run0.melt";
|
||||
const auto *dump_file = "dump_local_format_column_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "format 1 \"%20d\"", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -162,7 +162,7 @@ TEST_F(DumpLocalTest, format_column_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, no_buffer_run0)
|
||||
{
|
||||
auto dump_file = "dump_local_format_line_run0.melt";
|
||||
const auto *dump_file = "dump_local_format_line_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "buffer no", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -187,7 +187,7 @@ TEST_F(DumpLocalTest, no_buffer_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, with_units_run0)
|
||||
{
|
||||
auto dump_file = "dump_with_units_run0.melt";
|
||||
const auto *dump_file = "dump_with_units_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "units yes", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -206,7 +206,7 @@ TEST_F(DumpLocalTest, with_units_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, with_time_run0)
|
||||
{
|
||||
auto dump_file = "dump_with_time_run0.melt";
|
||||
const auto *dump_file = "dump_with_time_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "time yes", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -225,7 +225,7 @@ TEST_F(DumpLocalTest, with_time_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, triclinic_run0)
|
||||
{
|
||||
auto dump_file = "dump_local_triclinic_run0.melt";
|
||||
const auto *dump_file = "dump_local_triclinic_run0.melt";
|
||||
enable_triclinic();
|
||||
generate_dump(dump_file, "index c_comp[1]", "", 0);
|
||||
|
||||
|
||||
@ -40,13 +40,13 @@ TEST_F(DumpLocalCompressTest, compressed_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "run*.melt.local";
|
||||
auto base_name_0 = "run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "run*.melt.local";
|
||||
const auto *base_name_0 = "run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
if (compression_style == "local/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "",
|
||||
@ -73,13 +73,13 @@ TEST_F(DumpLocalCompressTest, compressed_no_buffer_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "no_buffer_run*.melt.local";
|
||||
auto base_name_0 = "no_buffer_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "no_buffer_run*.melt.local";
|
||||
const auto *base_name_0 = "no_buffer_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
if (compression_style == "local/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "buffer no",
|
||||
@ -106,13 +106,13 @@ TEST_F(DumpLocalCompressTest, compressed_with_time_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "with_time_run*.melt.local";
|
||||
auto base_name_0 = "with_time_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "with_time_run*.melt.local";
|
||||
const auto *base_name_0 = "with_time_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
if (compression_style == "local/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "time yes",
|
||||
@ -139,13 +139,13 @@ TEST_F(DumpLocalCompressTest, compressed_with_units_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "with_units_run*.melt.local";
|
||||
auto base_name_0 = "with_units_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "with_units_run*.melt.local";
|
||||
const auto *base_name_0 = "with_units_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
if (compression_style == "local/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "units yes",
|
||||
@ -173,13 +173,13 @@ TEST_F(DumpLocalCompressTest, compressed_triclinic_run0)
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
enable_triclinic();
|
||||
|
||||
auto base_name = "triclinic_run*.melt.local";
|
||||
auto base_name_0 = "triclinic_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "triclinic_run*.melt.local";
|
||||
const auto *base_name_0 = "triclinic_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
if (compression_style == "local/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "",
|
||||
@ -206,16 +206,16 @@ TEST_F(DumpLocalCompressTest, compressed_multi_file_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_run1_*.melt.local";
|
||||
auto base_name_0 = "multi_file_run1_0.melt.local";
|
||||
auto base_name_1 = "multi_file_run1_1.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "multi_file_run1_*.melt.local";
|
||||
const auto *base_name_0 = "multi_file_run1_0.melt.local";
|
||||
const auto *base_name_1 = "multi_file_run1_1.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
if (compression_style == "local/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||
@ -248,16 +248,16 @@ TEST_F(DumpLocalCompressTest, compressed_multi_file_with_pad_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_pad_run1_*.melt.local";
|
||||
auto base_name_0 = "multi_file_pad_run1_000.melt.local";
|
||||
auto base_name_1 = "multi_file_pad_run1_001.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "multi_file_pad_run1_*.melt.local";
|
||||
const auto *base_name_0 = "multi_file_pad_run1_000.melt.local";
|
||||
const auto *base_name_1 = "multi_file_pad_run1_001.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "pad 3", 1);
|
||||
|
||||
@ -290,19 +290,19 @@ TEST_F(DumpLocalCompressTest, compressed_multi_file_with_maxfiles_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_maxfiles_run1_*.melt.local";
|
||||
auto base_name_0 = "multi_file_maxfiles_run1_0.melt.local";
|
||||
auto base_name_1 = "multi_file_maxfiles_run1_1.melt.local";
|
||||
auto base_name_2 = "multi_file_maxfiles_run1_2.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "multi_file_maxfiles_run1_*.melt.local";
|
||||
const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt.local";
|
||||
const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt.local";
|
||||
const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "maxfiles 2", 2);
|
||||
|
||||
@ -337,7 +337,7 @@ TEST_F(DumpLocalCompressTest, compressed_modify_bad_param)
|
||||
{
|
||||
if (compression_style != "local/gz") GTEST_SKIP();
|
||||
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||
@ -353,7 +353,7 @@ TEST_F(DumpLocalCompressTest, compressed_modify_multi_bad_param)
|
||||
{
|
||||
if (compression_style != "local/gz") GTEST_SKIP();
|
||||
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||
@ -370,10 +370,10 @@ TEST_F(DumpLocalCompressTest, compressed_modify_clevel_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "modify_clevel_run0.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "modify_clevel_run0.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||
"compression_level 3", 0);
|
||||
|
||||
@ -91,8 +91,8 @@ public:
|
||||
TEST_F(DumpNetCDFTest, run0_plain)
|
||||
{
|
||||
if (!lammps_has_style(lmp, "dump", "netcdf")) GTEST_SKIP();
|
||||
auto dump_file = dump_filename("run0");
|
||||
auto fields = "id type proc procp1 mass x y z ix iy iz xu yu zu vx vy vz fx fy fz";
|
||||
auto dump_file = dump_filename("run0");
|
||||
const auto *fields = "id type proc procp1 mass x y z ix iy iz xu yu zu vx vy vz fx fy fz";
|
||||
set_style("netcdf");
|
||||
generate_dump(dump_file, fields, "", 0);
|
||||
|
||||
@ -285,8 +285,8 @@ TEST_F(DumpNetCDFTest, run0_plain)
|
||||
TEST_F(DumpNetCDFTest, run0_mpi)
|
||||
{
|
||||
if (!lammps_has_style(lmp, "dump", "netcdf/mpiio")) GTEST_SKIP();
|
||||
auto dump_file = dump_filename("mpi0");
|
||||
auto fields = "id type proc procp1 mass x y z ix iy iz xu yu zu vx vy vz fx fy fz";
|
||||
auto dump_file = dump_filename("mpi0");
|
||||
const auto *fields = "id type proc procp1 mass x y z ix iy iz xu yu zu vx vy vz fx fy fz";
|
||||
set_style("netcdf/mpiio");
|
||||
generate_dump(dump_file, fields, "", 0);
|
||||
|
||||
|
||||
@ -31,12 +31,12 @@ TEST_F(DumpXYZCompressTest, compressed_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "run*.melt.xyz";
|
||||
auto base_name_0 = "run0.melt.xyz";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *base_name = "run*.melt.xyz";
|
||||
const auto *base_name_0 = "run0.melt.xyz";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
|
||||
if (compression_style == "xyz/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, "", "", "", "checksum yes",
|
||||
@ -63,12 +63,12 @@ TEST_F(DumpXYZCompressTest, compressed_no_buffer_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "no_buffer_run*.melt.xyz";
|
||||
auto base_name_0 = "no_buffer_run0.melt.xyz";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *base_name = "no_buffer_run*.melt.xyz";
|
||||
const auto *base_name_0 = "no_buffer_run0.melt.xyz";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
|
||||
if (compression_style == "xyz/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, "", "", "buffer no",
|
||||
@ -95,15 +95,15 @@ TEST_F(DumpXYZCompressTest, compressed_multi_file_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_run1_*.melt.xyz";
|
||||
auto base_name_0 = "multi_file_run1_0.melt.xyz";
|
||||
auto base_name_1 = "multi_file_run1_1.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *base_name = "multi_file_run1_*.melt.xyz";
|
||||
const auto *base_name_0 = "multi_file_run1_0.melt.xyz";
|
||||
const auto *base_name_1 = "multi_file_run1_1.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
|
||||
if (compression_style == "xyz/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "checksum no", 1);
|
||||
@ -135,15 +135,15 @@ TEST_F(DumpXYZCompressTest, compressed_multi_file_with_pad_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_pad_run1_*.melt.xyz";
|
||||
auto base_name_0 = "multi_file_pad_run1_000.melt.xyz";
|
||||
auto base_name_1 = "multi_file_pad_run1_001.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *base_name = "multi_file_pad_run1_*.melt.xyz";
|
||||
const auto *base_name_0 = "multi_file_pad_run1_000.melt.xyz";
|
||||
const auto *base_name_1 = "multi_file_pad_run1_001.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "pad 3", 1);
|
||||
|
||||
@ -176,18 +176,18 @@ TEST_F(DumpXYZCompressTest, compressed_multi_file_with_maxfiles_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_maxfiles_run1_*.melt.xyz";
|
||||
auto base_name_0 = "multi_file_maxfiles_run1_0.melt.xyz";
|
||||
auto base_name_1 = "multi_file_maxfiles_run1_1.melt.xyz";
|
||||
auto base_name_2 = "multi_file_maxfiles_run1_2.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
const auto *base_name = "multi_file_maxfiles_run1_*.melt.xyz";
|
||||
const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt.xyz";
|
||||
const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt.xyz";
|
||||
const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "maxfiles 2", 2);
|
||||
|
||||
@ -250,9 +250,9 @@ TEST_F(DumpXYZCompressTest, compressed_modify_clevel_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "modify_clevel_run0.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "modify_clevel_run0.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "compression_level 3",
|
||||
0);
|
||||
|
||||
@ -511,10 +511,10 @@ TEST_F(FileOperationsTest, read_data_fix)
|
||||
lmp->atom->molecule[1] = 6;
|
||||
lmp->atom->molecule[2] = 5;
|
||||
lmp->atom->molecule[3] = 6;
|
||||
lmp->atom->tag[0] = 9;
|
||||
lmp->atom->tag[1] = 6;
|
||||
lmp->atom->tag[2] = 7;
|
||||
lmp->atom->tag[3] = 8;
|
||||
lmp->atom->tag[0] = 9;
|
||||
lmp->atom->tag[1] = 6;
|
||||
lmp->atom->tag[2] = 7;
|
||||
lmp->atom->tag[3] = 8;
|
||||
lmp->atom->map_init(1);
|
||||
lmp->atom->map_set();
|
||||
command("write_data test_mol_id_merge.data");
|
||||
|
||||
@ -61,10 +61,10 @@ 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;
|
||||
auto *image = lmp->atom->image;
|
||||
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);
|
||||
@ -153,10 +153,10 @@ TEST_F(ImageFlagsTest, read_data)
|
||||
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;
|
||||
auto *image = lmp->atom->image;
|
||||
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);
|
||||
|
||||
@ -67,7 +67,7 @@ TEST_F(PotentialFileReaderTest, Sw_native)
|
||||
PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairSW::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairSW::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairSW::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ TEST_F(PotentialFileReaderTest, Sw_conv)
|
||||
PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber", utils::METAL2REAL);
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairSW::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairSW::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairSW::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ TEST_F(PotentialFileReaderTest, Comb)
|
||||
PotentialFileReader reader(lmp, "ffield.comb", "COMB");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairComb::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairComb::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairComb::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ TEST_F(PotentialFileReaderTest, Comb3)
|
||||
PotentialFileReader reader(lmp, "ffield.comb3", "COMB3");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairComb3::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairComb3::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairComb3::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ TEST_F(PotentialFileReaderTest, Tersoff)
|
||||
PotentialFileReader reader(lmp, "Si.tersoff", "Tersoff");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairTersoff::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairTersoff::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairTersoff::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ TEST_F(PotentialFileReaderTest, TersoffMod)
|
||||
PotentialFileReader reader(lmp, "Si.tersoff.mod", "Tersoff/Mod");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairTersoffMOD::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairTersoffMOD::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairTersoffMOD::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ TEST_F(PotentialFileReaderTest, TersoffModC)
|
||||
PotentialFileReader reader(lmp, "Si.tersoff.modc", "Tersoff/ModC");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairTersoffMODC::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairTersoffMODC::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairTersoffMODC::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ TEST_F(PotentialFileReaderTest, TersoffTable)
|
||||
PotentialFileReader reader(lmp, "Si.tersoff", "TersoffTable");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairTersoffTable::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairTersoffTable::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairTersoffTable::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ TEST_F(PotentialFileReaderTest, TersoffZBL)
|
||||
PotentialFileReader reader(lmp, "SiC.tersoff.zbl", "Tersoff/ZBL");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairTersoffZBL::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairTersoffZBL::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairTersoffZBL::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ TEST_F(PotentialFileReaderTest, GW)
|
||||
PotentialFileReader reader(lmp, "SiC.gw", "GW");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairGW::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairGW::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairGW::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ TEST_F(PotentialFileReaderTest, GWZBL)
|
||||
PotentialFileReader reader(lmp, "SiC.gw.zbl", "GW/ZBL");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairGWZBL::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairGWZBL::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairGWZBL::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ TEST_F(PotentialFileReaderTest, Nb3bHarmonic)
|
||||
PotentialFileReader reader(lmp, "MOH.nb3b.harmonic", "NB3B Harmonic");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairNb3bHarmonic::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairNb3bHarmonic::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairNb3bHarmonic::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ TEST_F(PotentialFileReaderTest, Vashishta)
|
||||
PotentialFileReader reader(lmp, "SiC.vashishta", "Vashishta");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairVashishta::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairVashishta::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairVashishta::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -61,8 +61,8 @@ protected:
|
||||
|
||||
TEST_F(TextFileReaderTest, nofile)
|
||||
{
|
||||
ASSERT_THROW({ TextFileReader reader("text_reader_noexist.file", "test"); },
|
||||
FileReaderException);
|
||||
ASSERT_THROW(
|
||||
{ TextFileReader reader("text_reader_noexist.file", "test"); }, FileReaderException);
|
||||
}
|
||||
|
||||
// this test cannot work on windows due to its non unix-like permission system
|
||||
@ -76,8 +76,8 @@ TEST_F(TextFileReaderTest, permissions)
|
||||
fputs("word\n", fp);
|
||||
fclose(fp);
|
||||
chmod("text_reader_noperms.file", 0);
|
||||
ASSERT_THROW({ TextFileReader reader("text_reader_noperms.file", "test"); },
|
||||
FileReaderException);
|
||||
ASSERT_THROW(
|
||||
{ TextFileReader reader("text_reader_noperms.file", "test"); }, FileReaderException);
|
||||
platform::unlink("text_reader_noperms.file");
|
||||
}
|
||||
#endif
|
||||
@ -93,8 +93,8 @@ TEST_F(TextFileReaderTest, usefp)
|
||||
FILE *fp = fopen("text_reader_two.file", "r");
|
||||
ASSERT_NE(fp, nullptr);
|
||||
|
||||
auto reader = new TextFileReader(fp, "test");
|
||||
auto line = reader->next_line();
|
||||
auto *reader = new TextFileReader(fp, "test");
|
||||
auto *line = reader->next_line();
|
||||
ASSERT_STREQ(line, "4 ");
|
||||
line = reader->next_line(1);
|
||||
ASSERT_STREQ(line, "4 0.5 ");
|
||||
@ -120,7 +120,7 @@ TEST_F(TextFileReaderTest, comments)
|
||||
test_files();
|
||||
TextFileReader reader("text_reader_two.file", "test");
|
||||
reader.ignore_comments = true;
|
||||
auto line = reader.next_line();
|
||||
auto *line = reader.next_line();
|
||||
ASSERT_STREQ(line, "4 ");
|
||||
line = reader.next_line(1);
|
||||
ASSERT_STREQ(line, "4 0.5 ");
|
||||
@ -141,7 +141,7 @@ TEST_F(TextFileReaderTest, nocomments)
|
||||
test_files();
|
||||
TextFileReader reader("text_reader_one.file", "test");
|
||||
reader.ignore_comments = false;
|
||||
auto line = reader.next_line();
|
||||
auto *line = reader.next_line();
|
||||
ASSERT_STREQ(line, "# test file 1 for text file reader\n");
|
||||
line = reader.next_line(1);
|
||||
ASSERT_STREQ(line, "one\n");
|
||||
|
||||
@ -39,7 +39,7 @@ int f_lammps_has_id(const char *, const char *);
|
||||
int f_lammps_id_count(const char *);
|
||||
char *f_lammps_id_name(const char *, int);
|
||||
int f_lammps_plugin_count();
|
||||
int f_lammps_plugin_name();
|
||||
int f_lammps_plugin_name(int, const char*, const char*);
|
||||
}
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
@ -136,8 +136,8 @@ TEST_F(LAMMPS_configuration, has_package)
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
for (std::size_t i = 0; i < pkg_name.size(); i++)
|
||||
EXPECT_EQ(f_lammps_has_package(pkg_name[i].c_str()), Info::has_package(pkg_name[i]));
|
||||
for (const auto &i : pkg_name)
|
||||
EXPECT_EQ(f_lammps_has_package(i.c_str()), Info::has_package(i));
|
||||
}
|
||||
|
||||
TEST_F(LAMMPS_configuration, package_count)
|
||||
@ -347,7 +347,7 @@ TEST_F(LAMMPS_configuration, plugins)
|
||||
#else
|
||||
int nplugins = f_lammps_plugin_count();
|
||||
for (int n = 0; n < nplugins; n++) {
|
||||
lammpsplugin_t *plugin = plugin_get_info(n);
|
||||
auto *plugin = plugin_get_info(n);
|
||||
EXPECT_EQ(f_lammps_plugin_name(n + 1, plugin->style, plugin->name), 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -34,7 +34,7 @@ TEST(open_no_mpi, no_args)
|
||||
void *handle = f_lammps_no_mpi_no_args();
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.substr(0, 6).c_str(), "LAMMPS");
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
EXPECT_EQ(lmp->world, MPI_COMM_WORLD);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
EXPECT_EQ(lmp->screen, stdout);
|
||||
@ -51,7 +51,7 @@ TEST(open_no_mpi, with_args)
|
||||
void *handle = f_lammps_no_mpi_with_args();
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.substr(0, 6).c_str(), "LAMMPS");
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
EXPECT_EQ(lmp->screen, stdout);
|
||||
EXPECT_EQ(lmp->logfile, nullptr);
|
||||
@ -70,10 +70,10 @@ TEST(fortran_open, no_args)
|
||||
void *handle = f_lammps_open_no_args();
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.substr(0, 6).c_str(), "LAMMPS");
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
int f_comm = f_lammps_get_comm();
|
||||
MPI_Comm mycomm = MPI_Comm_f2c(f_comm);
|
||||
int f_comm = f_lammps_get_comm();
|
||||
auto mycomm = MPI_Comm_f2c(f_comm);
|
||||
EXPECT_EQ(lmp->world, mycomm);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
EXPECT_EQ(lmp->screen, stdout);
|
||||
@ -90,10 +90,10 @@ TEST(fortran_open, with_args)
|
||||
void *handle = f_lammps_open_with_args();
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.substr(0, 6).c_str(), "LAMMPS");
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
int f_comm = f_lammps_get_comm();
|
||||
MPI_Comm mycomm = MPI_Comm_f2c(f_comm);
|
||||
int f_comm = f_lammps_get_comm();
|
||||
auto mycomm = MPI_Comm_f2c(f_comm);
|
||||
EXPECT_EQ(lmp->world, mycomm);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
EXPECT_EQ(lmp->screen, stdout);
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
// unit tests for creating atoms in a LAMMPS instance through the Fortran wrapper
|
||||
|
||||
#include "atom.h"
|
||||
#include "lammps.h"
|
||||
#include "library.h"
|
||||
#include "atom.h"
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <mpi.h>
|
||||
@ -56,39 +56,39 @@ TEST_F(LAMMPS_create_atoms, create_three)
|
||||
#endif
|
||||
double **x, **v;
|
||||
EXPECT_EQ(lmp->atom->nlocal, 3);
|
||||
tag = lmp->atom->tag;
|
||||
tag = lmp->atom->tag;
|
||||
image = lmp->atom->image;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
f_lammps_create_three_atoms();
|
||||
EXPECT_EQ(lmp->atom->nlocal, 6);
|
||||
for (int i = 0; i < lmp->atom->nlocal; i++) {
|
||||
if (tag[i] == 4) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(1,-1,3));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],1.0);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],1.8);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],2.718281828);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],1.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],-1.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(1, -1, 3));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 1.0);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 1.8);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 2.718281828);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 1.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], -1.0);
|
||||
}
|
||||
if (tag[i] == 5) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(-2,-2,1));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],1.8);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],1.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],1.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],-1.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],3.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(-2, -2, 1));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 1.8);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 1.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 1.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], -1.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], 3.0);
|
||||
}
|
||||
if (tag[i] == 6) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(-2,0,0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],0.6);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],0.8);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],2.2);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.1);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],0.2);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],-0.2);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(-2, 0, 0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 0.6);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 0.8);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 2.2);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.1);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 0.2);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], -0.2);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -106,30 +106,30 @@ TEST_F(LAMMPS_create_atoms, create_two_more)
|
||||
EXPECT_EQ(lmp->atom->nlocal, 6);
|
||||
f_lammps_create_two_more();
|
||||
EXPECT_EQ(lmp->atom->nlocal, 8);
|
||||
tag = lmp->atom->tag;
|
||||
tag = lmp->atom->tag;
|
||||
image = lmp->atom->image;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
for (int i = 0; i < lmp->atom->nlocal; i++) {
|
||||
if (tag[i] == 7) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(0,0,0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],1.9);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],3.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],0.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(0, 0, 0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 1.9);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 3.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], 0.0);
|
||||
}
|
||||
if (tag[i] == 8) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(0,0,0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],1.2);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],2.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],1.25);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],0.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(0, 0, 0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 1.2);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 2.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 1.25);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(LAMMPS_create_atoms, create_two_more_bigsmall)
|
||||
@ -149,30 +149,30 @@ TEST_F(LAMMPS_create_atoms, create_two_more_bigsmall)
|
||||
f_lammps_create_two_more_small();
|
||||
#endif
|
||||
EXPECT_EQ(lmp->atom->nlocal, 8);
|
||||
tag = lmp->atom->tag;
|
||||
tag = lmp->atom->tag;
|
||||
image = lmp->atom->image;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
for (int i = 0; i < lmp->atom->nlocal; i++) {
|
||||
if (tag[i] == 7) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(-1,0,0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],1.2);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],2.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],1.25);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],0.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(-1, 0, 0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 1.2);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 2.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 1.25);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], 0.0);
|
||||
}
|
||||
if (tag[i] == 8) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(1,0,0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],1.9);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],3.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],0.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(1, 0, 0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 1.9);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 3.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(LAMMPS_create_atoms, create_two_more_bigsmall2)
|
||||
@ -192,28 +192,28 @@ TEST_F(LAMMPS_create_atoms, create_two_more_bigsmall2)
|
||||
f_lammps_create_two_more_small2();
|
||||
#endif
|
||||
EXPECT_EQ(lmp->atom->nlocal, 8);
|
||||
tag = lmp->atom->tag;
|
||||
tag = lmp->atom->tag;
|
||||
image = lmp->atom->image;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
for (int i = 0; i < lmp->atom->nlocal; i++) {
|
||||
if (tag[i] == 7) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(0,0,0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],1.2);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],2.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],1.25);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],0.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(0, 0, 0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 1.2);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 2.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 1.25);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], 0.0);
|
||||
}
|
||||
if (tag[i] == 8) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(0,0,0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],1.9);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],3.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],0.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(0, 0, 0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 1.9);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 3.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -51,7 +51,7 @@ protected:
|
||||
TEST_F(LAMMPS_extract_fix, global_scalar)
|
||||
{
|
||||
f_lammps_setup_extract_fix();
|
||||
double *scalar =
|
||||
auto *scalar =
|
||||
(double *)lammps_extract_fix(lmp, "recenter", LMP_STYLE_GLOBAL, LMP_TYPE_SCALAR, -1, -1);
|
||||
EXPECT_DOUBLE_EQ(f_lammps_extract_fix_global_scalar(), *scalar);
|
||||
lammps_free(scalar);
|
||||
@ -60,11 +60,11 @@ TEST_F(LAMMPS_extract_fix, global_scalar)
|
||||
TEST_F(LAMMPS_extract_fix, global_vector)
|
||||
{
|
||||
f_lammps_setup_extract_fix();
|
||||
double *x =
|
||||
auto *x =
|
||||
(double *)lammps_extract_fix(lmp, "recenter", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 0, -1);
|
||||
double *y =
|
||||
auto *y =
|
||||
(double *)lammps_extract_fix(lmp, "recenter", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 1, -1);
|
||||
double *z =
|
||||
auto *z =
|
||||
(double *)lammps_extract_fix(lmp, "recenter", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 2, -1);
|
||||
EXPECT_DOUBLE_EQ(f_lammps_extract_fix_global_vector(1), *x);
|
||||
EXPECT_DOUBLE_EQ(f_lammps_extract_fix_global_vector(2), *y);
|
||||
|
||||
@ -121,7 +121,7 @@ TEST_F(LAMMPS_extract_variable, loop_pad)
|
||||
char str[10];
|
||||
char *fstr;
|
||||
for (i = 1; i <= 10; i++) {
|
||||
std::sprintf(str, "%02d", i);
|
||||
std::snprintf(str, 10, "%02d", i);
|
||||
fstr = f_lammps_extract_variable_loop_pad();
|
||||
EXPECT_STREQ(fstr, str);
|
||||
std::free(fstr);
|
||||
@ -170,7 +170,7 @@ TEST_F(LAMMPS_extract_variable, format)
|
||||
char str[16];
|
||||
char *fstr;
|
||||
for (i = 1; i <= 10; i++) {
|
||||
std::sprintf(str, "%.6G", std::exp(i));
|
||||
std::snprintf(str, 16, "%.6G", std::exp(i));
|
||||
fstr = f_lammps_extract_variable_format();
|
||||
EXPECT_STREQ(fstr, str);
|
||||
std::free(fstr);
|
||||
@ -185,7 +185,7 @@ TEST_F(LAMMPS_extract_variable, format_pad)
|
||||
char str[16];
|
||||
char *fstr;
|
||||
for (i = 1; i <= 10; i++) {
|
||||
std::sprintf(str, "%08.6G", std::exp(i));
|
||||
std::snprintf(str, 16, "%08.6G", std::exp(i));
|
||||
fstr = f_lammps_extract_variable_format_pad();
|
||||
EXPECT_STREQ(fstr, str);
|
||||
std::free(fstr);
|
||||
|
||||
@ -18,7 +18,7 @@ void f_lammps_close();
|
||||
void f_lammps_setup_fix_external_callback();
|
||||
void f_lammps_setup_fix_external_array();
|
||||
void f_lammps_set_fix_external_callbacks();
|
||||
void f_lammps_get_force(int, double*);
|
||||
void f_lammps_get_force(int, double *);
|
||||
void f_lammps_reverse_direction();
|
||||
void f_lammps_find_forces();
|
||||
void f_lammps_add_energy();
|
||||
@ -59,11 +59,11 @@ TEST_F(LAMMPS_fixexternal, callback)
|
||||
f_lammps_set_fix_external_callbacks();
|
||||
lammps_command(lmp, "run 0");
|
||||
double f[3];
|
||||
f_lammps_get_force(1,f);
|
||||
f_lammps_get_force(1, f);
|
||||
EXPECT_DOUBLE_EQ(f[0], 3.0);
|
||||
EXPECT_DOUBLE_EQ(f[1], -3.0);
|
||||
EXPECT_DOUBLE_EQ(f[2], 3.75);
|
||||
f_lammps_get_force(2,f);
|
||||
f_lammps_get_force(2, f);
|
||||
EXPECT_DOUBLE_EQ(f[0], -3.0);
|
||||
EXPECT_DOUBLE_EQ(f[1], 3.0);
|
||||
EXPECT_DOUBLE_EQ(f[2], -3.75);
|
||||
@ -71,11 +71,11 @@ TEST_F(LAMMPS_fixexternal, callback)
|
||||
f_lammps_reverse_direction();
|
||||
f_lammps_set_fix_external_callbacks();
|
||||
lammps_command(lmp, "run 0");
|
||||
f_lammps_get_force(1,f);
|
||||
f_lammps_get_force(1, f);
|
||||
EXPECT_DOUBLE_EQ(f[0], -1.0);
|
||||
EXPECT_DOUBLE_EQ(f[1], 1.0);
|
||||
EXPECT_DOUBLE_EQ(f[2], -1.25);
|
||||
f_lammps_get_force(2,f);
|
||||
f_lammps_get_force(2, f);
|
||||
EXPECT_DOUBLE_EQ(f[0], 1.0);
|
||||
EXPECT_DOUBLE_EQ(f[1], -1.0);
|
||||
EXPECT_DOUBLE_EQ(f[2], 1.25);
|
||||
@ -85,7 +85,7 @@ TEST_F(LAMMPS_fixexternal, array)
|
||||
{
|
||||
f_lammps_setup_fix_external_array();
|
||||
double **f;
|
||||
f = (double**) lammps_extract_atom(lmp, "f");
|
||||
f = (double **)lammps_extract_atom(lmp, "f");
|
||||
f_lammps_find_forces();
|
||||
lammps_command(lmp, "run 0");
|
||||
EXPECT_DOUBLE_EQ(f[0][0], 14.0);
|
||||
@ -112,19 +112,19 @@ TEST_F(LAMMPS_fixexternal, virial_global)
|
||||
double virial[6], volume;
|
||||
f_lammps_set_virial();
|
||||
lammps_command(lmp, "run 0");
|
||||
volume = lammps_get_thermo(lmp, "vol");
|
||||
volume = lammps_get_thermo(lmp, "vol");
|
||||
virial[0] = lammps_get_thermo(lmp, "pxx");
|
||||
virial[1] = lammps_get_thermo(lmp, "pyy");
|
||||
virial[2] = lammps_get_thermo(lmp, "pzz");
|
||||
virial[3] = lammps_get_thermo(lmp, "pxy");
|
||||
virial[4] = lammps_get_thermo(lmp, "pxz");
|
||||
virial[5] = lammps_get_thermo(lmp, "pyz");
|
||||
EXPECT_DOUBLE_EQ(virial[0], 1.0/volume);
|
||||
EXPECT_DOUBLE_EQ(virial[1], 2.0/volume);
|
||||
EXPECT_DOUBLE_EQ(virial[2], 2.5/volume);
|
||||
EXPECT_DOUBLE_EQ(virial[3], -1.0/volume);
|
||||
EXPECT_DOUBLE_EQ(virial[4], -2.25/volume);
|
||||
EXPECT_DOUBLE_EQ(virial[5], -3.02/volume);
|
||||
EXPECT_DOUBLE_EQ(virial[0], 1.0 / volume);
|
||||
EXPECT_DOUBLE_EQ(virial[1], 2.0 / volume);
|
||||
EXPECT_DOUBLE_EQ(virial[2], 2.5 / volume);
|
||||
EXPECT_DOUBLE_EQ(virial[3], -1.0 / volume);
|
||||
EXPECT_DOUBLE_EQ(virial[4], -2.25 / volume);
|
||||
EXPECT_DOUBLE_EQ(virial[5], -3.02 / volume);
|
||||
};
|
||||
|
||||
TEST_F(LAMMPS_fixexternal, energy_peratom)
|
||||
@ -135,13 +135,12 @@ TEST_F(LAMMPS_fixexternal, energy_peratom)
|
||||
double energy;
|
||||
lammps_command(lmp, "run 0");
|
||||
int nlocal = lammps_extract_setting(lmp, "nlocal");
|
||||
for (int i = 1; i <= nlocal; i++)
|
||||
{
|
||||
for (int i = 1; i <= nlocal; i++) {
|
||||
energy = f_lammps_find_peratom_energy(i);
|
||||
if (i == 1)
|
||||
EXPECT_DOUBLE_EQ(energy, 1.0);
|
||||
EXPECT_DOUBLE_EQ(energy, 1.0);
|
||||
else
|
||||
EXPECT_DOUBLE_EQ(energy, 10.0);
|
||||
EXPECT_DOUBLE_EQ(energy, 10.0);
|
||||
}
|
||||
};
|
||||
|
||||
@ -153,26 +152,22 @@ TEST_F(LAMMPS_fixexternal, virial_peratom)
|
||||
double virial[6];
|
||||
lammps_command(lmp, "run 0");
|
||||
int nlocal = lammps_extract_setting(lmp, "nlocal");
|
||||
for (int i = 1; i <= nlocal; i++)
|
||||
{
|
||||
for (int i = 1; i <= nlocal; i++) {
|
||||
f_lammps_find_peratom_virial(virial, i);
|
||||
if (i == 1)
|
||||
{
|
||||
EXPECT_DOUBLE_EQ(virial[0], -1.0);
|
||||
EXPECT_DOUBLE_EQ(virial[1], -2.0);
|
||||
EXPECT_DOUBLE_EQ(virial[2], 1.0);
|
||||
EXPECT_DOUBLE_EQ(virial[3], 2.0);
|
||||
EXPECT_DOUBLE_EQ(virial[4], -3.0);
|
||||
EXPECT_DOUBLE_EQ(virial[5], 3.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
EXPECT_DOUBLE_EQ(virial[0], -10.0);
|
||||
EXPECT_DOUBLE_EQ(virial[1], -20.0);
|
||||
EXPECT_DOUBLE_EQ(virial[2], 10.0);
|
||||
EXPECT_DOUBLE_EQ(virial[3], 20.0);
|
||||
EXPECT_DOUBLE_EQ(virial[4], -30.0);
|
||||
EXPECT_DOUBLE_EQ(virial[5], 30.0);
|
||||
if (i == 1) {
|
||||
EXPECT_DOUBLE_EQ(virial[0], -1.0);
|
||||
EXPECT_DOUBLE_EQ(virial[1], -2.0);
|
||||
EXPECT_DOUBLE_EQ(virial[2], 1.0);
|
||||
EXPECT_DOUBLE_EQ(virial[3], 2.0);
|
||||
EXPECT_DOUBLE_EQ(virial[4], -3.0);
|
||||
EXPECT_DOUBLE_EQ(virial[5], 3.0);
|
||||
} else {
|
||||
EXPECT_DOUBLE_EQ(virial[0], -10.0);
|
||||
EXPECT_DOUBLE_EQ(virial[1], -20.0);
|
||||
EXPECT_DOUBLE_EQ(virial[2], 10.0);
|
||||
EXPECT_DOUBLE_EQ(virial[3], 20.0);
|
||||
EXPECT_DOUBLE_EQ(virial[4], -30.0);
|
||||
EXPECT_DOUBLE_EQ(virial[5], 30.0);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -184,11 +179,9 @@ TEST_F(LAMMPS_fixexternal, vector)
|
||||
f_lammps_fixexternal_set_vector();
|
||||
lammps_command(lmp, "run 0");
|
||||
double *v;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
v = (double*) lammps_extract_fix(lmp, "ext2", LMP_STYLE_GLOBAL,
|
||||
LMP_TYPE_VECTOR, i, 1);
|
||||
EXPECT_DOUBLE_EQ(i+1, *v);
|
||||
std::free(v);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
v = (double *)lammps_extract_fix(lmp, "ext2", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, i, 1);
|
||||
EXPECT_DOUBLE_EQ(i + 1, *v);
|
||||
std::free(v);
|
||||
}
|
||||
};
|
||||
|
||||
@ -277,7 +277,7 @@ TEST_F(LAMMPS_gather_scatter, gather_compute)
|
||||
lammps_command(lmp, "run 0");
|
||||
int natoms = lmp->atom->natoms;
|
||||
int *tag = lmp->atom->tag;
|
||||
double *pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR);
|
||||
auto *pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR);
|
||||
for (int i = 0; i < natoms; i++)
|
||||
EXPECT_DOUBLE_EQ(f_lammps_gather_pe_atom(tag[i]), pe[i]);
|
||||
#endif
|
||||
@ -292,7 +292,7 @@ TEST_F(LAMMPS_gather_scatter, gather_compute_concat)
|
||||
lammps_command(lmp, "run 0");
|
||||
int natoms = lmp->atom->natoms;
|
||||
int *tag = lmp->atom->tag;
|
||||
double *pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR);
|
||||
auto *pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR);
|
||||
for (int i = 0; i < natoms; i++)
|
||||
EXPECT_DOUBLE_EQ(f_lammps_gather_pe_atom(tag[i]), pe[i]);
|
||||
#endif
|
||||
@ -305,11 +305,11 @@ TEST_F(LAMMPS_gather_scatter, gather_compute_subset)
|
||||
#else
|
||||
f_lammps_setup_gather_scatter();
|
||||
lammps_command(lmp, "run 0");
|
||||
int ids[2] = {3, 1};
|
||||
int *tag = lmp->atom->tag;
|
||||
double pe[2] = {0.0, 0.0};
|
||||
int nlocal = lammps_extract_setting(lmp, "nlocal");
|
||||
double *pa_pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR);
|
||||
int ids[2] = {3, 1};
|
||||
int *tag = lmp->atom->tag;
|
||||
double pe[2] = {0.0, 0.0};
|
||||
int nlocal = lammps_extract_setting(lmp, "nlocal");
|
||||
auto *pa_pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR);
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (tag[i] == ids[0]) pe[0] = pa_pe[i];
|
||||
@ -330,10 +330,10 @@ TEST_F(LAMMPS_gather_scatter, scatter_compute)
|
||||
#else
|
||||
f_lammps_setup_gather_scatter();
|
||||
int natoms = lmp->atom->natoms;
|
||||
double *pe = new double[natoms];
|
||||
auto *pe = new double[natoms];
|
||||
lammps_command(lmp, "run 0");
|
||||
lammps_gather(lmp, "c_pe", 1, 1, pe);
|
||||
double *old_pe = new double[natoms];
|
||||
auto *old_pe = new double[natoms];
|
||||
for (int i = 0; i < natoms; i++)
|
||||
old_pe[i] = pe[i];
|
||||
EXPECT_DOUBLE_EQ(pe[0], old_pe[0]);
|
||||
@ -356,10 +356,10 @@ TEST_F(LAMMPS_gather_scatter, scatter_subset_compute)
|
||||
#else
|
||||
f_lammps_setup_gather_scatter();
|
||||
int natoms = lmp->atom->natoms;
|
||||
double *pe = new double[natoms];
|
||||
auto *pe = new double[natoms];
|
||||
lammps_command(lmp, "run 0");
|
||||
lammps_gather(lmp, "c_pe", 1, 1, pe);
|
||||
double *old_pe = new double[natoms];
|
||||
auto *old_pe = new double[natoms];
|
||||
for (int i = 0; i < natoms; i++)
|
||||
old_pe[i] = pe[i];
|
||||
EXPECT_DOUBLE_EQ(pe[0], old_pe[0]);
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
// unit tests for accessing neighbor lists in a LAMMPS instance through the Fortran wrapper
|
||||
|
||||
#include "force.h"
|
||||
#include "info.h"
|
||||
#include "lammps.h"
|
||||
#include "library.h"
|
||||
#include "force.h"
|
||||
#include "modify.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "info.h"
|
||||
//#include <cstdint>
|
||||
//#include <cstdlib>
|
||||
#include "neighbor.h"
|
||||
// #include <cstdint>
|
||||
// #include <cstdlib>
|
||||
#include <mpi.h>
|
||||
#include <string>
|
||||
|
||||
@ -33,13 +33,15 @@ protected:
|
||||
LAMMPS_neighbors() = default;
|
||||
~LAMMPS_neighbors() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
void SetUp() override
|
||||
{
|
||||
::testing::internal::CaptureStdout();
|
||||
lmp = (LAMMPS_NS::LAMMPS *)f_lammps_with_args();
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.substr(0, 8).c_str(), "LAMMPS (");
|
||||
}
|
||||
void TearDown() override {
|
||||
void TearDown() override
|
||||
{
|
||||
::testing::internal::CaptureStdout();
|
||||
f_lammps_close();
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
@ -52,14 +54,13 @@ TEST_F(LAMMPS_neighbors, pair)
|
||||
{
|
||||
f_lammps_setup_neigh_tests();
|
||||
int pair_neighlist = f_lammps_pair_neighlist_test();
|
||||
Pair *pair = lmp->force->pair_match("lj/cut",1,0);
|
||||
int index = -2;
|
||||
Pair *pair = lmp->force->pair_match("lj/cut", 1, 0);
|
||||
int index = -2;
|
||||
if (pair != nullptr) {
|
||||
for (int i = 0; i < lmp->neighbor->nlist; i++) {
|
||||
NeighList *list = lmp->neighbor->lists[i];
|
||||
if ((list->requestor_type == NeighList::PAIR)
|
||||
and (pair == list->requestor)
|
||||
and (list->id == 0)) {
|
||||
if ((list->requestor_type == NeighList::PAIR) and (pair == list->requestor) and
|
||||
(list->id == 0)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
@ -72,16 +73,16 @@ TEST_F(LAMMPS_neighbors, fix)
|
||||
{
|
||||
if (not Info::has_package("REPLICA")) GTEST_SKIP();
|
||||
f_lammps_setup_neigh_tests();
|
||||
auto fix = lmp->modify->get_fix_by_id("f");
|
||||
auto *fix = lmp->modify->get_fix_by_id("f");
|
||||
EXPECT_NE(fix, nullptr);
|
||||
int ilist = -2;
|
||||
for (int i = 0; i < lmp->neighbor->nlist; i++) {
|
||||
NeighList *list = lmp->neighbor->lists[i];
|
||||
if ( (list->requestor_type == NeighList::FIX)
|
||||
and (fix == list->requestor) and (list->id == 0) ) {
|
||||
ilist = i;
|
||||
break;
|
||||
}
|
||||
NeighList *list = lmp->neighbor->lists[i];
|
||||
if ((list->requestor_type == NeighList::FIX) and (fix == list->requestor) and
|
||||
(list->id == 0)) {
|
||||
ilist = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(ilist, f_lammps_fix_neighlist_test());
|
||||
};
|
||||
@ -89,13 +90,13 @@ TEST_F(LAMMPS_neighbors, fix)
|
||||
TEST_F(LAMMPS_neighbors, compute)
|
||||
{
|
||||
f_lammps_setup_neigh_tests();
|
||||
auto compute = lmp->modify->get_compute_by_id("c");
|
||||
EXPECT_NE(compute,nullptr);
|
||||
auto *compute = lmp->modify->get_compute_by_id("c");
|
||||
EXPECT_NE(compute, nullptr);
|
||||
int ilist = -2;
|
||||
for (int i=0; i < lmp->neighbor->nlist; i++) {
|
||||
for (int i = 0; i < lmp->neighbor->nlist; i++) {
|
||||
NeighList *list = lmp->neighbor->lists[i];
|
||||
if ( (list->requestor_type == NeighList::COMPUTE)
|
||||
and (compute == list->requestor) and (list->id == 0) ) {
|
||||
if ((list->requestor_type == NeighList::COMPUTE) and (compute == list->requestor) and
|
||||
(list->id == 0)) {
|
||||
ilist = i;
|
||||
break;
|
||||
}
|
||||
@ -107,17 +108,17 @@ TEST_F(LAMMPS_neighbors, numelements)
|
||||
{
|
||||
f_lammps_setup_neigh_tests();
|
||||
int num_neigh = 0;
|
||||
int pair_id = f_lammps_pair_neighlist_test();
|
||||
num_neigh = f_lammps_neighlist_num_elements(pair_id);
|
||||
int pair_id = f_lammps_pair_neighlist_test();
|
||||
num_neigh = f_lammps_neighlist_num_elements(pair_id);
|
||||
EXPECT_EQ(num_neigh, lammps_neighlist_num_elements(lmp, pair_id));
|
||||
if (Info::has_package("REPLICA")) {
|
||||
int fix_id = f_lammps_fix_neighlist_test();
|
||||
num_neigh = f_lammps_neighlist_num_elements(fix_id);
|
||||
EXPECT_EQ(num_neigh, lammps_neighlist_num_elements(lmp, fix_id));
|
||||
int fix_id = f_lammps_fix_neighlist_test();
|
||||
num_neigh = f_lammps_neighlist_num_elements(fix_id);
|
||||
EXPECT_EQ(num_neigh, lammps_neighlist_num_elements(lmp, fix_id));
|
||||
}
|
||||
int compute_id = f_lammps_compute_neighlist_test();
|
||||
num_neigh = f_lammps_neighlist_num_elements(compute_id);
|
||||
num_neigh = f_lammps_neighlist_num_elements(compute_id);
|
||||
EXPECT_EQ(num_neigh, lammps_neighlist_num_elements(lmp, compute_id));
|
||||
};
|
||||
|
||||
} // LAMMPS_NS
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
@ -3,6 +3,7 @@ import sys,os,unittest,ctypes
|
||||
from lammps import lammps, LMP_VAR_ATOM, LMP_STYLE_GLOBAL, LMP_STYLE_LOCAL
|
||||
from lammps import LMP_TYPE_VECTOR, LMP_SIZE_VECTOR, LMP_SIZE_ROWS, LMP_SIZE_COLS
|
||||
from lammps import LAMMPS_DOUBLE_2D, LAMMPS_AUTODETECT
|
||||
import math
|
||||
|
||||
has_manybody=False
|
||||
try:
|
||||
@ -15,6 +16,17 @@ try:
|
||||
except:
|
||||
pass
|
||||
|
||||
has_streitz=False
|
||||
try:
|
||||
machine=None
|
||||
if 'LAMMPS_MACHINE_NAME' in os.environ:
|
||||
machine=os.environ['LAMMPS_MACHINE_NAME']
|
||||
lmp=lammps(name=machine)
|
||||
has_streitz = lmp.has_style("pair","coul/streitz")
|
||||
lmp.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
class PythonCommand(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
@ -666,6 +678,49 @@ create_atoms 1 single &
|
||||
self.lmp.command("balance 0.1 rcb")
|
||||
self.assertEqual(self.lmp.extract_global("procgrid"), None)
|
||||
|
||||
def test_extract_pair1(self):
|
||||
self.lmp.command("region box block 0 1 0 1 0 1")
|
||||
self.lmp.command("create_box 3 box")
|
||||
self.lmp.command("mass * 1.0")
|
||||
self.lmp.command("pair_style lj/cut 3.0")
|
||||
self.lmp.command("pair_coeff 1 1 1.0 1.0")
|
||||
self.lmp.command("pair_coeff 2 2 1.5 2.0")
|
||||
self.lmp.command("pair_coeff 3 3 1.0 3.0")
|
||||
self.lmp.command("run 0 post no")
|
||||
self.assertEqual(self.lmp.extract_pair_dimension("epsilon"), 2)
|
||||
self.assertEqual(self.lmp.extract_pair_dimension("sigma"), 2)
|
||||
self.assertEqual(self.lmp.extract_pair_dimension("cut_coul"), None)
|
||||
sigma = self.lmp.extract_pair("sigma")
|
||||
self.assertEqual(sigma[1][1], 1.0)
|
||||
self.assertEqual(sigma[2][2], 2.0)
|
||||
self.assertEqual(sigma[3][3], 3.0)
|
||||
self.assertEqual(sigma[1][2], math.sqrt(2.0))
|
||||
|
||||
@unittest.skipIf(not has_streitz, "Pair extract for coul/streitz test")
|
||||
def test_extract_pair2(self):
|
||||
self.lmp.command("units metal")
|
||||
self.lmp.command("atom_style charge")
|
||||
self.lmp.command("region box block 0 1 0 1 0 1")
|
||||
self.lmp.command("create_box 2 box")
|
||||
self.lmp.command("mass * 1.0")
|
||||
self.lmp.command("pair_style coul/streitz 12.0 wolf 0.31")
|
||||
self.lmp.command("pair_coeff * * AlO.streitz Al O")
|
||||
self.lmp.command("run 0 post no")
|
||||
|
||||
self.assertEqual(self.lmp.extract_pair_dimension("chi"), 1)
|
||||
self.assertEqual(self.lmp.extract_pair_dimension("scale"), 2)
|
||||
self.assertEqual(self.lmp.extract_pair_dimension("cut_coul"), 0)
|
||||
self.assertEqual(self.lmp.extract_pair_dimension("epsilon"), None)
|
||||
|
||||
self.assertEqual(self.lmp.extract_pair("cut_coul"), 12.0)
|
||||
self.assertEqual(self.lmp.extract_pair("chi"), [0.0, 0.0, 5.484763])
|
||||
scale = self.lmp.extract_pair("scale")
|
||||
self.assertEqual(scale[0][0], 0.0);
|
||||
self.assertEqual(scale[0][1], 0.0);
|
||||
self.assertEqual(scale[1][1], 1.0);
|
||||
self.assertEqual(scale[1][2], 1.0);
|
||||
self.assertEqual(scale[2][2], 1.0);
|
||||
|
||||
def test_create_atoms(self):
|
||||
self.lmp.command("boundary f p m")
|
||||
self.lmp.command("region box block 0 10 0 10 0 10")
|
||||
|
||||
@ -342,7 +342,7 @@ TEST_F(FixPythonInvokeTest, post_force)
|
||||
if (line == "PYTHON_POST_FORCE") ++count;
|
||||
}
|
||||
|
||||
ASSERT_EQ(count, 5);
|
||||
ASSERT_EQ(count, 6);
|
||||
}
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
@ -107,7 +107,7 @@ public:
|
||||
|
||||
protected:
|
||||
std::string testbinary = "LAMMPSTest";
|
||||
LAMMPS::argv args = {"-log", "none", "-echo", "screen", "-nocite"};
|
||||
LAMMPS::argv args = {"-log", "none", "-echo", "screen", "-nocite"};
|
||||
LAMMPS *lmp;
|
||||
Info *info;
|
||||
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
# -*- CMake -*- file for tests of utily functions and classes in LAMMPS
|
||||
|
||||
# we use python 3's subprocess module to run the tools and check the output
|
||||
find_package(Python 3.6 COMPONENTS Interpreter)
|
||||
|
||||
get_property(BUILD_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(BUILD_IS_MULTI_CONFIG)
|
||||
set(LAMMPS_SHELL_EXE_DIR ${CMAKE_BINARY_DIR}/$<CONFIG>)
|
||||
else()
|
||||
set(LAMMPS_SHELL_EXE_DIR ${CMAKE_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
if(Python_EXECUTABLE)
|
||||
if(BUILD_LAMMPS_SHELL)
|
||||
add_test(NAME LammpsShell
|
||||
COMMAND ${Python_EXECUTABLE} -u ${CMAKE_CURRENT_SOURCE_DIR}/test_lammps_shell.py -v
|
||||
WORKING_DIRECTORY ${LAMMPS_SHELL_EXE_DIR})
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Skipping Tests for LAMMPS tools: no suitable Python interpreter")
|
||||
endif()
|
||||
@ -1,151 +0,0 @@
|
||||
|
||||
import os, re, subprocess, unittest
|
||||
|
||||
# enable test mode
|
||||
os.putenv('LAMMPS_SHELL_TESTING','1')
|
||||
|
||||
shell_prompt_re = r"([^>]*LAMMPS Shell> ([a-z0-9_]+) *([a-z0-9_\.]+)?.*\n)+"
|
||||
cmd_group_re = r"([^>]*LAMMPS Shell> ([a-z0-9_]+) +([a-z0-9]+) +([a-z0-9]+)? *([a-z/0-9]+)?.*\n)+"
|
||||
|
||||
#
|
||||
class LammpsShell(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.proc = subprocess.Popen('./lammps-shell',
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
|
||||
|
||||
def tearDown(self):
|
||||
self.proc.kill()
|
||||
|
||||
|
||||
def InputRunner(self,text):
|
||||
"""Test tab expansions"""
|
||||
try:
|
||||
[outs,errs] = self.proc.communicate(input=text, timeout=10)
|
||||
self.timeout = 0
|
||||
except subprocess.TimeoutExpired:
|
||||
self.proc.kill()
|
||||
[outs,errs] = self.proc.communicate()
|
||||
self.timeout = 1
|
||||
|
||||
return outs.decode('UTF-8')
|
||||
|
||||
def testExpandClearHistory(self):
|
||||
"""Test expansion of a shell specific command"""
|
||||
matches = re.findall(shell_prompt_re, self.InputRunner(b'clear_his\t\n'), re.MULTILINE)
|
||||
if self.timeout:
|
||||
self.fail("Timeout")
|
||||
else:
|
||||
self.assertEqual(matches[0][1],"clear_history")
|
||||
|
||||
def testExpandDimension(self):
|
||||
"""Test expansion of a LAMMPS command"""
|
||||
matches = re.findall(shell_prompt_re, self.InputRunner(b'dimens\t\n'), re.MULTILINE)
|
||||
if self.timeout:
|
||||
self.fail("Timeout")
|
||||
else:
|
||||
self.assertEqual(matches[0][1],"dimension")
|
||||
|
||||
def testExpandPairStyle(self):
|
||||
"""Test expansion of a pair style"""
|
||||
matches = re.findall(shell_prompt_re, self.InputRunner(b'pair_st\t zer\t\n'), re.MULTILINE)
|
||||
if self.timeout:
|
||||
self.fail("Timeout")
|
||||
else:
|
||||
self.assertEqual(matches[0][1],"pair_style")
|
||||
self.assertEqual(matches[0][2],"zero")
|
||||
|
||||
def testExpandBondStyle(self):
|
||||
"""Test expansion of a bond style"""
|
||||
matches = re.findall(shell_prompt_re, self.InputRunner(b'bond_st\t zer\t\n'), re.MULTILINE)
|
||||
if self.timeout:
|
||||
self.fail("Timeout")
|
||||
else:
|
||||
self.assertEqual(matches[0][1],"bond_style")
|
||||
self.assertEqual(matches[0][2],"zero")
|
||||
|
||||
def testExpandAngleStyle(self):
|
||||
"""Test expansion of a angle style"""
|
||||
matches = re.findall(shell_prompt_re, self.InputRunner(b'angle_st\t zer\t\n'), re.MULTILINE)
|
||||
if self.timeout:
|
||||
self.fail("Timeout")
|
||||
else:
|
||||
self.assertEqual(matches[0][1],"angle_style")
|
||||
self.assertEqual(matches[0][2],"zero")
|
||||
|
||||
def testExpandDihedralStyle(self):
|
||||
"""Test expansion of a dihedral style"""
|
||||
matches = re.findall(shell_prompt_re, self.InputRunner(b'dihedral_st\t zer\t\n'), re.MULTILINE)
|
||||
if self.timeout:
|
||||
self.fail("Timeout")
|
||||
else:
|
||||
self.assertEqual(matches[0][1],"dihedral_style")
|
||||
self.assertEqual(matches[0][2],"zero")
|
||||
|
||||
def testExpandImproperStyle(self):
|
||||
"""Test expansion of a improper style"""
|
||||
matches = re.findall(shell_prompt_re, self.InputRunner(b'improper_st\t zer\t\n'), re.MULTILINE)
|
||||
if self.timeout:
|
||||
self.fail("Timeout")
|
||||
else:
|
||||
self.assertEqual(matches[0][1],"improper_style")
|
||||
self.assertEqual(matches[0][2],"zero")
|
||||
|
||||
def testExpandComputeGroup(self):
|
||||
"""Test expansion of a group-ID and a compute command"""
|
||||
matches = re.findall(cmd_group_re, self.InputRunner(b'compute test al\tstress/at\t\n'), re.MULTILINE)
|
||||
if self.timeout:
|
||||
self.fail("Timeout")
|
||||
else:
|
||||
self.assertEqual(matches[0][1],"compute")
|
||||
self.assertEqual(matches[0][2],"test")
|
||||
self.assertEqual(matches[0][3],"all")
|
||||
self.assertEqual(matches[0][4],"stress/atom")
|
||||
|
||||
def testExpandFixGroup(self):
|
||||
"""Test expansion of a group-ID and a fix command"""
|
||||
matches = re.findall(cmd_group_re, self.InputRunner(b'fix test al\tpropert\t\n'), re.MULTILINE)
|
||||
if self.timeout:
|
||||
self.fail("Timeout")
|
||||
else:
|
||||
self.assertEqual(matches[0][1],"fix")
|
||||
self.assertEqual(matches[0][2],"test")
|
||||
self.assertEqual(matches[0][3],"all")
|
||||
self.assertEqual(matches[0][4],"property/atom")
|
||||
|
||||
def testExpandSource(self):
|
||||
"""Test expansion of a shell command and a file name"""
|
||||
with open('.tmp.in.source', 'w') as out:
|
||||
print('units real', file=out)
|
||||
out.close()
|
||||
matches = re.findall(shell_prompt_re, self.InputRunner(b'sour\t.tmp.in.sou\t\n'), re.MULTILINE)
|
||||
os.remove('.tmp.in.source')
|
||||
if self.timeout:
|
||||
self.fail("Timeout")
|
||||
else:
|
||||
self.assertEqual(matches[0][1],"source")
|
||||
self.assertEqual(matches[0][2],".tmp.in.source")
|
||||
|
||||
def testHistory(self):
|
||||
"""Test history expansion"""
|
||||
out = self.InputRunner(b'clear_history\nunits real\ndimension 2\n!!:p\n!-3:p\n!dim:p\n!uni:p\nprint !!:$\nprint !dim:1\n')
|
||||
idx = 0
|
||||
if self.timeout:
|
||||
self.fail("Timeout")
|
||||
else:
|
||||
lines = out.splitlines()
|
||||
for line in lines:
|
||||
if line.startswith('LAMMPS Shell>'): break
|
||||
idx += 1
|
||||
|
||||
self.assertEqual(lines[idx+4],"dimension 2")
|
||||
self.assertEqual(lines[idx+6],"units real")
|
||||
self.assertEqual(lines[idx+8],"dimension 2")
|
||||
self.assertEqual(lines[idx+10],"units real")
|
||||
self.assertEqual(lines[idx+12],"real")
|
||||
self.assertEqual(lines[idx+14],"2")
|
||||
|
||||
###########################
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@ -130,7 +130,10 @@ TEST(LeptonCustomFunction, zbl)
|
||||
|
||||
class ExampleFunction : public Lepton::CustomFunction {
|
||||
int getNumArguments() const override { return 2; }
|
||||
double evaluate(const double *arguments) const override { return 2.0 * arguments[0] * arguments[1]; }
|
||||
double evaluate(const double *arguments) const override
|
||||
{
|
||||
return 2.0 * arguments[0] * arguments[1];
|
||||
}
|
||||
double evaluateDerivative(const double *arguments, const int *derivOrder) const override
|
||||
{
|
||||
if (derivOrder[0] == 1) {
|
||||
|
||||
@ -24,7 +24,7 @@ TEST(Types, ubuf)
|
||||
{
|
||||
double buf[3];
|
||||
double d1 = 0.1;
|
||||
int i1 = -10;
|
||||
int i1 = -10;
|
||||
#if defined(LAMMPS_SMALLSMALL)
|
||||
bigint b1 = 2048;
|
||||
#else
|
||||
@ -43,14 +43,14 @@ TEST(Types, multitype)
|
||||
{
|
||||
multitype m[7];
|
||||
int64_t b1 = (3L << 48) - 1;
|
||||
int i1 = 20;
|
||||
double d1 = 0.1;
|
||||
int i1 = 20;
|
||||
double d1 = 0.1;
|
||||
|
||||
m[0] = b1;
|
||||
m[1] = i1;
|
||||
m[2] = d1;
|
||||
|
||||
m[3] = (bigint) -((1L << 40) + (1L << 50));
|
||||
m[3] = (bigint) - ((1L << 40) + (1L << 50));
|
||||
m[4] = -1023;
|
||||
m[5] = -2.225;
|
||||
|
||||
@ -72,7 +72,7 @@ TEST(Types, multitype)
|
||||
EXPECT_EQ(m[2].data.d, d1);
|
||||
|
||||
#if !defined(LAMMPS_SMALLSMALL)
|
||||
EXPECT_EQ(m[3].data.b, -((1L << 40) + (1L << 50)));
|
||||
EXPECT_EQ(m[3].data.b, -((1L << 40) + (1L << 50)));
|
||||
#endif
|
||||
EXPECT_EQ(m[4].data.i, -1023);
|
||||
EXPECT_EQ(m[5].data.d, -2.225);
|
||||
|
||||
@ -385,9 +385,9 @@ void TestJacobi(int n, //<! matrix size
|
||||
Alloc2D(n, n, &M);
|
||||
Alloc2D(n, n, &evecs);
|
||||
Alloc2D(n, n, &evecs_known);
|
||||
Scalar *evals = new Scalar[n];
|
||||
Scalar *evals_known = new Scalar[n];
|
||||
Scalar *test_evec = new Scalar[n];
|
||||
auto *evals = new Scalar[n];
|
||||
auto *evals_known = new Scalar[n];
|
||||
auto *test_evec = new Scalar[n];
|
||||
|
||||
#endif
|
||||
|
||||
@ -464,7 +464,7 @@ void TestJacobi(int n, //<! matrix size
|
||||
Scalar const(*)[NF]>::SORT_INCREASING_ABS_EVALS);
|
||||
#else
|
||||
ecalc.Diagonalize(M, evals, evecs,
|
||||
Jacobi<Scalar, Scalar *, Scalar **,
|
||||
Jacobi<Scalar, Scalar *, Scalar **,
|
||||
Scalar const *const *>::SORT_INCREASING_ABS_EVALS);
|
||||
#endif
|
||||
|
||||
@ -488,7 +488,7 @@ void TestJacobi(int n, //<! matrix size
|
||||
Scalar const(*)[NF]>::SORT_DECREASING_ABS_EVALS);
|
||||
#else
|
||||
ecalc.Diagonalize(M, evals, evecs,
|
||||
Jacobi<Scalar, Scalar *, Scalar **,
|
||||
Jacobi<Scalar, Scalar *, Scalar **,
|
||||
Scalar const *const *>::SORT_DECREASING_ABS_EVALS);
|
||||
#endif
|
||||
|
||||
@ -511,7 +511,7 @@ void TestJacobi(int n, //<! matrix size
|
||||
Scalar const(*)[NF]>::SORT_INCREASING_EVALS);
|
||||
#else
|
||||
ecalc.Diagonalize(M, evals, evecs,
|
||||
Jacobi<Scalar, Scalar *, Scalar **,
|
||||
Jacobi<Scalar, Scalar *, Scalar **,
|
||||
Scalar const *const *>::SORT_INCREASING_EVALS);
|
||||
#endif
|
||||
for (int i = 1; i < n; i++)
|
||||
@ -533,8 +533,8 @@ void TestJacobi(int n, //<! matrix size
|
||||
Jacobi<Scalar, Scalar *, Scalar(*)[NF], Scalar const(*)[NF]>::DO_NOT_SORT);
|
||||
#else
|
||||
ecalc.Diagonalize(
|
||||
M, evals, evecs,
|
||||
Jacobi<Scalar, Scalar *, Scalar **, Scalar const *const *>::DO_NOT_SORT);
|
||||
M, evals, evecs,
|
||||
Jacobi<Scalar, Scalar *, Scalar **, Scalar const *const *>::DO_NOT_SORT);
|
||||
#endif
|
||||
|
||||
} // if (test_code_coverage)
|
||||
|
||||
@ -173,6 +173,49 @@ TEST(Tokenizer, default_separators)
|
||||
ASSERT_EQ(t.count(), 2);
|
||||
}
|
||||
|
||||
TEST(Tokenizer, contains)
|
||||
{
|
||||
Tokenizer values("test word");
|
||||
ASSERT_TRUE(values.contains("test"));
|
||||
ASSERT_TRUE(values.contains("word"));
|
||||
values = Tokenizer("Triangles");
|
||||
ASSERT_TRUE(values.contains("angles"));
|
||||
ASSERT_TRUE(values.contains("Triangles"));
|
||||
}
|
||||
|
||||
TEST(Tokenizer, not_contains)
|
||||
{
|
||||
Tokenizer values("test word");
|
||||
ASSERT_FALSE(values.contains("test2"));
|
||||
}
|
||||
|
||||
TEST(Tokenizer, matches)
|
||||
{
|
||||
Tokenizer values("test word");
|
||||
ASSERT_TRUE(values.matches("test"));
|
||||
ASSERT_TRUE(values.matches("^test"));
|
||||
ASSERT_TRUE(values.matches("word"));
|
||||
ASSERT_TRUE(values.matches("word$"));
|
||||
ASSERT_TRUE(values.matches("^\\s*\\S+\\s+word"));
|
||||
values = Tokenizer("Triangles");
|
||||
ASSERT_TRUE(values.matches("^\\s*Triangles\\s*$"));
|
||||
values = Tokenizer("\t20\tatoms");
|
||||
ASSERT_TRUE(values.matches("^\\s*\\d+\\s+atoms\\s*$"));
|
||||
}
|
||||
|
||||
TEST(Tokenizer, not_matches)
|
||||
{
|
||||
Tokenizer values("test word");
|
||||
ASSERT_FALSE(values.matches("test2"));
|
||||
ASSERT_FALSE(values.matches("^word"));
|
||||
ASSERT_FALSE(values.matches("^ "));
|
||||
ASSERT_FALSE(values.matches(" $"));
|
||||
values = Tokenizer("Triangles");
|
||||
ASSERT_FALSE(values.matches("^\\s*\\S+\\s+angles"));
|
||||
values = Tokenizer("\t0x20\tatoms");
|
||||
ASSERT_FALSE(values.matches("^\\s*\\d+\\s+atoms\\s*$"));
|
||||
}
|
||||
|
||||
TEST(Tokenizer, as_vector1)
|
||||
{
|
||||
Tokenizer t(" \r\n test \t word \f");
|
||||
@ -338,6 +381,9 @@ TEST(ValueTokenizer, contains)
|
||||
ValueTokenizer values("test word");
|
||||
ASSERT_TRUE(values.contains("test"));
|
||||
ASSERT_TRUE(values.contains("word"));
|
||||
values = ValueTokenizer("Triangles");
|
||||
ASSERT_TRUE(values.contains("angles"));
|
||||
ASSERT_TRUE(values.contains("Triangles"));
|
||||
}
|
||||
|
||||
TEST(ValueTokenizer, not_contains)
|
||||
@ -346,6 +392,33 @@ TEST(ValueTokenizer, not_contains)
|
||||
ASSERT_FALSE(values.contains("test2"));
|
||||
}
|
||||
|
||||
TEST(ValueTokenizer, matches)
|
||||
{
|
||||
ValueTokenizer values("test word");
|
||||
ASSERT_TRUE(values.matches("test"));
|
||||
ASSERT_TRUE(values.matches("^test"));
|
||||
ASSERT_TRUE(values.matches("word"));
|
||||
ASSERT_TRUE(values.matches("word$"));
|
||||
ASSERT_TRUE(values.matches("^\\s*\\S+\\s+word"));
|
||||
values = ValueTokenizer("Triangles");
|
||||
ASSERT_TRUE(values.matches("^\\s*Triangles\\s*$"));
|
||||
values = ValueTokenizer("\t20\tatoms");
|
||||
ASSERT_TRUE(values.matches("^\\s*\\d+\\s+atoms\\s*$"));
|
||||
}
|
||||
|
||||
TEST(ValueTokenizer, not_matches)
|
||||
{
|
||||
ValueTokenizer values("test word");
|
||||
ASSERT_FALSE(values.matches("test2"));
|
||||
ASSERT_FALSE(values.matches("^word"));
|
||||
ASSERT_FALSE(values.matches("^ "));
|
||||
ASSERT_FALSE(values.matches(" $"));
|
||||
values = ValueTokenizer("Triangles");
|
||||
ASSERT_FALSE(values.matches("^\\s*\\S+\\s+angles"));
|
||||
values = ValueTokenizer("\t0x20\tatoms");
|
||||
ASSERT_FALSE(values.matches("^\\s*\\d+\\s+atoms\\s*$"));
|
||||
}
|
||||
|
||||
TEST(ValueTokenizer, missing_int)
|
||||
{
|
||||
ValueTokenizer values("10");
|
||||
|
||||
@ -1061,6 +1061,16 @@ TEST(Utils, timespec2seconds_hhmmss)
|
||||
ASSERT_DOUBLE_EQ(utils::timespec2seconds("2:10:45"), 7845.0);
|
||||
}
|
||||
|
||||
TEST(Utils, timespec2seconds_ssfraction)
|
||||
{
|
||||
ASSERT_DOUBLE_EQ(utils::timespec2seconds("5.2"), 5.2);
|
||||
}
|
||||
|
||||
TEST(Utils, timespec2seconds_mmfraction)
|
||||
{
|
||||
ASSERT_DOUBLE_EQ(utils::timespec2seconds("2.5:10"), 160.0);
|
||||
}
|
||||
|
||||
TEST(Utils, timespec2seconds_invalid)
|
||||
{
|
||||
ASSERT_DOUBLE_EQ(utils::timespec2seconds("2:aa:45"), -1.0);
|
||||
|
||||
Reference in New Issue
Block a user