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
25 Vec3d get_cartesian_coord(const Vec3d& index_3d) const { return index_3d * biggrid_latvec0_; }
26 Vec3d get_cartesian_coord(const Vec3i& index_3d) const { return index_3d * biggrid_latvec0_; }
27 Vec3d get_direct_coord(const Vec3d& cart_coord) const { return cart_coord * biggrid_GT_; }
28
29 // Return the maximum number of big grids that can fit inside a sphere of radius r,
30 // along the three lattice vector directions.
31 Vec3i max_ext_bgrid_num(double r) const;
32
33 // get number of meshgrids along three lattice directions
34 int get_nmx() const { return nmx_; }
35 int get_nmy() const { return nmy_; }
36 int get_nmz() const { return nmz_; }
37 int get_mgrids_num() const { return nmxyz_; }
38
39 const std::vector<Vec3d>& get_mgrids_coord() const { return meshgrid_coords_; }
40 const Vec3d& get_mgrid_coord(int index_1d) const { return meshgrid_coords_[index_1d]; }
41
42 std::shared_ptr<const MeshGridInfo> get_mgrid_info() const { return meshgrid_info_; }
43
44 // get the 3D index of a meshgrid in the big grid from the 1D index
45 Vec3i mgrid_idx_1Dto3D(int index_1d) const
46 {
47 return index1Dto3D(index_1d, nmx_, nmy_, nmz_);
48 }
49
50 // get the 1D index of a meshgrid in the big grid from the 3D index
51 int mgrid_idx_3Dto1D(const Vec3i index_3d) const
52 {
53 return index3Dto1D(index_3d.x, index_3d.y, index_3d.z, nmx_, nmy_, nmz_);
54 }
55
56 private:
57 // basis vectors of the big grid
61
62 // used to convert the (i, j, k) index of the big grid to the Cartesian coordinate
63 // if biggrid_vec1_ is row vector,
64 // then biggrid_latvec0_ = [biggrid_vec1_; biggrid_vec2_; biggrid_vec3_],
65 // (i, j, k) * biggrid_latvec0_ = (x, y, z)
67
68 // used to convert the Cartesian coordinate to the (i, j, k) index of the big grid
69 // biggrid_GT_ = biggrid_latvec0_.Inverse()
70 // (x, y, z) * biggrid_GT_ = (i, j, k)
72
73 //======================================================
74 // some member variables related to meshgrid
75 //======================================================
76
77 // basic attributes of meshgrid
78 std::shared_ptr<const MeshGridInfo> meshgrid_info_;
79
80 // the number of meshgrids of a biggrid along the first basis vector
81 // nmx may be a confusing name, because it is not the number of meshgrids along x axis
82 // but it's used in the original code, so I keep it, maybe it will be changed later
83 int nmx_;
84
85 // the number of meshgrids of a biggrid along the second basis vector
86 int nmy_;
87
88 // the number of meshgrids of a biggrid along the third basis vector
89 int nmz_;
90
91 // total number of meshgrids in the biggrid
92 int nmxyz_;
93
94 // store the relative Cartesian coordinates of all meshgrids in the biggrid
95 // the size of vector is nbxyz_
96 std::vector<Vec3d> meshgrid_coords_;
97};
98
99} // namespace ModuleGint
3x3 matrix and related mathamatical operations
Definition matrix3.h:19
T x
Definition vector3.h:24
T y
Definition vector3.h:25
T z
Definition vector3.h:26
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:40
Vec3d get_cartesian_coord(const Vec3i &index_3d) const
Definition biggrid_info.h:26
int get_nmz() const
Definition biggrid_info.h:36
Vec3d biggrid_vec3_
Definition biggrid_info.h:60
Vec3d get_direct_coord(const Vec3d &cart_coord) const
Definition biggrid_info.h:27
Vec3d biggrid_vec1_
Definition biggrid_info.h:58
std::shared_ptr< const MeshGridInfo > meshgrid_info_
Definition biggrid_info.h:78
Vec3i mgrid_idx_1Dto3D(int index_1d) const
Definition biggrid_info.h:45
Vec3d get_cartesian_coord(const Vec3d &index_3d) const
Definition biggrid_info.h:25
Vec3i max_ext_bgrid_num(double r) const
Definition biggrid_info.cpp:49
int get_mgrids_num() const
Definition biggrid_info.h:37
int nmx_
Definition biggrid_info.h:83
std::vector< Vec3d > meshgrid_coords_
Definition biggrid_info.h:96
int mgrid_idx_3Dto1D(const Vec3i index_3d) const
Definition biggrid_info.h:51
int nmz_
Definition biggrid_info.h:89
const std::vector< Vec3d > & get_mgrids_coord() const
Definition biggrid_info.h:39
int nmxyz_
Definition biggrid_info.h:92
Matrix3 biggrid_latvec0_
Definition biggrid_info.h:66
std::shared_ptr< const MeshGridInfo > get_mgrid_info() const
Definition biggrid_info.h:42
int get_nmx() const
Definition biggrid_info.h:34
int nmy_
Definition biggrid_info.h:86
Vec3d biggrid_vec2_
Definition biggrid_info.h:59
int get_nmy() const
Definition biggrid_info.h:35
Matrix3 biggrid_GT_
Definition biggrid_info.h:71
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:10
Vec3i index1Dto3D(const int index_1d, const int dim_x, const int dim_y, const int dim_z)
Definition gint_helper.h:16