Commit c8162e4 gitpeterwind
committed
1 parent 1e7ea8e commit c8162e4 Copy full SHA for c8162e4
File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -78,15 +78,18 @@ mrcpp::FunctionTreeVector<3> MRDFT::evaluate(mrcpp::FunctionTreeVector<3> &inp)
78
78
int n_start = (mrcpp::mpi::wrk_rank * nNodes) / mrcpp::mpi::wrk_size;
79
79
int n_end = ((mrcpp::mpi::wrk_rank + 1 ) * nNodes) / mrcpp::mpi::wrk_size;
80
80
DoubleVector XCenergy = DoubleVector::Zero (1 );
81
+ double sum = 0.0 ;
81
82
#pragma omp parallel
82
83
{
83
- #pragma omp for schedule(guided)
84
+ #pragma omp for schedule(guided) reduction (+: sum)
84
85
for (int n = n_start; n < n_end; n++) {
85
86
vector<mrcpp::FunctionNode<3 > *> xcNodes = xc_utils::fetch_nodes (n, PotVec);
86
87
functional ().makepot (inp, xcNodes);
87
- XCenergy[ 0 ] += xcNodes[0 ]->integrate ();
88
+ sum += xcNodes[0 ]->integrate ();
88
89
}
89
90
}
91
+ XCenergy[0 ] = sum;
92
+
90
93
// each mpi only has part of the results. All send their results to bank and then fetch
91
94
if (mrcpp::mpi::wrk_size > 1 ) {
92
95
// sum up the energy contrbutions from all mpi
You can’t perform that action at this time.
0 commit comments