Skip to content

Commit f39bc50

Browse files
committed
fix bugs
1 parent 63eab55 commit f39bc50

21 files changed

+287
-841
lines changed

source/Makefile.Objects

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,6 @@ OBJS_IO_LCAO=cal_r_overlap_R.o\
623623
write_dmk.o\
624624
unk_overlap_lcao.o\
625625
read_wfc_nao.o\
626-
read_wfc_lcao.o\
627626
write_wfc_nao.o\
628627
write_HS_sparse.o\
629628
single_R_io.o\
@@ -765,6 +764,7 @@ OBJS_SRCPW=H_Ewald_pw.o\
765764
of_stress_pw.o\
766765
symmetry_rho.o\
767766
symmetry_rhog.o\
767+
setup_psi_pw.o\
768768
setup_psi.o\
769769
psi_init.o\
770770
elecond.o\

source/source_esolver/esolver_ks_lcao.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "source_io/ctrl_runner_lcao.h" // use ctrl_runner_lcao()
2121
#include "source_io/ctrl_iter_lcao.h" // use ctrl_iter_lcao()
2222
#include "source_io/ctrl_scf_lcao.h" // use ctrl_scf_lcao()
23-
#include "source_psi/setup_psi_lcao.h" // mohan add 20251019
23+
#include "source_psi/setup_psi.h" // mohan add 20251019
2424

2525
namespace ModuleESolver
2626
{
@@ -75,7 +75,7 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(UnitCell& ucell, const Input_pa
7575
}
7676

7777
// 5) init electronic wave function psi
78-
Setup_Psi_LCAO::before_runner();
78+
Setup_Psi<TK>::allocate_psi(this->psi, this->pelec->ekb, this->pelec->wg, this->kv, this->pv, PARAM.inp);
7979

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

source/source_esolver/esolver_ks_lcao_tddft.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,10 @@ void ESolver_KS_LCAO_TDDFT<TR, Device>::before_all_runners(UnitCell& ucell, cons
102102
if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir,
103103
this->pv,
104104
*(this->psi),
105-
this->pelec,
106-
this->pelec->klist->ik2iktot,
107-
this->pelec->klist->get_nkstot(),
105+
this->pelec->ekb,
106+
this->pelec->wg,
107+
this->kv.ik2iktot,
108+
this->kv.get_nkstot(),
108109
PARAM.inp.nspin,
109110
0,
110111
TD_info::estep_shift))

source/source_esolver/esolver_ks_pw.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef ESOLVER_KS_PW_H
22
#define ESOLVER_KS_PW_H
33
#include "./esolver_ks.h"
4-
#include "source_psi/setup_psi.h" // mohan add 20251012
4+
#include "source_psi/setup_psi_pw.h" // mohan add 20251012
55
#include "source_pw/module_pwdft/VSep_in_pw.h"
66
#include "source_pw/module_pwdft/global.h"
77
#include "source_pw/module_pwdft/module_exx_helper/exx_helper.h"
@@ -53,7 +53,7 @@ class ESolver_KS_PW : public ESolver_KS<T, Device>
5353
virtual void deallocate_hamilt();
5454

5555
// Electronic wave function psi
56-
Setup_Psi<T, Device> stp;
56+
Setup_Psi_pw<T, Device> stp;
5757

5858
// DFT-1/2 method
5959
VSep* vsep_cell = nullptr;

source/source_esolver/lcao_others.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ void ESolver_KS_LCAO<TK, TR>::others(UnitCell& ucell, const int istep)
155155
if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir,
156156
this->pv,
157157
*(this->psi),
158-
this->pelec,
158+
this->pelec->ekb,
159+
this->pelec->wg,
159160
this->pelec->klist->ik2iktot,
160161
this->pelec->klist->get_nkstot(),
161162
PARAM.inp.nspin))

