@@ -25,10 +25,10 @@ Sto_EleCond::Sto_EleCond(UnitCell* p_ucell_in,
2525 : EleCond(p_ucell_in, p_kv_in, p_elec_in, p_wfcpw_in, p_psi_in, p_ppcell_in)
2626{
2727 this ->p_hamilt = p_hamilt_in;
28+ this ->p_hamilt_sto = static_cast <hamilt::HamiltSdftPW<std::complex <double >>*>(p_hamilt_in);
2829 this ->p_stowf = p_stowf_in;
2930 this ->nbands_ks = p_psi_in->get_nbands ();
3031 this ->nbands_sto = p_stowf_in->nchi ;
31- this ->stohchi .init (p_wfcpw_in, p_kv_in, &stoche.emin_sto , &stoche.emax_sto );
3232 this ->stofunc .set_E_range (&stoche.emin_sto , &stoche.emax_sto );
3333}
3434
@@ -91,24 +91,23 @@ void Sto_EleCond::decide_nche(const double dt,
9191
9292 int nche_new = 0 ;
9393loop:
94- // re-set Emin & Emax both in stohchi & stofunc
94+ // re-set Emin & Emax both in p_hamilt_sto & stofunc
9595 check_che (std::max (nche_old * 2 , fd_nche),
9696 try_emin,
9797 try_emax,
9898 this ->nbands_sto ,
9999 this ->p_kv ,
100100 this ->p_stowf ,
101- this ->p_hamilt ,
102- this ->stohchi );
101+ this ->p_hamilt_sto );
103102
104103 // second try to find nche with new Emin & Emax
105104 getnche (nche_new);
106105
107106 if (nche_new > nche_old * 2 )
108107 {
109108 nche_old = nche_new;
110- try_emin = *stohchi. Emin ;
111- try_emax = *stohchi. Emax ;
109+ try_emin = *p_hamilt_sto-> emin ;
110+ try_emax = *p_hamilt_sto-> emax ;
112111 goto loop;
113112 }
114113
@@ -177,8 +176,8 @@ void Sto_EleCond::cal_jmatrix(const psi::Psi<std::complex<float>>& kspsi_all,
177176 psi::Psi<std::complex <float >> f_rightchi (1 , perbands_sto, npwx, p_kv->ngk .data ());
178177 psi::Psi<std::complex <float >> f_right_hchi (1 , perbands_sto, npwx, p_kv->ngk .data ());
179178
180- this ->stohchi . hchi (leftchi.get_pointer (), left_hchi.get_pointer (), perbands_sto);
181- this ->stohchi . hchi (rightchi.get_pointer (), right_hchi.get_pointer (), perbands_sto);
179+ this ->p_hamilt_sto -> hPsi (leftchi.get_pointer (), left_hchi.get_pointer (), perbands_sto);
180+ this ->p_hamilt_sto -> hPsi (rightchi.get_pointer (), right_hchi.get_pointer (), perbands_sto);
182181 convert_psi (rightchi, f_rightchi);
183182 convert_psi (right_hchi, f_right_hchi);
184183 right_hchi.resize (1 , 1 , 1 );
@@ -589,7 +588,6 @@ void Sto_EleCond::sKG(const int& smear_type,
589588 {
590589 this ->p_hamilt ->updateHk (ik);
591590 }
592- this ->stohchi .current_ik = ik;
593591 const int npw = p_kv->ngk [ik];
594592
595593 // get allbands_ks
@@ -733,8 +731,8 @@ void Sto_EleCond::sKG(const int& smear_type,
733731
734732 auto nroot_fd = std::bind (&Sto_Func<double >::nroot_fd, &this ->stofunc , std::placeholders::_1);
735733 che.calcoef_real (nroot_fd);
736- auto hchi_norm = std::bind (&Stochastic_hchi::hchi_norm ,
737- &stohchi ,
734+ auto hchi_norm = std::bind (&hamilt::HamiltSdftPW<std:: complex < double >>::hPsi_norm ,
735+ p_hamilt_sto ,
738736 std::placeholders::_1,
739737 std::placeholders::_2,
740738 std::placeholders::_3);
0 commit comments