Skip to content

Commit 1dca98f

Browse files
committed
mpi working
1 parent 2f44450 commit 1dca98f

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/qmoperators/two_electron/XCPotential.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void XCPotential::setup(double prec) {
6464

6565
auto &grid = this->mrdft->grid().get();
6666
mrcpp::FunctionTreeVector<3> xc_inp = setupDensities(prec, grid);
67-
xc_out = this->mrdft->evaluate(xc_inp);
67+
mrcpp::FunctionTreeVector<3> xc_out = this->mrdft->evaluate(xc_inp);
6868

6969
// Fetch energy
7070
this->energy = this->mrdft->functional().XCenergy;
@@ -97,6 +97,7 @@ void XCPotential::setup(double prec) {
9797
auto t = timer.elapsed();
9898
mrcpp::print::tree(2, "XC operator", totNodes, totSize, t);
9999
}
100+
mrcpp::clear(xc_out, true);
100101
mrcpp::print::footer(3, timer, 2);
101102
}
102103

@@ -105,7 +106,6 @@ void XCPotential::clear() {
105106
this->energy = 0.0;
106107
for (auto &rho : this->densities) rho.free(NUMBER::Total);
107108
mrcpp::clear(this->potentials, true);
108-
mrcpp::clear(xc_out, true);
109109
clearApplyPrec();
110110
}
111111

src/qmoperators/two_electron/XCPotential.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@ class XCPotential : public QMPotential {
6363
, mrdft(std::move(F)) {}
6464
~XCPotential() override = default;
6565

66+
/**
67+
* @brief Get the XC potential. For unrestricted calculations, the potential is a vector of two functions.
68+
*/
6669
std::shared_ptr<mrcpp::FunctionTreeVector<3>> getPotentialVector() {
67-
return std::make_shared<mrcpp::FunctionTreeVector<3>>(xc_out);
70+
return std::make_shared<mrcpp::FunctionTreeVector<3>>(potentials);
6871
}
6972

7073
friend class XCOperator;
@@ -88,7 +91,6 @@ class XCPotential : public QMPotential {
8891
Orbital apply(Orbital phi) override;
8992
Orbital dagger(Orbital phi) override;
9093
QMOperatorVector apply(std::shared_ptr<QMOperator> &O) override;
91-
mrcpp::FunctionTreeVector<3> xc_out;
9294
};
9395

9496
} // namespace mrchem

src/surface_forces/xcStress.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ std::vector<Matrix3d> xcGGAStress(unique_ptr<mrdft::MRDFT> &mrdft_p, mrcpp::Func
8181
pos[1] = gridPos(i, 1);
8282
pos[2] = gridPos(i, 2);
8383
for (int j = 0; j < 3; j++) {
84-
out[i](j, j) = xcOUT(i, 0) - rhoGrid(i) * std::get<1>(xc_pots[1])->evalf(pos);
84+
out[i](j, j) = xcOUT(i, 0) - rhoGrid(i) * std::get<1>(xc_pots[0])->evalf(pos);
8585
}
8686
for (int j1 = 0; j1 < 3; j1++) {
8787
for (int j2 = 0; j2 < 3; j2++) {
@@ -122,7 +122,7 @@ std::vector<Matrix3d> xcGGASpinStress(unique_ptr<mrdft::MRDFT> &mrdft_p, mrcpp::
122122
pos[1] = gridPos(i, 1);
123123
pos[2] = gridPos(i, 2);
124124
for (int j = 0; j < 3; j++) {
125-
out[i](j, j) = xc(i, 0) - std::get<1>(xc_pots[1])->evalf(pos) * rhoGridAlpha(i) - std::get<1>(xc_pots[2])->evalf(pos) * rhoGridBeta(i);
125+
out[i](j, j) = xc(i, 0) - std::get<1>(xc_pots[0])->evalf(pos) * rhoGridAlpha(i) - std::get<1>(xc_pots[1])->evalf(pos) * rhoGridBeta(i);
126126
}
127127
for (int j1 = 0; j1 < 3; j1++) {
128128
for (int j2 = 0; j2 < 3; j2++) {

0 commit comments

Comments
 (0)