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