Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ OBJS_GINT=batch_biggrid.o\

OBJS_HAMILT=hamilt_pw.o\
hs_matrix_k.o\
hamilt_sdft_pw.o\
sto_hamilt_pw.o\
operator.o\
op_pw.o\
op_pw_exx.o\
Expand Down Expand Up @@ -443,7 +443,6 @@ OBJS_HSOLVER=diago_cg.o\
hsolver.o\
hsolver_pw.o\
hsolver_lcaopw.o\
hsolver_pw_sdft.o\
diago_iter_assist.o\
hegvd_op.o\
bpcg_kernel_op.o\
Expand Down Expand Up @@ -881,6 +880,7 @@ OBJS_SRCPW=h_ewald_pw.o\
stru_fac.o\
stru_fac_k.o\
soc.o\
sto_hsolver_pw.o\
sto_iter.o\
sto_che.o\
sto_wf.o\
Expand Down
89 changes: 45 additions & 44 deletions source/source_esolver/esolver_sdft_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "source_hsolver/diago_iter_assist.h"
#include "source_hsolver/diago_params.h"
#include "source_io/module_parameter/parameter.h"
#include "source_pw/module_stodft/sto_hsolver_pw.h"
#include "source_pw/module_stodft/sto_dos.h"
#include "source_pw/module_stodft/sto_elecond.h"
#include "source_pw/module_stodft/sto_forces.h"
Expand Down Expand Up @@ -100,15 +101,15 @@ void ESolver_SDFT_PW<T, Device>::before_scf(UnitCell& ucell, const int istep)

ESolver_KS_PW<T, Device>::before_scf(ucell, istep);
delete reinterpret_cast<hamilt::HamiltPW<double>*>(this->p_hamilt);
this->p_hamilt = new hamilt::HamiltSdftPW<T, Device>(this->pelec->pot,
this->pw_wfc,
&this->kv,
&this->ppcell,
&ucell,
PARAM.globalv.npol,
&this->stoche.emin_sto,
&this->stoche.emax_sto);
this->p_hamilt_sto = static_cast<hamilt::HamiltSdftPW<T, Device>*>(this->p_hamilt);
this->p_hamilt = new StoHamiltPW<T, Device>(this->pelec->pot,
this->pw_wfc,
&this->kv,
&this->ppcell,
&ucell,
PARAM.globalv.npol,
&this->stoche.emin_sto,
&this->stoche.emax_sto);
this->p_hamilt_sto = static_cast<StoHamiltPW<T, Device>*>(this->p_hamilt);

