@@ -108,9 +108,16 @@ namespace LR_Util
108108 {
109109 assert (psi_kfirst.get_nk () == 1 );
110110 assert (nk_in * nbasis_in == psi_kfirst.get_nbasis ());
111+
112+ std::vector<int > ngk_vector (nk_in, 0 );
113+ for (size_t i = 0 ; i < ngk_vector.size (); i++)
114+ {
115+ ngk_vector[i] = psi_kfirst.get_ngk_pointer ()[i];
116+ }
117+
111118 int ib_now = psi_kfirst.get_current_b ();
112119 psi_kfirst.fix_b (0 ); // for get_pointer() to get the head pointer
113- psi::Psi<T, Device> psi_bfirst (psi_kfirst.get_pointer (), nk_in, psi_kfirst.get_nbands (), nbasis_in, psi_kfirst. get_ngk_pointer () , false );
120+ psi::Psi<T, Device> psi_bfirst (psi_kfirst.get_pointer (), nk_in, psi_kfirst.get_nbands (), nbasis_in, ngk_vector , false );
114121 psi_kfirst.fix_b (ib_now);
115122 return psi_bfirst;
116123 }
@@ -121,8 +128,15 @@ namespace LR_Util
121128 {
122129 int ib_now = psi_bfirst.get_current_b ();
123130 int ik_now = psi_bfirst.get_current_k ();
131+
132+ std::vector<int > ngk_vector (psi_bfirst.get_nk (), 0 );
133+ for (size_t i = 0 ; i < ngk_vector.size (); i++)
134+ {
135+ ngk_vector[i] = psi_bfirst.get_ngk_pointer ()[i];
136+ }
137+
124138 psi_bfirst.fix_kb (0 , 0 ); // for get_pointer() to get the head pointer
125- psi::Psi<T, Device> psi_kfirst (psi_bfirst.get_pointer (), 1 , psi_bfirst.get_nbands (), psi_bfirst.get_nk () * psi_bfirst.get_nbasis (), psi_bfirst. get_ngk_pointer () , true );
139+ psi::Psi<T, Device> psi_kfirst (psi_bfirst.get_pointer (), 1 , psi_bfirst.get_nbands (), psi_bfirst.get_nk () * psi_bfirst.get_nbasis (), ngk_vector , true );
126140 psi_bfirst.fix_kb (ik_now, ib_now);
127141 return psi_kfirst;
128142 }
0 commit comments