forked from deepmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesolver.h
More file actions
60 lines (44 loc) · 1.58 KB
/
Copy pathesolver.h
File metadata and controls
60 lines (44 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef ESOLVER_H
#define ESOLVER_H
#include "source_base/matrix.h"
#include "source_cell/base_cell.h"
#include "source_cell/unitcell.h"
struct Input_para;
namespace ModuleESolver
{
class ESolver
{
public:
ESolver()
{
classname = "ESolver";
}
virtual ~ESolver()
{
//****************************************************
// do not add any codes in this deconstructor funcion
//****************************************************
}
//! initialize the energy solver by using input parameters and cell modules
virtual void before_all_runners(BaseCell& cell, const Input_para& inp) = 0;
//! run energy solver
virtual void runner(BaseCell& cell, const int istep) = 0;
//! perform post processing calculations
virtual void after_all_runners(BaseCell& cell) = 0;
//! deal with exx and other calculation than scf/md/relax/cell-relax:
//! such as nscf, get_wf and get_pchg
virtual void others(BaseCell&, const int) {}
//! calculate total energy of a given system
virtual double cal_energy() = 0;
//! calcualte forces for the atoms in the given cell
virtual void cal_force(BaseCell& cell, ModuleBase::matrix& force) = 0;
//! calcualte stress of given cell
virtual void cal_stress(BaseCell& cell, ModuleBase::matrix& stress) = 0;
bool conv_esolver = true; // whether esolver is converged
std::string classname;
protected:
/// Bound in before_all_runners; members use inp_->xxx instead of PARAM.inp.xxx
const Input_para* inp_ = nullptr;
};
} // namespace ModuleESolver
#endif