Skip to content

Commit 14f71c5

Browse files
authored
Format according to new clang15 format (#416)
1 parent 91c5a6e commit 14f71c5

138 files changed

Lines changed: 1150 additions & 925 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmake_modules/FindCLANG_FORMAT.cmake

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# CLANG_FORMAT_VERSION - The version of clang-format found
66

77
find_program(CLANG_FORMAT_EXECUTABLE
8-
NAMES clang-format clang-format-6.0
8+
NAMES clang-format clang-format-15.0
99
DOC "clang-format executable")
1010
mark_as_advanced(CLANG_FORMAT_EXECUTABLE)
1111

@@ -14,14 +14,14 @@ if (CLANG_FORMAT_EXECUTABLE)
1414
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} -version
1515
OUTPUT_VARIABLE clang_format_version
1616
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
17-
if (clang_format_version MATCHES "^clang-format version .*")
18-
# clang_format_version sample: "clang-format version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)"
19-
string(REGEX REPLACE "clang-format version ([.0-9]+).*" "\\1"
20-
CLANG_FORMAT_VERSION "${clang_format_version}")
17+
message(STATUS ${clang_format_version})
18+
19+
if (clang_format_version MATCHES "clang-format version ([0-9]+)")
20+
set(CLANG_FORMAT_FOUND_VERSION_MAJOR ${CMAKE_MATCH_1})
21+
message(STATUS "Found clang-format version major: ${CLANG_FORMAT_FOUND_VERSION_MAJOR}")
2122
endif()
22-
if (NOT CLANG_FORMAT_VERSION STREQUAL "6.0.0" AND
23-
NOT CLANG_FORMAT_VERSION STREQUAL "6.0.1")
24-
message(SEND_ERROR "Wrong clang-format version. Please use clang-format 6.0.")
23+
if (NOT CLANG_FORMAT_FOUND_VERSION_MAJOR STREQUAL "15")
24+
message(SEND_ERROR "Wrong clang-format version. Please use clang-format 15")
2525
endif()
2626
endif()
2727

src/AndersonMix.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static const double min_det_mat = 0.01;
2626
static const double max_theta = 0.5;
2727
static const double min_theta = -3.;
2828

29-
//#define DEBUG 0
29+
// #define DEBUG 0
3030

3131
template <class T>
3232
AndersonMix<T>::AndersonMix(const int m, const double beta, T& x) : m_(m), x_(x)
@@ -236,15 +236,15 @@ void AndersonMix<T>::update(T& f, T& work, ostream& os, const bool verbose)
236236
}
237237
}
238238

239-
//#ifdef DEBUG
239+
// #ifdef DEBUG
240240
if (os.good() && mm_ > 0 && verbose)
241241
{
242242
os << "Anderson extrapolation:";
243243
for (int j = 0; j < mm_; j++)
244244
os << " theta[" << j << "]=" << theta_[j];
245245
os << endl;
246246
}
247-
//#endif
247+
// #endif
248248
}
249249

250250
// update x_

src/AndersonMix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class AndersonMix : public Mixing<T>
3232

3333
static Timer update_tm_;
3434

35-
virtual void postprocessUpdate(){};
35+
virtual void postprocessUpdate() {};
3636

3737
T& x_; // current trial solution
3838

src/ChebyshevApproximationFunction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class ChebyshevApproximationFunction
1717

1818
private:
1919
public:
20-
ChebyshevApproximationFunction(){};
21-
virtual ~ChebyshevApproximationFunction(){}; // destructor
20+
ChebyshevApproximationFunction() {};
21+
virtual ~ChebyshevApproximationFunction() {}; // destructor
2222

2323
virtual std::vector<double> eval(const std::vector<double>& x) = 0;
2424
};

src/ChebyshevApproximationInterface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ChebyshevApproximationInterface
4949

5050
public:
5151
// constructor
52-
ChebyshevApproximationInterface(){};
52+
ChebyshevApproximationInterface() {};
5353

5454
// build the Chebyshev coefficients for the interval [a, b]
5555
void computeChebyshevCoeffs();
@@ -66,7 +66,7 @@ class ChebyshevApproximationInterface
6666
max_order_ = order;
6767
order_ = order;
6868
}
69-
virtual ~ChebyshevApproximationInterface(){};
69+
virtual ~ChebyshevApproximationInterface() {};
7070

7171
static void printTimers(std::ostream& os)
7272
{

src/Constraint.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Constraint
2323
names_; // names of atoms involved in the constraint
2424

2525
public:
26-
virtual ~Constraint(){};
26+
virtual ~Constraint() {};
2727

2828
virtual bool enforce(void) = 0;
2929
virtual bool project_out_forces(void) = 0;

src/ConstraintSet.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ bool ConstraintSet::addConstraint(Ions& ions, const vector<string>& argv)
147147
// check if a constraint (name1,name2) or (name2,name1) is defined
148148
if (pc->type() == "distance"
149149
&& ((pc->names(0) == name1 && pc->names(1) == name2)
150-
|| (pc->names(1) == name1 && pc->names(0) == name2)))
150+
|| (pc->names(1) == name1 && pc->names(0) == name2)))
151151
found = true;
152152
}
153153

