Skip to content

Commit 1e5e2c7

Browse files
committed
move polyinterpolator to utils
1 parent c78886b commit 1e5e2c7

6 files changed

+11
-6
lines changed
-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
target_sources(mrchem PRIVATE
2-
${CMAKE_CURRENT_SOURCE_DIR}/PolyInterpolator.cpp
32
${CMAKE_CURRENT_SOURCE_DIR}/HirshfeldInterpolator.cpp
43
${CMAKE_CURRENT_SOURCE_DIR}/HirshfeldPartition.cpp
54
)

src/properties/hirshfeld/HirshfeldInterpolator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ HirshfeldRadInterpolater::HirshfeldRadInterpolater(const std::string element, st
2626

2727
rhoGrid = rhoGrid.array().log();
2828

29-
lnRho = std::make_shared<PolyInterpolator>(rGrid, rhoGrid);
29+
lnRho = std::make_shared<interpolation_utils::PolyInterpolator>(rGrid, rhoGrid);
3030
if (writeToFile) {
3131
writeInterpolatedDensity(element + ".interpolated");
3232
}

src/properties/hirshfeld/HirshfeldInterpolator.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <vector>
44
#include <Eigen/Dense>
5-
#include "PolyInterpolator.h"
5+
#include "utils/PolyInterpolator.h"
66

77
class HirshfeldRadInterpolater {
88

@@ -31,7 +31,7 @@ class HirshfeldRadInterpolater {
3131
/**
3232
* @brief The interpolator for the atomic density
3333
*/
34-
std::shared_ptr<PolyInterpolator> lnRho = nullptr;
34+
std::shared_ptr<interpolation_utils::PolyInterpolator> lnRho = nullptr;
3535
/**
3636
* @brief Write the interpolated density to a file for debugging.
3737
* @param path The path to the file to write the interpolated density to.

src/utils/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
target_sources(mrchem
22
PRIVATE
3+
${CMAKE_CURRENT_SOURCE_DIR}/PolyInterpolator.cpp
34
${CMAKE_CURRENT_SOURCE_DIR}/print_utils.cpp
45
${CMAKE_CURRENT_SOURCE_DIR}/math_utils.cpp
56
${CMAKE_CURRENT_SOURCE_DIR}/NonlinearMaximizer.cpp

src/properties/hirshfeld/PolyInterpolator.cpp src/utils/PolyInterpolator.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <Eigen/Dense>
22
#include "PolyInterpolator.h"
33

4+
namespace interpolation_utils{
45
double polynomialInterpolate5(Eigen::VectorXd &x_in, Eigen::VectorXd &y_in, double x){
56
double xm2 = x_in(0);
67
double xm1 = x_in(1);
@@ -77,4 +78,5 @@ int binarySearch(const Eigen::VectorXd &x, const double &x0) {
7778
}
7879
}
7980
return i;
80-
}
81+
}
82+
} // namespace interpolation_utils

src/properties/hirshfeld/PolyInterpolator.h src/utils/PolyInterpolator.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <filesystem>
77
#include <iostream>
88

9+
namespace interpolation_utils{
10+
911
/**
1012
* @brief Interpolate a 5th order polynomial through 5 points and evaluate at x.
1113
* @param x_in x values of the 5 points
@@ -130,4 +132,5 @@ class PolyInterpolator {
130132
if (i == n - 2) j = n - 3;
131133
return j;
132134
}
133-
};
135+
};
136+
} // namespace interpolation_utils

0 commit comments

Comments
 (0)