Skip to content
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
c83e361
Use template to reconstruct parse_expression
1041176461 Jan 21, 2023
cdf3c0c
Feature: output R matrix at each MD step
1041176461 Jan 23, 2023
cff6e08
Modify'matrix_HS' to 'matrix' for R matrix output
1041176461 Jan 23, 2023
b9db1f1
Merge branch 'develop' into develop
1041176461 Jan 23, 2023
6c1a77b
Merge branch 'develop' of https://github.com/1041176461/abacus-develo…
1041176461 Jan 31, 2023
cc149a5
Merge branches 'develop' and 'develop' of https://github.com/10411764…
Feb 11, 2023
992ba96
Merge branch 'develop' of https://github.com/1041176461/abacus-develo…
Feb 11, 2023
0c753e2
Merge branch 'deepmodeling:develop' into develop
1041176461 Feb 12, 2023
3fd87f3
Merge branch 'develop' of https://github.com/1041176461/abacus-develo…
Feb 14, 2023
2a81795
Fix: modify index in parse_expression
1041176461 Feb 15, 2023
3523c57
Merge branch 'deepmodeling:develop' into develop
1041176461 Mar 27, 2023
afe397c
Fix: add regfree for parse_expression
May 10, 2023
d7775cf
Merge branch 'develop' into develop
1041176461 May 10, 2023
aad3e5a
Merge branch 'develop' into develop
Qianruipku May 10, 2023
4375864
Merge branch 'deepmodeling:develop' into develop
1041176461 May 21, 2023
d91a9e9
Doc: update phonopy doc
1041176461 Jun 5, 2023
238d73f
Merge branch 'deepmodeling:develop' into develop
1041176461 Jun 5, 2023
cdc685a
Doc: update phonopy doc
1041176461 Jun 5, 2023
47bc26b
Merge branch 'develop' of https://github.com/1041176461/abacus-develo…
1041176461 Jun 5, 2023
2ecdcca
Merge branch 'deepmodeling:develop' into develop
1041176461 Jun 24, 2023
53eeedf
Merge branch 'deepmodeling:develop' into develop
1041176461 Aug 30, 2023
b22769e
Merge branch 'deepmodeling:develop' into develop
1041176461 Sep 4, 2023
89d7394
Merge branch 'deepmodeling:develop' into develop
1041176461 Oct 30, 2023
d09f2d8
Merge branch 'deepmodeling:develop' into develop
1041176461 Apr 8, 2024
2673ecc
fix tdos plot for nspin=2
1041176461 Apr 8, 2024
3d2d8dd
optimize dosplot for nspin=2
1041176461 Apr 8, 2024
d919681
fix legend for dosplot
1041176461 Apr 8, 2024
76defcd
Merge branch 'develop' into develop
1041176461 Apr 8, 2024
560a60c
Merge branch 'deepmodeling:develop' into develop
1041176461 May 8, 2024
47d5cac
Merge branch 'deepmodeling:develop' into develop
1041176461 Jul 3, 2024
8e0c6d8
Merge branch 'deepmodeling:develop' into develop
1041176461 Oct 13, 2024
90e4750
Merge branch 'deepmodeling:develop' into develop
1041176461 Oct 19, 2024
e21da57
Refactor: modify exx loop for relax/md
1041176461 Nov 2, 2024
ced029a
add exx when istep>0
maki49 Nov 2, 2024
7740356
Merge pull request #8 from maki49/new_loop
1041176461 Nov 3, 2024
d15217c
Merge pull request #7 from 1041176461/new_loop
1041176461 Nov 3, 2024
2755221
Merge branch 'develop' into develop
1041176461 Nov 4, 2024
9b7df7d
Update dos.py
1041176461 Nov 4, 2024
a8a9051
Update esolver_sdft_pw.cpp
1041176461 Nov 4, 2024
ba09ba9
Update lcao_before_scf.cpp
1041176461 Nov 4, 2024
f5734d4
Update Exx_LRI_interface.h
1041176461 Nov 4, 2024
cacaf93
Update Exx_LRI_interface.hpp
1041176461 Nov 4, 2024
894cb25
Fix: compile error
1041176461 Nov 4, 2024
7c54ec6
Fix: compile error
1041176461 Nov 4, 2024
8c7c0e6
Fix: change HSE relax/md result.ref for new framework
1041176461 Nov 5, 2024
3df2804
Merge branch 'pr/1041176461/9' into develop
1041176461 Nov 6, 2024
9a820d2
Fix: compile error
1041176461 Nov 6, 2024
ebfdadc
compatible with exx_iter_finish
1041176461 Nov 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/module_esolver/esolver_ks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ void ESolver_KS<T, Device>::runner(const int istep, UnitCell& ucell)
this->update_pot(istep, iter);

