ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
esolver_ks.h
Go to the documentation of this file.
1#ifndef ESOLVER_KS_H
2#define ESOLVER_KS_H
3
4#include "esolver_fp.h" // first-principles esolver
5#include "source_basis/module_pw/pw_basis_k.h" // use plane wave
6#include "source_cell/klist.h" // use k-points in Brillouin zone
7#include "source_estate/module_charge/charge_mixing.h" // use charge mixing
8#include "source_hamilt/hamilt.h" // use Hamiltonian
9#include "source_hamilt/hamilt_base.h" // use Hamiltonian base class
10#include "source_lcao/module_dftu/dftu.h" // mohan add 20251107
12
13namespace ModuleESolver
14{
15
16class ESolver_KS : public ESolver_FP
17{
18 public:
20 ESolver_KS();
21
23 virtual ~ESolver_KS();
24
25 virtual void before_all_runners(UnitCell& ucell, const Input_para& inp) override;
26
27 virtual void runner(UnitCell& ucell, const int istep) override;
28
29 virtual void after_all_runners(UnitCell& ucell) override;
30
31 protected:
33 virtual void before_scf(UnitCell& ucell, const int istep) override;
34
36 virtual void iter_init(UnitCell& ucell, const int istep, const int iter);
37
39 virtual void iter_finish(UnitCell& ucell, const int istep, int& iter, bool& conv_esolver) override;
40
41 // calculate electron density from a specific Hamiltonian with ethr
42 virtual void hamilt2rho_single(UnitCell& ucell, const int istep, const int iter, const double ethr);
43
44 // calculate electron density from a specific Hamiltonian
45 void hamilt2rho(UnitCell& ucell, const int istep, const int iter, const double ethr);
46
48 virtual void after_scf(UnitCell& ucell, const int istep, const bool conv_esolver) override;
49
52
55
58
61
64
65 std::string basisname;
66 double esolver_KS_ne = 0.0;
67 double diag_ethr;
68 double scf_thr;
69 double scf_ene_thr;
70 double drho;
73 int niter;
74 bool oscillate_esolver = false; // whether esolver is oscillated
75 bool scf_nmax_flag = false; // whether scf has reached nmax, mohan add 20250921
76};
77} // namespace ModuleESolver
78#endif
Definition charge_mixing.h:9
Definition esolver_fp.h:29
Definition esolver_ks.h:17
double scf_ene_thr
scf density threshold
Definition esolver_ks.h:69
ESolver_KS()
Constructor.
Definition esolver_ks.cpp:23
int maxniter
the error of HSolver
Definition esolver_ks.h:72
double scf_thr
the threshold for diagonalization
Definition esolver_ks.h:68
virtual ~ESolver_KS()
Deconstructor.
Definition esolver_ks.cpp:26
double esolver_KS_ne
esolver_ks_lcao.cpp
Definition esolver_ks.h:66
hamilt::HamiltBase * p_hamilt
Hamiltonian (base class pointer, actual type determined at runtime)
Definition esolver_ks.h:51
virtual void after_all_runners(UnitCell &ucell) override
perform post processing calculations
Definition esolver_ks.cpp:311
virtual void hamilt2rho_single(UnitCell &ucell, const int istep, const int iter, const double ethr)
Definition esolver_ks.cpp:78
bool scf_nmax_flag
Definition esolver_ks.h:75
int niter
maximum iter steps for scf
Definition esolver_ks.h:73
std::string basisname
Definition esolver_ks.h:65
bool oscillate_esolver
iter steps actually used in scf
Definition esolver_ks.h:74
Plus_U dftu
DFT+U method, mohan add 2025-11-07.
Definition esolver_ks.h:63
double hsolver_error
the difference between rho_in (before HSolver) and rho_out (After HSolver)
Definition esolver_ks.h:71
virtual void before_scf(UnitCell &ucell, const int istep) override
Something to do before SCF iterations.
Definition esolver_ks.cpp:170
virtual void before_all_runners(UnitCell &ucell, const Input_para &inp) override
Initialize of the first-principels energy solver.
Definition esolver_ks.cpp:40
virtual void after_scf(UnitCell &ucell, const int istep, const bool conv_esolver) override
Something to do after SCF iterations when SCF is converged or comes to the max iter step.
Definition esolver_ks.cpp:287
double diag_ethr
number of electrons
Definition esolver_ks.h:67
virtual void runner(UnitCell &ucell, const int istep) override
run energy solver
Definition esolver_ks.cpp:121
pseudopot_cell_vnl ppcell
nonlocal pseudopotentials
Definition esolver_ks.h:60
double drho
scf energy threshold
Definition esolver_ks.h:70
void hamilt2rho(UnitCell &ucell, const int istep, const int iter, const double ethr)
Definition esolver_ks.cpp:81
virtual void iter_finish(UnitCell &ucell, const int istep, int &iter, bool &conv_esolver) override
Something to do after hamilt2rho function in each iter loop.
Definition esolver_ks.cpp:202
virtual void iter_init(UnitCell &ucell, const int istep, const int iter)
Something to do before hamilt2rho function in each iter loop.
Definition esolver_ks.cpp:176
ModulePW::PW_Basis_K * pw_wfc
PW for wave functions, only used in KSDFT, not in OFDFT.
Definition esolver_ks.h:54
Charge_Mixing * p_chgmix
Charge mixing method.
Definition esolver_ks.h:57
bool conv_esolver
Definition esolver.h:48
Special pw_basis class. It includes different k-points.
Definition pw_basis_k.h:56
Definition dftu.h:19
Definition unitcell.h:15
Base class for Hamiltonian.
Definition hamilt_base.h:17
Definition vnl_pw.h:21
The First-Principles (FP) Energy Solver Class.
Definition opt_test_tools.cpp:93
Definition input_parameter.h:12