Skip to content

Commit b15cd5c

Browse files
committed
fix bug
1 parent 84e63b6 commit b15cd5c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

source/module_psi/psi.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,12 @@ template <typename T, typename Device>
208208
void Psi<T, Device>::resize(const int nks_in, const int nbands_in, const int nbasis_in)
209209
{
210210
assert(nks_in > 0 && nbands_in >= 0 && nbasis_in > 0);
211+
211212
// This function will delete the psi array first(if psi exist), then malloc a new memory for it.
212213
resize_memory_op()(this->ctx, this->psi, nks_in * static_cast<std::size_t>(nbands_in) * nbasis_in, "no_record");
214+
215+
this->zero_out();
216+
213217
this->nk = nks_in;
214218
this->nbands = nbands_in;
215219
this->nbasis = nbasis_in;

0 commit comments

Comments
 (0)