// 10) finish scf iterations
this->iter_finish(iter);
this->iter_finish(istep, iter);
#ifdef __MPI
double duration = (double)(MPI_Wtime() - iterstart);
#else
Expand Down Expand Up @@ -675,7 +675,7 @@ void ESolver_KS<T, Device>::runner(const int istep, UnitCell& ucell)
};

template <typename T, typename Device>
void ESolver_KS<T, Device>::iter_finish(int& iter)
void ESolver_KS<T, Device>::iter_finish(const int istep, int& iter)
{
// 1 means Harris-Foulkes functional
// 2 means Kohn-Sham functional
Expand Down
2 changes: 1 addition & 1 deletion source/module_esolver/esolver_ks.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ESolver_KS : public ESolver_FP
virtual void iter_init(const int istep, const int iter) {};

//! Something to do after hamilt2density function in each iter loop.
virtual void iter_finish(int& iter);
virtual void iter_finish(const int istep, int& iter);

//! Something to do after SCF iterations when SCF is converged or comes to the max iter step.
virtual void after_scf(const int istep) override;
Expand Down
16 changes: 11 additions & 5 deletions source/module_esolver/esolver_ks_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,13 +625,15 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(const int istep, const int iter)
// calculate exact-exchange
if (GlobalC::exx_info.info_ri.real_number)
{
this->exd->exx_eachiterinit(*dynamic_cast<const elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM(),
this->exd->exx_eachiterinit(istep,
*dynamic_cast<const elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM(),
this->kv,
iter);
}
else
{
this->exc->exx_eachiterinit(*dynamic_cast<const elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM(),
this->exc->exx_eachiterinit(istep,
*dynamic_cast<const elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM(),
this->kv,
iter);
}
Expand Down Expand Up @@ -914,12 +916,12 @@ void ESolver_KS_LCAO<TK, TR>::update_pot(const int istep, const int iter)
//! 5) cal_MW? (why put it here?)
//------------------------------------------------------------------------------
template <typename TK, typename TR>
void ESolver_KS_LCAO<TK, TR>::iter_finish(int& iter)
void ESolver_KS_LCAO<TK, TR>::iter_finish(const int istep, int& iter)
{
ModuleBase::TITLE("ESolver_KS_LCAO", "iter_finish");

// call iter_finish() of ESolver_KS
ESolver_KS<TK>::iter_finish(iter);
ESolver_KS<TK>::iter_finish(istep, iter);

// 1) mix density matrix if mixing_restart + mixing_dmr + not first
// mixing_restart at every iter
Expand All @@ -943,7 +945,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(int& iter)
// 3) save exx matrix
int two_level_step = GlobalC::exx_info.info_ri.real_number ? this->exd->two_level_step : this->exc->two_level_step;

if (GlobalC::restart.info_save.save_H && two_level_step > 0
if (GlobalC::restart.info_save.save_H && (two_level_step > 0 || istep > 0)
&& (!GlobalC::exx_info.info_global.separate_loop || iter == 1)) // to avoid saving the same value repeatedly
{
////////// for Add_Hexx_Type::k
Expand Down Expand Up @@ -991,23 +993,27 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(int& iter)
}
if (GlobalC::exx_info.info_ri.real_number)
{
this->exd->dm_last_step = dynamic_cast<const elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM();
this->conv_esolver = this->exd->exx_after_converge(
*this->p_hamilt,
*dynamic_cast<const elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM(),
this->kv,
PARAM.inp.nspin,
iter,
istep,
this->pelec->f_en.etot,
this->scf_ene_thr);
}
else
{
this->exc->dm_last_step = dynamic_cast<const elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM();
this->conv_esolver = this->exc->exx_after_converge(
*this->p_hamilt,
*dynamic_cast<const elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM(),
this->kv,
PARAM.inp.nspin,
iter,
istep,
this->pelec->f_en.etot,
this->scf_ene_thr);
}
Expand Down
2 changes: 1 addition & 1 deletion source/module_esolver/esolver_ks_lcao.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ESolver_KS_LCAO : public ESolver_KS<TK> {

virtual void update_pot(const int istep, const int iter) override;

virtual void iter_finish(int& iter) override;
virtual void iter_finish(const int istep, int& iter) override;

virtual void after_scf(const int istep) override;

Expand Down
4 changes: 2 additions & 2 deletions source/module_esolver/esolver_ks_lcaopw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ namespace ModuleESolver
}

template <typename T>
void ESolver_KS_LIP<T>::iter_finish(int& iter)
void ESolver_KS_LIP<T>::iter_finish(const int istep, int& iter)
{
ESolver_KS_PW<T>::iter_finish(iter);
ESolver_KS_PW<T>::iter_finish(istep, iter);

#ifdef __EXX
if (GlobalC::exx_info.info_global.cal_exx && this->conv_esolver)
Expand Down
2 changes: 1 addition & 1 deletion source/module_esolver/esolver_ks_lcaopw.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace ModuleESolver

protected:
virtual void iter_init(const int istep, const int iter) override;
virtual void iter_finish(int& iter) override;
virtual void iter_finish(const int istep, int& iter) override;

virtual void allocate_hamilt() override;
virtual void deallocate_hamilt() override;
Expand Down
4 changes: 2 additions & 2 deletions source/module_esolver/esolver_ks_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,10 @@ void ESolver_KS_PW<T, Device>::update_pot(const int istep, const int iter)
}

template <typename T, typename Device>
void ESolver_KS_PW<T, Device>::iter_finish(int& iter)
void ESolver_KS_PW<T, Device>::iter_finish(const int istep, int& iter)
{
// call iter_finish() of ESolver_KS
ESolver_KS<T, Device>::iter_finish(iter);
ESolver_KS<T, Device>::iter_finish(istep, iter);

// liuyu 2023-10-24
// D in uspp need vloc, thus needs update when veff updated
Expand Down
2 changes: 1 addition & 1 deletion source/module_esolver/esolver_ks_pw.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ESolver_KS_PW : public ESolver_KS<T, Device>

virtual void update_pot(const int istep, const int iter) override;

virtual void iter_finish(int& iter) override;
virtual void iter_finish(const int istep, int& iter) override;

virtual void after_scf(const int istep) override;

Expand Down
4 changes: 2 additions & 2 deletions source/module_esolver/esolver_sdft_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ void ESolver_SDFT_PW<T, Device>::before_scf(const int istep)
}

template <typename T, typename Device>
void ESolver_SDFT_PW<T, Device>::iter_finish(int& iter)
void ESolver_SDFT_PW<T, Device>::iter_finish(const int istep, int& iter)
{
// call iter_finish() of ESolver_KS
ESolver_KS<T, Device>::iter_finish(iter);
ESolver_KS<T, Device>::iter_finish(istep, iter);
}

template <typename T, typename Device>
Expand Down
2 changes: 1 addition & 1 deletion source/module_esolver/esolver_sdft_pw.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ESolver_SDFT_PW : public ESolver_KS_PW<T, Device>

virtual void others(const int istep) override;

virtual void iter_finish(int& iter) override;
virtual void iter_finish(const int istep, int& iter) override;

virtual void after_scf(const int istep) override;

Expand Down
5 changes: 3 additions & 2 deletions source/module_esolver/lcao_before_scf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ void ESolver_KS_LCAO<TK, TR>::beforesolver(const int istep)
orb_,
DM
#ifdef __EXX
, istep
, GlobalC::exx_info.info_ri.real_number ? &this->exd->two_level_step : &this->exc->two_level_step
, GlobalC::exx_info.info_ri.real_number ? &exx_lri_double->Hexxs : nullptr
, GlobalC::exx_info.info_ri.real_number ? nullptr : &exx_lri_complex->Hexxs
Expand Down Expand Up @@ -210,11 +211,11 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(const int istep)
#ifdef __EXX // set xc type before the first cal of xc in pelec->init_scf
if (GlobalC::exx_info.info_ri.real_number)
{
this->exd->exx_beforescf(this->kv, *this->p_chgmix, GlobalC::ucell, orb_);
this->exd->exx_beforescf(istep, this->kv, *this->p_chgmix, GlobalC::ucell, orb_);
}
else
{
this->exc->exx_beforescf(this->kv, *this->p_chgmix, GlobalC::ucell, orb_);
this->exc->exx_beforescf(istep, this->kv, *this->p_chgmix, GlobalC::ucell, orb_);
}
#endif // __EXX

Expand Down
2 changes: 2 additions & 0 deletions source/module_hamilt_lcao/hamilt_lcaodft/hamilt_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ HamiltLCAO<TK, TR>::HamiltLCAO(Gint_Gamma* GG_in,
const LCAO_Orbitals& orb,
elecstate::DensityMatrix<TK, double>* DM_in
#ifdef __EXX
, const int istep
, int* exx_two_level_step
, std::vector<std::map<int, std::map<TAC, RI::Tensor<double>>>>* Hexxd
, std::vector<std::map<int, std::map<TAC, RI::Tensor<std::complex<double>>>>>* Hexxc
Expand Down Expand Up @@ -397,6 +398,7 @@ HamiltLCAO<TK, TR>::HamiltLCAO(Gint_Gamma* GG_in,
Hexxd,
Hexxc,
Add_Hexx_Type::R,
istep,
exx_two_level_step,
!GlobalC::restart.info_load.restart_exx
&& GlobalC::restart.info_load.load_H);
Expand Down
3 changes: 3 additions & 0 deletions source/module_hamilt_lcao/hamilt_lcaodft/hamilt_lcao.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class HamiltLCAO : public Hamilt<TK>
const LCAO_Orbitals& orb,
elecstate::DensityMatrix<TK, double>* DM_in
#ifdef __EXX
, const int istep
, int* exx_two_level_step = nullptr
, std::vector<std::map<int, std::map<TAC, RI::Tensor<double>>>>* Hexxd = nullptr
, std::vector<std::map<int, std::map<TAC, RI::Tensor<std::complex<double>>>>>* Hexxc = nullptr
Expand Down Expand Up @@ -105,6 +106,8 @@ class HamiltLCAO : public Hamilt<TK>
/// current_spin for NSPIN=2, 0: hamiltonian for spin up, 1: hamiltonian for spin down
int current_spin = 0;

const int istep = 0;

// sk and hk will be refactored to HamiltLCAO later
// std::vector<TK> sk;
// std::vector<TK> hk;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class OperatorEXX<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
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,
const int istep_in = 0,
int* two_level_step_in = nullptr,
const bool restart_in = false);

Expand All @@ -54,6 +55,8 @@ class OperatorEXX<OperatorLCAO<TK, TR>> : public OperatorLCAO<TK, TR>
/// @brief if restart, read and save Hexx, and directly use it during the first outer loop.
bool restart = false;

const int istep = 0; // the ion step

void add_loaded_Hexx(const int ik);

const K_Vectors& kv;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,15 @@ OperatorEXX<OperatorLCAO<TK, TR>>::OperatorEXX(HS_Matrix_K<TK>* hsk_in,
std::vector<std::map<int, std::map<TAC, RI::Tensor<double>>>>* Hexxd_in,
std::vector<std::map<int, std::map<TAC, RI::Tensor<std::complex<double>>>>>* Hexxc_in,
Add_Hexx_Type add_hexx_type_in,
int* two_level_step_in,
const int istep,
int* two_level_step_in,
const bool restart_in)
: OperatorLCAO<TK, TR>(hsk_in, kv_in.kvec_d, hR_in),
kv(kv_in),
Hexxd(Hexxd_in),
Hexxc(Hexxc_in),
add_hexx_type(add_hexx_type_in),
istep(istep),
two_level_step(two_level_step_in),
restart(restart_in)
{
Expand Down Expand Up @@ -201,7 +203,7 @@ void OperatorEXX<OperatorLCAO<TK, TR>>::contributeHR()
{
ModuleBase::TITLE("OperatorEXX", "contributeHR");
// Peize Lin add 2016-12-03
if (PARAM.inp.calculation != "nscf" && this->two_level_step != nullptr && *this->two_level_step == 0 && !this->restart) { return; } //in the non-exx loop, do nothing
if (this->istep == 0 && PARAM.inp.calculation != "nscf" && this->two_level_step != nullptr && *this->two_level_step == 0 && !this->restart) { return; } //in the non-exx loop, do nothing
if (this->add_hexx_type == Add_Hexx_Type::k) { return; }

if (XC_Functional::get_func_type() == 4 || XC_Functional::get_func_type() == 5)
Expand Down
6 changes: 4 additions & 2 deletions source/module_ri/Exx_LRI_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ class Exx_LRI_Interface
void exx_before_all_runners(const K_Vectors& kv, const UnitCell& ucell, const Parallel_2D& pv);

/// @brief in beforescf: set xc type, opt_orb, do DM mixing
void exx_beforescf(const K_Vectors& kv, const Charge_Mixing& chgmix, const UnitCell& ucell, const LCAO_Orbitals& orb);
void exx_beforescf(const int istep, const K_Vectors& kv, const Charge_Mixing& chgmix, const UnitCell& ucell, const LCAO_Orbitals& orb);

/// @brief in eachiterinit: do DM mixing and calculate Hexx when entering 2nd SCF
void exx_eachiterinit(const elecstate::DensityMatrix<T, double>& dm/**< double should be Tdata if complex-PBE-DM is supported*/,
void exx_eachiterinit(const int istep, const elecstate::DensityMatrix<T, double>& dm/**< double should be Tdata if complex-PBE-DM is supported*/,
const K_Vectors& kv, const int& iter);

/// @brief in hamilt2density: calculate Hexx and Eexx
Expand All @@ -70,10 +70,12 @@ class Exx_LRI_Interface
const K_Vectors& kv,
const int& nspin,
int& iter,
const int& istep,
const double& etot,
const double& scf_ene_thr);
int two_level_step = 0;
double etot_last_outer_loop = 0.0;
elecstate::DensityMatrix<T, double>* dm_last_step;
private:
std::shared_ptr<Exx_LRI<Tdata>> exx_ptr;
Mix_DMk_2D mix_DMk_2D;
Expand Down
39 changes: 25 additions & 14 deletions source/module_ri/Exx_LRI_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,16 @@ void Exx_LRI_Interface<T, Tdata>::exx_before_all_runners(const K_Vectors& kv, co
}

template<typename T, typename Tdata>
void Exx_LRI_Interface<T, Tdata>::exx_beforescf(const K_Vectors& kv, const Charge_Mixing& chgmix, const UnitCell& ucell, const LCAO_Orbitals& orb)
void Exx_LRI_Interface<T, Tdata>::exx_beforescf(const int istep, const K_Vectors& kv, const Charge_Mixing& chgmix, const UnitCell& ucell, const LCAO_Orbitals& orb)
{
#ifdef __MPI
if (GlobalC::exx_info.info_global.cal_exx)
{
if (GlobalC::restart.info_load.load_H_finish && !GlobalC::restart.info_load.restart_exx) { XC_Functional::set_xc_type(GlobalC::ucell.atoms[0].ncpp.xc_func);
} else
}
else if (istep > 0) { XC_Functional::set_xc_type(GlobalC::ucell.atoms[0].ncpp.xc_func);
}
else
{
if (ucell.atoms[0].ncpp.xc_func == "HF" || ucell.atoms[0].ncpp.xc_func == "PBE0" || ucell.atoms[0].ncpp.xc_func == "HSE")
{
Expand Down Expand Up @@ -100,21 +103,28 @@ void Exx_LRI_Interface<T, Tdata>::exx_beforescf(const K_Vectors& kv, const Charg
}

template<typename T, typename Tdata>
void Exx_LRI_Interface<T, Tdata>::exx_eachiterinit(const elecstate::DensityMatrix<T, double>& dm, const K_Vectors& kv, const int& iter)
void Exx_LRI_Interface<T, Tdata>::exx_eachiterinit(const int istep, const elecstate::DensityMatrix<T, double>& dm, const K_Vectors& kv, const int& iter)
{
if (GlobalC::exx_info.info_global.cal_exx)
{
if (!GlobalC::exx_info.info_global.separate_loop && this->two_level_step)
if (!GlobalC::exx_info.info_global.separate_loop && (this->two_level_step || istep > 0))
{
const bool flag_restart = (iter == 1) ? true : false;
if (this->exx_spacegroup_symmetry) { this->mix_DMk_2D.mix(symrot_.restore_dm(kv, dm.get_DMK_vector(), *dm.get_paraV_pointer()), flag_restart); }
else { this->mix_DMk_2D.mix(dm.get_DMK_vector(), flag_restart); }
const std::vector<std::map<int,std::map<std::pair<int, std::array<int, 3>>,RI::Tensor<Tdata>>>>
Ds = PARAM.globalv.gamma_only_local
? RI_2D_Comm::split_m2D_ktoR<Tdata>(*this->exx_ptr->p_kv, this->mix_DMk_2D.get_DMk_gamma_out(), *dm.get_paraV_pointer(), PARAM.inp.nspin)
: RI_2D_Comm::split_m2D_ktoR<Tdata>(*this->exx_ptr->p_kv, this->mix_DMk_2D.get_DMk_k_out(), *dm.get_paraV_pointer(), PARAM.inp.nspin, this->exx_spacegroup_symmetry);
if (this->exx_spacegroup_symmetry && GlobalC::exx_info.info_global.exx_symmetry_realspace) { this->exx_ptr->cal_exx_elec(Ds, *dm.get_paraV_pointer(), &this->symrot_); }
else { this->exx_ptr->cal_exx_elec(Ds, *dm.get_paraV_pointer()); }
auto cal = [this, &kv, &flag_restart](const elecstate::DensityMatrix<T, double>& dm_in)
{
if (this->exx_spacegroup_symmetry) { this->mix_DMk_2D.mix(symrot_.restore_dm(kv,dm_in.get_DMK_vector(), *dm_in.get_paraV_pointer()), flag_restart); }
else { this->mix_DMk_2D.mix(dm_in.get_DMK_vector(), flag_restart); }
const std::vector<std::map<int,std::map<std::pair<int, std::array<int, 3>>,RI::Tensor<Tdata>>>>
Ds = PARAM.globalv.gamma_only_local
? RI_2D_Comm::split_m2D_ktoR<Tdata>(*this->exx_ptr->p_kv, this->mix_DMk_2D.get_DMk_gamma_out(), *dm_in.get_paraV_pointer(), PARAM.inp.nspin)
: RI_2D_Comm::split_m2D_ktoR<Tdata>(*this->exx_ptr->p_kv, this->mix_DMk_2D.get_DMk_k_out(), *dm_in.get_paraV_pointer(), PARAM.inp.nspin, this->exx_spacegroup_symmetry);
if (this->exx_spacegroup_symmetry && GlobalC::exx_info.info_global.exx_symmetry_realspace) { this->exx_ptr->cal_exx_elec(Ds, *dm_in.get_paraV_pointer(), &this->symrot_); }
else { this->exx_ptr->cal_exx_elec(Ds, *dm_in.get_paraV_pointer()); }
};
if(istep > 0 && flag_restart)
cal(*dm_last_step);
else
cal(dm);
}
}
}
Expand Down Expand Up @@ -150,6 +160,7 @@ bool Exx_LRI_Interface<T, Tdata>::exx_after_converge(
const K_Vectors& kv,
const int& nspin,
int& iter,
const int& istep,
const double& etot,
const double& scf_ene_thr)
{ // only called if (GlobalC::exx_info.info_global.cal_exx)
Expand All @@ -158,7 +169,7 @@ bool Exx_LRI_Interface<T, Tdata>::exx_after_converge(
GlobalC::restart.info_load.restart_exx = true;
this->exx_ptr->Eexx = 0;
};

// no separate_loop case
if (!GlobalC::exx_info.info_global.separate_loop)
{
Expand All @@ -168,7 +179,7 @@ bool Exx_LRI_Interface<T, Tdata>::exx_after_converge(
// in first scf loop, exx updated once in beginning,
// in second scf loop, exx updated every iter

if (this->two_level_step)
if (this->two_level_step || istep > 0)
{
restart_reset();
return true;
Expand Down
4 changes: 2 additions & 2 deletions tests/integrate/285_NO_KP_RE_HSE/result.ref
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
etotref -200.8969758707964
etotperatomref -100.4484879354
etotref -199.35070744
etotperatomref -99.67535372
totaltimeref 19.17
4 changes: 2 additions & 2 deletions tests/integrate/286_NO_KP_CR_HSE/result.ref
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
etotref -196.7312320266655092
etotperatomref -98.3656160133
etotref -192.82622412
etotperatomref -96.41311206
totaltimeref 56.4969
37.12
4 changes: 2 additions & 2 deletions tests/integrate/385_NO_GO_RE_S1_HSE/result.ref
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
etotref -465.7333468413376
etotperatomref -155.2444489471
etotref -465.73367480
etotperatomref -155.24455827
totaltimeref 16.44
Loading
Loading