forked from deepmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesolver_dfpt_pw.cpp
More file actions
104 lines (77 loc) · 2.59 KB
/
Copy pathesolver_dfpt_pw.cpp
File metadata and controls
104 lines (77 loc) · 2.59 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// ============================================================
// This code is added by Mohan Chen on 2026-05-18.
// This code is currently in the design phase and has not been
// put into production yet. It may change in the future.
// Please use this code with caution. Only developers who know
// what they are doing should use this code.
// ============================================================
#include "esolver_dfpt_pw.h"
#include "source_base/tool_quit.h"
namespace ModuleESolver
{
ESolver_DFPT_PW::ESolver_DFPT_PW()
{
this->classname = "ESolver_DFPT_PW";
this->basisname = "PW";
gs_done_ = false;
dfpt_ = nullptr;
}
ESolver_DFPT_PW::~ESolver_DFPT_PW()
{
if (dfpt_ != nullptr)
{
delete dfpt_;
dfpt_ = nullptr;
}
}
void ESolver_DFPT_PW::before_all_runners(BaseCell& basecell, const Input_para& inp)
{
basecell.require_kind(BaseCell::Kind::unit_cell, __FUNCTION__);
UnitCell& ucell = static_cast<UnitCell&>(basecell);
ModuleBase::TITLE("ESolver_DFPT_PW", "before_all_runners");
ESolver_KS_PW<std::complex<double>, base_device::DEVICE_CPU>::before_all_runners(ucell, inp);
init_dfpt(ucell);
}
void ESolver_DFPT_PW::runner(BaseCell& basecell, const int istep)
{
basecell.require_kind(BaseCell::Kind::unit_cell, __FUNCTION__);
UnitCell& ucell = static_cast<UnitCell&>(basecell);
ModuleBase::TITLE("ESolver_DFPT_PW", "runner");
if (!gs_done_)
{
run_gs(ucell);
gs_done_ = true;
}
if (dfpt_ != nullptr)
{
dfpt_->run();
}
run_post_process(ucell);
}
void ESolver_DFPT_PW::after_all_runners(BaseCell& basecell)
{
basecell.require_kind(BaseCell::Kind::unit_cell, __FUNCTION__);
UnitCell& ucell = static_cast<UnitCell&>(basecell);
ModuleBase::TITLE("ESolver_DFPT_PW", "after_all_runners");
ESolver_KS_PW<std::complex<double>, base_device::DEVICE_CPU>::after_all_runners(ucell);
}
void ESolver_DFPT_PW::run_gs(UnitCell& ucell)
{
ModuleBase::TITLE("ESolver_DFPT_PW", "run_gs");
ESolver_KS_PW<std::complex<double>, base_device::DEVICE_CPU>::runner(ucell, 0);
}
void ESolver_DFPT_PW::init_dfpt(UnitCell& ucell)
{
ModuleBase::TITLE("ESolver_DFPT_PW", "init_dfpt");
dfpt_ = new ModuleDFPT::DFPT_PW();
// dfpt_->init(ucell, *this->stp.psi, this->pelec->nelec, this->inp_->ecutwfc);
dfpt_->set_parameters("dfpt.in");
dfpt_->set_qmesh(1, 1, 1);
dfpt_->set_conv_thr(1e-8);
dfpt_->set_max_iter(100);
}
void ESolver_DFPT_PW::run_post_process(UnitCell& ucell)
{
ModuleBase::TITLE("ESolver_DFPT_PW", "run_post_process");
}
} // namespace ModuleESolver