Skip to content

Commit e555490

Browse files
authored
Refactor:Remove GlobalC::ucell in module_io (#5677)
* change ucell in module_io * change ucell in module_io/cal_r_overlap.cpp * change ucell in module_io/cal_test.cpp * change ucell in module_io/get_wf_lcao.cpp * change ucell in module_io/numerical_desciptor.cpp * change ucell in module_io/read_wfc_to_rho.cpp * change ucell in module_io/td_current_io.cpp * change ucell in module_io/to_wannier90_lcao_in_pw.cpp * change ucell in module_io/to_wannier90_pw.cpp * change ucell in module_io/to_wannier90_lcao.cpp * change ucell in module_io/to_wannier90.cpp * change ucell in module_io/write_vxc_lip.hpp.cpp * change ucell in module_io/unk_overlap_lcao.cpp * change ucell in module_io/write_dipole.cpp * change ucell in module_io/write_dmr.cpp * change ucell in module_io/write_dos_lcao.cpp * change ucell in module_io/write_elecstat_pot.cpp * change ucell in module_io/write_wfc_r.cpp * change ucell in bessel_basis_test.cpp * change ucell in read_wfc_to_rho_test.cpp
1 parent 3b1fa6e commit e555490

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+518
-437
lines changed

source/module_esolver/esolver_gets.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ void ESolver_GetS::runner(UnitCell& ucell, const int istep)
136136
if (PARAM.inp.out_mat_r)
137137
{
138138
cal_r_overlap_R r_matrix;
139-
r_matrix.init(pv, orb_);
140-
r_matrix.out_rR(istep);
139+
r_matrix.init(ucell,pv, orb_);
140+
r_matrix.out_rR(ucell,istep);
141141
}
142142

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

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,8 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(UnitCell& ucell, const int istep)
991991
PARAM.inp.out_dm1,
992992
false,
993993
PARAM.inp.out_app_flag,
994+
ucell.get_iat2iwt(),
995+
&ucell.nat,
994996
istep);
995997

996998
//! 7) write density matrix
@@ -1232,7 +1234,8 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(UnitCell& ucell, const int istep)
12321234
PARAM.inp.nnkpfile,
12331235
PARAM.inp.wannier_spin);
12341236

1235-
myWannier.calculate(this->pelec->ekb,
1237+
myWannier.calculate(ucell,
1238+
this->pelec->ekb,
12361239
this->pw_wfc,
12371240
this->pw_big,
12381241
this->sf,
@@ -1251,7 +1254,7 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(UnitCell& ucell, const int istep)
12511254
PARAM.inp.wannier_spin,
12521255
orb_);
12531256

1254-
myWannier.calculate(this->pelec->ekb, this->kv, *(this->psi), &(this->pv));
1257+
myWannier.calculate(ucell,this->pelec->ekb, this->kv, *(this->psi), &(this->pv));
12551258
}
12561259
std::cout << FmtCore::format(" >> Finish %s.\n * * * * * *\n", "Wave function to Wannier90");
12571260
}
@@ -1263,12 +1266,13 @@ void ESolver_KS_LCAO<TK, TR>::after_scf(UnitCell& ucell, const int istep)
12631266
{
12641267
std::cout << FmtCore::format("\n * * * * * *\n << Start %s.\n", "Berry phase calculation");
12651268
berryphase bp(&(this->pv));
1266-
bp.lcao_init(this->kv,
1269+
bp.lcao_init(ucell,
1270+
this->kv,
12671271
this->GridT,
12681272
orb_); // additional step before calling
12691273
// macroscopic_polarization (why capitalize
12701274
// the function name?)
1271-
bp.Macroscopic_polarization(this->pw_wfc->npwk_max, this->psi, this->pw_rho, this->pw_wfc, this->kv);
1275+
bp.Macroscopic_polarization(ucell,this->pw_wfc->npwk_max, this->psi, this->pw_rho, this->pw_wfc, this->kv);
12721276
std::cout << FmtCore::format(" >> Finish %s.\n * * * * * *\n", "Berry phase calculation");
12731277
}
12741278
}

source/module_esolver/esolver_ks_lcao_tddft.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,16 @@ void ESolver_KS_LCAO_TDDFT::after_scf(UnitCell& ucell, const int istep)
349349
{
350350
std::stringstream ss_dipole;
351351
ss_dipole << PARAM.globalv.global_out_dir << "SPIN" << is + 1 << "_DIPOLE";
352-
ModuleIO::write_dipole(pelec->charge->rho_save[is], pelec->charge->rhopw, is, istep, ss_dipole.str());
352+
ModuleIO::write_dipole(ucell,pelec->charge->rho_save[is], pelec->charge->rhopw, is, istep, ss_dipole.str());
353353
}
354354
}
355355
if (TD_Velocity::out_current == true)
356356
{
357357
elecstate::DensityMatrix<std::complex<double>, double>* tmp_DM
358358
= dynamic_cast<elecstate::ElecStateLCAO<std::complex<double>>*>(this->pelec)->get_DM();
359359

360-
ModuleIO::write_current(istep,
360+
ModuleIO::write_current(ucell,
361+
istep,
361362
this->psi,
362363
pelec,
363364
kv,

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,8 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep)
585585
PARAM.inp.out_wannier_wvfn_formatted,
586586
PARAM.inp.nnkpfile,
587587
PARAM.inp.wannier_spin);
588-
589-
wan.calculate(this->pelec->ekb, this->pw_wfc, this->pw_big, this->kv, this->psi);
588+
wan.set_tpiba_omega(ucell.tpiba, ucell.omega);
589+
wan.calculate(ucell,this->pelec->ekb, this->pw_wfc, this->pw_big, this->kv, this->psi);
590590
std::cout << FmtCore::format(" >> Finish %s.\n * * * * * *\n", "Wannier functions calculation");
591591
}
592592

