ri.h Source File

LibRPA: ri.h Source File
LibRPA
ri.h
Go to the documentation of this file.
1 
5 #ifndef RI_H
6 #define RI_H
7 #include <cstring>
8 #include <map>
9 #include <memory>
10 #include <utility>
11 #include "vector3_order.h"
12 #include "atoms.h"
13 #include "complexmatrix.h"
14 
15 #ifdef LIBRPA_USE_LIBRI
16 #include <RI/global/Tensor.h>
17 #else
18 #include "libri_stub.h"
19 #endif
20 #include "libri_utils.h"
21 
22 extern int n_irk_points;
23 extern int natom;
24 extern int ncell;
25 extern std::vector<Vector3_Order<double>> irk_points;
26 extern map<Vector3_Order<double>, double> irk_weight;
27 extern map<atom_t, size_t> atom_nw;
28 extern map<atom_t, size_t> atom_mu;
29 extern map<atom_t, size_t> atom_nw_loc;
30 extern map<atom_t, size_t> atom_mu_loc;
31 extern vector<size_t> atom_mu_part_range;
32 extern int N_all_mu;
33 
34 extern vector<atpair_t> tot_atpair;
35 extern vector<atpair_t> tot_atpair_ordered;
36 extern vector<atpair_t> local_atpair;
37 
39 typedef atom_mapping< map<Vector3_Order<int>, std::shared_ptr<matrix>> >::pair_t_old atpair_R_mat_t;
41 typedef atom_mapping< map<Vector3_Order<int>, std::shared_ptr<ComplexMatrix>> >::pair_t_old atpair_R_cplx_mat_t;
43 typedef atom_mapping< map<Vector3_Order<double>, std::shared_ptr<ComplexMatrix>> >::pair_t_old atpair_k_cplx_mat_t;
44 
45 struct Cs_LRI
46 {
47 public:
48  bool use_libri;
49  // Tri-coefficient of localized RI (LRI) in real space. ABF on the first atom of the atom pair
50  atpair_R_mat_t data_IJR;
51  // Tri-coefficient of localized RI (LRI) in real space, represented using LibRI tensor class
52  std::map<int, std::map<libri_types<int, int>::TAC, RI::Tensor<double>>> data_libri;
53 
54  void clear();
55 };
56 
57 extern Cs_LRI Cs_data;
58 
60 extern atpair_k_cplx_mat_t Vq;
63 
64 extern map<Vector3_Order<double>, ComplexMatrix> Vq_block_loc;
65 extern map<Vector3_Order<double>, ComplexMatrix> Vq_cut_block_loc;
66 
67 void allreduce_2D_coulomb_to_atompair(map<Vector3_Order<double>, ComplexMatrix> &Vq_loc, atpair_k_cplx_mat_t &coulomb_mat, double threshold );
68 void allreduce_atp_coulomb( atpair_k_cplx_mat_t &coulomb_mat );
69 
70 int atom_iw_loc2glo(const int &atom_index, const int &iw_lcoal);
71 int atom_mu_loc2glo(const int &atom_index, const int &mu_lcoal);
72 int atom_mu_glo2loc(const int &glo_index, int &mu_index); //in-out mu_index, return atom_index;
73 
74 void init_N_all_mu();
75 void allreduce_atp_aux();
78 
79 vector<int> get_part_range();
80 
82 matrix reshape_Cs(size_t n1, size_t n2, size_t n3, const shared_ptr<matrix> &Csmat);
84 matrix reshape_mat(size_t n1, size_t n2, size_t n3, const matrix &Csmat);
86 matrix reshape_mat_21(const size_t n1, const size_t n2, const size_t n3, const matrix &Csmat);
88 matrix reshape_mat_21(const size_t n1, const size_t n2, const size_t n3, const matrix &Csmat);
89 #endif
Utilies to handle atomic model and related data.
Definition: complexmatrix.h:20
Definition: libri_stub.h:19
Definition: vector3_order.h:15
Definition: matrix.h:23
matrix reshape_Cs(size_t n1, size_t n2, size_t n3, const shared_ptr< matrix > &Csmat)
Reshape Cs matrix from (n1*n2,n3) to (n2,n1*n3)
Definition: ri.cpp:81
atpair_R_cplx_mat_t inverse_FT_atpair_cplx_mat(atpair_k_cplx_mat_t kmat, vector< Vector3_Order< int >> Rlist)
inverse Fouriter transform of atom-pair mapping to complex matrix
atpair_k_cplx_mat_t Vq
Coulomb matrix in ABF, represented in the reciprocal space.
Definition: ri.cpp:34
atom_mapping< map< Vector3_Order< int >, std::shared_ptr< matrix > > >::pair_t_old atpair_R_mat_t
type alias of atom-pair mapping to real matrix indexed by unit-cell vector
Definition: ri.h:39
atpair_k_cplx_mat_t Vq_cut
Truncated Coulomb matrix in ABF, represented in the reciprocal space.
Definition: ri.cpp:35
atom_mapping< map< Vector3_Order< int >, std::shared_ptr< ComplexMatrix > > >::pair_t_old atpair_R_cplx_mat_t
type alias of atom-pair mapping to complex matrix indexed by unit-cell vector
Definition: ri.h:41
matrix reshape_mat(size_t n1, size_t n2, size_t n3, const matrix &Csmat)
Reshape Cs matrix from (n1,n2*n3) to (n2,n1*n3)
Definition: ri.cpp:96
matrix reshape_mat_21(const size_t n1, const size_t n2, const size_t n3, const matrix &Csmat)
Reshape Cs matrix from n1,n2*n3) to (n1*n2,n3)
Definition: ri.cpp:111
atom_mapping< map< Vector3_Order< double >, std::shared_ptr< ComplexMatrix > > >::pair_t_old atpair_k_cplx_mat_t
type alias of atom-pair mapping to complex matrix indexed by reciprocal vector
Definition: ri.h:43
Definition: ri.h:46
mapping from atom entries to data
Definition: atoms.h:30