Skip to content

Commit

Permalink
Fix: get_pointer(int) in Psi
Browse files Browse the repository at this point in the history
  • Loading branch information
dyzheng committed Oct 18, 2024
1 parent e75c861 commit 97d9ae9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions source/module_hamilt_lcao/module_deltaspin/cal_mw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ void SpinConstrain<std::complex<double>>::cal_Mi_pw()
const int npol = psi_t->npol;
for(int ik = 0; ik < nks; ik++)
{
psi_pointer = psi_t->get_pointer(ik);
psi_t->fix_k(ik);
psi_pointer = psi_t->get_pointer();
onsite_p->tabulate_atomic(ik); // tabulate for each atom at each k-point
// std::cout << __FILE__ << ":" << __LINE__ << " nbands = " << nbands << std::endl;
onsite_p->overlap_proj_psi(nbands * npol, psi_pointer);
Expand Down Expand Up @@ -177,7 +178,8 @@ void SpinConstrain<std::complex<double>>::cal_Mi_pw()
const int npol = psi_t->npol;
for(int ik = 0; ik < nks; ik++)
{
psi_pointer = psi_t->get_pointer(ik);
psi_t->fix_k(ik);
psi_pointer = psi_t->get_pointer();
onsite_p->tabulate_atomic(ik); // tabulate for each atom at each k-point
// std::cout << __FILE__ << ":" << __LINE__ << " nbands = " << nbands << std::endl;
onsite_p->overlap_proj_psi(nbands * npol, psi_pointer);
Expand Down
3 changes: 1 addition & 2 deletions source/module_psi/psi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,7 @@ template <typename T, typename Device> T* Psi<T, Device>::get_pointer(const int&
{
assert(ikb >= 0);
assert(this->k_first ? ikb < this->nbands : ikb < this->nk);
T* p = this->k_first ? &this->psi[ikb * this->nbands * this->nbasis] : &this->psi[ikb * this->nk * this->nbasis];
return p;
return &this->psi_current[ikb * this->nbasis];
}

template <typename T, typename Device> const int* Psi<T, Device>::get_ngk_pointer() const
Expand Down

0 comments on commit 97d9ae9

Please sign in to comment.