Merge branch 'develop' into general-triclinic
# Conflicts: # src/atom.cpp
This commit is contained in:
@ -27,6 +27,7 @@
|
||||
#include "atom.h"
|
||||
#include "compute.h"
|
||||
#include "exceptions.h"
|
||||
#include "fix.h"
|
||||
#include "fmt/format.h"
|
||||
#include "force.h"
|
||||
#include "info.h"
|
||||
@ -528,6 +529,59 @@ TEST(AngleStyle, omp)
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
};
|
||||
|
||||
TEST(AngleStyle, numdiff)
|
||||
{
|
||||
if (!LAMMPS::is_installed_pkg("EXTRA-FIX")) GTEST_SKIP();
|
||||
if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP();
|
||||
|
||||
LAMMPS::argv args = {"AngleStyle", "-log", "none", "-echo", "screen", "-nocite"};
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
LAMMPS *lmp = init_lammps(args, test_config, true);
|
||||
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << output;
|
||||
|
||||
if (!lmp) {
|
||||
std::cerr << "One or more prerequisite styles are not available "
|
||||
"in this LAMMPS configuration:\n";
|
||||
for (auto &prerequisite : test_config.prerequisites) {
|
||||
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
||||
}
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
EXPECT_THAT(output, HasSubstr("Loop time"));
|
||||
|
||||
// abort if running in parallel and not all atoms are local
|
||||
const int nlocal = lmp->atom->nlocal;
|
||||
ASSERT_EQ(lmp->atom->natoms, nlocal);
|
||||
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
lmp->input->one("fix diff all numdiff 2 6.05504e-6");
|
||||
lmp->input->one("run 2 post no");
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
Fix *ifix = lmp->modify->get_fix_by_id("diff");
|
||||
if (ifix) {
|
||||
double epsilon = test_config.epsilon * 5.0e8;
|
||||
ErrorStats stats;
|
||||
double **f1 = lmp->atom->f;
|
||||
double **f2 = ifix->array_atom;
|
||||
SCOPED_TRACE("EXPECT FORCES: numdiff");
|
||||
for (int i = 0; i < nlocal; ++i) {
|
||||
EXPECT_FP_LE_WITH_EPS(f1[i][0], f2[i][0], epsilon);
|
||||
EXPECT_FP_LE_WITH_EPS(f1[i][1], f2[i][1], epsilon);
|
||||
EXPECT_FP_LE_WITH_EPS(f1[i][2], f2[i][2], epsilon);
|
||||
}
|
||||
if (print_stats)
|
||||
std::cerr << "numdiff stats: " << stats << " epsilon: " << epsilon << std::endl;
|
||||
}
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
cleanup_lammps(lmp, test_config);
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
}
|
||||
|
||||
TEST(AngleStyle, single)
|
||||
{
|
||||
if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP();
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include "bond.h"
|
||||
#include "compute.h"
|
||||
#include "exceptions.h"
|
||||
#include "fix.h"
|
||||
#include "fmt/format.h"
|
||||
#include "force.h"
|
||||
#include "info.h"
|
||||
@ -530,6 +531,60 @@ TEST(BondStyle, omp)
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
};
|
||||
|
||||
|
||||
TEST(BondStyle, numdiff)
|
||||
{
|
||||
if (!LAMMPS::is_installed_pkg("EXTRA-FIX")) GTEST_SKIP();
|
||||
if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP();
|
||||
|
||||
LAMMPS::argv args = {"BondStyle", "-log", "none", "-echo", "screen", "-nocite"};
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
LAMMPS *lmp = init_lammps(args, test_config, true);
|
||||
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << output;
|
||||
|
||||
if (!lmp) {
|
||||
std::cerr << "One or more prerequisite styles are not available "
|
||||
"in this LAMMPS configuration:\n";
|
||||
for (auto &prerequisite : test_config.prerequisites) {
|
||||
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
||||
}
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
EXPECT_THAT(output, HasSubstr("Loop time"));
|
||||
|
||||
// abort if running in parallel and not all atoms are local
|
||||
const int nlocal = lmp->atom->nlocal;
|
||||
ASSERT_EQ(lmp->atom->natoms, nlocal);
|
||||
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
lmp->input->one("fix diff all numdiff 2 6.05504e-6");
|
||||
lmp->input->one("run 2 post no");
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
Fix *ifix = lmp->modify->get_fix_by_id("diff");
|
||||
if (ifix) {
|
||||
double epsilon = test_config.epsilon * 5.0e8;
|
||||
ErrorStats stats;
|
||||
double **f1 = lmp->atom->f;
|
||||
double **f2 = ifix->array_atom;
|
||||
SCOPED_TRACE("EXPECT FORCES: numdiff");
|
||||
for (int i = 0; i < nlocal; ++i) {
|
||||
EXPECT_FP_LE_WITH_EPS(f1[i][0], f2[i][0], epsilon);
|
||||
EXPECT_FP_LE_WITH_EPS(f1[i][1], f2[i][1], epsilon);
|
||||
EXPECT_FP_LE_WITH_EPS(f1[i][2], f2[i][2], epsilon);
|
||||
}
|
||||
if (print_stats)
|
||||
std::cerr << "numdiff stats: " << stats << " epsilon: " << epsilon << std::endl;
|
||||
}
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
cleanup_lammps(lmp, test_config);
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
}
|
||||
|
||||
TEST(BondStyle, single)
|
||||
{
|
||||
if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP();
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include "compute.h"
|
||||
#include "dihedral.h"
|
||||
#include "exceptions.h"
|
||||
#include "fix.h"
|
||||
#include "fmt/format.h"
|
||||
#include "force.h"
|
||||
#include "info.h"
|
||||
@ -531,3 +532,57 @@ TEST(DihedralStyle, omp)
|
||||
cleanup_lammps(lmp, test_config);
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
};
|
||||
|
||||
|
||||
TEST(DihedralStyle, numdiff)
|
||||
{
|
||||
if (!LAMMPS::is_installed_pkg("EXTRA-FIX")) GTEST_SKIP();
|
||||
if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP();
|
||||
|
||||
LAMMPS::argv args = {"DihedralStyle", "-log", "none", "-echo", "screen", "-nocite"};
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
LAMMPS *lmp = init_lammps(args, test_config, true);
|
||||
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << output;
|
||||
|
||||
if (!lmp) {
|
||||
std::cerr << "One or more prerequisite styles are not available "
|
||||
"in this LAMMPS configuration:\n";
|
||||
for (auto &prerequisite : test_config.prerequisites) {
|
||||
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
||||
}
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
EXPECT_THAT(output, HasSubstr("Loop time"));
|
||||
|
||||
// abort if running in parallel and not all atoms are local
|
||||
const int nlocal = lmp->atom->nlocal;
|
||||
ASSERT_EQ(lmp->atom->natoms, nlocal);
|
||||
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
lmp->input->one("fix diff all numdiff 2 6.05504e-6");
|
||||
lmp->input->one("run 2 post no");
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
Fix *ifix = lmp->modify->get_fix_by_id("diff");
|
||||
if (ifix) {
|
||||
double epsilon = test_config.epsilon * 5.0e8;
|
||||
ErrorStats stats;
|
||||
double **f1 = lmp->atom->f;
|
||||
double **f2 = ifix->array_atom;
|
||||
SCOPED_TRACE("EXPECT FORCES: numdiff");
|
||||
for (int i = 0; i < nlocal; ++i) {
|
||||
EXPECT_FP_LE_WITH_EPS(f1[i][0], f2[i][0], epsilon);
|
||||
EXPECT_FP_LE_WITH_EPS(f1[i][1], f2[i][1], epsilon);
|
||||
EXPECT_FP_LE_WITH_EPS(f1[i][2], f2[i][2], epsilon);
|
||||
}
|
||||
if (print_stats)
|
||||
std::cerr << "numdiff stats: " << stats << " epsilon: " << epsilon << std::endl;
|
||||
}
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
cleanup_lammps(lmp, test_config);
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#include "atom.h"
|
||||
#include "compute.h"
|
||||
#include "exceptions.h"
|
||||
#include "fix.h"
|
||||
#include "fmt/format.h"
|
||||
#include "force.h"
|
||||
#include "improper.h"
|
||||
@ -524,3 +525,56 @@ TEST(ImproperStyle, omp)
|
||||
cleanup_lammps(lmp, test_config);
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
};
|
||||
|
||||
TEST(ImproperStyle, numdiff)
|
||||
{
|
||||
if (!LAMMPS::is_installed_pkg("EXTRA-FIX")) GTEST_SKIP();
|
||||
if (test_config.skip_tests.count(test_info_->name())) GTEST_SKIP();
|
||||
|
||||
LAMMPS::argv args = {"ImproperStyle", "-log", "none", "-echo", "screen", "-nocite"};
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
LAMMPS *lmp = init_lammps(args, test_config, true);
|
||||
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << output;
|
||||
|
||||
if (!lmp) {
|
||||
std::cerr << "One or more prerequisite styles are not available "
|
||||
"in this LAMMPS configuration:\n";
|
||||
for (auto &prerequisite : test_config.prerequisites) {
|
||||
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
||||
}
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
EXPECT_THAT(output, HasSubstr("Loop time"));
|
||||
|
||||
// abort if running in parallel and not all atoms are local
|
||||
const int nlocal = lmp->atom->nlocal;
|
||||
ASSERT_EQ(lmp->atom->natoms, nlocal);
|
||||
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
lmp->input->one("fix diff all numdiff 2 6.05504e-6");
|
||||
lmp->input->one("run 2 post no");
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
Fix *ifix = lmp->modify->get_fix_by_id("diff");
|
||||
if (ifix) {
|
||||
double epsilon = test_config.epsilon * 5.0e8;
|
||||
ErrorStats stats;
|
||||
double **f1 = lmp->atom->f;
|
||||
double **f2 = ifix->array_atom;
|
||||
SCOPED_TRACE("EXPECT FORCES: numdiff");
|
||||
for (int i = 0; i < nlocal; ++i) {
|
||||
EXPECT_FP_LE_WITH_EPS(f1[i][0], f2[i][0], epsilon);
|
||||
EXPECT_FP_LE_WITH_EPS(f1[i][1], f2[i][1], epsilon);
|
||||
EXPECT_FP_LE_WITH_EPS(f1[i][2], f2[i][2], epsilon);
|
||||
}
|
||||
if (print_stats)
|
||||
std::cerr << "numdiff stats: " << stats << " epsilon: " << epsilon << std::endl;
|
||||
}
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
cleanup_lammps(lmp, test_config);
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ void EXPECT_STRESS(const std::string &name, double *stress, const stress_t &expe
|
||||
EXPECT_FP_LE_WITH_EPS(stress[3], expected_stress.xy, epsilon);
|
||||
EXPECT_FP_LE_WITH_EPS(stress[4], expected_stress.xz, epsilon);
|
||||
EXPECT_FP_LE_WITH_EPS(stress[5], expected_stress.yz, epsilon);
|
||||
if (print_stats) std::cerr << name << " stats" << stats << std::endl;
|
||||
if (print_stats) std::cerr << name << " stats: " << stats << std::endl;
|
||||
}
|
||||
|
||||
void EXPECT_FORCES(const std::string &name, Atom *atom, const std::vector<coord_t> &f_ref,
|
||||
@ -64,7 +64,7 @@ void EXPECT_FORCES(const std::string &name, Atom *atom, const std::vector<coord_
|
||||
EXPECT_FP_LE_WITH_EPS(f[i][1], f_ref[tag[i]].y, epsilon);
|
||||
EXPECT_FP_LE_WITH_EPS(f[i][2], f_ref[tag[i]].z, epsilon);
|
||||
}
|
||||
if (print_stats) std::cerr << name << " stats" << stats << std::endl;
|
||||
if (print_stats) std::cerr << name << " stats: " << stats << std::endl;
|
||||
}
|
||||
|
||||
void EXPECT_POSITIONS(const std::string &name, Atom *atom, const std::vector<coord_t> &x_ref,
|
||||
@ -81,7 +81,7 @@ void EXPECT_POSITIONS(const std::string &name, Atom *atom, const std::vector<coo
|
||||
EXPECT_FP_LE_WITH_EPS(x[i][1], x_ref[tag[i]].y, epsilon);
|
||||
EXPECT_FP_LE_WITH_EPS(x[i][2], x_ref[tag[i]].z, epsilon);
|
||||
}
|
||||
if (print_stats) std::cerr << name << " stats" << stats << std::endl;
|
||||
if (print_stats) std::cerr << name << " stats: " << stats << std::endl;
|
||||
}
|
||||
|
||||
void EXPECT_VELOCITIES(const std::string &name, Atom *atom, const std::vector<coord_t> &v_ref,
|
||||
@ -98,7 +98,7 @@ void EXPECT_VELOCITIES(const std::string &name, Atom *atom, const std::vector<co
|
||||
EXPECT_FP_LE_WITH_EPS(v[i][1], v_ref[tag[i]].y, epsilon);
|
||||
EXPECT_FP_LE_WITH_EPS(v[i][2], v_ref[tag[i]].z, epsilon);
|
||||
}
|
||||
if (print_stats) std::cerr << name << " stats" << stats << std::endl;
|
||||
if (print_stats) std::cerr << name << " stats: " << stats << std::endl;
|
||||
}
|
||||
|
||||
// common read_yaml_file function
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
lammps_version: 17 Feb 2022
|
||||
date_generated: Fri Mar 18 22:17:51 2022
|
||||
epsilon: 5e-13
|
||||
skip_tests:
|
||||
skip_tests: numdiff
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
angle cosine/delta
|
||||
|
||||
@ -5,6 +5,7 @@ epsilon: 2.5e-13
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
angle fourier/simple
|
||||
skip_tests: numdiff
|
||||
pre_commands: ! ""
|
||||
post_commands: ! ""
|
||||
input_file: in.fourmol
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
---
|
||||
lammps_version: 17 Feb 2022
|
||||
date_generated: Fri Mar 18 22:17:52 2022
|
||||
epsilon: 2.5e-13
|
||||
epsilon: 2.5e-12
|
||||
skip_tests:
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
lammps_version: 17 Feb 2022
|
||||
date_generated: Fri Mar 18 22:17:52 2022
|
||||
epsilon: 5e-13
|
||||
skip_tests:
|
||||
skip_tests: numdiff
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
angle table
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
lammps_version: 17 Feb 2022
|
||||
date_generated: Fri Mar 18 22:17:51 2022
|
||||
epsilon: 2.5e-13
|
||||
skip_tests:
|
||||
skip_tests: numdiff
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
bond table
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
lammps_version: 17 Feb 2022
|
||||
date_generated: Fri Mar 18 22:18:01 2022
|
||||
epsilon: 2.5e-13
|
||||
skip_tests:
|
||||
skip_tests: numdiff
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
dihedral charmm
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
---
|
||||
lammps_version: 17 Feb 2022
|
||||
date_generated: Fri Mar 18 22:18:02 2022
|
||||
epsilon: 2.5e-13
|
||||
epsilon: 5.0e-12
|
||||
skip_tests:
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
|
||||
@ -3,7 +3,7 @@ lammps_version: 17 Feb 2022
|
||||
tags: unstable
|
||||
date_generated: Fri Mar 18 22:18:02 2022
|
||||
epsilon: 1e-13
|
||||
skip_tests:
|
||||
skip_tests: numdiff
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
dihedral table/cut
|
||||
|
||||
@ -3,7 +3,7 @@ lammps_version: 22 Dec 2022
|
||||
tags: unstable
|
||||
date_generated: Mon Dec 26 16:49:31 2022
|
||||
epsilon: 7.5e-14
|
||||
skip_tests:
|
||||
skip_tests: numdiff
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
dihedral table
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
---
|
||||
lammps_version: 22 Dec 2022
|
||||
date_generated: Mon Dec 26 16:49:37 2022
|
||||
epsilon: 1e-13
|
||||
epsilon: 1.0e-13
|
||||
skip_tests:
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
lammps_version: 17 Feb 2022
|
||||
date_generated: Fri Mar 18 22:18:02 2022
|
||||
epsilon: 2.5e-13
|
||||
skip_tests:
|
||||
skip_tests: numdiff
|
||||
prerequisites: ! |
|
||||
atom full
|
||||
improper cossq
|
||||
|
||||
@ -632,7 +632,7 @@ TEST_F(AtomStyleTest, atomic)
|
||||
ASSERT_EQ(lmp->atom->map_user, Atom::MAP_HASH);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 3);
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("reset_atom_ids");
|
||||
command("reset_atoms id");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 2);
|
||||
ASSERT_EQ(lmp->atom->tag_consecutive(), 1);
|
||||
@ -693,6 +693,112 @@ TEST_F(AtomStyleTest, atomic)
|
||||
EXPECT_NEAR(x[GETIDX(16)][2], 7.9, EPSILON);
|
||||
}
|
||||
|
||||
TEST_F(AtomStyleTest, no_tags)
|
||||
{
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("atom_modify id no");
|
||||
command("create_box 2 box");
|
||||
command("create_atoms 1 single -2.0 2.0 0.1");
|
||||
command("create_atoms 1 single -2.0 -2.0 -0.1");
|
||||
command("create_atoms 2 single 2.0 2.0 -0.1");
|
||||
command("create_atoms 2 single 2.0 -2.0 0.1");
|
||||
command("mass 1 4.0");
|
||||
command("mass 2 2.4");
|
||||
command("pair_coeff * *");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic"));
|
||||
ASSERT_NE(lmp->atom->avec, nullptr);
|
||||
ASSERT_EQ(lmp->atom->natoms, 4);
|
||||
ASSERT_EQ(lmp->atom->nlocal, 4);
|
||||
ASSERT_EQ(lmp->atom->nghost, 0);
|
||||
ASSERT_NE(lmp->atom->nmax, -1);
|
||||
ASSERT_EQ(lmp->atom->tag_enable, 0);
|
||||
ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC);
|
||||
ASSERT_EQ(lmp->atom->ntypes, 2);
|
||||
|
||||
ASSERT_NE(lmp->atom->mass, nullptr);
|
||||
ASSERT_NE(lmp->atom->mass_setflag, nullptr);
|
||||
ASSERT_EQ(lmp->atom->sametag, nullptr);
|
||||
ASSERT_EQ(lmp->atom->map_style, Atom::MAP_NONE);
|
||||
ASSERT_EQ(lmp->atom->map_user, Atom::MAP_NONE);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, -1);
|
||||
ASSERT_EQ(lmp->atom->tag_consecutive(), 0);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("pair_coeff * *");
|
||||
command("write_data test_atom_styles.data nocoeff");
|
||||
command("clear");
|
||||
command("atom_style atomic");
|
||||
command("pair_style zero 4.0");
|
||||
command("atom_modify id no");
|
||||
command("units real");
|
||||
command("read_data test_atom_styles.data");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic"));
|
||||
ASSERT_NE(lmp->atom->avec, nullptr);
|
||||
ASSERT_EQ(lmp->atom->natoms, 4);
|
||||
ASSERT_EQ(lmp->atom->nlocal, 4);
|
||||
ASSERT_EQ(lmp->atom->nghost, 0);
|
||||
ASSERT_NE(lmp->atom->nmax, -1);
|
||||
ASSERT_EQ(lmp->atom->tag_enable, 0);
|
||||
ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC);
|
||||
ASSERT_EQ(lmp->atom->ntypes, 2);
|
||||
|
||||
ASSERT_NEAR(lmp->atom->mass[1], 4.0, EPSILON);
|
||||
ASSERT_NEAR(lmp->atom->mass[2], 2.4, EPSILON);
|
||||
ASSERT_EQ(lmp->atom->mass_setflag[1], 1);
|
||||
ASSERT_EQ(lmp->atom->mass_setflag[2], 1);
|
||||
ASSERT_EQ(lmp->atom->map_style, Atom::MAP_NONE);
|
||||
ASSERT_EQ(lmp->atom->map_user, Atom::MAP_NONE);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, -1);
|
||||
ASSERT_EQ(lmp->atom->tag_consecutive(), 0);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("pair_coeff * *");
|
||||
command("write_restart test_atom_styles.restart");
|
||||
command("clear");
|
||||
command("read_restart test_atom_styles.restart");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic"));
|
||||
ASSERT_NE(lmp->atom->avec, nullptr);
|
||||
ASSERT_EQ(lmp->atom->natoms, 4);
|
||||
ASSERT_EQ(lmp->atom->nlocal, 4);
|
||||
ASSERT_EQ(lmp->atom->nghost, 0);
|
||||
ASSERT_NE(lmp->atom->nmax, -1);
|
||||
ASSERT_EQ(lmp->atom->tag_enable, 0);
|
||||
ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC);
|
||||
ASSERT_EQ(lmp->atom->ntypes, 2);
|
||||
ASSERT_EQ(lmp->atom->tag_consecutive(), 0);
|
||||
|
||||
ASSERT_NEAR(lmp->atom->mass[1], 4.0, EPSILON);
|
||||
ASSERT_NEAR(lmp->atom->mass[2], 2.4, EPSILON);
|
||||
ASSERT_EQ(lmp->atom->mass_setflag[1], 1);
|
||||
ASSERT_EQ(lmp->atom->mass_setflag[2], 1);
|
||||
ASSERT_EQ(lmp->atom->map_style, Atom::MAP_NONE);
|
||||
ASSERT_EQ(lmp->atom->map_user, Atom::MAP_NONE);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, -1);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("comm_style tiled");
|
||||
command("change_box all triclinic");
|
||||
command("replicate 2 2 2");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
ASSERT_EQ(lmp->atom->natoms, 32);
|
||||
ASSERT_EQ(lmp->atom->nlocal, 32);
|
||||
ASSERT_EQ(lmp->atom->nghost, 0);
|
||||
ASSERT_NE(lmp->atom->nmax, -1);
|
||||
ASSERT_EQ(lmp->atom->tag_enable, 0);
|
||||
ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC);
|
||||
ASSERT_EQ(lmp->atom->ntypes, 2);
|
||||
ASSERT_EQ(lmp->atom->tag_consecutive(), 0);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, -1);
|
||||
|
||||
TEST_FAILURE(".*ERROR: Cannot use reset_atoms id unless atoms have IDs.*",
|
||||
command("reset_atoms id"););
|
||||
}
|
||||
|
||||
TEST_F(AtomStyleTest, charge)
|
||||
{
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
@ -846,7 +952,7 @@ TEST_F(AtomStyleTest, charge)
|
||||
ASSERT_EQ(lmp->atom->mass_setflag[2], 1);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("reset_atom_ids");
|
||||
command("reset_atoms id");
|
||||
command("change_box all triclinic");
|
||||
command("replicate 2 2 2 bbox");
|
||||
END_HIDE_OUTPUT();
|
||||
@ -1004,7 +1110,7 @@ TEST_F(AtomStyleTest, sphere)
|
||||
ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic"));
|
||||
command("read_restart test_atom_styles.restart");
|
||||
command("replicate 1 1 2");
|
||||
command("reset_atom_ids");
|
||||
command("reset_atoms id");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("sphere"));
|
||||
ASSERT_NE(lmp->atom->avec, nullptr);
|
||||
@ -1310,7 +1416,7 @@ TEST_F(AtomStyleTest, ellipsoid)
|
||||
EXPECT_NEAR(bonus[3].quat[3], 0.25056280708573159, EPSILON);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("reset_atom_ids");
|
||||
command("reset_atoms id");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->atom->nellipsoids, 4);
|
||||
ASSERT_EQ(lmp->atom->tag_consecutive(), 1);
|
||||
@ -1600,7 +1706,7 @@ TEST_F(AtomStyleTest, line)
|
||||
EXPECT_NEAR(bonus[3].theta, MathConst::MY_PI / 6.0, EPSILON);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("reset_atom_ids");
|
||||
command("reset_atoms id");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->atom->nlines, 4);
|
||||
ASSERT_EQ(lmp->atom->tag_consecutive(), 1);
|
||||
@ -2008,7 +2114,7 @@ TEST_F(AtomStyleTest, tri)
|
||||
EXPECT_NEAR(bonus[3].c3[2], -0.15731490073748589, EPSILON);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("reset_atom_ids");
|
||||
command("reset_atoms id");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->atom->ntris, 4);
|
||||
ASSERT_EQ(lmp->atom->tag_consecutive(), 1);
|
||||
@ -2583,7 +2689,7 @@ TEST_F(AtomStyleTest, body_nparticle)
|
||||
ASSERT_NE(bonus[3].dvalue, nullptr);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("reset_atom_ids");
|
||||
command("reset_atoms id");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->atom->nbodies, 4);
|
||||
ASSERT_EQ(lmp->atom->tag_consecutive(), 1);
|
||||
@ -2968,7 +3074,7 @@ TEST_F(AtomStyleTest, template)
|
||||
ASSERT_EQ(molatom[GETIDX(24)], -1);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("reset_atom_ids");
|
||||
command("reset_atoms id");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->atom->tag_consecutive(), 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 16);
|
||||
@ -3396,7 +3502,7 @@ TEST_F(AtomStyleTest, template_charge)
|
||||
ASSERT_EQ(molatom[GETIDX(24)], -1);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("reset_atom_ids");
|
||||
command("reset_atoms id");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->atom->tag_consecutive(), 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 16);
|
||||
@ -3742,7 +3848,7 @@ TEST_F(AtomStyleTest, bond)
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("delete_bonds all bond 2");
|
||||
command("reset_atom_ids");
|
||||
command("reset_atoms id");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->atom->tag_consecutive(), 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 8);
|
||||
@ -4119,7 +4225,7 @@ TEST_F(AtomStyleTest, angle)
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("delete_bonds all angle 2");
|
||||
command("reset_atom_ids");
|
||||
command("reset_atoms id");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->atom->tag_consecutive(), 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 8);
|
||||
@ -4479,7 +4585,7 @@ TEST_F(AtomStyleTest, full_ellipsoid)
|
||||
EXPECT_NEAR(bonus[3].quat[3], 0.25056280708573159, EPSILON);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("reset_atom_ids");
|
||||
command("reset_atoms id");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->atom->nellipsoids, 4);
|
||||
ASSERT_EQ(lmp->atom->tag_consecutive(), 1);
|
||||
@ -4775,7 +4881,7 @@ TEST_F(AtomStyleTest, property_atom)
|
||||
EXPECT_NEAR(three[GETIDX(3)], 0.5, EPSILON);
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("reset_atom_ids");
|
||||
command("reset_atoms id");
|
||||
command("change_box all triclinic");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 2);
|
||||
|
||||
Reference in New Issue
Block a user