apply clang-format

This commit is contained in:
Axel Kohlmeyer
2022-09-10 03:21:28 -04:00
parent 4998c065da
commit ab899861d5
19 changed files with 158 additions and 116 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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: missing argument\\(s\\).*",
command("region new1 block 0 1"););
TEST_FAILURE(".*ERROR: Delete region new3 does not exist.*", command("region new3 delete"););
}

View File

@ -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);

View File

@ -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)
{

View File

@ -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 <cstdlib>
#include <cstring>
@ -30,13 +30,14 @@
#include <mpi.h>
#include <vector>
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,7 +50,9 @@ 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<coord_t> & f_ref, double epsilon) {
void EXPECT_FORCES(const std::string &name, Atom *atom, const std::vector<coord_t> &f_ref,
double epsilon)
{
SCOPED_TRACE("EXPECT_FORCES: " + name);
double **f = atom->f;
tagint *tag = atom->tag;
@ -64,7 +67,9 @@ void EXPECT_FORCES(const std::string & name, Atom * atom, const std::vector<coor
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, double epsilon) {
void EXPECT_POSITIONS(const std::string &name, Atom *atom, const std::vector<coord_t> &x_ref,
double epsilon)
{
SCOPED_TRACE("EXPECT_POSITIONS: " + name);
double **x = atom->x;
tagint *tag = atom->tag;
@ -79,7 +84,9 @@ void EXPECT_POSITIONS(const std::string & name, Atom * atom, const std::vector<c
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, double epsilon) {
void EXPECT_VELOCITIES(const std::string &name, Atom *atom, const std::vector<coord_t> &v_ref,
double epsilon)
{
SCOPED_TRACE("EXPECT_VELOCITIES: " + name);
double **v = atom->v;
tagint *tag = atom->tag;

View File

@ -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"));

View File

@ -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)
{

View File

@ -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);

View File

@ -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)
{

View File

@ -387,7 +387,7 @@ TEST_F(DumpNetCDFTest, run0_mpi)
}
delete_file(dump_file);
}
}
} // namespace LAMMPS_NS
int main(int argc, char **argv)
{

View File

@ -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)

View File

@ -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"));
}