ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
sltk_grid_driver.h
Go to the documentation of this file.
1#ifndef GRID_DRIVER_H
2#define GRID_DRIVER_H
3
7#include "sltk_grid.h"
8
9#include <memory>
10#include <stdexcept>
11#include <tuple>
12
13//==========================================================
14// Struct of array for packing the Adjacent atom information
15//==========================================================
17{
18 public:
20 {
21 }
23 std::vector<int> ntype;
24 std::vector<int> natom;
25 std::vector<ModuleBase::Vector3<double>> adjacent_tau;
26 std::vector<ModuleBase::Vector3<int>> box;
27 void clear()
28 {
29 adj_num = 0;
30 ntype.clear();
31 natom.clear();
32 adjacent_tau.clear();
33 box.clear();
34 }
35};
36
37void filter_adjs(const std::vector<bool>& is_adj, AdjacentAtomInfo& adjs);
38
39class Grid_Driver : public Grid
40{
41 public:
42 //==========================================================
43 // THE INTERFACE WITH USER :
44 // MEMBRE FUNCTIONS :
45 // NAME : Find_atom (input cartesian position,find the
46 // adjacent of this atom,and store the information
47 // in 'adj_num','ntype','natom'
48 //==========================================================
50 Grid_Driver(const int& test_d_in, const int& test_grid_in);
51
53
55
56 //==========================================================
57 // EXPLAIN FOR default parameter `adjs = nullptr`
58 //
59 // This design make Grid_Driver compatible with multi-thread usage
60 // 1. Find_atom store results in Grid_Driver::adj_info
61 // by default.
62 // 2. And store results into parameter adjs when adjs is
63 // NOT NULL
64 //==========================================================
65 void Find_atom(const UnitCell& ucell,
66 const int ntype,
67 const int nnumber,
68 AdjacentAtomInfo* adjs = nullptr) const;
69
70 // cartesian_posi and ucell is deprecated 20241204 zhanghaochong
71 // this interface is deprecated, please use Find_atom above
72 void Find_atom(const UnitCell& ucell,
73 const ModuleBase::Vector3<double>& cartesian_posi,
74 const int& ntype,
75 const int& nnumber,
76 AdjacentAtomInfo* adjs = nullptr) const;
77 //==========================================================
78 // EXPLAIN : The adjacent information for the input
79 // cartesian_pos
80 // MEMBER VARIABLES :
81 // NAME : getAdjacentNum
82 // NAME : getNtype
83 // NAME : getNatom
84 // NAME : getAdjaentTau
85 //==========================================================
86 const int& getAdjacentNum() const
87 {
88 return adj_info.adj_num;
89 }
90 const int& getType(const int i) const
91 {
92 return adj_info.ntype[i];
93 }
94 const int& getNatom(const int i) const
95 {
96 return adj_info.natom[i];
97 }
99 {
100 return adj_info.adjacent_tau[i];
101 }
102 const ModuleBase::Vector3<int>& getBox(const int i) const
103 {
104 return adj_info.box[i];
105 }
106
107 private:
110};
111#endif
const std::complex< double > i
Definition cal_pLpR.cpp:46
Definition sltk_grid_driver.h:17
int adj_num
Definition sltk_grid_driver.h:22
std::vector< ModuleBase::Vector3< double > > adjacent_tau
Definition sltk_grid_driver.h:25
AdjacentAtomInfo()
Definition sltk_grid_driver.h:19
std::vector< ModuleBase::Vector3< int > > box
Definition sltk_grid_driver.h:26
std::vector< int > ntype
Definition sltk_grid_driver.h:23
std::vector< int > natom
Definition sltk_grid_driver.h:24
void clear()
Definition sltk_grid_driver.h:27
Definition sltk_grid_driver.h:40
void Find_atom(const UnitCell &ucell, const int ntype, const int nnumber, AdjacentAtomInfo *adjs=nullptr) const
Definition sltk_grid_driver.cpp:25
Grid_Driver & operator=(Grid_Driver &&)=default
AdjacentAtomInfo adj_info
Definition sltk_grid_driver.h:108
const ModuleBase::Vector3< double > & getAdjacentTau(const int i) const
Definition sltk_grid_driver.h:98
const int & getType(const int i) const
Definition sltk_grid_driver.h:90
const int & getNatom(const int i) const
Definition sltk_grid_driver.h:94
const int & getAdjacentNum() const
Definition sltk_grid_driver.h:86
~Grid_Driver()
Definition sltk_grid_driver.cpp:21
const ModuleBase::Vector3< int > & getBox(const int i) const
Definition sltk_grid_driver.h:102
Grid_Driver()
Definition sltk_grid_driver.h:49
bool test_deconstructor
Definition sltk_grid_driver.h:109
3 elements vector
Definition vector3.h:24
Definition unitcell.h:15
Definition batch.h:6
void filter_adjs(const std::vector< bool > &is_adj, AdjacentAtomInfo &adjs)
Definition sltk_grid_driver.cpp:67