|
11 | 11 | #include "source_estate/module_charge/symmetry_rho.h" |
12 | 12 | #include "source_hamilt/module_ewald/H_Ewald_pw.h" |
13 | 13 | #include "source_hamilt/module_vdw/vdw.h" |
14 | | -#include "source_lcao/module_deltaspin/spin_constrain.h" |
15 | | -#include "source_lcao/module_dftu/dftu.h" |
16 | | -#include "source_pw/module_pwdft/elecond.h" |
17 | | -#include "source_pw/module_pwdft/forces.h" |
18 | | -#include "source_pw/module_pwdft/hamilt_pw.h" |
19 | | -#include "source_pw/module_pwdft/onsite_projector.h" |
20 | | -#include "source_pw/module_pwdft/stress_pw.h" |
21 | 14 | #include "source_hsolver/diago_iter_assist.h" |
22 | 15 | #include "source_hsolver/hsolver_pw.h" |
23 | 16 | #include "source_hsolver/kernels/dngvd_op.h" |
24 | 17 | #include "source_io/berryphase.h" |
25 | 18 | #include "source_io/cal_ldos.h" |
26 | 19 | #include "source_io/get_pchg_pw.h" |
27 | 20 | #include "source_io/get_wf_pw.h" |
| 21 | +#include "source_io/module_parameter/parameter.h" |
28 | 22 | #include "source_io/numerical_basis.h" |
29 | 23 | #include "source_io/numerical_descriptor.h" |
30 | 24 | #include "source_io/to_wannier90_pw.h" |
31 | 25 | #include "source_io/winput.h" |
32 | 26 | #include "source_io/write_dos_pw.h" |
33 | 27 | #include "source_io/write_wfc_pw.h" |
34 | | -#include "source_io/module_parameter/parameter.h" |
| 28 | +#include "source_lcao/module_deltaspin/spin_constrain.h" |
| 29 | +#include "source_lcao/module_dftu/dftu.h" |
| 30 | +#include "source_pw/module_pwdft/elecond.h" |
| 31 | +#include "source_pw/module_pwdft/forces.h" |
| 32 | +#include "source_pw/module_pwdft/hamilt_pw.h" |
| 33 | +#include "source_pw/module_pwdft/onsite_projector.h" |
| 34 | +#include "source_pw/module_pwdft/stress_pw.h" |
35 | 35 |
|
36 | 36 | #include <iostream> |
37 | 37 |
|
@@ -717,16 +717,25 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep, const |
717 | 717 | //------------------------------------------------------------------ |
718 | 718 | // 4) calculate band-decomposed (partial) charge density in pw basis |
719 | 719 | //------------------------------------------------------------------ |
720 | | - const std::vector<int> out_pchg = PARAM.inp.out_pchg; |
721 | | - if (out_pchg.size() > 0) |
| 720 | + if (PARAM.inp.out_pchg.size() > 0) |
722 | 721 | { |
723 | | - ModuleIO::get_pchg_pw(out_pchg, |
| 722 | + if (this->__kspw_psi != nullptr && PARAM.inp.precision == "single") |
| 723 | + { |
| 724 | + delete reinterpret_cast<psi::Psi<std::complex<double>, Device>*>(this->__kspw_psi); |
| 725 | + } |
| 726 | + |
| 727 | + // Refresh __kspw_psi |
| 728 | + this->__kspw_psi = PARAM.inp.precision == "single" |
| 729 | + ? new psi::Psi<std::complex<double>, Device>(this->kspw_psi[0]) |
| 730 | + : reinterpret_cast<psi::Psi<std::complex<double>, Device>*>(this->kspw_psi); |
| 731 | + |
| 732 | + ModuleIO::get_pchg_pw(PARAM.inp.out_pchg, |
724 | 733 | this->kspw_psi->get_nbands(), |
725 | 734 | PARAM.inp.nspin, |
726 | 735 | this->pw_rhod->nxyz, |
727 | 736 | this->chr.ngmc, |
728 | 737 | &ucell, |
729 | | - this->psi, |
| 738 | + this->__kspw_psi, |
730 | 739 | this->pw_rhod, |
731 | 740 | this->pw_wfc, |
732 | 741 | this->ctx, |
@@ -943,20 +952,25 @@ void ESolver_KS_PW<T, Device>::after_all_runners(UnitCell& ucell) |
943 | 952 | //---------------------------------------------------------- |
944 | 953 | //! 5) Print out electronic wave functions in real space |
945 | 954 | //---------------------------------------------------------- |
946 | | - const std::vector<int> out_wfc_norm = PARAM.inp.out_wfc_norm; |
947 | | - const std::vector<int> out_wfc_re_im = PARAM.inp.out_wfc_re_im; |
948 | | - if (out_wfc_norm.size() > 0 || out_wfc_re_im.size() > 0) |
| 955 | + if (PARAM.inp.out_wfc_norm.size() > 0 || PARAM.inp.out_wfc_re_im.size() > 0) |
949 | 956 | { |
950 | | - ModuleIO::get_wf_pw(out_wfc_norm, |
951 | | - out_wfc_re_im, |
| 957 | + if (this->__kspw_psi != nullptr && PARAM.inp.precision == "single") |
| 958 | + { |
| 959 | + delete reinterpret_cast<psi::Psi<std::complex<double>, Device>*>(this->__kspw_psi); |
| 960 | + } |
| 961 | + |
| 962 | + // Refresh __kspw_psi |
| 963 | + this->__kspw_psi = PARAM.inp.precision == "single" |
| 964 | + ? new psi::Psi<std::complex<double>, Device>(this->kspw_psi[0]) |
| 965 | + : reinterpret_cast<psi::Psi<std::complex<double>, Device>*>(this->kspw_psi); |
| 966 | + |
| 967 | + ModuleIO::get_wf_pw(PARAM.inp.out_wfc_norm, |
| 968 | + PARAM.inp.out_wfc_re_im, |
952 | 969 | this->kspw_psi->get_nbands(), |
953 | 970 | PARAM.inp.nspin, |
954 | | - this->pw_rhod->nx, |
955 | | - this->pw_rhod->ny, |
956 | | - this->pw_rhod->nz, |
957 | 971 | this->pw_rhod->nxyz, |
958 | 972 | &ucell, |
959 | | - this->psi, |
| 973 | + this->__kspw_psi, |
960 | 974 | this->pw_wfc, |
961 | 975 | this->ctx, |
962 | 976 | this->Pgrid, |
@@ -991,29 +1005,29 @@ void ESolver_KS_PW<T, Device>::after_all_runners(UnitCell& ucell) |
991 | 1005 |
|
992 | 1006 | ModuleIO::Write_MLKEDF_Descriptors write_mlkedf_desc; |
993 | 1007 | write_mlkedf_desc.cal_tool->set_para(this->chr.nrxx, |
994 | | - PARAM.inp.nelec, |
995 | | - PARAM.inp.of_tf_weight, |
996 | | - PARAM.inp.of_vw_weight, |
997 | | - PARAM.inp.of_ml_chi_p, |
998 | | - PARAM.inp.of_ml_chi_q, |
999 | | - PARAM.inp.of_ml_chi_xi, |
1000 | | - PARAM.inp.of_ml_chi_pnl, |
1001 | | - PARAM.inp.of_ml_chi_qnl, |
1002 | | - PARAM.inp.of_ml_nkernel, |
1003 | | - PARAM.inp.of_ml_kernel, |
1004 | | - PARAM.inp.of_ml_kernel_scaling, |
1005 | | - PARAM.inp.of_ml_yukawa_alpha, |
1006 | | - PARAM.inp.of_ml_kernel_file, |
1007 | | - ucell.omega, |
1008 | | - this->pw_rho); |
| 1008 | + PARAM.inp.nelec, |
| 1009 | + PARAM.inp.of_tf_weight, |
| 1010 | + PARAM.inp.of_vw_weight, |
| 1011 | + PARAM.inp.of_ml_chi_p, |
| 1012 | + PARAM.inp.of_ml_chi_q, |
| 1013 | + PARAM.inp.of_ml_chi_xi, |
| 1014 | + PARAM.inp.of_ml_chi_pnl, |
| 1015 | + PARAM.inp.of_ml_chi_qnl, |
| 1016 | + PARAM.inp.of_ml_nkernel, |
| 1017 | + PARAM.inp.of_ml_kernel, |
| 1018 | + PARAM.inp.of_ml_kernel_scaling, |
| 1019 | + PARAM.inp.of_ml_yukawa_alpha, |
| 1020 | + PARAM.inp.of_ml_kernel_file, |
| 1021 | + ucell.omega, |
| 1022 | + this->pw_rho); |
1009 | 1023 |
|
1010 | 1024 | write_mlkedf_desc.generateTrainData_KS(PARAM.globalv.global_mlkedf_descriptor_dir, |
1011 | | - this->kspw_psi, |
1012 | | - this->pelec, |
1013 | | - this->pw_wfc, |
1014 | | - this->pw_rho, |
1015 | | - ucell, |
1016 | | - this->pelec->pot->get_effective_v(0)); |
| 1025 | + this->kspw_psi, |
| 1026 | + this->pelec, |
| 1027 | + this->pw_wfc, |
| 1028 | + this->pw_rho, |
| 1029 | + ucell, |
| 1030 | + this->pelec->pot->get_effective_v(0)); |
1017 | 1031 | } |
1018 | 1032 | #endif |
1019 | 1033 | } |
|
0 commit comments