Skip to content

Commit

Permalink
remove inheritance in Gint
Browse files Browse the repository at this point in the history
  • Loading branch information
maki49 committed Jun 21, 2024
1 parent 985d3f6 commit 62eeb69
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 13 deletions.
8 changes: 3 additions & 5 deletions source/module_hamilt_lcao/module_gint/gint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void Gint::cal_gint(Gint_inout* inout)

// it's a uniform grid to save orbital values, so the delta_r is
// a constant.
const double delta_r = this->dr_uniform;
const double delta_r = this->gridt->dr_uniform;

if((inout->job==Gint_Tools::job_type::vlocal
|| inout->job==Gint_Tools::job_type::vlocal_meta)
Expand Down Expand Up @@ -483,9 +483,7 @@ void Gint::prep_grid(const Grid_Technique& gt,
this->ny = ny_in;
this->nplane = nplane_in;
this->startz_current = startz_current_in;
this->ucell= ucell_in;
this->dr_uniform=gt.dr_uniform;
this->rcuts=gt.rcuts;
this->ucell = ucell_in;
assert(nbx > 0);
assert(nby > 0);
assert(nbz >= 0);
Expand Down Expand Up @@ -603,7 +601,7 @@ void Gint::initialize_pvpR(const UnitCell& ucell_in, Grid_Driver* gd)
{
ModuleBase::Vector3<double> dtau = gd->getAdjacentTau(ad) - tau1;
double distance = dtau.norm() * ucell_in.lat0;
double rcut = this->rcuts[T1] + this->rcuts[T2];
double rcut = this->gridt->rcuts[T1] + this->gridt->rcuts[T2];

//if(distance < rcut)
// mohan reset this 2013-07-02 in Princeton
Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_lcao/module_gint/gint.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "module_hamilt_lcao/module_hcontainer/hcontainer.h"
#include "module_cell/module_neighbor/sltk_grid_driver.h"
#include "module_hamilt_lcao/module_gint/grid_technique.h"
class Gint :public Grid_Technique
class Gint
{
public:

Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_lcao/module_gint/gint_gamma_env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void Gint_Gamma::cal_env(const double* wfc, double* rho,UnitCell &ucell)
ModuleBase::TITLE("Grid_Integral","cal_env");

// it's a uniform grid to save orbital values, so the delta_r is a constant.
const double delta_r = this->dr_uniform;
const double delta_r = this->gridt->dr_uniform;
const int max_size = this->gridt->max_atom;
const int LD_pool = max_size*ucell.nwmax;

Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_lcao/module_gint/gint_k_env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void Gint_k::cal_env_k(int ik, const std::complex<double>* psi_k, double* rho,
ModuleBase::timer::tick("Gint_k", "cal_env_k");

// it's a uniform grid to save orbital values, so the delta_r is a constant.
const double delta_r = this->dr_uniform;
const double delta_r = this->gridt->dr_uniform;
const int max_size = this->gridt->max_atom;
const int LD_pool = max_size * ucell.nwmax;

Expand Down
6 changes: 3 additions & 3 deletions source/module_hamilt_lcao/module_gint/gint_k_pvpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void Gint_k::folding_vl_k(const int &ik,
Atom* atom2 = &ucell.atoms[T2];
dtau = adjs.adjacent_tau[ad] - tau1;
double distance = dtau.norm() * ucell.lat0;
double rcut = this->rcuts[T1] + this->rcuts[T2];
double rcut = this->gridt->rcuts[T1] + this->gridt->rcuts[T2];

// for the local part, only need to calculate <phi_i | phi_j> within range
// mohan note 2012-07-06
Expand Down Expand Up @@ -473,7 +473,7 @@ void Gint_k::transfer_pvpR(hamilt::HContainer<double> *hR,const UnitCell* ucell_
Atom* atom2 = &ucell.atoms[T2];
auto dtau = adjs.adjacent_tau[ad] - tau1;
double distance = dtau.norm() * ucell.lat0;
double rcut = this->rcuts[T1] + this->rcuts[T2];
double rcut = this->gridt->rcuts[T1] + this->gridt->rcuts[T2];

if(distance < rcut)
{
Expand Down Expand Up @@ -598,7 +598,7 @@ void Gint_k::transfer_pvpR(hamilt::HContainer<std::complex<double>> *hR,const Un
Atom* atom2 = &ucell.atoms[T2];
auto dtau = adjs.adjacent_tau[ad] - tau1;
double distance = dtau.norm() * ucell.lat0;
double rcut = this->rcuts[T1] + this->rcuts[T2];
double rcut = this->gridt->rcuts[T1] + this->gridt->rcuts[T2];

if(distance < rcut)
{
Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_lcao/module_gint/gint_k_sparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void Gint_k::cal_vlocal_R_sparseMatrix(const int &current_spin, const double &sp
Atom* atom2 = &ucell.atoms[T2];
dtau = gdriver.getAdjacentTau(ad) - tau1;
double distance = dtau.norm() * ucell.lat0;
double rcut = this->rcuts[T1]+this->rcuts[T2];
double rcut = this->gridt->rcuts[T1] + this->gridt->rcuts[T2];

if(distance < rcut)
{
Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_lcao/module_gint/gint_k_sparse1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ void Gint_k::cal_dvlocal_R_sparseMatrix(const int &current_spin, const double &s
Atom* atom2 = &ucell.atoms[T2];
dtau = gdriver.getAdjacentTau(ad) - tau1;
double distance = dtau.norm() * ucell.lat0;
double rcut = this->rcuts[T1] + this->rcuts[T2];
double rcut = this->gridt->rcuts[T1] + this->gridt->rcuts[T2];

if(distance < rcut)
{
Expand Down

0 comments on commit 62eeb69

Please sign in to comment.