Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions cmake_modules/FindCLANG_FORMAT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# CLANG_FORMAT_VERSION - The version of clang-format found

find_program(CLANG_FORMAT_EXECUTABLE
NAMES clang-format clang-format-6.0
NAMES clang-format clang-format-15.0
DOC "clang-format executable")
mark_as_advanced(CLANG_FORMAT_EXECUTABLE)

Expand All @@ -14,14 +14,14 @@ if (CLANG_FORMAT_EXECUTABLE)
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} -version
OUTPUT_VARIABLE clang_format_version
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if (clang_format_version MATCHES "^clang-format version .*")
# clang_format_version sample: "clang-format version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)"
string(REGEX REPLACE "clang-format version ([.0-9]+).*" "\\1"
CLANG_FORMAT_VERSION "${clang_format_version}")
message(STATUS ${clang_format_version})

if (clang_format_version MATCHES "clang-format version ([0-9]+)")
set(CLANG_FORMAT_FOUND_VERSION_MAJOR ${CMAKE_MATCH_1})
message(STATUS "Found clang-format version major: ${CLANG_FORMAT_FOUND_VERSION_MAJOR}")
endif()
if (NOT CLANG_FORMAT_VERSION STREQUAL "6.0.0" AND
NOT CLANG_FORMAT_VERSION STREQUAL "6.0.1")
message(SEND_ERROR "Wrong clang-format version. Please use clang-format 6.0.")
if (NOT CLANG_FORMAT_FOUND_VERSION_MAJOR STREQUAL "15")
message(SEND_ERROR "Wrong clang-format version. Please use clang-format 15")
endif()
endif()

Expand Down
6 changes: 3 additions & 3 deletions src/AndersonMix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static const double min_det_mat = 0.01;
static const double max_theta = 0.5;
static const double min_theta = -3.;

//#define DEBUG 0
// #define DEBUG 0

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

//#ifdef DEBUG
// #ifdef DEBUG
if (os.good() && mm_ > 0 && verbose)
{
os << "Anderson extrapolation:";
for (int j = 0; j < mm_; j++)
os << " theta[" << j << "]=" << theta_[j];
os << endl;
}
//#endif
// #endif
}

// update x_
Expand Down
2 changes: 1 addition & 1 deletion src/AndersonMix.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AndersonMix : public Mixing<T>

static Timer update_tm_;

virtual void postprocessUpdate(){};
virtual void postprocessUpdate() {};

T& x_; // current trial solution

Expand Down
4 changes: 2 additions & 2 deletions src/ChebyshevApproximationFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class ChebyshevApproximationFunction

private:
public:
ChebyshevApproximationFunction(){};
virtual ~ChebyshevApproximationFunction(){}; // destructor
ChebyshevApproximationFunction() {};
virtual ~ChebyshevApproximationFunction() {}; // destructor

virtual std::vector<double> eval(const std::vector<double>& x) = 0;
};
Expand Down
4 changes: 2 additions & 2 deletions src/ChebyshevApproximationInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ChebyshevApproximationInterface

public:
// constructor
ChebyshevApproximationInterface(){};
ChebyshevApproximationInterface() {};

// build the Chebyshev coefficients for the interval [a, b]
void computeChebyshevCoeffs();
Expand All @@ -66,7 +66,7 @@ class ChebyshevApproximationInterface
max_order_ = order;
order_ = order;
}
virtual ~ChebyshevApproximationInterface(){};
virtual ~ChebyshevApproximationInterface() {};

static void printTimers(std::ostream& os)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Constraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Constraint
names_; // names of atoms involved in the constraint

public:
virtual ~Constraint(){};
virtual ~Constraint() {};

virtual bool enforce(void) = 0;
virtual bool project_out_forces(void) = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/ConstraintSet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ bool ConstraintSet::addConstraint(Ions& ions, const vector<string>& argv)
// check if a constraint (name1,name2) or (name2,name1) is defined
if (pc->type() == "distance"
&& ((pc->names(0) == name1 && pc->names(1) == name2)
|| (pc->names(1) == name1 && pc->names(0) == name2)))
|| (pc->names(1) == name1 && pc->names(0) == name2)))
found = true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ConstraintSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ConstraintSet
bool addConstraint(Ions&, const std::vector<std::string>& argv);

