diff --git a/source/module_esolver/esolver_ks_lcao_elec.cpp b/source/module_esolver/esolver_ks_lcao_elec.cpp index e00f8d19f3..09b521f34f 100644 --- a/source/module_esolver/esolver_ks_lcao_elec.cpp +++ b/source/module_esolver/esolver_ks_lcao_elec.cpp @@ -712,7 +712,7 @@ void ESolver_KS_LCAO::nscf() { if (berryphase::berry_phase_flag && ModuleSymmetry::Symmetry::symm_flag != 1) { std::cout << FmtCore::format("\n * * * * * *\n << Start %s.\n", "Berry phase calculation"); - berryphase bp(this->orb_con.ParaV); + berryphase bp(&(this->orb_con.ParaV)); bp.lcao_init(this->kv, this->GridT); // additional step before calling // macroscopic_polarization (why capitalize diff --git a/source/module_io/berryphase.cpp b/source/module_io/berryphase.cpp index 2a19d2be95..8479ce6337 100644 --- a/source/module_io/berryphase.cpp +++ b/source/module_io/berryphase.cpp @@ -11,7 +11,7 @@ berryphase::berryphase() } #ifdef __LCAO -berryphase::berryphase(const Parallel_Orbitals& paraV_in) : paraV(paraV_in) +berryphase::berryphase(const Parallel_Orbitals* paraV_in) : paraV(paraV_in) { GDIR = INPUT.gdir; } @@ -19,7 +19,6 @@ berryphase::berryphase(const Parallel_Orbitals& paraV_in) : paraV(paraV_in) berryphase::~berryphase() { - // GlobalV::ofs_running << "this is ~berryphase()" << std::endl; } void berryphase::get_occupation_bands() @@ -347,7 +346,7 @@ double berryphase::stringPhase(int index_str, if (GlobalV::NSPIN != 4) { // std::complex my_det = lcao_method.det_berryphase(ik_1,ik_2,dk,nbands); - zeta = zeta * lcao_method.det_berryphase(ik_1, ik_2, dk, nbands, this->paraV, psi_in, kv); + zeta = zeta * lcao_method.det_berryphase(ik_1, ik_2, dk, nbands, *(this->paraV), psi_in, kv); // test by jingan // GlobalV::ofs_running << "methon 1: det = " << my_det << std::endl; // test by jingan diff --git a/source/module_io/berryphase.h b/source/module_io/berryphase.h index 0754331f69..f69d3c10d8 100644 --- a/source/module_io/berryphase.h +++ b/source/module_io/berryphase.h @@ -16,7 +16,7 @@ class berryphase public: berryphase(); // for pw-line #ifdef __LCAO - berryphase(const Parallel_Orbitals& paraV_in); // for lcao-line + berryphase(const Parallel_Orbitals* paraV_in); // for lcao-line #endif ~berryphase(); @@ -25,7 +25,7 @@ class berryphase unkOverlap_pw pw_method; #ifdef __LCAO unkOverlap_lcao lcao_method; - Parallel_Orbitals paraV; + const Parallel_Orbitals* paraV; #endif int total_string; diff --git a/source/module_io/unk_overlap_lcao.cpp b/source/module_io/unk_overlap_lcao.cpp index bcda53f862..fe543fbb28 100644 --- a/source/module_io/unk_overlap_lcao.cpp +++ b/source/module_io/unk_overlap_lcao.cpp @@ -16,9 +16,9 @@ unkOverlap_lcao::~unkOverlap_lcao() { for (int iw = 0; iw < GlobalV::NLOCAL; iw++) { - delete cal_tag[iw]; + delete [] cal_tag[iw]; } - delete cal_tag; + delete [] cal_tag; } // GlobalV::ofs_running << "this is ~unkOverlap_lcao()" << std::endl;