Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maki49 committed Jul 2, 2024
1 parent 679ae11 commit 72e1c1b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
4 changes: 2 additions & 2 deletions source/module_esolver/esolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ std::string determine_type(void)
esolver_type = "ksdft_lip";
}
#else
ModuleBase::WARNING_QUIT("ESolver", "LCAO basis type must be compiled with __LCAO");
ModuleBase::WARNING_QUIT("ESolver", "Calculation involving numerical orbitals must be compiled with __LCAO");
#endif
}
else if (GlobalV::BASIS_TYPE == "lcao")
Expand All @@ -65,7 +65,7 @@ std::string determine_type(void)
esolver_type = "ksdft_lcao";
}
#else
ModuleBase::WARNING_QUIT("ESolver", "LCAO basis type must be compiled with __LCAO");
ModuleBase::WARNING_QUIT("ESolver", "Calculation involving numerical orbitals must be compiled with __LCAO");
#endif
}

Expand Down
6 changes: 3 additions & 3 deletions source/module_esolver/esolver_ks_lip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ namespace ModuleESolver
}

template <typename T>
void ESolver_KS_LIP<T>::init_hsolver()
void ESolver_KS_LIP<T>::allocate_hsolver()
{
this->phsol = new hsolver::HSolverLIP<T>(this->pw_wfc);
}
template <typename T>
void ESolver_KS_LIP<T>::delete_hsolver()
void ESolver_KS_LIP<T>::deallocate_hsolver()
{
if (this->phsol != nullptr)
{
Expand Down Expand Up @@ -113,7 +113,7 @@ namespace ModuleESolver
}
else
{
ModuleBase::WARNING_QUIT("ESolver_KS_PW", "HSolver has not been initialed!");
ModuleBase::WARNING_QUIT("ESolver_KS_LIP", "HSolver has not been allocated.");
}
// add exx
#ifdef __LCAO
Expand Down
6 changes: 3 additions & 3 deletions source/module_esolver/esolver_ks_lip.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef ESOLVER_KS_LIP_H
#define ESOLVER_KS_LIP_H
#include "./esolver_ks_pw.h"
#include "module_esolver/esolver_ks_pw.h"
#include "module_hsolver/hsolver_lip.h"
namespace ModuleESolver
{
Expand All @@ -21,8 +21,8 @@ namespace ModuleESolver

protected:

virtual void init_hsolver() override;
virtual void delete_hsolver() override;
virtual void allocate_hsolver() override;
virtual void deallocate_hsolver() override;

};
} // namespace ModuleESolver
Expand Down
16 changes: 6 additions & 10 deletions source/module_esolver/esolver_ks_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ template <typename T, typename Device>
ESolver_KS_PW<T, Device>::~ESolver_KS_PW()
{
// delete HSolver and ElecState
this->delete_hsolver();
this->deallocate_hsolver();
if (this->pelec != nullptr)
{
delete reinterpret_cast<elecstate::ElecStatePW<T, Device>*>(this->pelec);
Expand Down Expand Up @@ -161,7 +161,7 @@ void ESolver_KS_PW<T, Device>::before_all_runners(Input& inp, UnitCell& ucell)
// 2) initialize HSolver
if (this->phsol == nullptr)
{
this->init_hsolver();
this->allocate_hsolver();
}

// 3) initialize ElecState,
Expand Down Expand Up @@ -221,18 +221,14 @@ void ESolver_KS_PW<T, Device>::before_all_runners(Input& inp, UnitCell& ucell)
}
}
template <typename T, typename Device>
void ESolver_KS_PW<T, Device>::init_hsolver()
void ESolver_KS_PW<T, Device>::allocate_hsolver()
{
this->phsol = new hsolver::HSolverPW<T, Device>(this->pw_wfc, &this->wf);
}
template <typename T, typename Device>
void ESolver_KS_PW<T, Device>::delete_hsolver()
void ESolver_KS_PW<T, Device>::deallocate_hsolver()
{
if (this->phsol != nullptr)
{
delete reinterpret_cast<hsolver::HSolverPW<T, Device>*>(this->phsol);
this->phsol = nullptr;
}
delete reinterpret_cast<hsolver::HSolverPW<T, Device>*>(this->phsol);
}
template <typename T, typename Device>
void ESolver_KS_PW<T, Device>::init_after_vc(Input& inp, UnitCell& ucell)
Expand Down Expand Up @@ -266,7 +262,7 @@ void ESolver_KS_PW<T, Device>::init_after_vc(Input& inp, UnitCell& ucell)
this->pw_wfc->collect_local_pw(inp.erf_ecut, inp.erf_height, inp.erf_sigma);

delete this->phsol;
this->init_hsolver();
this->allocate_hsolver();

delete this->pelec;
this->pelec = new elecstate::ElecStatePW<T, Device>(this->pw_wfc,
Expand Down
4 changes: 2 additions & 2 deletions source/module_esolver/esolver_ks_pw.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class ESolver_KS_PW : public ESolver_KS<T, Device>
// Init Global class
void Init_GlobalC(Input& inp, UnitCell& ucell, pseudopot_cell_vnl& ppcell);

virtual void init_hsolver();
virtual void delete_hsolver();
virtual void allocate_hsolver();
virtual void deallocate_hsolver();

//! hide the psi in ESolver_KS for tmp use
psi::Psi<std::complex<double>, base_device::DEVICE_CPU>* psi = nullptr;
Expand Down

0 comments on commit 72e1c1b

Please sign in to comment.