forked from deepmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdriver.cpp
110 lines (83 loc) · 2.7 KB
/
driver.cpp
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
105
106
107
108
109
110
#include "driver.h"
#include "input.h"
#include "input_conv.h"
#include "run_pw.h"
#include "src_pw/global.h"
#ifdef __LCAO
#include "run_lcao.h"
#include "src_lcao/global_fp.h"
#endif
#include "src_io/cal_test.h"
#include "src_io/winput.h"
#include "src_io/print_info.h"
#include "module_base/timer.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::NPOOL 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
//--------------------------------------------------
if(GlobalV::BASIS_TYPE=="pw" || GlobalV::BASIS_TYPE=="lcao_in_pw")
{
Run_pw::plane_wave_line();
}
#ifdef __LCAO
else if(GlobalV::BASIS_TYPE=="lcao")
{
Run_lcao::lcao_line();
}
#endif
ModuleBase::timer::finish( GlobalV::ofs_running );
ModuleBase::Memory::print_all( GlobalV::ofs_running ) ;
return;
}