forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdriver.cpp
More file actions
101 lines (79 loc) · 2.71 KB
/
driver.cpp
File metadata and controls
101 lines (79 loc) · 2.71 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
#include "driver.h"
#include "input.h"
#include "input_conv.h"
#include "src_pw/global.h"
#ifdef __LCAO
#include "src_lcao/global_fp.h"
#endif
#include "module_base/memory.h"
#include "module_base/timer.h"
#include "module_esolver/esolver.h"
#include "src_io/cal_test.h"
#include "src_io/print_info.h"
#include "src_io/winput.h"
Driver::Driver()
{
}
Driver::~Driver()
{
}
void Driver::init()
{
ModuleBase::TITLE("Driver", "init");
time_t time_start = std::time(NULL);
ModuleBase::timer::start();
// (1) read the input parameters.
this->reading();
// (2) welcome to the atomic world!
this->atomic_world();
// (3) output information
time_t time_finish = std::time(NULL);
Print_Info::print_time(time_start, time_finish);
// (4) close all of the running logs
INPUT.close_log();
return;
}
void Driver::reading(void)
{
ModuleBase::timer::tick("Driver", "reading");
// (1) read INPUT
INPUT.Init(GlobalV::global_in_card);
// (2) copy the variables from INPUT to each class
Input_Conv::Convert();
// (3) define the 'DIAGONALIZATION' world in MPI
Parallel_Global::split_diag_world(GlobalV::DIAGO_PROC);
Parallel_Global::split_grid_world(GlobalV::DIAGO_PROC);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "DRANK", GlobalV::DRANK + 1);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "DSIZE", GlobalV::DSIZE);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "DCOLOR", GlobalV::DCOLOR + 1);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "GRANK", GlobalV::GRANK + 1);
ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "GSIZE", GlobalV::GSIZE);
#ifdef __MPI
// (4) divide the GlobalV::NPROC processors into GlobalV::KPAR for k-points parallelization.
GlobalC::Pkpoints.init_pools();
#endif
// (5) Read in parameters about wannier functions.
winput::Init(GlobalV::global_wannier_card);
// (6) Print the parameters into INPUT file.
std::stringstream ss1;
ss1 << GlobalV::global_out_dir << GlobalV::global_in_card;
INPUT.Print(ss1.str());
// ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running,"READING CARDS");
ModuleBase::timer::tick("Driver", "reading");
return;
}
void Driver::atomic_world(void)
{
ModuleBase::TITLE("Driver", "atomic_world");
//--------------------------------------------------
// choose basis sets:
// pw: plane wave basis set
// lcao_in_pw: LCAO expaned by plane wave basis set
// lcao: linear combination of atomic orbitals
//--------------------------------------------------
// where the actual stuff is done
this->driver_run();
ModuleBase::timer::finish(GlobalV::ofs_running);
ModuleBase::Memory::print_all(GlobalV::ofs_running);
return;
}