diff --git a/include/dft.h b/include/dft.h index 31683c214..02fe4c22b 100644 --- a/include/dft.h +++ b/include/dft.h @@ -289,7 +289,7 @@ namespace dftfe * @brief Number of Kohn-Sham eigen values to be computed */ unsigned int d_numEigenValues; - unsigned int d_highestStateForNscfCalculation; + unsigned int d_highestStateForResidualComputation; /** * @brief Number of Kohn-Sham eigen values to be computed in the Rayleigh-Ritz step * after spectrum splitting. @@ -1189,7 +1189,6 @@ namespace dftfe */ void compute_tdos(const std::vector> &eigenValuesInput, - const unsigned int highestStateOfInterest, const std::string & fileName); void diff --git a/src/dft/dft.cc b/src/dft/dft.cc index 3f124abdb..7e3d48a85 100644 --- a/src/dft/dft.cc +++ b/src/dft/dft.cc @@ -532,13 +532,13 @@ namespace dftfe pcout << "Setting netcharge " << d_dftParamsPtr->netCharge << std::endl; if (d_dftParamsPtr->solverMode == "NSCF" && - d_dftParamsPtr->numberEigenValues == 0 && d_dftParamsPtr->highestStateOfInterestForChebFiltering != 0) { - d_numEigenValues = + d_numEigenValues = std::max( + static_cast(d_dftParamsPtr->numberEigenValues), std::max(d_dftParamsPtr->highestStateOfInterestForChebFiltering * 1.1, d_dftParamsPtr->highestStateOfInterestForChebFiltering + - 10.0); + 10.0)); if (d_dftParamsPtr->verbosity >= 1) { pcout @@ -2002,7 +2002,7 @@ namespace dftfe interpoolcomm, d_dftParamsPtr, fermiEnergy, - d_highestStateForNscfCalculation); + d_highestStateForResidualComputation); } #ifdef DFTFE_WITH_DEVICE else if constexpr (dftfe::utils::MemorySpace::DEVICE == memorySpace) @@ -2021,7 +2021,7 @@ namespace dftfe interpoolcomm, d_dftParamsPtr, fermiEnergy, - d_highestStateForNscfCalculation); + d_highestStateForResidualComputation); } #endif @@ -2052,9 +2052,7 @@ namespace dftfe writeGSElectronDensity("densityQuadData.txt"); if (d_dftParamsPtr->writeDosFile) - compute_tdos(eigenValues, - d_dftParamsPtr->highestStateOfInterestForChebFiltering, - "dosData.out"); + compute_tdos(eigenValues, "dosData.out"); if (d_dftParamsPtr->writeLdosFile) compute_ldos(eigenValues, "ldosData.out"); diff --git a/src/dft/dos.cc b/src/dft/dos.cc index fec585df9..57b6a6a79 100644 --- a/src/dft/dos.cc +++ b/src/dft/dos.cc @@ -147,7 +147,6 @@ namespace dftfe void dftClass::compute_tdos( const std::vector> &eigenValuesInput, - const unsigned int highestStateOfInterest, const std::string & dosFileName) { computing_timer.enter_subsection("DOS computation"); @@ -155,7 +154,8 @@ namespace dftfe // from 0th spin as this is only to get a printing range std::vector eigenValuesAllkPoints; for (int kPoint = 0; kPoint < d_kPointWeights.size(); ++kPoint) - for (int statesIter = 0; statesIter <= d_highestStateForNscfCalculation; + for (int statesIter = 0; + statesIter <= d_highestStateForResidualComputation; ++statesIter) eigenValuesAllkPoints.push_back(eigenValuesInput[kPoint][statesIter]); @@ -206,7 +206,7 @@ namespace dftfe ++spinType) { for (unsigned int statesIter = 0; - statesIter <= d_highestStateForNscfCalculation; + statesIter <= d_highestStateForResidualComputation; ++statesIter) { double term1 = @@ -252,7 +252,7 @@ namespace dftfe for (int kPoint = 0; kPoint < d_kPointWeights.size(); ++kPoint) { for (unsigned int statesIter = 0; - statesIter <= d_highestStateForNscfCalculation; + statesIter <= d_highestStateForResidualComputation; ++statesIter) { double term1 = diff --git a/src/dft/kohnShamEigenSolve.cc b/src/dft/kohnShamEigenSolve.cc index 1666129ad..55f9c4b25 100644 --- a/src/dft/kohnShamEigenSolve.cc +++ b/src/dft/kohnShamEigenSolve.cc @@ -1002,7 +1002,7 @@ namespace dftfe maxHighestOccupiedStateResNorm = dealii::Utilities::MPI::max(maxHighestOccupiedStateResNorm, interpoolcomm); - d_highestStateForNscfCalculation = highestState; + d_highestStateForResidualComputation = highestState; return maxHighestOccupiedStateResNorm; } // compute the maximum of the residual norm of the highest occupied state @@ -1043,7 +1043,7 @@ namespace dftfe residualNormWaveFunctionsAllkPoints[kPoint] [highestOccupiedState]; } - d_highestStateForNscfCalculation = highestOccupiedState; + d_highestStateForResidualComputation = highestOccupiedState; } } else @@ -1075,14 +1075,10 @@ namespace dftfe highestOccupiedState = i; } - d_highestStateForNscfCalculation = std::min( - d_numEigenValues - 1, - std::max(static_cast(highestOccupiedState * 1.2), - highestOccupiedState + - 5)); // 5 buffer states for dos and pdos plot - //(We need to take a call on this because the residual norm - // converges slowly if we go far from fermi energy) - for (unsigned int i = 0; i <= d_highestStateForNscfCalculation; i++) + d_highestStateForResidualComputation = highestOccupiedState; + + for (unsigned int i = 0; i <= d_highestStateForResidualComputation; + i++) { if (residualNormWaveFunctionsAllkPoints[kPoint][i] > maxHighestOccupiedStateResNorm) diff --git a/src/pseudo/oncv/atomCenteredPostProcessing.cc b/src/pseudo/oncv/atomCenteredPostProcessing.cc index 7f6627904..bd1767022 100644 --- a/src/pseudo/oncv/atomCenteredPostProcessing.cc +++ b/src/pseudo/oncv/atomCenteredPostProcessing.cc @@ -339,8 +339,9 @@ namespace dftfe const double intervalSize = dftParamsPtr->intervalSize / C_haToeV; // eV to Ha - double lowerBoundEpsilon = std::floor(eigenValuesAllkPoints[0]*100)/100; - double upperBoundEpsilon = std::ceil(eigenValuesAllkPoints[totalEigenValues - 1]*100)/100; + double lowerBoundEpsilon = std::floor(eigenValuesAllkPoints[0] * 100) / 100; + double upperBoundEpsilon = + std::ceil(eigenValuesAllkPoints[totalEigenValues - 1] * 100) / 100; MPI_Allreduce(MPI_IN_PLACE, &lowerBoundEpsilon, @@ -973,9 +974,9 @@ namespace dftfe dftParamsPtr->verbosity == 0 && atomId == 0) { double epsValueTrunc = - std::floor(100000 * epsValue * C_haToeV) / - 100000; - pcout << std::fixed << std::setprecision(5) << std::setw(15) << epsValueTrunc << "\t"; + std::floor(100000 * epsValue * C_haToeV) / 100000; + pcout << std::fixed << std::setprecision(5) + << std::setw(15) << epsValueTrunc << "\t"; } std::vector pdosVec; @@ -1032,17 +1033,15 @@ namespace dftfe dftParamsPtr->verbosity == 0 && atomId == 0) { pcout << std::setw(15) - << std::floor(100000 * pdosSumUp) / - 100000 + << std::floor(100000 * pdosSumUp) / 100000 << "\t"; for (auto it = pdosVec.begin(); it != pdosVec.end(); ++it) { pcout << std::setw(15) - << std::floor((*it) * 100000) / - 100000 - << "\t"; + << std::floor((*it) * 100000) / 100000 + << "\t"; } pcout << std::endl; } @@ -1066,13 +1065,12 @@ namespace dftfe dftParamsPtr->verbosity == 0 && atomId == 0) { pcout << std::setw(15) - << std::floor(pdosSumUp * 100000) / - 100000 - << "\t"; - pcout << std::setw(15) - << std::floor(pdosSumDown * 100000) / - 100000 + << std::floor(pdosSumUp * 100000) / 100000 << "\t"; + pcout + << std::setw(15) + << std::floor(pdosSumDown * 100000) / 100000 + << "\t"; for (auto it = pdosVec.begin(); it != pdosVec.begin() + pdosVec.size() / 2;