public:
ConstraintSet(){};
ConstraintSet() {};

void clear();

Expand Down
67 changes: 43 additions & 24 deletions src/Control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ void Control::print(std::ostream& os)
os << " Multigrid preconditioning for wave functions:" << std::endl;
os << " # of Multigrid levels : " << mg_levels_ << std::endl;
os << " # of pre-smoothing steps : " << mg_npresmoothing_ << std::endl;
os << " # of post-smoothing steps : " << mg_npostsmoothing_ << std::endl;
os << " # of post-smoothing steps : " << mg_npostsmoothing_
<< std::endl;
}
else
{
Expand Down Expand Up @@ -503,7 +504,8 @@ void Control::sync(void)
memset(&float_buffer[0], 0, size_float_buffer * sizeof(float));
}

auto bcast_check = [](int mpirc) {
auto bcast_check = [](int mpirc)
{
if (mpirc != MPI_SUCCESS)
{
(*MPIdata::sout) << "MPI Bcast of Control failed!!!" << std::endl;
Expand Down Expand Up @@ -1497,9 +1499,9 @@ void Control::setOptions(const boost::program_options::variables_map& vm)
mg_npresmoothing_ = vm["Preconditioner.npresmoothing"].as<short>();
mg_npostsmoothing_ = vm["Preconditioner.npostsmoothing"].as<short>();
precond_precision_ = vm["Preconditioner.precision"].as<short>();
assert(precond_precision_==32 ||precond_precision_==64);
assert(precond_precision_ == 32 || precond_precision_ == 64);

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

rom_pri_option.restart_file_fmt = vm["ROM.offline.restart_filefmt"].as<std::string>();
rom_pri_option.restart_file_minidx = vm["ROM.offline.restart_min_idx"].as<int>();
rom_pri_option.restart_file_maxidx = vm["ROM.offline.restart_max_idx"].as<int>();
rom_pri_option.basis_file = vm["ROM.offline.basis_file"].as<std::string>();
rom_pri_option.restart_file_fmt
= vm["ROM.offline.restart_filefmt"].as<std::string>();
rom_pri_option.restart_file_minidx
= vm["ROM.offline.restart_min_idx"].as<int>();
rom_pri_option.restart_file_maxidx
= vm["ROM.offline.restart_max_idx"].as<int>();
rom_pri_option.basis_file
= vm["ROM.offline.basis_file"].as<std::string>();

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

rom_pri_option.save_librom_snapshot = vm["ROM.offline.save_librom_snapshot"].as<bool>();
rom_pri_option.librom_snapshot_freq = vm["ROM.offline.librom_snapshot_freq"].as<int>();
rom_pri_option.save_librom_snapshot
= vm["ROM.offline.save_librom_snapshot"].as<bool>();
rom_pri_option.librom_snapshot_freq
= vm["ROM.offline.librom_snapshot_freq"].as<int>();

rom_pri_option.compare_md = vm["ROM.basis.compare_md"].as<bool>();
rom_pri_option.num_orbbasis = vm["ROM.basis.number_of_orbital_basis"].as<int>();
rom_pri_option.num_potbasis = vm["ROM.basis.number_of_potential_basis"].as<int>();
rom_pri_option.pot_rom_file = vm["ROM.potential_rom_file"].as<std::string>();
} // onpe0
rom_pri_option.num_orbbasis
= vm["ROM.basis.number_of_orbital_basis"].as<int>();
rom_pri_option.num_potbasis
= vm["ROM.basis.number_of_potential_basis"].as<int>();
rom_pri_option.pot_rom_file
= vm["ROM.potential_rom_file"].as<std::string>();
} // onpe0

// synchronize all processors
syncROMOptions();
Expand All @@ -2031,7 +2042,8 @@ void Control::syncROMOptions()
mmpi.bcast(rom_pri_option.basis_file, comm_global_);
mmpi.bcast(rom_pri_option.pot_rom_file, comm_global_);

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

mpirc = MPI_Bcast(&rom_pri_option.restart_file_minidx, 1, MPI_INT, 0, comm_global_);
mpirc = MPI_Bcast(
&rom_pri_option.restart_file_minidx, 1, MPI_INT, 0, comm_global_);
bcast_check(mpirc);

mpirc = MPI_Bcast(&rom_pri_option.restart_file_maxidx, 1, MPI_INT, 0, comm_global_);
mpirc = MPI_Bcast(
&rom_pri_option.restart_file_maxidx, 1, MPI_INT, 0, comm_global_);
bcast_check(mpirc);

mpirc = MPI_Bcast(&rom_pri_option.save_librom_snapshot, 1, MPI_C_BOOL, 0, comm_global_);
mpirc = MPI_Bcast(
&rom_pri_option.save_librom_snapshot, 1, MPI_C_BOOL, 0, comm_global_);
bcast_check(mpirc);

mpirc = MPI_Bcast(&rom_pri_option.librom_snapshot_freq, 1, MPI_INT, 0, comm_global_);
mpirc = MPI_Bcast(
&rom_pri_option.librom_snapshot_freq, 1, MPI_INT, 0, comm_global_);
bcast_check(mpirc);

short rom_var = (short)static_cast<int>(rom_pri_option.variable);
mpirc = MPI_Bcast(&rom_var, 1, MPI_SHORT, 0, comm_global_);
mpirc = MPI_Bcast(&rom_var, 1, MPI_SHORT, 0, comm_global_);
bcast_check(mpirc);

rom_pri_option.rom_stage = static_cast<ROMStage>(rom_stage);
rom_pri_option.variable = static_cast<ROMVariable>(rom_var);
rom_pri_option.variable = static_cast<ROMVariable>(rom_var);

mpirc = MPI_Bcast(&rom_pri_option.compare_md, 1, MPI_C_BOOL, 0, comm_global_);
mpirc
= MPI_Bcast(&rom_pri_option.compare_md, 1, MPI_C_BOOL, 0, comm_global_);
bcast_check(mpirc);

mpirc = MPI_Bcast(&rom_pri_option.num_orbbasis, 1, MPI_INT, 0, comm_global_);
mpirc
= MPI_Bcast(&rom_pri_option.num_orbbasis, 1, MPI_INT, 0, comm_global_);
bcast_check(mpirc);

mpirc = MPI_Bcast(&rom_pri_option.num_potbasis, 1, MPI_INT, 0, comm_global_);
mpirc
= MPI_Bcast(&rom_pri_option.num_potbasis, 1, MPI_INT, 0, comm_global_);
bcast_check(mpirc);
}
5 changes: 2 additions & 3 deletions src/Control.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class Control

