|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
Classes | |
| struct | CsrTextHeader |
| Metadata shared by every self-describing CSR text writer. More... | |
Functions | |
| template<typename Tdata> | |
| std::vector< long long > | count_nonzeros_by_R (const SparseRMatrix< Tdata > &smat, const std::set< RCoordinate > &all_R_coor, const double threshold, const bool reduce) |
| Count non-zero elements per R-block of a sparse R-matrix. | |
| void | check_output_file_open (const std::ofstream &ofs, const std::string &filename, const std::string &context) |
| Quit if a sparse-matrix output stream failed to open. | |
| bool | append_ionic_step (const int out_app_flag, const int istep) |
| Decide whether the current ionic step appends to an existing file. | |
| std::string | make_sparse_R_filename (const std::string &prefix, const std::string &spin_suffix, const bool numbered, const int istep, const std::string &extension) |
| Build the "<prefix><spin suffix>[g<step>]_nao<ext>" name shared by every R-space sparse output. | |
| void | write_csr_text_header (std::ofstream &ofs, const CsrTextHeader &header) |
| Write the common self-describing header of a CSR text file. | |
| void | write_csr_binary_header (std::ofstream &ofs, const int step, const int nbasis, const int number_of_R) |
| Write the three-integer binary CSR header. | |
| void | write_R_record (std::ofstream &ofs, const int rx, const int ry, const int rz, const long long nnz, const bool binary, const bool leading_space) |
| Write the "Rx Ry Rz nnz" record that starts one R block. | |
| bool | lat_r_nonempty (const int nonzero_num[3]) |
| void | assemble_csr (const std::string &output_filename, const std::string &payload_filename, int step, int nlocal, int output_R_number, bool binary, bool append, const std::string &axis, const UnitCell *ucell, const std::string &context) |
| Assemble one r(R) component file from its temporary block payload. | |
|
inline |
Decide whether the current ionic step appends to an existing file.
Mode 1 appends all ionic steps after the first written one; mode 0 and mode 2 always start a fresh stream (mode 2 embeds the step in the file name). Single-point runs pass istep <= 0 and truncate.
| out_app_flag | Output append mode from INPUT. |
| istep | Zero-based ionic step index. |
| void ModuleIO::detail::assemble_csr | ( | const std::string & | output_filename, |
| const std::string & | payload_filename, | ||
| int | step, | ||
| int | nlocal, | ||
| int | output_R_number, | ||
| bool | binary, | ||
| bool | append, | ||
| const std::string & | axis, | ||
| const UnitCell * | ucell, | ||
| const std::string & | context ) |
Assemble one r(R) component file from its temporary block payload.
Text output uses the same self-describing header and CSR banner as H(R)/S(R)/dH(R) files, while binary output keeps the three-integer header followed by the raw block records.
| output_filename | Final file name of this Cartesian component. |
| payload_filename | Temporary file holding the CSR block records. |
| step | One-based ionic step written into the header. |
| nlocal | Number of localized basis functions. |
| output_R_number | Number of Bravais lattice vectors written. |
| binary | Whether the payload and output are binary. |
| append | Whether to append to the existing output file. |
| axis | Cartesian component label ("x", "y" or "z"). |
| ucell | Unit cell written into the text header; must not be null. |
| context | Caller name used in diagnostics. |
|
inline |
Quit if a sparse-matrix output stream failed to open.
| ofs | Stream to check. |
| filename | Filename for the error message. |
| context | Caller tag for the error message. |
| std::vector< long long > ModuleIO::detail::count_nonzeros_by_R | ( | const SparseRMatrix< Tdata > & | smat, |
| const std::set< RCoordinate > & | all_R_coor, | ||
| const double | threshold, | ||
| const bool | reduce ) |
Count non-zero elements per R-block of a sparse R-matrix.
| smat | Sparse matrix keyed by R-coordinate. |
| all_R_coor | Ordered set of R-coordinates to scan. |
| threshold | Magnitude below which an element is treated as zero. |
| reduce | If true, allreduce the per-R counts across MPI ranks. |
| bool ModuleIO::detail::lat_r_nonempty | ( | const int | nonzero_num[3] | ) |
|
inline |
Build the "<prefix><spin suffix>[g<step>]_nao<ext>" name shared by every R-space sparse output.
Centralizing the suffix order keeps H(R), S(R), DM(R), dH/dR, r(R), T(R), Vxc(R) and L(R) file names consistent and avoids one writer drifting from the others.
| prefix | Property prefix without spin or step, e.g. "dhrx", "rrx". |
| spin_suffix | Spin token appended to the prefix ("s1", "1") or empty when the quantity is spin independent. |
| numbered | Whether to embed the one-based ionic step. |
| istep | Zero-based ionic step index. |
| extension | File extension including the leading dot. |
|
inline |
Write the three-integer binary CSR header.
| ofs | Output binary stream. |
| step | One-based ionic step. |
| nbasis | Number of localized basis functions. |
| number_of_R | Number of R blocks actually written. |
|
inline |
Write the common self-describing header of a CSR text file.
| ofs | Output text stream. |
| header | Header fields; ucell must not be null. |
|
inline |
Write the "Rx Ry Rz nnz" record that starts one R block.
| ofs | Output stream. |
| rx | First Bravais lattice vector component. |
| ry | Second Bravais lattice vector component. |
| rz | Third Bravais lattice vector component. |
| nnz | Number of non-zero elements in the block. |
| binary | Whether the stream uses the binary record layout. |
| leading_space | Prefix the text record with a space (save_sparse layout). |