Skip to content

Commit 410a051

Browse files
committed
change ucell in module_io/cal_r_overlap.cpp
1 parent eb60634 commit 410a051

File tree

4 files changed

+33
-31
lines changed

4 files changed

+33
-31
lines changed

source/module_esolver/esolver_gets.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ void ESolver_GetS::runner(UnitCell& ucell, const int istep)
134134
if (PARAM.inp.out_mat_r)
135135
{
136136
cal_r_overlap_R r_matrix;
137-
r_matrix.init(pv, orb_);
138-
r_matrix.out_rR(istep);
137+
r_matrix.init(ucell,pv, orb_);
138+
r_matrix.out_rR(ucell,istep);
139139
}
140140

141141
ModuleBase::timer::tick("ESolver_GetS", "runner");

source/module_io/cal_r_overlap_R.cpp

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ cal_r_overlap_R::~cal_r_overlap_R()
1414
{
1515
}
1616

17-
void cal_r_overlap_R::initialize_orb_table(const LCAO_Orbitals& orb)
17+
void cal_r_overlap_R::initialize_orb_table(const UnitCell& ucell,
18+
const LCAO_Orbitals& orb)
1819
{
1920
int Lmax_used = 0;
2021
int Lmax = 0;
@@ -28,7 +29,7 @@ void cal_r_overlap_R::initialize_orb_table(const LCAO_Orbitals& orb)
2829
for (int it = 0; it < ntype; it++)
2930
{
3031
lmax_orb = std::max(lmax_orb, orb.Phi[it].getLmax());
31-
lmax_beta = std::max(lmax_beta, GlobalC::ucell.infoNL.Beta[it].getLmax());
32+
lmax_beta = std::max(lmax_beta, ucell.infoNL.Beta[it].getLmax());
3233
}
3334
const double dr = orb.get_dR();
3435
const double dk = orb.get_dk();
@@ -53,7 +54,8 @@ void cal_r_overlap_R::initialize_orb_table(const LCAO_Orbitals& orb)
5354
MGT.init_Gaunt(Lmax);
5455
}
5556

