add option to extract newton_bond/newton_pair settings
This commit is contained in:
committed by
Richard Berger
parent
7cb644b425
commit
849e5ffee2
@ -841,6 +841,10 @@ not recognized, the function returns -1.
|
|||||||
See :doc:`create_box`.
|
See :doc:`create_box`.
|
||||||
* - nthreads
|
* - nthreads
|
||||||
- Number of requested OpenMP threads for LAMMPS' execution
|
- Number of requested OpenMP threads for LAMMPS' execution
|
||||||
|
* - newton_bond
|
||||||
|
- 1 if Newton's 3rd law is applied to bonded interactions, 0 if not.
|
||||||
|
* - newton_pair
|
||||||
|
- 1 if Newton's 3rd law is applied to non-bonded interactions, 0 if not.
|
||||||
* - triclinic
|
* - triclinic
|
||||||
- 1 if the the simulation box is triclinic, 0 if orthogonal.
|
- 1 if the the simulation box is triclinic, 0 if orthogonal.
|
||||||
See :doc:`change_box`.
|
See :doc:`change_box`.
|
||||||
@ -933,6 +937,8 @@ int lammps_extract_setting(void *handle, const char *keyword)
|
|||||||
|
|
||||||
if (strcmp(keyword,"dimension") == 0) return lmp->domain->dimension;
|
if (strcmp(keyword,"dimension") == 0) return lmp->domain->dimension;
|
||||||
if (strcmp(keyword,"box_exist") == 0) return lmp->domain->box_exist;
|
if (strcmp(keyword,"box_exist") == 0) return lmp->domain->box_exist;
|
||||||
|
if (strcmp(keyword,"newton_bond") == 0) return lmp->force->newton_bond;
|
||||||
|
if (strcmp(keyword,"newton_pair") == 0) return lmp->force->newton_pair;
|
||||||
if (strcmp(keyword,"triclinic") == 0) return lmp->domain->triclinic;
|
if (strcmp(keyword,"triclinic") == 0) return lmp->domain->triclinic;
|
||||||
|
|
||||||
if (strcmp(keyword,"universe_rank") == 0) return lmp->universe->me;
|
if (strcmp(keyword,"universe_rank") == 0) return lmp->universe->me;
|
||||||
|
|||||||
@ -91,10 +91,11 @@ TEST_F(LibraryProperties, thermo)
|
|||||||
{
|
{
|
||||||
if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP();
|
if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP();
|
||||||
std::string input = INPUT_DIR + PATH_SEP + "in.fourmol";
|
std::string input = INPUT_DIR + PATH_SEP + "in.fourmol";
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
::testing::internal::CaptureStdout();
|
||||||
lammps_file(lmp, input.c_str());
|
lammps_file(lmp, input.c_str());
|
||||||
lammps_command(lmp, "run 2 post no");
|
lammps_command(lmp, "run 2 post no");
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
std::string output = ::testing::internal::GetCapturedStdout();
|
||||||
|
if (verbose) std::cout << output;
|
||||||
EXPECT_EQ(lammps_get_thermo(lmp, "step"), 2);
|
EXPECT_EQ(lammps_get_thermo(lmp, "step"), 2);
|
||||||
EXPECT_EQ(lammps_get_thermo(lmp, "atoms"), 29);
|
EXPECT_EQ(lammps_get_thermo(lmp, "atoms"), 29);
|
||||||
EXPECT_DOUBLE_EQ(lammps_get_thermo(lmp, "vol"), 3375.0);
|
EXPECT_DOUBLE_EQ(lammps_get_thermo(lmp, "vol"), 3375.0);
|
||||||
@ -106,10 +107,11 @@ TEST_F(LibraryProperties, box)
|
|||||||
{
|
{
|
||||||
if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP();
|
if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP();
|
||||||
std::string input = INPUT_DIR + PATH_SEP + "in.fourmol";
|
std::string input = INPUT_DIR + PATH_SEP + "in.fourmol";
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
::testing::internal::CaptureStdout();
|
||||||
lammps_file(lmp, input.c_str());
|
lammps_file(lmp, input.c_str());
|
||||||
lammps_command(lmp, "run 2 post no");
|
lammps_command(lmp, "run 2 post no");
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
std::string output = ::testing::internal::GetCapturedStdout();
|
||||||
|
if (verbose) std::cout << output;
|
||||||
double boxlo[3], boxhi[3], xy, yz, xz;
|
double boxlo[3], boxhi[3], xy, yz, xz;
|
||||||
int pflags[3], boxflag;
|
int pflags[3], boxflag;
|
||||||
lammps_extract_box(lmp, boxlo, boxhi, &xy, &yz, &xz, pflags, &boxflag);
|
lammps_extract_box(lmp, boxlo, boxhi, &xy, &yz, &xz, pflags, &boxflag);
|
||||||
@ -204,6 +206,28 @@ TEST_F(LibraryProperties, setting)
|
|||||||
EXPECT_EQ(lammps_extract_setting(lmp, "universe_size"), 1);
|
EXPECT_EQ(lammps_extract_setting(lmp, "universe_size"), 1);
|
||||||
EXPECT_EQ(lammps_extract_setting(lmp, "universe_rank"), 0);
|
EXPECT_EQ(lammps_extract_setting(lmp, "universe_rank"), 0);
|
||||||
EXPECT_GT(lammps_extract_setting(lmp, "nthreads"), 0);
|
EXPECT_GT(lammps_extract_setting(lmp, "nthreads"), 0);
|
||||||
|
EXPECT_EQ(lammps_extract_setting(lmp, "newton_pair"), 1);
|
||||||
|
EXPECT_EQ(lammps_extract_setting(lmp, "newton_bond"), 1);
|
||||||
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
|
lammps_command(lmp, "newton off");
|
||||||
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
EXPECT_EQ(lammps_extract_setting(lmp, "newton_pair"), 0);
|
||||||
|
EXPECT_EQ(lammps_extract_setting(lmp, "newton_bond"), 0);
|
||||||
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
|
lammps_command(lmp, "newton on off");
|
||||||
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
EXPECT_EQ(lammps_extract_setting(lmp, "newton_pair"), 1);
|
||||||
|
EXPECT_EQ(lammps_extract_setting(lmp, "newton_bond"), 0);
|
||||||
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
|
lammps_command(lmp, "newton off on");
|
||||||
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
EXPECT_EQ(lammps_extract_setting(lmp, "newton_pair"), 0);
|
||||||
|
EXPECT_EQ(lammps_extract_setting(lmp, "newton_bond"), 1);
|
||||||
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
|
lammps_command(lmp, "newton on");
|
||||||
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
|
EXPECT_EQ(lammps_extract_setting(lmp, "newton_pair"), 1);
|
||||||
|
EXPECT_EQ(lammps_extract_setting(lmp, "newton_bond"), 1);
|
||||||
|
|
||||||
EXPECT_EQ(lammps_extract_setting(lmp, "ntypes"), 0);
|
EXPECT_EQ(lammps_extract_setting(lmp, "ntypes"), 0);
|
||||||
EXPECT_EQ(lammps_extract_setting(lmp, "nbondtypes"), 0);
|
EXPECT_EQ(lammps_extract_setting(lmp, "nbondtypes"), 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user