modernize and reformat with clang-tidy and clang-format
This commit is contained in:
@ -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
|
||||
|
||||
@ -112,75 +112,75 @@ TEST_F(LibraryObjects, variables)
|
||||
if (verbose) std::cout << output;
|
||||
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "unknown"), -1);
|
||||
void *ptr = lammps_extract_variable(lmp, "unknown", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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", NULL);
|
||||
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);
|
||||
double *dptr = (double *)lammps_extract_variable(lmp, "ten4", NULL);
|
||||
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", NULL);
|
||||
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);
|
||||
@ -196,10 +196,10 @@ TEST_F(LibraryObjects, variables)
|
||||
EXPECT_THAT(*(double *)ptr, 0.0);
|
||||
lammps_free(ptr);
|
||||
#elif defined(__linux__)
|
||||
ptr = lammps_extract_variable(lmp, "iswin", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "iswin", nullptr);
|
||||
EXPECT_THAT(*(double *)ptr, 0.0);
|
||||
lammps_free(ptr);
|
||||
ptr = lammps_extract_variable(lmp, "islin", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "islin", nullptr);
|
||||
EXPECT_THAT(*(double *)ptr, 1.0);
|
||||
lammps_free(ptr);
|
||||
#else
|
||||
|
||||
@ -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");
|
||||
auto *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]);
|
||||
for (int &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]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -655,7 +655,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 +663,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 +681,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();
|
||||
|
||||
|
||||
@ -389,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);
|
||||
@ -746,9 +746,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();
|
||||
|
||||
@ -71,7 +71,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool use_re
|
||||
// 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
|
||||
@ -97,7 +97,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool use_re
|
||||
};
|
||||
|
||||
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);
|
||||
@ -128,7 +128,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool use_re
|
||||
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");
|
||||
@ -158,10 +158,10 @@ 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");
|
||||
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;
|
||||
@ -198,16 +198,16 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
// natoms
|
||||
writer.emit("natoms", natoms);
|
||||
|
||||
auto ifix = lmp->modify->get_fix_by_id("test");
|
||||
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 {
|
||||
// run_stress, if enabled
|
||||
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]);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
|
||||
// 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]);
|
||||
@ -238,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]);
|
||||
@ -289,7 +289,7 @@ 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);
|
||||
|
||||
auto ifix = lmp->modify->get_fix_by_id("test");
|
||||
auto *ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
@ -317,8 +317,8 @@ TEST(FixTimestep, plain)
|
||||
|
||||
// check t_target for thermostats
|
||||
|
||||
int dim = -1;
|
||||
double *ptr = (double *)ifix->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) {
|
||||
@ -583,7 +583,7 @@ 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);
|
||||
|
||||
auto ifix = lmp->modify->get_fix_by_id("test");
|
||||
auto *ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
@ -611,8 +611,8 @@ TEST(FixTimestep, omp)
|
||||
|
||||
// check t_target for thermostats
|
||||
|
||||
int dim = -1;
|
||||
double *ptr = (double *)ifix->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) {
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user