source/source_io/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ if(ENABLE_LCAO)
6161
get_pchg_lcao.cpp
6262
get_wf_lcao.cpp
6363
read_wfc_nao.cpp
64-
read_wfc_lcao.cpp
6564
write_wfc_nao.cpp
6665
write_dmk.cpp
6766
write_dmr.cpp

source/source_io/ctrl_output_pw.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void ModuleIO::ctrl_scf_pw(const int istep,
9090
const ModulePW::PW_Basis *pw_rho,
9191
const ModulePW::PW_Basis *pw_rhod,
9292
const ModulePW::PW_Basis_Big *pw_big,
93-
Setup_Psi<T, Device> &stp,
93+
Setup_Psi_pw<T, Device> &stp,
9494
const Device* ctx,
9595
const base_device::AbacusDevice_t &device,
9696
const Parallel_Grid &para_grid,
@@ -252,7 +252,7 @@ void ModuleIO::ctrl_runner_pw(UnitCell& ucell,
252252
ModulePW::PW_Basis* pw_rhod,
253253
Charge &chr,
254254
K_Vectors &kv,
255-
Setup_Psi<T, Device> &stp,
255+
Setup_Psi_pw<T, Device> &stp,
256256
Structure_Factor &sf,
257257
pseudopot_cell_vnl &ppcell,
258258
surchem &solvent,
@@ -384,7 +384,7 @@ template void ModuleIO::ctrl_scf_pw<std::complex<float>, base_device::DEVICE_CPU
384384
const ModulePW::PW_Basis *pw_rho,
385385
const ModulePW::PW_Basis *pw_rhod,
386386
const ModulePW::PW_Basis_Big *pw_big,
387-
Setup_Psi<std::complex<float>, base_device::DEVICE_CPU> &stp,
387+
Setup_Psi_pw<std::complex<float>, base_device::DEVICE_CPU> &stp,
388388
const base_device::DEVICE_CPU* ctx,
389389
const base_device::AbacusDevice_t &device,
390390
const Parallel_Grid &para_grid,
@@ -401,7 +401,7 @@ template void ModuleIO::ctrl_scf_pw<std::complex<double>, base_device::DEVICE_CP
401401
const ModulePW::PW_Basis *pw_rho,
402402
const ModulePW::PW_Basis *pw_rhod,
403403
const ModulePW::PW_Basis_Big *pw_big,
404-
Setup_Psi<std::complex<double>, base_device::DEVICE_CPU> &stp,
404+
Setup_Psi_pw<std::complex<double>, base_device::DEVICE_CPU> &stp,
405405
const base_device::DEVICE_CPU* ctx,
406406
const base_device::AbacusDevice_t &device,
407407
const Parallel_Grid &para_grid,
@@ -419,7 +419,7 @@ template void ModuleIO::ctrl_scf_pw<std::complex<float>, base_device::DEVICE_GPU
419419
const ModulePW::PW_Basis *pw_rho,
420420
const ModulePW::PW_Basis *pw_rhod,
421421
const ModulePW::PW_Basis_Big *pw_big,
422-
Setup_Psi<std::complex<float>, base_device::DEVICE_GPU> &stp,
422+
Setup_Psi_pw<std::complex<float>, base_device::DEVICE_GPU> &stp,
423423
const base_device::DEVICE_GPU* ctx,
424424
const base_device::AbacusDevice_t &device,
425425
const Parallel_Grid &para_grid,
@@ -436,7 +436,7 @@ template void ModuleIO::ctrl_scf_pw<std::complex<double>, base_device::DEVICE_GP
436436
const ModulePW::PW_Basis *pw_rho,
437437
const ModulePW::PW_Basis *pw_rhod,
438438
const ModulePW::PW_Basis_Big *pw_big,
439-
Setup_Psi<std::complex<double>, base_device::DEVICE_GPU> &stp,
439+
Setup_Psi_pw<std::complex<double>, base_device::DEVICE_GPU> &stp,
440440
const base_device::DEVICE_GPU* ctx,
441441
const base_device::AbacusDevice_t &device,
442442
const Parallel_Grid &para_grid,
@@ -452,7 +452,7 @@ template void ModuleIO::ctrl_runner_pw<std::complex<float>, base_device::DEVICE_
452452
ModulePW::PW_Basis* pw_rhod,
453453
Charge &chr,
454454
K_Vectors &kv,
455-
Setup_Psi<std::complex<float>, base_device::DEVICE_CPU> &stp,
455+
Setup_Psi_pw<std::complex<float>, base_device::DEVICE_CPU> &stp,
456456
Structure_Factor &sf,
457457
pseudopot_cell_vnl &ppcell,
458458
surchem &solvent,
@@ -469,7 +469,7 @@ template void ModuleIO::ctrl_runner_pw<std::complex<double>, base_device::DEVICE
469469
ModulePW::PW_Basis* pw_rhod,
470470
Charge &chr,
471471
K_Vectors &kv,
472-
Setup_Psi<std::complex<double>, base_device::DEVICE_CPU> &stp,
472+
Setup_Psi_pw<std::complex<double>, base_device::DEVICE_CPU> &stp,
473473
Structure_Factor &sf,
474474
pseudopot_cell_vnl &ppcell,
475475
surchem &solvent,
@@ -487,7 +487,7 @@ template void ModuleIO::ctrl_runner_pw<std::complex<float>, base_device::DEVICE_
487487
ModulePW::PW_Basis* pw_rhod,
488488
Charge &chr,
489489
K_Vectors &kv,
490-
Setup_Psi<std::complex<float>, base_device::DEVICE_GPU> &stp,
490+
Setup_Psi_pw<std::complex<float>, base_device::DEVICE_GPU> &stp,
491491
Structure_Factor &sf,
492492
pseudopot_cell_vnl &ppcell,
493493
surchem &solvent,
@@ -504,7 +504,7 @@ template void ModuleIO::ctrl_runner_pw<std::complex<double>, base_device::DEVICE
504504
ModulePW::PW_Basis* pw_rhod,
505505
Charge &chr,
506506
K_Vectors &kv,
507-
Setup_Psi<std::complex<double>, base_device::DEVICE_GPU> &stp,
507+
Setup_Psi_pw<std::complex<double>, base_device::DEVICE_GPU> &stp,
508508
Structure_Factor &sf,
509509
pseudopot_cell_vnl &ppcell,
510510
surchem &solvent,

source/source_io/ctrl_output_pw.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "source_base/module_device/device.h" // use Device
55
#include "source_psi/psi.h" // define psi
66
#include "source_estate/elecstate_lcao.h" // use pelec
7-
#include "source_psi/setup_psi.h" // use Setup_Psi class
7+
#include "source_psi/setup_psi_pw.h" // use Setup_Psi class
88

99
namespace ModuleIO
1010
{
@@ -29,7 +29,7 @@ void ctrl_scf_pw(const int istep,
2929
const ModulePW::PW_Basis *pw_rho,
3030
const ModulePW::PW_Basis *pw_rhod,
3131
const ModulePW::PW_Basis_Big *pw_big,
32-
Setup_Psi<T, Device> &stp,
32+
Setup_Psi_pw<T, Device> &stp,
3333
const Device* ctx,
3434
const base_device::AbacusDevice_t &device, // mohan add 2025-10-15
3535
const Parallel_Grid &para_grid,
@@ -44,7 +44,7 @@ void ctrl_runner_pw(UnitCell& ucell,
4444
ModulePW::PW_Basis* pw_rhod,
4545
Charge &chr,
4646
K_Vectors &kv,
47-
Setup_Psi<T, Device> &stp,
47+
Setup_Psi_pw<T, Device> &stp,
4848
Structure_Factor &sf,
4949
pseudopot_cell_vnl &ppcell,
5050
surchem &solvent,

0 commit comments

Comments
 (0)