Skip to content

Commit

Permalink
add HexxR(R)instead of Hexx(k)
Browse files Browse the repository at this point in the history
  • Loading branch information
maki49 committed Jul 6, 2024
1 parent 08518df commit 3bd6367
Show file tree
Hide file tree
Showing 7 changed files with 303 additions and 139 deletions.
5 changes: 5 additions & 0 deletions source/module_cell/klist.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ class K_Vectors
return this->nkstot_full;
}

double get_koffset(const int i) const
{
return this->koffset[i];
}

void set_nks(int value)
{
this->nks = value;
Expand Down
21 changes: 11 additions & 10 deletions source/module_hamilt_lcao/hamilt_lcaodft/hamilt_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,16 +361,17 @@ HamiltLCAO<TK, TR>::HamiltLCAO(Gint_Gamma* GG_in,
#ifdef __EXX
if (GlobalC::exx_info.info_global.cal_exx)
{
Operator<TK>* exx = new OperatorEXX<OperatorLCAO<TK, TR>>(this->hsk,
LM_in,
this->hR,
*this->kv,
LM_in->Hexxd,
LM_in->Hexxc,
exx_two_level_step,
!GlobalC::restart.info_load.restart_exx
&& GlobalC::restart.info_load.load_H);
this->getOperator()->add(exx);
Operator<TK>*exx = new OperatorEXX<OperatorLCAO<TK, TR>>(this->hsk,
LM_in,
this->hR,
*this->kv,
LM_in->Hexxd,
LM_in->Hexxc,
Add_Hexx_Type::R,
exx_two_level_step,
!GlobalC::restart.info_load.restart_exx
&& GlobalC::restart.info_load.load_H);
this->getOperator()->add(exx);
}
#endif
// if NSPIN==2, HR should be separated into two parts, save HR into this->hRS2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#ifdef __EXX

#include <RI/global/Tensor.h>
#include <RI/ri/Cell_Nearest.h>
#include "operator_lcao.h"
#include "module_cell/klist.h"
#include "module_hamilt_lcao/hamilt_lcaodft/LCAO_matrix.h"
Expand All @@ -20,7 +21,7 @@ class OperatorEXX : public T
};

#endif

enum Add_Hexx_Type { R, k };
template <typename TK, typename TR>
class OperatorEXX<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
{
Expand All @@ -32,13 +33,16 @@ class OperatorEXX<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
const K_Vectors& kv_in,
std::vector<std::map<int, std::map<TAC, RI::Tensor<double>>>>* Hexxd_in = nullptr,
std::vector<std::map<int, std::map<TAC, RI::Tensor<std::complex<double>>>>>* Hexxc_in = nullptr,
Add_Hexx_Type add_hexx_type_in = Add_Hexx_Type::R,
int* two_level_step_in = nullptr,
const bool restart_in = false);

virtual void contributeHk(int ik) override;
virtual void contributeHR() override;

private:

Add_Hexx_Type add_hexx_type = Add_Hexx_Type::R;
int current_spin = 0;
bool HR_fixed_done = false;

std::vector<std::map<int, std::map<TAC, RI::Tensor<double>>>>* Hexxd = nullptr;
Expand All @@ -53,9 +57,14 @@ class OperatorEXX<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
bool restart = false;

void add_loaded_Hexx(const int ik);
void add_loaded_HexxR() {};
void clear_loaded_HexxR() {};
const K_Vectors& kv;

LCAO_Matrix* LM = nullptr;
// if k points has no shift, use cell_nearest to reduce the memory cost
RI::Cell_Nearest<int, int, 3, double, 3> cell_nearest;
bool use_cell_nearest = true;
};

} // namespace hamilt
Expand Down
Loading

0 comments on commit 3bd6367

Please sign in to comment.