From ab899861d5eb673af71f6995b3bb43ea8c94f8d6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 10 Sep 2022 03:21:28 -0400 Subject: [PATCH] apply clang-format --- .../c-library/test_library_properties.cpp | 2 +- .../c-library/test_library_scatter_gather.cpp | 2 +- unittest/commands/test_regions.cpp | 46 ++++++----- unittest/commands/test_set_property.cpp | 74 ++++++++--------- unittest/commands/test_simple_commands.cpp | 3 +- unittest/force-styles/test_angle_style.cpp | 2 +- unittest/force-styles/test_bond_style.cpp | 2 +- unittest/force-styles/test_dihedral_style.cpp | 2 +- unittest/force-styles/test_improper_style.cpp | 2 +- unittest/force-styles/test_main.cpp | 37 +++++---- unittest/force-styles/test_pair_style.cpp | 2 +- unittest/formats/test_atom_styles.cpp | 80 +++++++++++++------ unittest/formats/test_dump_cfg.cpp | 2 +- unittest/formats/test_dump_custom.cpp | 2 +- unittest/formats/test_dump_local.cpp | 2 +- unittest/formats/test_dump_netcdf.cpp | 2 +- .../formats/test_potential_file_reader.cpp | 6 +- unittest/utils/test_platform.cpp | 4 +- unittest/utils/test_utils.cpp | 2 +- 19 files changed, 158 insertions(+), 116 deletions(-) diff --git a/unittest/c-library/test_library_properties.cpp b/unittest/c-library/test_library_properties.cpp index 9bfea75d40..56c89a6c13 100644 --- a/unittest/c-library/test_library_properties.cpp +++ b/unittest/c-library/test_library_properties.cpp @@ -14,8 +14,8 @@ #define STRINGIFY(val) XSTR(val) #define XSTR(val) #val -using ::LAMMPS_NS::platform::path_join; using ::LAMMPS_NS::tagint; +using ::LAMMPS_NS::platform::path_join; using ::testing::HasSubstr; using ::testing::StartsWith; using ::testing::StrEq; diff --git a/unittest/c-library/test_library_scatter_gather.cpp b/unittest/c-library/test_library_scatter_gather.cpp index 25e3dde787..c2b1604091 100644 --- a/unittest/c-library/test_library_scatter_gather.cpp +++ b/unittest/c-library/test_library_scatter_gather.cpp @@ -14,9 +14,9 @@ #define STRINGIFY(val) XSTR(val) #define XSTR(val) #val -using ::LAMMPS_NS::platform::path_join; using ::LAMMPS_NS::bigint; using ::LAMMPS_NS::tagint; +using ::LAMMPS_NS::platform::path_join; using ::testing::HasSubstr; using ::testing::StartsWith; diff --git a/unittest/commands/test_regions.cpp b/unittest/commands/test_regions.cpp index 2ced0c45f5..a39212efa8 100644 --- a/unittest/commands/test_regions.cpp +++ b/unittest/commands/test_regions.cpp @@ -192,17 +192,25 @@ TEST_F(RegionTest, DeathTests) auto list = domain->get_region_list(); ASSERT_EQ(list.size(), 1); - TEST_FAILURE(".*ERROR: Illegal region block xlo: 1 >= xhi: 0.*", command("region reg1 block 1 0 0 1 0 1");); - TEST_FAILURE(".*ERROR: Illegal region cone open face: 4.*", command("region reg2 cone x 0 0 2 1 0 1 open 4");); - TEST_FAILURE(".*ERROR: Illegal region plane normal vector: 0 0 0.*", command("region reg3 plane 0 0 0 0 0 0 side out");); - TEST_FAILURE(".*ERROR: Illegal region prism non-zero xy tilt with infinite x size.*", command("region reg4 prism INF INF 0 1 0 1 0.1 0.2 0.3");); - TEST_FAILURE(".*ERROR: Illegal region sphere radius: -1.*", command("region reg5 sphere 0 0 0 -1");); - TEST_FAILURE(".*ERROR: Illegal region ellipsoid c: -2.*", command("region reg8 ellipsoid 0 0 0 2 1 -2");); - TEST_FAILURE(".*ERROR: Illegal region cylinder axis: xx.*", command("region reg9 cylinder xx 0 0 1 0 1 open 1 units box");); + TEST_FAILURE(".*ERROR: Illegal region block xlo: 1 >= xhi: 0.*", + command("region reg1 block 1 0 0 1 0 1");); + TEST_FAILURE(".*ERROR: Illegal region cone open face: 4.*", + command("region reg2 cone x 0 0 2 1 0 1 open 4");); + TEST_FAILURE(".*ERROR: Illegal region plane normal vector: 0 0 0.*", + command("region reg3 plane 0 0 0 0 0 0 side out");); + TEST_FAILURE(".*ERROR: Illegal region prism non-zero xy tilt with infinite x size.*", + command("region reg4 prism INF INF 0 1 0 1 0.1 0.2 0.3");); + TEST_FAILURE(".*ERROR: Illegal region sphere radius: -1.*", + command("region reg5 sphere 0 0 0 -1");); + TEST_FAILURE(".*ERROR: Illegal region ellipsoid c: -2.*", + command("region reg8 ellipsoid 0 0 0 2 1 -2");); + TEST_FAILURE(".*ERROR: Illegal region cylinder axis: xx.*", + command("region reg9 cylinder xx 0 0 1 0 1 open 1 units box");); TEST_FAILURE(".*ERROR: Unrecognized region style 'xxx'.*", command("region new1 xxx");); - //TEST_FAILURE(".*ERROR: Illegal region command.*", command("region new1 block 0 1");); - TEST_FAILURE(".*ERROR: Illegal region command: missing argument\\(s\\).*", command("region new1 block 0 1");); + // TEST_FAILURE(".*ERROR: Illegal region command.*", command("region new1 block 0 1");); + TEST_FAILURE(".*ERROR: Illegal region command: missing argument\\(s\\).*", + command("region new1 block 0 1");); TEST_FAILURE(".*ERROR: Delete region new3 does not exist.*", command("region new3 delete");); } @@ -223,16 +231,16 @@ 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 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; diff --git a/unittest/commands/test_set_property.cpp b/unittest/commands/test_set_property.cpp index f5e290c671..092a0172fc 100644 --- a/unittest/commands/test_set_property.cpp +++ b/unittest/commands/test_set_property.cpp @@ -46,7 +46,7 @@ protected: void TearDown() override { LAMMPSTest::TearDown(); } - void atomic_system(const std::string &atom_style, const std::string units = "real") + void atomic_system(const std::string &atom_style, const std::string &units = "real") { BEGIN_HIDE_OUTPUT(); command("atom_style " + atom_style); @@ -313,10 +313,10 @@ TEST_F(SetTest, SpinPackage) command("set atom 1*2 spin/atom 0.5 0.1 0.5 -0.1"); command("set atom 8 spin/atom/random 23974 0.25"); END_HIDE_OUTPUT(); - constexpr double vx = 0.1; - constexpr double vy = 0.5; - constexpr double vz = -0.1; - const double norm = 1.0 / sqrt(vx * vx + vy * vy + vz * vz); + constexpr double vx = 0.1; + constexpr double vy = 0.5; + constexpr double vz = -0.1; + const double norm = 1.0 / sqrt(vx * vx + vy * vy + vz * vz); ASSERT_EQ(atom->sp[0][0], vx * norm); ASSERT_EQ(atom->sp[0][1], vy * norm); ASSERT_EQ(atom->sp[0][2], vz * norm); @@ -365,39 +365,39 @@ TEST_F(SetTest, EffPackage) ASSERT_NE(compute, nullptr); compute->compute_peratom(); - EXPECT_EQ(atom->spin[0],-1); - EXPECT_EQ(atom->spin[1],-1); - EXPECT_EQ(atom->spin[2],1); - EXPECT_EQ(atom->spin[3],1); - EXPECT_EQ(atom->spin[4],0); - EXPECT_EQ(atom->spin[5],2); - EXPECT_EQ(atom->spin[6],3); - EXPECT_EQ(atom->spin[7],3); - EXPECT_EQ(atom->eradius[0],0.5); - EXPECT_EQ(atom->eradius[1],1.0); - EXPECT_EQ(atom->eradius[2],0.5); - EXPECT_EQ(atom->eradius[3],1.0); - EXPECT_EQ(atom->eradius[4],0.5); - EXPECT_EQ(atom->eradius[5],1.0); - EXPECT_EQ(atom->eradius[6],0.5); - EXPECT_EQ(atom->eradius[7],1.0); + EXPECT_EQ(atom->spin[0], -1); + EXPECT_EQ(atom->spin[1], -1); + EXPECT_EQ(atom->spin[2], 1); + EXPECT_EQ(atom->spin[3], 1); + EXPECT_EQ(atom->spin[4], 0); + EXPECT_EQ(atom->spin[5], 2); + EXPECT_EQ(atom->spin[6], 3); + EXPECT_EQ(atom->spin[7], 3); + EXPECT_EQ(atom->eradius[0], 0.5); + EXPECT_EQ(atom->eradius[1], 1.0); + EXPECT_EQ(atom->eradius[2], 0.5); + EXPECT_EQ(atom->eradius[3], 1.0); + EXPECT_EQ(atom->eradius[4], 0.5); + EXPECT_EQ(atom->eradius[5], 1.0); + EXPECT_EQ(atom->eradius[6], 0.5); + EXPECT_EQ(atom->eradius[7], 1.0); - EXPECT_EQ(compute->array_atom[0][0],-1); - EXPECT_EQ(compute->array_atom[1][0],-1); - EXPECT_EQ(compute->array_atom[2][0],1); - EXPECT_EQ(compute->array_atom[3][0],1); - EXPECT_EQ(compute->array_atom[4][0],0); - EXPECT_EQ(compute->array_atom[5][0],2); - EXPECT_EQ(compute->array_atom[6][0],3); - EXPECT_EQ(compute->array_atom[7][0],3); - EXPECT_EQ(compute->array_atom[0][1],0.5); - EXPECT_EQ(compute->array_atom[1][1],1.0); - EXPECT_EQ(compute->array_atom[2][1],0.5); - EXPECT_EQ(compute->array_atom[3][1],1.0); - EXPECT_EQ(compute->array_atom[4][1],0.5); - EXPECT_EQ(compute->array_atom[5][1],1.0); - EXPECT_EQ(compute->array_atom[6][1],0.5); - EXPECT_EQ(compute->array_atom[7][1],1.0); + EXPECT_EQ(compute->array_atom[0][0], -1); + EXPECT_EQ(compute->array_atom[1][0], -1); + EXPECT_EQ(compute->array_atom[2][0], 1); + EXPECT_EQ(compute->array_atom[3][0], 1); + EXPECT_EQ(compute->array_atom[4][0], 0); + EXPECT_EQ(compute->array_atom[5][0], 2); + EXPECT_EQ(compute->array_atom[6][0], 3); + EXPECT_EQ(compute->array_atom[7][0], 3); + EXPECT_EQ(compute->array_atom[0][1], 0.5); + EXPECT_EQ(compute->array_atom[1][1], 1.0); + EXPECT_EQ(compute->array_atom[2][1], 0.5); + EXPECT_EQ(compute->array_atom[3][1], 1.0); + EXPECT_EQ(compute->array_atom[4][1], 0.5); + EXPECT_EQ(compute->array_atom[5][1], 1.0); + EXPECT_EQ(compute->array_atom[6][1], 0.5); + EXPECT_EQ(compute->array_atom[7][1], 1.0); TEST_FAILURE(".*ERROR on proc 0: Incorrect value for electron spin: 0.5.*", command("set atom * spin/electron 0.5");); diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index 5889f09eb0..54ffbb6950 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -41,8 +41,7 @@ using ::testing::ContainsRegex; using ::testing::ExitedWithCode; using ::testing::StrEq; -class SimpleCommandsTest : public LAMMPSTest { -}; +class SimpleCommandsTest : public LAMMPSTest {}; TEST_F(SimpleCommandsTest, UnknownCommand) { diff --git a/unittest/force-styles/test_angle_style.cpp b/unittest/force-styles/test_angle_style.cpp index 82a4731492..1a97368e0a 100644 --- a/unittest/force-styles/test_angle_style.cpp +++ b/unittest/force-styles/test_angle_style.cpp @@ -285,7 +285,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // run_stress 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]); + stress[1], stress[2], stress[3], stress[4], stress[5]); writer.emit_block("run_stress", block); block.clear(); diff --git a/unittest/force-styles/test_bond_style.cpp b/unittest/force-styles/test_bond_style.cpp index d0d8f26b6e..09ea62a909 100644 --- a/unittest/force-styles/test_bond_style.cpp +++ b/unittest/force-styles/test_bond_style.cpp @@ -285,7 +285,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // run_stress 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]); + stress[1], stress[2], stress[3], stress[4], stress[5]); writer.emit_block("run_stress", block); block.clear(); diff --git a/unittest/force-styles/test_dihedral_style.cpp b/unittest/force-styles/test_dihedral_style.cpp index 3f3e1248e8..74438da356 100644 --- a/unittest/force-styles/test_dihedral_style.cpp +++ b/unittest/force-styles/test_dihedral_style.cpp @@ -288,7 +288,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // run_stress 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]); + stress[1], stress[2], stress[3], stress[4], stress[5]); writer.emit_block("run_stress", block); block.clear(); diff --git a/unittest/force-styles/test_improper_style.cpp b/unittest/force-styles/test_improper_style.cpp index 3d2719f7d0..740b75552b 100644 --- a/unittest/force-styles/test_improper_style.cpp +++ b/unittest/force-styles/test_improper_style.cpp @@ -279,7 +279,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config) // run_stress 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]); + stress[1], stress[2], stress[3], stress[4], stress[5]); writer.emit_block("run_stress", block); block.clear(); diff --git a/unittest/force-styles/test_main.cpp b/unittest/force-styles/test_main.cpp index 0fc2fef47d..df6c79d4ef 100644 --- a/unittest/force-styles/test_main.cpp +++ b/unittest/force-styles/test_main.cpp @@ -12,16 +12,16 @@ ------------------------------------------------------------------------- */ #include "test_main.h" +#include "atom.h" +#include "error_stats.h" +#include "lammps.h" #include "pointers.h" #include "test_config.h" #include "test_config_reader.h" -#include "error_stats.h" #include "utils.h" #include "yaml_writer.h" #include "gmock/gmock.h" #include "gtest/gtest.h" -#include "lammps.h" -#include "atom.h" #include #include @@ -30,13 +30,14 @@ #include #include -using LAMMPS_NS::LAMMPS; using LAMMPS_NS::Atom; +using LAMMPS_NS::LAMMPS; +using LAMMPS_NS::tagint; using LAMMPS_NS::utils::split_words; using LAMMPS_NS::utils::trim; -using LAMMPS_NS::tagint; -void EXPECT_STRESS(const std::string & name, double * stress, const stress_t & expected_stress, double epsilon) +void EXPECT_STRESS(const std::string &name, double *stress, const stress_t &expected_stress, + double epsilon) { SCOPED_TRACE("EXPECT_STRESS: " + name); ErrorStats stats; @@ -49,10 +50,12 @@ void EXPECT_STRESS(const std::string & name, double * stress, const stress_t & e if (print_stats) std::cerr << name << " stats" << stats << std::endl; } -void EXPECT_FORCES(const std::string & name, Atom * atom, const std::vector & f_ref, double epsilon) { +void EXPECT_FORCES(const std::string &name, Atom *atom, const std::vector &f_ref, + double epsilon) +{ SCOPED_TRACE("EXPECT_FORCES: " + name); - double ** f = atom->f; - tagint * tag = atom->tag; + double **f = atom->f; + tagint *tag = atom->tag; const int nlocal = atom->nlocal; ASSERT_EQ(nlocal + 1, f_ref.size()); ErrorStats stats; @@ -64,10 +67,12 @@ void EXPECT_FORCES(const std::string & name, Atom * atom, const std::vector & x_ref, double epsilon) { +void EXPECT_POSITIONS(const std::string &name, Atom *atom, const std::vector &x_ref, + double epsilon) +{ SCOPED_TRACE("EXPECT_POSITIONS: " + name); - double ** x = atom->x; - tagint * tag = atom->tag; + double **x = atom->x; + tagint *tag = atom->tag; const int nlocal = atom->nlocal; ASSERT_EQ(nlocal + 1, x_ref.size()); ErrorStats stats; @@ -79,10 +84,12 @@ void EXPECT_POSITIONS(const std::string & name, Atom * atom, const std::vector & v_ref, double epsilon) { +void EXPECT_VELOCITIES(const std::string &name, Atom *atom, const std::vector &v_ref, + double epsilon) +{ SCOPED_TRACE("EXPECT_VELOCITIES: " + name); - double ** v = atom->v; - tagint * tag = atom->tag; + double **v = atom->v; + tagint *tag = atom->tag; const int nlocal = atom->nlocal; ASSERT_EQ(nlocal + 1, v_ref.size()); ErrorStats stats; diff --git a/unittest/force-styles/test_pair_style.cpp b/unittest/force-styles/test_pair_style.cpp index e56a5bba1c..6f1061a5eb 100644 --- a/unittest/force-styles/test_pair_style.cpp +++ b/unittest/force-styles/test_pair_style.cpp @@ -766,7 +766,7 @@ TEST(PairStyle, gpu) GTEST_SKIP(); const char *args_neigh[] = {"PairStyle", "-log", "none", "-echo", - "screen", "-nocite", "-sf", "gpu"}; + "screen", "-nocite", "-sf", "gpu"}; const char *args_noneigh[] = {"PairStyle", "-log", "none", "-echo", "screen", "-nocite", "-sf", "gpu", "-pk", "gpu", "0", "neigh", "no"}; diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index c712ffd763..4b726bb030 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -2123,7 +2123,7 @@ TEST_F(AtomStyleTest, body_nparticle) "12.0 0.0 12.0 0.0 0.0 0.0\n" "0.0 1.0 0.0\n" "0.0 -3.0 0.0\n"; - FILE *fp = fopen("input_atom_styles.data", "w"); + FILE *fp = fopen("input_atom_styles.data", "w"); fputs(data_file, fp); fclose(fp); BEGIN_HIDE_OUTPUT(); @@ -4889,16 +4889,26 @@ TEST_F(AtomStyleTest, oxdna) command("set atom 8 shape 1.173984503142341 1.173984503142341 1.173984503142341"); command("set atom 9 shape 1.173984503142341 1.173984503142341 1.173984503142341"); command("set atom 10 shape 1.173984503142341 1.173984503142341 1.173984503142341"); - command("set atom 1 quat 0.120438343611269 -0.970540441176996 0.208676441957758 16.990727782866998"); - command("set atom 2 quat 0.122039415796829 -0.068232256412985 0.990177125658213 40.001729435287870"); - command("set atom 3 quat 0.052760168698289 0.030943512185297 0.998127679033382 69.627682451632380"); - command("set atom 4 quat -0.037622918613871 0.030623545471522 0.998822664169035 97.038820280300570"); - command("set atom 5 quat 0.055056042946138 0.077631917807377 0.995460756369964 137.7813218321917"); - command("set atom 6 quat 0.931128471673637 -0.355724722922553 -0.080372201291206 166.2836226291888"); - command("set atom 7 quat 0.753526078198930 -0.648440397941919 0.108275111595674 200.6802564250672"); - command("set atom 8 quat 0.553942138074214 -0.829580511279186 0.070315595507185 192.0355407659524"); - command("set atom 9 quat -0.373540155765431 0.913070802138105 -0.163613759548524 171.0789308260751"); - command("set atom 10 quat 0.027515673832457 0.998248649922676 -0.052369080773879 161.2621224558284"); + command("set atom 1 quat 0.120438343611269 -0.970540441176996 0.208676441957758 " + "16.990727782866998"); + command("set atom 2 quat 0.122039415796829 -0.068232256412985 0.990177125658213 " + "40.001729435287870"); + command( + "set atom 3 quat 0.052760168698289 0.030943512185297 0.998127679033382 69.627682451632380"); + command("set atom 4 quat -0.037622918613871 0.030623545471522 0.998822664169035 " + "97.038820280300570"); + command( + "set atom 5 quat 0.055056042946138 0.077631917807377 0.995460756369964 137.7813218321917"); + command("set atom 6 quat 0.931128471673637 -0.355724722922553 -0.080372201291206 " + "166.2836226291888"); + command( + "set atom 7 quat 0.753526078198930 -0.648440397941919 0.108275111595674 200.6802564250672"); + command( + "set atom 8 quat 0.553942138074214 -0.829580511279186 0.070315595507185 192.0355407659524"); + command("set atom 9 quat -0.373540155765431 0.913070802138105 -0.163613759548524 " + "171.0789308260751"); + command("set atom 10 quat 0.027515673832457 0.998248649922676 -0.052369080773879 " + "161.2621224558284"); command("bond_style oxdna2/fene"); command("bond_coeff * 2.0 0.25 0.7564"); command("special_bonds lj 0 1 1"); @@ -4910,14 +4920,24 @@ TEST_F(AtomStyleTest, oxdna) command("create_bonds single/bond 1 7 8"); command("create_bonds single/bond 1 8 9"); command("create_bonds single/bond 1 9 10"); - command("pair_style hybrid/overlay oxdna2/excv oxdna2/stk oxdna2/hbond oxdna2/xstk oxdna2/coaxstk oxdna2/dh"); + command("pair_style hybrid/overlay oxdna2/excv oxdna2/stk oxdna2/hbond oxdna2/xstk " + "oxdna2/coaxstk oxdna2/dh"); command("pair_coeff * * oxdna2/excv 2.0 0.7 0.675 2.0 0.515 0.5 2.0 0.33 0.32"); - command("pair_coeff * * oxdna2/stk seqdep 0.1 1.3523 2.6717 6.0 0.4 0.9 0.32 0.75 1.3 0 0.8 0.9 0 0.95 0.9 0 0.95 2.0 0.65 2.0 0.65"); - command("pair_coeff * * oxdna2/hbond seqdep 0.0 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); - command("pair_coeff 1 4 oxdna2/hbond seqdep 1.0678 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); - command("pair_coeff 2 3 oxdna2/hbond seqdep 1.0678 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); - command("pair_coeff * * oxdna2/xstk 47.5 0.575 0.675 0.495 0.655 2.25 0.791592653589793 0.58 1.7 1.0 0.68 1.7 1.0 0.68 1.5 0 0.65 1.7 0.875 0.68 1.7 0.875 0.68"); - command("pair_coeff * * oxdna2/coaxstk 58.5 0.4 0.6 0.22 0.58 2.0 2.891592653589793 0.65 1.3 0 0.8 0.9 0 0.95 0.9 0 0.95 40.0 3.116592653589793"); + command("pair_coeff * * oxdna2/stk seqdep 0.1 1.3523 2.6717 6.0 0.4 0.9 0.32 0.75 1.3 0 0.8 " + "0.9 0 0.95 0.9 0 0.95 2.0 0.65 2.0 0.65"); + command( + "pair_coeff * * oxdna2/hbond seqdep 0.0 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 " + "0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); + command( + "pair_coeff 1 4 oxdna2/hbond seqdep 1.0678 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 " + "0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); + command( + "pair_coeff 2 3 oxdna2/hbond seqdep 1.0678 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 " + "0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); + command("pair_coeff * * oxdna2/xstk 47.5 0.575 0.675 0.495 0.655 2.25 0.791592653589793 0.58 " + "1.7 1.0 0.68 1.7 1.0 0.68 1.5 0 0.65 1.7 0.875 0.68 1.7 0.875 0.68"); + command("pair_coeff * * oxdna2/coaxstk 58.5 0.4 0.6 0.22 0.58 2.0 2.891592653589793 0.65 1.3 0 " + "0.8 0.9 0 0.95 0.9 0 0.95 40.0 3.116592653589793"); command("pair_coeff * * oxdna2/dh 0.1 0.2 0.815"); END_HIDE_OUTPUT(); @@ -4974,14 +4994,24 @@ TEST_F(AtomStyleTest, oxdna) command("bond_style oxdna2/fene"); command("bond_coeff * 2.0 0.25 0.7564"); command("special_bonds lj 0 1 1"); - command("pair_style hybrid/overlay oxdna2/excv oxdna2/stk oxdna2/hbond oxdna2/xstk oxdna2/coaxstk oxdna2/dh"); + command("pair_style hybrid/overlay oxdna2/excv oxdna2/stk oxdna2/hbond oxdna2/xstk " + "oxdna2/coaxstk oxdna2/dh"); command("pair_coeff * * oxdna2/excv 2.0 0.7 0.675 2.0 0.515 0.5 2.0 0.33 0.32"); - command("pair_coeff * * oxdna2/stk seqdep 0.1 1.3523 2.6717 6.0 0.4 0.9 0.32 0.75 1.3 0 0.8 0.9 0 0.95 0.9 0 0.95 2.0 0.65 2.0 0.65"); - command("pair_coeff * * oxdna2/hbond seqdep 0.0 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); - command("pair_coeff 1 4 oxdna2/hbond seqdep 1.0678 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); - command("pair_coeff 2 3 oxdna2/hbond seqdep 1.0678 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); - command("pair_coeff * * oxdna2/xstk 47.5 0.575 0.675 0.495 0.655 2.25 0.791592653589793 0.58 1.7 1.0 0.68 1.7 1.0 0.68 1.5 0 0.65 1.7 0.875 0.68 1.7 0.875 0.68"); - command("pair_coeff * * oxdna2/coaxstk 58.5 0.4 0.6 0.22 0.58 2.0 2.891592653589793 0.65 1.3 0 0.8 0.9 0 0.95 0.9 0 0.95 40.0 3.116592653589793"); + command("pair_coeff * * oxdna2/stk seqdep 0.1 1.3523 2.6717 6.0 0.4 0.9 0.32 0.75 1.3 0 0.8 " + "0.9 0 0.95 0.9 0 0.95 2.0 0.65 2.0 0.65"); + command( + "pair_coeff * * oxdna2/hbond seqdep 0.0 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 " + "0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); + command( + "pair_coeff 1 4 oxdna2/hbond seqdep 1.0678 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 " + "0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); + command( + "pair_coeff 2 3 oxdna2/hbond seqdep 1.0678 8.0 0.4 0.75 0.34 0.7 1.5 0 0.7 1.5 0 0.7 1.5 0 " + "0.7 0.46 3.141592653589793 0.7 4.0 1.5707963267948966 0.45 4.0 1.5707963267948966 0.45"); + command("pair_coeff * * oxdna2/xstk 47.5 0.575 0.675 0.495 0.655 2.25 0.791592653589793 0.58 " + "1.7 1.0 0.68 1.7 1.0 0.68 1.5 0 0.65 1.7 0.875 0.68 1.7 0.875 0.68"); + command("pair_coeff * * oxdna2/coaxstk 58.5 0.4 0.6 0.22 0.58 2.0 2.891592653589793 0.65 1.3 0 " + "0.8 0.9 0 0.95 0.9 0 0.95 40.0 3.116592653589793"); command("pair_coeff * * oxdna2/dh 0.1 0.2 0.815"); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid")); diff --git a/unittest/formats/test_dump_cfg.cpp b/unittest/formats/test_dump_cfg.cpp index acd839282d..2a295163ab 100644 --- a/unittest/formats/test_dump_cfg.cpp +++ b/unittest/formats/test_dump_cfg.cpp @@ -144,7 +144,7 @@ TEST_F(DumpCfgTest, no_unwrap_no_buffer_run0) ASSERT_THAT(lines[0], Eq("Number of particles = 32")); delete_file("dump_cfg_no_unwrap_no_buffer_run0.melt.cfg"); } -} +} // namespace LAMMPS_NS int main(int argc, char **argv) { diff --git a/unittest/formats/test_dump_custom.cpp b/unittest/formats/test_dump_custom.cpp index d1bae9d28f..3649dcfb02 100644 --- a/unittest/formats/test_dump_custom.cpp +++ b/unittest/formats/test_dump_custom.cpp @@ -384,7 +384,7 @@ TEST_F(DumpCustomTest, rerun_bin) ASSERT_NEAR(pe_2, pe_rerun, 1.0e-14); delete_file(dump_file); } -} +} // namespace LAMMPS_NS int main(int argc, char **argv) { MPI_Init(&argc, &argv); diff --git a/unittest/formats/test_dump_local.cpp b/unittest/formats/test_dump_local.cpp index 5735f4dc7c..5685504cab 100644 --- a/unittest/formats/test_dump_local.cpp +++ b/unittest/formats/test_dump_local.cpp @@ -238,7 +238,7 @@ TEST_F(DumpLocalTest, triclinic_run0) ASSERT_EQ(utils::split_words(lines[7]).size(), 3); delete_file(dump_file); } -} +} // namespace LAMMPS_NS int main(int argc, char **argv) { diff --git a/unittest/formats/test_dump_netcdf.cpp b/unittest/formats/test_dump_netcdf.cpp index 0b016d0efb..bf14f8aa54 100644 --- a/unittest/formats/test_dump_netcdf.cpp +++ b/unittest/formats/test_dump_netcdf.cpp @@ -387,7 +387,7 @@ TEST_F(DumpNetCDFTest, run0_mpi) } delete_file(dump_file); } -} +} // namespace LAMMPS_NS int main(int argc, char **argv) { diff --git a/unittest/formats/test_potential_file_reader.cpp b/unittest/formats/test_potential_file_reader.cpp index e9b633690e..9e07bbc951 100644 --- a/unittest/formats/test_potential_file_reader.cpp +++ b/unittest/formats/test_potential_file_reader.cpp @@ -57,8 +57,7 @@ constexpr int LAMMPS_NS::PairVashishta::NPARAMS_PER_LINE; constexpr int LAMMPS_NS::PairTersoffTable::NPARAMS_PER_LINE; #endif -class PotentialFileReaderTest : public LAMMPSTest { -}; +class PotentialFileReaderTest : public LAMMPSTest {}; // open for native units TEST_F(PotentialFileReaderTest, Sw_native) @@ -259,8 +258,7 @@ TEST_F(PotentialFileReaderTest, UnitConvert) delete reader; } -class OpenPotentialTest : public LAMMPSTest { -}; +class OpenPotentialTest : public LAMMPSTest {}; // open for native units TEST_F(OpenPotentialTest, Sw_native) diff --git a/unittest/utils/test_platform.cpp b/unittest/utils/test_platform.cpp index 8101c1adc6..493a2749be 100644 --- a/unittest/utils/test_platform.cpp +++ b/unittest/utils/test_platform.cpp @@ -325,10 +325,10 @@ TEST(Platform, path_and_directory) ASSERT_FALSE(platform::path_is_directory("path_is_directory")); #if defined(_WIN32) - ASSERT_EQ(platform::mkdir("path_is_directory\\path_is_directory"),0); + ASSERT_EQ(platform::mkdir("path_is_directory\\path_is_directory"), 0); ASSERT_TRUE(platform::path_is_directory("path_is_directory\\path_is_directory")); #else - ASSERT_EQ(platform::mkdir("path_is_directory/path_is_directory"),0); + ASSERT_EQ(platform::mkdir("path_is_directory/path_is_directory"), 0); ASSERT_TRUE(platform::path_is_directory("path_is_directory/path_is_directory")); #endif platform::rmdir("path_is_directory"); diff --git a/unittest/utils/test_utils.cpp b/unittest/utils/test_utils.cpp index cff7375aeb..2881ad10de 100644 --- a/unittest/utils/test_utils.cpp +++ b/unittest/utils/test_utils.cpp @@ -152,7 +152,7 @@ TEST(Utils, join_words) words.resize(1); combined = utils::join_words(words, "/"); ASSERT_THAT(combined, StrEq("one")); - words.push_back(""); + words.emplace_back(""); combined = utils::join_words(words, "1"); ASSERT_THAT(combined, StrEq("one1")); }