Skip to content

Commit

Permalink
Merged in hubbardOpt (pull request #633)
Browse files Browse the repository at this point in the history
HubbardOpt

Approved-by: Sambit Das
Approved-by: Kartick Ramakrishnan
  • Loading branch information
vishal-subbu authored and dsambit committed Oct 1, 2024
2 parents 3df9b89 + 87f6a62 commit e4a48de
Show file tree
Hide file tree
Showing 25 changed files with 6,055 additions and 329 deletions.
13 changes: 3 additions & 10 deletions include/ExcDFTPlusU.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,10 @@ namespace dftfe
& src,
dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace> &dst,
const unsigned int inputVecSize,
const double factor,
const unsigned int kPointIndex,
const unsigned int spinIndex) override;

void
applyWaveFunctionDependentFuncDerWrtPsiCheby(
const dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace>
& src,
dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace> &dst,
const unsigned int inputVecSize,
const double factor,
const unsigned int kPointIndex,
const unsigned int spinIndex) override;
void
updateWaveFunctionDependentFuncDerWrtPsi(
const std::shared_ptr<AuxDensityMatrix<memorySpace>> &auxDensityMatrixPtr,
const std::vector<double> &kPointWeights) override;
Expand Down Expand Up @@ -86,6 +76,9 @@ namespace dftfe
const std::vector<xcRemainderOutputDataAttributes> &outputDataAttributes)
const override;

void
reinitKPointDependentVariables(unsigned int kPointIndex) override;

void
initialiseHubbardClass(
const MPI_Comm &mpi_comm_parent,
Expand Down
28 changes: 3 additions & 25 deletions include/ExcSSDFunctionalBaseClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ namespace dftfe
* Similarly for dst, accumulateLocallyOwned() should be called in HX()
* after this function is called. param[in] src The input vector param[out]
* dst The output vector param[in] inputVecSize The size of the input vector
* param[in] factor the factor with which the output is scaled in HX()
* param[in] kPointIndex the k point for which the HX() is called
* param[in] spinIndex the spin index for which the HX() is called
*/
Expand All @@ -110,30 +109,6 @@ namespace dftfe
& src,
dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace> &dst,
const unsigned int inputVecSize,
const double factor,
const unsigned int kPointIndex,
const unsigned int spinIndex) = 0;


/*
* @brief The apply function that will be called in HXCheby().
* The distribute() and updateGhostValues() for src
* has to be called before this function.
* Similarly, for dst, accumulateLocallyOwned() should be called in
* HXCheby() after this function is called. param[in] src The input vector
* param[out] dst The output vector
* param[in] inputVecSize The size of the input vector
* param[in] factor the factor with which the output is scaled in HX()
* param[in] kPointIndex the k point for which the HX() is called
* param[in] spinIndex the spin index for which the HX() is called
*/
virtual void
applyWaveFunctionDependentFuncDerWrtPsiCheby(
const dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace>
& src,
dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace> &dst,
const unsigned int inputVecSize,
const double factor,
const unsigned int kPointIndex,
const unsigned int spinIndex) = 0;

Expand Down Expand Up @@ -194,6 +169,9 @@ namespace dftfe
const std::vector<xcRemainderOutputDataAttributes> &outputDataAttributes)
const = 0;

virtual void
reinitKPointDependentVariables(unsigned int kPointIndex) = 0;

protected:
const std::vector<DensityDescriptorDataAttributes>
d_densityDescriptorAttributesList;
Expand Down
12 changes: 6 additions & 6 deletions include/KohnShamHamiltonianOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <oncvClass.h>
#include <AuxDensityMatrix.h>

// ************* For debugging purposes only. Remove afterwards
#include "hubbardClass.h"

namespace dftfe
Expand Down Expand Up @@ -298,12 +297,13 @@ namespace dftfe

std::shared_ptr<hubbard<dataTypes::number, memorySpace>> d_hubbardClassPtr;
bool d_useHubbard;
dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace>
d_srcNonLocalTemp;
dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace>
d_dstNonLocalTemp;

// dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace>
// d_hubbNonLocalProjectorTimesVectorBlock;

// dftfe::utils::MemoryStorage<dataTypes::number, memorySpace>
// d_cellWaveFunctionMatrixSrcHubb;
dftfe::utils::MemoryStorage<dftfe::global_size_type, memorySpace>
d_mapNodeIdToProcId;
};
} // namespace dftfe
#endif
14 changes: 3 additions & 11 deletions include/excDensityGGAClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ namespace dftfe
& src,
dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace> &dst,
const unsigned int inputVecSize,
const double factor,
const unsigned int kPointIndex,
const unsigned int spinIndex) override;

