ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
biggrid_info.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include "gint_type.h"
5#include "gint_helper.h"
6#include "meshgrid_info.h"
7
8namespace ModuleGint
9{
10
16{
17 public:
18 // constructor
20 Vec3d biggrid_vec1,
21 Vec3d biggrid_vec2,
22 Vec3d biggrid_vec3,
23 int nmx, int nmy, int nmz);
24
26
27 Vec3d get_cartesian_coord(const Vec3d& index_3d) const { return index_3d * bgrid_latvec0_; }
28 Vec3d get_cartesian_coord(const Vec3i& index_3d) const { return index_3d * bgrid_latvec0_; }
29 Vec3d get_direct_coord(const Vec3d& cart_coord) const { return cart_coord * biggrid_GT_; }
30
31 // Return the maximum number of big grids that can fit inside a sphere of radius r,
32 // along the three lattice vector directions.
33 Vec3i max_ext_bgrid_num(double r) const;
34
35 // get number of meshgrids along three lattice directions
36 int get_nmx() const { return nmx_; }
37 int get_nmy() const { return nmy_; }
38 int get_nmz() const { return nmz_; }
39 int get_mgrids_num() const { return nmxyz_; }
40
41 const std::vector<Vec3d>& get_mgrids_coord() const { return mgrid_coords_; }
42 const Vec3d& get_mgrid_coord(int index_1d) const { return mgrid_coords_[index_1d]; }
43
44 std::shared_ptr<const MeshGridInfo> get_mgrid_info() const { return meshgrid_info_; }
45
46 // get the 3D index of a meshgrid in the big grid from the 1D index
47 Vec3i mgrid_idx_1Dto3D(int index_1d) const
48 {
49 return index1Dto3D(index_1d, nmx_, nmy_, nmz_);
50 }
51
52 // get the 1D index of a meshgrid in the big grid from the 3D index
53 int mgrid_idx_3Dto1D(const Vec3i index_3d) const
54 {
55 return index3Dto1D(index_3d.x, index_3d.y, index_3d.z, nmx_, nmy_, nmz_);
56 }
57
58 private:
59 // basis vectors of the big grid
63
64 // used to convert the (i, j, k) index of the big grid to the Cartesian coordinate
65 // if biggrid_vec1_ is row vector,
66 // then bgrid_latvec0_ = [biggrid_vec1_; biggrid_vec2_; biggrid_vec3_],
67 // (i, j, k) * bgrid_latvec0_ = (x, y, z)
69
70 // used to convert the Cartesian coordinate to the (i, j, k) index of the big grid
71 // biggrid_GT_ = bgrid_latvec0_.Inverse()
72 // (x, y, z) * biggrid_GT_ = (i, j, k)
74
75 //======================================================
76 // some member variables related to meshgrid
77 //======================================================
78
79 // basic attributes of meshgrid
80 std::shared_ptr<const MeshGridInfo> meshgrid_info_;
81
82 // the number of meshgrids of a biggrid along the first basis vector
83 // nmx may be a confusing name, because it is not the number of meshgrids along x axis
84 // but it's used in the original code, so I keep it, maybe it will be changed later
85 int nmx_;
86
87 // the number of meshgrids of a biggrid along the second basis vector
88 int nmy_;
89
90 // the number of meshgrids of a biggrid along the third basis vector
91 int nmz_;
92
93 // total number of meshgrids in the biggrid
94 int nmxyz_;
95
96 // store the relative Cartesian coordinates of all meshgrids in the biggrid
97 // the size of vector is nbxyz_
98 std::vector<Vec3d> mgrid_coords_;
99};
100
101} // namespace ModuleGint
3x3 matrix and related mathamatical operations
Definition matrix3.h:19
T x
Definition vector3.h:26
T y
Definition vector3.h:27
T z
Definition vector3.h:28
This class stores some basic properties common to all big grids.
Definition biggrid_info.h:16
const Vec3d & get_mgrid_coord(int index_1d) const
Definition biggrid_info.h:42
Vec3d get_cartesian_coord(const Vec3i &index_3d) const
Definition biggrid_info.h:28
int get_nmz() const
Definition biggrid_info.h:38
Vec3d biggrid_vec3_
Definition biggrid_info.h:62
Vec3d get_direct_coord(const Vec3d &cart_coord) const
Definition biggrid_info.h:29
Vec3d biggrid_vec1_
Definition biggrid_info.h:60
std::shared_ptr< const MeshGridInfo > meshgrid_info_
Definition biggrid_info.h:80
Vec3i mgrid_idx_1Dto3D(int index_1d) const
Definition biggrid_info.h:47
Vec3d get_cartesian_coord(const Vec3d &index_3d) const
Definition biggrid_info.h:27
Vec3i max_ext_bgrid_num(double r) const
Definition biggrid_info.cpp:56
int get_mgrids_num() const
Definition biggrid_info.h:39
int nmx_
Definition biggrid_info.h:85
int mgrid_idx_3Dto1D(const Vec3i index_3d) const
Definition biggrid_info.h:53
int nmz_
Definition biggrid_info.h:91
const std::vector< Vec3d > & get_mgrids_coord() const
Definition biggrid_info.h:41
int nmxyz_
Definition biggrid_info.h:94
std::shared_ptr< const MeshGridInfo > get_mgrid_info() const
Definition biggrid_info.h:44
Matrix3 bgrid_latvec0_
Definition biggrid_info.h:68
int get_nmx() const
Definition biggrid_info.h:36
std::vector< Vec3d > mgrid_coords_
Definition biggrid_info.h:98
int nmy_
Definition biggrid_info.h:88
Vec3d biggrid_vec2_
Definition biggrid_info.h:61
int get_nmy() const
Definition biggrid_info.h:37
~BigGridInfo()
Definition biggrid_info.cpp:51
Matrix3 biggrid_GT_
Definition biggrid_info.h:73
Definition batch_biggrid.cpp:4
int index3Dto1D(const int id_x, const int id_y, const int id_z, const int dim_x, const int dim_y, const int dim_z)
Definition gint_helper.h:15
Vec3i index1Dto3D(const int index_1d, const int dim_x, const int dim_y, const int dim_z)
Definition gint_helper.h:21