ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
esolver.h
Go to the documentation of this file.
1#ifndef ESOLVER_H
2#define ESOLVER_H
3
7
8struct Input_para;
9
10namespace ModuleESolver
11{
13{
14 public:
15 ESolver() { classname = "ESolver"; }
16
17 virtual ~ESolver()
18 {
19 //****************************************************
20 // do not add any codes in this deconstructor funcion
21 //****************************************************
22 }
23
25 virtual void before_all_runners(BaseCell &cell, const Input_para &inp) = 0;
26
28 virtual void runner(BaseCell &cell, const int istep) = 0;
29
31 virtual void after_all_runners(BaseCell &cell) = 0;
32
35 virtual void others(BaseCell &, const int) {}
36
38 virtual double cal_energy() = 0;
39
41 virtual void cal_force(BaseCell &cell, ModuleBase::matrix &force) = 0;
42
44 virtual void cal_stress(BaseCell &cell, ModuleBase::matrix &stress) = 0;
45
46 bool conv_esolver = true; // whether esolver is converged
47
48 std::string classname;
49
50 protected:
52 const Input_para *inp_ = nullptr;
53};
54
55} // namespace ModuleESolver
56
57#endif
Definition basecell.h:9
Definition matrix.h:15
virtual void cal_force(BaseCell &cell, ModuleBase::matrix &force)=0
calcualte forces for the atoms in the given cell
virtual void others(BaseCell &, const int)
Definition esolver.h:35
virtual ~ESolver()
Definition esolver.h:17
ESolver()
Definition esolver.h:15
virtual double cal_energy()=0
calculate total energy of a given system
virtual void cal_stress(BaseCell &cell, ModuleBase::matrix &stress)=0
calcualte stress of given cell
virtual void runner(BaseCell &cell, const int istep)=0
run energy solver
virtual void before_all_runners(BaseCell &cell, const Input_para &inp)=0
initialize the energy solver by using input parameters and cell modules
bool conv_esolver
Definition esolver.h:46
const Input_para * inp_
Bound in before_all_runners; members use inp_->xxx instead of PARAM.inp.xxx.
Definition esolver.h:52
std::string classname
Definition esolver.h:48
virtual void after_all_runners(BaseCell &cell)=0
perform post processing calculations
The First-Principles (FP) Energy Solver Class.
Definition opt_test_tools.cpp:93
Definition input_parameter.h:13