ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
frame_append.h
Go to the documentation of this file.
1#ifndef FRAME_APPEND_H
2#define FRAME_APPEND_H
3
4#include <stdexcept>
5#include <string>
6
7namespace ModuleIO
8{
9
20inline bool frame_appends(const int out_app_flag, const int istep)
21{
22 if (out_app_flag < 0 || out_app_flag > 2)
23 {
24 throw std::invalid_argument("frame_appends: out_app_flag must be 0, 1 or 2, got "
25 + std::to_string(out_app_flag));
26 }
27 if (istep < 0)
28 {
29 throw std::invalid_argument("frame_appends: istep must be non-negative, got "
30 + std::to_string(istep));
31 }
32
33 return out_app_flag == 1 && istep > 0;
34}
35
37inline std::string stru_frame_filename(const std::string& directory, const int out_app_flag, const int istep)
38{
39 frame_appends(out_app_flag, istep);
40 if (out_app_flag == 2)
41 {
42 return directory + "STRU" + std::to_string(istep + 1);
43 }
44 return directory + "STRU";
45}
46
47} // namespace ModuleIO
48
49#endif // FRAME_APPEND_H
Internal helpers shared by the R-space sparse text writers. Declared here (instead of duplicated in e...
Definition csr_reader.cpp:8
bool frame_appends(const int out_app_flag, const int istep)
Tell whether an output written for ionic step istep should append.
Definition frame_append.h:20
std::string stru_frame_filename(const std::string &directory, const int out_app_flag, const int istep)
Fixed STRU for overwrite/append modes; numbered STRU for mode 2.
Definition frame_append.h:37