From 3ad75c40ec631f070ce16fd9e1e732b75d118be0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 13 Oct 2021 23:59:43 -0400 Subject: [PATCH] catch up on previous clang-tidy refactor for files that were skipped before --- src/QMMM/fix_qmmm.cpp | 2 +- src/REAXFF/fix_acks2_reaxff.cpp | 34 ++++++++++++++--------------- tools/lammps-shell/lammps-shell.cpp | 16 +++++++------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/QMMM/fix_qmmm.cpp b/src/QMMM/fix_qmmm.cpp index 4222a82247..8c59077c7d 100644 --- a/src/QMMM/fix_qmmm.cpp +++ b/src/QMMM/fix_qmmm.cpp @@ -822,7 +822,7 @@ void FixQMMM::post_force(int vflag) /* ---------------------------------------------------------------------- */ /* local memory usage. approximately. */ -double FixQMMM::memory_usage(void) +double FixQMMM::memory_usage() { double bytes; diff --git a/src/REAXFF/fix_acks2_reaxff.cpp b/src/REAXFF/fix_acks2_reaxff.cpp index f9a3b384bd..c54fffa9f1 100644 --- a/src/REAXFF/fix_acks2_reaxff.cpp +++ b/src/REAXFF/fix_acks2_reaxff.cpp @@ -66,28 +66,28 @@ static const char cite_fix_acks2_reax[] = FixACKS2ReaxFF::FixACKS2ReaxFF(LAMMPS *lmp, int narg, char **arg) : FixQEqReaxFF(lmp, narg, arg) { - bcut = NULL; + bcut = nullptr; - X_diag = NULL; - Xdia_inv = NULL; + X_diag = nullptr; + Xdia_inv = nullptr; // BiCGStab - g = NULL; - q_hat = NULL; - r_hat = NULL; - y = NULL; - z = NULL; + g = nullptr; + q_hat = nullptr; + r_hat = nullptr; + y = nullptr; + z = nullptr; // X matrix - X.firstnbr = NULL; - X.numnbrs = NULL; - X.jlist = NULL; - X.val = NULL; + X.firstnbr = nullptr; + X.numnbrs = nullptr; + X.jlist = nullptr; + X.val = nullptr; // Update comm sizes for this fix comm_forward = comm_reverse = 2; - s_hist_X = s_hist_last = NULL; + s_hist_X = s_hist_last = nullptr; last_rows_rank = 0; last_rows_flag = (comm->me == last_rows_rank); @@ -149,8 +149,8 @@ void FixACKS2ReaxFF::pertype_parameters(char *arg) bcut_acks2 = (double *) pair->extract("bcut_acks2",tmp); double* bond_softness_ptr = (double *) pair->extract("bond_softness",tmp); - if (chi == NULL || eta == NULL || gamma == NULL || - bcut_acks2 == NULL || bond_softness_ptr == NULL) + if (chi == nullptr || eta == nullptr || gamma == nullptr || + bcut_acks2 == nullptr || bond_softness_ptr == nullptr) error->all(FLERR, "Fix acks2/reaxff could not extract params from pair reaxff"); bond_softness = *bond_softness_ptr; @@ -303,7 +303,7 @@ void FixACKS2ReaxFF::init_bondcut() int ntypes; ntypes = atom->ntypes; - if (bcut == NULL) + if (bcut == nullptr) memory->create(bcut,ntypes+1,ntypes+1,"acks2:bondcut"); for (i = 1; i <= ntypes; ++i) @@ -856,7 +856,7 @@ void FixACKS2ReaxFF::more_reverse_comm(double *vec) if (last_rows_flag) MPI_Reduce(MPI_IN_PLACE,&vec[2*NN],2,MPI_DOUBLE,MPI_SUM,last_rows_rank,world); else - MPI_Reduce(&vec[2*NN],NULL,2,MPI_DOUBLE,MPI_SUM,last_rows_rank,world); + MPI_Reduce(&vec[2*NN],nullptr,2,MPI_DOUBLE,MPI_SUM,last_rows_rank,world); } /* ---------------------------------------------------------------------- diff --git a/tools/lammps-shell/lammps-shell.cpp b/tools/lammps-shell/lammps-shell.cpp index 936b539d43..df8d52bd33 100644 --- a/tools/lammps-shell/lammps-shell.cpp +++ b/tools/lammps-shell/lammps-shell.cpp @@ -21,7 +21,7 @@ #endif #include #else -#include +#include #endif #if defined(_OPENMP) @@ -153,14 +153,14 @@ static int save_history(std::string range, std::string file) std::size_t found = range.find_first_of("-"); if (found == std::string::npos) { // only a single number - int num = strtol(range.c_str(), NULL, 10); + int num = strtol(range.c_str(), nullptr, 10); if ((num >= from) && (num <= to)) { from = to = num; } else return 1; } else { // range of numbers if (found > 0) { // get number before '-' - int num = strtol(range.substr(0, found).c_str(), NULL, 10); + int num = strtol(range.substr(0, found).c_str(), nullptr, 10); if ((num >= from) && (num <= to)) { from = num; } else @@ -168,7 +168,7 @@ static int save_history(std::string range, std::string file) } if (range.size() > found + 1) { // get number after '-' - int num = strtol(range.substr(found + 1).c_str(), NULL, 10); + int num = strtol(range.substr(found + 1).c_str(), nullptr, 10); if ((num >= from) && (num <= to)) { to = num; } else @@ -340,13 +340,13 @@ static char *variable_expand_generator(const char *text, int state) static char *plugin_generator(const char *text, int state) { - const char *subcmd[] = {"load", "unload", "list", "clear", NULL}; + const char *subcmd[] = {"load", "unload", "list", "clear", nullptr}; const char *sub; static std::size_t idx=0, len; if (!state) idx = 0; len = strlen(text); - while ((sub = subcmd[idx]) != NULL) { + while ((sub = subcmd[idx]) != nullptr) { ++idx; if (strncmp(text,sub,len) == 0) return dupstring(sub); @@ -356,12 +356,12 @@ static char *plugin_generator(const char *text, int state) static char *plugin_style_generator(const char *text, int state) { - const char *styles[] = {"pair", "fix", "command", NULL}; + const char *styles[] = {"pair", "fix", "command", nullptr}; const char *s; static std::size_t idx=0, len; if (!state) idx = 0; len = strlen(text); - while ((s = styles[idx]) != NULL) { + while ((s = styles[idx]) != nullptr) { ++idx; if (strncmp(text,s,len) == 0) return dupstring(s);