diff --git a/source/module_hsolver/diago_dav_subspace.cpp b/source/module_hsolver/diago_dav_subspace.cpp index 7d298be7ac..c1724eb136 100644 --- a/source/module_hsolver/diago_dav_subspace.cpp +++ b/source/module_hsolver/diago_dav_subspace.cpp @@ -25,9 +25,9 @@ Diago_DavSubspace::Diago_DavSubspace(const std::vector& precond { this->device = base_device::get_device_type(this->ctx); - this->one = this->cs.one; - this->zero = this->cs.zero; - this->neg_one = this->cs.neg_one; + this->one = &one_; + this->zero = &zero_; + this->neg_one = &neg_one_; assert(david_ndim_in > 1); assert(david_ndim_in * nband_in < nbasis_in * this->diag_comm.nproc); @@ -559,8 +559,8 @@ void Diago_DavSubspace::diag_zhegvx(const int& nbase, } else { - std::vector> h_diag(nbase, std::vector(nbase, cs.zero[0])); - std::vector> s_diag(nbase, std::vector(nbase, cs.zero[0])); + std::vector> h_diag(nbase, std::vector(nbase, *this->zero)); + std::vector> s_diag(nbase, std::vector(nbase, *this->zero)); for (size_t i = 0; i < nbase; i++) { @@ -589,10 +589,10 @@ void Diago_DavSubspace::diag_zhegvx(const int& nbase, for (size_t j = nbase; j < this->nbase_x; j++) { - hcc[i * this->nbase_x + j] = cs.zero[0]; - hcc[j * this->nbase_x + i] = cs.zero[0]; - scc[i * this->nbase_x + j] = cs.zero[0]; - scc[j * this->nbase_x + i] = cs.zero[0]; + hcc[i * this->nbase_x + j] = *this->zero; + hcc[j * this->nbase_x + i] = *this->zero; + scc[i * this->nbase_x + j] = *this->zero; + scc[j * this->nbase_x + i] = *this->zero; } } } diff --git a/source/module_hsolver/diago_dav_subspace.h b/source/module_hsolver/diago_dav_subspace.h index c335513a71..dc1e6c79a6 100644 --- a/source/module_hsolver/diago_dav_subspace.h +++ b/source/module_hsolver/diago_dav_subspace.h @@ -158,8 +158,8 @@ class Diago_DavSubspace using syncmem_h2d_op = base_device::memory::synchronize_memory_op; using syncmem_d2h_op = base_device::memory::synchronize_memory_op; - const_nums cs; const T *one = nullptr, *zero = nullptr, *neg_one = nullptr; + const T one_ = static_cast(1.0), zero_ = static_cast(0.0), neg_one_ = static_cast(-1.0); }; } // namespace hsolver