@@ -595,7 +595,7 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep)
595595
{
596596
std::cout << FmtCore::format("\n * * * * * *\n << Start %s.\n", "Berry phase polarization");
597597
berryphase bp;
598-
bp.Macroscopic_polarization(this->pw_wfc->npwk_max, this->psi, this->pw_rho, this->pw_wfc, this->kv);
598+
bp.Macroscopic_polarization(ucell,this->pw_wfc->npwk_max, this->psi, this->pw_rho, this->pw_wfc, this->kv);
599599
std::cout << FmtCore::format(" >> Finish %s.\n * * * * * *\n", "Berry phase polarization");
600600
}
601601
}
@@ -783,7 +783,7 @@ void ESolver_KS_PW<T, Device>::after_all_runners(UnitCell& ucell)
783783
//! 6) Print out electronic wave functions in real space
784784
if (PARAM.inp.out_wfc_r == 1) // Peize Lin add 2021.11.21
785785
{
786-
ModuleIO::write_psi_r_1(this->psi[0], this->pw_wfc, "wfc_realspace", true, this->kv);
786+
ModuleIO::write_psi_r_1(ucell,this->psi[0], this->pw_wfc, "wfc_realspace", true, this->kv);
787787
}
788788

789789
//! 7) Use Kubo-Greenwood method to compute conductivities

source/module_esolver/lcao_others.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
4848
if (cal_type == "test_memory")
4949
{
5050
std::cout << FmtCore::format("\n * * * * * *\n << Start %s.\n", "testing memory");
51-
Cal_Test::test_memory(this->pw_rho,
51+
Cal_Test::test_memory(ucell.nat,
52+
ucell.ntype,
53+
ucell.GGT,
54+
this->pw_rho,
5255
this->pw_wfc,
5356
this->p_chgmix->get_mixing_mode(),
5457
this->p_chgmix->get_mixing_ndim());
@@ -324,7 +327,8 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
324327
IState_Envelope IEP(this->pelec);
325328
if (PARAM.globalv.gamma_only_local)
326329
{
327-
IEP.begin(this->psi,
330+
IEP.begin(ucell,
331+
this->psi,
328332
this->pw_rhod,
329333
this->pw_wfc,
330334
this->pw_big,
@@ -344,7 +348,8 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
344348
}
345349
else
346350
{
347-
IEP.begin(this->psi,
351+
IEP.begin(ucell,
352+
this->psi,
348353
this->pw_rhod,
349354
this->pw_wfc,
350355
this->pw_big,

source/module_esolver/pw_others.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,17 @@ void ESolver_KS_PW<T, Device>::others(UnitCell& ucell, const int istep)
5656
const std::string cal_type = PARAM.inp.calculation;
5757

5858
if (cal_type == "test_memory") {
59-
Cal_Test::test_memory(this->pw_rho,
59+
Cal_Test::test_memory(ucell.nat,
60+
ucell.ntype,
61+
ucell.GGT,
62+
this->pw_rho,
6063
this->pw_wfc,
6164
this->p_chgmix->get_mixing_mode(),
6265
this->p_chgmix->get_mixing_ndim());
6366
} else if (cal_type == "gen_bessel") {
6467
Numerical_Descriptor nc;
65-
nc.output_descriptor(this->psi[0],
68+
nc.output_descriptor(ucell,
69+
this->psi[0],
6670
PARAM.inp.bessel_descriptor_lmax,
6771
PARAM.inp.bessel_descriptor_rcut,
6872
PARAM.inp.bessel_descriptor_tolerence,

source/module_hamilt_lcao/module_gint/gint_gamma.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Gint_Gamma : public Gint
3636

3737
//! in gint_gamma_env.cpp
3838
//! calcualte the electronic wave functions via grid integral
39-
void cal_env(const double* wfc, double* rho,UnitCell &ucell);
39+
void cal_env(const double* wfc, double* rho,const UnitCell &ucell);
4040

4141
//! transfer this->hRGint to Veff::hR
4242
void transfer_pvpR(hamilt::HContainer<double>* hR,const UnitCell* ucell);

source/module_hamilt_lcao/module_gint/gint_gamma_env.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "module_basis/module_ao/ORB_read.h"
77
#include "module_hamilt_pw/hamilt_pwdft/global.h"
88

9-
void Gint_Gamma::cal_env(const double* wfc, double* rho, UnitCell& ucell)
9+
void Gint_Gamma::cal_env(const double* wfc, double* rho,const UnitCell& ucell)
1010
{
1111
ModuleBase::TITLE("Grid_Integral", "cal_env");
1212

source/module_hamilt_lcao/module_gint/gint_k.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Gint_k : public Gint {
6565
double* rho,
6666
const std::vector<ModuleBase::Vector3<double>>& kvec_c,
6767
const std::vector<ModuleBase::Vector3<double>>& kvec_d,
68-
UnitCell& ucell);
68+
const UnitCell& ucell);
6969

7070
//------------------------------------------------------
7171
// in gint_k_sparse1.cpp

source/module_hamilt_lcao/module_gint/gint_k_env.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void Gint_k::cal_env_k(int ik,
1313
double* rho,
1414
const std::vector<ModuleBase::Vector3<double>>& kvec_c,
1515
const std::vector<ModuleBase::Vector3<double>>& kvec_d,
16-
UnitCell& ucell)
16+
const UnitCell& ucell)
1717
{
1818
ModuleBase::TITLE("Gint_k", "cal_env_k");
1919
ModuleBase::timer::tick("Gint_k", "cal_env_k");

0 commit comments

Comments
 (0)