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