Merge branch 'master' into mpi_tests

This commit is contained in:
Axel Kohlmeyer
2020-11-19 11:22:58 -05:00
1976 changed files with 79839 additions and 68750 deletions

View File

@ -105,7 +105,7 @@ TEST_F(LibraryConfig, style_count)
EXPECT_GT(lammps_style_count(lmp, "dihedral"), 1);
EXPECT_GT(lammps_style_count(lmp, "improper"), 1);
EXPECT_GT(lammps_style_count(lmp, "pair"), 1);
EXPECT_GT(lammps_style_count(lmp, "kspace"), 1);
EXPECT_GE(lammps_style_count(lmp, "kspace"), 0);
EXPECT_GT(lammps_style_count(lmp, "compute"), 1);
EXPECT_GT(lammps_style_count(lmp, "fix"), 1);
EXPECT_GT(lammps_style_count(lmp, "region"), 1);

View File

@ -1,6 +1,7 @@
// unit tests creating LAMMPS instances via the library interface
#include "lammps.h"
#define LAMMPS_LIB_MPI 1
#include "library.h"
#include <cstdio> // for stdin, stdout
#include <mpi.h>

View File

@ -13,10 +13,10 @@
#define STRINGIFY(val) XSTR(val)
#define XSTR(val) #val
using ::LAMMPS_NS::tagint;
using ::testing::HasSubstr;
using ::testing::StartsWith;
using ::testing::StrEq;
using ::LAMMPS_NS::tagint;
class LibraryProperties : public ::testing::Test {
protected:
@ -198,6 +198,13 @@ TEST_F(LibraryProperties, setting)
if (!verbose) ::testing::internal::CaptureStdout();
lammps_command(lmp, "dimension 3");
if (!verbose) ::testing::internal::GetCapturedStdout();
EXPECT_EQ(lammps_extract_setting(lmp, "ntypes"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "nbondtypes"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "nangletypes"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "ndihedraltypes"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "nimpropertypes"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "molecule_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "q_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "mu_flag"), 0);
@ -217,10 +224,22 @@ TEST_F(LibraryProperties, setting)
EXPECT_EQ(lammps_extract_setting(lmp, "nghost"), 518);
EXPECT_EQ(lammps_extract_setting(lmp, "nall"), 547);
EXPECT_EQ(lammps_extract_setting(lmp, "nmax"), 16384);
EXPECT_EQ(lammps_extract_setting(lmp, "ntypes"), 5);
EXPECT_EQ(lammps_extract_setting(lmp, "nbondtypes"), 5);
EXPECT_EQ(lammps_extract_setting(lmp, "nangletypes"), 4);
EXPECT_EQ(lammps_extract_setting(lmp, "ndihedraltypes"), 5);
EXPECT_EQ(lammps_extract_setting(lmp, "nimpropertypes"), 2);
EXPECT_EQ(lammps_extract_setting(lmp, "molecule_flag"), 1);
EXPECT_EQ(lammps_extract_setting(lmp, "q_flag"), 1);
EXPECT_EQ(lammps_extract_setting(lmp, "mu_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "rmass_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "radius_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "sphere_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "ellipsoid_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "omega_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "torque_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "angmom_flag"), 0);
if (!verbose) ::testing::internal::CaptureStdout();
lammps_command(lmp, "change_box all triclinic");
lammps_command(lmp, "fix rmass all property/atom rmass ghost yes");
@ -240,20 +259,31 @@ TEST_F(LibraryProperties, global)
lammps_command(lmp, "run 2 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
LAMMPS_NS::bigint *b_ptr;
int64_t *b_ptr;
char *c_ptr;
double *d_ptr;
int *i_ptr;
EXPECT_EQ(lammps_extract_global_datatype(lmp, "UNKNOWN"), -1);
EXPECT_EQ(lammps_extract_global(lmp, "UNKNOWN"), nullptr);
EXPECT_EQ(lammps_extract_global_datatype(lmp, "units"), LAMMPS_STRING);
c_ptr = (char *)lammps_extract_global(lmp, "units");
EXPECT_THAT(c_ptr, StrEq("real"));
b_ptr = (LAMMPS_NS::bigint *)lammps_extract_global(lmp, "ntimestep");
#if defined(LAMMPS_SMALLSMALL)
EXPECT_EQ(lammps_extract_global_datatype(lmp, "ntimestep"), LAMMPS_INT);
i_ptr = (int *)lammps_extract_global(lmp, "ntimestep");
EXPECT_EQ((*i_ptr), 2);
#else
EXPECT_EQ(lammps_extract_global_datatype(lmp, "ntimestep"), LAMMPS_INT64);
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);
d_ptr = (double *)lammps_extract_global(lmp, "dt");
EXPECT_DOUBLE_EQ((*d_ptr), 0.1);
int dtype = lammps_extract_global_datatype(lmp, "dt");
EXPECT_EQ(dtype, LAMMPS_DOUBLE);
};
class AtomProperties : public ::testing::Test {

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
@ -12,6 +12,7 @@
------------------------------------------------------------------------- */
#include "test_main.h"
#include "pointers.h"
#include "utils.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"