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
5#ifndef GRID_DRIVER_H
6#define GRID_DRIVER_H
7
11#include "sltk_grid.h"
12
13#include <memory>
14#include <stdexcept>
15#include <tuple>
16
21{
22 public:
27 {
28 }
29
30 int adj_num;
31 std::vector<int> ntype;
32 std::vector<int> natom;
33 std::vector<ModuleBase::Vector3<double>> adjacent_tau;
34 std::vector<ModuleBase::Vector3<int>> box;
35
39 void clear()
40 {
41 adj_num = 0;
42 ntype.clear();
43 natom.clear();
44 adjacent_tau.clear();
45 box.clear();
46 }
47};
48
55void filter_adjs(const std::vector<bool>& is_adj, AdjacentAtomInfo& adjs);
56
62class Grid_Driver : public Grid
63{
64 public:
69
76 Grid_Driver(const int& test_d_in, const int& test_grid_in);
77
82
84
97 void Find_atom(const UnitCell& ucell,
98 const int ntype,
99 const int nnumber,
100 AdjacentAtomInfo* adjs = nullptr) const;
101
114 void Find_atom(const UnitCell& ucell,
115 const ModuleBase::Vector3<double>& cartesian_posi,
116 const int& ntype,
117 const int& nnumber,
118 AdjacentAtomInfo* adjs = nullptr) const;
119
124 const int& getAdjacentNum() const
125 {
126 return adj_info.adj_num;
127 }
128
134 const int& getType(const int i) const
135 {
136 return adj_info.ntype[i];
137 }
138
144 const int& getNatom(const int i) const
145 {
146 return adj_info.natom[i];
147 }
148
155 {
156 return adj_info.adjacent_tau[i];
157 }
158
164 const ModuleBase::Vector3<int>& getBox(const int i) const
165 {
166 return adj_info.box[i];
167 }
168
174 {
175 return adj_info;
176 }
177
178 private:
181};
182#endif
Struct of array for packing the Adjacent atom information.
Definition sltk_grid_driver.h:21
int adj_num
number of adjacent atoms
Definition sltk_grid_driver.h:30
std::vector< ModuleBase::Vector3< double > > adjacent_tau
positions of adjacent atoms
Definition sltk_grid_driver.h:33
AdjacentAtomInfo()
Default constructor.
Definition sltk_grid_driver.h:26
std::vector< ModuleBase::Vector3< int > > box
box indices of adjacent atoms
Definition sltk_grid_driver.h:34
std::vector< int > ntype
types of adjacent atoms
Definition sltk_grid_driver.h:31
std::vector< int > natom
indices of adjacent atoms
Definition sltk_grid_driver.h:32
void clear()
Clear all adjacent atom information.
Definition sltk_grid_driver.h:39
void Find_atom(const UnitCell &ucell, const int ntype, const int nnumber, AdjacentAtomInfo *adjs=nullptr) const
Find adjacent atoms for a given atom.
Definition sltk_grid_driver.cpp:24
const AdjacentAtomInfo & getAdjacentInfo() const
Get the whole adjacent atom information.
Definition sltk_grid_driver.h:173
Grid_Driver & operator=(Grid_Driver &&)=default
AdjacentAtomInfo adj_info
adjacent atom information
Definition sltk_grid_driver.h:179
const ModuleBase::Vector3< double > & getAdjacentTau(const int i) const
Get the position of an adjacent atom.
Definition sltk_grid_driver.h:154
const int & getType(const int i) const
Get the type of an adjacent atom.
Definition sltk_grid_driver.h:134
const int & getNatom(const int i) const
Get the index of an adjacent atom.
Definition sltk_grid_driver.h:144
const int & getAdjacentNum() const
Get the number of adjacent atoms.
Definition sltk_grid_driver.h:124
~Grid_Driver()
Destructor.
Definition sltk_grid_driver.cpp:20
const ModuleBase::Vector3< int > & getBox(const int i) const
Get the box indices of an adjacent atom.
Definition sltk_grid_driver.h:164
Grid_Driver()
Default constructor.
Definition sltk_grid_driver.h:68
bool test_deconstructor
test deconstructor flag
Definition sltk_grid_driver.h:180
3 elements vector
Definition vector3.h:21
Provide the basic information about unitcell.
Definition unitcell.h:16
Definition batch.h:6
Grid class for neighbor search.
void filter_adjs(const std::vector< bool > &is_adj, AdjacentAtomInfo &adjs)
Filter adjacent atoms based on boolean mask.
Definition sltk_grid_driver.cpp:66