void
applyWaveFunctionDependentFuncDerWrtPsiCheby(
const dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace>
& src,
dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace> &dst,
const unsigned int inputVecSize,
const double factor,
const unsigned int kPointIndex,
const unsigned int spinIndex) override;

Expand All @@ -86,6 +75,9 @@ namespace dftfe
double
getExpectationOfWaveFunctionDependentExcFuncDerWrtPsi() override;

void
reinitKPointDependentVariables(unsigned int kPointIndex) override;

private:
NNGGA * d_NNGGAPtr;
std::shared_ptr<xc_func_type> d_funcXPtr;
Expand Down
14 changes: 3 additions & 11 deletions include/excDensityLDAClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,6 @@ namespace dftfe
& src,
dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace> &dst,
const unsigned int inputVecSize,
const double factor,
const unsigned int kPointIndex,
const unsigned int spinIndex) override;

void
applyWaveFunctionDependentFuncDerWrtPsiCheby(
const dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace>
& src,
dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace> &dst,
const unsigned int inputVecSize,
const double factor,
const unsigned int kPointIndex,
const unsigned int spinIndex) override;

Expand All @@ -85,6 +74,9 @@ namespace dftfe
double
getExpectationOfWaveFunctionDependentExcFuncDerWrtPsi() override;

void
reinitKPointDependentVariables(unsigned int kPointIndex) override;

private:
NNLDA * d_NNLDAPtr;
std::shared_ptr<xc_func_type> d_funcXPtr;
Expand Down
14 changes: 3 additions & 11 deletions include/excDensityLLMGGAClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,6 @@ namespace dftfe
& src,
dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace> &dst,
const unsigned int inputVecSize,
const double factor,
const unsigned int kPointIndex,
const unsigned int spinIndex) override;

void
applyWaveFunctionDependentFuncDerWrtPsiCheby(
const dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace>
& src,
dftfe::linearAlgebra::MultiVector<dataTypes::number, memorySpace> &dst,
const unsigned int inputVecSize,
const double factor,
const unsigned int kPointIndex,
const unsigned int spinIndex) override;

Expand All @@ -72,6 +61,9 @@ namespace dftfe
double
getExpectationOfWaveFunctionDependentExcFuncDerWrtPsi() override;

void
reinitKPointDependentVariables(unsigned int kPointIndex) override;

private:
NNLLMGGA * d_NNLLMGGAPtr;
std::shared_ptr<xc_func_type> d_funcXPtr;
Expand Down
18 changes: 0 additions & 18 deletions include/hubbardClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,24 +166,6 @@ namespace dftfe
const dftfe::linearAlgebra::MultiVector<ValueType, memorySpace> &src,
dftfe::linearAlgebra::MultiVector<ValueType, memorySpace> & dst,
const unsigned int inputVecSize,
const double factor,
const unsigned int kPointIndex,
const unsigned int spinIndex);

/*
* @brief This function is similar to above
* but used in HXCheby(). A different function is required from above as the
* src requires a different initialisation
* V_h \psi^{\sigma}_i = \sum_{I} | \phi^{I}_m> A^{I \sigma}_{m m'} < \phi^{I}_m' | \psi^{\sigma}_i >
* Where A is the coupling matrix. In the case of hubbard, it is a dense
* matrix for each atom I.
*/
void
applyPotentialDueToHubbardCorrectionCheby(
const dftfe::linearAlgebra::MultiVector<ValueType, memorySpace> &src,
dftfe::linearAlgebra::MultiVector<ValueType, memorySpace> & dst,
const unsigned int inputVecSize,
const double factor,
const unsigned int kPointIndex,
const unsigned int spinIndex);

Expand Down
11 changes: 11 additions & 0 deletions src/dft/dft.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1974,6 +1974,17 @@ namespace dftfe
dealii::ExcMessage(
"open mp is not compatible with hubbard "));

AssertThrow(d_dftParamsPtr->mixingMethod != "LOW_RANK_DIELECM_PRECOND",
dealii::ExcMessage(
"LRDM preconditioner is not compatible with hubbard "));

// band group parallelization data structures
const unsigned int numberBandGroups =
dealii::Utilities::MPI::n_mpi_processes(interBandGroupComm);

AssertThrow(numberBandGroups == 1,
dealii::ExcMessage(
"Band parallelisation is not compatible with hubbard "));

AssertThrow(
d_dftParamsPtr->overlapComputeCommunCheby == false,
Expand Down
Loading

0 comments on commit e4a48de

Please sign in to comment.