Skip to content

Commit d8bd20a

Browse files
committed
move read psi to esolver, not in psi
1 parent 367db31 commit d8bd20a

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

source/source_esolver/esolver_ks_lcao.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "source_io/ctrl_iter_lcao.h" // use ctrl_iter_lcao()
2222
#include "source_io/ctrl_scf_lcao.h" // use ctrl_scf_lcao()
2323
#include "source_psi/setup_psi.h" // mohan add 20251019
24+
#include "source_io/read_wfc_nao.h"
2425

2526
namespace ModuleESolver
2627
{
@@ -75,7 +76,19 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(UnitCell& ucell, const Input_pa
7576
}
7677

7778
// 5) init electronic wave function psi
78-
Setup_Psi<TK>::allocate_psi(this->psi, this->pelec->ekb, this->pelec->wg, this->kv, this->pv, PARAM.inp);
79+
Setup_Psi<TK>::allocate_psi(this->psi, this->kv, this->pv, PARAM.inp);
80+
81+
//! read psi from file
82+
if (inp.init_wfc == "file" && inp.esolver_type != "tddft")
83+
{
84+
if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir,
85+
this->pv, *this->psi, this->pelec->ekb, this->pelec->wg, this->kv.ik2iktot,
86+
this->kv.get_nkstot(), PARAM.inp.nspin))
87+
{
88+
ModuleBase::WARNING_QUIT("ESolver_KS_LCAO", "read electronic wave functions failed");
89+
}
90+
}
91+
7992

8093
// 7) init DMK, but DMR is constructed in before_scf()
8194
dynamic_cast<elecstate::ElecStateLCAO<TK>*>(this->pelec)->init_DM(&this->kv, &(this->pv), inp.nspin);

source/source_psi/setup_psi.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "source_psi/setup_psi.h"
22
#include "source_io/module_parameter/parameter.h" // use parameter
3-
#include "source_io/read_wfc_nao.h"
43

54
template <typename T>
65
Setup_Psi<T>::Setup_Psi(){}
@@ -14,8 +13,6 @@ Setup_Psi<T>::~Setup_Psi(){}
1413
template <typename T>
1514
void Setup_Psi<T>::allocate_psi(
1615
psi::Psi<T>* &psi,
17-
ModuleBase::matrix &ekb,
18-
ModuleBase::matrix &wg,
1916
const K_Vectors &kv,
2017
const Parallel_Orbitals &para_orb,
2118
const Input_para &inp)
@@ -47,19 +44,6 @@ void Setup_Psi<T>::allocate_psi(
4744
}
4845
psi = new psi::Psi<T>(nsk, ncol, para_orb.nrow, kv.ngk, true);
4946
}
50-
51-
//------------------------------
52-
//! read psi from file
53-
//------------------------------
54-
if (inp.init_wfc == "file" && inp.esolver_type != "tddft")
55-
{
56-
if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir,
57-
para_orb, *psi, ekb, wg, kv.ik2iktot,
58-
kv.get_nkstot(), inp.nspin))
59-
{
60-
ModuleBase::WARNING_QUIT("Setup_Psi", "read electronic wave functions failed");
61-
}
62-
}
6347
}
6448

6549

source/source_psi/setup_psi.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "source_cell/klist.h"
66
#include "source_io/module_parameter/input_parameter.h"
77
#include "source_basis/module_ao/parallel_orbitals.h" // use para_orb
8-
#include "source_base/matrix.h" // use matrix
98

109
template <typename T>
1110
class Setup_Psi
@@ -17,8 +16,6 @@ class Setup_Psi
1716

1817
static void allocate_psi(
1918
psi::Psi<T>* &psi,
20-
ModuleBase::matrix &ekb,
21-
ModuleBase::matrix &wg,
2219
const K_Vectors &kv,
2320
const Parallel_Orbitals &para_orb,
2421
const Input_para &inp);

0 commit comments

Comments
 (0)