@@ -26,10 +26,10 @@ DensityMatrix<TK, TR>::~DensityMatrix()
2626
2727template <typename TK, typename TR>
2828DensityMatrix<TK, TR>::DensityMatrix(const Parallel_Orbitals* paraV_in, const int nspin, const std::vector<ModuleBase::Vector3<double >>& kvec_d, const int nk)
29- : _paraV(paraV_in), _nspin(nspin), _kvec_d(kvec_d), _nks ((nk > 0 && nk <= _kvec_d.size()) ? nk : _kvec_d.size())
29+ : _paraV(paraV_in), _nspin(nspin), _kvec_d(kvec_d), _nk ((nk > 0 && nk <= _kvec_d.size()) ? nk : _kvec_d.size())
3030{
3131 ModuleBase::TITLE (" DensityMatrix" , " DensityMatrix-MK" );
32- const int nks = _nks * _nspin;
32+ const int nks = _nk * _nspin;
3333 this ->_DMK .resize (nks);
3434 for (int ik = 0 ; ik < nks; ik++)
3535 {
@@ -39,7 +39,7 @@ DensityMatrix<TK, TR>::DensityMatrix(const Parallel_Orbitals* paraV_in, const in
3939}
4040
4141template <typename TK, typename TR>
42- DensityMatrix<TK, TR>::DensityMatrix(const Parallel_Orbitals* paraV_in, const int nspin) :_paraV(paraV_in), _nspin(nspin), _kvec_d({ ModuleBase::Vector3<double >(0 ,0 ,0 ) }), _nks (1 )
42+ DensityMatrix<TK, TR>::DensityMatrix(const Parallel_Orbitals* paraV_in, const int nspin) :_paraV(paraV_in), _nspin(nspin), _kvec_d({ ModuleBase::Vector3<double >(0 ,0 ,0 ) }), _nk (1 )
4343{
4444 ModuleBase::TITLE (" DensityMatrix" , " DensityMatrix-GO" );
4545 this ->_DMK .resize (_nspin);
@@ -236,7 +236,7 @@ template <typename TK, typename TR>
236236TK* DensityMatrix<TK, TR>::get_DMK_pointer(const int ik) const
237237{
238238#ifdef __DEBUG
239- assert (ik < this ->_nks * this ->_nspin );
239+ assert (ik < this ->_nk * this ->_nspin );
240240#endif
241241 return const_cast <TK*>(this ->_DMK [ik].data ());
242242}
@@ -246,7 +246,7 @@ template <typename TK, typename TR>
246246void DensityMatrix<TK, TR>::set_DMK_pointer(const int ik, TK* DMK_in)
247247{
248248#ifdef __DEBUG
249- assert (ik < this ->_nks * this ->_nspin );
249+ assert (ik < this ->_nk * this ->_nspin );
250250#endif
251251 this ->_DMK [ik].assign (DMK_in, DMK_in + this ->_paraV ->nrow * this ->_paraV ->ncol );
252252}
@@ -257,17 +257,17 @@ void DensityMatrix<TK, TR>::set_DMK(const int ispin, const int ik, const int i,
257257{
258258#ifdef __DEBUG
259259 assert (ispin > 0 && ispin <= this ->_nspin );
260- assert (ik >= 0 && ik < this ->_nks );
260+ assert (ik >= 0 && ik < this ->_nk );
261261#endif
262262 // consider transpose col=>row
263- this ->_DMK [ik + this ->_nks * (ispin - 1 )][i * this ->_paraV ->nrow + j] = value;
263+ this ->_DMK [ik + this ->_nk * (ispin - 1 )][i * this ->_paraV ->nrow + j] = value;
264264}
265265
266266// set _DMK element
267267template <typename TK, typename TR>
268268void DensityMatrix<TK, TR>::set_DMK_zero()
269269{
270- for (int ik = 0 ; ik < _nspin * _nks ; ik++)
270+ for (int ik = 0 ; ik < _nspin * _nk ; ik++)
271271 {
272272 ModuleBase::GlobalFunc::ZEROS (this ->_DMK [ik].data (),
273273 this ->_paraV ->get_row_size () * this ->_paraV ->get_col_size ());
@@ -282,17 +282,17 @@ TK DensityMatrix<TK, TR>::get_DMK(const int ispin, const int ik, const int i, co
282282 assert (ispin > 0 && ispin <= this ->_nspin );
283283#endif
284284 // consider transpose col=>row
285- return this ->_DMK [ik + this ->_nks * (ispin - 1 )][i * this ->_paraV ->nrow + j];
285+ return this ->_DMK [ik + this ->_nk * (ispin - 1 )][i * this ->_paraV ->nrow + j];
286286}
287287
288288// get _DMK nks, nrow, ncol
289289template <typename TK, typename TR>
290290int DensityMatrix<TK, TR>::get_DMK_nks() const
291291{
292292#ifdef __DEBUG
293- assert (this ->_DMK .size () == _nks * _nspin);
293+ assert (this ->_DMK .size () == _nk * _nspin);
294294#endif
295- return _nks * _nspin;
295+ return _nk * _nspin;
296296}
297297
298298template <typename TK, typename TR>
@@ -364,7 +364,7 @@ void DensityMatrix<TK, TR>::cal_DMR_test()
364364{
365365 for (int is = 1 ; is <= this ->_nspin ; ++is)
366366 {
367- int ik_begin = this ->_nks * (is - 1 ); // jump this->_nks for spin_down if nspin==2
367+ int ik_begin = this ->_nk * (is - 1 ); // jump this->_nk for spin_down if nspin==2
368368 hamilt::HContainer<TR>* tmp_DMR = this ->_DMR [is - 1 ];
369369 // set zero since this function is called in every scf step
370370 tmp_DMR->set_zero ();
@@ -396,7 +396,7 @@ void DensityMatrix<TK, TR>::cal_DMR_test()
396396#endif
397397 std::complex <TR> tmp_res;
398398 // loop over k-points
399- for (int ik = 0 ; ik < this ->_nks ; ++ik)
399+ for (int ik = 0 ; ik < this ->_nk ; ++ik)
400400 {
401401 // cal k_phase
402402 // if TK==std::complex<double>, kphase is e^{ikR}
@@ -438,7 +438,7 @@ void DensityMatrix<std::complex<double>, double>::cal_DMR()
438438 int ld_hk2 = 2 * ld_hk;
439439 for (int is = 1 ; is <= this ->_nspin ; ++is)
440440 {
441- int ik_begin = this ->_nks * (is - 1 ); // jump this->_nks for spin_down if nspin==2
441+ int ik_begin = this ->_nk * (is - 1 ); // jump this->_nk for spin_down if nspin==2
442442 hamilt::HContainer<double >* tmp_DMR = this ->_DMR [is - 1 ];
443443 // set zero since this function is called in every scf step
444444 tmp_DMR->set_zero ();
@@ -471,7 +471,7 @@ void DensityMatrix<std::complex<double>, double>::cal_DMR()
471471 // loop over k-points
472472 if (PARAM.inp .nspin != 4 )
473473 {
474- for (int ik = 0 ; ik < this ->_nks ; ++ik)
474+ for (int ik = 0 ; ik < this ->_nk ; ++ik)
475475 {
476476 // cal k_phase
477477 // if TK==std::complex<double>, kphase is e^{ikR}
@@ -517,7 +517,7 @@ void DensityMatrix<std::complex<double>, double>::cal_DMR()
517517 std::vector<std::complex <double >> tmp_DMR (this ->_paraV ->get_col_size ()
518518 * this ->_paraV ->get_row_size (),
519519 std::complex <double >(0.0 , 0.0 ));
520- for (int ik = 0 ; ik < this ->_nks ; ++ik)
520+ for (int ik = 0 ; ik < this ->_nk ; ++ik)
521521 {
522522 // cal k_phase
523523 // if TK==std::complex<double>, kphase is e^{ikR}
@@ -603,7 +603,7 @@ void DensityMatrix<std::complex<double>, double>::cal_DMR(const int ik)
603603 int ld_hk2 = 2 * ld_hk;
604604 for (int is = 1 ; is <= this ->_nspin ; ++is)
605605 {
606- int ik_begin = this ->_nks * (is - 1 ); // jump this->_nks for spin_down if nspin==2
606+ int ik_begin = this ->_nk * (is - 1 ); // jump this->_nk for spin_down if nspin==2
607607 hamilt::HContainer<double >* tmp_DMR = this ->_DMR [is - 1 ];
608608 // set zero since this function is called in every scf step
609609 tmp_DMR->set_zero ();
@@ -693,14 +693,14 @@ void DensityMatrix<double, double>::cal_DMR()
693693 int ld_hk = this ->_paraV ->nrow ;
694694 for (int is = 1 ; is <= this ->_nspin ; ++is)
695695 {
696- int ik_begin = this ->_nks * (is - 1 ); // jump this->_nks for spin_down if nspin==2
696+ int ik_begin = this ->_nk * (is - 1 ); // jump this->_nk for spin_down if nspin==2
697697 hamilt::HContainer<double >* tmp_DMR = this ->_DMR [is - 1 ];
698698 // set zero since this function is called in every scf step
699699 tmp_DMR->set_zero ();
700700
701701#ifdef __DEBUG
702702 // assert(tmp_DMR->is_gamma_only() == true);
703- assert (this ->_nks == 1 );
703+ assert (this ->_nk == 1 );
704704#endif
705705#ifdef _OPENMP
706706#pragma omp parallel for
@@ -828,7 +828,7 @@ void DensityMatrix<TK, TR>::read_DMK(const std::string directory, const int ispi
828828 {
829829 for (int j = 0 ; j < this ->_paraV ->ncol ; ++j)
830830 {
831- ifs >> this ->_DMK [ik + this ->_nks * (ispin - 1 )][i * this ->_paraV ->ncol + j];
831+ ifs >> this ->_DMK [ik + this ->_nk * (ispin - 1 )][i * this ->_paraV ->ncol + j];
832832 }
833833 }
834834 ifs.close ();
@@ -865,7 +865,7 @@ void DensityMatrix<double, double>::write_DMK(const std::string directory, const
865865 {
866866 ofs << " \n " ;
867867 }
868- ofs << " " << this ->_DMK [ik + this ->_nks * (ispin - 1 )][i * this ->_paraV ->ncol + j];
868+ ofs << " " << this ->_DMK [ik + this ->_nk * (ispin - 1 )][i * this ->_paraV ->ncol + j];
869869 }
870870 }
871871
@@ -902,7 +902,7 @@ void DensityMatrix<std::complex<double>, double>::write_DMK(const std::string di
902902 {
903903 ofs << " \n " ;
904904 }
905- ofs << " " << this ->_DMK [ik + this ->_nks * (ispin - 1 )][i * this ->_paraV ->ncol + j].real ();
905+ ofs << " " << this ->_DMK [ik + this ->_nk * (ispin - 1 )][i * this ->_paraV ->ncol + j].real ();
906906 }
907907 }
908908
0 commit comments