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 int get_local_mgrid_num() const { return localcell_info_->get_mgrids_num(); }
42 double get_mgrid_volume() const { return meshgrid_info_->get_volume(); }
43
44 //=========================================
45 // functions about hcontainer
46 //=========================================
47 template <typename T>
48 HContainer<T> get_hr(int npol = 1) const;
49
50 private:
51 // initialize the atoms
52 void init_atoms_(int ntype, const Atom* atoms, const Numerical_Orbital* Phi);
53
54 // initialize trace_lo_ and lgd_
55 void init_trace_lo_(const UnitCell& ucell, const int nspin);
56
57 // initialize the ijr_info
58 void init_ijr_info_(const UnitCell& ucell, Grid_Driver& gd);
59
61
62 // the unitcell information
63 std::shared_ptr<const UnitCellInfo> unitcell_info_;
64
65 // the biggrid information
66 std::shared_ptr<const BigGridInfo> biggrid_info_;
67
68 // the meshgrid information
69 std::shared_ptr<const MeshGridInfo> meshgrid_info_;
70
71 // the divide information
72 std::shared_ptr<const DivideInfo> divide_info_;
73
74 // the localcell information
75 std::shared_ptr<const LocalCellInfo> localcell_info_;
76
77 // the big grids on this processor
78 std::vector<std::shared_ptr<BigGrid>> biggrids_;
79
80 // the total atoms in the unitcell(include extended unitcell) on this processor
81 // atoms[iat][Vec3i] is the atom with index iat in the unitcell with index Vec3i
82 // Note: Since GintAtom does not implement a default constructor,
83 // the map should not be accessed using [], but rather using the at function
84 std::vector<std::map<Vec3i, GintAtom>> atoms_;
85
86 // if the iat-th(global index) atom is in this processor, return true
87 std::vector<bool> is_atom_in_proc_;
88
89 // format for storing atomic pair information in hcontainer, used for initializing hcontainer
90 std::vector<int> ijr_info_;
91
92 // map the global index of atomic orbitals to local index
93 std::vector<int> trace_lo_;
94
95 // store the information about Numerical orbitals
96 std::vector<Numerical_Orbital> orbs_;
97
98 // total num of atomic orbitals on this proc
99 int lgd_ = 0;
100
101 #ifdef __CUDA
102 public:
103 std::vector<std::shared_ptr<BatchBigGrid>>& get_bgrid_batches() { return bgrid_batches_; };
104 std::shared_ptr<const GintGpuVars> get_gpu_vars() const { return gpu_vars_; };
105 int get_dev_id() const { return gpu_vars_->dev_id_; };
106 int get_streams_num() const { return streams_num_; };
107
108 private:
109 void init_bgrid_batches_(int batch_size);
110 std::vector<std::shared_ptr<BatchBigGrid>> bgrid_batches_;
111 std::shared_ptr<const GintGpuVars> gpu_vars_;
112 // More streams can improve parallelism and may speed up grid integration, at the cost of higher GPU memory usage.
113 int streams_num_;
114 #endif
115};
116
117} // 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:69
int get_local_mgrid_num() const
Definition gint_info.h:41
const UnitCell * ucell_
Definition gint_info.h:60
std::vector< Numerical_Orbital > orbs_
Definition gint_info.h:96
void init_atoms_(int ntype, const Atom *atoms, const Numerical_Orbital *Phi)
Definition gint_info.cpp:78
int lgd_
Definition gint_info.h:99
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:87
int get_lgd() const
Definition gint_info.h:39
std::shared_ptr< const LocalCellInfo > localcell_info_
Definition gint_info.h:75
std::vector< std::map< Vec3i, GintAtom > > atoms_
Definition gint_info.h:84
std::vector< int > ijr_info_
Definition gint_info.h:90
std::vector< std::shared_ptr< BigGrid > > biggrids_
Definition gint_info.h:78
double get_mgrid_volume() const
Definition gint_info.h:42
std::shared_ptr< const BigGridInfo > biggrid_info_
Definition gint_info.h:66
std::shared_ptr< const UnitCellInfo > unitcell_info_
Definition gint_info.h:63
const std::vector< std::shared_ptr< BigGrid > > & get_biggrids()
Definition gint_info.h:37
std::vector< int > trace_lo_
Definition gint_info.h:93
std::shared_ptr< const DivideInfo > divide_info_
Definition gint_info.h:72
int get_nat() const
Definition gint_info.h:40
Definition ORB_atomic.h:52
Definition unitcell.h:16
int & nat
Definition unitcell.h:46
Definition hcontainer.h:144
Definition batch_biggrid.cpp:4