Skip to content

Commit

Permalink
refactor: remove the useless loc in veff (deepmodeling#4532)
Browse files Browse the repository at this point in the history
* refactor: remove the useless loc in veff

* [pre-commit.ci lite] apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
  • Loading branch information
pxlxingliang and pre-commit-ci-lite[bot] authored Jul 1, 2024
1 parent 4eef2ca commit d474610
Show file tree
Hide file tree
Showing 4 changed files with 397 additions and 333 deletions.
1 change: 0 additions & 1 deletion source/module_esolver/esolver_ks_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,6 @@ void ESolver_KS_LCAO<TK, TR>::after_all_runners()
this->GG,
this->GK,
this->LM,
this->LOC,
this->kv,
this->pelec->wg,
GlobalC::GridD);
Expand Down
2 changes: 0 additions & 2 deletions source/module_hamilt_lcao/hamilt_lcaodft/hamilt_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ HamiltLCAO<TK, TR>::HamiltLCAO(Gint_Gamma* GG_in,
pot_in->pot_register(pot_register_in);
// effective potential term
Operator<TK>* veff = new Veff<OperatorLCAO<TK, TR>>(GG_in,
loc_in,
LM_in,
this->kv->kvec_d,
pot_in,
Expand Down Expand Up @@ -248,7 +247,6 @@ HamiltLCAO<TK, TR>::HamiltLCAO(Gint_Gamma* GG_in,
pot_in->pot_register(pot_register_in);
// Veff term
this->getOperator() = new Veff<OperatorLCAO<TK, TR>>(GK_in,
loc_in,
LM_in,
kv->kvec_d,
pot_in,
Expand Down
71 changes: 30 additions & 41 deletions source/module_hamilt_lcao/hamilt_lcaodft/operator_lcao/veff_lcao.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#ifndef VEFFLCAO_H
#define VEFFLCAO_H
#include "module_base/timer.h"
#include "module_cell/module_neighbor/sltk_grid_driver.h"
#include "module_cell/unitcell.h"
#include "module_elecstate/potentials/potential_new.h"
#include "module_hamilt_lcao/hamilt_lcaodft/local_orbital_charge.h"
#include "module_hamilt_lcao/module_gint/gint_gamma.h"
#include "module_hamilt_lcao/module_gint/gint_k.h"
#include "operator_lcao.h"
#include "module_cell/module_neighbor/sltk_grid_driver.h"
#include "module_cell/unitcell.h"

namespace hamilt
{
Expand All @@ -25,32 +24,26 @@ class Veff : public T
/// @brief Effective potential class, used for calculating Hamiltonian with grid integration tools
/// If user want to separate the contribution of V_{eff} into V_{H} and V_{XC} and V_{local pseudopotential} and so on,
/// the user can separate the Potential class into different parts, and construct different Veff class for each part.
/// @tparam TK
/// @tparam TR
/// @tparam TK
/// @tparam TR
template <typename TK, typename TR>
class Veff<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
{
public:
/**
* @brief Construct a new Veff object for multi-kpoint calculation
* @param GK_in: the pointer of Gint_k object, used for grid integration
*/
*/
Veff<OperatorLCAO<TK, TR>>(Gint_k* GK_in,
Local_Orbital_Charge* loc_in,
LCAO_Matrix* LM_in,
const std::vector<ModuleBase::Vector3<double>>& kvec_d_in,
elecstate::Potential* pot_in,
hamilt::HContainer<TR>* hR_in,
std::vector<TK>* hK_in,
const UnitCell* ucell_in,
Grid_Driver* GridD_in,
const Parallel_Orbitals* paraV)
: GK(GK_in),
loc(loc_in),
pot(pot_in),
ucell(ucell_in),
gd(GridD_in),
OperatorLCAO<TK, TR>(LM_in, kvec_d_in, hR_in, hK_in)
LCAO_Matrix* LM_in,
const std::vector<ModuleBase::Vector3<double>>& kvec_d_in,
elecstate::Potential* pot_in,
hamilt::HContainer<TR>* hR_in,
std::vector<TK>* hK_in,
const UnitCell* ucell_in,
Grid_Driver* GridD_in,
const Parallel_Orbitals* paraV)
: GK(GK_in), pot(pot_in), ucell(ucell_in), gd(GridD_in), OperatorLCAO<TK, TR>(LM_in, kvec_d_in, hR_in, hK_in)
{
this->cal_type = calculation_type::lcao_gint;

Expand All @@ -60,20 +53,17 @@ class Veff<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
/**
* @brief Construct a new Veff object for Gamma-only calculation
* @param GG_in: the pointer of Gint_Gamma object, used for grid integration
*/
*/
Veff<OperatorLCAO<TK, TR>>(Gint_Gamma* GG_in,
Local_Orbital_Charge* loc_in,
LCAO_Matrix* LM_in,
const std::vector<ModuleBase::Vector3<double>>& kvec_d_in,
elecstate::Potential* pot_in,
hamilt::HContainer<TR>* hR_in,
std::vector<TK>* hK_in,
const UnitCell* ucell_in,
Grid_Driver* GridD_in,
const Parallel_Orbitals* paraV
)
: GG(GG_in), loc(loc_in), pot(pot_in),
OperatorLCAO<TK, TR>(LM_in, kvec_d_in, hR_in, hK_in)
LCAO_Matrix* LM_in,
const std::vector<ModuleBase::Vector3<double>>& kvec_d_in,
elecstate::Potential* pot_in,
hamilt::HContainer<TR>* hR_in,
std::vector<TK>* hK_in,
const UnitCell* ucell_in,
Grid_Driver* GridD_in,
const Parallel_Orbitals* paraV)
: GG(GG_in), pot(pot_in), OperatorLCAO<TK, TR>(LM_in, kvec_d_in, hR_in, hK_in)
{
this->cal_type = calculation_type::lcao_gint;
this->initialize_HR(ucell_in, GridD_in, paraV);
Expand All @@ -86,13 +76,14 @@ class Veff<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
/**
* @brief contributeHR() is used to calculate the HR matrix
* <phi_{\mu, 0}|V_{eff}|phi_{\nu, R}>
* the contribution of V_{eff} is calculated by the contribution of V_{H} and V_{XC} and V_{local pseudopotential} and so on.
* grid integration is used to calculate the contribution Hamiltonian of effective potential
* the contribution of V_{eff} is calculated by the contribution of V_{H} and V_{XC} and V_{local pseudopotential}
* and so on. grid integration is used to calculate the contribution Hamiltonian of effective potential
*/
virtual void contributeHR() override;

const UnitCell* ucell;
Grid_Driver* gd;

const UnitCell* ucell;
Grid_Driver* gd;

private:
// used for k-dependent grid integration.
Gint_k* GK = nullptr;
Expand All @@ -101,7 +92,6 @@ class Veff<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
Gint_Gamma* GG = nullptr;

// Charge calculating method in LCAO base and contained grid base calculation: DM_R, DM, pvpR_reduced
Local_Orbital_Charge* loc = nullptr;

elecstate::Potential* pot = nullptr;

Expand All @@ -114,7 +104,6 @@ class Veff<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
* the size of HR will be fixed after initialization
*/
void initialize_HR(const UnitCell* ucell_in, Grid_Driver* GridD_in, const Parallel_Orbitals* paraV);

};

} // namespace hamilt
Expand Down
Loading

0 comments on commit d474610

Please sign in to comment.