Skip to content

Commit 84e63b6

Browse files
committed
remove Psi(const Psi& psi_in, const int nk_in, int nband_in);
1 parent 91b0281 commit 84e63b6

File tree

9 files changed

+17
-37
lines changed

9 files changed

+17
-37
lines changed

source/module_elecstate/cal_dm.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ inline void cal_dm(const Parallel_Orbitals* ParaV, const ModuleBase::matrix& wg,
2727
//dm.fix_k(ik);
2828
dm[ik].create(ParaV->ncol, ParaV->nrow);
2929
// wg_wfc(ib,iw) = wg[ib] * wfc(ib,iw);
30-
psi::Psi<double> wg_wfc(wfc, 1);
30+
// psi::Psi<double> wg_wfc(wfc, 1);
31+
psi::Psi<double> wg_wfc(1, nbands_local, nbasis_local);
3132

3233
int ib_global = 0;
3334
for (int ib_local = 0; ib_local < nbands_local; ++ib_local)

source/module_elecstate/module_dm/cal_dm_psi.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ void cal_dm_psi(const Parallel_Orbitals* ParaV,
3232
// dm.fix_k(ik);
3333
// dm[ik].create(ParaV->ncol, ParaV->nrow);
3434
// wg_wfc(ib,iw) = wg[ib] * wfc(ib,iw);
35-
psi::Psi<double> wg_wfc(wfc, 1);
35+
// psi::Psi<double> wg_wfc(wfc, 1, );
36+
psi::Psi<double> wg_wfc(1, nbands_local, nbasis_local);
3637

3738
int ib_global = 0;
3839
for (int ib_local = 0; ib_local < nbands_local; ++ib_local)

source/module_hamilt_general/operator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ T* Operator<T, Device>::get_hpsi(const hpsi_info& info) const
156156
else if(hpsi_pointer == psi_pointer)
157157
{
158158
this->in_place = true;
159-
this->hpsi = new psi::Psi<T, Device>(std::get<0>(info)[0], 1, nbands_range);
159+
// this->hpsi = new psi::Psi<T, Device>(std::get<0>(info)[0], 1, nbands_range);
160+
this->hpsi = new psi::Psi<T, Device>(1, nbands_range, std::get<0>(info)->get_nbasis());
160161
}
161162
else
162163
{

source/module_io/get_pchg_lcao.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,8 @@ void IState_Charge::idmatrix(const int& ib,
478478

479479
// wg_wfc(ib,iw) = wg[ib] * wfc(ib,iw);
480480
this->psi_gamma->fix_k(is);
481-
psi::Psi<double> wg_wfc(*this->psi_gamma, 1);
481+
// psi::Psi<double> wg_wfc(*this->psi_gamma, 1);
482+
psi::Psi<double> wg_wfc(1, this->psi_gamma->get_nbands(), this->psi_gamma->get_nbasis());
482483

483484
for (int ir = 0; ir < wg_wfc.get_nbands(); ++ir)
484485
{
@@ -540,7 +541,8 @@ void IState_Charge::idmatrix(const int& ib,
540541
}
541542

542543
this->psi_k->fix_k(ik);
543-
psi::Psi<std::complex<double>> wg_wfc(*this->psi_k, 1);
544+
// psi::Psi<std::complex<double>> wg_wfc(*this->psi_k, 1);
545+
psi::Psi<std::complex<double>> wg_wfc(1, this->psi_k->get_nbands(), this->psi_k->get_nbasis());
544546

545547
for (int ir = 0; ir < wg_wfc.get_nbands(); ++ir)
546548
{

source/module_io/write_dos_lcao.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,9 @@ void ModuleIO::write_dos_lcao(const UnitCell& ucell,
461461
}
462462

463463
psi->fix_k(ik);
464-
psi::Psi<std::complex<double>> Dwfc(psi[0], 1);
464+
// psi::Psi<std::complex<double>> Dwfc(psi[0], 1);
465+
psi::Psi<std::complex<double>> Dwfc(1, psi->get_nbands(), psi->get_nbasis());
466+
465467
std::complex<double>* p_dwfc = Dwfc.get_pointer();
466468
for (int index = 0; index < Dwfc.size(); ++index)
467469
{

source/module_io/write_proj_band_lcao.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ void ModuleIO::write_proj_band_lcao(
221221

222222
// calculate Mulk
223223
psi->fix_k(ik);
224-
psi::Psi<std::complex<double>> Dwfc(psi[0], 1);
224+
// psi::Psi<std::complex<double>> Dwfc(psi[0], 1);
225+
psi::Psi<std::complex<double>> Dwfc(1, psi->get_nbands(), psi->get_nbasis());
226+
225227
std::complex<double>* p_dwfc = Dwfc.get_pointer();
226228
for (int index = 0; index < Dwfc.size(); ++index)
227229
{

source/module_psi/psi.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -107,32 +107,6 @@ Psi<T, Device>::Psi(T* psi_pointer, const int nk_in, const int nbd_in, const int
107107
base_device::information::print_device_info<Device>(this->ctx, GlobalV::ofs_device);
108108
}
109109

110-
template <typename T, typename Device>
111-
Psi<T, Device>::Psi(const Psi& psi_in, const int nk_in, int nband_in)
112-
{
113-
assert(nk_in <= psi_in.get_nk());
114-
if (nband_in == 0)
115-
{
116-
nband_in = psi_in.get_nbands();
117-
}
118-
this->k_first = psi_in.get_k_first();
119-
this->device = psi_in.device;
120-
this->resize(nk_in, nband_in, psi_in.get_nbasis());
121-
this->ngk = psi_in.ngk;
122-
this->npol = psi_in.npol;
123-
if (nband_in <= psi_in.get_nbands())
124-
{
125-
// copy from Psi from psi_in(current_k, 0, 0),
126-
// if size of k is 1, current_k in new Psi is psi_in.current_k
127-
if (nk_in == 1)
128-
{
129-
// current_k for this Psi only keep the spin index same as the copied Psi
130-
this->current_k = psi_in.get_current_k();
131-
}
132-
synchronize_memory_op()(this->ctx, psi_in.get_device(), this->psi, psi_in.get_pointer(), this->size());
133-
}
134-
}
135-
136110
template <typename T, typename Device>
137111
Psi<T, Device>::Psi(T* psi_pointer, const Psi& psi_in, const int nk_in, int nband_in)
138112
{

source/module_psi/psi.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ class Psi
4242
// Constructor 3: specify nk, nbands, nbasis, ngk, and do not need to call resize() later
4343
Psi(const int nk_in, const int nbd_in, const int nbs_in, const int* ngk_in = nullptr, const bool k_first_in = true);
4444

45-
// Constructor 4: copy a new Psi which have several k-points and several bands from inputted psi_in
46-
Psi(const Psi& psi_in, const int nk_in, int nband_in = 0);
47-
4845
// Constructor 5: a wrapper of a data pointer, used for Operator::hPsi()
4946
// in this case, fix_k can not be used
5047
Psi(T* psi_pointer, const Psi& psi_in, const int nk_in, int nband_in = 0);

source/module_psi/test/psi_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TestPsi : public ::testing::Test
1515
const psi::Psi<std::complex<float>>* psi_object33 = new psi::Psi<std::complex<float>>(ink, inbands, inbasis, &ngk[0]);
1616
const psi::Psi<float>* psi_object34 = new psi::Psi<float>(ink, inbands, inbasis, &ngk[0]);
1717

18-
psi::Psi<std::complex<double>>* psi_object4 = new psi::Psi<std::complex<double>>(*psi_object31, ink, 0);
18+
// psi::Psi<std::complex<double>>* psi_object4 = new psi::Psi<std::complex<double>>(*psi_object31, ink, 0);
1919
psi::Psi<std::complex<double>>* psi_object5 = new psi::Psi<std::complex<double>>(psi_object31->get_pointer(), *psi_object31, ink, 0);
2020
};
2121

0 commit comments

Comments
 (0)