Skip to content

Commit e8d5d5b

Browse files
committed
Fix: using psi for DeePKS in PW base
1 parent 920f231 commit e8d5d5b

File tree

7 files changed

+16
-10
lines changed

7 files changed

+16
-10
lines changed

source/module_deepks/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ get_target_property(ABACUS_LINK_LIBRARIES ${ABACUS_BIN_NAME} LINK_LIBRARIES)
77
target_link_libraries(
88
test_deepks
99
base cell symmetry md surchem xc
10-
neighbor orb io ions lcao parallel mrrr pdiag pw ri driver esolver
10+
neighbor orb io ions lcao parallel mrrr pdiag pw ri driver esolver hsolver psi elecstate hamilt
1111
pthread
1212
deepks
1313
${ABACUS_LINK_LIBRARIES}

source/run_pw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void Run_pw::plane_wave_line(ModuleESolver::ESolver *p_esolver)
5959
if(GlobalV::BASIS_TYPE=="pw" && GlobalV::deepks_out_labels)
6060
{
6161
Numerical_Descriptor nc;
62-
nc.output_descriptor(GlobalC::wf.evc, INPUT.deepks_descriptor_lmax);
62+
nc.output_descriptor(GlobalC::wf.psi[0], INPUT.deepks_descriptor_lmax);
6363
ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running,"GENERATE DESCRIPTOR FOR DEEPKS");
6464
}
6565

source/src_io/numerical_descriptor.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Numerical_Descriptor::~Numerical_Descriptor()
2323
}
2424

2525

26-
void Numerical_Descriptor::output_descriptor(const ModuleBase::ComplexMatrix *psi, const int &lmax_in)
26+
void Numerical_Descriptor::output_descriptor(const psi::Psi<std::complex<double>> &psi, const int &lmax_in)
2727
{
2828
ModuleBase::TITLE("Numerical_Descriptor","output_descriptor");
2929
ModuleBase::GlobalFunc::NEW_PART("DeepKS descriptor: D_{Inl}");
@@ -90,7 +90,8 @@ void Numerical_Descriptor::output_descriptor(const ModuleBase::ComplexMatrix *ps
9090
GlobalV::ofs_running << "\n " << std::setw(8) << ik+1 << std::setw(8) << npw << std::endl;
9191
GlobalV::ofs_running << " --------------------------------------------------------" << std::endl;
9292
// search for all k-points.
93-
this->jlq3d_overlap(overlap_Q1, overlap_Q2, ik, ik, npw, psi[ik]);
93+
psi.fix_k(ik);
94+
this->jlq3d_overlap(overlap_Q1, overlap_Q2, ik, ik, npw, psi);
9495
ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running,"jlq3d_overlap");
9596
}
9697

@@ -233,7 +234,7 @@ void Numerical_Descriptor::jlq3d_overlap(
233234
const int &ik_ibz,
234235
const int &ik,
235236
const int &np,
236-
const ModuleBase::ComplexMatrix &psi)
237+
const psi::Psi<std::complex<double>> &psi)
237238
{
238239
ModuleBase::TITLE("Numerical_Descriptor","jlq3d_overlap");
239240
ModuleBase::timer::tick("Numerical_Descriptor","jlq3d_overlap");

source/src_io/numerical_descriptor.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "../module_base/intarray.h"
1010
#include "../module_base/complexmatrix.h"
1111
#include "bessel_basis.h"
12+
#include "module_psi/psi.h"
1213
//==========================================================
1314
// CLASS :
1415
// NAME : Numerical_Descriptor
@@ -19,7 +20,7 @@ class Numerical_Descriptor
1920
Numerical_Descriptor();
2021
~Numerical_Descriptor();
2122

22-
void output_descriptor( const ModuleBase::ComplexMatrix *psi, const int &lmax_in); // mohan added 2021-01-03
23+
void output_descriptor( const psi::Psi<std::complex<double>> &psi, const int &lmax_in); // mohan added 2021-01-03
2324

2425
private:
2526

@@ -35,7 +36,7 @@ class Numerical_Descriptor
3536
void init_mu_index(void);//mohan added 2021-01-03
3637

3738
void jlq3d_overlap(ModuleBase::realArray &overlap_Q1, ModuleBase::realArray &overlap_Q2,
38-
const int &ik_ibz, const int &ik, const int &np, const ModuleBase::ComplexMatrix &psi);
39+
const int &ik_ibz, const int &ik, const int &np, const psi::Psi<std::complex<double>> &psi);
3940

4041
void generate_descriptor(ModuleBase::realArray &overlap_Q1, ModuleBase::realArray &overlap_Q2,
4142
const int &it, const int &ia, double *d, const int &nd);

source/src_pw/wavefunc.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,11 @@ void wavefunc::wfcinit(void)
172172
if (GlobalV::test_wf>2)
173173
{
174174
output::printrm(GlobalV::ofs_running, " wg ", wg);
175-
this->check_psi();
175+
if(this->evc!=nullptr)
176+
{
177+
this->check_evc();
178+
}
179+
//lack of check for psi
176180
}
177181

178182
ModuleBase::timer::tick("wavefunc","wfcinit");

source/src_pw/wf_atomic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ void WF_atomic::print_PAOs(void)const
218218
//===================================================================
219219
// from wfcinit.f90
220220

221-
void WF_atomic::check_psi()const
221+
void WF_atomic::check_evc()const
222222
{
223223
std::cout<<"\n Check psi : \n";
224224

source/src_pw/wf_atomic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class WF_atomic : public WF_igk
5050
void random(ModuleBase::ComplexMatrix &psi,const int iw_start,const int iw_end,const int ik)const;
5151
void atomicrandom(ModuleBase::ComplexMatrix &psi,const int iw_start,const int iw_end,const int ik)const;
5252

53-
void check_psi()const;
53+
void check_evc()const;
5454

5555
};
5656
#endif

0 commit comments

Comments
 (0)