ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
big_grid.h
Go to the documentation of this file.
1#ifndef ABACUS_SOURCE_HAMILT_MODULE_GINT_BIG_GRID_H
2#define ABACUS_SOURCE_HAMILT_MODULE_GINT_BIG_GRID_H
3
4#include "biggrid_info.h"
5#include "gint_atom.h"
6#include "gint_type.h"
7#include "localcell_info.h"
8#include "unitcell_info.h"
9#include <memory>
10#include <vector>
11
12namespace ModuleGint
13{
14
16{
17 public:
18 // constructor
19 BigGrid(int idx);
20
21 static void init_localcell_info(std::shared_ptr<const LocalCellInfo> localcell_info)
22 {
23 localcell_info_ = localcell_info;
24 }
25 static void init_unitcell_info(std::shared_ptr<const UnitCellInfo> unitcell_info)
26 {
27 unitcell_info_ = unitcell_info;
28 }
29 static void init_bgrid_info(std::shared_ptr<const BigGridInfo> biggrid_info) { biggrid_info_ = biggrid_info; }
30
31 // getter functions
32 int get_idx() const { return idx_; }
33 static std::shared_ptr<const LocalCellInfo> get_localcell_info() { return localcell_info_; }
34 static std::shared_ptr<const UnitCellInfo> get_unitcell_info() { return unitcell_info_; }
35 static std::shared_ptr<const BigGridInfo> get_bgrid_info() { return biggrid_info_; }
36 const std::vector<const GintAtom *> &get_atoms() const { return atoms_; }
37 const GintAtom *get_atom(int i) const { return atoms_[i]; }
38
39 // get the number of meshgrids in the big grid
40 int get_mgrids_num() const { return biggrid_info_->get_mgrids_num(); }
41
42 // get the number of atoms that can affect the big grid
43 int get_atoms_num() const { return atoms_.size(); }
44
45 // add an atom to the big grid
46 void add_atom(const GintAtom *atom);
47
48 // get the total number of phi of a meshgrid
49 // return: (\sum_{i=0}^{atoms_->size()} atoms_[i]->nw)
50 int get_phi_len() const;
51
52 // set the start index of the phi of each atom
53 // return: vector[i] = \sum_{j=0}^{i-1} atoms_[j]->nw
54 void set_atoms_startidx(std::vector<int> &startidx) const;
55
56 // set the length of phi of each atom
57 void set_atoms_phi_len(std::vector<int> &phi_len) const;
58
59 // set the coordinates of the meshgrids of the big grid
60 void set_mgrids_coord(std::vector<Vec3d> &coord) const;
61
62 // set the 1D index of the meshgrids in the local cell
63 void set_mgrids_local_idx(std::vector<int> &mgrids_idx) const;
64
65 // a wrapper function to get the relative coordinates of the atom and the meshgrids
66 void set_atom_relative_coords(const GintAtom *atom, std::vector<Vec3d> &atom_coord) const;
67
76 const Vec3i bgrid_idx, const Vec3d tau_in_bgrid, std::vector<Vec3d> &atom_coord) const;
77
78 // get the relative coords of the atom and the biggrid (used in gpu code)
79 Vec3d get_bgrid_atom_rcoord(const GintAtom *atom) const;
80
81 // if the atom affects the big grid, return true, otherwise false
82 // note when we say an atom affects a big grid, it does not mean that the atom affects all the meshgrid on the big
83 // grid, it may only affect a part of them.
84 bool is_atom_on_bgrid(const GintAtom *atom) const;
85
86 private:
87 // atoms that can affect the big grid
88 std::vector<const GintAtom *> atoms_;
89
90 // the 1D index of the big grid in the local cell
91 const int idx_;
92
93 // local cell info
94 static std::shared_ptr<const LocalCellInfo> localcell_info_;
95
96 // unitcell info
97 static std::shared_ptr<const UnitCellInfo> unitcell_info_;
98
99 // the big grid info
100 static std::shared_ptr<const BigGridInfo> biggrid_info_;
101};
102
103} // namespace ModuleGint
104
105#endif // ABACUS_SOURCE_HAMILT_MODULE_GINT_BIG_GRID_H
static std::shared_ptr< const UnitCellInfo > get_unitcell_info()
Definition big_grid.h:34
static std::shared_ptr< const UnitCellInfo > unitcell_info_
Definition big_grid.h:97
static std::shared_ptr< const BigGridInfo > biggrid_info_
Definition big_grid.h:100
static void init_bgrid_info(std::shared_ptr< const BigGridInfo > biggrid_info)
Definition big_grid.h:29
const std::vector< const GintAtom * > & get_atoms() const
Definition big_grid.h:36
const GintAtom * get_atom(int i) const
Definition big_grid.h:37
int get_phi_len() const
Definition big_grid.cpp:13
static void init_unitcell_info(std::shared_ptr< const UnitCellInfo > unitcell_info)
Definition big_grid.h:25
static void init_localcell_info(std::shared_ptr< const LocalCellInfo > localcell_info)
Definition big_grid.h:21
int get_atoms_num() const
Definition big_grid.h:43
void set_atom_relative_coords(const GintAtom *atom, std::vector< Vec3d > &atom_coord) const
Definition big_grid.cpp:72
void set_mgrids_local_idx(std::vector< int > &mgrids_idx) const
Definition big_grid.cpp:52
BigGrid(int idx)
Definition big_grid.cpp:9
void set_mgrids_coord(std::vector< Vec3d > &coord) const
Definition big_grid.cpp:42
static std::shared_ptr< const BigGridInfo > get_bgrid_info()
Definition big_grid.h:35
static std::shared_ptr< const LocalCellInfo > get_localcell_info()
Definition big_grid.h:33
int get_mgrids_num() const
Definition big_grid.h:40
int get_idx() const
Definition big_grid.h:32
const int idx_
Definition big_grid.h:91
void set_atoms_phi_len(std::vector< int > &phi_len) const
Definition big_grid.cpp:33
std::vector< const GintAtom * > atoms_
Definition big_grid.h:88
void add_atom(const GintAtom *atom)
Definition big_grid.cpp:11
bool is_atom_on_bgrid(const GintAtom *atom) const
Definition big_grid.cpp:99
Vec3d get_bgrid_atom_rcoord(const GintAtom *atom) const
Definition big_grid.cpp:93
void set_atoms_startidx(std::vector< int > &startidx) const
Definition big_grid.cpp:23
static std::shared_ptr< const LocalCellInfo > localcell_info_
Definition big_grid.h:94
Definition gint_atom.h:12
Definition batch_biggrid.cpp:4
ModuleBase::Vector3< double > Vec3d
Definition gint_type.h:11
ModuleBase::Vector3< int > Vec3i
Definition gint_type.h:12