Skip to content

Commit 4686a50

Browse files
committed
clang-format
1 parent ac5a3c5 commit 4686a50

Some content is hidden

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

64 files changed

+683
-765
lines changed

src/analyticfunctions/NuclearGradientFunction.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
namespace mrchem {
3333

34-
class NuclearGradientFunction : public mrcpp::RepresentableFunction<3, double> {
34+
class NuclearGradientFunction : public mrcpp::RepresentableFunction<3, double> {
3535
public:
3636
/*!
3737
* @brief NuclearGradientFunction represents the function: Z * [x,y,z]/|r - o|^3

src/chemistry/Molecule.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@
4444
#include "Nucleus.h"
4545
#include "properties/DipoleMoment.h"
4646
#include "properties/GeometricDerivative.h"
47+
#include "properties/HirshfeldCharges.h"
4748
#include "properties/Magnetizability.h"
4849
#include "properties/NMRShielding.h"
4950
#include "properties/OrbitalEnergies.h"
5051
#include "properties/Polarizability.h"
5152
#include "properties/QuadrupoleMoment.h"
5253
#include "properties/SCFEnergy.h"
5354
#include "qmfunctions/Orbital.h"
54-
#include "properties/HirshfeldCharges.h"
5555

5656
/** @class Molecule
5757
*

src/driver.cpp

+8-12
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
#include <MRCPP/Printer>
2828
#include <MRCPP/Timer>
2929

30-
#include <filesystem>
3130
#include "driver.h"
31+
#include <filesystem>
3232

3333
#include "chemistry/Molecule.h"
3434
#include "chemistry/Nucleus.h"
@@ -51,12 +51,12 @@
5151
#include "qmfunctions/density_utils.h"
5252
#include "qmfunctions/orbital_utils.h"
5353

54+
#include "qmoperators/one_electron/AZoraPotential.h"
5455
#include "qmoperators/one_electron/ElectricFieldOperator.h"
5556
#include "qmoperators/one_electron/KineticOperator.h"
5657
#include "qmoperators/one_electron/NuclearGradientOperator.h"
5758
#include "qmoperators/one_electron/NuclearOperator.h"
5859
#include "qmoperators/one_electron/ZoraOperator.h"
59-
#include "qmoperators/one_electron/AZoraPotential.h"
6060

6161
#include "qmoperators/one_electron/H_BB_dia.h"
6262
#include "qmoperators/one_electron/H_BM_dia.h"
@@ -83,8 +83,8 @@
8383
#include "environment/LPBESolver.h"
8484
#include "environment/PBESolver.h"
8585
#include "environment/Permittivity.h"
86-
#include "surface_forces/SurfaceForce.h"
8786
#include "properties/hirshfeld/HirshfeldPartition.h"
87+
#include "surface_forces/SurfaceForce.h"
8888

8989
#include "mrdft/Factory.h"
9090

@@ -563,7 +563,7 @@ void driver::scf::calc_properties(const json &json_prop, Molecule &mol, const js
563563
el.row(k) = h.trace(Phi).real();
564564
h.clear();
565565
}
566-
// calculate electronic gradient using the surface integrals method
566+
// calculate electronic gradient using the surface integrals method
567567
} else if (json_prop["geometric_derivative"]["geom-1"]["method"] == "surface_integrals") {
568568
double prec = json_prop["geometric_derivative"]["geom-1"]["precision"];
569569
std::string leb_prec = json_prop["geometric_derivative"]["geom-1"]["surface_integral_precision"];
@@ -573,9 +573,7 @@ void driver::scf::calc_properties(const json &json_prop, Molecule &mol, const js
573573
auto &nuc = G.getNuclear();
574574
auto &el = G.getElectronic();
575575
// set electronic gradient
576-
for (int k = 0; k < mol.getNNuclei(); k++) {
577-
el.row(k) = surfaceForces.row(k) - nuc.row(k);
578-
}
576+
for (int k = 0; k < mol.getNNuclei(); k++) { el.row(k) = surfaceForces.row(k) - nuc.row(k); }
579577
} else {
580578
MSG_ABORT("Invalid method for geometric derivative");
581579
}
@@ -639,9 +637,9 @@ void driver::scf::calc_properties(const json &json_prop, Molecule &mol, const js
639637
mrchem::density::compute(prec, rho, Phi, DensityType::Total);
640638
Eigen::VectorXd charges = Eigen::VectorXd::Zero(mol.getNNuclei());
641639
for (int i = 0; i < mol.getNNuclei(); i++) {
642-
if ( ! mrcpp::mpi::my_func(i) ) continue; // my_orb also works for atoms.
640+
if (!mrcpp::mpi::my_func(i)) continue; // my_orb also works for atoms.
643641
double charge = partitioner.getHirshfeldPartitionIntegral(i, rho, prec);
644-
charge = - charge + mol.getNuclei()[i].getCharge();
642+
charge = -charge + mol.getNuclei()[i].getCharge();
645643
charges(i) = charge;
646644
}
647645
mrcpp::mpi::allreduce_vector(charges, mrcpp::mpi::comm_wrk);
@@ -1105,9 +1103,7 @@ void driver::build_fock_operator(const json &json_fock, Molecule &mol, FockBuild
11051103
std::string azora_dir_src = AZORA_POTENTIALS_SOURCE_DIR;
11061104
std::string azora_dir_install = AZORA_POTENTIALS_INSTALL_DIR;
11071105
std::string azora_dir = "";
1108-
if (json_fock["zora_operator"].contains("azora_potential_path")) {
1109-
azora_dir = json_fock["zora_operator"]["azora_potential_path"];
1110-
}
1106+
if (json_fock["zora_operator"].contains("azora_potential_path")) { azora_dir = json_fock["zora_operator"]["azora_potential_path"]; }
11111107

11121108
std::string azora_dir_final;
11131109
if (azora_dir != "") {

src/environment/GPESolver.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void GPESolver::computeGamma(mrcpp::CompFunction<3> &potential, mrcpp::CompFunct
103103
mrcpp::AnalyticFunction<3> d_cav(C_pin->getGradVector()[d]);
104104
mrcpp::CompFunction<3> cplxfunc_prod;
105105

106-
mrcpp::FunctionTree<3, double>& Tree = get_func(d_V, d);
106+
mrcpp::FunctionTree<3, double> &Tree = get_func(d_V, d);
107107
mrcpp::multiply(cplxfunc_prod, Tree, d_cav, this->apply_prec, 1);
108108
// add result into out_gamma
109109
if (d == 0) {
@@ -247,13 +247,13 @@ mrcpp::CompFunction<3> &GPESolver::solveEquation(double prec, const Density &rho
247247

248248
Timer t_gamma;
249249
if (Vr_n.Ncomp() == 0) {
250-
mrcpp::CompFunction<3> gamma_0;
251-
mrcpp::CompFunction<3> V_tot;
252-
gamma_0.func_ptr->isreal = 1;
253-
gamma_0.alloc(1);
250+
mrcpp::CompFunction<3> gamma_0;
251+
mrcpp::CompFunction<3> V_tot;
252+
gamma_0.func_ptr->isreal = 1;
253+
gamma_0.alloc(1);
254254

255-
computeGamma(V_vac, gamma_0);
256-
this->Vr_n = solvePoissonEquation(gamma_0, rho_el);
255+
computeGamma(V_vac, gamma_0);
256+
this->Vr_n = solvePoissonEquation(gamma_0, rho_el);
257257
}
258258

259259
// update the potential/gamma before doing anything with them

src/environment/PBESolver.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void PBESolver::computeGamma(mrcpp::CompFunction<3> &potential, mrcpp::CompFunct
7878
auto C_pin = this->epsilon.getCavity_p();
7979
mrcpp::AnalyticFunction<3> d_cav(C_pin->getGradVector()[d]);
8080
mrcpp::CompFunction<3> cplxfunc_prod;
81-
mrcpp::FunctionTree<3, double>& Tree = get_func(d_V, d);
81+
mrcpp::FunctionTree<3, double> &Tree = get_func(d_V, d);
8282
mrcpp::multiply(cplxfunc_prod, Tree, d_cav, this->apply_prec, 1);
8383
// add result into out_gamma
8484
if (d == 0) {

src/mrdft/Functional.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Functional {
4848

4949
void setLogGradient(bool log) { log_grad = log; }
5050
void setDensityCutoff(double cut) { cutoff = cut; }
51-
void setDerivOp(std::unique_ptr<mrcpp::DerivativeOperator<3>> &d) {derivOp = std::move(d);}
51+
void setDerivOp(std::unique_ptr<mrcpp::DerivativeOperator<3>> &d) { derivOp = std::move(d); }
5252

5353
virtual bool isSpin() const = 0;
5454
bool isLDA() const { return (not(isGGA() or isMetaGGA())); }

src/mrenv.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
* <https://mrchem.readthedocs.io/>
2424
*/
2525

26+
#include "MRCPP/utils/parallel.h"
2627
#include <MRCPP/Printer>
2728
#include <XCFun/xcfun.h>
2829
#include <fstream>
29-
#include "MRCPP/utils/parallel.h"
3030

3131
#include "mrchem.h"
3232
#include "mrenv.h"

src/properties/GeometricDerivative.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ class GeometricDerivative final {
7474
* @brief Compute the variance of the total force using the formula
7575
* sigma = sqrt(1/(3N) * sum_i sum_j (F_{ij})^2) presented in
7676
* Gubler et al.: Journal of Computational Physics: X Volume 17, November 2023, 100131
77-
*/
77+
*/
7878
double variance() const {
7979
DoubleMatrix forces = getTensor();
8080
Eigen::Vector3d total_force = forces.colwise().sum();
81-
double force_variance = total_force.norm() * std::sqrt( 1.0 / (3.0 * forces.rows()) );
81+
double force_variance = total_force.norm() * std::sqrt(1.0 / (3.0 * forces.rows()));
8282
return force_variance;
8383
}
8484

src/properties/HirshfeldCharges.h

+2-5
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ namespace mrchem {
1212

1313
class HirshfeldCharges final {
1414
public:
15-
1615
DoubleVector getVector() const { return this->hirshfeld_charges; }
1716

1817
void setVector(const DoubleVector &v) { this->hirshfeld_charges = v; }
1918

2019
void print(const std::string &id) const {
2120
mrcpp::print::header(0, "Hirshfeld Charges (" + id + ")");
22-
mrcpp::print::separator(0, '-');
21+
mrcpp::print::separator(0, '-');
2322
for (int i = 0; i < hirshfeld_charges.size(); i++) {
2423
std::string text = "Charge of atom " + std::to_string(i);
2524
print_utils::scalar(0, text, hirshfeld_charges(i));
@@ -29,9 +28,7 @@ class HirshfeldCharges final {
2928
mrcpp::print::separator(0, '=');
3029
}
3130

32-
nlohmann::json json() const {
33-
return {{"total", print_utils::eigen_to_vector(getVector(), 1.0e-12)}};
34-
}
31+
nlohmann::json json() const { return {{"total", print_utils::eigen_to_vector(getVector(), 1.0e-12)}}; }
3532

3633
protected:
3734
DoubleVector hirshfeld_charges;

src/properties/hirshfeld/HirshfeldInterpolator.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ HirshfeldRadInterpolater::HirshfeldRadInterpolater(const std::string element, st
2727
rhoGrid = rhoGrid.array().log();
2828

2929
lnRho = std::make_shared<interpolation_utils::PolyInterpolator>(rGrid, rhoGrid);
30-
if (writeToFile) {
31-
writeInterpolatedDensity(element + ".interpolated");
32-
}
30+
if (writeToFile) { writeInterpolatedDensity(element + ".interpolated"); }
3331
}
3432

3533
// Function to evaluate the interpolated function

src/properties/hirshfeld/HirshfeldInterpolator.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#pragma once
22

3-
#include <vector>
4-
#include <Eigen/Dense>
53
#include "utils/PolyInterpolator.h"
4+
#include <Eigen/Dense>
5+
#include <vector>
66

77
class HirshfeldRadInterpolater {
88

@@ -11,18 +11,18 @@ class HirshfeldRadInterpolater {
1111
* @brief Construct a new Rad Interpolater object
1212
* @param element The element for which the ZORA potential is to be interpolated
1313
* @param data_dir The directory containing the ZORA potential data
14-
*/
14+
*/
1515
HirshfeldRadInterpolater(const std::string element, std::string data_dir, bool writeToFile = false);
1616

1717
/**
1818
* @brief Evaluate the interpolated function at a given point
1919
* @param r The point at which to evaluate
2020
* @return The interpolated value at the given point
21-
*/
21+
*/
2222
double evalf(const double &r) const;
2323

2424
/**
25-
* @brief Integrates the atomic charge density to get the charge of the tabulated
25+
* @brief Integrates the atomic charge density to get the charge of the tabulated
2626
* atomic density. The numeric is performed from 0 to 20 bohr. Only useful for debugging.
2727
*/
2828
double getNorm() const;

src/properties/hirshfeld/HirshfeldPartition.cpp

+3-10
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@ HirshfeldPartition::HirshfeldPartition(const mrchem::Molecule &mol, std::string
1212
// Uncomment the following line to print the charge of the atomic density
1313
// std::cout << "Norm of " << element << " = " << this->logDensities[i].getNorm() << std::endl;
1414
}
15-
1615
}
1716

1817
double HirshfeldPartition::getHirshfeldPartitionIntegral(int index, mrcpp::CompFunction<3> &rho, double prec) const {
19-
auto w_i_analytic = [index, this](const mrcpp::Coord<3> &r) {
20-
return this->evalf(r, index);
21-
};
18+
auto w_i_analytic = [index, this](const mrcpp::Coord<3> &r) { return this->evalf(r, index); };
2219
mrcpp::CompFunction<3> w_i_MW;
2320
mrcpp::AnalyticFunction<3> w_i_analytic_func(w_i_analytic);
2421
mrcpp::multiply(w_i_MW, rho.real(), w_i_analytic_func, prec);
@@ -34,18 +31,14 @@ double HirshfeldPartition::lseLogDens(const mrcpp::Coord<3> &r) const {
3431
mrcpp::Coord<3> nucPos;
3532
for (int i = 0; i < this->nNucs; i++) {
3633
nucPos = this->nucs->at(i).getCoord();
37-
rr = std::sqrt((r[0] - nucPos[0]) * (r[0] - nucPos[0])
38-
+ (r[1] - nucPos[1]) * (r[1] - nucPos[1])
39-
+ (r[2] - nucPos[2]) * (r[2] - nucPos[2]));
34+
rr = std::sqrt((r[0] - nucPos[0]) * (r[0] - nucPos[0]) + (r[1] - nucPos[1]) * (r[1] - nucPos[1]) + (r[2] - nucPos[2]) * (r[2] - nucPos[2]));
4035
lseLogDens_r(i) = this->logDensities[i].evalf(rr);
4136
}
4237
return mrchem::math_utils::logsumexp(lseLogDens_r);
4338
}
4439

4540
double HirshfeldPartition::evalf(const mrcpp::Coord<3> &r, int iAt) const {
4641
mrcpp::Coord<3> nucPos = this->nucs->at(iAt).getCoord();
47-
double rr = std::sqrt((r[0] - nucPos[0]) * (r[0] - nucPos[0])
48-
+ (r[1] - nucPos[1]) * (r[1] - nucPos[1])
49-
+ (r[2] - nucPos[2]) * (r[2] - nucPos[2]));
42+
double rr = std::sqrt((r[0] - nucPos[0]) * (r[0] - nucPos[0]) + (r[1] - nucPos[1]) * (r[1] - nucPos[1]) + (r[2] - nucPos[2]) * (r[2] - nucPos[2]));
5043
return std::exp(this->logDensities[iAt].evalf(rr) - this->lseLogDens(r));
5144
}

src/properties/hirshfeld/HirshfeldPartition.h

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#pragma once
22

3-
#include <Eigen/Dense>
4-
#include <mrchem.h>
53
#include "chemistry/Molecule.h"
6-
#include <string>
74
#include "chemistry/Nucleus.h"
85
#include "properties/hirshfeld/HirshfeldInterpolator.h"
6+
#include <Eigen/Dense>
7+
#include <mrchem.h>
8+
#include <string>
99

1010
/**
1111
* @brief Class for computing the Hirshfeld partitioning of a molecule. Reads and interpolates the Hirshfeld partitioning data.
1212
* can create MW representation of the Hirshfeld partitioning functions.
1313
*/
14-
class HirshfeldPartition{
14+
class HirshfeldPartition {
1515

16-
public:
16+
public:
1717
/**
1818
* @brief Construct a new Hirshfeld Partition object
1919
* @param mol The molecule for which the Hirshfeld partitioning is to be computed
@@ -26,8 +26,7 @@ class HirshfeldPartition{
2626
*/
2727
double getHirshfeldPartitionIntegral(int index, mrcpp::CompFunction<3> &rho, double prec) const;
2828

29-
protected:
30-
29+
protected:
3130
/**
3231
* @brief Evaluate the analytic, interpolated Hirshfeld partitioning function at a given point
3332
*/
@@ -52,6 +51,4 @@ class HirshfeldPartition{
5251
* @brief The atomic density interpolators for the nuclei
5352
*/
5453
std::vector<HirshfeldRadInterpolater> logDensities;
55-
56-
5754
};

src/qmfunctions/Orbital.cpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Orbital::Orbital(SPIN::type spin)
6060
*
6161
*/
6262
Orbital::Orbital(int spin, double occ, int rank)
63-
: mrcpp::CompFunction<3>(spin){
63+
: mrcpp::CompFunction<3>(spin) {
6464
if (this->spin() < 0) INVALID_ARG_ABORT;
6565
if (this->occ() < 0) {
6666
// d1 is defined as occupancy
@@ -71,7 +71,6 @@ Orbital::Orbital(int spin, double occ, int rank)
7171
this->func_ptr->rank = rank;
7272
}
7373

74-
7574
/** @brief Copy constructor
7675
*
7776
* @param orb: orbital to copy
@@ -83,7 +82,6 @@ Orbital::Orbital(int spin, double occ, int rank)
8382
Orbital::Orbital(Orbital &orb)
8483
: mrcpp::CompFunction<3>(orb) {}
8584

86-
8785
/** @brief Copy constructor
8886
*
8987
* @param orb: orbital to copy
@@ -92,11 +90,10 @@ Orbital::Orbital(Orbital &orb)
9290
* NO transfer of ownership:
9391
* both orbitals are pointing to the same tree
9492
*/
95-
//Orbital::Orbital(const mrcpp::CompFunction<3> &orb)
96-
// : mrcpp::CompFunction<3>(orb) {}
97-
Orbital::Orbital(const mrcpp::CompFunction<3>& orb)
98-
: mrcpp::CompFunction<3>(orb) {}
99-
93+
// Orbital::Orbital(const mrcpp::CompFunction<3> &orb)
94+
// : mrcpp::CompFunction<3>(orb) {}
95+
Orbital::Orbital(const mrcpp::CompFunction<3> &orb)
96+
: mrcpp::CompFunction<3>(orb) {}
10097

10198
/** @brief Complex conjugation
10299
*

0 commit comments

Comments
 (0)