Skip to content

Commit

Permalink
Implemented ElectrostaticAllElectronFE.t.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Avirup Sircar committed May 9, 2024
1 parent e04fb1f commit 4438f67
Show file tree
Hide file tree
Showing 22 changed files with 1,527 additions and 299 deletions.
49 changes: 49 additions & 0 deletions src/ksdft/Defaults.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/******************************************************************************
* Copyright (c) 2021. *
* The Regents of the University of Michigan and DFT-EFE developers. *
* *
* This file is part of the DFT-EFE code. *
* *
* DFT-EFE is free software: you can redistribute it and/or modify *
* it under the terms of the Lesser GNU General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version. *
* *
* DFT-EFE is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the Lesser GNU General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License at the top level of DFT-EFE distribution. If not, see *
* <https://www.gnu.org/licenses/>. *
******************************************************************************/

/*
* @author Avirup Sircar
*/
#include <ksdft/Defaults.h>
#include <limits.h>
namespace dftefe
{
namespace ksdft
{
/**
* @brief Setting all the PoissonProblemDefaults
*/
const linearAlgebra::PreconditionerType PoissonProblemDefaults::PC_TYPE =
linearAlgebra::PreconditionerType::JACOBI;
const size_type PoissonProblemDefaults::MAX_CELL_TIMES_NUMVECS = 50;
const size_type PoissonProblemDefaults::MAX_ITER = 1e8;
const double PoissonProblemDefaults::ABSOLUTE_TOL = 1e-13;
const double PoissonProblemDefaults::RELATIVE_TOL = 1e-14;
const double PoissonProblemDefaults::DIVERGENCE_TOL = 1e6;

/**
* @brief Setting all the LinearEigenSolverDefaults
*/
const double LinearEigenSolverDefaults::ILL_COND_TOL = 1e-14;
const double LinearEigenSolverDefaults::LANCZOS_EXTREME_EIGENVAL_TOL = 1e-6;

} // end of namespace ksdft
} // end of namespace dftefe
90 changes: 90 additions & 0 deletions src/ksdft/Defaults.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/******************************************************************************
* Copyright (c) 2021. *
* The Regents of the University of Michigan and DFT-EFE developers. *
* *
* This file is part of the DFT-EFE code. *
* *
* DFT-EFE is free software: you can redistribute it and/or modify *
* it under the terms of the Lesser GNU General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version. *
* *
* DFT-EFE is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the Lesser GNU General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License at the top level of DFT-EFE distribution. If not, see *
* <https://www.gnu.org/licenses/>. *
******************************************************************************/

/*
* @author Avirup Sircar
*/

#ifndef dftefeDFTDefaults_h
#define dftefeDFTDefaults_h

#include <utils/TypeConfig.h>
#include <string>
#include <linearAlgebra/LinearAlgebraTypes.h>

namespace dftefe
{
namespace ksdft
{
class PoissonProblemDefaults
{
public:
//
// The CG Preconditioner Type chosen for L2 Projection
//
static const linearAlgebra::PreconditionerType PC_TYPE;

//
// The number of batched gemms done
//
static const size_type MAX_CELL_TIMES_NUMVECS;

//
// Maximum iteration for CG
//
static const size_type MAX_ITER;

//
// Absolute tolerance of the residual |AX-b|
//
static const double ABSOLUTE_TOL;

//
// Relative tolerance of the residual |AX-b|/|b|
//
static const double RELATIVE_TOL;

//
// Maximum residual tolerance for divergence
//
static const double DIVERGENCE_TOL;

}; // end of class PoissonProblemDefaults

class LinearEigenSolverDefaults
{
public:
//
// Tolerance of ill conditioning for the
// orthogonalization step in CHFSi
//
static const double ILL_COND_TOL;

//
// Tolerance for lanczos extreme eigenvalues
//
static const double LANCZOS_EXTREME_EIGENVAL_TOL;

}; // end of class PoissonProblemDefaults

} // end of namespace ksdft
} // end of namespace dftefe
#endif // dftefeDFTDefaults_h
19 changes: 16 additions & 3 deletions src/ksdft/ElectrostaticAllElectronFE.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,25 @@ namespace dftefe
getLocal(Storage cellWiseStorage) const override;
void
evalEnergy() const;
RealType<ValueType>
ValueType
getEnergy() const override;

private:
const basis::FEBasisDataStorage<ValueTypeBasisData, memorySpace>
*d_feBasisDataStorage;
void
nuclearSelfEnergy();

const size_type d_numComponents;
const quadrature::QuadratureValuesContainer<RealType, memorySpace>
d_totalChargeDensity;
const quadrature::QuadratureValuesContainer<RealType, memorySpace>
d_nuclearChargesDensity;
const quadrature::QuadratureValuesContainer<RealType, memorySpace>
d_totalChargePotentialQuad;
std::shared_ptr<const basis::FEBasisOperations<ValueTypeBasisCoeff,
ValueTypeBasisData,
memorySpace,
dim>>
d_feBasisOp;
}; // end of class ElectrostaticAllElectronFE
} // end of namespace ksdft
} // end of namespace dftefe
Expand Down
Loading

0 comments on commit 4438f67

Please sign in to comment.