Skip to content

Commit d5805a3

Browse files
authored
Merge pull request #483 from gitpeterwind/dftfix
bug fix dft energy printouts
2 parents d770722 + df39ee2 commit d5805a3

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.github/workflows/build-test.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ jobs:
2121
runs-on: ${{ matrix.os }}
2222
strategy:
2323
matrix:
24-
os: [ubuntu-latest, macos-latest]
24+
# setup-miniconda not compatible with macos-latest presently.
25+
# https://github.com/conda-incubator/setup-miniconda/issues/344
26+
os: [ubuntu-latest, macos-12]
2527

2628
steps:
2729
- uses: actions/checkout@v2
@@ -35,7 +37,7 @@ jobs:
3537
key:
3638
${{ matrix.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('.github/mrchem-gha.yml') }}
3739

38-
- uses: conda-incubator/setup-miniconda@v2
40+
- uses: conda-incubator/setup-miniconda@v3
3941
with:
4042
auto-update-conda: true
4143
auto-activate-base: false

src/mrdft/MRDFT.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,18 @@ mrcpp::FunctionTreeVector<3> MRDFT::evaluate(mrcpp::FunctionTreeVector<3> &inp)
7878
int n_start = (mrcpp::mpi::wrk_rank * nNodes) / mrcpp::mpi::wrk_size;
7979
int n_end = ((mrcpp::mpi::wrk_rank + 1) * nNodes) / mrcpp::mpi::wrk_size;
8080
DoubleVector XCenergy = DoubleVector::Zero(1);
81+
double sum = 0.0;
8182
#pragma omp parallel
8283
{
83-
#pragma omp for schedule(guided)
84+
#pragma omp for schedule(guided) reduction (+: sum)
8485
for (int n = n_start; n < n_end; n++) {
8586
vector<mrcpp::FunctionNode<3> *> xcNodes = xc_utils::fetch_nodes(n, PotVec);
8687
functional().makepot(inp, xcNodes);
87-
XCenergy[0] += xcNodes[0]->integrate();
88+
sum += xcNodes[0]->integrate();
8889
}
8990
}
91+
XCenergy[0] = sum;
92+
9093
// each mpi only has part of the results. All send their results to bank and then fetch
9194
if(mrcpp::mpi::wrk_size > 1) {
9295
// sum up the energy contrbutions from all mpi

0 commit comments

Comments
 (0)