ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
gint_info.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <vector>
9#include "gint_type.h"
10#include "big_grid.h"
11#include "gint_atom.h"
12#include "unitcell_info.h"
13#include "localcell_info.h"
14#include "divide_info.h"
15
16#ifdef __CUDA
17#include "batch_biggrid.h"
19#endif
20
21namespace ModuleGint
22{
23
25{
26 public:
27 // constructor
29 int nbx, int nby, int nbz,
30 int nmx, int nmy, int nmz,
31 int startidx_bx, int startidx_by, int startidx_bz,
32 int nbx_local, int nby_local, int nbz_local,
33 const Numerical_Orbital* Phi,
34 const UnitCell& ucell, Grid_Driver& gd);
35
36 // getter functions
37 const std::vector<std::shared_ptr<BigGrid>>& get_biggrids() { return biggrids_; }
38 const std::vector<int>& get_trace_lo() const{ return trace_lo_; }
39 int get_lgd() const { return lgd_; }
40 int get_nat() const { return ucell_->nat; } // return the number of atoms in the unitcell
41 const UnitCell* get_ucell() const { return ucell_; }
42 const std::vector<int>& get_ijr_info() const {return ijr_info_;}
43 int get_local_mgrid_num() const { return localcell_info_->get_mgrids_num(); }
44 double get_mgrid_volume() const { return meshgrid_info_->get_volume(); }
45
46 //=========================================
47 // functions about hcontainer
48 //=========================================
49 template <typename T>
50 HContainer<T> get_hr(int npol = 1) const;
51
52 private:
53 // initialize the atoms
54 void init_atoms_(int ntype, const Atom* atoms, const Numerical_Orbital* Phi);
55
56 // initialize trace_lo_ and lgd_
57 void init_trace_lo_(const UnitCell& ucell, const int nspin);
58
59 // initialize the ijr_info
60 void init_ijr_info_(const UnitCell& ucell, Grid_Driver& gd);
61
63
64 // the unitcell information
65 std::shared_ptr<const UnitCellInfo> unitcell_info_;
66
67 // the biggrid information
68 std::shared_ptr<const BigGridInfo> biggrid_info_;
69
70 // the meshgrid information
71 std::shared_ptr<const MeshGridInfo> meshgrid_info_;
72
73 // the divide information
74 std::shared_ptr<const DivideInfo> divide_info_;
75
76 // the localcell information
77 std::shared_ptr<const LocalCellInfo> localcell_info_;
78
79 // the big grids on this processor
80 std::vector<std::shared_ptr<BigGrid>> biggrids_;
81
82 // the total atoms in the unitcell(include extended unitcell) on this processor
83 // atoms[iat][Vec3i] is the atom with index iat in the unitcell with index Vec3i
84 // Note: Since GintAtom does not implement a default constructor,
85 // the map should not be accessed using [], but rather using the at function
86 std::vector<std::map<Vec3i, GintAtom>> atoms_;
87
88 // if the iat-th(global index) atom is in this processor, return true
89 std::vector<bool> is_atom_in_proc_;
90
91 // format for storing atomic pair information in hcontainer, used for initializing hcontainer
92 std::vector<int> ijr_info_;
93
94 // map the global index of atomic orbitals to local index
95 std::vector<int> trace_lo_;
96
97 // store the information about Numerical orbitals
98 std::vector<Numerical_Orbital> orbs_;
99
100 // total num of atomic orbitals on this proc
101 int lgd_ = 0;
102
103 #ifdef __CUDA
104 public:
105 std::vector<std::shared_ptr<BatchBigGrid>>& get_bgrid_batches() { return bgrid_batches_; };
106 std::shared_ptr<const GintGpuVars> get_gpu_vars() const { return gpu_vars_; };
107 int get_dev_id() const { return gpu_vars_->dev_id_; };
108 int get_streams_num() const { return streams_num_; };
109
110 private:
111 void init_bgrid_batches_(int batch_size);
112 std::vector<std::shared_ptr<BatchBigGrid>> bgrid_batches_;
113 std::shared_ptr<const GintGpuVars> gpu_vars_;
114 // More streams can improve parallelism and may speed up grid integration, at the cost of higher GPU memory usage.
115 int streams_num_;
116 #endif
117};
118
119} // namespace ModuleGint
Definition atom_spec.h:7
Definition sltk_grid_driver.h:43
Definition gint_info.h:25
void init_ijr_info_(const UnitCell &ucell, Grid_Driver &gd)
Definition gint_info.cpp:199
HContainer< T > get_hr(int npol=1) const
Definition gint_info.cpp:66
const std::vector< int > & get_trace_lo() const
Definition gint_info.h:38
std::shared_ptr< const MeshGridInfo > meshgrid_info_
Definition gint_info.h:71
const UnitCell * get_ucell() const
Definition gint_info.h:41
int get_local_mgrid_num() const
Definition gint_info.h:43
const UnitCell * ucell_
Definition gint_info.h:62
std::vector< Numerical_Orbital > orbs_
Definition gint_info.h:98
void init_atoms_(int ntype, const Atom *atoms, const Numerical_Orbital *Phi)
Definition gint_info.cpp:78
int lgd_
Definition gint_info.h:101
void init_trace_lo_(const UnitCell &ucell, const int nspin)
Definition gint_info.cpp:158
std::vector< bool > is_atom_in_proc_
Definition gint_info.h:89
int get_lgd() const
Definition gint_info.h:39
std::shared_ptr< const LocalCellInfo > localcell_info_
Definition gint_info.h:77
std::vector< std::map< Vec3i, GintAtom > > atoms_
Definition gint_info.h:86
std::vector< int > ijr_info_
Definition gint_info.h:92
std::vector< std::shared_ptr< BigGrid > > biggrids_
Definition gint_info.h:80
double get_mgrid_volume() const
Definition gint_info.h:44
std::shared_ptr< const BigGridInfo > biggrid_info_
Definition gint_info.h:68
std::shared_ptr< const UnitCellInfo > unitcell_info_
Definition gint_info.h:65
const std::vector< std::shared_ptr< BigGrid > > & get_biggrids()
Definition gint_info.h:37
const std::vector< int > & get_ijr_info() const
Definition gint_info.h:42
std::vector< int > trace_lo_
Definition gint_info.h:95
std::shared_ptr< const DivideInfo > divide_info_
Definition gint_info.h:74
int get_nat() const
Definition gint_info.h:40
Definition ORB_atomic.h:52
Definition unitcell.h:17
int & nat
Definition unitcell.h:48
Definition hcontainer.h:144
Definition batch_biggrid.cpp:4