src/ConstraintSet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ConstraintSet
3535
bool addConstraint(Ions&, const std::vector<std::string>& argv);
3636

3737
public:
38-
ConstraintSet(){};
38+
ConstraintSet() {};
3939

4040
void clear();
4141

src/Control.cc

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ void Control::print(std::ostream& os)
271271
os << " Multigrid preconditioning for wave functions:" << std::endl;
272272
os << " # of Multigrid levels : " << mg_levels_ << std::endl;
273273
os << " # of pre-smoothing steps : " << mg_npresmoothing_ << std::endl;
274-
os << " # of post-smoothing steps : " << mg_npostsmoothing_ << std::endl;
274+
os << " # of post-smoothing steps : " << mg_npostsmoothing_
275+
<< std::endl;
275276
}
276277
else
277278
{
@@ -503,7 +504,8 @@ void Control::sync(void)
503504
memset(&float_buffer[0], 0, size_float_buffer * sizeof(float));
504505
}
505506

506-
auto bcast_check = [](int mpirc) {
507+
auto bcast_check = [](int mpirc)
508+
{
507509
if (mpirc != MPI_SUCCESS)
508510
{
509511
(*MPIdata::sout) << "MPI Bcast of Control failed!!!" << std::endl;
@@ -1497,9 +1499,9 @@ void Control::setOptions(const boost::program_options::variables_map& vm)
14971499
mg_npresmoothing_ = vm["Preconditioner.npresmoothing"].as<short>();
14981500
mg_npostsmoothing_ = vm["Preconditioner.npostsmoothing"].as<short>();
14991501
precond_precision_ = vm["Preconditioner.precision"].as<short>();
1500-
assert(precond_precision_==32 ||precond_precision_==64);
1502+
assert(precond_precision_ == 32 || precond_precision_ == 64);
15011503

1502-
precond_factor = vm["Quench.step_length"].as<float>();
1504+
precond_factor = vm["Quench.step_length"].as<float>();
15031505
if (precond_factor < 0.)
15041506
{
15051507
switch (lap_type)
@@ -1994,10 +1996,14 @@ void Control::setROMOptions(const boost::program_options::variables_map& vm)
19941996
else if (str.compare("none") == 0)
19951997
rom_pri_option.rom_stage = ROMStage::UNSUPPORTED;
19961998

1997-
rom_pri_option.restart_file_fmt = vm["ROM.offline.restart_filefmt"].as<std::string>();
1998-
rom_pri_option.restart_file_minidx = vm["ROM.offline.restart_min_idx"].as<int>();
1999-
rom_pri_option.restart_file_maxidx = vm["ROM.offline.restart_max_idx"].as<int>();
2000-
rom_pri_option.basis_file = vm["ROM.offline.basis_file"].as<std::string>();
1999+
rom_pri_option.restart_file_fmt
2000+
= vm["ROM.offline.restart_filefmt"].as<std::string>();
2001+
rom_pri_option.restart_file_minidx
2002+
= vm["ROM.offline.restart_min_idx"].as<int>();
2003+
rom_pri_option.restart_file_maxidx
2004+
= vm["ROM.offline.restart_max_idx"].as<int>();
2005+
rom_pri_option.basis_file
2006+
= vm["ROM.offline.basis_file"].as<std::string>();
20012007

20022008
str = vm["ROM.offline.variable"].as<std::string>();
20032009
if (str.compare("orbitals") == 0)
@@ -2007,14 +2013,19 @@ void Control::setROMOptions(const boost::program_options::variables_map& vm)
20072013
else
20082014
rom_pri_option.variable = ROMVariable::NONE;
20092015

2010-
rom_pri_option.save_librom_snapshot = vm["ROM.offline.save_librom_snapshot"].as<bool>();
2011-
rom_pri_option.librom_snapshot_freq = vm["ROM.offline.librom_snapshot_freq"].as<int>();
2016+
rom_pri_option.save_librom_snapshot
2017+
= vm["ROM.offline.save_librom_snapshot"].as<bool>();
2018+
rom_pri_option.librom_snapshot_freq
2019+
= vm["ROM.offline.librom_snapshot_freq"].as<int>();
20122020

20132021
rom_pri_option.compare_md = vm["ROM.basis.compare_md"].as<bool>();
2014-
rom_pri_option.num_orbbasis = vm["ROM.basis.number_of_orbital_basis"].as<int>();
2015-
rom_pri_option.num_potbasis = vm["ROM.basis.number_of_potential_basis"].as<int>();
2016-
rom_pri_option.pot_rom_file = vm["ROM.potential_rom_file"].as<std::string>();
2017-
} // onpe0
2022+
rom_pri_option.num_orbbasis
2023+
= vm["ROM.basis.number_of_orbital_basis"].as<int>();
2024+
rom_pri_option.num_potbasis
2025+
= vm["ROM.basis.number_of_potential_basis"].as<int>();
2026+
rom_pri_option.pot_rom_file
2027+
= vm["ROM.potential_rom_file"].as<std::string>();
2028+
} // onpe0
20182029

20192030
// synchronize all processors
20202031
syncROMOptions();
@@ -2031,7 +2042,8 @@ void Control::syncROMOptions()
20312042
mmpi.bcast(rom_pri_option.basis_file, comm_global_);
20322043
mmpi.bcast(rom_pri_option.pot_rom_file, comm_global_);
20332044

2034-
auto bcast_check = [](int mpirc) {
2045+
auto bcast_check = [](int mpirc)
2046+
{
20352047
if (mpirc != MPI_SUCCESS)
20362048
{
20372049
(*MPIdata::sout) << "MPI Bcast of Control failed!!!" << std::endl;
@@ -2044,31 +2056,38 @@ void Control::syncROMOptions()
20442056
mpirc = MPI_Bcast(&rom_stage, 1, MPI_SHORT, 0, comm_global_);
20452057
bcast_check(mpirc);
20462058

2047-
mpirc = MPI_Bcast(&rom_pri_option.restart_file_minidx, 1, MPI_INT, 0, comm_global_);
2059+
mpirc = MPI_Bcast(
2060+
&rom_pri_option.restart_file_minidx, 1, MPI_INT, 0, comm_global_);
20482061
bcast_check(mpirc);
20492062

2050-
mpirc = MPI_Bcast(&rom_pri_option.restart_file_maxidx, 1, MPI_INT, 0, comm_global_);
2063+
mpirc = MPI_Bcast(
2064+
&rom_pri_option.restart_file_maxidx, 1, MPI_INT, 0, comm_global_);
20512065
bcast_check(mpirc);
20522066

2053-
mpirc = MPI_Bcast(&rom_pri_option.save_librom_snapshot, 1, MPI_C_BOOL, 0, comm_global_);
2067+
mpirc = MPI_Bcast(
2068+
&rom_pri_option.save_librom_snapshot, 1, MPI_C_BOOL, 0, comm_global_);
20542069
bcast_check(mpirc);
20552070

2056-
mpirc = MPI_Bcast(&rom_pri_option.librom_snapshot_freq, 1, MPI_INT, 0, comm_global_);
2071+
mpirc = MPI_Bcast(
2072+
&rom_pri_option.librom_snapshot_freq, 1, MPI_INT, 0, comm_global_);
20572073
bcast_check(mpirc);
20582074

20592075
short rom_var = (short)static_cast<int>(rom_pri_option.variable);
2060-
mpirc = MPI_Bcast(&rom_var, 1, MPI_SHORT, 0, comm_global_);
2076+
mpirc = MPI_Bcast(&rom_var, 1, MPI_SHORT, 0, comm_global_);
20612077
bcast_check(mpirc);
20622078

20632079
rom_pri_option.rom_stage = static_cast<ROMStage>(rom_stage);
2064-
rom_pri_option.variable = static_cast<ROMVariable>(rom_var);
2080+
rom_pri_option.variable = static_cast<ROMVariable>(rom_var);
20652081

2066-
mpirc = MPI_Bcast(&rom_pri_option.compare_md, 1, MPI_C_BOOL, 0, comm_global_);
2082+
mpirc
2083+
= MPI_Bcast(&rom_pri_option.compare_md, 1, MPI_C_BOOL, 0, comm_global_);
20672084
bcast_check(mpirc);
20682085

2069-
mpirc = MPI_Bcast(&rom_pri_option.num_orbbasis, 1, MPI_INT, 0, comm_global_);
2086+
mpirc
2087+
= MPI_Bcast(&rom_pri_option.num_orbbasis, 1, MPI_INT, 0, comm_global_);
20702088
bcast_check(mpirc);
20712089

2072-
mpirc = MPI_Bcast(&rom_pri_option.num_potbasis, 1, MPI_INT, 0, comm_global_);
2090+
mpirc
2091+
= MPI_Bcast(&rom_pri_option.num_potbasis, 1, MPI_INT, 0, comm_global_);
20732092
bcast_check(mpirc);
20742093
}

src/Control.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class Control
216216

217217
Control();
218218

219-
~Control(){};
219+
~Control() {};
220220
Control(const Control& ct) { (void)ct; };
221221

222222
void printRestartLink();
@@ -406,7 +406,6 @@ class Control
406406
short mg_npresmoothing_;
407407
short mg_npostsmoothing_;
408408

409-
410409
// dielectric model for solvation
411410
short diel;
412411
// Parameters for MG solver/ preconditioner for Poisson problem
@@ -483,7 +482,7 @@ class Control
483482

484483
// Number of v-cycles for hartree solution
485484
short vh_its;
486-
485+
487486
// convergence tolerance for solving Poisson problem using PCG.
488487
float poisson_conv_tol;
489488

0 commit comments

Comments
 (0)