diff --git a/src/dft/dos.cc b/src/dft/dos.cc index b953d3bcb..e2d006159 100644 --- a/src/dft/dos.cc +++ b/src/dft/dos.cc @@ -179,9 +179,24 @@ namespace dftfe const double totalEigenValues = eigenValuesAllkPoints.size(); const double intervalSize = 0.001; const double sigma = C_kb * d_dftParamsPtr->TVal; - const double lowerBoundEpsilon = 1.5 * eigenValuesAllkPoints[0]; - const double upperBoundEpsilon = + double lowerBoundEpsilon = 1.5 * eigenValuesAllkPoints[0]; + double upperBoundEpsilon = eigenValuesAllkPoints[totalEigenValues - 1] * 1.5; + + MPI_Allreduce(MPI_IN_PLACE, + &lowerBoundEpsilon, + 1, + dataTypes::mpi_type_id(&lowerBoundEpsilon), + MPI_MIN, + interpoolcomm); + + MPI_Allreduce(MPI_IN_PLACE, + &upperBoundEpsilon, + 1, + dataTypes::mpi_type_id(&upperBoundEpsilon), + MPI_MAX, + interpoolcomm); + const unsigned int numberIntervals = std::ceil((upperBoundEpsilon - lowerBoundEpsilon) / intervalSize); @@ -386,6 +401,21 @@ namespace dftfe double lowerBoundEpsilon = 1.5 * eigenValuesAllkPoints[0]; double upperBoundEpsilon = eigenValuesAllkPoints[totalEigenValues - 1] * 1.5; + + MPI_Allreduce(MPI_IN_PLACE, + &lowerBoundEpsilon, + 1, + dataTypes::mpi_type_id(&lowerBoundEpsilon), + MPI_MIN, + interpoolcomm); + + MPI_Allreduce(MPI_IN_PLACE, + &upperBoundEpsilon, + 1, + dataTypes::mpi_type_id(&upperBoundEpsilon), + MPI_MAX, + interpoolcomm); + unsigned int numberIntervals = std::ceil((upperBoundEpsilon - lowerBoundEpsilon) / intervalSize); unsigned int numberGlobalAtoms = atomLocations.size(); @@ -967,6 +997,20 @@ namespace dftfe double upperBoundEpsilon = eigenValuesAllkPoints[totalEigenValues - 1] * 1.5; + MPI_Allreduce(MPI_IN_PLACE, + &lowerBoundEpsilon, + 1, + dataTypes::mpi_type_id(&lowerBoundEpsilon), + MPI_MIN, + interpoolcomm); + + MPI_Allreduce(MPI_IN_PLACE, + &upperBoundEpsilon, + 1, + dataTypes::mpi_type_id(&upperBoundEpsilon), + MPI_MAX, + interpoolcomm); + unsigned int numberIntervals = std::ceil((upperBoundEpsilon - lowerBoundEpsilon) / intervalSize); std::vector partialDensityOfStates; diff --git a/src/dft/kohnShamEigenSolve.cc b/src/dft/kohnShamEigenSolve.cc index 93b36e041..1fa463d4e 100644 --- a/src/dft/kohnShamEigenSolve.cc +++ b/src/dft/kohnShamEigenSolve.cc @@ -1023,15 +1023,12 @@ namespace dftfe if (factor <= 0.0) { double temp2 = 1.0 / (1.0 + exp(factor)); - functionValue = (2.0 - d_dftParamsPtr->spinPolarized) * - d_kPointWeights[kPoint] * temp2; + functionValue = (2.0 - d_dftParamsPtr->spinPolarized)*temp2; } else { double temp2 = 1.0 / (1.0 + exp(-factor)); - functionValue = (2.0 - d_dftParamsPtr->spinPolarized) * - d_kPointWeights[kPoint] * exp(-factor) * - temp2; + functionValue = (2.0 - d_dftParamsPtr->spinPolarized) * exp(-factor) * temp2; } if (functionValue > 1e-3) highestOccupiedState = i;