@@ -68,6 +68,20 @@ void Veff<OperatorLCAO<double, double>>::contributeHR()
6868 double * vr_eff1 = this ->pot ->get_effective_v (this ->current_spin );
6969 double * vofk_eff1 = this ->pot ->get_effective_vofk (this ->current_spin );
7070
71+ #ifndef __NEW_GINT
72+ if (XC_Functional::get_func_type ()==3 || XC_Functional::get_func_type ()==5 )
73+ {
74+ Gint_inout inout (vr_eff1, vofk_eff1, Gint_Tools::job_type::vlocal_meta);
75+ this ->GG ->cal_vlocal (&inout, this ->new_e_iteration );
76+ }
77+ else
78+ {
79+ Gint_inout inout (vr_eff1, Gint_Tools::job_type::vlocal);
80+ this ->GG ->cal_vlocal (&inout, this ->new_e_iteration );
81+ }
82+ this ->GG ->transfer_pvpR (this ->hR ,this ->ucell );
83+ this ->new_e_iteration = false ;
84+ #else
7185 if (XC_Functional::get_func_type ()==3 || XC_Functional::get_func_type ()==5 )
7286 {
7387 ModuleGint::cal_gint_vl_metagga (vr_eff1, vofk_eff1, this ->hR );
@@ -76,6 +90,7 @@ void Veff<OperatorLCAO<double, double>>::contributeHR()
7690 {
7791 ModuleGint::cal_gint_vl (vr_eff1, this ->hR );
7892 }
93+ #endif
7994
8095 if (this ->nspin == 2 )
8196 {
@@ -98,6 +113,23 @@ void Veff<OperatorLCAO<std::complex<double>, double>>::contributeHR()
98113 double * vr_eff1 = this ->pot ->get_effective_v (this ->current_spin );
99114 double * vofk_eff1 = this ->pot ->get_effective_vofk (this ->current_spin );
100115
116+ #ifndef __NEW_GINT
117+ // if you change the place of the following code,
118+ // rememeber to delete the #include
119+ if (XC_Functional::get_func_type ()==3 || XC_Functional::get_func_type ()==5 )
120+ {
121+ Gint_inout inout (vr_eff1, vofk_eff1, 0 , Gint_Tools::job_type::vlocal_meta);
122+ this ->GK ->cal_gint (&inout);
123+ }
124+ else
125+ {
126+ // vlocal = Vh[rho] + Vxc[rho] + Vl(pseudo)
127+ Gint_inout inout (vr_eff1, 0 , Gint_Tools::job_type::vlocal);
128+ this ->GK ->cal_gint (&inout);
129+ }
130+
131+ this ->GK ->transfer_pvpR (this ->hR ,this ->ucell ,this ->gd );
132+ #else
101133 if (XC_Functional::get_func_type ()==3 || XC_Functional::get_func_type ()==5 )
102134 {
103135 ModuleGint::cal_gint_vl_metagga (vr_eff1, vofk_eff1, this ->hR );
@@ -106,6 +138,7 @@ void Veff<OperatorLCAO<std::complex<double>, double>>::contributeHR()
106138 {
107139 ModuleGint::cal_gint_vl (vr_eff1, this ->hR );
108140 }
141+ #endif
109142
110143 if (this ->nspin == 2 )
111144 {
@@ -122,6 +155,30 @@ void Veff<OperatorLCAO<std::complex<double>, std::complex<double>>>::contributeH
122155 ModuleBase::TITLE (" Veff" , " contributeHR" );
123156 ModuleBase::timer::tick (" Veff" , " contributeHR" );
124157
158+ #ifndef __NEW_GINT
159+ double * vr_eff1 = nullptr ;
160+ double * vofk_eff1 = nullptr ;
161+ for (int is = 0 ; is < 4 ; is++)
162+ {
163+ vr_eff1 = this ->pot ->get_effective_v (is);
164+ if (XC_Functional::get_func_type ()==3 || XC_Functional::get_func_type ()==5 )
165+ {
166+ vofk_eff1 = this ->pot ->get_effective_vofk (is);
167+ }
168+
169+ if (XC_Functional::get_func_type ()==3 || XC_Functional::get_func_type ()==5 )
170+ {
171+ Gint_inout inout (vr_eff1, vofk_eff1, is, Gint_Tools::job_type::vlocal_meta);
172+ this ->GK ->cal_gint (&inout);
173+ }
174+ else
175+ {
176+ Gint_inout inout (vr_eff1, is, Gint_Tools::job_type::vlocal);
177+ this ->GK ->cal_gint (&inout);
178+ }
179+ }
180+ this ->GK ->transfer_pvpR (this ->hR ,this ->ucell ,this ->gd );
181+ #else
125182 std::vector<const double *> vr_eff (4 , nullptr );
126183 std::vector<const double *> vofk_eff (4 , nullptr );
127184 for (int is = 0 ; is < 4 ; is++)
@@ -143,6 +200,7 @@ void Veff<OperatorLCAO<std::complex<double>, std::complex<double>>>::contributeH
143200 }
144201 }
145202 }
203+ #endif
146204
147205 ModuleBase::timer::tick (" Veff" , " contributeHR" );
148206 return ;
0 commit comments