Skip to content

Commit b590f0d

Browse files
committed
update ngk_vector
1 parent 8822aad commit b590f0d

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

source/module_psi/psi.cpp

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Psi<T, Device>::Psi(const int nk_in,
5858
this->k_first = k_first_in;
5959
this->allocate_inside = true;
6060

61-
this->ngk = ngk_in.data(); // modify later
61+
// this->ngk = ngk_in.data(); // modify later
6262
ngk_vector = ngk_in;
6363

6464
// This function will delete the psi array first(if psi exist), then malloc a new memory for it.
@@ -97,7 +97,7 @@ Psi<T, Device>::Psi(T* psi_pointer,
9797
this->k_first = k_first_in;
9898
this->allocate_inside = false;
9999

100-
this->ngk = nullptr;
100+
// this->ngk = nullptr;
101101
ngk_vector = std::vector<int>(nk_in, current_nbasis_in);
102102

103103

@@ -131,7 +131,7 @@ Psi<T, Device>::Psi(const int nk_in,
131131
this->k_first = k_first_in;
132132
this->allocate_inside = true;
133133

134-
this->ngk = nullptr;
134+
// this->ngk = nullptr;
135135
ngk_vector = std::vector<int>(nk_in, current_nbasis_in);
136136

137137
assert(nk_in > 0 && nbd_in >= 0 && nbs_in > 0);
@@ -160,7 +160,7 @@ template <typename T, typename Device>
160160
Psi<T, Device>::Psi(const Psi& psi_in)
161161
{
162162

163-
this->ngk = psi_in.ngk;
163+
// this->ngk = psi_in.ngk;
164164
this->ngk_vector = psi_in.ngk_vector;
165165

166166
this->nk = psi_in.get_nk();
@@ -187,7 +187,7 @@ template <typename T_in, typename Device_in>
187187
Psi<T, Device>::Psi(const Psi<T_in, Device_in>& psi_in)
188188
{
189189

190-
this->ngk = psi_in.get_ngk_pointer();
190+
// this->ngk = psi_in.get_ngk_pointer();
191191
this->ngk_vector = psi_in.get_ngk_vector();
192192

193193
this->nk = psi_in.get_nk();
@@ -281,11 +281,11 @@ const Device* Psi<T, Device>::get_device() const
281281
return this->ctx;
282282
}
283283

284-
template <typename T, typename Device>
285-
const int* Psi<T, Device>::get_ngk_pointer() const
286-
{
287-
return this->ngk;
288-
}
284+
// template <typename T, typename Device>
285+
// const int* Psi<T, Device>::get_ngk_pointer() const
286+
// {
287+
// return this->ngk;
288+
// }
289289

290290
template <typename T, typename Device>
291291
const std::vector<int>& Psi<T, Device>::get_ngk_vector() const
@@ -359,14 +359,16 @@ void Psi<T, Device>::fix_k(const int ik) const
359359
{
360360
assert(ik >= 0);
361361
this->current_k = ik;
362-
if (this->ngk != nullptr)
363-
{
364-
this->current_nbasis = this->ngk[ik];
365-
}
366-
else
367-
{
368-
this->current_nbasis = this->nbasis;
369-
}
362+
363+
// if (this->ngk != nullptr)
364+
// {
365+
// this->current_nbasis = this->ngk[ik];
366+
// }
367+
// else
368+
// {
369+
// this->current_nbasis = this->nbasis;
370+
// }
371+
this->current_nbasis = this->ngk_vector[ik];
370372

371373
if (this->k_first)
372374
{
@@ -473,8 +475,8 @@ int Psi<T, Device>::get_current_nbas() const
473475
template <typename T, typename Device>
474476
const int& Psi<T, Device>::get_ngk(const int ik_in) const
475477
{
476-
assert(this->ngk != nullptr);
477-
return this->ngk[ik_in];
478+
// assert(this->ngk != nullptr);
479+
return this->ngk_vector[ik_in];
478480
}
479481

480482
template <typename T, typename Device>

source/module_psi/psi.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class Psi
118118

119119
const int& get_ngk(const int ik_in) const;
120120

121-
const int* get_ngk_pointer() const;
121+
// const int* get_ngk_pointer() const;
122122

123123
const std::vector<int>& get_ngk_vector() const;
124124

@@ -157,7 +157,7 @@ class Psi
157157
// psi_current = psi + psi_bias;
158158
mutable int psi_bias = 0;
159159

160-
const int* ngk = nullptr;
160+
// const int* ngk = nullptr;
161161
std::vector<int> ngk_vector;
162162

163163
bool k_first = true;

0 commit comments

Comments
 (0)