56-
void cal_r_overlap_R::construct_orbs_and_orb_r(const LCAO_Orbitals& orb)
57+
void cal_r_overlap_R::construct_orbs_and_orb_r(const UnitCell& ucell,
58+
const LCAO_Orbitals& orb)
5759
{
5860
int orb_r_ntype = 0;
5961
int mat_Nr = orb.Phi[0].PhiLN(0, 0).getNr();
@@ -201,13 +203,13 @@ void cal_r_overlap_R::construct_orbs_and_orb_r(const LCAO_Orbitals& orb)
201203
iw2im.resize(PARAM.globalv.nlocal);
202204

203205
int iw = 0;
204-
for (int it = 0; it < GlobalC::ucell.ntype; it++)
206+
for (int it = 0; it < ucell.ntype; it++)
205207
{
206-
for (int ia = 0; ia < GlobalC::ucell.atoms[it].na; ia++)
208+
for (int ia = 0; ia < ucell.atoms[it].na; ia++)
207209
{
208-
for (int iL = 0; iL < GlobalC::ucell.atoms[it].nwl + 1; iL++)
210+
for (int iL = 0; iL < ucell.atoms[it].nwl + 1; iL++)
209211
{
210-
for (int iN = 0; iN < GlobalC::ucell.atoms[it].l_nchi[iL]; iN++)
212+
for (int iN = 0; iN < ucell.atoms[it].l_nchi[iL]; iN++)
211213
{
212214
for (int im = 0; im < (2 * iL + 1); im++)
213215
{
@@ -224,20 +226,20 @@ void cal_r_overlap_R::construct_orbs_and_orb_r(const LCAO_Orbitals& orb)
224226
}
225227
}
226228

227-
void cal_r_overlap_R::init(const Parallel_Orbitals& pv, const LCAO_Orbitals& orb)
229+
void cal_r_overlap_R::init(const UnitCell& ucell,const Parallel_Orbitals& pv, const LCAO_Orbitals& orb)
228230
{
229231
ModuleBase::TITLE("cal_r_overlap_R", "init");
230232
ModuleBase::timer::tick("cal_r_overlap_R", "init");
231233
this->ParaV = &pv;
232234

233-
initialize_orb_table(orb);
234-
construct_orbs_and_orb_r(orb);
235+
initialize_orb_table(ucell,orb);
236+
construct_orbs_and_orb_r(ucell,orb);
235237

236238
ModuleBase::timer::tick("cal_r_overlap_R", "init");
237239
return;
238240
}
239241

240-
void cal_r_overlap_R::out_rR(const int& istep)
242+
void cal_r_overlap_R::out_rR(const UnitCell& ucell, const int& istep)
241243
{
242244
ModuleBase::TITLE("cal_r_overlap_R", "out_rR");
243245
ModuleBase::timer::tick("cal_r_overlap_R", "out_rR");
@@ -296,7 +298,7 @@ void cal_r_overlap_R::out_rR(const int& istep)
296298
int dRy = R_coor.y;
297299
int dRz = R_coor.z;
298300

299-
ModuleBase::Vector3<double> R_car = ModuleBase::Vector3<double>(dRx, dRy, dRz) * GlobalC::ucell.latvec;
301+
ModuleBase::Vector3<double> R_car = ModuleBase::Vector3<double>(dRx, dRy, dRz) * ucell.latvec;
300302

301303
int ir, ic;
302304
for (int iw1 = 0; iw1 < PARAM.globalv.nlocal; iw1++)
@@ -331,8 +333,8 @@ void cal_r_overlap_R::out_rR(const int& istep)
331333
int im2 = iw2im[orb_index_col];
332334

333335
ModuleBase::Vector3<double> r_distance
334-
= (GlobalC::ucell.atoms[it2].tau[ia2] - GlobalC::ucell.atoms[it1].tau[ia1] + R_car)
335-
* GlobalC::ucell.lat0;
336+
= (ucell.atoms[it2].tau[ia2] - ucell.atoms[it1].tau[ia1] + R_car)
337+
* ucell.lat0;
336338

337339
double overlap_o = center2_orb11[it1][it2][iL1][iN1][iL2].at(iN2).cal_overlap(origin_point,
338340
r_distance,
@@ -365,7 +367,7 @@ void cal_r_overlap_R::out_rR(const int& istep)
365367

366368
ModuleBase::Vector3<double> temp_prp
367369
= ModuleBase::Vector3<double>(overlap_x, overlap_y, overlap_z)
368-
+ GlobalC::ucell.atoms[it1].tau[ia1] * GlobalC::ucell.lat0 * overlap_o;
370+
+ ucell.atoms[it1].tau[ia1] * ucell.lat0 * overlap_o;
369371

370372
if (std::abs(temp_prp.x) > sparse_threshold)
371373
{
@@ -506,7 +508,7 @@ void cal_r_overlap_R::out_rR(const int& istep)
506508
return;
507509
}
508510

509-
void cal_r_overlap_R::out_rR_other(const int& istep, const std::set<Abfs::Vector3_Order<int>>& output_R_coor)
511+
void cal_r_overlap_R::out_rR_other(const UnitCell& ucell, const int& istep, const std::set<Abfs::Vector3_Order<int>>& output_R_coor)
510512
{
511513
ModuleBase::TITLE("cal_r_overlap_R", "out_rR_other");
512514
ModuleBase::timer::tick("cal_r_overlap_R", "out_rR_other");
@@ -571,7 +573,7 @@ void cal_r_overlap_R::out_rR_other(const int& istep, const std::set<Abfs::Vector
571573
int dRy = R_coor.y;
572574
int dRz = R_coor.z;
573575

574-
ModuleBase::Vector3<double> R_car = ModuleBase::Vector3<double>(dRx, dRy, dRz) * GlobalC::ucell.latvec;
576+
ModuleBase::Vector3<double> R_car = ModuleBase::Vector3<double>(dRx, dRy, dRz) * ucell.latvec;
575577

576578
int ir = 0;
577579
int ic = 0;
@@ -607,8 +609,8 @@ void cal_r_overlap_R::out_rR_other(const int& istep, const std::set<Abfs::Vector
607609
int im2 = iw2im[orb_index_col];
608610

609611
ModuleBase::Vector3<double> r_distance
610-
= (GlobalC::ucell.atoms[it2].tau[ia2] - GlobalC::ucell.atoms[it1].tau[ia1] + R_car)
611-
* GlobalC::ucell.lat0;
612+
= (ucell.atoms[it2].tau[ia2] - ucell.atoms[it1].tau[ia1] + R_car)
613+
* ucell.lat0;
612614

613615
double overlap_o = center2_orb11[it1][it2][iL1][iN1][iL2].at(iN2).cal_overlap(origin_point,
614616
r_distance,
@@ -641,7 +643,7 @@ void cal_r_overlap_R::out_rR_other(const int& istep, const std::set<Abfs::Vector
641643

642644
ModuleBase::Vector3<double> temp_prp
643645
= ModuleBase::Vector3<double>(overlap_x, overlap_y, overlap_z)
644-
+ GlobalC::ucell.atoms[it1].tau[ia1] * GlobalC::ucell.lat0 * overlap_o;
646+
+ ucell.atoms[it1].tau[ia1] * ucell.lat0 * overlap_o;
645647

646648
if (std::abs(temp_prp.x) > sparse_threshold)
647649
{

source/module_io/cal_r_overlap_R.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "module_hamilt_lcao/hamilt_lcaodft/center2_orb-orb21.h"
1414
#include "module_hamilt_lcao/hamilt_lcaodft/center2_orb.h"
1515
#include "single_R_io.h"
16-
16+
#include "module_cell/unitcell.h"
1717
#include <map>
1818
#include <set>
1919
#include <vector>
@@ -30,13 +30,13 @@ class cal_r_overlap_R
3030
double sparse_threshold = 1e-10;
3131
bool binary = false;
3232

33-
void init(const Parallel_Orbitals& pv, const LCAO_Orbitals& orb);
34-
void out_rR(const int& istep);
35-
void out_rR_other(const int& istep, const std::set<Abfs::Vector3_Order<int>>& output_R_coor);
33+
void init(const UnitCell& ucell,const Parallel_Orbitals& pv, const LCAO_Orbitals& orb);
34+
void out_rR(const UnitCell& ucell, const int& istep);
35+
void out_rR_other(const UnitCell& ucell, const int& istep, const std::set<Abfs::Vector3_Order<int>>& output_R_coor);
3636

3737
private:
38-
void initialize_orb_table(const LCAO_Orbitals& orb);
39-
void construct_orbs_and_orb_r(const LCAO_Orbitals& orb);
38+
void initialize_orb_table(const UnitCell& ucell, const LCAO_Orbitals& orb);
39+
void construct_orbs_and_orb_r(const UnitCell& ucell,const LCAO_Orbitals& orb);
4040

4141
std::vector<int> iw2ia;
4242
std::vector<int> iw2iL;

source/module_io/output_mat_sparse.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ void output_mat_sparse(const bool& out_mat_hsR,
7373
if (out_mat_r)
7474
{
7575
cal_r_overlap_R r_matrix;
76-
r_matrix.init(pv, orb);
76+
r_matrix.init(ucell, pv, orb);
7777
if (out_mat_hsR)
7878
{
79-
r_matrix.out_rR_other(istep, HS_Arrays.output_R_coor);
79+
r_matrix.out_rR_other(ucell,istep, HS_Arrays.output_R_coor);
8080
}
8181
else
8282
{
83-
r_matrix.out_rR(istep);
83+
r_matrix.out_rR(ucell,istep);
8484
}
8585
}
8686

0 commit comments

Comments
 (0)