ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
esolver_ks_lcao.h
Go to the documentation of this file.
1#ifndef ESOLVER_KS_LCAO_H
2#define ESOLVER_KS_LCAO_H
3
4#include "esolver_ks.h"
6#include "source_cell/record_adj.h" // adjacent atoms
9#include "source_hamilt/module_xc/exx_info.h" // LCAO owns full Exx_Info
10#include "source_lcao/allocate_dm.h" // mohan add 2025-10-30
11#include "source_lcao/module_rdmft/rdmft.h" // rdmft
13#include "source_lcao/setup_deepks.h" // for deepks, mohan add 20251008
14#include "source_lcao/setup_exx.h" // for exx, mohan add 20251008
15
16#include <complex>
17#include <memory>
18
19class BasisFlattenedIndexing; // Defined in source/source_base/basis_flattened_indexing.h
20
21//-----------------------------------
22// ESolver for LCAO
23//-----------------------------------
24namespace ModuleESolver
25{
27template <typename T, typename TR>
28class ESolver_LR;
29
31template <typename TK, typename TR>
33{
34 public:
39
41 void before_all_runners(BaseCell &basecell, const Input_para &inp) override;
42
44 double cal_energy() override;
45
47 void cal_force(BaseCell &basecell, ModuleBase::matrix &force) override;
48
50 void cal_stress(BaseCell &basecell, ModuleBase::matrix &stress) override;
51
53 void after_all_runners(BaseCell &basecell) override;
54
55 protected:
57 virtual TD_info *get_td_info() const { return nullptr; }
58
60 virtual void before_scf(UnitCell &ucell, const int istep) override;
61
63 void before_scf(UnitCell &ucell, const int istep, const int output_step);
64
68 int istep_ = 0;
69
78
80 virtual void iter_init(UnitCell &ucell, const int istep, const int iter) override;
81
83 virtual void hamilt2rho_single(
84 UnitCell &ucell,
85 const int istep,
86 const int iter,
87 const double ethr) override;
88
90 virtual void iter_finish(
91 UnitCell &ucell,
92 const int istep,
93 int &iter,
94 bool &conv_esolver) override;
95
97 virtual void after_scf(UnitCell &ucell, const int istep, const bool conv_esolver) override;
98
100 virtual void others(BaseCell &basecell, const int istep) override;
101
103 psi::Psi<TK> *psi = nullptr;
104
107
110
113
115 std::unique_ptr<BasisFlattenedIndexing> basis_index_;
116
118 std::unique_ptr<ModuleGint::GintInfo> gint_info_;
119
122
125
128
131
134
137
140
142 friend class ESolver_LR<double, double>;
144 friend class ESolver_LR<std::complex<double>, double>;
145
149 bool have_force = false;
150
153};
154} // namespace ModuleESolver
155#endif
Definition basecell.h:9
Canonical atom-major flattening of the LCAO basis hierarchy.
Definition basis_flattened_indexing.h:40
Definition setup_exx.h:21
Definition gint_prec_ctrl.h:9
Grid_Driver class for neighbor search interface.
Definition sltk_grid_driver.h:63
Definition orb_read.h:18
Definition matrix.h:15
Grid_Driver gd
Search for adjacent atoms and provide their positions and cell indices.
Definition esolver_ks_lcao.h:109
virtual void iter_finish(UnitCell &ucell, const int istep, int &iter, bool &conv_esolver) override
Finish an SCF iteration with energy corrections, mixing, convergence checks, and output.
Definition esolver_ks_lcao.cpp:579
TwoCenterBundle two_center_bundle_
NAO orbitals: two-center integrations.
Definition esolver_ks_lcao.h:124
LCAO_Orbitals orb_
Store NAO orbitals and their radial tables.
Definition esolver_ks_lcao.h:121
void cal_force(BaseCell &basecell, ModuleBase::matrix &force) override
Calculate the requested forces and stress, caching the stress for cal_stress().
Definition esolver_ks_lcao.cpp:303
ModuleBase::matrix scs
Cache the stress computed by cal_force() for the separate cal_stress() interface.
Definition esolver_ks_lcao.h:147
virtual TD_info * get_td_info() const
Optional solver-owned RT state passed to LCAO consumers.
Definition esolver_ks_lcao.h:57
module_dm::Setup_DM< TK > dmat
Own the density matrix, mohan add 2025-10-30.
Definition esolver_ks_lcao.h:127
virtual void before_scf(UnitCell &ucell, const int istep) override
Prepare an ionic step using istep for both initialization and initial-state output.
Definition esolver_ks_lcao.cpp:163
void cal_stress(BaseCell &basecell, ModuleBase::matrix &stress) override
Return the cached stress, calling cal_force() first when needed.
Definition esolver_ks_lcao.cpp:335
void before_all_runners(BaseCell &basecell, const Input_para &inp) override
Initialize the LCAO basis, electronic state, and potentials before all steps.
Definition esolver_ks_lcao.cpp:87
int istep_
Definition esolver_ks_lcao.h:68
bool final_electronic_step_
Whether the current after_scf() call ends the final electronic step of the run.
Definition esolver_ks_lcao.h:77
ESolver_KS_LCAO()
Initialize the solver identity and DFT+U storage.
Definition esolver_ks_lcao.cpp:72
GintPrecisionController gint_precision_controller_
Control grid-integration precision and its switching during SCF iterations.
Definition esolver_ks_lcao.h:152
Setup_DeePKS< TK > deepks
For DeePKS calculations, mohan add 2025-10-08.
Definition esolver_ks_lcao.h:130
~ESolver_KS_LCAO()
Release the electronic wave functions.
Definition esolver_ks_lcao.cpp:80
rdmft::RDMFT< TK, TR > rdmft_solver
For RDMFT calculations, added by jghan, 2024-03-16.
Definition esolver_ks_lcao.h:139
Exx_Info exx_info_
Full EXX info for LCAO (includes info_ri, info_opt_abfs, info_lip).
Definition esolver_ks_lcao.h:133
bool have_force
Track whether cal_force() has run since the last cal_stress() call.
Definition esolver_ks_lcao.h:149
std::unique_ptr< ModuleGint::GintInfo > gint_info_
GintInfo: used to store basic grid-integration information for module_gint.
Definition esolver_ks_lcao.h:118
Record_adj RA
Store information about adjacent atoms for the distributed matrix layout.
Definition esolver_ks_lcao.h:106
std::unique_ptr< BasisFlattenedIndexing > basis_index_
Canonical global ordering and atom slices of the LCAO basis.
Definition esolver_ks_lcao.h:115
Parallel_Orbitals pv
NAO orbitals: 2D block-cyclic distribution info.
Definition esolver_ks_lcao.h:112
Exx_NAO< TK > exx_nao
For exact-exchange calculations, mohan add 2025-10-08.
Definition esolver_ks_lcao.h:136
virtual void after_scf(UnitCell &ucell, const int istep, const bool conv_esolver) override
Write the SCF results and release adjacency records when forces and stress are not requested.
Definition esolver_ks_lcao.cpp:688
void after_all_runners(BaseCell &basecell) override
Perform final LCAO output and postprocessing after all steps.
Definition esolver_ks_lcao.cpp:357
virtual void others(BaseCell &basecell, const int istep) override
Run specialized LCAO calculations outside the standard SCF workflow.
Definition lcao_others.cpp:34
double cal_energy() override
Return the electronic total energy in Ry.
Definition esolver_ks_lcao.cpp:297
virtual void hamilt2rho_single(UnitCell &ucell, const int istep, const int iter, const double ethr) override
Solve the Hamiltonian and update the charge density and energy terms.
Definition esolver_ks_lcao.cpp:484
virtual void iter_init(UnitCell &ucell, const int istep, const int iter) override
Prepare charge mixing and Hamiltonian updates for an SCF iteration.
Definition esolver_ks_lcao.cpp:382
ESolver_KS()
Constructor.
Definition esolver_ks.cpp:29
Forward declaration for the linear-response solver.
Definition esolver_lr_lcao_tddft.h:44
bool conv_esolver
Definition esolver.h:46
Definition parallel_orbitals.h:16
Definition record_adj.h:15
Definition setup_deepks.h:23
Definition td_info.h:18
Definition two_center_bundle.h:11
Provide the basic information about unitcell.
Definition unitcell.h:16
Definition dm_holder.h:10
Definition psi.h:37
Definition rdmft.h:47
#define complex
Definition elpa_new.h:28
The First-Principles (FP) Energy Solver Class.
Definition opt_test_tools.cpp:93
Definition diag_lcao.h:14
Definition exx_info.h:10
Definition input_parameter.h:13