Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 29 additions & 24 deletions source/source_io/module_restart/restart_exx_csr.h
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
#pragma once
#include "source_lcao/module_ri/abfs-vector3_order.h"
#include "source_cell/unitcell.h"
#include "source_lcao/module_ri/RI_Util.h"
#include "source_lcao/module_ri/abfs-vector3_order.h"

#include <RI/global/Tensor.h>
#include <map>

namespace ModuleIO
{
using TC = std::array<int, 3>;
using TAC = std::pair<int, TC>;
using TC = std::array<int, 3>;
using TAC = std::pair<int, TC>;

/// read Hexxs in CSR format
template<typename Tdata>
void read_Hexxs_csr(const std::string& file_name, const UnitCell& ucell,
const int nspin, const int nbasis,
std::vector<std::map<int, std::map<TAC, RI::Tensor<Tdata>>>>& Hexxs);
/// read Hexxs in CSR format
template <typename Tdata>
void read_Hexxs_csr(const std::string& file_name,
const UnitCell& ucell,
const int nspin,
const int nbasis,
std::vector<std::map<int, std::map<TAC, RI::Tensor<Tdata>>>>& Hexxs);

/// read Hexxs in cereal format
template<typename Tdata>
void read_Hexxs_cereal(const std::string& file_name,
std::vector<std::map<int, std::map<TAC, RI::Tensor<Tdata>>>>& Hexxs);
/// read Hexxs in cereal format
template <typename Tdata>
void read_Hexxs_cereal(const std::string& file_name,
std::vector<std::map<int, std::map<TAC, RI::Tensor<Tdata>>>>& Hexxs);

/// write Hexxs in CSR format
template<typename Tdata>
void write_Hexxs_csr(const std::string& file_name, const UnitCell& ucell,
const std::map<int, std::map<TAC, RI::Tensor<Tdata>>>& Hexxs);
/// write Hexxs in CSR format
template <typename Tdata>
void write_Hexxs_csr(const std::string& file_name,
const UnitCell& ucell,
const std::map<int, std::map<TAC, RI::Tensor<Tdata>>>& Hexxs);

/// calculate CSR sparse matrix from the global matrix stored with RI::Tensor
/// the return type is same as SR_sparse, HR_sparse, etc.
template<typename Tdata>
std::map<Abfs::Vector3_Order<int>, std::map<size_t, std::map<size_t, Tdata>>>
calculate_RI_Tensor_sparse(const double& sparse_threshold,
const std::vector<std::map<int, std::map<TAC, RI::Tensor<Tdata>>>>& Hexxs,
const UnitCell& ucell);
}
/// calculate CSR sparse matrix from the global matrix stored with RI::Tensor
/// the return type is same as SR_sparse, HR_sparse, etc.
template <typename Tdata>
std::map<Abfs::Vector3_Order<int>, std::map<size_t, std::map<size_t, Tdata>>> calculate_RI_Tensor_sparse(
const double& sparse_threshold,
const std::vector<std::map<int, std::map<TAC, RI::Tensor<Tdata>>>>& Hexxs,
const UnitCell& ucell);
} // namespace ModuleIO

#include "restart_exx_csr.hpp"
Loading
Loading