ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
hs_sparse_io.h
Go to the documentation of this file.
1#ifndef HS_SPARSE_IO_H
2#define HS_SPARSE_IO_H
3
6
7#include <cstddef>
8#include <map>
9#include <set>
10#include <string>
11
12class UnitCell;
13
14namespace ModuleIO
15{
17
18template <typename T>
19using SparseRBlock = std::map<size_t, std::map<size_t, T>>;
20
21template <typename T>
22using SparseRMatrix = std::map<RCoordinate, SparseRBlock<T>>;
23
25{
26 std::string filename;
27 std::string label;
28 double threshold = 0.0;
29 bool binary = false;
30 int precision = 16;
31 int istep = -1;
32 bool reduce = true;
33 // Runtime flags that decide file-open mode (append on md restart).
34 // Must be provided explicitly by the caller instead of reading PARAM.
35 std::string calculation;
36 int out_app_flag = 0;
37 // Text output style: self-describing header with cell information and
38 // annotated CSR blocks, matching the H(R)/S(R) CSR files. Binary output
39 // keeps the compact record layout regardless of this flag.
40 bool csr_format = false;
41 // Unit cell written into the self-describing text header; required when
42 // csr_format is true.
43 const UnitCell* ucell = nullptr;
44 // Spin metadata written into the self-describing text header. Spin
45 // independent outputs keep the defaults (one spin direction, index 0).
46 int nspin = 1;
47 int ispin = 0;
48};
49
50template <typename Tdata>
51void save_sparse(const SparseRMatrix<Tdata>& smat,
52 const std::set<RCoordinate>& all_R_coor,
53 const Parallel_Orbitals& pv,
54 const SparseWriteOptions& options);
55} // namespace ModuleIO
56
57#endif
Definition abfs_vector3_order.h:16
Definition parallel_orbitals.h:16
Provide the basic information about unitcell.
Definition unitcell.h:16
Internal helpers shared by the R-space sparse text writers. Declared here (instead of duplicated in e...
Definition csr_reader.cpp:8
std::map< RCoordinate, SparseRBlock< T > > SparseRMatrix
Definition hs_sparse_io.h:22
void save_sparse(const SparseRMatrix< Tdata > &smat, const std::set< RCoordinate > &all_R_coor, const Parallel_Orbitals &pv, const SparseWriteOptions &options)
Definition hs_sparse_io.cpp:93
Abfs::Vector3_Order< int > RCoordinate
Definition hs_sparse_io.h:16
std::map< size_t, std::map< size_t, T > > SparseRBlock
Definition hs_sparse_io.h:19
Definition hs_sparse_io.h:25
int out_app_flag
Definition hs_sparse_io.h:36
int nspin
Definition hs_sparse_io.h:46
bool reduce
Definition hs_sparse_io.h:32
bool csr_format
Definition hs_sparse_io.h:40
int precision
Definition hs_sparse_io.h:30
double threshold
Definition hs_sparse_io.h:28
std::string label
Definition hs_sparse_io.h:27
int istep
Definition hs_sparse_io.h:31
std::string calculation
Definition hs_sparse_io.h:35
int ispin
Definition hs_sparse_io.h:47
const UnitCell * ucell
Definition hs_sparse_io.h:43
std::string filename
Definition hs_sparse_io.h:26
bool binary
Definition hs_sparse_io.h:29