use clang-tidy and clang-format to update/modernize/simplify code
This commit is contained in:
@ -32,8 +32,8 @@
|
||||
#include "input.h"
|
||||
#include "lammps.h"
|
||||
#include "modify.h"
|
||||
#include "universe.h"
|
||||
#include "platform.h"
|
||||
#include "universe.h"
|
||||
|
||||
#include <cctype>
|
||||
#include <cstdio>
|
||||
@ -90,7 +90,7 @@ LAMMPS *init_lammps(int argc, char **argv, const TestConfig &cfg, const bool new
|
||||
|
||||
// utility lambdas to improve readability
|
||||
auto command = [&](const std::string &line) {
|
||||
lmp->input->one(line.c_str());
|
||||
lmp->input->one(line);
|
||||
};
|
||||
auto parse_input_script = [&](const std::string &filename) {
|
||||
lmp->input->file(filename.c_str());
|
||||
@ -133,7 +133,7 @@ void run_lammps(LAMMPS *lmp)
|
||||
{
|
||||
// utility lambda to improve readability
|
||||
auto command = [&](const std::string &line) {
|
||||
lmp->input->one(line.c_str());
|
||||
lmp->input->one(line);
|
||||
};
|
||||
|
||||
command("fix 1 all nve");
|
||||
@ -148,7 +148,7 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
{
|
||||
// utility lambda to improve readability
|
||||
auto command = [&](const std::string &line) {
|
||||
lmp->input->one(line.c_str());
|
||||
lmp->input->one(line);
|
||||
};
|
||||
|
||||
command("clear");
|
||||
@ -175,7 +175,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
{
|
||||
// utility lambdas to improve readability
|
||||
auto command = [&](const std::string &line) {
|
||||
lmp->input->one(line.c_str());
|
||||
lmp->input->one(line);
|
||||
};
|
||||
auto parse_input_script = [&](const std::string &filename) {
|
||||
lmp->input->file(filename.c_str());
|
||||
@ -226,7 +226,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
}
|
||||
|
||||
const int natoms = lmp->atom->natoms;
|
||||
std::string block("");
|
||||
std::string block;
|
||||
|
||||
YamlWriter writer(outfile);
|
||||
|
||||
@ -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();
|
||||
@ -297,7 +297,6 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
writer.emit_block("run_forces", block);
|
||||
|
||||
cleanup_lammps(lmp, config);
|
||||
return;
|
||||
}
|
||||
|
||||
TEST(BondStyle, plain)
|
||||
@ -334,7 +333,7 @@ TEST(BondStyle, plain)
|
||||
double epsilon = test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto bond = lmp->force->bond;
|
||||
auto bond = lmp->force->bond;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", bond->virial, test_config.init_stress, epsilon);
|
||||
@ -364,10 +363,11 @@ TEST(BondStyle, plain)
|
||||
|
||||
// skip over these tests if newton bond is forced to be on
|
||||
if (lmp->force->newton_bond == 0) {
|
||||
bond = lmp->force->bond;
|
||||
bond = lmp->force->bond;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton off)", bond->virial, test_config.init_stress, 2 * epsilon);
|
||||
EXPECT_STRESS("init_stress (newton off)", bond->virial, test_config.init_stress,
|
||||
2 * epsilon);
|
||||
|
||||
stats.reset();
|
||||
EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.init_energy, epsilon);
|
||||
@ -392,7 +392,7 @@ TEST(BondStyle, plain)
|
||||
restart_lammps(lmp, test_config);
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
|
||||
bond = lmp->force->bond;
|
||||
bond = lmp->force->bond;
|
||||
|
||||
EXPECT_FORCES("restart_forces", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("restart_stress", bond->virial, test_config.init_stress, epsilon);
|
||||
@ -405,7 +405,7 @@ TEST(BondStyle, plain)
|
||||
data_lammps(lmp, test_config);
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
|
||||
bond = lmp->force->bond;
|
||||
bond = lmp->force->bond;
|
||||
|
||||
EXPECT_FORCES("data_forces", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("data_stress", bond->virial, test_config.init_stress, epsilon);
|
||||
@ -456,7 +456,7 @@ TEST(BondStyle, omp)
|
||||
double epsilon = 5.0 * test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto bond = lmp->force->bond;
|
||||
auto bond = lmp->force->bond;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", bond->virial, test_config.init_stress, 10 * epsilon);
|
||||
@ -489,10 +489,11 @@ TEST(BondStyle, omp)
|
||||
|
||||
// skip over these tests if newton bond is forced to be on
|
||||
if (lmp->force->newton_bond == 0) {
|
||||
bond = lmp->force->bond;
|
||||
bond = lmp->force->bond;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton off)", bond->virial, test_config.init_stress, 10 * epsilon);
|
||||
EXPECT_STRESS("init_stress (newton off)", bond->virial, test_config.init_stress,
|
||||
10 * epsilon);
|
||||
|
||||
stats.reset();
|
||||
EXPECT_FP_LE_WITH_EPS(bond->energy, test_config.init_energy, epsilon);
|
||||
@ -503,7 +504,8 @@ TEST(BondStyle, omp)
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
|
||||
EXPECT_FORCES("run_forces (newton off)", lmp->atom, test_config.run_forces, 10 * epsilon);
|
||||
EXPECT_STRESS("run_stress (newton off)", bond->virial, test_config.run_stress, 10 * epsilon);
|
||||
EXPECT_STRESS("run_stress (newton off)", bond->virial, test_config.run_stress,
|
||||
10 * epsilon);
|
||||
|
||||
stats.reset();
|
||||
id = lmp->modify->find_compute("sum");
|
||||
@ -557,7 +559,7 @@ TEST(BondStyle, single)
|
||||
|
||||
// utility lambda to improve readability
|
||||
auto command = [&](const std::string &line) {
|
||||
lmp->input->one(line.c_str());
|
||||
lmp->input->one(line);
|
||||
};
|
||||
|
||||
// now start over
|
||||
|
||||
Reference in New Issue
Block a user