ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
restart.h
Go to the documentation of this file.
1#ifndef RESTART_H
2#define RESTART_H
3
4#include <string>
7#ifdef __EXX
8#include <RI/global/Tensor.h>
9#endif
10
12{
13public:
14 struct Info_Save
15 {
16 bool save_charge = false;
17 bool save_H = false; // save H means save Hexx now, will be changed in the future.
18 };
20
21 struct Info_Load
22 {
23 bool load_charge = false;
24 bool load_charge_finish = false;
25 bool load_H = false;
26 bool load_H_finish = false;
27 bool restart_exx = false; // to avoid the repeated load in MD/Relax
28 };
30
31 std::string folder;
32
33 template<typename T>
34 bool save_disk(const std::string label, const int index, const int size, T* data, const bool error_quit = true) const
35 {
38 data,
39 size * sizeof(T),
40 error_quit);
41 }
42 template<typename T>
43 bool load_disk(const std::string label, const int index, const int size, T* data, const bool error_quit = true) const
44 {
47 data,
48 size * sizeof(T),
49 error_quit);
50 }
51private:
52 void write_file1(const std::string &file_name, const void*const ptr, const size_t size) const;
53 void read_file1(const std::string &file_name, void*const ptr, const size_t size) const;
54 bool write_file2(const std::string& file_name, const void* const ptr, const size_t size, const bool error_quit = true) const;
55 bool read_file2(const std::string& file_name, void* const ptr, const size_t size, const bool error_quit = true) const;
56};
57
58#endif
Definition restart.h:12
std::string folder
Definition restart.h:31
void read_file1(const std::string &file_name, void *const ptr, const size_t size) const
Definition restart.cpp:17
Info_Load info_load
Definition restart.h:29
bool write_file2(const std::string &file_name, const void *const ptr, const size_t size, const bool error_quit=true) const
Definition restart.cpp:23
bool read_file2(const std::string &file_name, void *const ptr, const size_t size, const bool error_quit=true) const
Definition restart.cpp:45
bool load_disk(const std::string label, const int index, const int size, T *data, const bool error_quit=true) const
Definition restart.h:43
Info_Save info_save
Definition restart.h:19
bool save_disk(const std::string label, const int index, const int size, T *data, const bool error_quit=true) const
Definition restart.h:34
void write_file1(const std::string &file_name, const void *const ptr, const size_t size) const
Definition restart.cpp:11
#define T
Definition exp.cpp:237
int MY_RANK
global index of process
Definition global_variable.cpp:21
std::string TO_STRING(const T &t, const int n=20)
Definition global_function.h:239
Definition restart.h:22
bool load_charge
Definition restart.h:23
bool load_charge_finish
Definition restart.h:24
bool restart_exx
Definition restart.h:27
bool load_H
Definition restart.h:25
bool load_H_finish
Definition restart.h:26
Definition restart.h:15
bool save_H
Definition restart.h:17
bool save_charge
Definition restart.h:16