if (istep > 0 && this->inp_->nbands_sto != 0 && this->inp_->initsto_freq > 0 && istep % this->inp_->initsto_freq == 0)
{
Expand Down Expand Up @@ -153,43 +154,43 @@ void ESolver_SDFT_PW<T, Device>::hamilt2rho_single(UnitCell& ucell, int istep, i
bool skip_charge = this->inp_->calculation == "nscf" ? true : false;

// hsolver only exists in this function
hsolver::HSolverPW_SDFT<T, Device> hsolver_pw_sdft_obj(&this->kv,
this->pw_wfc,
this->stowf,
this->stoche,
this->p_hamilt_sto,
this->inp_->calculation,
this->inp_->basis_type,
this->inp_->ks_solver,
PARAM.globalv.use_uspp,
this->inp_->nspin,
hsolver::DiagoIterAssist<T, Device>::SCF_ITER,
hsolver::DiagoIterAssist<T, Device>::PW_DIAG_NMAX,
hsolver::DiagoIterAssist<T, Device>::PW_DIAG_THR,
hsolver::DiagoIterAssist<T, Device>::need_subspace,
this->inp_->nbands,
this->inp_->diago_smooth_ethr,
this->inp_->pw_diag_ndim,
this->inp_->diag_subspace,
this->inp_->nb2d,
PARAM.globalv.ks_run,
PARAM.globalv.all_ks_run,
this->inp_->bndpar);

hsolver_pw_sdft_obj.solve(ucell,
static_cast<hamilt::Hamilt<T, Device>*>(this->p_hamilt),
*this->stp.template get_psi_t<T, Device>(),
this->stp.psi_cpu[0],
this->pelec,
this->pw_wfc,
this->stowf,
istep,
iter,
GlobalV::ofs_running,
skip_charge);
StoHSolverPW<T, Device> sto_hsolver_pw_obj(&this->kv,
this->pw_wfc,
this->stowf,
this->stoche,
this->p_hamilt_sto,
this->inp_->calculation,
this->inp_->basis_type,
this->inp_->ks_solver,
PARAM.globalv.use_uspp,
this->inp_->nspin,
hsolver::DiagoIterAssist<T, Device>::SCF_ITER,
hsolver::DiagoIterAssist<T, Device>::PW_DIAG_NMAX,
hsolver::DiagoIterAssist<T, Device>::PW_DIAG_THR,
hsolver::DiagoIterAssist<T, Device>::need_subspace,
this->inp_->nbands,
this->inp_->diago_smooth_ethr,
this->inp_->pw_diag_ndim,
this->inp_->diag_subspace,
this->inp_->nb2d,
PARAM.globalv.ks_run,
PARAM.globalv.all_ks_run,
this->inp_->bndpar);

sto_hsolver_pw_obj.solve(ucell,
static_cast<hamilt::Hamilt<T, Device>*>(this->p_hamilt),
*this->stp.template get_psi_t<T, Device>(),
this->stp.psi_cpu[0],
this->pelec,
this->pw_wfc,
this->stowf,
istep,
iter,
GlobalV::ofs_running,
skip_charge);

// set_diagethr need it
this->esolver_KS_ne = hsolver_pw_sdft_obj.stoiter.KS_ne;
this->esolver_KS_ne = sto_hsolver_pw_obj.stoiter.KS_ne;

if (PARAM.globalv.ks_run)
{
Expand Down
4 changes: 2 additions & 2 deletions source/source_esolver/esolver_sdft_pw.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define ESOLVER_SDFT_PW_H

#include "esolver_ks_pw.h"
#include "source_pw/module_stodft/hamilt_sdft_pw.h"
#include "source_pw/module_stodft/sto_hamilt_pw.h"
#include "source_pw/module_stodft/sto_che.h"
#include "source_pw/module_stodft/sto_iter.h"
#include "source_pw/module_stodft/sto_wf.h"
Expand Down Expand Up @@ -31,7 +31,7 @@ class ESolver_SDFT_PW : public ESolver_KS_PW<T, Device>
public:
Stochastic_WF<T, Device> stowf;
StoChe<Real, Device> stoche;
hamilt::HamiltSdftPW<T, Device>* p_hamilt_sto = nullptr;
StoHamiltPW<T, Device>* p_hamilt_sto = nullptr;

protected:
virtual void before_scf(UnitCell& ucell, const int istep) override;
Expand Down
1 change: 0 additions & 1 deletion source/source_hsolver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ list(APPEND objects
para_lin_tf.cpp
hsolver_pw.cpp
hsolver_lcaopw.cpp
hsolver_pw_sdft.cpp
diago_iter_assist.cpp
hsolver.cpp
diago_pxxxgvx.cpp
Expand Down
84 changes: 0 additions & 84 deletions source/source_hsolver/hsolver_pw_sdft.h

This file was deleted.

7 changes: 0 additions & 7 deletions source/source_hsolver/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ if (ENABLE_MPI)
../../source_cell/klist.cpp ../../source_cell/klist_io.cpp ../../source_cell/parallel_kpoints.cpp ../../source_cell/reciprocal_grid.cpp
)

AddTest(
TARGET MODULE_HSOLVER_sdft
LIBS parameter psi device base container
SOURCES test_hsolver_sdft.cpp ../hsolver_pw_sdft.cpp ../hsolver_pw.cpp ../diago_bpcg.cpp ../diago_dav_subspace.cpp ../diag_const_nums.cpp ../diago_iter_assist.cpp ../para_lin_tf.cpp
../../source_estate/elecstate_tools.cpp ../../source_estate/occupy.cpp ../../source_base/module_fft/fft_bundle.cpp ../../source_base/module_fft/fft_cpu.cpp
)

if(ENABLE_LCAO)
if(TARGET ELPA::ELPA)
AddTest(
Expand Down
3 changes: 2 additions & 1 deletion source/source_pw/module_stodft/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
list(APPEND hamilt_stodft_srcs
hamilt_sdft_pw.cpp
sto_hamilt_pw.cpp
sto_hsolver_pw.cpp
sto_iter.cpp
sto_che.cpp
sto_wf.cpp
Expand Down
72 changes: 0 additions & 72 deletions source/source_pw/module_stodft/hamilt_sdft_pw.cpp

This file was deleted.

6 changes: 3 additions & 3 deletions source/source_pw/module_stodft/sto_dos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Sto_DOS<FPTYPE, Device>::Sto_DOS(ModulePW::PW_Basis_K* p_wfcpw_in,
this->p_elec = p_elec_in;
this->p_psi = p_psi_in;
this->p_hamilt = p_hamilt_in;
this->p_hamilt_sto = static_cast<hamilt::HamiltSdftPW<std::complex<double>>*>(p_hamilt_in);
this->p_hamilt_sto = static_cast<StoHamiltPW<std::complex<double>>*>(p_hamilt_in);
this->p_stowf = p_stowf_in;
this->nbands_ks = p_psi_in->get_nbands();
this->nbands_sto = p_stowf_in->nchi;
Expand All @@ -51,7 +51,7 @@ void Sto_DOS<FPTYPE, Device>::decide_param(const int& dos_nche,
this->nbands_sto,
this->p_kv,
reinterpret_cast<Stochastic_WF<std::complex<FPTYPE>, Device>*>(this->p_stowf),
reinterpret_cast<hamilt::HamiltSdftPW<std::complex<FPTYPE>, Device>*>(this->p_hamilt_sto));
reinterpret_cast<StoHamiltPW<std::complex<FPTYPE>, Device>*>(this->p_hamilt_sto));
if (dos_setemax)
{
this->emax = dos_emax_ev;
Expand Down Expand Up @@ -124,7 +124,7 @@ void Sto_DOS<FPTYPE, Device>::caldos(const double sigmain, const double de, cons
p_stowf->chi0->fix_k(ik);
pchi = p_stowf->chi0->get_pointer();
}
auto hchi_norm = std::bind(&hamilt::HamiltSdftPW<std::complex<double>>::hPsi_norm,
auto hchi_norm = std::bind(&StoHamiltPW<std::complex<double>>::hPsi_norm,
p_hamilt_sto,
std::placeholders::_1,
std::placeholders::_2,
Expand Down
4 changes: 2 additions & 2 deletions source/source_pw/module_stodft/sto_dos.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef STO_DOS
#define STO_DOS
#include "source_estate/elecstate.h"
#include "source_pw/module_stodft/hamilt_sdft_pw.h"
#include "source_pw/module_stodft/sto_hamilt_pw.h"
#include "source_pw/module_stodft/sto_che.h"
#include "source_pw/module_stodft/sto_func.h"
#include "source_pw/module_stodft/sto_wf.h"
Expand Down Expand Up @@ -65,7 +65,7 @@ class Sto_DOS
= nullptr; ///< pointer to the stochastic wavefunctions
Sto_Func<double> stofunc; ///< functions

hamilt::HamiltSdftPW<std::complex<double>>* p_hamilt_sto = nullptr; ///< pointer to the Hamiltonian for sDFT
StoHamiltPW<std::complex<double>>* p_hamilt_sto = nullptr; ///< pointer to the Hamiltonian for sDFT
};

#endif // STO_DOS
Loading
Loading