@@ -131,14 +131,7 @@ void IState_Charge::begin(Gint_Gamma& gg,
131
131
// Use a const vector to store efermi for all spins, replace the original implementation:
132
132
// const double ef_tmp = pelec->eferm.get_efval(is);
133
133
double ef_spin = ef_all_spin[is];
134
- ModuleIO::write_vdata_palgrid (pgrid,
135
- rho_save[is].data (),
136
- is,
137
- nspin,
138
- 0 ,
139
- ssc.str (),
140
- ef_spin,
141
- ucell_in);
134
+ ModuleIO::write_vdata_palgrid (pgrid, rho_save[is].data (), is, nspin, 0 , ssc.str (), ef_spin, ucell_in);
142
135
}
143
136
144
137
std::cout << " Complete!" << std::endl;
@@ -212,8 +205,11 @@ void IState_Charge::begin(Gint_k& gk,
212
205
if (bands_picked_[ib])
213
206
{
214
207
// Using new density matrix inplementation (multi-k)
215
- const int nspin_dm = std::map<int , int >({ {1 ,1 },{2 ,2 },{4 ,1 } })[nspin];
216
- elecstate::DensityMatrix<std::complex<double >, double > DM (this ->ParaV , nspin_dm, kv.kvec_d , kv.get_nks () / nspin_dm);
208
+ const int nspin_dm = std::map<int , int >({{1 , 1 }, {2 , 2 }, {4 , 1 }})[nspin];
209
+ elecstate::DensityMatrix<std::complex<double >, double > DM (this ->ParaV ,
210
+ nspin_dm,
211
+ kv.kvec_d ,
212
+ kv.get_nks () / nspin_dm);
217
213
218
214
#ifdef __MPI
219
215
this ->idmatrix (ib, nspin, nelec, nlocal, wg, DM, kv, if_separate_k);
@@ -259,13 +255,13 @@ void IState_Charge::begin(Gint_k& gk,
259
255
260
256
double ef_spin = ef_all_spin[is];
261
257
ModuleIO::write_vdata_palgrid (pgrid,
262
- rho_save[is].data (),
263
- is,
264
- nspin,
265
- 0 ,
266
- ssc.str (),
267
- ef_spin,
268
- ucell_in);
258
+ rho_save[is].data (),
259
+ is,
260
+ nspin,
261
+ 0 ,
262
+ ssc.str (),
263
+ ef_spin,
264
+ ucell_in);
269
265
}
270
266
271
267
std::cout << " Complete!" << std::endl;
@@ -318,13 +314,13 @@ void IState_Charge::begin(Gint_k& gk,
318
314
319
315
double ef_spin = ef_all_spin[is];
320
316
ModuleIO::write_vdata_palgrid (pgrid,
321
- rho_save[is].data (),
322
- is,
323
- nspin,
324
- 0 ,
325
- ssc.str (),
326
- ef_spin,
327
- ucell_in);
317
+ rho_save[is].data (),
318
+ is,
319
+ nspin,
320
+ 0 ,
321
+ ssc.str (),
322
+ ef_spin,
323
+ ucell_in);
328
324
}
329
325
330
326
std::cout << " Complete!" << std::endl;
@@ -480,7 +476,7 @@ void IState_Charge::idmatrix(const int& ib,
480
476
this ->psi_gamma ->fix_k (is);
481
477
482
478
// psi::Psi<double> wg_wfc(*this->psi_gamma, 1, this->psi_gamma->get_nbands());
483
- psi::Psi<double > wg_wfc (1 ,
479
+ psi::Psi<double > wg_wfc (1 ,
484
480
this ->psi_gamma ->get_nbands (),
485
481
this ->psi_gamma ->get_nbasis (),
486
482
this ->psi_gamma ->get_nbasis (),
@@ -547,12 +543,13 @@ void IState_Charge::idmatrix(const int& ib,
547
543
}
548
544
549
545
this ->psi_k ->fix_k (ik);
550
-
551
- psi::Psi<std::complex<double >> wg_wfc (1 ,
552
- this ->psi_k ->get_nbands (),
546
+
547
+ psi::Psi<std::complex<double >> wg_wfc (1 ,
548
+ this ->psi_k ->get_nbands (),
553
549
this ->psi_k ->get_nbasis (),
554
550
this ->psi_k ->get_nbasis (),
555
551
true );
552
+ wg_wfc.set_all_psi (this ->psi_k ->get_pointer (), wg_wfc.size ());
556
553
557
554
for (int ir = 0 ; ir < wg_wfc.get_nbands (); ++ir)
558
555
{
0 commit comments