Skip to content

Commit 56cb9bb

Browse files
committed
unify some variables name
1 parent b6c17ce commit 56cb9bb

File tree

10 files changed

+76
-68
lines changed

10 files changed

+76
-68
lines changed

source/module_hamilt_lcao/module_gint/new_grid_tech/biggrid.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void BigGrid::set_mgrids_coord(std::vector<Vec3d>& coord) const
5454

5555
void BigGrid::set_mgrids_local_idx(std::vector<int>& mgrids_idx) const
5656
{
57-
auto index_3d = localcell_info_->biggrid_idx_1Dto3D(idx_);
57+
auto index_3d = localcell_info_->bgrid_idx_1Dto3D(idx_);
5858
Vec3i startidx(
5959
index_3d.x * biggrid_info_->get_nmx(),
6060
index_3d.y * biggrid_info_->get_nmy(),
@@ -67,7 +67,7 @@ void BigGrid::set_mgrids_local_idx(std::vector<int>& mgrids_idx) const
6767
for(int iz = 0; iz < biggrid_info_->get_nmz(); ++iz)
6868
{
6969
Vec3i idx_3d(startidx.x + ix, startidx.y + iy, startidx.z + iz);
70-
mgrids_idx.push_back(localcell_info_->meshgrid_idx_3Dto1D(idx_3d));
70+
mgrids_idx.push_back(localcell_info_->mgrid_idx_3Dto1D(idx_3d));
7171
}
7272
}
7373
}
@@ -92,7 +92,7 @@ void BigGrid::set_atom_relative_coords(const Vec3i bgrid_idx, const Vec3d tau_in
9292

9393
void BigGrid::set_atom_relative_coords(const GintAtom* atom, std::vector<Vec3d>& atom_coord) const
9494
{
95-
return set_atom_relative_coords(atom->get_biggrid_idx(), atom->get_tau_in_biggrid(), atom_coord);
95+
return set_atom_relative_coords(atom->get_bgrid_idx(), atom->get_tau_in_bgrid(), atom_coord);
9696
}
9797

9898
bool BigGrid::is_atom_on_bgrid(const GintAtom* atom) const

source/module_hamilt_lcao/module_gint/new_grid_tech/biggrid.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,25 @@ class BigGrid
1515
{
1616
public:
1717
// constructor
18-
BigGrid(int idx, std::shared_ptr<const LocalCellInfo> localcell_info);
18+
BigGrid(int idx);
19+
20+
static void init_localcell_info(std::shared_ptr<const LocalCellInfo> localcell_info) { localcell_info_ = localcell_info; };
21+
static void init_unitcell_info(std::shared_ptr<const UnitCellInfo> unitcell_info) { unitcell_info_ = unitcell_info; };
22+
static void init_bgrid_info(std::shared_ptr<const BigGridInfo> biggrid_info) { biggrid_info_ = biggrid_info; };
1923

2024
// getter functions
2125
int get_idx() const { return idx_; };
2226
std::shared_ptr<const LocalCellInfo> get_localcell_info() const { return localcell_info_; };
2327
std::shared_ptr<const UnitCellInfo> get_unitcell_info() const {return unitcell_info_; };
24-
std::shared_ptr<const BigGridInfo> get_biggrid_info() const { return biggrid_info_; };
28+
std::shared_ptr<const BigGridInfo> get_bgrid_info() const { return biggrid_info_; };
2529
const std::vector<const GintAtom*>& get_atoms() const { return atoms_; };
2630
const GintAtom* get_atom(int i) const { return atoms_[i]; };
2731

2832
// get the number of meshgrids in the big grid
29-
int get_meshgrid_num() const { return biggrid_info_->get_mgrids_num(); };
33+
int get_mgrids_num() const { return biggrid_info_->get_mgrids_num(); };
3034

3135
// get the number of atoms that can affect the big grid
32-
int get_atom_num() const { return atoms_.size(); };
36+
int get_atoms_num() const { return atoms_.size(); };
3337

3438
// add an atom to the big grid
3539
void add_atom(const GintAtom* atom);

source/module_hamilt_lcao/module_gint/new_grid_tech/gint_atom.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ class GintAtom
2727
const Atom* get_atom() const { return atom_; };
2828
const int get_ia() const { return ia_; };
2929
const int get_iat() const { return iat_; };
30-
const Vec3i& get_biggrid_idx() const { return biggrid_idx_; };
30+
const Vec3i& get_bgrid_idx() const { return biggrid_idx_; };
3131
const Vec3i& get_unitcell_idx() const { return unitcell_idx_; };
3232
const Vec3i& get_R() const { return unitcell_idx_; };
33-
const Vec3d& get_tau_in_biggrid() const { return tau_in_biggrid_; };
33+
const Vec3d& get_tau_in_bgrid() const { return tau_in_biggrid_; };
3434
const Numerical_Orbital* get_orb() const { return orb_; };
3535

3636
const int get_nw() const { return atom_->nw; };

source/module_hamilt_lcao/module_gint/new_grid_tech/gint_info.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ GintInfo::GintInfo(
2121
unitcell_info_ = std::make_shared<UnitCellInfo>(ucell_->a1 * ucell_->lat0, ucell_->a2 * ucell_->lat0, ucell_->a3 * ucell_->lat0,
2222
nbx, nby, nbz, nmx, nmy, nmz);
2323

24-
biggrid_info_ = unitcell_info_->get_biggrid_info();
24+
biggrid_info_ = unitcell_info_->get_bgrid_info();
2525
meshgrid_info_ = biggrid_info_->get_mgrid_info();
2626

2727
// initialize the divide information
@@ -32,7 +32,11 @@ GintInfo::GintInfo(
3232
localcell_info_ = divide_info_->get_localcell_info();
3333

3434
// initialize the biggrids
35-
for (int i = 0; i < localcell_info_->get_biggrid_num(); i++)
35+
BigGrid::init_localcell_info(localcell_info_);
36+
BigGrid::init_unitcell_info(unitcell_info_);
37+
BigGrid::init_bgrid_info(biggrid_info_);
38+
39+
for (int i = 0; i < localcell_info_->get_bgrids_num(); i++)
3640
{
3741
biggrids_.push_back(std::make_shared<BigGrid>(i, localcell_info_));
3842
}

source/module_hamilt_lcao/module_gint/new_grid_tech/gint_info.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class GintInfo
3030

3131
// getter functions
3232
std::vector<std::shared_ptr<BigGrid>> get_biggrids() const { return biggrids_; };
33-
double get_local_mgrid_num() const { return localcell_info_->get_mgrid_num(); };
33+
double get_local_mgrid_num() const { return localcell_info_->get_mgrids_num(); };
3434
double get_mgrid_volume() const { return meshgrid_info_->get_volume(); };
3535

3636
//=========================================

source/module_hamilt_lcao/module_gint/new_grid_tech/localcell_info.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace ModuleGint
88
std::shared_ptr<const UnitCellInfo> unitcell_info)
99
: startidx_bx_(startidx_bx), startidx_by_(startidx_by), startidx_bz_(startidx_bz),
1010
nbx_(nbx), nby_(nby), nbz_(nbz), nbxyz_(nbx*nby*nbz),
11-
unitcell_info_(unitcell_info), biggrid_info_(unitcell_info->get_biggrid_info())
11+
unitcell_info_(unitcell_info), biggrid_info_(unitcell_info->get_bgrid_info())
1212
{
1313
startidx_mx_ = startidx_bx_ * biggrid_info_->get_nmx();
1414
startidx_my_ = startidx_by_ * biggrid_info_->get_nmy();
@@ -23,12 +23,12 @@ namespace ModuleGint
2323
// functions related to the big grid
2424
//====================================================================
2525

26-
int LocalCellInfo::biggrid_idx_3Dto1D(const Vec3i index_3d) const
26+
int LocalCellInfo::bgrid_idx_3Dto1D(const Vec3i index_3d) const
2727
{
2828
return index3Dto1D(index_3d.x, index_3d.y, index_3d.z, nbx_, nby_, nbz_);
2929
}
3030

31-
Vec3i LocalCellInfo::biggrid_idx_1Dto3D(const int index_1d) const
31+
Vec3i LocalCellInfo::bgrid_idx_1Dto3D(const int index_1d) const
3232
{
3333
return index1Dto3D(index_1d, nbx_, nby_, nbz_);
3434
}
@@ -43,13 +43,13 @@ namespace ModuleGint
4343

4444
Vec3i LocalCellInfo::get_bgrid_global_idx_3D(const int index_1d) const
4545
{
46-
return get_bgrid_global_idx_3D(biggrid_idx_1Dto3D(index_1d));
46+
return get_bgrid_global_idx_3D(bgrid_idx_1Dto3D(index_1d));
4747
}
4848

4949
int LocalCellInfo::get_bgrid_global_idx_1D(const int index_1d) const
5050
{
51-
Vec3i ucell_idx_3d = get_bgrid_global_idx_3D(biggrid_idx_1Dto3D(index_1d));
52-
return unitcell_info_->biggrid_idx_3Dto1D(ucell_idx_3d);
51+
Vec3i ucell_idx_3d = get_bgrid_global_idx_3D(bgrid_idx_1Dto3D(index_1d));
52+
return unitcell_info_->bgrid_idx_3Dto1D(ucell_idx_3d);
5353
}
5454

5555

@@ -66,19 +66,19 @@ namespace ModuleGint
6666

6767
int LocalCellInfo::get_bgrid_local_idx_1D(const Vec3i index_3d) const
6868
{
69-
return biggrid_idx_3Dto1D(get_bgrid_local_idx_3D(index_3d));
69+
return bgrid_idx_3Dto1D(get_bgrid_local_idx_3D(index_3d));
7070
}
7171

7272
int LocalCellInfo::get_bgrid_local_idx_1D(const int index_1d) const
7373
{
74-
Vec3i idx_3d = unitcell_info_->biggrid_idx_1Dto3D(index_1d);
75-
return biggrid_idx_3Dto1D(get_bgrid_local_idx_3D(idx_3d));
74+
Vec3i idx_3d = unitcell_info_->bgrid_idx_1Dto3D(index_1d);
75+
return bgrid_idx_3Dto1D(get_bgrid_local_idx_3D(idx_3d));
7676
}
7777

7878
Vec3d LocalCellInfo::get_bgrid_global_coord_3D(const int index_1d) const
7979
{
8080
Vec3i ucell_idx_3d = get_bgrid_global_idx_3D(index_1d);
81-
return unitcell_info_->get_biggrid_coord(ucell_idx_3d);
81+
return unitcell_info_->get_bgrid_coord(ucell_idx_3d);
8282
}
8383

8484
bool LocalCellInfo::is_bgrid_in_lcell(const Vec3i index_3d) const
@@ -92,12 +92,12 @@ namespace ModuleGint
9292
// functions related to the meshgrid
9393
//====================================================================
9494

95-
int LocalCellInfo::meshgrid_idx_3Dto1D(const Vec3i index_3d) const
95+
int LocalCellInfo::mgrid_idx_3Dto1D(const Vec3i index_3d) const
9696
{
9797
return index3Dto1D(index_3d.x, index_3d.y, index_3d.z, nmx_, nmy_, nmz_);
9898
}
9999

100-
Vec3i LocalCellInfo::meshgrid_idx_1Dto3D(const int index_1d) const
100+
Vec3i LocalCellInfo::mgrid_idx_1Dto3D(const int index_1d) const
101101
{
102102
return index1Dto3D(index_1d, nmx_, nmy_, nmz_);
103103
}
@@ -112,8 +112,8 @@ namespace ModuleGint
112112

113113
int LocalCellInfo::get_mgrid_global_idx_1D(const int index_1d) const
114114
{
115-
Vec3i ucell_idx_3d = get_mgrid_global_idx_3D(meshgrid_idx_1Dto3D(index_1d));
116-
return unitcell_info_->meshgrid_idx_3Dto1D(ucell_idx_3d);
115+
Vec3i ucell_idx_3d = get_mgrid_global_idx_3D(mgrid_idx_1Dto3D(index_1d));
116+
return unitcell_info_->mgrid_idx_3Dto1D(ucell_idx_3d);
117117
}
118118

119119
}

source/module_hamilt_lcao/module_gint/new_grid_tech/localcell_info.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ class LocalCellInfo
2323
const int get_nbx() const { return nbx_; };
2424
const int get_nby() const { return nby_; };
2525
const int get_nbz() const { return nbz_; };
26-
const int get_biggrid_num() const { return nbxyz_; };
27-
const int get_mgrid_num() const { return nmxyz_; };
26+
const int get_bgrids_num() const { return nbxyz_; };
27+
const int get_mgrids_num() const { return nmxyz_; };
2828
std::shared_ptr<const UnitCellInfo> get_unitcell_info() const { return unitcell_info_; };
29-
std::shared_ptr<const BigGridInfo> get_biggrid_info() const { return unitcell_info_->get_biggrid_info(); };
29+
std::shared_ptr<const BigGridInfo> get_bgrid_info() const { return unitcell_info_->get_bgrid_info(); };
3030

3131
//====================================================================
3232
// functions related to the big grid
3333
//====================================================================
3434

3535
// transform the 3D index of a big grid in the local cell to the 3D index in the local cell
36-
int biggrid_idx_3Dto1D(const Vec3i index_3d) const;
36+
int bgrid_idx_3Dto1D(const Vec3i index_3d) const;
3737

3838
// transform the 1D index of a big grid in the local cell to the 1D index in the local cell
39-
Vec3i biggrid_idx_1Dto3D(const int index_1d) const;
39+
Vec3i bgrid_idx_1Dto3D(const int index_1d) const;
4040

4141
// transform the 3D index of a big grid in the local cell to the 3D index in the unit cell
4242
Vec3i get_bgrid_global_idx_3D(const Vec3i index_3d) const;
@@ -69,10 +69,10 @@ class LocalCellInfo
6969
//====================================================================
7070

7171
// transform the 3D index of a meshgrid in the local cell to the 3D index in the local cell
72-
int meshgrid_idx_3Dto1D(const Vec3i index_3d) const;
72+
int mgrid_idx_3Dto1D(const Vec3i index_3d) const;
7373

7474
// transform the 1D index of a meshgrid in the local cell to the 1D index in the local cell
75-
Vec3i meshgrid_idx_1Dto3D(const int index_1d) const;
75+
Vec3i mgrid_idx_1Dto3D(const int index_1d) const;
7676

7777
// transform the 3D index of a meshgrid in the local cell to the 3D index in the unit cell
7878
Vec3i get_mgrid_global_idx_3D(const Vec3i index_3d) const;

source/module_hamilt_lcao/module_gint/new_grid_tech/phi_operator.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ namespace ModuleGint
99
void PhiOperator::set_bgrid(std::shared_ptr<const BigGrid> biggrid)
1010
{
1111
biggrid_ = biggrid;
12-
rows_ = biggrid_->get_meshgrid_num();
12+
rows_ = biggrid_->get_mgrids_num();
1313
cols_ = biggrid_->get_mgrid_phi_len();
1414

1515
biggrid_->set_atoms_startidx(atoms_startidx_);
1616
biggrid_->set_atoms_phi_len(atoms_phi_len_);
1717
biggrid_->set_mgrids_local_idx(meshgrids_local_idx_);
1818

1919
// init is_atom_on_mgrid_ and atoms_relative_coords_
20-
int atoms_num = biggrid_->get_atom_num();
20+
int atoms_num = biggrid_->get_atoms_num();
2121
atoms_relative_coords_.resize(atoms_num);
2222
is_atom_on_mgrid_.resize(atoms_num);
2323
for(int i = 0; i < atoms_num; ++i)
@@ -36,7 +36,7 @@ void PhiOperator::set_bgrid(std::shared_ptr<const BigGrid> biggrid)
3636

3737
void PhiOperator::set_phi(double* phi) const
3838
{
39-
for(int i = 0; i < biggrid_->get_atom_num(); ++i)
39+
for(int i = 0; i < biggrid_->get_atoms_num(); ++i)
4040
{
4141
const auto atom = biggrid_->get_atom(i);
4242
atom->set_phi(atoms_relative_coords_[i], cols_, phi);
@@ -46,7 +46,7 @@ void PhiOperator::set_phi(double* phi) const
4646

4747
void PhiOperator::set_phi_dphi(double* phi, double* dphi_x, double* dphi_y, double* dphi_z) const
4848
{
49-
for(int i = 0; i < biggrid_->get_atom_num(); ++i)
49+
for(int i = 0; i < biggrid_->get_atoms_num(); ++i)
5050
{
5151
const auto atom = biggrid_->get_atom(i);
5252
atom->set_phi_dphi(atoms_relative_coords_[i], cols_, phi, dphi_x, dphi_y, dphi_z);
@@ -64,7 +64,7 @@ void PhiOperator::set_ddphi(
6464
double* ddphi_xx, double* ddphi_xy, double* ddphi_xz,
6565
double* ddphi_yy, double* ddphi_yz, double* ddphi_zz) const
6666
{
67-
for(int i = 0; i < biggrid_->get_atom_num(); ++i)
67+
for(int i = 0; i < biggrid_->get_atoms_num(); ++i)
6868
{
6969
const auto atom = biggrid_->get_atom(i);
7070
atom->set_ddphi(atoms_relative_coords_[i], cols_, ddphi_xx, ddphi_xy, ddphi_xz, ddphi_yy, ddphi_yz, ddphi_zz);
@@ -91,7 +91,7 @@ void PhiOperator::phi_mul_dm(
9191
const double beta = 1.0;
9292
const double alpha1 = is_symm ? 2.0 : 1.0;
9393

94-
for(int i = 0; i < biggrid_->get_atom_num(); ++i)
94+
for(int i = 0; i < biggrid_->get_atoms_num(); ++i)
9595
{
9696
const auto atom_i = biggrid_->get_atom(i);
9797
const auto r_i = atom_i->get_R();
@@ -105,7 +105,7 @@ void PhiOperator::phi_mul_dm(
105105

106106
const int start = is_symm ? i + 1 : 0;
107107

108-
for(int j = start; j < biggrid_->get_atom_num(); ++j)
108+
for(int j = start; j < biggrid_->get_atoms_num(); ++j)
109109
{
110110
const auto atom_j = biggrid_->get_atom(j);
111111
const auto r_j = atom_j->get_R();
@@ -138,7 +138,7 @@ void PhiOperator::phi_mul_vldr3(const double* vl, const double dr3, const double
138138
{
139139
ModuleBase::GlobalFunc::ZEROS(result, rows_ * cols_);
140140
int idx = 0;
141-
for(int i = 0; i < biggrid_->get_meshgrid_num(); i++)
141+
for(int i = 0; i < biggrid_->get_mgrids_num(); i++)
142142
{
143143
double vldr3_mgrid = vl[meshgrids_local_idx_[i]] * dr3;
144144
for(int j = 0; j < cols_; j++)
@@ -157,13 +157,13 @@ void PhiOperator::phi_mul_phi_vldr3(
157157
const char transa='N', transb='T';
158158
const double alpha=1, beta=1;
159159

160-
for(int i = 0; i < biggrid_->get_atom_num(); ++i)
160+
for(int i = 0; i < biggrid_->get_atoms_num(); ++i)
161161
{
162162
const auto atom_i = biggrid_->get_atom(i);
163163
const auto& r_i = atom_i->get_R();
164164
const int iat_i = atom_i->get_iat();
165165

166-
for(int j = 0; j < biggrid_->get_atom_num(); ++j)
166+
for(int j = 0; j < biggrid_->get_atoms_num(); ++j)
167167
{
168168
const auto atom_j = biggrid_->get_atom(j);
169169
const auto& r_j = atom_j->get_R();
@@ -204,7 +204,7 @@ void PhiOperator::phi_dot_phi_dm(
204204
double* rho) const
205205
{
206206
const int inc = 1;
207-
for(int i = 0; i < biggrid_->get_meshgrid_num(); ++i)
207+
for(int i = 0; i < biggrid_->get_mgrids_num(); ++i)
208208
{
209209
rho[meshgrids_local_idx_[i]] += ddot_(&cols_, &phi[i * cols_], &inc, &phi_dm[i * cols_], &inc);
210210
}
@@ -217,13 +217,13 @@ void PhiOperator::phi_dot_dphi(
217217
const double* dphi_z,
218218
ModuleBase::matrix *fvl) const
219219
{
220-
for(int i = 0; i < biggrid_->get_atom_num(); ++i)
220+
for(int i = 0; i < biggrid_->get_atoms_num(); ++i)
221221
{
222222
const int iat = biggrid_->get_atom(i)->get_iat();
223223
const int start_idx = atoms_startidx_[i];
224224
const int phi_len = atoms_phi_len_[i];
225225
double rx = 0, ry = 0, rz = 0;
226-
for(int j = 0; j < biggrid_->get_meshgrid_num(); ++j)
226+
for(int j = 0; j < biggrid_->get_mgrids_num(); ++j)
227227
{
228228
for(int k = 0; k < phi_len; ++k)
229229
{
@@ -248,9 +248,9 @@ void PhiOperator::phi_dot_dphi_r(
248248
ModuleBase::matrix *svl) const
249249
{
250250
double sxx = 0, sxy = 0, sxz = 0, syy = 0, syz = 0, szz = 0;
251-
for(int i = 0; i < biggrid_->get_meshgrid_num(); ++i)
251+
for(int i = 0; i < biggrid_->get_mgrids_num(); ++i)
252252
{
253-
for(int j = 0; j < biggrid_->get_atom_num(); ++j)
253+
for(int j = 0; j < biggrid_->get_atoms_num(); ++j)
254254
{
255255
const int start_idx = atoms_startidx_[j];
256256
for(int k = 0; k < atoms_phi_len_[j]; ++k)
@@ -281,9 +281,9 @@ void PhiOperator::phi_dot_dphi_r(
281281
//===============================
282282
void PhiOperator::init_atom_pair_start_end_idx_()
283283
{
284-
int atoms_num = biggrid_->get_atom_num();
284+
int atoms_num = biggrid_->get_atoms_num();
285285
atom_pair_start_end_idx_.resize(atoms_num * (atoms_num + 1) / 2);
286-
int mgrids_num = biggrid_->get_meshgrid_num();
286+
int mgrids_num = biggrid_->get_mgrids_num();
287287
int atom_pair_idx = 0;
288288
for(int i = 0; i < atoms_num; ++i)
289289
{

source/module_hamilt_lcao/module_gint/new_grid_tech/phi_operator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ class PhiOperator
8888
{
8989
int x = std::min(a, b);
9090
int y = std::abs(a - b);
91-
return atom_pair_start_end_idx_[(2 * biggrid_->get_atom_num() - x + 1) * x / 2 + y];
91+
return atom_pair_start_end_idx_[(2 * biggrid_->get_atoms_num() - x + 1) * x / 2 + y];
9292
};
9393

9494
// the row number of the phi matrix
95-
// rows_ = biggrid_->get_meshgrid_num()
95+
// rows_ = biggrid_->get_mgrids_num()
9696
int rows_;
9797

9898
// the column number of the phi matrix

0 commit comments

Comments
 (0)