Skip to content

Commit

Permalink
Merge pull request #483 from gitpeterwind/dftfix
Browse files Browse the repository at this point in the history
bug fix dft energy printouts
  • Loading branch information
stigrj authored May 2, 2024
2 parents d770722 + df39ee2 commit d5805a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
# setup-miniconda not compatible with macos-latest presently.
# https://github.com/conda-incubator/setup-miniconda/issues/344
os: [ubuntu-latest, macos-12]

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

- uses: conda-incubator/setup-miniconda@v2
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
auto-activate-base: false
Expand Down
7 changes: 5 additions & 2 deletions src/mrdft/MRDFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,18 @@ mrcpp::FunctionTreeVector<3> MRDFT::evaluate(mrcpp::FunctionTreeVector<3> &inp)
int n_start = (mrcpp::mpi::wrk_rank * nNodes) / mrcpp::mpi::wrk_size;
int n_end = ((mrcpp::mpi::wrk_rank + 1) * nNodes) / mrcpp::mpi::wrk_size;
DoubleVector XCenergy = DoubleVector::Zero(1);
double sum = 0.0;
#pragma omp parallel
{
#pragma omp for schedule(guided)
#pragma omp for schedule(guided) reduction (+: sum)
for (int n = n_start; n < n_end; n++) {
vector<mrcpp::FunctionNode<3> *> xcNodes = xc_utils::fetch_nodes(n, PotVec);
functional().makepot(inp, xcNodes);
XCenergy[0] += xcNodes[0]->integrate();
sum += xcNodes[0]->integrate();
}
}
XCenergy[0] = sum;

// each mpi only has part of the results. All send their results to bank and then fetch
if(mrcpp::mpi::wrk_size > 1) {
// sum up the energy contrbutions from all mpi
Expand Down

0 comments on commit d5805a3

Please sign in to comment.