Control();

~Control(){};
~Control() {};
Control(const Control& ct) { (void)ct; };

void printRestartLink();
Expand Down Expand Up @@ -406,7 +406,6 @@ class Control
short mg_npresmoothing_;
short mg_npostsmoothing_;


// dielectric model for solvation
short diel;
// Parameters for MG solver/ preconditioner for Poisson problem
Expand Down Expand Up @@ -483,7 +482,7 @@ class Control

// Number of v-cycles for hartree solution
short vh_its;

// convergence tolerance for solving Poisson problem using PCG.
float poisson_conv_tol;

Expand Down
2 changes: 1 addition & 1 deletion src/DMStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DMStrategy
virtual void initialize(OrbitalsType& orbitals) = 0;
virtual int update(OrbitalsType& orbitals) = 0;

virtual ~DMStrategy(){};
virtual ~DMStrategy() {};

// tells if strategy needs an updated H matrix
// to update DM
Expand Down
8 changes: 4 additions & 4 deletions src/DavidsonSolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ int DavidsonSolver<OrbitalsType, MatrixType>::checkConvergence(
// {
// n++;
// }
//#ifdef USE_MPI
// #ifdef USE_MPI
// MPI_Bcast(&n, 1, MPI_INT, 0, comm_);
//#endif
// #endif
// if (n <= numst) return;
//
// // build H matrix in basis of evect
Expand All @@ -159,9 +159,9 @@ int DavidsonSolver<OrbitalsType, MatrixType>::checkConvergence(
// index = i;
// }
// }
//#ifdef USE_MPI
// #ifdef USE_MPI
// MPI_Bcast(&index, 1, MPI_INT, 0, comm_);
//#endif
// #endif
// if (index != n - 1)
// {
// if (onpe0 && ct.verbose > 2)
Expand Down
2 changes: 1 addition & 1 deletion src/DistMatrix/DistMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class DistMatrix
return *this;
}

~DistMatrix() {}
~DistMatrix() { }

void identity(void);

Expand Down
2 changes: 1 addition & 1 deletion src/DistMatrix/DistVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DistVector : public DistMatrix<T>
{
}

DistVector(const int m) : DistMatrix<T>("noname", m, 1) {}
DistVector(const int m) : DistMatrix<T>("noname", m, 1) { }

DistVector(const std::vector<T>& v) : DistMatrix<T>("noname", v.size(), 1)
{
Expand Down
10 changes: 5 additions & 5 deletions src/DistMatrix/SubMatrices.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <limits.h>

//#define DEBUG
// #define DEBUG

namespace dist_matrix
{
Expand Down Expand Up @@ -161,12 +161,12 @@ void SubMatrices<T>::gather(const DistMatrix<T>& mat)
// compute displacements
std::vector<type_displ> remote_displ(npes_, 0);
for (int pe = 1; pe < npes_; pe++)
remote_displ[pe] = (type_displ)(
submat_indexing_.getRemoteSize(pe - 1) + remote_displ[pe - 1]);
remote_displ[pe] = (type_displ)(submat_indexing_.getRemoteSize(pe - 1)
+ remote_displ[pe - 1]);
std::vector<type_displ> my_displ(npes_distmat_, 0);
for (int pe = 1; pe < npes_distmat_; pe++)
my_displ[pe] = (type_displ)(
submat_indexing_.getMySize(pe - 1) + my_displ[pe - 1]);
my_displ[pe] = (type_displ)(submat_indexing_.getMySize(pe - 1)
+ my_displ[pe - 1]);

// build buffer for data array to send
std::vector<T> buf_remote_val(tot_remote_size, 0.);
Expand Down
2 changes: 1 addition & 1 deletion src/DistMatrix2SquareLocalMatrices.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DistMatrix2SquareLocalMatrices
"Work", gids, comm, empty_mat, *submat_indexing_));
}

~DistMatrix2SquareLocalMatrices() {}
~DistMatrix2SquareLocalMatrices() { }

void convert(const dist_matrix::DistMatrix<DISTMATDTYPE>& dmat,
SquareLocalMatrices<MATDTYPE, MemorySpace::Host>& lmat);
Expand Down
2 changes: 1 addition & 1 deletion src/DistributedIonicData.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DistributedIonicData
public:
DistributedIonicData(
const std::vector<std::string>&, const std::vector<double>&);
DistributedIonicData(){};
DistributedIonicData() {};

int size() const { return (int)ion_names_.size(); };

Expand Down
2 changes: 1 addition & 1 deletion src/DotProductDiagonal.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ template <class T>
class DotProductDiagonal : public DotProductManager<T>
{
public:
DotProductDiagonal(){};
DotProductDiagonal() {};

double dotProduct(T& phi0, const T& phi1) override;
};
Expand Down
4 changes: 2 additions & 2 deletions src/DotProductManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ template <class T>
class DotProductManager
{
public:
DotProductManager(){};
DotProductManager() {};

virtual ~DotProductManager(){};
virtual ~DotProductManager() {};

virtual double dotProduct(T& a, const T& b) = 0;
};
Expand Down
Loading