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());
|
||||
@ -235,7 +235,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);
|
||||
|
||||
@ -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();
|
||||
@ -300,7 +300,6 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
writer.emit_block("run_forces", block);
|
||||
|
||||
cleanup_lammps(lmp, config);
|
||||
return;
|
||||
}
|
||||
|
||||
TEST(DihedralStyle, plain)
|
||||
@ -370,7 +369,8 @@ TEST(DihedralStyle, plain)
|
||||
dihedral = lmp->force->dihedral;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton off)", dihedral->virial, test_config.init_stress, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton off)", dihedral->virial, test_config.init_stress,
|
||||
epsilon);
|
||||
|
||||
stats.reset();
|
||||
EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.init_energy, epsilon);
|
||||
@ -462,7 +462,8 @@ TEST(DihedralStyle, omp)
|
||||
auto dihedral = lmp->force->dihedral;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", dihedral->virial, test_config.init_stress, 10 * epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", dihedral->virial, test_config.init_stress,
|
||||
10 * epsilon);
|
||||
|
||||
stats.reset();
|
||||
EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.init_energy, epsilon);
|
||||
@ -495,7 +496,8 @@ TEST(DihedralStyle, omp)
|
||||
dihedral = lmp->force->dihedral;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton off)", dihedral->virial, test_config.init_stress, 10 * epsilon);
|
||||
EXPECT_STRESS("init_stress (newton off)", dihedral->virial, test_config.init_stress,
|
||||
10 * epsilon);
|
||||
|
||||
stats.reset();
|
||||
EXPECT_FP_LE_WITH_EPS(dihedral->energy, test_config.init_energy, epsilon);
|
||||
@ -506,7 +508,8 @@ TEST(DihedralStyle, 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)", dihedral->virial, test_config.run_stress, 10 * epsilon);
|
||||
EXPECT_STRESS("run_stress (newton off)", dihedral->virial, test_config.run_stress,
|
||||
10 * epsilon);
|
||||
|
||||
stats.reset();
|
||||
id = lmp->modify->find_compute("sum");
|
||||
|
||||
Reference in New Issue
Block a user