From 0ef2cc2a36fccd7c1cb903c20e31efdd101a56b3 Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Wed, 9 Jul 2025 11:52:55 +0800 Subject: [PATCH 01/16] hybrid gague --- source/Makefile.Objects | 6 +- source/module_lr/lr_spectrum.h | 6 +- source/module_lr/lr_spectrum_velocity.cpp | 14 +- source/source_base/global_file.cpp | 40 ++ source/source_base/global_file.h | 1 + .../module_mixing/test/mixing_test.cpp | 0 source/source_base/test/global_file_test.cpp | 6 +- .../test_parallel/parallel_2d_test.sh | 0 .../test_parallel/parallel_common_test.sh | 0 .../test_parallel/parallel_global_test.sh | 0 .../test_parallel/parallel_reduce_test.sh | 0 .../source_basis/module_ao/ORB_nonlocal_lm.h | 3 + .../module_ao/test/parallel_orbitals_test.sh | 0 .../module_nao/test/I_sphbes_coeff.txt | 0 .../source_basis/module_pw/test/test_gnu.sh | 0 .../source_basis/module_pw/test/test_intel.sh | 0 .../test/bcast_atom_pseudo_test.sh | 0 .../source_cell/test/bcast_atom_spec_test.sh | 0 source/source_cell/test/klist_test_para.sh | 0 .../source_cell/test/parallel_kpoints_test.sh | 0 .../test/unitcell_test_parallel.sh | 0 .../test_pw/unitcell_test_pw_para.sh | 0 source/source_esolver/esolver.cpp | 21 +- source/source_esolver/esolver_ks.cpp | 5 +- source/source_esolver/esolver_ks_lcao.cpp | 2 +- .../source_esolver/esolver_ks_lcao_tddft.cpp | 439 +++++++++++++----- source/source_esolver/esolver_ks_lcao_tddft.h | 23 +- .../module_dm/density_matrix.cpp | 174 ++++++- .../source_estate/module_dm/density_matrix.h | 9 +- .../source_estate/module_pot/H_TDDFT_pw.cpp | 33 +- source/source_estate/module_pot/H_TDDFT_pw.h | 5 +- source/source_hamilt/operator.h | 2 +- .../source_hsolver/test/parallel_k2d_test.sh | 0 source/source_io/cal_r_overlap_R.cpp | 368 +++++++++++++++ source/source_io/cal_r_overlap_R.h | 36 ++ source/source_io/input_conv.cpp | 68 ++- .../module_parameter/input_parameter.h | 3 +- .../module_parameter/system_parameter.h | 1 + source/source_io/output_log.cpp | 11 + source/source_io/output_log.h | 7 + source/source_io/read_input.cpp | 8 +- source/source_io/read_input_item_md.cpp | 11 +- source/source_io/read_input_item_system.cpp | 4 + source/source_io/read_input_item_tddft.cpp | 27 +- source/source_io/read_set_globalv.cpp | 14 +- source/source_io/read_wfc_nao.cpp | 14 +- source/source_io/read_wfc_nao.h | 1 + source/source_io/td_current_io.cpp | 421 ++++++++++++++--- source/source_io/td_current_io.h | 45 +- source/source_io/write_HS_sparse.cpp | 12 +- source/source_io/write_wfc_nao.cpp | 11 +- source/source_lcao/CMakeLists.txt | 1 + source/source_lcao/hamilt_lcao.cpp | 28 +- .../module_operator_lcao/CMakeLists.txt | 1 + .../module_operator_lcao/operator_lcao.cpp | 39 +- .../module_operator_lcao/overlap_new.cpp | 44 +- .../module_operator_lcao/td_ekinetic_lcao.cpp | 66 +-- .../module_operator_lcao/td_ekinetic_lcao.h | 8 +- .../module_operator_lcao/td_nonlocal_lcao.cpp | 51 +- .../module_operator_lcao/td_nonlocal_lcao.h | 4 +- .../module_operator_lcao/td_pot_hybrid.cpp | 300 ++++++++++++ .../module_operator_lcao/td_pot_hybrid.h | 129 +++++ source/source_lcao/module_rt/CMakeLists.txt | 5 +- source/source_lcao/module_rt/evolve_elec.h | 3 +- source/source_lcao/module_rt/evolve_psi.cpp | 4 +- .../module_rt/solve_propagation.cpp | 7 +- source/source_lcao/module_rt/td_folding.cpp | 52 +++ .../{td_velocity.cpp => td_info.cpp} | 95 ++-- .../module_rt/{td_velocity.h => td_info.h} | 52 ++- .../{td_current.cpp => velocity_op.cpp} | 240 +++++----- .../module_rt/{td_current.h => velocity_op.h} | 26 +- source/source_lcao/spar_hsr.cpp | 12 +- tests/05_rtTDDFT/01_NO_KP_ocp_TDDFT/INPUT | 3 +- .../05_rtTDDFT/01_NO_KP_ocp_TDDFT/result.ref | 8 +- tests/05_rtTDDFT/02_NO_CH_OW_TDDFT/INPUT | 1 + tests/05_rtTDDFT/02_NO_CH_OW_TDDFT/result.ref | 8 +- .../wfs1k1g3_nao_mod.txt.ref | 160 +++---- tests/05_rtTDDFT/03_NO_CO_TDDFT/INPUT | 1 + tests/05_rtTDDFT/03_NO_CO_TDDFT/result.ref | 8 +- tests/05_rtTDDFT/04_NO_CO_ocp_TDDFT/INPUT | 1 + .../05_rtTDDFT/04_NO_CO_ocp_TDDFT/result.ref | 8 +- tests/05_rtTDDFT/05_NO_cur_TDDFT/INPUT | 1 + .../05_NO_cur_TDDFT/refcurrent_total.dat | 6 +- tests/05_rtTDDFT/05_NO_cur_TDDFT/result.ref | 8 +- tests/05_rtTDDFT/06_NO_dir_TDDFT/INPUT | 1 + tests/05_rtTDDFT/06_NO_dir_TDDFT/KPT | 0 tests/05_rtTDDFT/06_NO_dir_TDDFT/STRU | 0 tests/05_rtTDDFT/06_NO_dir_TDDFT/result.ref | 8 +- tests/05_rtTDDFT/07_NO_EDM_TDDFT/INPUT | 1 + tests/05_rtTDDFT/07_NO_EDM_TDDFT/result.ref | 8 +- tests/05_rtTDDFT/08_NO_ETRS_TDDFT/INPUT | 1 + tests/05_rtTDDFT/08_NO_ETRS_TDDFT/result.ref | 8 +- tests/05_rtTDDFT/09_NO_HEAV_TDDFT/INPUT | 1 + tests/05_rtTDDFT/09_NO_HEAV_TDDFT/result.ref | 8 +- tests/05_rtTDDFT/10_NO_HHG_TDDFT/INPUT | 1 + tests/05_rtTDDFT/10_NO_HHG_TDDFT/KPT | 0 tests/05_rtTDDFT/10_NO_HHG_TDDFT/STRU | 0 tests/05_rtTDDFT/10_NO_HHG_TDDFT/result.ref | 8 +- tests/05_rtTDDFT/11_NO_O3_TDDFT/INPUT | 1 + tests/05_rtTDDFT/11_NO_O3_TDDFT/result.ref | 8 +- tests/05_rtTDDFT/12_NO_re_TDDFT/INPUT | 1 + tests/05_rtTDDFT/13_NO_Taylor_TDDFT/INPUT | 1 + .../05_rtTDDFT/13_NO_Taylor_TDDFT/result.ref | 8 +- tests/05_rtTDDFT/14_NO_TRAP_TDDFT/INPUT | 1 + tests/05_rtTDDFT/14_NO_TRAP_TDDFT/KPT | 0 tests/05_rtTDDFT/14_NO_TRAP_TDDFT/STRU | 0 tests/05_rtTDDFT/14_NO_TRAP_TDDFT/result.ref | 8 +- tests/05_rtTDDFT/15_NO_TRI_TDDFT/INPUT | 1 + tests/05_rtTDDFT/15_NO_TRI_TDDFT/KPT | 0 tests/05_rtTDDFT/15_NO_TRI_TDDFT/STRU | 0 tests/05_rtTDDFT/15_NO_TRI_TDDFT/result.ref | 8 +- tests/05_rtTDDFT/16_NO_vel_TDDFT/INPUT | 1 + .../16_NO_vel_TDDFT/refcurrent_total.dat | 6 +- tests/05_rtTDDFT/16_NO_vel_TDDFT/result.ref | 8 +- tests/05_rtTDDFT/17_NO_vel_TDDFT/INPUT | 1 + tests/05_rtTDDFT/17_NO_vel_TDDFT/result.ref | 4 +- tests/05_rtTDDFT/Autotest.sh | 329 +++++++++++++ tests/05_rtTDDFT/test.sum | 16 + tests/rttest.zip | Bin 0 -> 49456 bytes 119 files changed, 2944 insertions(+), 734 deletions(-) mode change 100755 => 100644 source/source_base/module_mixing/test/mixing_test.cpp mode change 100755 => 100644 source/source_base/test_parallel/parallel_2d_test.sh mode change 100755 => 100644 source/source_base/test_parallel/parallel_common_test.sh mode change 100755 => 100644 source/source_base/test_parallel/parallel_global_test.sh mode change 100755 => 100644 source/source_base/test_parallel/parallel_reduce_test.sh mode change 100755 => 100644 source/source_basis/module_ao/test/parallel_orbitals_test.sh mode change 100755 => 100644 source/source_basis/module_nao/test/I_sphbes_coeff.txt mode change 100755 => 100644 source/source_basis/module_pw/test/test_gnu.sh mode change 100755 => 100644 source/source_basis/module_pw/test/test_intel.sh mode change 100755 => 100644 source/source_cell/test/bcast_atom_pseudo_test.sh mode change 100755 => 100644 source/source_cell/test/bcast_atom_spec_test.sh mode change 100755 => 100644 source/source_cell/test/klist_test_para.sh mode change 100755 => 100644 source/source_cell/test/parallel_kpoints_test.sh mode change 100755 => 100644 source/source_cell/test/unitcell_test_parallel.sh mode change 100755 => 100644 source/source_cell/test_pw/unitcell_test_pw_para.sh mode change 100755 => 100644 source/source_hsolver/test/parallel_k2d_test.sh create mode 100644 source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp create mode 100644 source/source_lcao/module_operator_lcao/td_pot_hybrid.h create mode 100644 source/source_lcao/module_rt/td_folding.cpp rename source/source_lcao/module_rt/{td_velocity.cpp => td_info.cpp} (62%) rename source/source_lcao/module_rt/{td_velocity.h => td_info.h} (64%) rename source/source_lcao/module_rt/{td_current.cpp => velocity_op.cpp} (73%) rename source/source_lcao/module_rt/{td_current.h => velocity_op.h} (85%) mode change 100755 => 100644 tests/05_rtTDDFT/06_NO_dir_TDDFT/INPUT mode change 100755 => 100644 tests/05_rtTDDFT/06_NO_dir_TDDFT/KPT mode change 100755 => 100644 tests/05_rtTDDFT/06_NO_dir_TDDFT/STRU mode change 100755 => 100644 tests/05_rtTDDFT/10_NO_HHG_TDDFT/INPUT mode change 100755 => 100644 tests/05_rtTDDFT/10_NO_HHG_TDDFT/KPT mode change 100755 => 100644 tests/05_rtTDDFT/10_NO_HHG_TDDFT/STRU mode change 100755 => 100644 tests/05_rtTDDFT/14_NO_TRAP_TDDFT/INPUT mode change 100755 => 100644 tests/05_rtTDDFT/14_NO_TRAP_TDDFT/KPT mode change 100755 => 100644 tests/05_rtTDDFT/14_NO_TRAP_TDDFT/STRU mode change 100755 => 100644 tests/05_rtTDDFT/15_NO_TRI_TDDFT/INPUT mode change 100755 => 100644 tests/05_rtTDDFT/15_NO_TRI_TDDFT/KPT mode change 100755 => 100644 tests/05_rtTDDFT/15_NO_TRI_TDDFT/STRU create mode 100644 tests/05_rtTDDFT/Autotest.sh create mode 100644 tests/05_rtTDDFT/test.sum create mode 100644 tests/rttest.zip diff --git a/source/Makefile.Objects b/source/Makefile.Objects index d2f9999283..baf40df2e3 100644 --- a/source/Makefile.Objects +++ b/source/Makefile.Objects @@ -356,6 +356,7 @@ OBJS_HAMILT_LCAO=hamilt_lcao.o\ overlap_new.o\ td_ekinetic_lcao.o\ td_nonlocal_lcao.o\ + td_pot_hybrid.o\ veff_lcao.o\ meta_lcao.o\ op_dftu_lcao.o\ @@ -624,8 +625,9 @@ OBJS_LCAO=evolve_elec.o\ propagator_cn2.o\ propagator_taylor.o\ propagator_etrs.o\ - td_velocity.o\ - td_current.o\ + td_folding.o\ + td_info.o\ + velocity_op.o\ snap_psibeta_half_tddft.o\ solve_propagation.o\ upsi.o\ diff --git a/source/module_lr/lr_spectrum.h b/source/module_lr/lr_spectrum.h index b30bf9fdfa..54e158d46d 100644 --- a/source/module_lr/lr_spectrum.h +++ b/source/module_lr/lr_spectrum.h @@ -5,7 +5,7 @@ #include "source_estate/module_dm/density_matrix.h" #include "module_lr/utils/lr_util.h" #include "source_basis/module_nao/two_center_bundle.h" -#include "source_lcao/module_rt/td_current.h" +#include "source_lcao/module_rt/velocity_op.h" namespace LR { template @@ -52,8 +52,8 @@ namespace LR /// calculate the transition dipole of all states in length gauge void cal_transition_dipoles_length(); /// calculate the transition dipole of state S in velocity gauge: $i(\sum_{iak}X^S_{iak})/\Omega_S$ - ModuleBase::Vector3 cal_transition_dipole_istate_velocity_R(const int istate, const TD_current& vR); - ModuleBase::Vector3 cal_transition_dipole_istate_velocity_k(const int istate, const TD_current& vR); + ModuleBase::Vector3 cal_transition_dipole_istate_velocity_R(const int istate, const Velocity_op>& vR); + ModuleBase::Vector3 cal_transition_dipole_istate_velocity_k(const int istate, const Velocity_op>& vR); /// calculate the transition dipole of all states in velocity gauge void cal_transition_dipoles_velocity(); double cal_mean_squared_dipole(ModuleBase::Vector3 dipole); diff --git a/source/module_lr/lr_spectrum_velocity.cpp b/source/module_lr/lr_spectrum_velocity.cpp index 3625fb3117..fb63a79836 100644 --- a/source/module_lr/lr_spectrum_velocity.cpp +++ b/source/module_lr/lr_spectrum_velocity.cpp @@ -7,17 +7,17 @@ namespace LR { /// get the velocity matrix v(R) - inline TD_current get_velocity_matrix_R(const UnitCell& ucell, + inline Velocity_op> get_velocity_matrix_R(const UnitCell& ucell, const Grid_Driver& gd, const Parallel_Orbitals& pmat, const TwoCenterBundle& two_center_bundle) { - // convert the orbital object to the old class for TD_current + // convert the orbital object to the old class for Velocity_op LCAO_Orbitals orb; const auto& inp = PARAM.inp; two_center_bundle.to_LCAO_Orbitals(orb, inp.lcao_ecut, inp.lcao_dk, inp.lcao_dr, inp.lcao_rmax); // actually this class calculates the velocity matrix v(R) at A=0 - TD_current vR(&ucell, &gd, &pmat, orb, two_center_bundle.overlap_orb.get()); + Velocity_op> vR(&ucell, &gd, &pmat, orb, two_center_bundle.overlap_orb.get()); vR.calculate_vcomm_r(); // $<\mu, 0|[Vnl, r]|\nu, R>$ vR.calculate_grad_term(); // $<\mu, 0|\nabla|\nu, R>$ return vR; @@ -47,7 +47,7 @@ namespace LR /// this algorithm has bug in multi-k cases, just for test template - ModuleBase::Vector3 LR::LR_Spectrum::cal_transition_dipole_istate_velocity_R(const int istate, const TD_current& vR) + ModuleBase::Vector3 LR::LR_Spectrum::cal_transition_dipole_istate_velocity_R(const int istate, const Velocity_op>& vR) { // transition density matrix D(R) const elecstate::DensityMatrix& DM_trans = this->cal_transition_density_matrix(istate); @@ -69,7 +69,7 @@ namespace LR // this algorithm is actually in use template - ModuleBase::Vector3 LR::LR_Spectrum::cal_transition_dipole_istate_velocity_k(const int istate, const TD_current& vR) + ModuleBase::Vector3 LR::LR_Spectrum::cal_transition_dipole_istate_velocity_k(const int istate, const Velocity_op>& vR) { // transition density matrix D(R) const elecstate::DensityMatrix& DM_trans = this->cal_transition_density_matrix(istate, this->X, false); @@ -97,7 +97,7 @@ namespace LR template void LR::LR_Spectrum::cal_transition_dipoles_velocity() { - const TD_current& vR = get_velocity_matrix_R(ucell, gd_, pmat, two_center_bundle_); // velocity matrix v(R) + const Velocity_op>& vR = get_velocity_matrix_R(ucell, gd_, pmat, two_center_bundle_); // velocity matrix v(R) transition_dipole_.resize(nstate); this->mean_squared_transition_dipole_.resize(nstate); for (int istate = 0;istate < nstate;++istate) @@ -148,7 +148,7 @@ namespace LR void LR::LR_Spectrum::test_transition_dipoles_velocity_ks(const double* const ks_eig) { // velocity matrix v(R) - const TD_current& vR = get_velocity_matrix_R(ucell, gd_, pmat, two_center_bundle_); + const Velocity_op>& vR = get_velocity_matrix_R(ucell, gd_, pmat, two_center_bundle_); // (e_c-e_v) of KS eigenvalues std::vector eig_ks_diff(this->ldim); for (int is = 0;is < this->nspin_x;++is) diff --git a/source/source_base/global_file.cpp b/source/source_base/global_file.cpp index a7dd287300..cd6c424fc7 100644 --- a/source/source_base/global_file.cpp +++ b/source/source_base/global_file.cpp @@ -25,6 +25,7 @@ void ModuleBase::Global_File::make_dir_out( const std::string &suffix, const std::string &calculation, const bool &out_dir, + const bool &out_wfc_dir, const int rank, const bool &restart, const bool out_alllog) @@ -153,6 +154,45 @@ void ModuleBase::Global_File::make_dir_out( #endif } + if(out_wfc_dir) + { + int make_dir_wfc = 0; + std::string command1 = "test -d " + PARAM.globalv.global_wfc_dir + " || mkdir " + PARAM.globalv.global_wfc_dir; + + times = 0; + while(times0) { break; +} + ++times; + } + +#ifdef __MPI + if(make_dir_wfc==0) + { + std::cout << " CAN NOT MAKE THE WFC DIR......." << std::endl; + ModuleBase::QUIT(); + } + MPI_Barrier(MPI_COMM_WORLD); +#endif + } + if(PARAM.inp.of_ml_gene_data == 1) { int make_dir_descrip = 0; diff --git a/source/source_base/global_file.h b/source/source_base/global_file.h index 9b6895388c..06809f9611 100644 --- a/source/source_base/global_file.h +++ b/source/source_base/global_file.h @@ -23,6 +23,7 @@ namespace Global_File void make_dir_out(const std::string &suffix, const std::string &calculation, const bool &out_dir, + const bool &out_wfc_dir, const int rank, const bool &restart, const bool out_alllog = false); diff --git a/source/source_base/module_mixing/test/mixing_test.cpp b/source/source_base/module_mixing/test/mixing_test.cpp old mode 100755 new mode 100644 diff --git a/source/source_base/test/global_file_test.cpp b/source/source_base/test/global_file_test.cpp index f44a938e84..55b006fac4 100644 --- a/source/source_base/test/global_file_test.cpp +++ b/source/source_base/test/global_file_test.cpp @@ -33,7 +33,7 @@ TEST_F(GlobalFile,mkdirout) { std::string output; testing::internal::CaptureStdout(); - ModuleBase::Global_File::make_dir_out("Si","m",false,0,true,true); + ModuleBase::Global_File::make_dir_out("Si","m",false,false,0,true,true); output = testing::internal::GetCapturedStdout(); EXPECT_THAT(output,testing::HasSubstr("MAKE THE DIR")); GlobalV::ofs_warning.close(); @@ -43,7 +43,7 @@ TEST_F(GlobalFile,mkdirout) remove(dd.c_str()); testing::internal::CaptureStdout(); - ModuleBase::Global_File::make_dir_out("Si","md",false,0,true,false); + ModuleBase::Global_File::make_dir_out("Si","md",false,false,0,true,false); output = testing::internal::GetCapturedStdout(); EXPECT_THAT(output,testing::HasSubstr("MAKE THE STRU DIR")); EXPECT_TRUE(GlobalV::ofs_running.is_open()); @@ -53,7 +53,7 @@ TEST_F(GlobalFile,mkdirout) remove(bb.c_str()); testing::internal::CaptureStdout(); - ModuleBase::Global_File::make_dir_out("Si","md",true,0,true,true); + ModuleBase::Global_File::make_dir_out("Si","md",true,false,0,true,true); output = testing::internal::GetCapturedStdout(); EXPECT_THAT(output,testing::HasSubstr("MAKE THE MATRIX DIR")); EXPECT_TRUE(GlobalV::ofs_running.is_open()); diff --git a/source/source_base/test_parallel/parallel_2d_test.sh b/source/source_base/test_parallel/parallel_2d_test.sh old mode 100755 new mode 100644 diff --git a/source/source_base/test_parallel/parallel_common_test.sh b/source/source_base/test_parallel/parallel_common_test.sh old mode 100755 new mode 100644 diff --git a/source/source_base/test_parallel/parallel_global_test.sh b/source/source_base/test_parallel/parallel_global_test.sh old mode 100755 new mode 100644 diff --git a/source/source_base/test_parallel/parallel_reduce_test.sh b/source/source_base/test_parallel/parallel_reduce_test.sh old mode 100755 new mode 100644 diff --git a/source/source_basis/module_ao/ORB_nonlocal_lm.h b/source/source_basis/module_ao/ORB_nonlocal_lm.h index 31ed209f14..b3504065ae 100644 --- a/source/source_basis/module_ao/ORB_nonlocal_lm.h +++ b/source/source_basis/module_ao/ORB_nonlocal_lm.h @@ -45,6 +45,9 @@ class Numerical_Nonlocal_Lm const double& getKpoint(const int &ik) const { return this->k_radial[ik]; } const double* getBeta_k() const { return this->beta_k; } const double& getBeta_k(const int &ik) const { return this->beta_k[ik]; } + + const int& getNk() const { return nk; } + const double& getDruniform() const { return dr_uniform; } // enables deep copy Numerical_Nonlocal_Lm& operator= (const Numerical_Nonlocal_Lm& nol ); diff --git a/source/source_basis/module_ao/test/parallel_orbitals_test.sh b/source/source_basis/module_ao/test/parallel_orbitals_test.sh old mode 100755 new mode 100644 diff --git a/source/source_basis/module_nao/test/I_sphbes_coeff.txt b/source/source_basis/module_nao/test/I_sphbes_coeff.txt old mode 100755 new mode 100644 diff --git a/source/source_basis/module_pw/test/test_gnu.sh b/source/source_basis/module_pw/test/test_gnu.sh old mode 100755 new mode 100644 diff --git a/source/source_basis/module_pw/test/test_intel.sh b/source/source_basis/module_pw/test/test_intel.sh old mode 100755 new mode 100644 diff --git a/source/source_cell/test/bcast_atom_pseudo_test.sh b/source/source_cell/test/bcast_atom_pseudo_test.sh old mode 100755 new mode 100644 diff --git a/source/source_cell/test/bcast_atom_spec_test.sh b/source/source_cell/test/bcast_atom_spec_test.sh old mode 100755 new mode 100644 diff --git a/source/source_cell/test/klist_test_para.sh b/source/source_cell/test/klist_test_para.sh old mode 100755 new mode 100644 diff --git a/source/source_cell/test/parallel_kpoints_test.sh b/source/source_cell/test/parallel_kpoints_test.sh old mode 100755 new mode 100644 diff --git a/source/source_cell/test/unitcell_test_parallel.sh b/source/source_cell/test/unitcell_test_parallel.sh old mode 100755 new mode 100644 diff --git a/source/source_cell/test_pw/unitcell_test_pw_para.sh b/source/source_cell/test_pw/unitcell_test_pw_para.sh old mode 100755 new mode 100644 diff --git a/source/source_esolver/esolver.cpp b/source/source_esolver/esolver.cpp index 25840d9993..95ec4dbee1 100644 --- a/source/source_esolver/esolver.cpp +++ b/source/source_esolver/esolver.cpp @@ -230,13 +230,26 @@ ESolver* init_esolver(const Input_para& inp, UnitCell& ucell) } else if (esolver_type == "ksdft_lcao_tddft") { -#if ((defined __CUDA) /* || (defined __ROCM) */) - if (PARAM.inp.device == "gpu") + if (PARAM.inp.nspin < 4) { - return new ESolver_KS_LCAO_TDDFT(); +#if ((defined __CUDA) /* || (defined __ROCM) */) + if (PARAM.inp.device == "gpu") + { + return new ESolver_KS_LCAO_TDDFT(); + } +#endif + return new ESolver_KS_LCAO_TDDFT(); } + else + { +#if ((defined __CUDA) /* || (defined __ROCM) */) + if (PARAM.inp.device == "gpu") + { + return new ESolver_KS_LCAO_TDDFT, base_device::DEVICE_GPU>(); + } #endif - return new ESolver_KS_LCAO_TDDFT(); + return new ESolver_KS_LCAO_TDDFT, base_device::DEVICE_CPU>(); + } } else if (esolver_type == "lr_lcao") { diff --git a/source/source_esolver/esolver_ks.cpp b/source/source_esolver/esolver_ks.cpp index 000f13f43b..0750fd382e 100644 --- a/source/source_esolver/esolver_ks.cpp +++ b/source/source_esolver/esolver_ks.cpp @@ -287,7 +287,10 @@ void ESolver_KS::before_scf(UnitCell& ucell, const int istep) template void ESolver_KS::iter_init(UnitCell& ucell, const int istep, const int iter) { - ModuleIO::write_head(GlobalV::ofs_running, istep, iter, this->basisname); + if(PARAM.inp.esolver_type != "tddft") + { + ModuleIO::write_head(GlobalV::ofs_running, istep, iter, this->basisname); + } #ifdef __MPI iter_time = MPI_Wtime(); diff --git a/source/source_esolver/esolver_ks_lcao.cpp b/source/source_esolver/esolver_ks_lcao.cpp index 4bccc580b4..814ef8ebbb 100644 --- a/source/source_esolver/esolver_ks_lcao.cpp +++ b/source/source_esolver/esolver_ks_lcao.cpp @@ -161,7 +161,7 @@ void ESolver_KS_LCAO::before_all_runners(UnitCell& ucell, const Input_pa } // 5) read psi from file - if (PARAM.inp.init_wfc == "file") + if (PARAM.inp.init_wfc == "file"&& PARAM.inp.esolver_type != "tddft") { if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir, this->pv, diff --git a/source/source_esolver/esolver_ks_lcao_tddft.cpp b/source/source_esolver/esolver_ks_lcao_tddft.cpp index 5c02507027..d13c89de7a 100644 --- a/source/source_esolver/esolver_ks_lcao_tddft.cpp +++ b/source/source_esolver/esolver_ks_lcao_tddft.cpp @@ -4,8 +4,10 @@ #include "source_io/cal_r_overlap_R.h" #include "source_io/dipole_io.h" #include "source_io/td_current_io.h" +#include "source_io/read_wfc_nao.h" #include "source_io/write_HS.h" #include "source_io/write_HS_R.h" +#include "source_io/output_log.h" //--------------temporary---------------------------- #include "source_base/blas_connector.h" @@ -19,8 +21,8 @@ #include "source_estate/occupy.h" #include "source_io/print_info.h" #include "source_lcao/module_rt/evolve_elec.h" -#include "source_lcao/module_rt/td_velocity.h" #include "source_pw/module_pwdft/global.h" +#include "source_estate/module_pot/H_TDDFT_pw.h" //-----HSolver ElecState Hamilt-------- #include "source_io/module_parameter/parameter.h" @@ -38,11 +40,11 @@ namespace ModuleESolver { -template -ESolver_KS_LCAO_TDDFT::ESolver_KS_LCAO_TDDFT() +template +ESolver_KS_LCAO_TDDFT::ESolver_KS_LCAO_TDDFT() { - classname = "ESolver_rtTDDFT"; - basisname = "LCAO"; + this->classname = "ESolver_rtTDDFT"; + this->basisname = "LCAO"; // If the device is GPU, we must open use_tensor and use_lapack ct::DeviceType ct_device_type = ct::DeviceTypeToEnum::value; @@ -53,13 +55,13 @@ ESolver_KS_LCAO_TDDFT::ESolver_KS_LCAO_TDDFT() } } -template -ESolver_KS_LCAO_TDDFT::~ESolver_KS_LCAO_TDDFT() +template +ESolver_KS_LCAO_TDDFT::~ESolver_KS_LCAO_TDDFT() { delete psi_laststep; if (Hk_laststep != nullptr) { - for (int ik = 0; ik < kv.get_nks(); ++ik) + for (int ik = 0; ik < this->kv.get_nks(); ++ik) { delete[] Hk_laststep[ik]; } @@ -67,73 +69,219 @@ ESolver_KS_LCAO_TDDFT::~ESolver_KS_LCAO_TDDFT() } if (Sk_laststep != nullptr) { - for (int ik = 0; ik < kv.get_nks(); ++ik) + for (int ik = 0; ik < this->kv.get_nks(); ++ik) { delete[] Sk_laststep[ik]; } delete[] Sk_laststep; } + if (td_p != nullptr) + { + delete td_p; + } + TD_info::td_vel_op = nullptr; } -template -void ESolver_KS_LCAO_TDDFT::before_all_runners(UnitCell& ucell, const Input_para& inp) +template +void ESolver_KS_LCAO_TDDFT::before_all_runners(UnitCell& ucell, const Input_para& inp) { // 1) run before_all_runners in ESolver_KS_LCAO - ESolver_KS_LCAO, double>::before_all_runners(ucell, inp); + ESolver_KS_LCAO, TR>::before_all_runners(ucell, inp); // this line should be optimized // this->pelec = dynamic_cast(this->pelec); + + td_p = new TD_info(&ucell); + TD_info::td_vel_op = td_p; + totstep += TD_info::estep_shift; + + if (PARAM.inp.init_wfc == "file") + { + if (!ModuleIO::read_wfc_nao(PARAM.globalv.global_readin_dir, + this->pv, + *(this->psi), + this->pelec, + this->pelec->klist->ik2iktot, + this->pelec->klist->get_nkstot(), + PARAM.inp.nspin, + TD_info::estep_shift)) + { + ModuleBase::WARNING_QUIT("ESolver_KS_LCAO", "read electronic wave functions failed"); + } + } } +template +void ESolver_KS_LCAO_TDDFT::runner(UnitCell& ucell, const int istep) +{ + ModuleBase::TITLE("ESolver_KS_LCAO_TDDFT", "runner"); + ModuleBase::timer::tick(this->classname, "runner"); + + //---------------------------------------------------------------- + // 1) before_scf (electronic iteration loops) + //---------------------------------------------------------------- + this->before_scf(ucell, istep); + ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT SCF"); -template -void ESolver_KS_LCAO_TDDFT::hamilt2rho_single(UnitCell& ucell, - const int istep, - const int iter, - const double ethr) + // Initialize velocity operator for current calculation + if(PARAM.inp.td_stype!=1 && TD_info::out_current) + { + // initialize the velocity operator + velocity_mat = new Velocity_op(&ucell, &(this->gd), &this->pv, this->orb_, this->two_center_bundle_.overlap_orb.get()); + //calculate velocity operator + velocity_mat->calculate_grad_term(); + velocity_mat->calculate_vcomm_r(); + } + int estep_max = (istep == 0 && !PARAM.inp.mdp.md_restart) ? 1 : PARAM.inp.estep_per_md; + if(PARAM.inp.mdp.md_nstep==0)estep_max = PARAM.inp.estep_per_md + 1; + //int estep_max = PARAM.inp.estep_per_md; + for(int estep =0; estep < estep_max; estep++) + { + // calculate total time step + this->totstep++; + this->print_step(); + //update At + if(PARAM.inp.td_stype > 0) + { + elecstate::H_TDDFT_pw::update_At(); + td_p->cal_cart_At(elecstate::H_TDDFT_pw::At); + ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Ax(t)", td_p->cart_At[0]); + ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Ay(t)", td_p->cart_At[1]); + ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Az(t)", td_p->cart_At[2]); + } + + if(estep!=0) + { + this->CE.update_all_dis(ucell); + this->CE.extrapolate_charge(&this->Pgrid, + ucell, + &this->chr, + &this->sf, + GlobalV::ofs_running, + GlobalV::ofs_warning); + //need to test if correct when estep>0 + this->pelec->init_scf(totstep, ucell, this->Pgrid, this->sf.strucFac, this->locpp.numeric, ucell.symm); + + if(totstep <= PARAM.inp.td_tend + 1) + { + TD_info::evolve_once = true; + } + } + //---------------------------------------------------------------- + // 2) SCF iterations + //---------------------------------------------------------------- + bool conv_esolver = false; + this->niter = this->maxniter; + this->diag_ethr = PARAM.inp.pw_diag_thr; + for (int iter = 1; iter <= this->maxniter; ++iter) + { + ModuleIO::write_head_td(GlobalV::ofs_running, istep, totstep, iter, this->basisname); + //---------------------------------------------------------------- + // 3) initialization of SCF iterations + //---------------------------------------------------------------- + this->iter_init(ucell, totstep, iter); + + //---------------------------------------------------------------- + // 4) use Hamiltonian to obtain charge density + //---------------------------------------------------------------- + this->hamilt2rho(ucell, totstep, iter, this->diag_ethr); + + //---------------------------------------------------------------- + // 5) finish scf iterations + //---------------------------------------------------------------- + this->iter_finish(ucell, totstep, iter, conv_esolver); + + //---------------------------------------------------------------- + // 6) check convergence + //---------------------------------------------------------------- + if (conv_esolver || this->oscillate_esolver) + { + this->niter = iter; + if (this->oscillate_esolver) + { + std::cout << " !! Density oscillation is found, STOP HERE !!" << std::endl; + } + break; + } + } // end scf iterations + + //---------------------------------------------------------------- + // 7) after scf + //---------------------------------------------------------------- + this->after_scf(ucell, totstep, conv_esolver); + if(!restart_done && PARAM.inp.mdp.md_restart) + { + restart_done = true; + estep += TD_info::estep_shift%PARAM.inp.estep_per_md; + if(estep==0)break; + if(PARAM.inp.mdp.md_nstep!=0)estep -= 1; + } + } + if(PARAM.inp.td_stype!=1 && TD_info::out_current) + { + delete velocity_mat; + } + ModuleBase::timer::tick(this->classname, "runner"); + return; +} +//output electronic step infos +template +void ESolver_KS_LCAO_TDDFT::print_step() +{ + std::cout << " -------------------------------------------" << std::endl; + GlobalV::ofs_running << "\n -------------------------------------------" << std::endl; + std::cout << " STEP OF ELECTRON EVOLVE : " << unsigned(totstep) << std::endl; + GlobalV::ofs_running << " STEP OF ELECTRON EVOLVE : " << unsigned(totstep) << std::endl; + std::cout << " -------------------------------------------" << std::endl; + GlobalV::ofs_running << " -------------------------------------------" << std::endl; +} +template +void ESolver_KS_LCAO_TDDFT::hamilt2rho_single(UnitCell& ucell, + const int istep, + const int iter, + const double ethr) { if (PARAM.inp.init_wfc == "file") { - if (istep >= 1) + if (istep >= TD_info::estep_shift + 1) { module_rt::Evolve_elec::solve_psi(istep, - PARAM.inp.nbands, - PARAM.globalv.nlocal, - kv.get_nks(), - this->p_hamilt, - this->pv, - this->psi, - this->psi_laststep, - this->Hk_laststep, - this->Sk_laststep, - this->pelec->ekb, - GlobalV::ofs_running, - td_htype, - PARAM.inp.propagator, - use_tensor, - use_lapack); - this->weight_dm_rho(); + PARAM.inp.nbands, + PARAM.globalv.nlocal, + this->kv.get_nks(), + this->p_hamilt, + this->pv, + this->psi, + this->psi_laststep, + this->Hk_laststep, + this->Sk_laststep, + this->pelec->ekb, + GlobalV::ofs_running, + td_htype, + PARAM.inp.propagator, + use_tensor, + use_lapack); } - this->weight_dm_rho(); + this->weight_dm_rho(ucell); } - else if (istep >= 2) + else if (istep >= 1) { module_rt::Evolve_elec::solve_psi(istep, - PARAM.inp.nbands, - PARAM.globalv.nlocal, - kv.get_nks(), - this->p_hamilt, - this->pv, - this->psi, - this->psi_laststep, - this->Hk_laststep, - this->Sk_laststep, - this->pelec->ekb, - GlobalV::ofs_running, - td_htype, - PARAM.inp.propagator, - use_tensor, - use_lapack); - this->weight_dm_rho(); + PARAM.inp.nbands, + PARAM.globalv.nlocal, + this->kv.get_nks(), + this->p_hamilt, + this->pv, + this->psi, + this->psi_laststep, + this->Hk_laststep, + this->Sk_laststep, + this->pelec->ekb, + GlobalV::ofs_running, + td_htype, + PARAM.inp.propagator, + use_tensor, + use_lapack); + this->weight_dm_rho(ucell); } else { @@ -154,7 +302,7 @@ void ESolver_KS_LCAO_TDDFT::hamilt2rho_single(UnitCell& ucell, Symmetry_rho srho; for (int is = 0; is < PARAM.inp.nspin; is++) { - srho.begin(is, this->chr, pw_rho, ucell.symm); + srho.begin(is, this->chr, this->pw_rho, ucell.symm); } } @@ -162,38 +310,44 @@ void ESolver_KS_LCAO_TDDFT::hamilt2rho_single(UnitCell& ucell, this->pelec->f_en.deband = this->pelec->cal_delta_eband(ucell); } -template -void ESolver_KS_LCAO_TDDFT::iter_finish(UnitCell& ucell, const int istep, int& iter, bool& conv_esolver) +template +void ESolver_KS_LCAO_TDDFT::iter_finish( + UnitCell& ucell, + const int istep, + int& iter, + bool& conv_esolver) { // print occupation of each band if (iter == 1 && istep <= 2) { - GlobalV::ofs_running << " ----------------------------------------------------------" << std::endl; - GlobalV::ofs_running << " Occupations of electrons" << std::endl; - GlobalV::ofs_running << " ----------------------------------------------------------" << std::endl; + GlobalV::ofs_running << " ---------------------------------------------------------" + << std::endl; + GlobalV::ofs_running << " occupations of electrons" << std::endl; GlobalV::ofs_running << " k-point state occupation" << std::endl; GlobalV::ofs_running << std::setiosflags(std::ios::showpoint); GlobalV::ofs_running << std::left; std::setprecision(6); - for (int ik = 0; ik < kv.get_nks(); ik++) + for (int ik = 0; ik < this->kv.get_nks(); ik++) { for (int ib = 0; ib < PARAM.inp.nbands; ib++) { - GlobalV::ofs_running << " " << std::setw(9) << ik + 1 << std::setw(8) << ib + 1 << std::setw(12) - << this->pelec->wg(ik, ib) << std::endl; + GlobalV::ofs_running << " " << std::setw(9) + << ik+1 << std::setw(8) << ib + 1 + << std::setw(12) << this->pelec->wg(ik, ib) << std::endl; } } - GlobalV::ofs_running << " ----------------------------------------------------------" << std::endl; + GlobalV::ofs_running << " ---------------------------------------------------------" + << std::endl; } - ESolver_KS_LCAO, double>::iter_finish(ucell, istep, iter, conv_esolver); + ESolver_KS_LCAO, TR>::iter_finish(ucell, istep, iter, conv_esolver); } -template -void ESolver_KS_LCAO_TDDFT::update_pot(UnitCell& ucell, - const int istep, - const int iter, - const bool conv_esolver) +template +void ESolver_KS_LCAO_TDDFT::update_pot(UnitCell& ucell, + const int istep, + const int iter, + const bool conv_esolver) { // Calculate new potential according to new Charge Density if (!conv_esolver) @@ -214,7 +368,7 @@ void ESolver_KS_LCAO_TDDFT::update_pot(UnitCell& ucell, const int nlocal = PARAM.globalv.nlocal; // store wfc and Hk laststep - if (istep >= (PARAM.inp.init_wfc == "file" ? 0 : 1) && conv_esolver) + if (conv_esolver) { if (this->psi_laststep == nullptr) { @@ -227,7 +381,8 @@ void ESolver_KS_LCAO_TDDFT::update_pot(UnitCell& ucell, ncol_tmp = nbands; nrow_tmp = nlocal; #endif - this->psi_laststep = new psi::Psi>(kv.get_nks(), ncol_tmp, nrow_tmp, kv.ngk, true); + this->psi_laststep = new psi::Psi>(this->kv.get_nks(), ncol_tmp, nrow_tmp, this->kv.ngk, true); + } // allocate memory for Hk_laststep and Sk_laststep @@ -238,8 +393,8 @@ void ESolver_KS_LCAO_TDDFT::update_pot(UnitCell& ucell, if (this->Hk_laststep == nullptr) { - this->Hk_laststep = new std::complex*[kv.get_nks()]; - for (int ik = 0; ik < kv.get_nks(); ++ik) + this->Hk_laststep = new std::complex*[this->kv.get_nks()]; + for (int ik = 0; ik < this->kv.get_nks(); ++ik) { // Allocate memory for Hk_laststep, if (use_tensor && use_lapack), should be global this->Hk_laststep[ik] = new std::complex[len_HS]; @@ -248,8 +403,8 @@ void ESolver_KS_LCAO_TDDFT::update_pot(UnitCell& ucell, } if (this->Sk_laststep == nullptr) { - this->Sk_laststep = new std::complex*[kv.get_nks()]; - for (int ik = 0; ik < kv.get_nks(); ++ik) + this->Sk_laststep = new std::complex*[this->kv.get_nks()]; + for (int ik = 0; ik < this->kv.get_nks(); ++ik) { // Allocate memory for Sk_laststep, if (use_tensor && use_lapack), should be global this->Sk_laststep[ik] = new std::complex[len_HS]; @@ -259,16 +414,16 @@ void ESolver_KS_LCAO_TDDFT::update_pot(UnitCell& ucell, } // put information to Hk_laststep and Sk_laststep - for (int ik = 0; ik < kv.get_nks(); ++ik) + for (int ik = 0; ik < this->kv.get_nks(); ++ik) { this->psi->fix_k(ik); this->psi_laststep->fix_k(ik); // copy the data from psi to psi_laststep - const int size0 = psi->get_nbands() * psi->get_nbasis(); + const int size0 = this->psi->get_nbands() * this->psi->get_nbasis(); for (int index = 0; index < size0; ++index) { - psi_laststep[0].get_pointer()[index] = psi[0].get_pointer()[index]; + psi_laststep[0].get_pointer()[index] = this->psi[0].get_pointer()[index]; } // store Hamiltonian @@ -309,47 +464,47 @@ void ESolver_KS_LCAO_TDDFT::update_pot(UnitCell& ucell, } // calculate energy density matrix for tddft - if (istep >= (PARAM.inp.init_wfc == "file" ? 0 : 2) && PARAM.inp.td_edm == 0) + if (istep >= (PARAM.inp.init_wfc == "file" ? 0 : 1) && PARAM.inp.td_edm == 0) { elecstate::cal_edm_tddft(this->pv, this->pelec, this->kv, this->p_hamilt); } } // print "eigen value" for tddft - // it seems unnecessary to print out E_ii because the band energies are printed - /* - if (conv_esolver) +// it seems uncessary to print out E_ii because the band energies are printed +/* + if (conv_esolver) + { + GlobalV::ofs_running << "----------------------------------------------------------" + << std::endl; + GlobalV::ofs_running << " Print E= " << std::endl; + GlobalV::ofs_running << " k-point state energy (eV)" << std::endl; + GlobalV::ofs_running << "----------------------------------------------------------" + << std::endl; + GlobalV::ofs_running << std::setprecision(6); + GlobalV::ofs_running << std::setiosflags(std::ios::showpoint); + + for (int ik = 0; ik < this->kv.get_nks(); ik++) { - GlobalV::ofs_running << "----------------------------------------------------------" - << std::endl; - GlobalV::ofs_running << " Print E= " << std::endl; - GlobalV::ofs_running << " k-point state energy (eV)" << std::endl; - GlobalV::ofs_running << "----------------------------------------------------------" - << std::endl; - GlobalV::ofs_running << std::setprecision(6); - GlobalV::ofs_running << std::setiosflags(std::ios::showpoint); - - for (int ik = 0; ik < kv.get_nks(); ik++) + for (int ib = 0; ib < PARAM.inp.nbands; ib++) { - for (int ib = 0; ib < PARAM.inp.nbands; ib++) - { - GlobalV::ofs_running << " " << std::setw(7) << ik + 1 - << std::setw(7) << ib + 1 - << std::setw(10) << this->pelec->ekb(ik, ib) * ModuleBase::Ry_to_eV - << std::endl; - } + GlobalV::ofs_running << " " << std::setw(7) << ik + 1 + << std::setw(7) << ib + 1 + << std::setw(10) << this->pelec->ekb(ik, ib) * ModuleBase::Ry_to_eV + << std::endl; } } - */ + } +*/ } -template -void ESolver_KS_LCAO_TDDFT::after_scf(UnitCell& ucell, const int istep, const bool conv_esolver) +template +void ESolver_KS_LCAO_TDDFT::after_scf(UnitCell& ucell, const int istep, const bool conv_esolver) { ModuleBase::TITLE("ESolver_LCAO_TDDFT", "after_scf"); ModuleBase::timer::tick("ESolver_LCAO_TDDFT", "after_scf"); - ESolver_KS_LCAO, double>::after_scf(ucell, istep, conv_esolver); + ESolver_KS_LCAO, TR>::after_scf(ucell, istep, conv_esolver); // (1) write dipole information for (int is = 0; is < PARAM.inp.nspin; is++) @@ -358,33 +513,60 @@ void ESolver_KS_LCAO_TDDFT::after_scf(UnitCell& ucell, const int istep, { std::stringstream ss_dipole; ss_dipole << PARAM.globalv.global_out_dir << "SPIN" << is + 1 << "_DIPOLE"; - ModuleIO::write_dipole(ucell, this->chr.rho_save[is], this->chr.rhopw, is, istep, ss_dipole.str()); + ModuleIO::write_dipole(ucell, + this->chr.rho_save[is], + this->chr.rhopw, + is, + istep, + ss_dipole.str()); } } - + elecstate::DensityMatrix, double>* tmp_DM + = dynamic_cast>*>(this->pelec)->get_DM(); // (2) write current information - if (TD_Velocity::out_current == true) + if(TD_info::out_current) { - elecstate::DensityMatrix, double>* tmp_DM - = dynamic_cast>*>(this->pelec)->get_DM(); - - ModuleIO::write_current(ucell, - this->gd, - istep, - this->psi, - pelec, - kv, - two_center_bundle_.overlap_orb.get(), - tmp_DM->get_paraV_pointer(), - orb_, - this->RA); + if(TD_info::out_current_k) + { + ModuleIO::write_current_eachk(ucell, + istep, + this->psi, + this->pelec, + this->kv, + this->two_center_bundle_.overlap_orb.get(), + tmp_DM->get_paraV_pointer(), + this->orb_, + this->velocity_mat, + this->RA); + } + else + { + ModuleIO::write_current(ucell, + istep, + this->psi, + this->pelec, + this->kv, + this->two_center_bundle_.overlap_orb.get(), + tmp_DM->get_paraV_pointer(), + this->orb_, + this->velocity_mat, + this->RA); + } } + // (3) output energy for sub loop + std::cout << "Potential (Ry): " << std::setprecision(15) << this->pelec->f_en.etot <out_restart_info(istep, elecstate::H_TDDFT_pw::At, elecstate::H_TDDFT_pw::At_laststep); + } + ModuleBase::timer::tick("ESolver_LCAO_TDDFT", "after_scf"); } -template -void ESolver_KS_LCAO_TDDFT::weight_dm_rho() +template +void ESolver_KS_LCAO_TDDFT::weight_dm_rho(const UnitCell& ucell) { if (PARAM.inp.ocp == 1) { @@ -397,22 +579,31 @@ void ESolver_KS_LCAO_TDDFT::weight_dm_rho() } // calculate Eband energy - elecstate::calEBand(this->pelec->ekb, this->pelec->wg, this->pelec->f_en); + elecstate::calEBand(this->pelec->ekb,this->pelec->wg,this->pelec->f_en); // calculate the density matrix ModuleBase::GlobalFunc::NOTE("Calculate the density matrix."); auto _pes = dynamic_cast>*>(this->pelec); elecstate::cal_dm_psi(_pes->DM->get_paraV_pointer(), _pes->wg, this->psi[0], *(_pes->DM)); - _pes->DM->cal_DMR(); + if(PARAM.inp.td_stype == 2) + { + _pes->DM->cal_DMR_td(ucell, td_p->cart_At); + } + else + { + _pes->DM->cal_DMR(); + } // get the real-space charge density this->pelec->psiToRho(this->psi[0]); } -template class ESolver_KS_LCAO_TDDFT; +template class ESolver_KS_LCAO_TDDFT; +template class ESolver_KS_LCAO_TDDFT, base_device::DEVICE_CPU>; #if ((defined __CUDA) /* || (defined __ROCM) */) -template class ESolver_KS_LCAO_TDDFT; +template class ESolver_KS_LCAO_TDDFT; +template class ESolver_KS_LCAO_TDDFT, base_device::DEVICE_GPU>; #endif } // namespace ModuleESolver diff --git a/source/source_esolver/esolver_ks_lcao_tddft.h b/source/source_esolver/esolver_ks_lcao_tddft.h index f51aa29c9c..2890e6e5e9 100644 --- a/source/source_esolver/esolver_ks_lcao_tddft.h +++ b/source/source_esolver/esolver_ks_lcao_tddft.h @@ -5,6 +5,8 @@ #include "source_base/scalapack_connector.h" // Cpxgemr2d #include "source_lcao/record_adj.h" #include "source_psi/psi.h" +#include "source_lcao/module_rt/velocity_op.h" +#include "source_lcao/module_rt/td_info.h" namespace ModuleESolver { @@ -47,8 +49,8 @@ void gatherMatrix(const int myid, const int root_proc, const hamilt::MatrixBlock } //------------------------ MPI gathering and distributing functions ------------------------// -template -class ESolver_KS_LCAO_TDDFT : public ESolver_KS_LCAO, double> +template +class ESolver_KS_LCAO_TDDFT : public ESolver_KS_LCAO, TR> { public: ESolver_KS_LCAO_TDDFT(); @@ -58,6 +60,8 @@ class ESolver_KS_LCAO_TDDFT : public ESolver_KS_LCAO, doubl void before_all_runners(UnitCell& ucell, const Input_para& inp) override; protected: + virtual void runner(UnitCell& cell, const int istep) override; + virtual void hamilt2rho_single(UnitCell& ucell, const int istep, const int iter, const double ethr) override; virtual void update_pot(UnitCell& ucell, const int istep, const int iter, const bool conv_esolver) override; @@ -66,6 +70,7 @@ class ESolver_KS_LCAO_TDDFT : public ESolver_KS_LCAO, doubl virtual void after_scf(UnitCell& ucell, const int istep, const bool conv_esolver) override; + void print_step(); //! wave functions of last time step psi::Psi>* psi_laststep = nullptr; @@ -81,9 +86,21 @@ class ESolver_KS_LCAO_TDDFT : public ESolver_KS_LCAO, doubl bool use_tensor = false; bool use_lapack = false; + //! Total steps for evolving the wave function + int totstep = -1; + + //! Velocity matrix for calculating current + Velocity_op* velocity_mat = nullptr; + + TD_info* td_p = nullptr; + + //! doubt + bool restart_done = false; + private: - void weight_dm_rho(); + void weight_dm_rho(const UnitCell& ucell); }; } // namespace ModuleESolver #endif + diff --git a/source/source_estate/module_dm/density_matrix.cpp b/source/source_estate/module_dm/density_matrix.cpp index 706f4c4b3a..f883ca79e3 100644 --- a/source/source_estate/module_dm/density_matrix.cpp +++ b/source/source_estate/module_dm/density_matrix.cpp @@ -220,6 +220,178 @@ void DensityMatrix, double>::cal_DMR(const int ik_in) ModuleBase::timer::tick("DensityMatrix", "cal_DMR"); } +// calculate DMR from DMK using blas for multi-k calculation +template <> +void DensityMatrix, double>::cal_DMR_td(const UnitCell& ucell, const ModuleBase::Vector3 At, const int ik_in) +{ + ModuleBase::TITLE("DensityMatrix", "cal_DMR_td"); + // To check whether DMR has been initialized +#ifdef __DEBUG + assert(!this->_DMR.empty() && "DMR has not been initialized!"); +#endif + + ModuleBase::timer::tick("DensityMatrix", "cal_DMR_td"); + int ld_hk = this->_paraV->nrow; + for (int is = 1; is <= this->_nspin; ++is) + { + int ik_begin = this->_nk * (is - 1); // jump this->_nk for spin_down if nspin==2 + hamilt::HContainer* target_DMR = this->_DMR[is - 1]; + // set zero since this function is called in every scf step + target_DMR->set_zero(); +#ifdef _OPENMP +#pragma omp parallel for schedule(dynamic) +#endif + for (int i = 0; i < target_DMR->size_atom_pairs(); ++i) + { + hamilt::AtomPair& target_ap = target_DMR->get_atom_pair(i); + int iat1 = target_ap.get_atom_i(); + int iat2 = target_ap.get_atom_j(); + // get global indexes of whole matrix for each atom in this process + int row_ap = this->_paraV->atom_begin_row[iat1]; + int col_ap = this->_paraV->atom_begin_col[iat2]; + const int row_size = this->_paraV->get_row_size(iat1); + const int col_size = this->_paraV->get_col_size(iat2); + const int mat_size = row_size * col_size; + const int r_size = target_ap.get_R_size(); + if (row_ap == -1 || col_ap == -1) + { + throw std::string("Atom-pair not belong this process"); + } + std::vector> tmp_DMR; + if (PARAM.inp.nspin == 4) + { + tmp_DMR.resize(mat_size * r_size, 0); + } + + // calculate kphase and target_mat_ptr + std::vector> kphase_vec(r_size * this->_nk); + std::vector target_DMR_mat_vec(r_size); + for(int ir = 0; ir < r_size; ++ir) + { + const ModuleBase::Vector3 r_index = target_ap.get_R_index(ir); + hamilt::BaseMatrix* target_mat = target_ap.find_matrix(r_index); +#ifdef __DEBUG + if (target_mat == nullptr) + { + std::cout << "target_mat is nullptr" << std::endl; + continue; + } +#endif + target_DMR_mat_vec[ir] = target_mat->get_pointer(); + double arg_td = 0.0; + //cal tddft phase for hybrid gague + ModuleBase::Vector3 dtau = ucell.cal_dtau(iat1, iat2, r_index); + arg_td = At * dtau * ucell.lat0; + for(int ik = 0; ik < this->_nk; ++ik) + { + if(ik_in >= 0 && ik_in != ik) + { + continue; + } + // cal k_phase + // if TK==std::complex, kphase is e^{ikR} + const ModuleBase::Vector3 dR(r_index[0], r_index[1], r_index[2]); + const double arg = (this->_kvec_d[ik] * dR) * ModuleBase::TWO_PI + arg_td; + double sinp, cosp; + ModuleBase::libm::sincos(arg, &sinp, &cosp); + kphase_vec[ik * r_size + ir] = std::complex(cosp, sinp); + } + } + + std::vector> tmp_DMK_mat(mat_size); + // step_trace = 0 for NSPIN=1,2; ={0, 1, local_col, local_col+1} for NSPIN=4 + // step_trace is used when nspin = 4; + int step_trace[4]{}; + if(PARAM.inp.nspin == 4) + { + const int npol = 2; + for (int is = 0; is < npol; is++) + { + for (int is2 = 0; is2 < npol; is2++) + { + step_trace[is * npol + is2] = target_ap.get_col_size() * is + is2; + } + } + } + for(int ik = 0; ik < this->_nk; ++ik) + { + if(ik_in >= 0 && ik_in != ik) + { + continue; + } + + // copy column-major DMK to row-major tmp_DMK_mat (for the purpose of computational efficiency) + const std::complex* DMK_mat_ptr = this->_DMK[ik + ik_begin].data() + col_ap * this->_paraV->nrow + row_ap; + for(int icol = 0; icol < col_size; ++icol) + { + for(int irow = 0; irow < row_size; ++irow) + { + tmp_DMK_mat[irow * col_size + icol] = DMK_mat_ptr[icol * ld_hk + irow]; + } + } + + // if nspin != 4, fill DMR + // if nspin == 4, fill tmp_DMR + for(int ir = 0; ir < r_size; ++ir) + { + std::complex kphase = kphase_vec[ik * r_size + ir]; + if(PARAM.inp.nspin != 4) + { + double* target_DMR_mat = target_DMR_mat_vec[ir]; + for(int i = 0; i < mat_size; i++) + { + target_DMR_mat[i] += kphase.real() * tmp_DMK_mat[i].real() + - kphase.imag() * tmp_DMK_mat[i].imag(); + } + } else if(PARAM.inp.nspin == 4) + { + std::complex* tmp_DMR_mat = &tmp_DMR[ir * mat_size]; + BlasConnector::axpy(mat_size, + kphase, + tmp_DMK_mat.data(), + 1, + tmp_DMR_mat, + 1); + } + } + } + + // if nspin == 4 + // copy tmp_DMR to fill target_DMR + if(PARAM.inp.nspin == 4) + { + std::complex tmp[4]{}; + for(int ir = 0; ir < r_size; ++ir) + { + std::complex* tmp_DMR_mat = &tmp_DMR[ir * mat_size]; + double* target_DMR_mat = target_DMR_mat_vec[ir]; + for (int irow = 0; irow < row_size; irow += 2) + { + for (int icol = 0; icol < col_size; icol += 2) + { + // catch the 4 spin component value of one orbital pair + tmp[0] = tmp_DMR_mat[icol + step_trace[0]]; + tmp[1] = tmp_DMR_mat[icol + step_trace[1]]; + tmp[2] = tmp_DMR_mat[icol + step_trace[2]]; + tmp[3] = tmp_DMR_mat[icol + step_trace[3]]; + // transfer to Pauli matrix and save the real part + // save them back to the target_mat + target_DMR_mat[icol + step_trace[0]] = tmp[0].real() + tmp[3].real(); + target_DMR_mat[icol + step_trace[1]] = tmp[1].real() + tmp[2].real(); + target_DMR_mat[icol + step_trace[2]] + = -tmp[1].imag() + tmp[2].imag(); // (i * (rho_updown - rho_downup)).real() + target_DMR_mat[icol + step_trace[3]] = tmp[0].real() - tmp[3].real(); + } + tmp_DMR_mat += col_size * 2; + target_DMR_mat += col_size * 2; + } + } + } + } + } + ModuleBase::timer::tick("DensityMatrix", "cal_DMR_td"); +} + // calculate DMR from DMK using blas for multi-k calculation template <> void DensityMatrix::cal_DMR_full(hamilt::HContainer>* dmR_out)const{} @@ -463,7 +635,7 @@ void DensityMatrix::switch_dmr(const int mode) } } -// T of HContainer can be double or std::complex +// T of HContainer can be double or complex template class DensityMatrix; // Gamma-Only case template class DensityMatrix, double>; // Multi-k case template class DensityMatrix, std::complex>; // For EXX in future diff --git a/source/source_estate/module_dm/density_matrix.h b/source/source_estate/module_dm/density_matrix.h index bc912bbebb..17afea0cc4 100644 --- a/source/source_estate/module_dm/density_matrix.h +++ b/source/source_estate/module_dm/density_matrix.h @@ -87,7 +87,7 @@ class DensityMatrix /// since copy HContainer from another HContainer with different TR is not supported yet /// would be refactor in the future /// @param _DMR_in - // the old input type ``:HContainer ` causes redefination error if TR = std::complex + // the old input type ``:HContainer` causes redefination error if TR = complex void init_DMR(const hamilt::HContainer& _DMR_in); /** @@ -181,6 +181,13 @@ class DensityMatrix */ void cal_DMR(const int ik_in = -1); + /** + * @brief calculate density matrix DMR with additional vector potential phase, used for hybrid gague tddft + * if ik_in < 0, calculate all k-points + * if ik_in >= 0, calculate only one k-point without summing over k-points + */ + void cal_DMR_td(const UnitCell& ucell, const ModuleBase::Vector3 At, const int ik_in = -1); + /** * @brief calculate complex density matrix DMR with both real and imaginary part for noncollinear-spin calculation * the stored dm(k) has been used to calculate the passin DMR diff --git a/source/source_estate/module_pot/H_TDDFT_pw.cpp b/source/source_estate/module_pot/H_TDDFT_pw.cpp index e3abf0a10b..3b52c53eb1 100644 --- a/source/source_estate/module_pot/H_TDDFT_pw.cpp +++ b/source/source_estate/module_pot/H_TDDFT_pw.cpp @@ -44,7 +44,9 @@ double H_TDDFT_pw::lcut2; // velocity gauge ModuleBase::Vector3 H_TDDFT_pw::At; - +ModuleBase::Vector3 H_TDDFT_pw::At_laststep; +// hybrid gague +ModuleBase::Vector3 H_TDDFT_pw::Et; // time domain parameters // Gauss @@ -83,15 +85,18 @@ std::vector H_TDDFT_pw::heavi_amp; // Ry/bohr void H_TDDFT_pw::current_step_info(const std::string& file_dir, int& istep) { std::stringstream ssc; - ssc << file_dir << "Restart_md.dat"; + ssc << file_dir << "Restart_td.dat"; std::ifstream file(ssc.str().c_str()); if (!file) { - ModuleBase::WARNING_QUIT("H_TDDFT_pw::current_step_info", "No Restart_md.dat!"); + ModuleBase::WARNING_QUIT("H_TDDFT_pw::current_step_info", "No Restart_td.dat!"); } file >> istep; + file >> At[0] >> At[1] >>At[2]; + file >> At_laststep[0] >> At_laststep[1] >> At_laststep[2]; + At_laststep=-At_laststep; file.close(); } @@ -99,8 +104,8 @@ void H_TDDFT_pw::cal_fixed_v(double* vl_pseudo) { ModuleBase::TITLE("H_TDDFT_pw", "cal_fixed_v"); - // skip if velocity_gauge - if (stype == 1) + // skip if not length gague + if (stype != 0) { return; } @@ -283,6 +288,10 @@ void H_TDDFT_pw::update_At() //std::cout << "calculate electric potential" << std::endl; // time evolve H_TDDFT_pw::istep++; + // midpoint rule should be used both in Hamiltonian and here. + At = At + At_laststep/2.0; + At_laststep.set(0.0, 0.0, 0.0); + Et.set(0.0, 0.0, 0.0); // judgement to skip vext if (!PARAM.inp.td_vext || istep > tend || istep < tstart) @@ -329,7 +338,11 @@ void H_TDDFT_pw::update_At() switch (stype) { case 1: - At[direc - 1] -= out; + At_laststep[direc - 1] -= out; + break; + case 2: + At_laststep[direc-1] -= out; + Et[direc-1] += vext_time[0]; break; default: std::cout << "space_domain_type of electric field is wrong" << std::endl; @@ -349,6 +362,7 @@ void H_TDDFT_pw::update_At() // total count++ count++; } + At = At + At_laststep/2.0; ModuleBase::timer::tick("H_TDDFT_pw", "update_At"); return; @@ -373,7 +387,7 @@ double H_TDDFT_pw::cal_v_time(int t_type, const bool last) break; case 3: - vext_time = cal_v_time_heaviside(); + vext_time = cal_v_time_heaviside(last); break; // case 4: @@ -460,7 +474,7 @@ double H_TDDFT_pw::cal_v_time_trigonometric(const bool last) return vext_time; } -double H_TDDFT_pw::cal_v_time_heaviside() +double H_TDDFT_pw::cal_v_time_heaviside(const bool last) { double t0 = *(heavi_t0.begin() + heavi_count); double amp = *(heavi_amp.begin() + heavi_count); @@ -473,7 +487,7 @@ double H_TDDFT_pw::cal_v_time_heaviside() { vext_time = 0.0; } - heavi_count++; + if(last)heavi_count++; return vext_time; } @@ -524,3 +538,4 @@ void H_TDDFT_pw::compute_force(const UnitCell& cell, ModuleBase::matrix& fe) } } // namespace elecstate + diff --git a/source/source_estate/module_pot/H_TDDFT_pw.h b/source/source_estate/module_pot/H_TDDFT_pw.h index eec2088371..6c69d63566 100644 --- a/source/source_estate/module_pot/H_TDDFT_pw.h +++ b/source/source_estate/module_pot/H_TDDFT_pw.h @@ -72,6 +72,8 @@ class H_TDDFT_pw : public PotBase // velocity gauge, vector magnetic potential static ModuleBase::Vector3 At; + static ModuleBase::Vector3 At_laststep; + static ModuleBase::Vector3 Et; // time domain parameters @@ -144,7 +146,7 @@ class H_TDDFT_pw : public PotBase static double cal_v_time_Gauss(const bool last); static double cal_v_time_trapezoid(const bool last); static double cal_v_time_trigonometric(const bool last); - static double cal_v_time_heaviside(); + static double cal_v_time_heaviside(const bool last); // double cal_v_time_HHG(); // get ncut number for At integral @@ -156,3 +158,4 @@ class H_TDDFT_pw : public PotBase } // namespace elecstate #endif + diff --git a/source/source_hamilt/operator.h b/source/source_hamilt/operator.h index 4f7c9e2a0f..4198220a02 100644 --- a/source/source_hamilt/operator.h +++ b/source/source_hamilt/operator.h @@ -26,7 +26,7 @@ enum class calculation_type lcao_exx, lcao_dftu, lcao_sc_lambda, - lcao_tddft_velocity, + lcao_tddft_periodic, }; // Basic class for operator module, diff --git a/source/source_hsolver/test/parallel_k2d_test.sh b/source/source_hsolver/test/parallel_k2d_test.sh old mode 100755 new mode 100644 diff --git a/source/source_io/cal_r_overlap_R.cpp b/source/source_io/cal_r_overlap_R.cpp index 343d39b4ba..f81bf8026f 100644 --- a/source/source_io/cal_r_overlap_R.cpp +++ b/source/source_io/cal_r_overlap_R.cpp @@ -5,6 +5,7 @@ #include "source_base/timer.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" #include "source_pw/module_pwdft/global.h" +#include "source_base/mathzone_add1.h" cal_r_overlap_R::cal_r_overlap_R() { @@ -226,6 +227,238 @@ void cal_r_overlap_R::construct_orbs_and_orb_r(const UnitCell& ucell, } } +void cal_r_overlap_R::construct_orbs_and_nonlocal_and_orb_r(const UnitCell& ucell,const LCAO_Orbitals& orb) +{ + const InfoNonlocal& infoNL_ = ucell.infoNL; + + int orb_r_ntype = 0; + int mat_Nr = orb.Phi[0].PhiLN(0, 0).getNr(); + int count_Nr = 0; + + orbs.resize(orb.get_ntype()); + for (int T = 0; T < orb.get_ntype(); ++T) + { + count_Nr = orb.Phi[T].PhiLN(0, 0).getNr(); + if (count_Nr > mat_Nr) + { + mat_Nr = count_Nr; + orb_r_ntype = T; + } + + orbs[T].resize(orb.Phi[T].getLmax() + 1); + for (int L = 0; L <= orb.Phi[T].getLmax(); ++L) + { + orbs[T][L].resize(orb.Phi[T].getNchi(L)); + for (int N = 0; N < orb.Phi[T].getNchi(L); ++N) + { + const auto& orb_origin = orb.Phi[T].PhiLN(L, N); + orbs[T][L][N].set_orbital_info(orb_origin.getLabel(), + orb_origin.getType(), + orb_origin.getL(), + orb_origin.getChi(), + orb_origin.getNr(), + orb_origin.getRab(), + orb_origin.getRadial(), + Numerical_Orbital_Lm::Psi_Type::Psi, + orb_origin.getPsi(), + static_cast(orb_origin.getNk() * kmesh_times) | 1, + orb_origin.getDk(), + orb_origin.getDruniform(), + false, + true, + PARAM.inp.cal_force); + } + } + } + + orb_r.set_orbital_info(orbs[orb_r_ntype][0][0].getLabel(), // atom label + orb_r_ntype, // atom type + 1, // angular momentum L + 1, // number of orbitals of this L , just N + orbs[orb_r_ntype][0][0].getNr(), // number of radial mesh + orbs[orb_r_ntype][0][0].getRab(), // the mesh interval in radial mesh + orbs[orb_r_ntype][0][0].getRadial(), // radial mesh value(a.u.) + Numerical_Orbital_Lm::Psi_Type::Psi, + orbs[orb_r_ntype][0][0].getRadial(), // radial wave function + orbs[orb_r_ntype][0][0].getNk(), + orbs[orb_r_ntype][0][0].getDk(), + orbs[orb_r_ntype][0][0].getDruniform(), + false, + true, + PARAM.inp.cal_force); + + orbs_nonlocal.resize(orb.get_ntype()); + for (int T = 0; T < orb.get_ntype(); ++T) + { + const int nproj = infoNL_.nproj[T]; + orbs_nonlocal[T].resize(nproj); + for (int ip = 0; ip < nproj; ip++) + { + int nr = infoNL_.Beta[T].Proj[ip].getNr(); + double dr_uniform = 0.01; + int nr_uniform = static_cast((infoNL_.Beta[T].Proj[ip].getRadial(nr-1) - infoNL_.Beta[T].Proj[ip].getRadial(0))/dr_uniform) + 1; + double* rad = new double[nr_uniform]; + double* rab = new double[nr_uniform]; + for (int ir = 0; ir < nr_uniform; ir++) + { + rad[ir] = ir*dr_uniform; + rab[ir] = dr_uniform; + } + double* y2 = new double[nr]; + double* Beta_r_uniform = new double[nr_uniform]; + double* dbeta_uniform = new double[nr_uniform]; + ModuleBase::Mathzone_Add1::SplineD2(infoNL_.Beta[T].Proj[ip].getRadial(), infoNL_.Beta[T].Proj[ip].getBeta_r(), nr, 0.0, 0.0, y2); + ModuleBase::Mathzone_Add1::Cubic_Spline_Interpolation( + infoNL_.Beta[T].Proj[ip].getRadial(), + infoNL_.Beta[T].Proj[ip].getBeta_r(), + y2, + nr, + rad, + nr_uniform, + Beta_r_uniform, + dbeta_uniform + ); + + // linear extrapolation at the zero point + if (infoNL_.Beta[T].Proj[ip].getRadial(0) > 1e-10) + { + double slope = (infoNL_.Beta[T].Proj[ip].getBeta_r(1) - infoNL_.Beta[T].Proj[ip].getBeta_r(0)) / (infoNL_.Beta[T].Proj[ip].getRadial(1) - infoNL_.Beta[T].Proj[ip].getRadial(0)); + Beta_r_uniform[0] = infoNL_.Beta[T].Proj[ip].getBeta_r(0) - slope * infoNL_.Beta[T].Proj[ip].getRadial(0); + } + + // Here, the operation beta_r / r is performed. To avoid divergence at r=0, beta_r(0) is set to beta_r(1). + // However, this may introduce issues, so caution is needed. + for (int ir = 1; ir < nr_uniform; ir++) + { + Beta_r_uniform[ir] = Beta_r_uniform[ir] / rad[ir]; + } + Beta_r_uniform[0] = Beta_r_uniform[1]; + + orbs_nonlocal[T][ip].set_orbital_info(infoNL_.Beta[T].getLabel(), + infoNL_.Beta[T].getType(), + infoNL_.Beta[T].Proj[ip].getL(), + 1, + nr_uniform, + rab, + rad, + Numerical_Orbital_Lm::Psi_Type::Psi, + Beta_r_uniform, + static_cast(infoNL_.Beta[T].Proj[ip].getNk() * kmesh_times) | 1, + infoNL_.Beta[T].Proj[ip].getDk(), + infoNL_.Beta[T].Proj[ip].getDruniform(), + false, + true, + PARAM.inp.cal_force); + + delete [] rad; + delete [] rab; + delete [] y2; + delete [] Beta_r_uniform; + delete [] dbeta_uniform; + } + } + + for (int TA = 0; TA < orb.get_ntype(); ++TA) + { + for (int TB = 0; TB < orb.get_ntype(); ++TB) + { + for (int LA = 0; LA <= orb.Phi[TA].getLmax(); ++LA) + { + for (int NA = 0; NA < orb.Phi[TA].getNchi(LA); ++NA) + { + for (int ip = 0; ip < infoNL_.nproj[TB]; ip++) + { + center2_orb11_nonlocal[TA][TB][LA][NA].insert( + std::make_pair(ip, Center2_Orb::Orb11(orbs[TA][LA][NA], orbs_nonlocal[TB][ip], psb_, MGT))); + } + } + } + } + } + + for (int TA = 0; TA < orb.get_ntype(); ++TA) + { + for (int TB = 0; TB < orb.get_ntype(); ++TB) + { + for (int LA = 0; LA <= orb.Phi[TA].getLmax(); ++LA) + { + for (int NA = 0; NA < orb.Phi[TA].getNchi(LA); ++NA) + { + for (int ip = 0; ip < infoNL_.nproj[TB]; ip++) + { + center2_orb21_r_nonlocal[TA][TB][LA][NA].insert(std::make_pair( + ip, + Center2_Orb::Orb21(orbs[TA][LA][NA], orb_r, orbs_nonlocal[TB][ip], psb_, MGT))); + } + } + } + } + } + + for (auto& co1: center2_orb11_nonlocal) + { + for (auto& co2: co1.second) + { + for (auto& co3: co2.second) + { + for (auto& co4: co3.second) + { + for (auto& co5: co4.second) + { + co5.second.init_radial_table(); + } + } + } + } + } + + for (auto& co1: center2_orb21_r_nonlocal) + { + for (auto& co2: co1.second) + { + for (auto& co3: co2.second) + { + for (auto& co4: co3.second) + { + for (auto& co5: co4.second) + { + co5.second.init_radial_table(); + } + } + } + } + } + + iw2it.resize(PARAM.globalv.nlocal); + iw2ia.resize(PARAM.globalv.nlocal); + iw2iL.resize(PARAM.globalv.nlocal); + iw2iN.resize(PARAM.globalv.nlocal); + iw2im.resize(PARAM.globalv.nlocal); + + int iw = 0; + for (int it = 0; it < ucell.ntype; it++) + { + for (int ia = 0; ia < ucell.atoms[it].na; ia++) + { + for (int iL = 0; iL < ucell.atoms[it].nwl + 1; iL++) + { + for (int iN = 0; iN < ucell.atoms[it].l_nchi[iL]; iN++) + { + for (int im = 0; im < (2 * iL + 1); im++) + { + iw2it[iw] = it; + iw2ia[iw] = ia; + iw2iL[iw] = iL; + iw2iN[iw] = iN; + iw2im[iw] = im; + iw++; + } + } + } + } + } +} + void cal_r_overlap_R::init(const UnitCell& ucell,const Parallel_Orbitals& pv, const LCAO_Orbitals& orb) { ModuleBase::TITLE("cal_r_overlap_R", "init"); @@ -239,6 +472,141 @@ void cal_r_overlap_R::init(const UnitCell& ucell,const Parallel_Orbitals& pv, co return; } +void cal_r_overlap_R::init_nonlocal(const UnitCell& ucell,const Parallel_Orbitals& pv, const LCAO_Orbitals& orb) +{ + ModuleBase::TITLE("cal_r_overlap_R", "init_nonlocal"); + ModuleBase::timer::tick("cal_r_overlap_R", "init_nonlocal"); + this->ParaV = &pv; + + initialize_orb_table(ucell,orb); + construct_orbs_and_nonlocal_and_orb_r(ucell,orb); + + ModuleBase::timer::tick("cal_r_overlap_R", "init_nonlocal"); + return; +} + +ModuleBase::Vector3 cal_r_overlap_R::get_psi_r_psi(const ModuleBase::Vector3& R1, + const int& T1, + const int& L1, + const int& m1, + const int& N1, + const ModuleBase::Vector3& R2, + const int& T2, + const int& L2, + const int& m2, + const int& N2) +{ + ModuleBase::Vector3 origin_point(0.0, 0.0, 0.0); + double factor = sqrt(ModuleBase::FOUR_PI / 3.0); + const ModuleBase::Vector3& distance = R2 - R1; + + double overlap_o = center2_orb11[T1][T2][L1][N1][L2].at(N2).cal_overlap(origin_point, distance, m1, m2); + + double overlap_x = -1 * factor + * center2_orb21_r[T1][T2][L1][N1][L2].at(N2).cal_overlap(origin_point, + distance, + m1, + 1, + m2); // m = 1 + + double overlap_y = -1 * factor + * center2_orb21_r[T1][T2][L1][N1][L2].at(N2).cal_overlap(origin_point, + distance, + m1, + 2, + m2); // m = -1 + + double overlap_z = factor + * center2_orb21_r[T1][T2][L1][N1][L2].at(N2).cal_overlap(origin_point, + distance, + m1, + 0, + m2); // m = 0 + + ModuleBase::Vector3 temp_prp + = ModuleBase::Vector3(overlap_x, overlap_y, overlap_z) + R1 * overlap_o; + + return temp_prp; +} + +void cal_r_overlap_R::get_psi_r_beta(const UnitCell& ucell, + std::vector>& nlm, + const ModuleBase::Vector3& R1, + const int& T1, + const int& L1, + const int& m1, + const int& N1, + const ModuleBase::Vector3& R2, + const int& T2) +{ + ModuleBase::Vector3 origin_point(0.0, 0.0, 0.0); + double factor = sqrt(ModuleBase::FOUR_PI / 3.0); + const ModuleBase::Vector3& distance = R2 - R1; + const InfoNonlocal& infoNL_ = ucell.infoNL; + const int nproj = infoNL_.nproj[T2]; + nlm.resize(4); + if (nproj == 0) + { + for(int i = 0;i < 4;i++) + { + nlm[i].resize(1); + } + return; + } + + int natomwfc = 0; + for (int ip = 0; ip < nproj; ip++) + { + const int L2 = infoNL_.Beta[T2].Proj[ip].getL(); // mohan add 2021-05-07 + natomwfc += 2 * L2 + 1; + } + for(int i = 0;i < 4;i++) + { + nlm[i].resize(natomwfc); + } + int index = 0; + for (int ip = 0; ip < nproj; ip++) + { + const int L2 = infoNL_.Beta[T2].Proj[ip].getL(); + for (int m2 = 0; m2 < 2 * L2 + 1; m2++) + { + double overlap_o + = center2_orb11_nonlocal[T1][T2][L1][N1].at(ip).cal_overlap(origin_point, distance, m1, m2); + + double overlap_x = -1 * factor + * center2_orb21_r_nonlocal[T1][T2][L1][N1].at(ip).cal_overlap(origin_point, + distance, + m1, + 1, + m2); // m = 1 + + double overlap_y = -1 * factor + * center2_orb21_r_nonlocal[T1][T2][L1][N1].at(ip).cal_overlap(origin_point, + distance, + m1, + 2, + m2); // m = -1 + + double overlap_z = factor + * center2_orb21_r_nonlocal[T1][T2][L1][N1].at(ip).cal_overlap(origin_point, + distance, + m1, + 0, + m2); // m = 0 + + //nlm[index] = ModuleBase::Vector3(overlap_x, overlap_y, overlap_z) + R1 * overlap_o; + + //nlm[index] = ModuleBase::Vector3(overlap_o, overlap_y, overlap_z);// + R1 * overlap_o; + nlm[0][index] = overlap_o; + nlm[1][index] = overlap_x + (R1 * overlap_o).x; + nlm[2][index] = overlap_y + (R1 * overlap_o).y; + nlm[3][index] = overlap_z + (R1 * overlap_o).z; + index++; + } + } +} + + void cal_r_overlap_R::out_rR(const UnitCell& ucell, const Grid_Driver& gd, const int& istep) { ModuleBase::TITLE("cal_r_overlap_R", "out_rR"); diff --git a/source/source_io/cal_r_overlap_R.h b/source/source_io/cal_r_overlap_R.h index 4fd617ff7c..c56f2b02e9 100644 --- a/source/source_io/cal_r_overlap_R.h +++ b/source/source_io/cal_r_overlap_R.h @@ -33,12 +33,37 @@ class cal_r_overlap_R bool binary = false; void init(const UnitCell& ucell,const Parallel_Orbitals& pv, const LCAO_Orbitals& orb); + void init_nonlocal(const UnitCell& ucell,const Parallel_Orbitals& pv, const LCAO_Orbitals& orb); + ModuleBase::Vector3 get_psi_r_psi( + const ModuleBase::Vector3& R1, + const int& T1, + const int& L1, + const int& m1, + const int& N1, + const ModuleBase::Vector3& R2, + const int& T2, + const int& L2, + const int& m2, + const int& N2 + ); + void get_psi_r_beta( + const UnitCell& ucell, + std::vector>& nlm, + const ModuleBase::Vector3& R1, + const int& T1, + const int& L1, + const int& m1, + const int& N1, + const ModuleBase::Vector3& R2, + const int& T2 + ); void out_rR(const UnitCell& ucell, const Grid_Driver& gd, const int& istep); void out_rR_other(const UnitCell& ucell, const int& istep, const std::set>& output_R_coor); private: void initialize_orb_table(const UnitCell& ucell, const LCAO_Orbitals& orb); void construct_orbs_and_orb_r(const UnitCell& ucell,const LCAO_Orbitals& orb); + void construct_orbs_and_nonlocal_and_orb_r(const UnitCell& ucell,const LCAO_Orbitals& orb); std::vector iw2ia; std::vector iw2iL; @@ -51,6 +76,7 @@ class cal_r_overlap_R Numerical_Orbital_Lm orb_r; std::vector>> orbs; + std::vector> orbs_nonlocal; std::map< size_t, @@ -62,6 +88,16 @@ class cal_r_overlap_R std::map>>>>> center2_orb21_r; + std::map< + size_t, + std::map>>>> + center2_orb11_nonlocal; + + std::map< + size_t, + std::map>>>> + center2_orb21_r_nonlocal; + const Parallel_Orbitals* ParaV; }; #endif diff --git a/source/source_io/input_conv.cpp b/source/source_io/input_conv.cpp index 2107fa3d45..9a4b19d4f7 100644 --- a/source/source_io/input_conv.cpp +++ b/source/source_io/input_conv.cpp @@ -24,7 +24,7 @@ #include "source_estate/module_pot/H_TDDFT_pw.h" #include "source_lcao/FORCE_STRESS.h" #include "source_lcao/module_rt/evolve_elec.h" -#include "source_lcao/module_rt/td_velocity.h" +#include "source_lcao/module_rt/td_info.h" #endif #ifdef __PEXSI #include "source_hsolver/module_pexsi/pexsi_solver.h" @@ -57,24 +57,25 @@ std::vector Input_Conv::convert_units(std::string params, double c) { void Input_Conv::read_td_efield() { elecstate::H_TDDFT_pw::stype = PARAM.inp.td_stype; - if (PARAM.inp.esolver_type == "tddft" && elecstate::H_TDDFT_pw::stype == 1) - { - TD_Velocity::tddft_velocity = true; - } else { - TD_Velocity::tddft_velocity = false; - } if (PARAM.inp.out_mat_hs2 == 1) { - TD_Velocity::out_mat_R = true; + TD_info::out_mat_R = true; } else { - TD_Velocity::out_mat_R = false; + TD_info::out_mat_R = false; } parse_expression(PARAM.inp.td_ttype, elecstate::H_TDDFT_pw::ttype); elecstate::H_TDDFT_pw::tstart = PARAM.inp.td_tstart; elecstate::H_TDDFT_pw::tend = PARAM.inp.td_tend; + if(PARAM.inp.td_dt!=-1.0) + { + elecstate::H_TDDFT_pw::dt = PARAM.inp.td_dt / ModuleBase::AU_to_FS; + } + else + { + elecstate::H_TDDFT_pw::dt = PARAM.mdp.md_dt / PARAM.inp.estep_per_md / ModuleBase::AU_to_FS; + } - elecstate::H_TDDFT_pw::dt = PARAM.mdp.md_dt / ModuleBase::AU_to_FS; elecstate::H_TDDFT_pw::dt_int = elecstate::H_TDDFT_pw::dt; // space domain parameters @@ -247,10 +248,10 @@ void Input_Conv::Convert() // Fuxiang He add 2016-10-26 //---------------------------------------------------------- #ifdef __LCAO - TD_Velocity::out_current = PARAM.inp.out_current; - TD_Velocity::out_current_k = PARAM.inp.out_current_k; - TD_Velocity::out_vecpot = PARAM.inp.out_vecpot; - TD_Velocity::init_vecpot_file = PARAM.inp.init_vecpot_file; + TD_info::out_current = PARAM.inp.out_current; + TD_info::out_current_k = PARAM.inp.out_current_k; + TD_info::out_vecpot = PARAM.inp.out_vecpot; + TD_info::init_vecpot_file = PARAM.inp.init_vecpot_file; read_td_efield(); #endif // __LCAO @@ -297,12 +298,7 @@ void Input_Conv::Convert() if (dft_functional_lower == "hf" || dft_functional_lower == "pbe0" || dft_functional_lower == "hse" || dft_functional_lower == "opt_orb" - || dft_functional_lower == "scan0" - || dft_functional_lower == "lc_pbe" - || dft_functional_lower == "lc_wpbe" - || dft_functional_lower == "lrc_wpbe" - || dft_functional_lower == "lrc_wpbeh" - || dft_functional_lower == "cam_pbeh") { + || dft_functional_lower == "scan0") { GlobalC::restart.info_load.load_charge = true; GlobalC::restart.info_load.load_H = true; } @@ -327,15 +323,10 @@ void Input_Conv::Convert() dft_functional_lower.begin(), tolower); if (dft_functional_lower == "hf" - || dft_functional_lower == "pbe0" || dft_functional_lower == "b3lyp" || dft_functional_lower == "hse" - || dft_functional_lower == "scan0" - || dft_functional_lower == "muller" || dft_functional_lower == "power" - || dft_functional_lower == "cwp22" || dft_functional_lower == "wp22" - || dft_functional_lower == "lc_pbe" - || dft_functional_lower == "lc_wpbe" - || dft_functional_lower == "lrc_wpbe" - || dft_functional_lower == "lrc_wpbeh" - || dft_functional_lower == "cam_pbeh") + || dft_functional_lower == "pbe0" || dft_functional_lower == "b3lyp" || dft_functional_lower == "hse" + || dft_functional_lower == "scan0" + || dft_functional_lower == "muller" || dft_functional_lower == "power" + || dft_functional_lower == "cwp22" || dft_functional_lower == "wp22") { GlobalC::exx_info.info_global.cal_exx = true; @@ -365,9 +356,9 @@ void Input_Conv::Convert() GlobalC::exx_info.info_global.coulomb_param[Conv_Coulomb_Pot_K::Coulomb_Type::Fock].resize(fock_alpha.size()); for(std::size_t i=0; i td_vext_dire = {1}; ///< vector of vext direction diff --git a/source/source_io/module_parameter/system_parameter.h b/source/source_io/module_parameter/system_parameter.h index 8df781ad0b..bcea7a519e 100644 --- a/source/source_io/module_parameter/system_parameter.h +++ b/source/source_io/module_parameter/system_parameter.h @@ -43,6 +43,7 @@ struct System_para std::string global_readin_dir = ""; ///< global readin directory std::string global_stru_dir = ""; ///< global structure directory std::string global_matrix_dir = ""; ///< global matrix directory + std::string global_wfc_dir = ""; ///< global wavefunction directory std::string global_mlkedf_descriptor_dir = ""; ///< global ML KEDF descriptor directory std::string global_deepks_label_elec_dir = ""; ///< global directory for DeePKS labels during electronic steps std::string log_file = "log"; ///< log file name diff --git a/source/source_io/output_log.cpp b/source/source_io/output_log.cpp index f719c6485e..87cdd3b63b 100644 --- a/source/source_io/output_log.cpp +++ b/source/source_io/output_log.cpp @@ -347,5 +347,16 @@ void write_head(std::ofstream& ofs, const int& istep, const int& iter, const std // ofs << "\n " << basisname << " ALGORITHM --------------- ION=" << std::setw(4) << istep + 1 // << " ELEC=" << std::setw(4) << iter << "--------------------------------\n"; } +void write_head_td(std::ofstream& ofs, const int& istep, const int& estep, const int& iter, const std::string& basisname) +{ + ofs << "\n"; + ofs << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<< std::endl; + ofs << " --> IONIC RELAXATION STEP=" << std::setw(6) << istep+1 + << " ELECTRON PROPAGATION STEP=" << std::setw(6) << estep + << " ELECTRONIC ITERATION STEP=" << std::setw(6) << iter << "\n"; + ofs << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<< std::endl; +// ofs << "\n " << basisname << " ALGORITHM --------------- ION=" << std::setw(4) << istep + 1 +// << " ELEC=" << std::setw(4) << estep << " iter=" << std::setw(4) << iter << "--------------------------------\n"; +} }// namespace ModuleIO diff --git a/source/source_io/output_log.h b/source/source_io/output_log.h index d1b476fd0f..a6b6c8b90c 100644 --- a/source/source_io/output_log.h +++ b/source/source_io/output_log.h @@ -77,6 +77,13 @@ void print_stress(const std::string& name, /// @param basisname basis set name void write_head(std::ofstream& ofs_running, const int& istep, const int& iter, const std::string& basisname); +/// @brief write head for scf iteration +/// @param ofs_running output stream +/// @param istep the ion step +/// @param estep the electron step +/// @param iter the scf iteration step +/// @param basisname basis set name +void write_head_td(std::ofstream& ofs_running, const int& istep, const int& estep, const int& iter, const std::string& basisname); } // namespace ModuleIO #endif diff --git a/source/source_io/read_input.cpp b/source/source_io/read_input.cpp index e8ee9ef3fd..470f62903c 100644 --- a/source/source_io/read_input.cpp +++ b/source/source_io/read_input.cpp @@ -189,11 +189,17 @@ void ReadInput::create_directory(const Parameter& param) { out_dir = true; } + bool out_wfc_dir = false; + if (param.input.out_wfc_lcao && !param.input.out_app_flag) + { + out_wfc_dir = true; + } // NOTE: "make_dir_out" must be called by all processes!!! // Maybe it is not good, because only rank 0 can create the directory. ModuleBase::Global_File::make_dir_out(param.input.suffix, param.input.calculation, out_dir, + out_wfc_dir, this->rank, param.input.mdp.md_restart, param.input.out_alllog); // xiaohui add 2013-09-01 @@ -372,7 +378,7 @@ void ReadInput::write_txt_input(const Parameter& param, const std::string& filen { ofs << "\n#Parameters (8.DeepKS)" << std::endl; } - else if (p_item->label == "td_force_dt") + else if (p_item->label == "td_dt") { ofs << "\n#Parameters (9.rt-tddft)" << std::endl; } diff --git a/source/source_io/read_input_item_md.cpp b/source/source_io/read_input_item_md.cpp index a49c1bd3e6..4ba795d63a 100644 --- a/source/source_io/read_input_item_md.cpp +++ b/source/source_io/read_input_item_md.cpp @@ -23,7 +23,7 @@ void ReadInput::item_md() Input_Item item("md_nstep"); item.annotation = "md steps"; item.reset_value = [](const Input_Item& item, Parameter& para) { - if (para.input.mdp.md_nstep == 0) + if (para.input.mdp.md_nstep == 0 && para.input.esolver_type != "tddft") { GlobalV::ofs_running << "md_nstep should be set. Autoset md_nstep to 50!" << std::endl; para.input.mdp.md_nstep = 50; @@ -40,6 +40,13 @@ void ReadInput::item_md() ModuleBase::WARNING_QUIT("ReadInput", "time interval of MD calculation should be positive"); } }; + item.reset_value = [](const Input_Item& item, Parameter& para) { + if (para.input.td_dt != -1.0) + { + GlobalV::ofs_running << "td_dt exist, set md_dt with td_dt" << std::endl; + para.input.mdp.md_dt = para.input.td_dt * para.input.estep_per_md; + } + }; read_sync_double(input.mdp.md_dt); this->add_item(item); } @@ -403,4 +410,4 @@ void ReadInput::item_md() this->add_item(item); } } -} // namespace ModuleIO \ No newline at end of file +} // namespace ModuleIO diff --git a/source/source_io/read_input_item_system.cpp b/source/source_io/read_input_item_system.cpp index d754f98465..ed8cd2f778 100644 --- a/source/source_io/read_input_item_system.cpp +++ b/source/source_io/read_input_item_system.cpp @@ -158,6 +158,10 @@ void ReadInput::item_system() { para.input.symmetry = "0"; } + if (para.input.esolver_type == "tddft") + { + para.input.symmetry = "-1"; + } if (para.input.qo_switch) { para.input.symmetry = "-1"; // disable kpoint reduce diff --git a/source/source_io/read_input_item_tddft.cpp b/source/source_io/read_input_item_tddft.cpp index 5a3ffe3214..0e44754db1 100644 --- a/source/source_io/read_input_item_tddft.cpp +++ b/source/source_io/read_input_item_tddft.cpp @@ -9,9 +9,28 @@ void ReadInput::item_rt_tddft() { // real time TDDFT { - Input_Item item("td_force_dt"); - item.annotation = "time of force change"; - read_sync_double(input.td_force_dt); + Input_Item item("td_dt"); + item.annotation = "time step for evolving wavefunction"; + item.reset_value = [](const Input_Item& item, Parameter& para) { + if (para.input.td_dt == -1.0) + { + GlobalV::ofs_running << "td_dt don't exist, set td_dt with md_dt" << std::endl; + para.input.td_dt = para.input.mdp.md_dt / para.input.estep_per_md; + } + }; + read_sync_double(input.td_dt); + this->add_item(item); + } + { + Input_Item item("estep_per_md"); + item.annotation = "steps of force change"; + read_sync_int(input.estep_per_md); + this->add_item(item); + } + { + Input_Item item("td_dt"); + item.annotation = "time step of propagation"; + read_sync_double(input.td_dt); this->add_item(item); } { @@ -388,4 +407,4 @@ void ReadInput::item_lr_tddft() this->add_item(item); } } -} \ No newline at end of file +} diff --git a/source/source_io/read_set_globalv.cpp b/source/source_io/read_set_globalv.cpp index 966417da0a..5237c0647a 100644 --- a/source/source_io/read_set_globalv.cpp +++ b/source/source_io/read_set_globalv.cpp @@ -93,6 +93,10 @@ void ReadInput::set_global_dir(const Input_para& inp, System_para& sys) sys.global_matrix_dir = sys.global_out_dir + "matrix/"; sys.global_matrix_dir = to_dir(sys.global_matrix_dir); + /// get the global output directory + sys.global_wfc_dir = sys.global_out_dir + "WFC/"; + sys.global_wfc_dir = to_dir(sys.global_wfc_dir); + /// get the global ML KEDF descriptor directory sys.global_mlkedf_descriptor_dir = sys.global_out_dir + "MLKEDF_Descriptors/"; sys.global_mlkedf_descriptor_dir = to_dir(sys.global_mlkedf_descriptor_dir); @@ -126,22 +130,17 @@ void ReadInput::set_global_dir(const Input_para& inp, System_para& sys) // set the global log file bool out_alllog = inp.out_alllog; - // set the global calculation type - std::string cal_type = inp.calculation; #ifdef __MPI // because log_file is different for each rank, so we need to bcast the out_alllog Parallel_Common::bcast_bool(out_alllog); - // In `ReadInput::read_parameters`, `bcastfunc(param)` is after `set_global_dir`, - // so `cal_type` must be synchronized here manually - Parallel_Common::bcast_string(cal_type); #endif if (out_alllog) { - PARAM.sys.log_file = "running_" + cal_type + "_" + std::to_string(PARAM.sys.myrank + 1) + ".log"; + PARAM.sys.log_file = "running_" + PARAM.inp.calculation + "_" + std::to_string(PARAM.sys.myrank + 1) + ".log"; } else { - PARAM.sys.log_file = "running_" + cal_type + ".log"; + PARAM.sys.log_file = "running_" + PARAM.inp.calculation + ".log"; } #ifdef __MPI Parallel_Common::bcast_string(sys.global_in_card); @@ -149,6 +148,7 @@ void ReadInput::set_global_dir(const Input_para& inp, System_para& sys) Parallel_Common::bcast_string(sys.global_readin_dir); Parallel_Common::bcast_string(sys.global_stru_dir); Parallel_Common::bcast_string(sys.global_matrix_dir); + Parallel_Common::bcast_string(sys.global_wfc_dir); Parallel_Common::bcast_string(sys.global_in_stru); #endif } diff --git a/source/source_io/read_wfc_nao.cpp b/source/source_io/read_wfc_nao.cpp index 0a7a62f5c2..fcc4fab4af 100644 --- a/source/source_io/read_wfc_nao.cpp +++ b/source/source_io/read_wfc_nao.cpp @@ -30,6 +30,7 @@ bool ModuleIO::read_wfc_nao( const std::vector &ik2iktot, const int nkstot, const int nspin, + const int nstep, const int skip_band) { ModuleBase::TITLE("ModuleIO", "read_wfc_nao"); @@ -155,11 +156,14 @@ bool ModuleIO::read_wfc_nao( if (myrank == 0) { const bool out_app_flag = false; - const int istep = -1; std::stringstream error_message; - - std::string ss = ModuleIO::filename_output(global_readin_dir,"wf","nao", - ik,ik2iktot,nspin,nkstot,out_type,out_app_flag,gamma_only,istep); + std::string readin_dir = global_readin_dir; + if(nstep >= 0) + { + readin_dir = readin_dir + "WFC/"; + } + std::string ss = ModuleIO::filename_output(readin_dir,"wf","nao", + ik,ik2iktot,nspin,nkstot,out_type,out_app_flag,gamma_only,nstep); read_success = read_one_file(ss, error_message, ik, ctot); errors = error_message.str(); @@ -207,6 +211,7 @@ template bool ModuleIO::read_wfc_nao(const std::string& global_readin_di const std::vector &ik2iktot, const int nkstot, const int nspin, + const int nstep, const int skip_band); template bool ModuleIO::read_wfc_nao>(const std::string& global_readin_dir, @@ -216,4 +221,5 @@ template bool ModuleIO::read_wfc_nao>(const std::string& gl const std::vector &ik2iktot, const int nkstot, const int nspin, + const int nstep, const int skip_band); diff --git a/source/source_io/read_wfc_nao.h b/source/source_io/read_wfc_nao.h index 370071f04b..e0993d2482 100644 --- a/source/source_io/read_wfc_nao.h +++ b/source/source_io/read_wfc_nao.h @@ -44,6 +44,7 @@ bool read_wfc_nao( const std::vector &ik2iktot, const int nkstot, const int nspin, + const int nstep = -1, const int skip_band = 0); } // namespace ModuleIO diff --git a/source/source_io/td_current_io.cpp b/source/source_io/td_current_io.cpp index 0e4c62d4bd..9de2b8d7bb 100644 --- a/source/source_io/td_current_io.cpp +++ b/source/source_io/td_current_io.cpp @@ -10,30 +10,210 @@ #include "source_estate/module_dm/cal_dm_psi.h" #include "source_estate/module_pot/H_TDDFT_pw.h" #include "source_lcao/LCAO_domain.h" -#include "source_lcao/module_rt/td_current.h" -#include "source_lcao/module_rt/td_velocity.h" +#include "source_lcao/module_rt/td_info.h" #include "source_pw/module_pwdft/global.h" #include "source_io/module_parameter/parameter.h" #ifdef __LCAO +void ModuleIO::cal_tmp_DM(const UnitCell& ucell, + elecstate::DensityMatrix, double>& DM_real, + elecstate::DensityMatrix, double>& DM_imag, + int nspin_dm) +{ + ModuleBase::TITLE("ModuleIO", "cal_tmp_DM"); + ModuleBase::timer::tick("ModuleIO", "cal_tmp_DM"); + for (int is = 1; is <= nspin_dm; ++is) + { + for (int ik = 0; ik < DM_real.get_DMK_nks() / nspin_dm; ++ik) + { + cal_tmp_DM_k(ucell, DM_real, DM_imag, ik, nspin_dm, is, false); + } + } + ModuleBase::timer::tick("ModuleIO", "cal_tmp_DM"); +} +template +void ModuleIO::write_current(const UnitCell& ucell, + const int istep, + const psi::Psi>* psi, + const elecstate::ElecState* pelec, + const K_Vectors& kv, + const TwoCenterIntegrator* intor, + const Parallel_Orbitals* pv, + const LCAO_Orbitals& orb, + const Velocity_op* cal_current, + Record_adj& ra) +{ + + ModuleBase::TITLE("ModuleIO", "write_current"); + ModuleBase::timer::tick("ModuleIO", "write_current"); + std::vector>*> current_term = {nullptr, nullptr, nullptr}; + if (PARAM.inp.td_stype!=1) + { + for (int dir = 0; dir < 3; dir++) + { + current_term[dir] = cal_current->get_current_term_pointer(dir); + } + } + else + { + if (TD_info::td_vel_op == nullptr) + { + ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gague infos is null!"); + } + for (int dir = 0; dir < 3; dir++) + { + current_term[dir] = TD_info::td_vel_op->get_current_term_pointer(dir); + } + } + double omega=ucell.omega; + // construct a DensityMatrix object + // Since the function cal_dm_psi do not suport DMR in complex type, I replace it with two DMR in double type. Should + // be refactored in the future. + const int nspin0 = PARAM.inp.nspin; + const int nspin_dm = std::map({ {1,1},{2,2},{4,1} })[nspin0]; + elecstate::DensityMatrix, double> DM_real(pv, nspin_dm, kv.kvec_d, kv.get_nks() / nspin_dm); + elecstate::DensityMatrix, double> DM_imag(pv, nspin_dm, kv.kvec_d, kv.get_nks() / nspin_dm); + // calculate DMK + elecstate::cal_dm_psi(DM_real.get_paraV_pointer(), pelec->wg, psi[0], DM_real); + + // init DMR + DM_real.init_DMR(ra, &ucell); + DM_imag.init_DMR(ra, &ucell); + cal_tmp_DM(ucell, DM_real, DM_imag, nspin_dm); + //DM_real.sum_DMR_spin(); + //DM_imag.sum_DMR_spin(); + + double current_total[3] = {0.0, 0.0, 0.0}; +#ifdef _OPENMP +#pragma omp parallel + { + double local_current[3] = {0.0, 0.0, 0.0}; +#else + // ModuleBase::matrix& local_soverlap = soverlap; + double* local_current = current_total; +#endif + ModuleBase::Vector3 tau1, dtau, tau2; + +#ifdef _OPENMP +#pragma omp for schedule(dynamic) +#endif + for (int iat = 0; iat < ucell.nat; iat++) + { + const int T1 = ucell.iat2it[iat]; + Atom* atom1 = &ucell.atoms[T1]; + const int I1 = ucell.iat2ia[iat]; + // get iat1 + int iat1 = ucell.itia2iat(T1, I1); + const int start1 = ucell.itiaiw2iwt(T1, I1, 0); + for (int cb = 0; cb < ra.na_each[iat]; ++cb) + { + const int T2 = ra.info[iat][cb][3]; + const int I2 = ra.info[iat][cb][4]; + + const int start2 = ucell.itiaiw2iwt(T2, I2, 0); + + Atom* atom2 = &ucell.atoms[T2]; + + // get iat2 + int iat2 = ucell.itia2iat(T2, I2); + double Rx = ra.info[iat][cb][0]; + double Ry = ra.info[iat][cb][1]; + double Rz = ra.info[iat][cb][2]; + //std::cout<< "iat1: " << iat1 << " iat2: " << iat2 << " Rx: " << Rx << " Ry: " << Ry << " Rz:" << Rz << std::endl; + // get BaseMatrix + hamilt::BaseMatrix* tmp_matrix_real + = DM_real.get_DMR_pointer(1)->find_matrix(iat1, iat2, Rx, Ry, Rz); + hamilt::BaseMatrix* tmp_matrix_imag + = DM_imag.get_DMR_pointer(1)->find_matrix(iat1, iat2, Rx, Ry, Rz); + // refactor + hamilt::BaseMatrix>* tmp_m_rvx + = current_term[0]->find_matrix(iat1, iat2, Rx, Ry, Rz); + hamilt::BaseMatrix>* tmp_m_rvy + = current_term[1]->find_matrix(iat1, iat2, Rx, Ry, Rz); + hamilt::BaseMatrix>* tmp_m_rvz + = current_term[2]->find_matrix(iat1, iat2, Rx, Ry, Rz); + if (tmp_matrix_real == nullptr) + { + continue; + } + int row_ap = pv->atom_begin_row[iat1]; + int col_ap = pv->atom_begin_col[iat2]; + // get DMR + for (int mu = 0; mu < pv->get_row_size(iat1); ++mu) + { + for (int nu = 0; nu < pv->get_col_size(iat2); ++nu) + { + double dm2d1_real = tmp_matrix_real->get_value(mu, nu); + double dm2d1_imag = tmp_matrix_imag->get_value(mu, nu); + + std::complex rvx = {0, 0}; + std::complex rvy = {0, 0}; + std::complex rvz = {0, 0}; + + if (tmp_m_rvx != nullptr) + { + rvx = tmp_m_rvx->get_value(mu, nu); + rvy = tmp_m_rvy->get_value(mu, nu); + rvz = tmp_m_rvz->get_value(mu, nu); + } + //std::cout<<"mu: "<< mu <<" nu: "<< nu << std::endl; + // std::cout<<"dm2d1_real: "<< dm2d1_real << " dm2d1_imag: "<< dm2d1_imag << std::endl; + //std::cout<<"rvz: "<< rvz.real() << " " << rvz.imag() << std::endl; + local_current[0] -= dm2d1_real * rvx.real() - dm2d1_imag * rvx.imag(); + local_current[1] -= dm2d1_real * rvy.real() - dm2d1_imag * rvy.imag(); + local_current[2] -= dm2d1_real * rvz.real() - dm2d1_imag * rvz.imag(); + } // end kk + } // end jj + } // end cb + } // end iat +#ifdef _OPENMP +#pragma omp critical(cal_current_k_reduce) + { + for (int i = 0; i < 3; ++i) + { + current_total[i] += local_current[i]; + } + } + } +#endif + Parallel_Reduce::reduce_all(current_total, 3); + // write end + if (GlobalV::MY_RANK == 0) + { + std::string filename = PARAM.globalv.global_out_dir + "current_total.dat"; + std::ofstream fout; + fout.open(filename, std::ios::app); + fout << std::setprecision(16); + fout << std::scientific; + fout << istep << " " << current_total[0]/omega << " " << current_total[1]/omega << " " << current_total[2]/omega << std::endl; + fout.close(); + } -void ModuleIO::cal_tmp_DM(elecstate::DensityMatrix, double>& DM_real, + ModuleBase::timer::tick("ModuleIO", "write_current"); + return; +} +void ModuleIO::cal_tmp_DM_k(const UnitCell& ucell, + elecstate::DensityMatrix, double>& DM_real, elecstate::DensityMatrix, double>& DM_imag, const int ik, const int nspin, - const int is) + const int is, + const bool reset) { - ModuleBase::TITLE("ModuleIO", "cal_tmp_DM"); - ModuleBase::timer::tick("ModuleIO", "cal_tmp_DM"); + ModuleBase::TITLE("ModuleIO", "cal_tmp_DM_k"); + ModuleBase::timer::tick("ModuleIO", "cal_tmp_DM_k"); int ld_hk = DM_real.get_paraV_pointer()->nrow; int ld_hk2 = 2 * ld_hk; // tmp for is int ik_begin = DM_real.get_DMK_nks() / nspin * (is - 1); // jump nk for spin_down if nspin==2 - - hamilt::HContainer* tmp_DMR_real = DM_real.get_DMR_vector()[is - 1]; - hamilt::HContainer* tmp_DMR_imag = DM_imag.get_DMR_vector()[is - 1]; - tmp_DMR_real->set_zero(); - tmp_DMR_imag->set_zero(); + //sum spin up and down into up + hamilt::HContainer* tmp_DMR_real = DM_real.get_DMR_vector()[0]; + hamilt::HContainer* tmp_DMR_imag = DM_imag.get_DMR_vector()[0]; + if(reset) + { + tmp_DMR_real->set_zero(); + tmp_DMR_imag->set_zero(); + } #ifdef _OPENMP #pragma omp parallel for #endif @@ -46,6 +226,12 @@ void ModuleIO::cal_tmp_DM(elecstate::DensityMatrix, double> // get global indexes of whole matrix for each atom in this process int row_ap = DM_real.get_paraV_pointer()->atom_begin_row[iat1]; int col_ap = DM_real.get_paraV_pointer()->atom_begin_col[iat2]; + // SOC + std::vector> tmp_DMR; + if (PARAM.inp.nspin == 4) + { + tmp_DMR.resize(tmp_ap_real.get_size()); + } for (int ir = 0; ir < tmp_ap_real.get_R_size(); ++ir) { const ModuleBase::Vector3 r_index = tmp_ap_real.get_R_index(ir); @@ -61,10 +247,20 @@ void ModuleIO::cal_tmp_DM(elecstate::DensityMatrix, double> // only ik if (PARAM.inp.nspin != 4) { + double arg_td = 0.0; + if(elecstate::H_TDDFT_pw::stype == 2) + { + //cal tddft phase for hybrid gague + const int iat1 = tmp_ap_real.get_atom_i(); + const int iat2 = tmp_ap_real.get_atom_j(); + ModuleBase::Vector3 dtau = ucell.cal_dtau(iat1, iat2, r_index); + double& tmp_lat0 = ucell.lat0; + arg_td = TD_info::td_vel_op->cart_At * dtau * tmp_lat0; + } // cal k_phase // if TK==std::complex, kphase is e^{ikR} const ModuleBase::Vector3 dR(r_index.x, r_index.y, r_index.z); - const double arg = (DM_real.get_kvec_d()[ik] * dR) * ModuleBase::TWO_PI; + const double arg = (DM_real.get_kvec_d()[ik] * dR) * ModuleBase::TWO_PI + arg_td; double sinp, cosp; ModuleBase::libm::sincos(arg, &sinp, &cosp); std::complex kphase = std::complex(cosp, sinp); @@ -112,13 +308,97 @@ void ModuleIO::cal_tmp_DM(elecstate::DensityMatrix, double> tmp_DMR_imag_pointer += DM_imag.get_paraV_pointer()->get_col_size(iat2); } } + // treat DMR as pauli matrix when NSPIN=4 + if (PARAM.inp.nspin == 4) + { + tmp_DMR.assign(tmp_ap_real.get_size(), std::complex(0.0, 0.0)); + { + // cal k_phase + // if TK==std::complex, kphase is e^{ikR} + const ModuleBase::Vector3 dR(r_index.x, r_index.y, r_index.z); + double arg_td = 0.0; + if(elecstate::H_TDDFT_pw::stype == 2) + { + //new + //cal tddft phase for mixing gague + const int iat1 = tmp_ap_real.get_atom_i(); + const int iat2 = tmp_ap_real.get_atom_j(); + ModuleBase::Vector3 dtau = ucell.cal_dtau(iat1, iat2, r_index); + double& tmp_lat0 = ucell.lat0; + arg_td = TD_info::td_vel_op->cart_At * dtau * tmp_lat0; + } + const double arg = (DM_real.get_kvec_d()[ik] * dR) * ModuleBase::TWO_PI + arg_td; + double sinp, cosp; + ModuleBase::libm::sincos(arg, &sinp, &cosp); + std::complex kphase = std::complex(cosp, sinp); + // set DMR element + std::complex* tmp_DMR_pointer = tmp_DMR.data(); + std::complex* tmp_DMK_pointer = DM_real.get_DMK_pointer(ik + ik_begin);; + double* DMK_real_pointer = nullptr; + double* DMK_imag_pointer = nullptr; + // jump DMK to fill DMR + // DMR is row-major, DMK is column-major + tmp_DMK_pointer += col_ap * DM_real.get_paraV_pointer()->nrow + row_ap; + for (int mu = 0; mu < tmp_ap_real.get_row_size(); ++mu) + { + BlasConnector::axpy(tmp_ap_real.get_col_size(), + kphase, + tmp_DMK_pointer, + ld_hk, + tmp_DMR_pointer, + 1); + tmp_DMK_pointer += 1; + tmp_DMR_pointer += tmp_ap_real.get_col_size(); + } + } + int npol = 2; + // step_trace = 0 for NSPIN=1,2; ={0, 1, local_col, local_col+1} for NSPIN=4 + int step_trace[4]; + for (int is = 0; is < npol; is++) + { + for (int is2 = 0; is2 < npol; is2++) + { + step_trace[is * npol + is2] = tmp_ap_real.get_col_size() * is + is2; + } + } + std::complex tmp[4]; + double* target_DMR_real = tmp_matrix_real->get_pointer(); + double* target_DMR_imag = tmp_matrix_imag->get_pointer(); + std::complex* tmp_DMR_pointer = tmp_DMR.data(); + for (int irow = 0; irow < tmp_ap_real.get_row_size(); irow += 2) + { + for (int icol = 0; icol < tmp_ap_real.get_col_size(); icol += 2) + { + // catch the 4 spin component value of one orbital pair + tmp[0] = tmp_DMR_pointer[icol + step_trace[0]]; + tmp[1] = tmp_DMR_pointer[icol + step_trace[1]]; + tmp[2] = tmp_DMR_pointer[icol + step_trace[2]]; + tmp[3] = tmp_DMR_pointer[icol + step_trace[3]]; + // transfer to Pauli matrix and save the real part + // save them back to the tmp_matrix + target_DMR_real[icol + step_trace[0]] += tmp[0].real() + tmp[3].real(); + target_DMR_real[icol + step_trace[1]] += tmp[1].real() + tmp[2].real(); + target_DMR_real[icol + step_trace[2]] + += -tmp[1].imag() + tmp[2].imag(); // (i * (rho_updown - rho_downup)).real() + target_DMR_real[icol + step_trace[3]] += tmp[0].real() - tmp[3].real(); + //imag part + target_DMR_imag[icol + step_trace[0]] += tmp[0].imag() + tmp[3].imag(); + target_DMR_imag[icol + step_trace[1]] += tmp[1].imag() + tmp[2].imag(); + target_DMR_imag[icol + step_trace[2]] + += tmp[1].real() - tmp[2].real(); // (i * (rho_updown - rho_downup)).real() + target_DMR_imag[icol + step_trace[3]] += tmp[0].imag() - tmp[3].imag(); + } + tmp_DMR_pointer += tmp_ap_real.get_col_size() * 2; + target_DMR_real += tmp_ap_real.get_col_size() * 2; + target_DMR_imag += tmp_ap_real.get_col_size() * 2; + } + } } } - ModuleBase::timer::tick("ModuleIO", "cal_tmp_DM"); + ModuleBase::timer::tick("ModuleIO", "cal_tmp_DM_k"); } - -void ModuleIO::write_current(const UnitCell& ucell, - const Grid_Driver& gd, +template +void ModuleIO::write_current_eachk(const UnitCell& ucell, const int istep, const psi::Psi>* psi, const elecstate::ElecState* pelec, @@ -126,19 +406,15 @@ void ModuleIO::write_current(const UnitCell& ucell, const TwoCenterIntegrator* intor, const Parallel_Orbitals* pv, const LCAO_Orbitals& orb, + const Velocity_op* cal_current, Record_adj& ra) { + ModuleBase::TITLE("ModuleIO", "write_current"); ModuleBase::timer::tick("ModuleIO", "write_current"); - - TD_current* cal_current = nullptr; std::vector>*> current_term = {nullptr, nullptr, nullptr}; - - if (!TD_Velocity::tddft_velocity) + if (PARAM.inp.td_stype != 1) { - cal_current = new TD_current(&ucell, &gd, pv, orb, intor); - cal_current->calculate_vcomm_r(); - cal_current->calculate_grad_term(); for (int dir = 0; dir < 3; dir++) { current_term[dir] = cal_current->get_current_term_pointer(dir); @@ -146,16 +422,16 @@ void ModuleIO::write_current(const UnitCell& ucell, } else { - if (TD_Velocity::td_vel_op == nullptr) + if (TD_info::td_vel_op == nullptr) { - ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gauge infos is null!"); + ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gague infos is null!"); } for (int dir = 0; dir < 3; dir++) { - current_term[dir] = TD_Velocity::td_vel_op->get_current_term_pointer(dir); + current_term[dir] = TD_info::td_vel_op->get_current_term_pointer(dir); } } - + double omega=ucell.omega; // construct a DensityMatrix object // Since the function cal_dm_psi do not suport DMR in complex type, // I replace it with two DMR in double type. @@ -163,10 +439,8 @@ void ModuleIO::write_current(const UnitCell& ucell, const int nspin0 = PARAM.inp.nspin; const int nspin_dm = std::map({ {1,1},{2,2},{4,1} })[nspin0]; - elecstate::DensityMatrix, double> DM_real(pv, nspin_dm, kv.kvec_d, kv.get_nks() / nspin_dm); elecstate::DensityMatrix, double> DM_imag(pv, nspin_dm, kv.kvec_d, kv.get_nks() / nspin_dm); - // calculate DMK elecstate::cal_dm_psi(DM_real.get_paraV_pointer(), pelec->wg, psi[0], DM_real); @@ -174,32 +448,23 @@ void ModuleIO::write_current(const UnitCell& ucell, DM_real.init_DMR(ra, &ucell); DM_imag.init_DMR(ra, &ucell); - int nks = DM_real.get_DMK_nks(); - if (nspin0 == 2) - { - nks /= 2; - } - + int nks = DM_real.get_DMK_nks() / nspin_dm; double current_total[3] = {0.0, 0.0, 0.0}; - for (int is = 1; is <= nspin0; ++is) + for (int is = 1; is <= nspin_dm; ++is) { for (int ik = 0; ik < nks; ++ik) { - cal_tmp_DM(DM_real, DM_imag, ik, nspin0, is); + cal_tmp_DM_k(ucell, DM_real, DM_imag, ik, nspin_dm, is); // check later double current_ik[3] = {0.0, 0.0, 0.0}; - int total_irr = 0; - #ifdef _OPENMP #pragma omp parallel { int num_threads = omp_get_num_threads(); double local_current_ik[3] = {0.0, 0.0, 0.0}; - int local_total_irr = 0; #else // ModuleBase::matrix& local_soverlap = soverlap; double* local_current_ik = current_ik; - int& local_total_irr = total_irr; #endif ModuleBase::Vector3 tau1, dtau, tau2; @@ -214,8 +479,6 @@ void ModuleIO::write_current(const UnitCell& ucell, const int I1 = ucell.iat2ia[iat]; // get iat1 int iat1 = ucell.itia2iat(T1, I1); - - int irr = pv->nlocstart[iat]; const int start1 = ucell.itiaiw2iwt(T1, I1, 0); for (int cb = 0; cb < ra.na_each[iat]; ++cb) { @@ -231,13 +494,12 @@ void ModuleIO::write_current(const UnitCell& ucell, double Rx = ra.info[iat][cb][0]; double Ry = ra.info[iat][cb][1]; double Rz = ra.info[iat][cb][2]; - + //std::cout<< "iat1: " << iat1 << " iat2: " << iat2 << " Rx: " << Rx << " Ry: " << Ry << " Rz:" << Rz << std::endl; // get BaseMatrix hamilt::BaseMatrix* tmp_matrix_real = DM_real.get_DMR_pointer(is)->find_matrix(iat1, iat2, Rx, Ry, Rz); hamilt::BaseMatrix* tmp_matrix_imag = DM_imag.get_DMR_pointer(is)->find_matrix(iat1, iat2, Rx, Ry, Rz); - // refactor hamilt::BaseMatrix>* tmp_m_rvx = current_term[0]->find_matrix(iat1, iat2, Rx, Ry, Rz); @@ -245,15 +507,12 @@ void ModuleIO::write_current(const UnitCell& ucell, = current_term[1]->find_matrix(iat1, iat2, Rx, Ry, Rz); hamilt::BaseMatrix>* tmp_m_rvz = current_term[2]->find_matrix(iat1, iat2, Rx, Ry, Rz); - if (tmp_matrix_real == nullptr) { continue; } - int row_ap = pv->atom_begin_row[iat1]; int col_ap = pv->atom_begin_col[iat2]; - // get DMR for (int mu = 0; mu < pv->get_row_size(iat1); ++mu) { @@ -272,12 +531,12 @@ void ModuleIO::write_current(const UnitCell& ucell, rvy = tmp_m_rvy->get_value(mu, nu); rvz = tmp_m_rvz->get_value(mu, nu); } - local_current_ik[0] -= dm2d1_real * rvx.real() - dm2d1_imag * rvx.imag(); + // std::cout<<"mu: "<< mu <<" nu: "<< nu << std::endl; + // std::cout<<"dm2d1_real: "<< dm2d1_real << " dm2d1_imag: "<< dm2d1_imag << std::endl; + // std::cout<<"rvz: "<< rvz.real() << " " << rvz.imag() << std::endl; + local_current_ik[0] -= dm2d1_real * rvx.real() - dm2d1_imag * rvx.imag(); local_current_ik[1] -= dm2d1_real * rvy.real() - dm2d1_imag * rvy.imag(); local_current_ik[2] -= dm2d1_real * rvz.real() - dm2d1_imag * rvz.imag(); - - ++local_total_irr; - ++irr; } // end kk } // end jj } // end cb @@ -285,7 +544,6 @@ void ModuleIO::write_current(const UnitCell& ucell, #ifdef _OPENMP #pragma omp critical(cal_current_k_reduce) { - total_irr += local_total_irr; for (int i = 0; i < 3; ++i) { current_ik[i] += local_current_ik[i]; @@ -298,9 +556,8 @@ void ModuleIO::write_current(const UnitCell& ucell, { current_total[i] += current_ik[i]; } - // MPI_Reduce(local_current_ik, current_ik, 3, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD); - if (GlobalV::MY_RANK == 0 && TD_Velocity::out_current_k) + if (GlobalV::MY_RANK == 0 && TD_info::out_current_k) { std::string filename = PARAM.globalv.global_out_dir + "current_spin" + std::to_string(is) + "_ik" + std::to_string(ik) + ".dat"; @@ -308,7 +565,7 @@ void ModuleIO::write_current(const UnitCell& ucell, fout.open(filename, std::ios::app); fout << std::setprecision(16); fout << std::scientific; - fout << istep << " " << current_ik[0] << " " << current_ik[1] << " " << current_ik[2] << std::endl; + fout << istep << " " << current_ik[0]/omega << " " << current_ik[1]/omega << " " << current_ik[2]/omega << std::endl; fout.close(); } // write end @@ -321,15 +578,57 @@ void ModuleIO::write_current(const UnitCell& ucell, fout.open(filename, std::ios::app); fout << std::setprecision(16); fout << std::scientific; - fout << istep << " " << current_total[0] << " " << current_total[1] << " " << current_total[2] << std::endl; + fout << istep << " " << current_total[0]/omega << " " << current_total[1]/omega << " " << current_total[2]/omega << std::endl; fout.close(); } - if (!TD_Velocity::tddft_velocity) - { - delete cal_current; - } ModuleBase::timer::tick("ModuleIO", "write_current"); return; } +template +void ModuleIO::write_current_eachk( + const UnitCell& ucell, + const int istep, + const psi::Psi>* psi, + const elecstate::ElecState* pelec, + const K_Vectors& kv, + const TwoCenterIntegrator* intor, + const Parallel_Orbitals* pv, + const LCAO_Orbitals& orb, + const Velocity_op* cal_current, + Record_adj& ra); +template +void ModuleIO::write_current_eachk>(const UnitCell& ucell, + const int istep, + const psi::Psi>* psi, + const elecstate::ElecState* pelec, + const K_Vectors& kv, + const TwoCenterIntegrator* intor, + const Parallel_Orbitals* pv, + const LCAO_Orbitals& orb, + const Velocity_op>* cal_current, + Record_adj& ra); +template +void ModuleIO::write_current(const UnitCell& ucell, + const int istep, + const psi::Psi>* psi, + const elecstate::ElecState* pelec, + const K_Vectors& kv, + const TwoCenterIntegrator* intor, + const Parallel_Orbitals* pv, + const LCAO_Orbitals& orb, + const Velocity_op* cal_current, + Record_adj& ra); +template +void ModuleIO::write_current>(const UnitCell& ucell, + const int istep, + const psi::Psi>* psi, + const elecstate::ElecState* pelec, + const K_Vectors& kv, + const TwoCenterIntegrator* intor, + const Parallel_Orbitals* pv, + const LCAO_Orbitals& orb, + const Velocity_op>* cal_current, + Record_adj& ra); #endif //__LCAO + diff --git a/source/source_io/td_current_io.h b/source/source_io/td_current_io.h index 5f1424c3b8..7872858c72 100644 --- a/source/source_io/td_current_io.h +++ b/source/source_io/td_current_io.h @@ -5,30 +5,49 @@ #include "source_estate/elecstate_lcao.h" #include "source_estate/module_dm/density_matrix.h" #include "source_psi/psi.h" +#include "source_lcao/module_rt/velocity_op.h" namespace ModuleIO { #ifdef __LCAO /// @brief func to output current, only used in tddft +template +void write_current_eachk(const UnitCell& ucell, + const int istep, + const psi::Psi>* psi, + const elecstate::ElecState* pelec, + const K_Vectors& kv, + const TwoCenterIntegrator* intor, + const Parallel_Orbitals* pv, + const LCAO_Orbitals& orb, + const Velocity_op* cal_current, + Record_adj& ra); +template void write_current(const UnitCell& ucell, - const Grid_Driver& gd, - const int istep, - const psi::Psi>* psi, - const elecstate::ElecState* pelec, - const K_Vectors& kv, - const TwoCenterIntegrator* intor, - const Parallel_Orbitals* pv, - const LCAO_Orbitals& orb, - Record_adj& ra); + const int istep, + const psi::Psi>* psi, + const elecstate::ElecState* pelec, + const K_Vectors& kv, + const TwoCenterIntegrator* intor, + const Parallel_Orbitals* pv, + const LCAO_Orbitals& orb, + const Velocity_op* cal_current, + Record_adj& ra); /// @brief calculate sum_n[𝜌_(𝑛𝑘,𝜇𝜈)] for current calculation -void cal_tmp_DM(elecstate::DensityMatrix, double>& DM_real, +void cal_tmp_DM_k(const UnitCell& ucell, + elecstate::DensityMatrix, double>& DM_real, elecstate::DensityMatrix, double>& DM_imag, const int ik, const int nspin, - const int is); + const int is, + const bool reset = true); + +void cal_tmp_DM(const UnitCell& ucell, + elecstate::DensityMatrix, double>& DM_real, + elecstate::DensityMatrix, double>& DM_imag, + const int nspin); #endif // __LCAO } // namespace ModuleIO - -#endif +#endif // W_ABACUS_DEVELOP_ABACUS_DEVELOP_SOURCE_MODULE_IO_TD_CURRENT_IO_H diff --git a/source/source_io/write_HS_sparse.cpp b/source/source_io/write_HS_sparse.cpp index d3d34bc25a..505933ad0d 100644 --- a/source/source_io/write_HS_sparse.cpp +++ b/source/source_io/write_HS_sparse.cpp @@ -3,7 +3,7 @@ #include "source_io/module_parameter/parameter.h" #include "source_base/parallel_reduce.h" #include "source_base/timer.h" -#include "source_lcao/module_rt/td_velocity.h" +#include "source_lcao/module_rt/td_info.h" #include "source_pw/module_pwdft/global.h" #include "single_R_io.h" @@ -48,12 +48,12 @@ void ModuleIO::save_HSR_sparse(const int& istep, for (auto& R_coor: all_R_coor_ptr) { if (PARAM.inp.nspin != 4) { for (int ispin = 0; ispin < spin_loop; ++ispin) { - if (TD_Velocity::tddft_velocity) { + if (PARAM.inp.esolver_type == "tddft" && PARAM.inp.td_stype == 1) { auto iter - = TD_Velocity::td_vel_op->HR_sparse_td_vel[ispin].find( + = TD_info::td_vel_op->HR_sparse_td_vel[ispin].find( R_coor); if (iter - != TD_Velocity::td_vel_op->HR_sparse_td_vel[ispin] + != TD_info::td_vel_op->HR_sparse_td_vel[ispin] .end()) { for (auto& row_loop: iter->second) { H_nonzero_num[ispin][count] @@ -254,9 +254,9 @@ void ModuleIO::save_HSR_sparse(const int& istep, // } } else { if (PARAM.inp.nspin != 4) { - if (TD_Velocity::tddft_velocity) { + if (PARAM.inp.esolver_type == "tddft" && PARAM.inp.td_stype == 1) { output_single_R(g1[ispin], - TD_Velocity::td_vel_op + TD_info::td_vel_op ->HR_sparse_td_vel[ispin][R_coor], sparse_thr, binary, diff --git a/source/source_io/write_wfc_nao.cpp b/source/source_io/write_wfc_nao.cpp index 78efb862f7..2efb05f169 100644 --- a/source/source_io/write_wfc_nao.cpp +++ b/source/source_io/write_wfc_nao.cpp @@ -269,7 +269,16 @@ void write_wfc_nao(const int out_type, if (myid == 0) { - std::string fn = filename_output(PARAM.globalv.global_out_dir,"wf","nao",ik,ik2iktot,nspin,nkstot, + std::string wfc_dir; + if(out_app_flag) + { + wfc_dir = PARAM.globalv.global_out_dir; + } + else + { + wfc_dir = PARAM.globalv.global_wfc_dir; + } + std::string fn = filename_output(wfc_dir,"wf","nao",ik,ik2iktot,nspin,nkstot, out_type,out_app_flag,gamma_only,istep); bool append_flag = (istep > 0 && out_app_flag); diff --git a/source/source_lcao/CMakeLists.txt b/source/source_lcao/CMakeLists.txt index cf793d3b65..da170bbb73 100644 --- a/source/source_lcao/CMakeLists.txt +++ b/source/source_lcao/CMakeLists.txt @@ -19,6 +19,7 @@ if(ENABLE_LCAO) module_operator_lcao/nonlocal_new.cpp module_operator_lcao/td_ekinetic_lcao.cpp module_operator_lcao/td_nonlocal_lcao.cpp + module_operator_lcao/td_pot_hybrid.cpp module_operator_lcao/dspin_lcao.cpp module_operator_lcao/dftu_lcao.cpp pulay_force_stress_center2.cpp diff --git a/source/source_lcao/hamilt_lcao.cpp b/source/source_lcao/hamilt_lcao.cpp index 85e613bdaf..c0b60e8331 100644 --- a/source/source_lcao/hamilt_lcao.cpp +++ b/source/source_lcao/hamilt_lcao.cpp @@ -38,6 +38,7 @@ #include "module_operator_lcao/overlap_new.h" #include "module_operator_lcao/td_ekinetic_lcao.h" #include "module_operator_lcao/td_nonlocal_lcao.h" +#include "module_operator_lcao/td_pot_hybrid.h" #include "module_operator_lcao/veff_lcao.h" namespace hamilt @@ -344,12 +345,8 @@ HamiltLCAO::HamiltLCAO(Gint_Gamma* GG_in, } #endif // TDDFT_velocity_gauge - if (TD_Velocity::tddft_velocity) + if (PARAM.inp.esolver_type == "tddft" && PARAM.inp.td_stype == 1) { - if (!TD_Velocity::init_vecpot_file) - { - elecstate::H_TDDFT_pw::update_At(); - } Operator* td_ekinetic = new TDEkinetic>(this->hsk, this->hR, this->kv, @@ -359,10 +356,27 @@ HamiltLCAO::HamiltLCAO(Gint_Gamma* GG_in, two_center_bundle.overlap_orb.get()); this->getOperator()->add(td_ekinetic); - Operator* td_nonlocal - = new TDNonlocal>(this->hsk, this->kv->kvec_d, this->hR, &ucell, orb, &grid_d); + Operator* td_nonlocal = new TDNonlocal>(this->hsk, + this->kv->kvec_d, + this->hR, + &ucell, + orb, + &grid_d); this->getOperator()->add(td_nonlocal); } + if (PARAM.inp.esolver_type == "tddft" && PARAM.inp.td_stype == 2) + { + Operator* td_pot_hybrid = new TD_pot_hybrid>(this->hsk, + this->kv, + this->hR, + this->sR, + orb, + &ucell, + orb.cutoffs(), + &grid_d, + two_center_bundle.kinetic_orb.get()); + this->getOperator()->add(td_pot_hybrid); + } if (PARAM.inp.dft_plus_u) { Operator* dftu = nullptr; diff --git a/source/source_lcao/module_operator_lcao/CMakeLists.txt b/source/source_lcao/module_operator_lcao/CMakeLists.txt index 2e1afc328e..0e49a9dc43 100644 --- a/source/source_lcao/module_operator_lcao/CMakeLists.txt +++ b/source/source_lcao/module_operator_lcao/CMakeLists.txt @@ -11,6 +11,7 @@ add_library( nonlocal_new.cpp td_ekinetic_lcao.cpp td_nonlocal_lcao.cpp + td_pot_hybrid.cpp dspin_lcao.cpp dftu_lcao.cpp ) diff --git a/source/source_lcao/module_operator_lcao/operator_lcao.cpp b/source/source_lcao/module_operator_lcao/operator_lcao.cpp index 3827dbe8bd..82eae42192 100644 --- a/source/source_lcao/module_operator_lcao/operator_lcao.cpp +++ b/source/source_lcao/module_operator_lcao/operator_lcao.cpp @@ -12,6 +12,8 @@ #include "source_hsolver/diago_elpa_native.h" #endif +#include "source_lcao/module_rt/td_info.h" + namespace hamilt { template <> @@ -200,7 +202,7 @@ void OperatorLCAO::init(const int ik_in) { break; } - case calculation_type::lcao_tddft_velocity: { + case calculation_type::lcao_tddft_periodic: { if (!this->hr_done) { // in cal_type=lcao_fixed, HR should be updated by each sub-chain // nodes @@ -240,8 +242,8 @@ void OperatorLCAO::init(const int ik_in) { } // contributeHk() -template -void OperatorLCAO::contributeHk(int ik) { +template <> +void OperatorLCAO::contributeHk(int ik) { ModuleBase::TITLE("OperatorLCAO", "contributeHk"); ModuleBase::timer::tick("OperatorLCAO", "contributeHk"); if(ModuleBase::GlobalFunc::IS_COLUMN_MAJOR_KS_SOLVER(PARAM.inp.ks_solver)) @@ -256,6 +258,37 @@ void OperatorLCAO::contributeHk(int ik) { } ModuleBase::timer::tick("OperatorLCAO", "contributeHk"); } +// contributeHk() +template +void OperatorLCAO::contributeHk(int ik) { + ModuleBase::TITLE("OperatorLCAO", "contributeHk"); + ModuleBase::timer::tick("OperatorLCAO", "contributeHk"); + if(ModuleBase::GlobalFunc::IS_COLUMN_MAJOR_KS_SOLVER(PARAM.inp.ks_solver)) + { + const int nrow = this->hsk->get_pv()->get_row_size(); + if(PARAM.inp.td_stype == 2) + { + TD_info::td_vel_op->folding_HR_td(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], nrow, 1); + } + else + { + hamilt::folding_HR(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], nrow, 1); + } + } + else + { + const int ncol = this->hsk->get_pv()->get_col_size(); + if(PARAM.inp.td_stype == 2) + { + TD_info::td_vel_op->folding_HR_td(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], ncol, 0); + } + else + { + hamilt::folding_HR(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], ncol, 0); + } + } + ModuleBase::timer::tick("OperatorLCAO", "contributeHk"); +} template class OperatorLCAO; template class OperatorLCAO, double>; diff --git a/source/source_lcao/module_operator_lcao/overlap_new.cpp b/source/source_lcao/module_operator_lcao/overlap_new.cpp index e13723c36e..a0c967ba65 100644 --- a/source/source_lcao/module_operator_lcao/overlap_new.cpp +++ b/source/source_lcao/module_operator_lcao/overlap_new.cpp @@ -7,6 +7,7 @@ #include "source_lcao/module_operator_lcao/operator_lcao.h" #include "source_lcao/module_hcontainer/hcontainer_funcs.h" #include +#include "source_lcao/module_rt/td_info.h" template hamilt::OverlapNew>::OverlapNew(HS_Matrix_K* hsk_in, @@ -188,11 +189,11 @@ void hamilt::OverlapNew>::contributeHR() } // contributeHk() -template -void hamilt::OverlapNew>::contributeHk(int ik) +template <> +void hamilt::OverlapNew>::contributeHk(int ik) { //! if k vector is not changed, then do nothing and return, only for gamma_only case - if (this->kvec_d[ik] == this->kvec_d_old && std::is_same::value) + if (this->kvec_d[ik] == this->kvec_d_old) { return; } @@ -217,7 +218,44 @@ void hamilt::OverlapNew>::contributeHk(int ik) ModuleBase::timer::tick("OverlapNew", "contributeHk"); } +template +void hamilt::OverlapNew>::contributeHk(int ik) +{ + ModuleBase::TITLE("OverlapNew", "contributeHk"); + ModuleBase::timer::tick("OverlapNew", "contributeHk"); + + //! set SK to zero and then calculate SK for each k vector + this->hsk->set_zero_sk(); + if (ModuleBase::GlobalFunc::IS_COLUMN_MAJOR_KS_SOLVER(PARAM.inp.ks_solver)) + { + const int nrow = this->SR->get_atom_pair(0).get_paraV()->get_row_size(); + if(PARAM.inp.td_stype == 2) + { + TD_info::td_vel_op->folding_HR_td(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], nrow, 1); + } + else + { + hamilt::folding_HR(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], nrow, 1); + } + } + else + { + const int ncol = this->SR->get_atom_pair(0).get_paraV()->get_col_size(); + if(PARAM.inp.td_stype == 2) + { + TD_info::td_vel_op->folding_HR_td(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], ncol, 0); + } + else + { + hamilt::folding_HR(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], ncol, 0); + } + } + + // update kvec_d_old + this->kvec_d_old = this->kvec_d[ik]; + ModuleBase::timer::tick("OverlapNew", "contributeHk"); +} template TK* hamilt::OverlapNew>::getSk() { diff --git a/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.cpp b/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.cpp index 824dcba37d..c155cd84cc 100644 --- a/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.cpp +++ b/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.cpp @@ -25,9 +25,8 @@ TDEkinetic>::TDEkinetic(HS_Matrix_K* hsk_in, : OperatorLCAO(hsk_in, kv_in->kvec_d, hR_in), orb_cutoff_(orb_cutoff), kv(kv_in), intor_(intor) { this->ucell = ucell_in; - this->cal_type = calculation_type::lcao_tddft_velocity; + this->cal_type = calculation_type::lcao_tddft_periodic; this->Grid = GridD_in; - this->init_td(); // initialize HR to get adjs info. this->initialize_HR(Grid); } @@ -39,28 +38,18 @@ TDEkinetic>::~TDEkinetic() { delete this->hR_tmp; } - TD_Velocity::td_vel_op = nullptr; } // term A^2*S template -void TDEkinetic>::td_ekinetic_scalar(std::complex* Hloc,const TR& overlap, int nnr) -{ - return; -} - -// term A^2*S -template <> -void TDEkinetic, double>>::td_ekinetic_scalar(std::complex* Hloc, - const double& overlap, - int nnr) +void TDEkinetic>::td_ekinetic_scalar(std::complex* Hloc, + const TR& overlap, + int nnr) { // the correction term A^2/2. From Hatree to Ry, it needs to be multiplied by 2.0 - std::complex tmp = {cart_At.norm2() * overlap, 0}; - Hloc[nnr] += tmp; + Hloc[nnr] += cart_At.norm2() * overlap; return; } - // term A dot ∇ template void TDEkinetic>::td_ekinetic_grad(std::complex* Hloc, @@ -106,12 +95,12 @@ void TDEkinetic>::calculate_HR() hamilt::BaseMatrix>* tmp = this->hR_tmp->find_matrix(iat1, iat2, R_index2); if (tmp != nullptr) { - if (TD_Velocity::out_current) + if (TD_info::out_current) { std::complex* tmp_c[3] = {nullptr, nullptr, nullptr}; for (int i = 0; i < 3; i++) { - tmp_c[i] = td_velocity.get_current_term_pointer(i)->find_matrix(iat1, iat2, R_index2)->get_pointer(); + tmp_c[i] = TD_info::td_vel_op->get_current_term_pointer(i)->find_matrix(iat1, iat2, R_index2)->get_pointer(); } this->cal_HR_IJR(iat1, iat2, paraV, dtau, tmp->get_pointer(), tmp_c); } @@ -233,19 +222,12 @@ void TDEkinetic>::cal_HR_IJR(const int& iat1, } } } -// init two center integrals and vector potential for td_ekintic term +//update vector potential for td_ekintic term template -void TDEkinetic>::init_td() +void TDEkinetic>::update_td() { - TD_Velocity::td_vel_op = &td_velocity; - // calculate At in cartesian coorinates. - td_velocity.cal_cart_At(elecstate::H_TDDFT_pw::At); - this->cart_At = td_velocity.cart_At; - - // mohan update 2025-04-20 - ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Ax(t)", cart_At[0]); - ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Ay(t)", cart_At[1]); - ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Az(t)", cart_At[2]); + //std::cout<<"velocity"<cart_At = TD_info::td_vel_op->cart_At; } template @@ -343,7 +325,7 @@ void TDEkinetic>::contributeHR() { return; } - if (!this->hR_tmp_done) + if (!this->hR_tmp_done || TD_info::evolve_once) { const Parallel_Orbitals* paraV = this->hR->get_atom_pair(0).get_paraV(); // if this Operator is the first node of the sub_chain, then hR_tmp is nullptr @@ -360,11 +342,13 @@ void TDEkinetic>::contributeHR() static_cast*>(this->next_sub_op)->set_HR_fixed(this->hR_tmp); } // initialize current term if needed - if (TD_Velocity::out_current) + if (TD_info::out_current) { - td_velocity.initialize_current_term(this->hR_tmp, paraV); + TD_info::td_vel_op->initialize_current_term(this->hR_tmp, paraV); } // calculate the values in hR_tmp + this->update_td(); + this->hR_tmp->set_zero(); this->calculate_HR(); this->hR_tmp_done = true; } @@ -376,12 +360,7 @@ void TDEkinetic>::contributeHR() template void TDEkinetic>::contributeHk(int ik) { - return; -} -template <> -void TDEkinetic, double>>::contributeHk(int ik) -{ - if (TD_Velocity::tddft_velocity == false) + if (PARAM.inp.td_stype != 1) { return; } @@ -392,12 +371,7 @@ void TDEkinetic, double>>::contributeHk(int ik const Parallel_Orbitals* paraV = this->hR_tmp->get_atom_pair(0).get_paraV(); // save HR data for output int spin_tot = PARAM.inp.nspin; - - if (spin_tot == 4) - { - - } - else if (!output_hR_done && TD_Velocity::out_mat_R) + if (!output_hR_done && TD_info::out_mat_R) { for (int spin_now = 0; spin_now < spin_tot; spin_now++) { @@ -405,11 +379,10 @@ void TDEkinetic, double>>::contributeHk(int ik spin_now, 1e-10, *hR_tmp, - td_velocity.HR_sparse_td_vel[spin_now]); + TD_info::td_vel_op->HR_sparse_td_vel[spin_now]); } output_hR_done = true; } - // folding inside HR to HK if (ModuleBase::GlobalFunc::IS_COLUMN_MAJOR_KS_SOLVER(PARAM.inp.ks_solver)) { @@ -426,7 +399,6 @@ void TDEkinetic, double>>::contributeHk(int ik } } -template class TDEkinetic>; template class TDEkinetic, double>>; template class TDEkinetic, std::complex>>; diff --git a/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.h b/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.h index 2377834a78..fba4ccccf8 100644 --- a/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.h +++ b/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.h @@ -5,7 +5,7 @@ #include "source_cell/klist.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" #include "source_lcao/module_hcontainer/hcontainer.h" -#include "source_lcao/module_rt/td_velocity.h" +#include "source_lcao/module_rt/td_info.h" #include "operator_lcao.h" #include @@ -48,8 +48,8 @@ class TDEkinetic> : public OperatorLCAO virtual void contributeHk(int ik) override; - /// @brief init two center integrals and vector potential for td_ekintic term - void init_td(); + /// @brief update vector potential + void update_td(); /** * @brief initialize HR, search the nearest neighbor atoms @@ -83,7 +83,6 @@ class TDEkinetic> : public OperatorLCAO virtual void set_HR_fixed(void*) override; - TD_Velocity td_velocity; private: @@ -124,3 +123,4 @@ class TDEkinetic> : public OperatorLCAO } // namespace hamilt #endif + diff --git a/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.cpp b/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.cpp index 7a3d0b3d35..7743003761 100644 --- a/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.cpp +++ b/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.cpp @@ -22,14 +22,13 @@ hamilt::TDNonlocal>::TDNonlocal(HS_Matrix_K* hs const Grid_Driver* GridD_in) : hamilt::OperatorLCAO(hsk_in, kvec_d_in, hR_in), orb_(orb) { - this->cal_type = calculation_type::lcao_tddft_velocity; + this->cal_type = calculation_type::lcao_tddft_periodic; this->ucell = ucell_in; this->Grid = GridD_in; #ifdef __DEBUG assert(this->ucell != nullptr); #endif // initialize HR to get adjs info. - this->init_td(); this->initialize_HR(Grid); } @@ -43,10 +42,10 @@ hamilt::TDNonlocal>::~TDNonlocal() } } template -void hamilt::TDNonlocal>::init_td() +void hamilt::TDNonlocal>::update_td() { // calculate At in cartesian coorinates. - this->cart_At = TD_Velocity::td_vel_op->cart_At; + this->cart_At = TD_info::td_vel_op->cart_At; } // initialize_HR() template @@ -130,7 +129,7 @@ void hamilt::TDNonlocal>::calculate_HR() const Parallel_Orbitals* paraV = this->hR_tmp->get_atom_pair(0).get_paraV(); const int npol = this->ucell->get_npol(); - const int nlm_dim = TD_Velocity::out_current ? 4 : 1; + const int nlm_dim = TD_info::out_current ? 4 : 1; // 1. calculate for each pair of atoms for (int iat0 = 0; iat0 < this->ucell->nat; iat0++) @@ -182,7 +181,7 @@ void hamilt::TDNonlocal>::calculate_HR() tau0 * this->ucell->lat0, T0, cart_At, - TD_Velocity::out_current); + TD_info::out_current); for (int dir = 0; dir < nlm_dim; dir++) { nlm_tot[ad][dir].insert({all_indexes[iw1l], nlm[dir]}); @@ -245,12 +244,12 @@ void hamilt::TDNonlocal>::calculate_HR() // if not found , skip this pair of atoms if (tmp != nullptr) { - if (TD_Velocity::out_current) + if (TD_info::out_current) { std::complex* tmp_c[3] = {nullptr, nullptr, nullptr}; for (int i = 0; i < 3; i++) { - tmp_c[i] = TD_Velocity::td_vel_op->get_current_term_pointer(i) + tmp_c[i] = TD_info::td_vel_op->get_current_term_pointer(i) ->find_matrix(iat1, iat2, R_vector[0], R_vector[1], R_vector[2]) ->get_pointer(); } @@ -295,7 +294,7 @@ void hamilt::TDNonlocal>::cal_HR_IJR( std::complex* data_pointer, std::complex** data_pointer_c) { - const int nlm_dim = TD_Velocity::out_current ? 4 : 1; + const int nlm_dim = TD_info::out_current ? 4 : 1; // npol is the number of polarizations, // 1 for non-magnetic (one Hamiltonian matrix only has spin-up or spin-down), // 2 for magnetic (one Hamiltonian matrix has both spin-up and spin-down) @@ -411,7 +410,7 @@ void hamilt::TDNonlocal>::contributeHR() ModuleBase::timer::tick("TDNonlocal", "contributeHR"); - if (!this->hR_tmp_done) + if (!this->hR_tmp_done || TD_info::evolve_once) { if (this->hR_tmp == nullptr) { @@ -427,8 +426,10 @@ void hamilt::TDNonlocal>::contributeHR() } // calculate the values in hR_tmp + this->update_td(); this->calculate_HR(); this->hR_tmp_done = true; + TD_info::evolve_once = false; } ModuleBase::timer::tick("TDNonlocal", "contributeHR"); @@ -442,35 +443,5 @@ void hamilt::TDNonlocal>::contributeHk(int ik) return; } - -template <> -void hamilt::TDNonlocal, double>>::contributeHk(int ik) -{ - if (TD_Velocity::tddft_velocity == false) - { - return; - } - else - { - ModuleBase::TITLE("TDNonlocal", "contributeHk"); - ModuleBase::timer::tick("TDNonlocal", "contributeHk"); - - // folding inside HR to HK - if (ModuleBase::GlobalFunc::IS_COLUMN_MAJOR_KS_SOLVER(PARAM.inp.ks_solver)) - { - const int nrow = this->hsk->get_pv()->get_row_size(); - folding_HR(*this->hR_tmp, this->hsk->get_hk(), this->kvec_d[ik], nrow, 1); - } - else - { - const int ncol = this->hsk->get_pv()->get_col_size(); - folding_HR(*this->hR_tmp, this->hsk->get_hk(), this->kvec_d[ik], ncol, 0); - } - - ModuleBase::timer::tick("TDNonlocal", "contributeHk"); - } -} - -template class hamilt::TDNonlocal>; template class hamilt::TDNonlocal, double>>; template class hamilt::TDNonlocal, std::complex>>; diff --git a/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.h b/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.h index 319884bab3..18228b1040 100644 --- a/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.h +++ b/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.h @@ -6,7 +6,7 @@ #include "source_estate/module_pot/H_TDDFT_pw.h" #include "source_lcao/module_operator_lcao/operator_lcao.h" #include "source_lcao/module_hcontainer/hcontainer.h" -#include "source_lcao/module_rt/td_velocity.h" +#include "source_lcao/module_rt/td_info.h" #include @@ -78,7 +78,7 @@ class TDNonlocal> : public OperatorLCAO */ void initialize_HR_tmp(const Parallel_Orbitals* paraV); /// @brief init vector potential for td_nonlocal term - void init_td(); + void update_td(); /** * @brief calculate the non-local pseudopotential matrix with specific atom-pairs * nearest neighbor atoms don't need to be calculated again diff --git a/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp b/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp new file mode 100644 index 0000000000..fffb439674 --- /dev/null +++ b/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp @@ -0,0 +1,300 @@ +#include "td_pot_hybrid.h" + +#include "source_base/timer.h" +#include "source_base/tool_title.h" +#include "source_cell/module_neighbor/sltk_grid_driver.h" +#include "source_lcao/module_operator_lcao/operator_lcao.h" +#include "source_lcao/module_hcontainer/hcontainer_funcs.h" +#include "source_pw/module_pwdft/global.h" + +// Constructor +template +cal_r_overlap_R hamilt::TD_pot_hybrid>::r_calculator; + +template +hamilt::TD_pot_hybrid>::TD_pot_hybrid( + HS_Matrix_K* hsk_in, + const K_Vectors* kv_in, + hamilt::HContainer* hR_in, + hamilt::HContainer* SR_in, + const LCAO_Orbitals& orb, + const UnitCell* ucell_in, + const std::vector& orb_cutoff, + const Grid_Driver* GridD_in, + const TwoCenterIntegrator* intor) + : hamilt::OperatorLCAO(hsk_in, kv_in->kvec_d, hR_in), SR(SR_in), orb_(orb), orb_cutoff_(orb_cutoff), intor_(intor) +{ + this->cal_type = calculation_type::lcao_tddft_periodic; + this->ucell = ucell_in; +#ifdef __DEBUG + assert(this->ucell != nullptr); + assert(this->hsk != nullptr); +#endif + this->init_td(); + // initialize HR to allocate sparse Ekinetic matrix memory + this->initialize_HR(GridD_in); +} + +// destructor +template +hamilt::TD_pot_hybrid>::~TD_pot_hybrid() +{ + if (this->allocated) + { + delete this->HR_fixed; + } + /*if(TD_info::td_vel_op!=nullptr) + { + TD_info::td_vel_op->hk_hybrid = nullptr; + }*/ +} + +// initialize_HR() +template +void hamilt::TD_pot_hybrid>::initialize_HR(const Grid_Driver* GridD) +{ + ModuleBase::TITLE("TD_pot_hybrid", "initialize_HR"); + ModuleBase::timer::tick("TD_pot_hybrid", "initialize_HR"); + + auto* paraV = this->hR->get_paraV();// get parallel orbitals from HR + // TODO: if paraV is nullptr, AtomPair can not use paraV for constructor, I will repair it in the future. + + for (int iat1 = 0; iat1 < ucell->nat; iat1++) + { + auto tau1 = ucell->get_tau(iat1); + int T1, I1; + ucell->iat2iait(iat1, &I1, &T1); + AdjacentAtomInfo adjs; + GridD->Find_atom(*ucell, tau1, T1, I1, &adjs); + std::vector is_adj(adjs.adj_num + 1, false); + for (int ad1 = 0; ad1 < adjs.adj_num + 1; ++ad1) + { + const int T2 = adjs.ntype[ad1]; + const int I2 = adjs.natom[ad1]; + const int iat2 = ucell->itia2iat(T2, I2); + if (paraV->get_row_size(iat1) <= 0 || paraV->get_col_size(iat2) <= 0) + { + continue; + } + const ModuleBase::Vector3& R_index2 = adjs.box[ad1]; + // choose the real adjacent atoms + // Note: the distance of atoms should less than the cutoff radius, + // When equal, the theoretical value of matrix element is zero, + // but the calculated value is not zero due to the numerical error, which would lead to result changes. + if (this->ucell->cal_dtau(iat1, iat2, R_index2).norm() * this->ucell->lat0 + < orb_cutoff_[T1] + orb_cutoff_[T2]) + { + is_adj[ad1] = true; + } + } + filter_adjs(is_adj, adjs); + this->adjs_all.push_back(adjs); + for (int ad = 0; ad < adjs.adj_num + 1; ++ad) + { + const int T2 = adjs.ntype[ad]; + const int I2 = adjs.natom[ad]; + int iat2 = ucell->itia2iat(T2, I2); + ModuleBase::Vector3& R_index = adjs.box[ad]; + hamilt::AtomPair tmp(iat1, iat2, R_index, paraV); + this->hR->insert_pair(tmp); + } + } + // allocate the memory of BaseMatrix in HR, and set the new values to zero + this->hR->allocate(nullptr, true); + + ModuleBase::timer::tick("TD_pot_hybrid", "initialize_HR"); +} + +template +void hamilt::TD_pot_hybrid>::calculate_HR() +{ + ModuleBase::TITLE("TD_pot_hybrid", "calculate_HR"); + if (this->HR_fixed == nullptr || this->HR_fixed->size_atom_pairs() <= 0) + { + ModuleBase::WARNING_QUIT("hamilt::TD_pot_hybrid::calculate_HR", "HR_fixed is nullptr or empty"); + } + ModuleBase::timer::tick("TD_pot_hybrid", "calculate_HR"); + + const Parallel_Orbitals* paraV = this->HR_fixed->get_atom_pair(0).get_paraV(); +#ifdef _OPENMP +#pragma omp parallel for +#endif + for (int iat1 = 0; iat1 < this->ucell->nat; iat1++) + { + auto tau1 = ucell->get_tau(iat1); + int T1, I1; + ucell->iat2iait(iat1, &I1, &T1); + AdjacentAtomInfo& adjs = this->adjs_all[iat1]; + for (int ad = 0; ad < adjs.adj_num + 1; ++ad) + { + const int T2 = adjs.ntype[ad]; + const int I2 = adjs.natom[ad]; + const int iat2 = ucell->itia2iat(T2, I2); + const ModuleBase::Vector3& R_index2 = adjs.box[ad]; + ModuleBase::Vector3 dtau = this->ucell->cal_dtau(iat1, iat2, R_index2); + + hamilt::BaseMatrix* tmp = this->HR_fixed->find_matrix(iat1, iat2, R_index2); + hamilt::BaseMatrix* tmp_overlap = this->SR->find_matrix(iat1, iat2, R_index2); + if (tmp != nullptr) + { + this->cal_HR_IJR(iat1, iat2, paraV, dtau, tmp->get_pointer(), tmp_overlap->get_pointer()); + } + else + { + ModuleBase::WARNING_QUIT("hamilt::TD_pot_hybrid::calculate_HR", "R_index not found in HR"); + } + } + } + + ModuleBase::timer::tick("TD_pot_hybrid", "calculate_HR"); +} + +// cal_HR_IJR() +template +void hamilt::TD_pot_hybrid>::cal_HR_IJR(const int& iat1, + const int& iat2, + const Parallel_Orbitals* paraV, + const ModuleBase::Vector3& dtau, + TR* hr_mat_p, + TR* sr_p) +{ + // --------------------------------------------- + // get info of orbitals of atom1 and atom2 from ucell + // --------------------------------------------- + int T1, I1; + this->ucell->iat2iait(iat1, &I1, &T1); + int T2, I2; + this->ucell->iat2iait(iat2, &I2, &T2); + Atom& atom1 = this->ucell->atoms[T1]; + Atom& atom2 = this->ucell->atoms[T2]; + + // npol is the number of polarizations, + // 1 for non-magnetic (one Hamiltonian matrix only has spin-up or spin-down), + // 2 for magnetic (one Hamiltonian matrix has both spin-up and spin-down) + const int npol = this->ucell->get_npol(); + + const int* iw2l1 = atom1.iw2l.data(); + const int* iw2n1 = atom1.iw2n.data(); + const int* iw2m1 = atom1.iw2m.data(); + const int* iw2l2 = atom2.iw2l.data(); + const int* iw2n2 = atom2.iw2n.data(); + const int* iw2m2 = atom2.iw2m.data(); + + // --------------------------------------------- + // calculate the Ekinetic matrix for each pair of orbitals + // --------------------------------------------- + double olm[3] = {0, 0, 0}; + auto row_indexes = paraV->get_indexes_row(iat1); + auto col_indexes = paraV->get_indexes_col(iat2); + const int step_trace = col_indexes.size() + 1; + + const ModuleBase::Vector3& tau1 = this->ucell->get_tau(iat1); + const ModuleBase::Vector3 tau2 = tau1 + dtau; + for (int iw1l = 0; iw1l < row_indexes.size(); iw1l += npol) + { + const int iw1 = row_indexes[iw1l] / npol; + const int L1 = iw2l1[iw1]; + const int N1 = iw2n1[iw1]; + const int m1 = iw2m1[iw1]; + + // convert m (0,1,...2l) to M (-l, -l+1, ..., l-1, l) + int M1 = (m1 % 2 == 0) ? -m1 / 2 : (m1 + 1) / 2; + + for (int iw2l = 0; iw2l < col_indexes.size(); iw2l += npol) + { + const int iw2 = col_indexes[iw2l] / npol; + const int L2 = iw2l2[iw2]; + const int N2 = iw2n2[iw2]; + const int m2 = iw2m2[iw2]; + + ModuleBase::Vector3 tmp_r = r_calculator.get_psi_r_psi(tau1 * this->ucell->lat0, T1, L1, m1, N1, tau2 * this->ucell->lat0, T2, L2, m2, N2); + // convert m (0,1,...2l) to M (-l, -l+1, ..., l-1, l) + int M2 = (m2 % 2 == 0) ? -m2 / 2 : (m2 + 1) / 2; + + for (int ipol = 0; ipol < npol; ipol++) + { + hr_mat_p[ipol * step_trace] += tmp_r * Et; + hr_mat_p[ipol * step_trace] -= ((dtau + tau1) * Et) * sr_p[ipol * step_trace] * this->ucell->lat0; + } + hr_mat_p += npol; + sr_p += npol; + } + hr_mat_p += (npol - 1) * col_indexes.size(); + sr_p += (npol - 1) * col_indexes.size(); + } +} +// init two center integrals and vector potential for td_ekintic term +template +void hamilt::TD_pot_hybrid>::init_td() +{ + // initialize the r_calculator + if(TD_info::td_vel_op->get_istep()==(TD_info::estep_shift-1)) + { + //std::cout << "init_r_overlap" <hR->get_paraV(), orb_); + } + //hk_hybrid.resize(this->hR->get_paraV()->nloc); +} +template +void hamilt::TD_pot_hybrid>::update_td() +{ + //std::cout<<"hybrid gague" <cart_At = TD_info::td_vel_op->cart_At; + //std::cout<<"At: "<< TD_info::td_vel_op->cart_At[0] <<" "<cart_At[1]<<" "<cart_At[2]<<" "< +void hamilt::TD_pot_hybrid>::set_HR_fixed(void* HR_fixed_in) +{ + this->HR_fixed = static_cast*>(HR_fixed_in); + this->allocated = false; +} + +// contributeHR() +template +void hamilt::TD_pot_hybrid>::contributeHR() +{ + ModuleBase::TITLE("TD_pot_hybrid", "contributeHR"); + ModuleBase::timer::tick("TD_pot_hybrid", "contributeHR"); + + if (!this->HR_fixed_done || TD_info::evolve_once) + { + // if this Operator is the first node of the sub_chain, then HR_fixed is nullptr + if (this->HR_fixed == nullptr) + { + this->HR_fixed = new hamilt::HContainer(*this->hR); + this->HR_fixed->set_zero(); + this->allocated = true; + } + if (this->next_sub_op != nullptr) + { + // pass pointer of HR_fixed to the next node + static_cast*>(this->next_sub_op)->set_HR_fixed(this->HR_fixed); + } + // calculate the values in HR_fixed + this->update_td(); + this->HR_fixed->set_zero(); + this->calculate_HR(); + this->HR_fixed_done = true; + TD_info::evolve_once = false; + } + // last node of sub-chain, add HR_fixed into HR + if (this->next_sub_op == nullptr) + { + this->hR->add(*(this->HR_fixed)); + } + + ModuleBase::timer::tick("TD_pot_hybrid", "contributeHR"); + return; +} + +//ETD +// contributeHk() +template +void hamilt::TD_pot_hybrid>::contributeHk(int ik) { + return; +} + +template class hamilt::TD_pot_hybrid, double>>; +template class hamilt::TD_pot_hybrid, std::complex>>; diff --git a/source/source_lcao/module_operator_lcao/td_pot_hybrid.h b/source/source_lcao/module_operator_lcao/td_pot_hybrid.h new file mode 100644 index 0000000000..82f17b6fed --- /dev/null +++ b/source/source_lcao/module_operator_lcao/td_pot_hybrid.h @@ -0,0 +1,129 @@ +#ifndef TD_POT_HYBRID_H +#define TD_POT_HYBRID_H +#include "source_basis/module_ao/parallel_orbitals.h" +#include "source_basis/module_nao/two_center_integrator.h" +#include "source_cell/klist.h" +#include "source_cell/module_neighbor/sltk_grid_driver.h" +#include "source_cell/unitcell.h" +#include "source_lcao/module_operator_lcao/operator_lcao.h" +#include "source_lcao/module_hcontainer/hcontainer.h" +#include +#include "source_io/cal_r_overlap_R.h" +#include "source_lcao/module_rt/td_info.h" +#include "source_estate/module_pot/H_TDDFT_pw.h" + +namespace hamilt +{ + +#ifndef __TD_POT_HYBRIDTEMPLATE +#define __TD_POT_HYBRIDTEMPLATE + +/// The EkineticNew class template inherits from class T +/// it is used to calculate the electronic kinetic +/// Template parameters: +/// - T: base class, it would be OperatorLCAO or OperatorPW +/// - TR: data type of real space Hamiltonian, it would be double or std::complex +template +class TD_pot_hybrid : public T +{ +}; + +#endif + +/// EkineticNew class template specialization for OperatorLCAO base class +/// It is used to calculate the electronic kinetic matrix in real space and fold it to k-space +/// HR = +/// HK = = \sum_{R} e^{ikR} HR +/// Template parameters: +/// - TK: data type of k-space Hamiltonian +/// - TR: data type of real space Hamiltonian +template +class TD_pot_hybrid> : public OperatorLCAO +{ + public: + /** + * @brief Construct a new EkineticNew object + */ + TD_pot_hybrid>(HS_Matrix_K* hsk_in, + const K_Vectors* kv_in, + HContainer* hR_in, + HContainer* SR_in, + const LCAO_Orbitals& orb, + const UnitCell* ucell_in, + const std::vector& orb_cutoff, + const Grid_Driver* GridD_in, + const TwoCenterIntegrator* intor); + + /** + * @brief Destroy the EkineticNew object + */ + ~TD_pot_hybrid>(); + + /** + * @brief contributeHR() is used to calculate the HR matrix + * + */ + virtual void contributeHR() override; + //ETD + virtual void contributeHk(int ik) override; + //ETD + + virtual void set_HR_fixed(void*) override; + + + private: + const UnitCell* ucell = nullptr; + std::vector orb_cutoff_; + const LCAO_Orbitals& orb_; + + hamilt::HContainer* HR_fixed = nullptr; + + hamilt::HContainer* SR = nullptr; + + const TwoCenterIntegrator* intor_ = nullptr; + + bool allocated = false; + + bool HR_fixed_done = false; + //tddft part + static cal_r_overlap_R r_calculator; + //ETD + //std::vector> hk_hybrid; + //ETD + /// @brief Store the vector potential for td_ekinetic term + ModuleBase::Vector3 cart_At; + ModuleBase::Vector3 Et; + + + /** + * @brief initialize HR, search the nearest neighbor atoms + * HContainer is used to store the electronic kinetic matrix with specific atom-pairs + * the size of HR will be fixed after initialization + */ + void initialize_HR(const Grid_Driver* GridD_in); + + void init_td(); + void update_td(); + + /** + * @brief calculate the electronic kinetic matrix with specific atom-pairs + * use the adjs_all to calculate the HR matrix + */ + void calculate_HR(); + + /** + * @brief calculate the HR local matrix of atom pair + */ + void cal_HR_IJR(const int& iat1, + const int& iat2, + const Parallel_Orbitals* paraV, + const ModuleBase::Vector3& dtau, + TR* hr_mat_p, + TR* sr_p); + + /// @brief exact the nearest neighbor atoms from all adjacent atoms + std::vector adjs_all; +}; + +} // namespace hamilt +#endif diff --git a/source/source_lcao/module_rt/CMakeLists.txt b/source/source_lcao/module_rt/CMakeLists.txt index e81ceb3368..58bc834a5f 100644 --- a/source/source_lcao/module_rt/CMakeLists.txt +++ b/source/source_lcao/module_rt/CMakeLists.txt @@ -10,9 +10,10 @@ if(ENABLE_LCAO) propagator_taylor.cpp propagator_etrs.cpp upsi.cpp - td_velocity.cpp - td_current.cpp + td_info.cpp + velocity_op.cpp snap_psibeta_half_tddft.cpp + td_folding.cpp solve_propagation.cpp ) diff --git a/source/source_lcao/module_rt/evolve_elec.h b/source/source_lcao/module_rt/evolve_elec.h index 6d71a9d692..fc19493811 100644 --- a/source/source_lcao/module_rt/evolve_elec.h +++ b/source/source_lcao/module_rt/evolve_elec.h @@ -143,7 +143,8 @@ class Evolve_elec friend class ModuleESolver::ESolver_KS_LCAO, double>; // Template parameter is needed for the friend class declaration - friend class ModuleESolver::ESolver_KS_LCAO_TDDFT; + friend class ModuleESolver::ESolver_KS_LCAO_TDDFT; + friend class ModuleESolver::ESolver_KS_LCAO_TDDFT, Device>; public: Evolve_elec(); diff --git a/source/source_lcao/module_rt/evolve_psi.cpp b/source/source_lcao/module_rt/evolve_psi.cpp index 503d73ae73..db59dcd44c 100644 --- a/source/source_lcao/module_rt/evolve_psi.cpp +++ b/source/source_lcao/module_rt/evolve_psi.cpp @@ -76,7 +76,7 @@ void evolve_psi(const int nband, /// @brief compute U_operator /// @input Stmp, Htmp, print_matrix /// @output U_operator - Propagator prop(propagator, pv, PARAM.mdp.md_dt); + Propagator prop(propagator, pv, PARAM.inp.td_dt); prop.compute_propagator(nlocal, Stmp, Htmp, H_laststep, U_operator, ofs_running, print_matrix); } @@ -93,7 +93,7 @@ void evolve_psi(const int nband, /// @brief solve the propagation equation /// @input Stmp, Htmp, psi_k_laststep /// @output psi_k - solve_propagation(pv, nband, nlocal, PARAM.mdp.md_dt / ModuleBase::AU_to_FS, Stmp, Htmp, psi_k_laststep, psi_k); + solve_propagation(pv, nband, nlocal, PARAM.inp.td_dt, Stmp, Htmp, psi_k_laststep, psi_k); } // (4)->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> diff --git a/source/source_lcao/module_rt/solve_propagation.cpp b/source/source_lcao/module_rt/solve_propagation.cpp index 23df591442..54caded18b 100644 --- a/source/source_lcao/module_rt/solve_propagation.cpp +++ b/source/source_lcao/module_rt/solve_propagation.cpp @@ -4,6 +4,7 @@ #include "source_base/lapack_connector.h" #include "source_base/scalapack_connector.h" +#include "source_pw/module_pwdft/global.h" namespace module_rt { @@ -25,14 +26,16 @@ void solve_propagation(const Parallel_Orbitals* pv, std::complex* operator_B = new std::complex[pv->nloc]; ModuleBase::GlobalFunc::ZEROS(operator_B, pv->nloc); BlasConnector::copy(pv->nloc, Htmp, 1, operator_B, 1); + + const double dt_au = dt / ModuleBase::AU_to_FS; // ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> // (2) compute operator_A & operator_B by GEADD // operator_A = Stmp + i*para * Htmp; beta2 = para = 0.25 * dt // operator_B = Stmp - i*para * Htmp; beta1 = - para = -0.25 * dt std::complex alpha = {1.0, 0.0}; - std::complex beta1 = {0.0, -0.25 * dt}; - std::complex beta2 = {0.0, 0.25 * dt}; + std::complex beta1 = {0.0, -0.25 * dt_au}; + std::complex beta2 = {0.0, 0.25 * dt_au}; ScalapackConnector::geadd('N', nlocal, diff --git a/source/source_lcao/module_rt/td_folding.cpp b/source/source_lcao/module_rt/td_folding.cpp new file mode 100644 index 0000000000..56614e1ac6 --- /dev/null +++ b/source/source_lcao/module_rt/td_folding.cpp @@ -0,0 +1,52 @@ +#include "td_info.h" +#include "source_base/libm/libm.h" +template +void TD_info::folding_HR_td(const hamilt::HContainer& hR, + std::complex* hk, + const ModuleBase::Vector3& kvec_d_in, + const int ncol, + const int hk_type) +{ +#ifdef _OPENMP +#pragma omp parallel for +#endif + for (int i = 0; i < hR.size_atom_pairs(); ++i) + { + hamilt::AtomPair& tmp = hR.get_atom_pair(i); + for(int ir = 0;ir < tmp.get_R_size(); ++ir ) + { + const ModuleBase::Vector3 r_index = tmp.get_R_index(ir); + + //new + //cal tddft phase for hybrid gague + const int iat1 = tmp.get_atom_i(); + const int iat2 = tmp.get_atom_j(); + ModuleBase::Vector3 dtau = ucell->cal_dtau(iat1, iat2, r_index); + const double arg_td = cart_At * dtau * ucell->lat0; + //new + + // cal k_phase + // if TK==std::complex, kphase is e^{ikR} + const ModuleBase::Vector3 dR(r_index.x, r_index.y, r_index.z); + const double arg = (kvec_d_in * dR) * ModuleBase::TWO_PI + arg_td; + double sinp, cosp; + ModuleBase::libm::sincos(arg, &sinp, &cosp); + std::complex kphase = std::complex(cosp, sinp); + + tmp.find_R(r_index); + tmp.add_to_matrix(hk, ncol, kphase, hk_type); + } + } +} +template +void TD_info::folding_HR_td(const hamilt::HContainer& hR, + std::complex* hk, + const ModuleBase::Vector3& kvec_d_in, + const int ncol, + const int hk_type); +template +void TD_info::folding_HR_td>(const hamilt::HContainer>& hR, + std::complex* hk, + const ModuleBase::Vector3& kvec_d_in, + const int ncol, + const int hk_type); \ No newline at end of file diff --git a/source/source_lcao/module_rt/td_velocity.cpp b/source/source_lcao/module_rt/td_info.cpp similarity index 62% rename from source/source_lcao/module_rt/td_velocity.cpp rename to source/source_lcao/module_rt/td_info.cpp index 642536c9cd..b076bac0be 100644 --- a/source/source_lcao/module_rt/td_velocity.cpp +++ b/source/source_lcao/module_rt/td_info.cpp @@ -1,33 +1,51 @@ -#include "td_velocity.h" +#include "td_info.h" #include "source_estate/module_pot/H_TDDFT_pw.h" #include "source_io/module_parameter/parameter.h" -bool TD_Velocity::tddft_velocity = false; -bool TD_Velocity::out_mat_R = false; -bool TD_Velocity::out_vecpot = false; -bool TD_Velocity::out_current = false; -bool TD_Velocity::out_current_k = false; -bool TD_Velocity::init_vecpot_file = false; +bool TD_info::out_mat_R = false; +bool TD_info::out_vecpot = false; +bool TD_info::out_current = false; +bool TD_info::out_current_k = false; +bool TD_info::init_vecpot_file = false; +bool TD_info::evolve_once = false; -TD_Velocity* TD_Velocity::td_vel_op = nullptr; +TD_info* TD_info::td_vel_op = nullptr; -int TD_Velocity::istep = -1; -int TD_Velocity::max_istep = -1; -std::vector> TD_Velocity::At_from_file; +int TD_info::estep_shift = 0; +int TD_info::istep = -1; +int TD_info::max_istep = -1; +std::vector> TD_info::At_from_file; -TD_Velocity::TD_Velocity() +TD_info::TD_info(const UnitCell* ucell_in) { + this->ucell = ucell_in; if (init_vecpot_file && istep == -1) { this->read_cart_At(); } + //read in restart step + if(PARAM.inp.mdp.md_restart) + { + std::stringstream ssc; + ssc << PARAM.globalv.global_readin_dir << "Restart_td.dat"; + std::ifstream file(ssc.str().c_str()); + if (!file) + { + ModuleBase::WARNING_QUIT("TD_info::TD_info", "No Restart_td.dat!"); + } + file >> estep_shift; + //std::cout<<"estep_shift"<istep += estep_shift; return; } -TD_Velocity::~TD_Velocity() +TD_info::~TD_info() { - this->destroy_HS_R_td_sparse(); - delete td_vel_op; + if(elecstate::H_TDDFT_pw::stype == 1) + { + this->destroy_HS_R_td_sparse(); + } for (int dir = 0; dir < 3; dir++) { if (this->current_term[dir] != nullptr) @@ -37,7 +55,7 @@ TD_Velocity::~TD_Velocity() } } -void TD_Velocity::output_cart_At(const std::string& out_dir) +void TD_info::output_cart_At(const std::string& out_dir) { if (GlobalV::MY_RANK == 0) { @@ -46,7 +64,7 @@ void TD_Velocity::output_cart_At(const std::string& out_dir) out_file = out_dir + "At.dat"; std::ofstream ofs; // output title - if (istep == 0) + if (istep == estep_shift) { ofs.open(out_file.c_str(), std::ofstream::out); ofs << std::left << std::setw(8) << "#istep" << std::setw(15) << "A_x" << std::setw(15) << "A_y" @@ -69,7 +87,7 @@ void TD_Velocity::output_cart_At(const std::string& out_dir) return; } -void TD_Velocity::cal_cart_At(const ModuleBase::Vector3& At) +void TD_info::cal_cart_At(const ModuleBase::Vector3& At) { istep++; if (init_vecpot_file) @@ -88,7 +106,7 @@ void TD_Velocity::cal_cart_At(const ModuleBase::Vector3& At) } } -void TD_Velocity::read_cart_At(void) +void TD_info::read_cart_At(void) { std::string in_file; // generate the input file name @@ -97,7 +115,7 @@ void TD_Velocity::read_cart_At(void) // check if the file is exist if (!ifs) { - ModuleBase::WARNING_QUIT("TD_Velocity::read_cart_At", "Cannot open Vector potential file!"); + ModuleBase::WARNING_QUIT("TD_info::read_cart_At", "Cannot open Vector potential file!"); } std::string line; std::vector str_vec; @@ -115,7 +133,7 @@ void TD_Velocity::read_cart_At(void) // skip the istep number if (!(iss >> tmp)) { - ModuleBase::WARNING_QUIT("TD_Velocity::read_cart_At", "Error reading istep!"); + ModuleBase::WARNING_QUIT("TD_info::read_cart_At", "Error reading istep!"); } // read the vector potential double component = 0; @@ -124,7 +142,7 @@ void TD_Velocity::read_cart_At(void) { if (!(iss >> component)) { - ModuleBase::WARNING_QUIT("TD_Velocity::read_cart_At", + ModuleBase::WARNING_QUIT("TD_info::read_cart_At", "Error reading component " + std::to_string(i + 1) + " for istep " + std::to_string(tmp) + "!"); } @@ -139,11 +157,34 @@ void TD_Velocity::read_cart_At(void) return; } -void TD_Velocity::initialize_current_term(const hamilt::HContainer>* HR, +void TD_info::out_restart_info(const int nstep, + const ModuleBase::Vector3& At_current, + const ModuleBase::Vector3& At_laststep) +{ + if (GlobalV::MY_RANK == 0) + { + // open file + std::string outdir = PARAM.globalv.global_out_dir + "Restart_td.dat"; + std::ofstream outFile(outdir); + if (!outFile) { + ModuleBase::WARNING_QUIT("out_restart_info", "no Restart_td.dat!"); + } + // write data + outFile << nstep << std::endl; + outFile << At_current[0] << " " << At_current[1] << " " << At_current[2] << std::endl; + outFile << At_laststep[0] << " " << At_laststep[1] << " " << At_laststep[2] << std::endl; + outFile.close(); + } + + + return; +} + +void TD_info::initialize_current_term(const hamilt::HContainer>* HR, const Parallel_Orbitals* paraV) { - ModuleBase::TITLE("TD_Velocity", "initialize_current_term"); - ModuleBase::timer::tick("TD_Velocity", "initialize_current_term"); + ModuleBase::TITLE("TD_info", "initialize_current_term"); + ModuleBase::timer::tick("TD_info", "initialize_current_term"); for (int dir = 0; dir < 3; dir++) { @@ -172,10 +213,10 @@ void TD_Velocity::initialize_current_term(const hamilt::HContainercurrent_term[dir]->allocate(nullptr, true); } - ModuleBase::timer::tick("TD_Velocity", "initialize_current_term"); + ModuleBase::timer::tick("TD_info", "initialize_current_term"); } -void TD_Velocity::destroy_HS_R_td_sparse(void) +void TD_info::destroy_HS_R_td_sparse(void) { std::map, std::map>>> empty_HR_sparse_td_vel_up; diff --git a/source/source_lcao/module_rt/td_velocity.h b/source/source_lcao/module_rt/td_info.h similarity index 64% rename from source/source_lcao/module_rt/td_velocity.h rename to source/source_lcao/module_rt/td_info.h index 36dd105240..60e4273266 100644 --- a/source/source_lcao/module_rt/td_velocity.h +++ b/source/source_lcao/module_rt/td_info.h @@ -1,27 +1,24 @@ -#ifndef TD_VELOCITY_H -#define TD_VELOCITY_H +#ifndef TD_INFO_H +#define TD_INFO_H #include "source_base/abfs-vector3_order.h" #include "source_base/timer.h" #include "source_lcao/module_hcontainer/hcontainer.h" #include -// Class to store TDDFT velocity gauge infos. -class TD_Velocity +// Class to store TDDFT infos, mainly for periodic system. +class TD_info { public: - TD_Velocity(); - ~TD_Velocity(); + TD_info(const UnitCell* ucell_in); + ~TD_info(); void init(); - /// @brief Judge if in tddft calculation or not - static bool tddft_velocity; - /// @brief switch to control the output of HR static bool out_mat_R; - /// @brief pointer to the only TD_Velocity object itself - static TD_Velocity* td_vel_op; + /// @brief pointer to the only TD_info object itself + static TD_info* td_vel_op; /// @brief switch to control the output of At static bool out_vecpot; @@ -35,12 +32,23 @@ class TD_Velocity /// @brief switch to control the source of At static bool init_vecpot_file; + /// @brief if need to calculate more than once + static bool evolve_once; + + /// @brief Restart step + static int estep_shift; + /// @brief Store the vector potential for tddft calculation ModuleBase::Vector3 cart_At; /// @brief calculate the At in cartesian coordinate void cal_cart_At(const ModuleBase::Vector3& At); + /// @brief output RT-TDDFT info for restart + void out_restart_info(const int nstep, + const ModuleBase::Vector3& At_current, + const ModuleBase::Vector3& At_laststep); + // allocate memory for current term. void initialize_current_term(const hamilt::HContainer>* HR, const Parallel_Orbitals* paraV); @@ -49,10 +57,32 @@ class TD_Velocity return this->current_term[i]; } + + // folding HR to hk, for hybrid gague + template + void folding_HR_td(const hamilt::HContainer& hR, + std::complex* hk, + const ModuleBase::Vector3& kvec_d_in, + const int ncol, + const int hk_type); + + int get_istep() + { + return istep; + } + + const UnitCell* get_ucell() + { + return this->ucell; + } + // For TDDFT velocity gauge, to fix the output of HR std::map, std::map>>> HR_sparse_td_vel[2]; private: + /// @brief pointer to the unit cell + const UnitCell* ucell = nullptr; + /// @brief read At from output file void read_cart_At(); diff --git a/source/source_lcao/module_rt/td_current.cpp b/source/source_lcao/module_rt/velocity_op.cpp similarity index 73% rename from source/source_lcao/module_rt/td_current.cpp rename to source/source_lcao/module_rt/velocity_op.cpp index d32f0d8921..afa49a93cd 100644 --- a/source/source_lcao/module_rt/td_current.cpp +++ b/source/source_lcao/module_rt/velocity_op.cpp @@ -1,43 +1,55 @@ -#include "td_current.h" -#ifdef __LCAO +#include "velocity_op.h" #include "source_base/timer.h" #include "source_base/tool_title.h" #include "source_lcao/module_rt/snap_psibeta_half_tddft.h" #ifdef _OPENMP -#include #include +#include #endif - -TD_current::TD_current(const UnitCell* ucell_in, - const Grid_Driver* GridD_in, - const Parallel_Orbitals* paraV, - const LCAO_Orbitals& orb, - const TwoCenterIntegrator* intor) - : ucell(ucell_in), paraV(paraV), orb_(orb), Grid(GridD_in), intor_(intor) -{ - // for length gauge, the A(t) = 0 for all the time. - this->cart_At = ModuleBase::Vector3(0, 0, 0); - this->initialize_vcomm_r(GridD_in, paraV); +#include "source_io/module_parameter/parameter.h" +template +cal_r_overlap_R Velocity_op::r_calculator; +template +bool Velocity_op::init_done = false; +template +Velocity_op::Velocity_op(const UnitCell* ucell_in, + const Grid_Driver* GridD_in, + const Parallel_Orbitals* paraV, + const LCAO_Orbitals& orb, + const TwoCenterIntegrator* intor) + : ucell(ucell_in), paraV(paraV) , orb_(orb), intor_(intor) +{ + // for length gague, the A(t) = 0 for all the time. + this->cart_At = ModuleBase::Vector3(0,0,0); this->initialize_grad_term(GridD_in, paraV); + this->initialize_vcomm_r(GridD_in, paraV); } -TD_current::~TD_current() +template +Velocity_op::~Velocity_op() { - for (int dir = 0; dir < 3; dir++) + for (int dir=0;dir<3;dir++) { delete this->current_term[dir]; } } -// allocate space for current_term -void TD_current::initialize_vcomm_r(const Grid_Driver* GridD, const Parallel_Orbitals* paraV) +//allocate space for current_term +template +void Velocity_op::initialize_vcomm_r(const Grid_Driver* GridD, const Parallel_Orbitals* paraV) { - ModuleBase::TITLE("TD_current", "initialize_vcomm_r"); - ModuleBase::timer::tick("TD_current", "initialize_vcomm_r"); - for (int dir = 0; dir < 3; dir++) + ModuleBase::TITLE("Velocity_op", "initialize_vcomm_r"); + ModuleBase::timer::tick("Velocity_op", "initialize_vcomm_r"); + if(!init_done) { - if (this->current_term[dir] == nullptr) - this->current_term[dir] = new hamilt::HContainer>(paraV); + std::cout << "init_r_overlap_nonlocal" <current_term[dir] == nullptr) + this->current_term[dir] = new hamilt::HContainer>(paraV); + } this->adjs_vcommr.clear(); this->adjs_vcommr.reserve(this->ucell->nat); for (int iat0 = 0; iat0 < ucell->nat; iat0++) @@ -56,8 +68,8 @@ void TD_current::initialize_vcomm_r(const Grid_Driver* GridD, const Parallel_Orb const ModuleBase::Vector3& tau1 = adjs.adjacent_tau[ad1]; const ModuleBase::Vector3& R_index1 = adjs.box[ad1]; // choose the real adjacent atoms - // Note: the distance of atoms should less than the cutoff radius, - // When equal, the theoretical value of matrix element is zero, + // Note: the distance of atoms should less than the cutoff radius, + // When equal, the theoretical value of matrix element is zero, // but the calculated value is not zero due to the numerical error, which would lead to result changes. if (this->ucell->cal_dtau(iat0, iat1, R_index1).norm() * this->ucell->lat0 < orb_.Phi[T1].getRcut() + this->ucell->infoNL.Beta[T0].get_rcut_max()) @@ -84,12 +96,12 @@ void TD_current::initialize_vcomm_r(const Grid_Driver* GridD, const Parallel_Orb continue; } hamilt::AtomPair> tmp(iat1, - iat2, - R_index2.x - R_index1.x, - R_index2.y - R_index1.y, - R_index2.z - R_index1.z, - paraV); - for (int dir = 0; dir < 3; dir++) + iat2, + R_index2.x - R_index1.x, + R_index2.y - R_index1.y, + R_index2.z - R_index1.z, + paraV); + for (int dir=0;dir<3;dir++) { this->current_term[dir]->insert_pair(tmp); } @@ -97,22 +109,24 @@ void TD_current::initialize_vcomm_r(const Grid_Driver* GridD, const Parallel_Orb } } // allocate the memory of BaseMatrix in cal_vcomm_r_IJR, and set the new values to zero - for (int dir = 0; dir < 3; dir++) + for (int dir=0;dir<3;dir++) { this->current_term[dir]->allocate(nullptr, true); } - ModuleBase::timer::tick("TD_current", "initialize_vcomm_r"); + ModuleBase::timer::tick("Velocity_op", "initialize_vcomm_r"); } -void TD_current::initialize_grad_term(const Grid_Driver* GridD, const Parallel_Orbitals* paraV) +template +void Velocity_op::initialize_grad_term(const Grid_Driver* GridD, const Parallel_Orbitals* paraV) { - ModuleBase::TITLE("TD_current", "initialize_grad_term"); - ModuleBase::timer::tick("TD_current", "initialize_grad_term"); - - for (int dir = 0; dir < 3; dir++) + ModuleBase::TITLE("Velocity_op", "initialize_grad_term"); + ModuleBase::timer::tick("Velocity_op", "initialize_grad_term"); + for (int dir=0;dir<3;dir++) { if (this->current_term[dir] == nullptr) - this->current_term[dir] = new hamilt::HContainer>(paraV); + this->current_term[dir] = new hamilt::HContainer>(paraV); } + this->adjs_grad.clear(); + this->adjs_grad.reserve(this->ucell->nat); for (int iat1 = 0; iat1 < ucell->nat; iat1++) { auto tau1 = ucell->get_tau(iat1); @@ -132,8 +146,8 @@ void TD_current::initialize_grad_term(const Grid_Driver* GridD, const Parallel_O } const ModuleBase::Vector3& R_index2 = adjs.box[ad1]; // choose the real adjacent atoms - // Note: the distance of atoms should less than the cutoff radius, - // When equal, the theoretical value of matrix element is zero, + // Note: the distance of atoms should less than the cutoff radius, + // When equal, the theoretical value of matrix element is zero, // but the calculated value is not zero due to the numerical error, which would lead to result changes. if (this->ucell->cal_dtau(iat1, iat2, R_index2).norm() * this->ucell->lat0 < orb_.Phi[T1].getRcut() + orb_.Phi[T2].getRcut()) @@ -150,25 +164,25 @@ void TD_current::initialize_grad_term(const Grid_Driver* GridD, const Parallel_O int iat2 = ucell->itia2iat(T2, I2); ModuleBase::Vector3& R_index = adjs.box[ad]; hamilt::AtomPair> tmp(iat1, iat2, R_index.x, R_index.y, R_index.z, paraV); - for (int dir = 0; dir < 3; dir++) + for (int dir=0;dir<3;dir++) { this->current_term[dir]->insert_pair(tmp); } } } // allocate the memory of BaseMatrix in HR, and set the new values to zero - for (int dir = 0; dir < 3; dir++) + for (int dir=0;dir<3;dir++) { this->current_term[dir]->allocate(nullptr, true); } - ModuleBase::timer::tick("TD_current", "initialize_grad_term"); + ModuleBase::timer::tick("Velocity_op", "initialize_grad_term"); } - -void TD_current::calculate_vcomm_r() +template +void Velocity_op::calculate_vcomm_r() { - ModuleBase::TITLE("TD_current", "calculate_vcomm_r"); - ModuleBase::timer::tick("TD_current", "calculate_vcomm_r"); + ModuleBase::TITLE("Velocity_op", "calculate_vcomm_r"); + ModuleBase::timer::tick("Velocity_op", "calculate_vcomm_r"); const Parallel_Orbitals* paraV = this->current_term[0]->get_atom_pair(0).get_paraV(); const int npol = this->ucell->get_npol(); @@ -180,17 +194,16 @@ void TD_current::calculate_vcomm_r() int T0, I0; ucell->iat2iait(iat0, &I0, &T0); AdjacentAtomInfo& adjs = this->adjs_vcommr[iat0]; - - std::vector>>>> nlm_tot; + std::vector>>> nlm_tot; nlm_tot.resize(adjs.adj_num + 1); for (int i = 0; i < adjs.adj_num + 1; i++) { nlm_tot[i].resize(4); } -#pragma omp parallel + #pragma omp parallel { -#pragma omp for schedule(dynamic) + #pragma omp for schedule(dynamic) for (int ad = 0; ad < adjs.adj_num + 1; ++ad) { const int T1 = adjs.ntype[ad]; @@ -207,26 +220,25 @@ void TD_current::calculate_vcomm_r() for (int iw1l = 0; iw1l < all_indexes.size(); iw1l += npol) { const int iw1 = all_indexes[iw1l] / npol; - std::vector>> nlm; + //std::vector>> nlm; + std::vector> nlm; // nlm is a vector of vectors, but size of outer vector is only 1 when out_current is false // and size of outer vector is 4 when out_current is true (3 for , 1 for // ) inner loop : all projectors (L0,M0) // snap_psibeta_half_tddft() are used to calculate // and as well if current are needed + ModuleBase::Vector3 dtau = tau0 - tau1; - module_rt::snap_psibeta_half_tddft(orb_, - this->ucell->infoNL, - nlm, - tau1 * this->ucell->lat0, - T1, - atom1->iw2l[iw1], - atom1->iw2m[iw1], - atom1->iw2n[iw1], - tau0 * this->ucell->lat0, - T0, - this->cart_At, - true); + r_calculator.get_psi_r_beta(*ucell, + nlm, + tau1 * this->ucell->lat0, + T1, + atom1->iw2l[iw1], + atom1->iw2m[iw1], + atom1->iw2n[iw1], + tau0 * this->ucell->lat0, + T0); for (int dir = 0; dir < 4; dir++) { nlm_tot[ad][dir].insert({all_indexes[iw1l], nlm[dir]}); @@ -234,7 +246,7 @@ void TD_current::calculate_vcomm_r() } } -#ifdef _OPENMP + #ifdef _OPENMP // record the iat number of the adjacent atoms std::set ad_atom_set; for (int ad = 0; ad < adjs.adj_num + 1; ++ad) @@ -250,7 +262,7 @@ void TD_current::calculate_vcomm_r() const int thread_id = omp_get_thread_num(); std::set ad_atom_set_thread; int i = 0; - for (const auto iat1: ad_atom_set) + for(const auto iat1 : ad_atom_set) { if (i % num_threads == thread_id) { @@ -258,20 +270,19 @@ void TD_current::calculate_vcomm_r() } i++; } -#endif - - // 2. calculate D for each pair of atoms + #endif + // 2. calculate D for each pair of atoms for (int ad1 = 0; ad1 < adjs.adj_num + 1; ++ad1) { const int T1 = adjs.ntype[ad1]; const int I1 = adjs.natom[ad1]; const int iat1 = ucell->itia2iat(T1, I1); -#ifdef _OPENMP + #ifdef _OPENMP if (ad_atom_set_thread.find(iat1) == ad_atom_set_thread.end()) - { - continue; - } -#endif + { + continue; + } + #endif ModuleBase::Vector3& R_index1 = adjs.box[ad1]; for (int ad2 = 0; ad2 < adjs.adj_num + 1; ++ad2) { @@ -280,38 +291,40 @@ void TD_current::calculate_vcomm_r() const int iat2 = ucell->itia2iat(T2, I2); ModuleBase::Vector3& R_index2 = adjs.box[ad2]; ModuleBase::Vector3 R_vector(R_index2[0] - R_index1[0], - R_index2[1] - R_index1[1], - R_index2[2] - R_index1[2]); + R_index2[1] - R_index1[1], + R_index2[2] - R_index1[2]); std::complex* tmp_c[3] = {nullptr, nullptr, nullptr}; for (int i = 0; i < 3; i++) { - hamilt::BaseMatrix>* matrix_ptr - = this->current_term[i]->find_matrix(iat1, iat2, R_vector[0], R_vector[1], R_vector[2]); - if (matrix_ptr != nullptr) - { - tmp_c[i] = matrix_ptr->get_pointer(); - } + tmp_c[i] = this->current_term[i]->find_matrix(iat1, iat2, R_vector[0], R_vector[1], R_vector[2])->get_pointer(); } // if not found , skip this pair of atoms if (tmp_c[0] != nullptr) { - this->cal_vcomm_r_IJR(iat1, iat2, T0, paraV, nlm_tot[ad1], nlm_tot[ad2], tmp_c); + this->cal_vcomm_r_IJR(iat1, + iat2, + T0, + paraV, + nlm_tot[ad1], + nlm_tot[ad2], + tmp_c); } } } } } - ModuleBase::timer::tick("TD_current", "calculate_vcomm_r"); + ModuleBase::timer::tick("Velocity_op", "calculate_vcomm_r"); } // cal_HR_IJR() -void TD_current::cal_vcomm_r_IJR( +template +void Velocity_op::cal_vcomm_r_IJR( const int& iat1, const int& iat2, const int& T0, const Parallel_Orbitals* paraV, - const std::vector>>>& nlm1_all, - const std::vector>>>& nlm2_all, + const std::vector>>& nlm1_all, + const std::vector>>& nlm2_all, std::complex** current_mat_p) { // npol is the number of polarizations, @@ -333,11 +346,12 @@ void TD_current::cal_vcomm_r_IJR( } } // calculate the local matrix - const std::complex* tmp_d = nullptr; + const TR* tmp_d = nullptr; for (int iw1l = 0; iw1l < row_indexes.size(); iw1l += npol) { // const std::vector>* nlm1 = &(nlm1_all[0].find(row_indexes[iw1l])->second); - std::vector>*> nlm1; + //std::vector>*> nlm1; + std::vector*> nlm1; for (int dir = 0; dir < 4; dir++) { nlm1.push_back(&(nlm1_all[dir].find(row_indexes[iw1l])->second)); @@ -345,11 +359,13 @@ void TD_current::cal_vcomm_r_IJR( for (int iw2l = 0; iw2l < col_indexes.size(); iw2l += npol) { - std::vector>*> nlm2; + //std::vector>*> nlm2; + std::vector*> nlm2; for (int dir = 0; dir < 4; dir++) { nlm2.push_back(&(nlm2_all[dir].find(col_indexes[iw2l])->second)); } + #ifdef __DEBUG assert(nlm1.size() == nlm2.size()); #endif @@ -366,9 +382,10 @@ void TD_current::cal_vcomm_r_IJR( this->ucell->atoms[T0].ncpp.get_d(is, p1, p2, tmp_d); //- // multiply d in the end - nlm_r_tmp += (nlm1[dir + 1]->at(p1) * std::conj(nlm2[0]->at(p2)) - - nlm1[0]->at(p1) * std::conj(nlm2[dir + 1]->at(p2))) - * (*tmp_d); + TR tmp = (nlm1[dir + 1]->at(p1) * nlm2[0]->at(p2) + - nlm1[0]->at(p1) * nlm2[dir + 1]->at(p2)) + * (*tmp_d); + nlm_r_tmp += tmp; } // -i[r,Vnl], 2.0 due to the unit transformation current_mat_p[dir][step_trace[is]] -= imag_unit * nlm_r_tmp / 2.0; @@ -385,15 +402,15 @@ void TD_current::cal_vcomm_r_IJR( } } } - -void TD_current::calculate_grad_term() +template +void Velocity_op::calculate_grad_term() { - ModuleBase::TITLE("TD_current", "calculate_grad_term"); - if (this->current_term[0] == nullptr || this->current_term[0]->size_atom_pairs() <= 0) + ModuleBase::TITLE("Velocity_op", "calculate_grad_term"); + if(this->current_term[0]==nullptr || this->current_term[0]->size_atom_pairs()<=0) { - ModuleBase::WARNING_QUIT("TD_current::calculate_grad_term", "grad_term is nullptr or empty"); + ModuleBase::WARNING_QUIT("Velocity_op::calculate_grad_term", "grad_term is nullptr or empty"); } - ModuleBase::timer::tick("TD_current", "calculate_grad_term"); + ModuleBase::timer::tick("Velocity_op", "calculate_grad_term"); const Parallel_Orbitals* paraV = this->current_term[0]->get_atom_pair(0).get_paraV(); #ifdef _OPENMP @@ -416,12 +433,7 @@ void TD_current::calculate_grad_term() std::complex* tmp_c[3] = {nullptr, nullptr, nullptr}; for (int i = 0; i < 3; i++) { - hamilt::BaseMatrix>* matrix_ptr - = this->current_term[i]->find_matrix(iat1, iat2, R_index2); - if (matrix_ptr != nullptr) - { - tmp_c[i] = matrix_ptr->get_pointer(); - } + tmp_c[i] = this->current_term[i]->find_matrix(iat1, iat2, R_index2)->get_pointer(); } if (tmp_c[0] != nullptr) { @@ -429,14 +441,14 @@ void TD_current::calculate_grad_term() } else { - ModuleBase::WARNING_QUIT("TD_current::calculate_grad_term", "R_index not found in HR"); + ModuleBase::WARNING_QUIT("Velocity_op::calculate_grad_term", "R_index not found in HR"); } } } - ModuleBase::timer::tick("TD_current", "calculate_grad_term"); + ModuleBase::timer::tick("Velocity_op", "calculate_grad_term"); } - -void TD_current::cal_grad_IJR(const int& iat1, +template +void Velocity_op::cal_grad_IJR(const int& iat1, const int& iat2, const Parallel_Orbitals* paraV, const ModuleBase::Vector3& dtau, @@ -477,7 +489,7 @@ void TD_current::cal_grad_IJR(const int& iat1, auto row_indexes = paraV->get_indexes_row(iat1); auto col_indexes = paraV->get_indexes_col(iat2); const int step_trace = col_indexes.size() + 1; - for (int iw1l = 0; iw1l < row_indexes.size(); iw1l += npol) + for(int iw1l = 0; iw1l < row_indexes.size(); iw1l += npol) { const int iw1 = row_indexes[iw1l] / npol; const int L1 = iw2l1[iw1]; @@ -513,8 +525,8 @@ void TD_current::cal_grad_IJR(const int& iat1, for (int dir = 0; dir < 3; dir++) { current_mat_p[dir] += (npol - 1) * col_indexes.size(); - } + } } } - -#endif // __LCAO +template class Velocity_op; +template class Velocity_op>; diff --git a/source/source_lcao/module_rt/td_current.h b/source/source_lcao/module_rt/velocity_op.h similarity index 85% rename from source/source_lcao/module_rt/td_current.h rename to source/source_lcao/module_rt/velocity_op.h index c2e6184580..7c3986a431 100644 --- a/source/source_lcao/module_rt/td_current.h +++ b/source/source_lcao/module_rt/velocity_op.h @@ -1,31 +1,30 @@ -#ifndef TD_CURRENT_H -#define TD_CURRENT_H +#ifndef TD_VELOCITY_OP_H +#define TD_VELOCITY_OP_H #include #include "source_basis/module_ao/parallel_orbitals.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" #include "source_cell/unitcell.h" #include "source_lcao/module_hcontainer/hcontainer.h" #include "source_basis/module_nao/two_center_integrator.h" -#include "td_velocity.h" #include "source_base/vector3.h" +#include "source_io/cal_r_overlap_R.h" -#ifdef __LCAO -//design to calculate current for length gauge -class TD_current +//design to calculate velocity operator +template +class Velocity_op { public: - TD_current(const UnitCell* ucell_in, + Velocity_op(const UnitCell* ucell_in, const Grid_Driver* GridD_in, const Parallel_Orbitals* paraV, const LCAO_Orbitals& orb, const TwoCenterIntegrator* intor); - ~TD_current(); + ~Velocity_op(); hamilt::HContainer>* get_current_term_pointer(const int& i)const { return this->current_term[i]; } - void calculate_vcomm_r(); void calculate_grad_term(); @@ -36,11 +35,11 @@ class TD_current const LCAO_Orbitals& orb_; - const Grid_Driver* Grid = nullptr; /// @brief Store real space hamiltonian. TD term should include imaginary part, thus it has to be complex type. Only shared between TD operators. std::vector>*> current_term = {nullptr, nullptr, nullptr}; const TwoCenterIntegrator* intor_ = nullptr; + const TwoCenterIntegrator* intorbeta_ = nullptr; /** * @brief initialize HR, search the nearest neighbor atoms @@ -57,8 +56,8 @@ class TD_current const int& iat2, const int& T0, const Parallel_Orbitals* paraV, - const std::vector>>>& nlm1_all, - const std::vector>>>& nlm2_all, + const std::vector>>& nlm1_all, + const std::vector>>& nlm2_all, std::complex** current_mat_p); void cal_grad_IJR(const int& iat1, const int& iat2, @@ -72,8 +71,9 @@ class TD_current /// @brief Store the vector potential for td_ekinetic term ModuleBase::Vector3 cart_At; + static cal_r_overlap_R r_calculator; + static bool init_done; }; -#endif // __LCAO #endif // TD_CURRENT_H diff --git a/source/source_lcao/spar_hsr.cpp b/source/source_lcao/spar_hsr.cpp index fe092173bd..024fbfde2f 100644 --- a/source/source_lcao/spar_hsr.cpp +++ b/source/source_lcao/spar_hsr.cpp @@ -1,7 +1,7 @@ #include "spar_hsr.h" #include "source_lcao/module_hcontainer/hcontainer.h" -#include "source_lcao/module_rt/td_velocity.h" +#include "source_lcao/module_rt/td_info.h" #include "source_io/module_parameter/parameter.h" #include "spar_dh.h" #include "spar_exx.h" @@ -96,13 +96,13 @@ void sparse_format::cal_HSR(const UnitCell& ucell, HS_Arrays.all_R_coor = get_R_range(*(p_ham_lcao->getHR())); - if (TD_Velocity::tddft_velocity) + if (PARAM.inp.esolver_type == "tddft" && PARAM.inp.td_stype == 1) { sparse_format::cal_HContainer_td(pv, current_spin, sparse_thr, *(p_ham_lcao->getHR()), - TD_Velocity::td_vel_op->HR_sparse_td_vel[current_spin]); + TD_info::td_vel_op->HR_sparse_td_vel[current_spin]); } else { @@ -334,9 +334,9 @@ void sparse_format::clear_zero_elements(LCAO_HS_Arrays& HS_Arrays, const int& cu } } } - if (TD_Velocity::tddft_velocity) + if (PARAM.inp.esolver_type == "tddft" && PARAM.inp.td_stype == 1) { - for (auto& R_loop: TD_Velocity::td_vel_op->HR_sparse_td_vel[current_spin]) + for (auto& R_loop: TD_info::td_vel_op->HR_sparse_td_vel[current_spin]) { for (auto& row_loop: R_loop.second) { @@ -451,4 +451,4 @@ void sparse_format::destroy_HS_R_sparse(LCAO_HS_Arrays& HS_Arrays) // all_R_coor.swap(empty_all_R_coor); return; -} \ No newline at end of file +} diff --git a/tests/05_rtTDDFT/01_NO_KP_ocp_TDDFT/INPUT b/tests/05_rtTDDFT/01_NO_KP_ocp_TDDFT/INPUT index c266fdc000..673a3b581c 100644 --- a/tests/05_rtTDDFT/01_NO_KP_ocp_TDDFT/INPUT +++ b/tests/05_rtTDDFT/01_NO_KP_ocp_TDDFT/INPUT @@ -16,6 +16,7 @@ ks_solver scalapack_gvx basis_type lcao gamma_only 0 md_nstep 2 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 @@ -31,4 +32,4 @@ md_type nve md_dt 0.05 init_vel 1 ocp 1 -ocp_set 1*1 1*1 3*0 +ocp_set 1*1 1*1 3*0 diff --git a/tests/05_rtTDDFT/01_NO_KP_ocp_TDDFT/result.ref b/tests/05_rtTDDFT/01_NO_KP_ocp_TDDFT/result.ref index d63ad6d41e..0c5a7f4b0e 100644 --- a/tests/05_rtTDDFT/01_NO_KP_ocp_TDDFT/result.ref +++ b/tests/05_rtTDDFT/01_NO_KP_ocp_TDDFT/result.ref @@ -1,5 +1,5 @@ -etotref -18.05532086783207 -etotperatomref -9.0276604339 -totalforceref 44.849994 -totalstressref 79.412932 +etotref -18.06593168523521 +etotperatomref -9.0329658426 +totalforceref 40.752890 +totalstressref 72.113950 totaltimeref 1.51 diff --git a/tests/05_rtTDDFT/02_NO_CH_OW_TDDFT/INPUT b/tests/05_rtTDDFT/02_NO_CH_OW_TDDFT/INPUT index f2f0be477e..63e34a60ee 100644 --- a/tests/05_rtTDDFT/02_NO_CH_OW_TDDFT/INPUT +++ b/tests/05_rtTDDFT/02_NO_CH_OW_TDDFT/INPUT @@ -19,6 +19,7 @@ ks_solver scalapack_gvx basis_type lcao gamma_only 0 md_nstep 2 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 diff --git a/tests/05_rtTDDFT/02_NO_CH_OW_TDDFT/result.ref b/tests/05_rtTDDFT/02_NO_CH_OW_TDDFT/result.ref index 460006669f..64e2f2ae8f 100644 --- a/tests/05_rtTDDFT/02_NO_CH_OW_TDDFT/result.ref +++ b/tests/05_rtTDDFT/02_NO_CH_OW_TDDFT/result.ref @@ -1,6 +1,6 @@ -etotref -323.5397668883450 -etotperatomref -107.8465889628 -totalforceref 19.372571 -totalstressref 328.906753 +etotref -323.5398327660280 +etotperatomref -107.8466109220 +totalforceref 19.450256 +totalstressref 329.292627 Compare_wfc_lcao_pass 0 totaltimeref 2.08 diff --git a/tests/05_rtTDDFT/02_NO_CH_OW_TDDFT/wfs1k1g3_nao_mod.txt.ref b/tests/05_rtTDDFT/02_NO_CH_OW_TDDFT/wfs1k1g3_nao_mod.txt.ref index dc962404a1..5ed19da4f9 100644 --- a/tests/05_rtTDDFT/02_NO_CH_OW_TDDFT/wfs1k1g3_nao_mod.txt.ref +++ b/tests/05_rtTDDFT/02_NO_CH_OW_TDDFT/wfs1k1g3_nao_mod.txt.ref @@ -3,102 +3,102 @@ 10 (number of bands) 31 (number of orbitals) 1 (band) --1.61504998e+00 (Ry) +-1.61755584e+00 (Ry) 1.00000000e+00 (Occupations) -1.8296496702e-02 5.6447172182e-03 4.0514247388e-03 9.2388792329e-07 3.0330171130e-04 -4.4881203958e-01 6.1982535911e-02 2.2403840350e-03 5.3841123486e-05 1.3452976189e-02 -2.3991167172e-03 5.6431871520e-05 2.1247835984e-03 1.1019400055e-02 3.3490889887e-08 -3.7042144457e-05 2.2885228036e-03 1.7837892531e-05 4.7005265534e-01 4.4297979208e-02 -2.4210717284e-03 1.0147228658e-04 1.3492211649e-02 2.2039247404e-03 4.9848017371e-05 -2.2476199038e-03 8.2988699732e-03 5.7780902115e-08 2.4744852695e-05 2.5083780561e-03 -1.9510642429e-05 +1.7973033228e-02 5.6365835155e-03 4.0292551523e-03 9.3613124647e-07 3.1049073715e-04 +4.4881324147e-01 6.1982212024e-02 2.1866639499e-03 5.3854752435e-05 1.3443886400e-02 +2.4004885492e-03 5.6446362484e-05 2.1372116215e-03 1.1018527223e-02 3.0207201941e-08 +3.4647693721e-05 2.2873348749e-03 1.7856076996e-05 4.7006748870e-01 4.4279989219e-02 +2.3897932195e-03 1.0152249673e-04 1.3497145623e-02 2.1842163251e-03 4.9876850598e-05 +2.2483079886e-03 8.2943956363e-03 5.4581218803e-08 2.2605006631e-05 2.5123017963e-03 +1.9513113148e-05 2 (band) --7.06349720e-01 (Ry) +-7.07747396e-01 (Ry) 1.00000000e+00 (Occupations) -2.0827779822e-01 1.2349871720e-03 5.6851081834e-03 7.3014896734e-07 9.5546231224e-05 -2.4559360052e-02 9.3200356850e-03 4.1289787689e-01 7.2556087918e-08 1.1325394789e-03 -8.4182035981e-03 2.6724859091e-06 2.3439963374e-03 6.8818565976e-03 6.4555783609e-06 -2.8878335283e-03 7.0259301229e-05 1.8864247708e-06 1.9316245933e-02 1.1727763403e-02 -4.0995348649e-01 1.0741628196e-05 1.9014860314e-03 4.9270843235e-03 4.6034530531e-06 -3.2156423947e-04 6.7182166998e-03 6.4458988394e-06 2.6106396563e-03 6.1063576100e-04 -2.3488661588e-07 +2.0653072429e-01 1.2922034155e-03 5.5721322331e-03 7.2160303746e-07 1.1946461441e-04 +2.4049835276e-02 9.0533892005e-03 4.1353078277e-01 6.9010744273e-08 1.0850266122e-03 +8.5128606326e-03 2.6178316195e-06 2.3615553384e-03 6.7178999601e-03 6.4624310555e-06 +2.8515458235e-03 7.4052768556e-05 1.8573055905e-06 1.8685652776e-02 1.1546953779e-02 +4.1059371287e-01 1.0518947039e-05 2.0025618623e-03 5.0072529498e-03 4.5336636824e-06 +3.1909624844e-04 6.5641355509e-03 6.4650077421e-06 2.5762193433e-03 6.2135728577e-04 +2.3593124810e-07 3 (band) --4.80956949e-01 (Ry) +-4.79113246e-01 (Ry) 1.00000000e+00 (Occupations) -7.0800533638e-01 8.2075243095e-02 4.7054662067e-03 2.6965403325e-06 5.6742297672e-05 -5.8471448366e-02 3.7990349742e-03 2.2962014633e-01 2.4509211953e-05 7.1439273089e-03 -1.2156005471e-03 1.2291386490e-05 2.2763511022e-03 1.2529075871e-02 3.1617210025e-06 -5.1577472019e-04 2.4948002802e-04 2.5422299702e-07 4.9082842634e-02 8.0016280962e-03 -2.2474252630e-01 4.8285866678e-05 1.4985309236e-02 7.4998469202e-04 3.0016331806e-06 -2.8664892978e-03 1.2149228791e-02 4.3555935240e-06 2.9657830088e-04 1.4584919556e-03 -5.3313143993e-06 +7.0949989237e-01 8.1390285943e-02 4.9575171275e-03 2.7504618329e-06 8.1835591429e-05 +5.7799204671e-02 3.6790251304e-03 2.2770658483e-01 2.2533967243e-05 7.3942524577e-03 +1.1242094504e-03 1.1736100212e-05 2.4009897873e-03 1.2402323127e-02 3.1370837973e-06 +5.0148798457e-04 2.4032930056e-04 3.7185915214e-07 4.8045592677e-02 8.0553442983e-03 +2.2283814985e-01 4.5776182772e-05 1.5502909712e-02 6.2832313743e-04 3.2578627130e-06 +2.8429788855e-03 1.2036482557e-02 4.3300276852e-06 2.8188339374e-04 1.5085617131e-03 +5.1181029768e-06 4 (band) --4.48031918e-01 (Ry) +-4.50651346e-01 (Ry) 1.00000000e+00 (Occupations) -1.2801751353e-02 6.7405479411e-04 1.2028360500e-03 1.3476687096e-06 7.1697077960e-04 -7.0280868816e-03 2.6360626791e-03 2.7938344851e-03 3.8144623577e-03 6.3186608011e-01 -2.9483088945e-04 8.0891983622e-04 1.2859531145e-01 3.1164670680e-03 6.0733584326e-06 -1.0345825090e-03 6.6001922757e-02 3.2880708894e-04 8.2728426426e-03 3.4159513251e-03 -2.8429717941e-03 4.0992767012e-03 6.7967934515e-01 2.2942629302e-04 6.8979390576e-04 -1.1231965413e-01 3.1852089431e-03 6.4026851239e-06 1.0314470618e-03 7.2323733701e-02 -3.6969971251e-04 +1.3215965624e-02 7.3798641996e-04 1.2038973025e-03 1.7937550905e-06 6.7028378581e-04 +6.9718289138e-03 2.5739994415e-03 2.8137532816e-03 3.8119796372e-03 6.3187318495e-01 +3.1901058225e-04 8.0847071103e-04 1.2861262374e-01 3.1525406399e-03 6.1162723759e-06 +1.0276720894e-03 6.6002797230e-02 3.2862533094e-04 8.4196142496e-03 3.4694204484e-03 +2.9150739715e-03 4.0961852049e-03 6.7963857691e-01 2.1227695507e-04 6.8941250116e-04 +1.1232828913e-01 3.2277363043e-03 6.4199729130e-06 1.0253152403e-03 7.2324966855e-02 +3.6949273003e-04 5 (band) --4.26612427e-01 (Ry) +-4.29244383e-01 (Ry) 1.00000000e+00 (Occupations) -1.2561260939e-04 1.1602996043e-05 5.3930895050e-06 9.2721789504e-05 4.3332158726e-06 -2.3865298254e-05 1.2693998871e-05 2.7714885760e-05 6.3650070230e-01 3.8407976565e-03 -1.4036465164e-06 1.3045955071e-01 7.5157578582e-04 1.6779132484e-05 1.0354407861e-03 -6.4192392721e-06 4.0395556857e-04 5.5544827758e-02 1.4371496653e-04 7.4356660965e-05 -2.7915264080e-05 6.8693957439e-01 4.1458577710e-03 4.7563011967e-07 1.1227396267e-01 -6.6537333131e-04 1.4043483436e-05 1.0413370897e-03 6.1646934447e-06 4.4306290140e-04 -6.2658521762e-02 +1.2546784263e-04 1.1549555323e-05 5.4861100875e-06 1.7618788451e-04 4.0258885017e-06 +2.4553679476e-05 1.3128486248e-05 2.6970170350e-05 6.3651768261e-01 3.8382457432e-03 +1.6118902935e-06 1.3046899203e-01 7.5113869585e-04 1.7036696317e-05 1.0434795778e-03 +6.3775793448e-06 4.0369713070e-04 5.5551262544e-02 1.4438094641e-04 7.4707587826e-05 +2.7467298158e-05 6.8689923238e-01 4.1429029353e-03 4.1973262045e-07 1.1228566368e-01 +6.6495939232e-04 1.4345339069e-05 1.0445406969e-03 6.1207392476e-06 4.4277257659e-04 +6.2664476162e-02 6 (band) -4.06143349e-01 (Ry) +4.03555951e-01 (Ry) 0.00000000e+00 (Occupations) -6.9066279067e-06 2.6256917398e-06 2.2592503397e-06 8.8107224109e-05 2.6681391552e-06 -2.4358756699e-04 2.1923665578e-06 6.3330085181e-06 9.7314749213e-01 7.8131860493e-03 -6.3318222375e-06 5.6630717697e-02 4.9348590407e-04 8.1195249515e-06 1.3835020156e-03 -1.0312747920e-05 1.1849247069e-03 1.6452599098e-01 2.3657523606e-04 1.6440335867e-05 -1.9433488409e-06 9.7075269813e-01 7.7866344617e-03 2.1981065982e-06 6.3607839186e-02 -5.5550256117e-04 4.8726661699e-06 1.3423179940e-03 9.5820176719e-06 1.2925915782e-03 -1.7669304559e-01 +8.1683925769e-06 1.4722915207e-06 1.9948122052e-06 1.3200895008e-04 2.4021948885e-06 +2.4242079429e-04 1.6150496660e-06 6.9023730019e-06 9.7310837647e-01 7.7981683079e-03 +6.0647157972e-06 5.6610304955e-02 4.9202412347e-04 9.7624398044e-06 1.3864041088e-03 +1.0077421290e-05 1.1828407394e-03 1.6453337227e-01 2.3314812432e-04 1.7930229814e-05 +2.1137369530e-06 9.7075032389e-01 7.7723245275e-03 2.2152868719e-06 6.3595469597e-02 +5.5426047813e-04 6.1501583800e-06 1.3430510326e-03 9.4412376964e-06 1.2903623626e-03 +1.7669219433e-01 7 (band) -4.31724136e-01 (Ry) +4.29135221e-01 (Ry) 0.00000000e+00 (Occupations) -1.7877403870e-03 4.7911036757e-05 1.3655675999e-04 3.5411982039e-07 1.3001575816e-04 -9.8556222987e-02 1.2155832352e-02 7.5056655562e-04 7.7240767245e-03 9.9375534234e-01 -1.1369349225e-03 4.8920262860e-04 6.7708181532e-02 3.7885375132e-04 1.0836394737e-05 -1.2736501628e-03 1.5671558922e-01 1.3511389123e-03 9.5960666538e-02 1.6329343328e-02 -3.9539333088e-04 7.7114230713e-03 9.9118418750e-01 3.0554944734e-04 5.3233712827e-04 -7.4132063862e-02 2.1695804472e-03 1.0777631124e-05 1.2395520876e-03 1.6931170376e-01 -1.4409081110e-03 +2.0483430953e-03 2.1290771690e-04 4.7751193802e-04 1.4707473235e-06 1.0462721745e-04 +9.8666649512e-02 1.1655949473e-02 8.5225424258e-04 7.7099091869e-03 9.9362720904e-01 +1.1296245859e-03 4.8817605249e-04 6.7644953642e-02 6.7149093710e-04 1.0840345166e-05 +1.2451690036e-03 1.5673285862e-01 1.3488300546e-03 9.5609188618e-02 1.6675102183e-02 +4.1262849603e-04 7.6976327316e-03 9.9115499004e-01 2.8451518740e-04 5.3136929190e-04 +7.4105703116e-02 2.4097974271e-03 1.0772646344e-05 1.2234030864e-03 1.6933164045e-01 +1.4384194040e-03 8 (band) -4.94077928e-01 (Ry) +4.92284914e-01 (Ry) 0.00000000e+00 (Occupations) -2.5907756421e-01 3.7734088558e-02 5.4628202967e-02 5.2772024356e-08 1.0416478702e-04 -2.5378889691e-01 3.0884105019e-01 1.0484017347e-01 1.8495496271e-05 1.5596425564e-02 -7.5486308307e-02 6.9770079141e-06 2.6926300421e-03 2.1017939738e-01 4.3971241761e-06 -7.1066431216e-04 8.5118085116e-04 3.2751611150e-05 1.5707572402e-01 3.3347013316e-01 -9.8300141060e-02 5.9068228006e-06 3.5353398980e-03 7.4567805729e-02 5.0952760309e-05 -2.8150155053e-03 2.0950896868e-01 5.6174652865e-06 6.1734643614e-04 1.8379188672e-03 -7.6413773890e-06 +2.5847673924e-01 3.5257716671e-02 5.4429773382e-02 4.3001919268e-08 1.1703814288e-04 +2.5391739847e-01 3.0906462859e-01 1.0309388450e-01 1.5712488430e-05 1.6757312373e-02 +7.4477641576e-02 7.1409157814e-06 2.7625711336e-03 2.1035588378e-01 4.3173293094e-06 +6.4592574702e-04 1.0158460762e-03 3.3313116902e-05 1.5848502785e-01 3.3347675036e-01 +9.6591033633e-02 8.9410837584e-06 2.2780796705e-03 7.3586838421e-02 5.0767785523e-05 +3.0484527462e-03 2.0961786979e-01 5.5400550591e-06 5.4738032999e-04 2.0896375541e-03 +7.0185962671e-06 9 (band) -7.34727750e-01 (Ry) +7.32222369e-01 (Ry) 0.00000000e+00 (Occupations) -2.5242826695e-03 9.7154036619e-04 4.2930752078e-04 3.1919157385e-07 8.7608345040e-04 -2.2779927257e+00 3.7748471403e-01 4.8719568410e-02 2.8884961199e-04 3.8826269018e-02 -1.0901904391e-02 8.5469195398e-05 4.7287754964e-03 1.4018687453e-01 8.1030772943e-07 -8.4696068479e-05 7.8133183866e-03 5.1077335205e-05 2.2815695414e+00 3.7137823112e-01 -4.3813092946e-02 3.5578877912e-04 3.9632573837e-02 1.6356749322e-02 1.6145637065e-04 -5.7354574882e-03 1.3199935068e-01 6.0659429427e-07 1.2699105255e-04 8.4209444525e-03 -5.9693972505e-05 +2.4578695350e-03 8.5843807140e-04 6.2468854349e-04 2.5395126951e-07 1.2683386927e-03 +2.2778058062e+00 3.7725419109e-01 4.7386829956e-02 2.8867590703e-04 3.8786144228e-02 +1.0678273189e-02 8.5392123886e-05 4.7205991655e-03 1.4010791076e-01 7.5925567125e-07 +1.1082943750e-04 7.8127831595e-03 5.1040821121e-05 2.2812710521e+00 3.7121246547e-01 +4.2697505218e-02 3.5566666679e-04 3.9610957533e-02 1.5859332778e-02 1.6142457000e-04 +5.7494172987e-03 1.3199569563e-01 6.0546882772e-07 1.5523585585e-04 8.4274708110e-03 +5.9663287292e-05 10 (band) -9.19989236e-01 (Ry) +9.17560598e-01 (Ry) 0.00000000e+00 (Occupations) -1.4377497264e-02 3.6140660556e-03 3.5878615007e-03 3.5374022080e-07 1.7079481791e-03 -6.1878793163e-02 1.2787227582e-02 1.4912881127e+00 7.4348380846e-06 2.8739432591e-03 -3.1678010447e-01 2.5604608822e-06 1.4801416149e-03 5.7593264393e-03 9.9835630232e-07 -3.4562105285e-03 3.7069076132e-04 8.5454627232e-07 6.3978183383e-02 3.7533179240e-03 -1.4744512122e+00 1.0758533388e-05 3.1621206549e-03 3.4455811593e-01 6.6266996522e-06 -1.4618311232e-03 1.7637191171e-03 7.8183066436e-08 2.6208305091e-03 4.0890930217e-04 -1.8473886285e-06 +1.4605760895e-02 3.2672341171e-03 3.5046933774e-03 3.2981741935e-07 1.4169970771e-03 +6.0584781494e-02 1.2710680005e-02 1.4913804403e+00 7.1951578087e-06 2.9200959258e-03 +3.1644331888e-01 2.5015543231e-06 1.5440221499e-03 5.6773360365e-03 9.5832726527e-07 +3.3827355085e-03 3.7440570824e-04 8.0049775928e-07 6.2704352743e-02 3.8212494469e-03 +1.4740759426e+00 1.0482135474e-05 3.1784866569e-03 3.4460812261e-01 6.4696964585e-06 +1.4877818341e-03 1.8027792019e-03 7.7708899765e-08 2.5473307995e-03 3.9643734513e-04 +1.7671374051e-06 diff --git a/tests/05_rtTDDFT/03_NO_CO_TDDFT/INPUT b/tests/05_rtTDDFT/03_NO_CO_TDDFT/INPUT index 36350ab20e..22cbe3b7dc 100644 --- a/tests/05_rtTDDFT/03_NO_CO_TDDFT/INPUT +++ b/tests/05_rtTDDFT/03_NO_CO_TDDFT/INPUT @@ -16,6 +16,7 @@ ks_solver scalapack_gvx basis_type lcao gamma_only 0 md_nstep 2 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 diff --git a/tests/05_rtTDDFT/03_NO_CO_TDDFT/result.ref b/tests/05_rtTDDFT/03_NO_CO_TDDFT/result.ref index 19ab9cb76f..07685a2d0c 100644 --- a/tests/05_rtTDDFT/03_NO_CO_TDDFT/result.ref +++ b/tests/05_rtTDDFT/03_NO_CO_TDDFT/result.ref @@ -1,5 +1,5 @@ -etotref -603.4339685991257 -etotperatomref -301.7169842996 -totalforceref 14.762982 -totalstressref 32.741000 +etotref -603.4336857561682 +etotperatomref -301.7168428781 +totalforceref 12.095750 +totalstressref 27.935490 totaltimeref 2.53 diff --git a/tests/05_rtTDDFT/04_NO_CO_ocp_TDDFT/INPUT b/tests/05_rtTDDFT/04_NO_CO_ocp_TDDFT/INPUT index aa2a749aa9..e5a908356c 100644 --- a/tests/05_rtTDDFT/04_NO_CO_ocp_TDDFT/INPUT +++ b/tests/05_rtTDDFT/04_NO_CO_ocp_TDDFT/INPUT @@ -16,6 +16,7 @@ ks_solver scalapack_gvx basis_type lcao gamma_only 0 md_nstep 2 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 diff --git a/tests/05_rtTDDFT/04_NO_CO_ocp_TDDFT/result.ref b/tests/05_rtTDDFT/04_NO_CO_ocp_TDDFT/result.ref index 10320d8162..34c12e8623 100644 --- a/tests/05_rtTDDFT/04_NO_CO_ocp_TDDFT/result.ref +++ b/tests/05_rtTDDFT/04_NO_CO_ocp_TDDFT/result.ref @@ -1,5 +1,5 @@ -etotref -603.4339685991248 -etotperatomref -301.7169842996 -totalforceref 14.762982 -totalstressref 32.737292 +etotref -603.4337279119619 +etotperatomref -301.7168639560 +totalforceref 12.106586 +totalstressref 27.960198 totaltimeref 2.71 diff --git a/tests/05_rtTDDFT/05_NO_cur_TDDFT/INPUT b/tests/05_rtTDDFT/05_NO_cur_TDDFT/INPUT index 048b254f70..cae0409438 100644 --- a/tests/05_rtTDDFT/05_NO_cur_TDDFT/INPUT +++ b/tests/05_rtTDDFT/05_NO_cur_TDDFT/INPUT @@ -15,6 +15,7 @@ ks_solver scalapack_gvx basis_type lcao gamma_only 0 md_nstep 3 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 diff --git a/tests/05_rtTDDFT/05_NO_cur_TDDFT/refcurrent_total.dat b/tests/05_rtTDDFT/05_NO_cur_TDDFT/refcurrent_total.dat index 5f225fd90f..56a9f6e13b 100644 --- a/tests/05_rtTDDFT/05_NO_cur_TDDFT/refcurrent_total.dat +++ b/tests/05_rtTDDFT/05_NO_cur_TDDFT/refcurrent_total.dat @@ -1,4 +1,4 @@ 0 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 -1 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 -2 -4.2482488063038011e-04 3.6208093141272442e-05 5.7880862345902912e-05 -3 1.7506474069499989e-04 9.7936761289276890e-05 1.5650847511644919e-04 \ No newline at end of file +1 1.3253329345174151e-07 -1.1309759467952081e-08 -1.8100967211240555e-08 +2 -1.8712729254901428e-07 -1.9255546268328018e-08 -3.0821009248708681e-08 +3 1.6157844599780660e-08 1.2274265606089292e-08 1.9637494050295524e-08 diff --git a/tests/05_rtTDDFT/05_NO_cur_TDDFT/result.ref b/tests/05_rtTDDFT/05_NO_cur_TDDFT/result.ref index dbe64306cd..d3cd1841df 100644 --- a/tests/05_rtTDDFT/05_NO_cur_TDDFT/result.ref +++ b/tests/05_rtTDDFT/05_NO_cur_TDDFT/result.ref @@ -1,6 +1,6 @@ -etotref -30.91255706614114 -etotperatomref -15.4562785331 -totalforceref 0.459938 -totalstressref 0.946457 +etotref -30.91255300422832 +etotperatomref -15.4562765021 +totalforceref 0.479532 +totalstressref 0.981046 CompareCurrent_pass 0 totaltimeref 1.72 diff --git a/tests/05_rtTDDFT/06_NO_dir_TDDFT/INPUT b/tests/05_rtTDDFT/06_NO_dir_TDDFT/INPUT old mode 100755 new mode 100644 index 68647f1cde..aefea252be --- a/tests/05_rtTDDFT/06_NO_dir_TDDFT/INPUT +++ b/tests/05_rtTDDFT/06_NO_dir_TDDFT/INPUT @@ -16,6 +16,7 @@ ks_solver scalapack_gvx basis_type lcao gamma_only 0 md_nstep 2 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 diff --git a/tests/05_rtTDDFT/06_NO_dir_TDDFT/KPT b/tests/05_rtTDDFT/06_NO_dir_TDDFT/KPT old mode 100755 new mode 100644 diff --git a/tests/05_rtTDDFT/06_NO_dir_TDDFT/STRU b/tests/05_rtTDDFT/06_NO_dir_TDDFT/STRU old mode 100755 new mode 100644 diff --git a/tests/05_rtTDDFT/06_NO_dir_TDDFT/result.ref b/tests/05_rtTDDFT/06_NO_dir_TDDFT/result.ref index ed14fa024d..5fbff0177d 100644 --- a/tests/05_rtTDDFT/06_NO_dir_TDDFT/result.ref +++ b/tests/05_rtTDDFT/06_NO_dir_TDDFT/result.ref @@ -1,5 +1,5 @@ -etotref -30.45466274119030 -etotperatomref -15.2273313706 -totalforceref 0.57439400 -totalstressref 4.285714 +etotref -30.45454376271165 +etotperatomref -15.2272718814 +totalforceref 0.595498 +totalstressref 4.286358 totaltimeref 1.55 diff --git a/tests/05_rtTDDFT/07_NO_EDM_TDDFT/INPUT b/tests/05_rtTDDFT/07_NO_EDM_TDDFT/INPUT index 41f7bdb5c8..2ef3cb7c96 100644 --- a/tests/05_rtTDDFT/07_NO_EDM_TDDFT/INPUT +++ b/tests/05_rtTDDFT/07_NO_EDM_TDDFT/INPUT @@ -16,6 +16,7 @@ ks_solver scalapack_gvx basis_type lcao gamma_only 0 md_nstep 2 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 diff --git a/tests/05_rtTDDFT/07_NO_EDM_TDDFT/result.ref b/tests/05_rtTDDFT/07_NO_EDM_TDDFT/result.ref index e8e3d2d48c..e319cfc11e 100644 --- a/tests/05_rtTDDFT/07_NO_EDM_TDDFT/result.ref +++ b/tests/05_rtTDDFT/07_NO_EDM_TDDFT/result.ref @@ -1,5 +1,5 @@ -etotref -18.05466171990316 -etotperatomref -9.0273308600 -totalforceref 43.10812600 -totalstressref 76.35413900 +etotref -18.06494189760862 +etotperatomref -9.0324709488 +totalforceref 41.359252 +totalstressref 73.228950 totaltimeref 1.53 diff --git a/tests/05_rtTDDFT/08_NO_ETRS_TDDFT/INPUT b/tests/05_rtTDDFT/08_NO_ETRS_TDDFT/INPUT index dd0503ad2d..d0144baf53 100644 --- a/tests/05_rtTDDFT/08_NO_ETRS_TDDFT/INPUT +++ b/tests/05_rtTDDFT/08_NO_ETRS_TDDFT/INPUT @@ -7,6 +7,7 @@ gamma_only 0 # multiple k points md_type nve md_dt 0.05 # MD time step md_nstep 2 # number of MD steps +estep_per_md 1 init_vel 1 # initial velocity # occupations of bands diff --git a/tests/05_rtTDDFT/08_NO_ETRS_TDDFT/result.ref b/tests/05_rtTDDFT/08_NO_ETRS_TDDFT/result.ref index 165990fd68..ea8a6bd3bc 100644 --- a/tests/05_rtTDDFT/08_NO_ETRS_TDDFT/result.ref +++ b/tests/05_rtTDDFT/08_NO_ETRS_TDDFT/result.ref @@ -1,5 +1,5 @@ -etotref -17.97090331943867 -etotperatomref -8.9854516597 -totalforceref 48.470218 -totalstressref 85.720449 +etotref -17.98590116761530 +etotperatomref -8.9929505838 +totalforceref 36.244632 +totalstressref 63.982423 totaltimeref 0.78 diff --git a/tests/05_rtTDDFT/09_NO_HEAV_TDDFT/INPUT b/tests/05_rtTDDFT/09_NO_HEAV_TDDFT/INPUT index d215681e48..51499b8a4e 100644 --- a/tests/05_rtTDDFT/09_NO_HEAV_TDDFT/INPUT +++ b/tests/05_rtTDDFT/09_NO_HEAV_TDDFT/INPUT @@ -16,6 +16,7 @@ ks_solver scalapack_gvx basis_type lcao gamma_only 0 md_nstep 2 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 diff --git a/tests/05_rtTDDFT/09_NO_HEAV_TDDFT/result.ref b/tests/05_rtTDDFT/09_NO_HEAV_TDDFT/result.ref index 7fe9afe5ac..16bc961000 100644 --- a/tests/05_rtTDDFT/09_NO_HEAV_TDDFT/result.ref +++ b/tests/05_rtTDDFT/09_NO_HEAV_TDDFT/result.ref @@ -1,5 +1,5 @@ -etotref -22.97718184915547 -etotperatomref -11.4885909246 -totalforceref 0.56587600 -totalstressref 76.073961 +etotref -22.97638349080425 +etotperatomref -11.4881917454 +totalforceref 0.582042 +totalstressref 76.025571 totaltimeref 1.56 diff --git a/tests/05_rtTDDFT/10_NO_HHG_TDDFT/INPUT b/tests/05_rtTDDFT/10_NO_HHG_TDDFT/INPUT old mode 100755 new mode 100644 index 998cbbb475..67adfbee74 --- a/tests/05_rtTDDFT/10_NO_HHG_TDDFT/INPUT +++ b/tests/05_rtTDDFT/10_NO_HHG_TDDFT/INPUT @@ -15,6 +15,7 @@ ks_solver scalapack_gvx basis_type lcao gamma_only 0 md_nstep 2 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 diff --git a/tests/05_rtTDDFT/10_NO_HHG_TDDFT/KPT b/tests/05_rtTDDFT/10_NO_HHG_TDDFT/KPT old mode 100755 new mode 100644 diff --git a/tests/05_rtTDDFT/10_NO_HHG_TDDFT/STRU b/tests/05_rtTDDFT/10_NO_HHG_TDDFT/STRU old mode 100755 new mode 100644 diff --git a/tests/05_rtTDDFT/10_NO_HHG_TDDFT/result.ref b/tests/05_rtTDDFT/10_NO_HHG_TDDFT/result.ref index 6e676b2f56..e47c61dabb 100644 --- a/tests/05_rtTDDFT/10_NO_HHG_TDDFT/result.ref +++ b/tests/05_rtTDDFT/10_NO_HHG_TDDFT/result.ref @@ -1,5 +1,5 @@ -etotref 20.38731422853930 -etotperatomref 10.1936571143 -totalforceref 0.73949000 -totalstressref 489.377111 +etotref 20.47683114572229 +etotperatomref 10.2384155729 +totalforceref 0.451670 +totalstressref 487.779801 totaltimeref 1.56 diff --git a/tests/05_rtTDDFT/11_NO_O3_TDDFT/INPUT b/tests/05_rtTDDFT/11_NO_O3_TDDFT/INPUT index 836885346b..9fb483ce2f 100644 --- a/tests/05_rtTDDFT/11_NO_O3_TDDFT/INPUT +++ b/tests/05_rtTDDFT/11_NO_O3_TDDFT/INPUT @@ -17,6 +17,7 @@ basis_type lcao out_chg 1 gamma_only 0 md_nstep 2 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 diff --git a/tests/05_rtTDDFT/11_NO_O3_TDDFT/result.ref b/tests/05_rtTDDFT/11_NO_O3_TDDFT/result.ref index fb20ab8d24..bee5bb6a00 100644 --- a/tests/05_rtTDDFT/11_NO_O3_TDDFT/result.ref +++ b/tests/05_rtTDDFT/11_NO_O3_TDDFT/result.ref @@ -1,5 +1,5 @@ -etotref -1336.999614848928 -etotperatomref -445.6665382830 -totalforceref 11.103409 -totalstressref 61.267028 +etotref -1336.999498209979 +etotperatomref -445.6664994033 +totalforceref 11.627501 +totalstressref 64.927558 totaltimeref 2.42 diff --git a/tests/05_rtTDDFT/12_NO_re_TDDFT/INPUT b/tests/05_rtTDDFT/12_NO_re_TDDFT/INPUT index f31fd0fe78..679c171d33 100644 --- a/tests/05_rtTDDFT/12_NO_re_TDDFT/INPUT +++ b/tests/05_rtTDDFT/12_NO_re_TDDFT/INPUT @@ -16,6 +16,7 @@ ks_solver scalapack_gvx basis_type lcao gamma_only 0 md_nstep 2 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 diff --git a/tests/05_rtTDDFT/13_NO_Taylor_TDDFT/INPUT b/tests/05_rtTDDFT/13_NO_Taylor_TDDFT/INPUT index 941e29434a..64c81c8fc9 100644 --- a/tests/05_rtTDDFT/13_NO_Taylor_TDDFT/INPUT +++ b/tests/05_rtTDDFT/13_NO_Taylor_TDDFT/INPUT @@ -16,6 +16,7 @@ ks_solver scalapack_gvx basis_type lcao gamma_only 0 md_nstep 2 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 diff --git a/tests/05_rtTDDFT/13_NO_Taylor_TDDFT/result.ref b/tests/05_rtTDDFT/13_NO_Taylor_TDDFT/result.ref index 81a204667a..f39f260c10 100644 --- a/tests/05_rtTDDFT/13_NO_Taylor_TDDFT/result.ref +++ b/tests/05_rtTDDFT/13_NO_Taylor_TDDFT/result.ref @@ -1,5 +1,5 @@ -etotref -17.55895929643325 -etotperatomref -8.7794796482 -totalforceref 25.866338 -totalstressref 45.642484 +etotref 18.66922016480692 +etotperatomref 9.3346100824 +totalforceref 82.531062 +totalstressref 170.582088 totaltimeref 1.54 diff --git a/tests/05_rtTDDFT/14_NO_TRAP_TDDFT/INPUT b/tests/05_rtTDDFT/14_NO_TRAP_TDDFT/INPUT old mode 100755 new mode 100644 index 8531aa5d5f..8b3cc43a28 --- a/tests/05_rtTDDFT/14_NO_TRAP_TDDFT/INPUT +++ b/tests/05_rtTDDFT/14_NO_TRAP_TDDFT/INPUT @@ -15,6 +15,7 @@ ks_solver scalapack_gvx basis_type lcao gamma_only 0 md_nstep 2 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 diff --git a/tests/05_rtTDDFT/14_NO_TRAP_TDDFT/KPT b/tests/05_rtTDDFT/14_NO_TRAP_TDDFT/KPT old mode 100755 new mode 100644 diff --git a/tests/05_rtTDDFT/14_NO_TRAP_TDDFT/STRU b/tests/05_rtTDDFT/14_NO_TRAP_TDDFT/STRU old mode 100755 new mode 100644 diff --git a/tests/05_rtTDDFT/14_NO_TRAP_TDDFT/result.ref b/tests/05_rtTDDFT/14_NO_TRAP_TDDFT/result.ref index 264acd99d0..c46aedc830 100644 --- a/tests/05_rtTDDFT/14_NO_TRAP_TDDFT/result.ref +++ b/tests/05_rtTDDFT/14_NO_TRAP_TDDFT/result.ref @@ -1,5 +1,5 @@ -etotref -30.89965242483882 -etotperatomref -15.4498262124 -totalforceref 0.57561800 -totalstressref 1.03619000 +etotref -30.89964815765915 +etotperatomref -15.4498240788 +totalforceref 0.596612 +totalstressref 1.073053 totaltimeref 1.44 diff --git a/tests/05_rtTDDFT/15_NO_TRI_TDDFT/INPUT b/tests/05_rtTDDFT/15_NO_TRI_TDDFT/INPUT old mode 100755 new mode 100644 index d992e156a5..4e255477d6 --- a/tests/05_rtTDDFT/15_NO_TRI_TDDFT/INPUT +++ b/tests/05_rtTDDFT/15_NO_TRI_TDDFT/INPUT @@ -15,6 +15,7 @@ ks_solver scalapack_gvx basis_type lcao gamma_only 0 md_nstep 2 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 diff --git a/tests/05_rtTDDFT/15_NO_TRI_TDDFT/KPT b/tests/05_rtTDDFT/15_NO_TRI_TDDFT/KPT old mode 100755 new mode 100644 diff --git a/tests/05_rtTDDFT/15_NO_TRI_TDDFT/STRU b/tests/05_rtTDDFT/15_NO_TRI_TDDFT/STRU old mode 100755 new mode 100644 diff --git a/tests/05_rtTDDFT/15_NO_TRI_TDDFT/result.ref b/tests/05_rtTDDFT/15_NO_TRI_TDDFT/result.ref index 6948429d12..0db2ec45d1 100644 --- a/tests/05_rtTDDFT/15_NO_TRI_TDDFT/result.ref +++ b/tests/05_rtTDDFT/15_NO_TRI_TDDFT/result.ref @@ -1,5 +1,5 @@ -etotref -30.90912142263002 -etotperatomref -15.4545607113 -totalforceref 0.57561800 -totalstressref 1.11089700 +etotref -30.90911715730050 +etotperatomref -15.4545585787 +totalforceref 0.596616 +totalstressref 1.147852 totaltimeref 1.43 diff --git a/tests/05_rtTDDFT/16_NO_vel_TDDFT/INPUT b/tests/05_rtTDDFT/16_NO_vel_TDDFT/INPUT index 80cce9250c..7a258e2e94 100644 --- a/tests/05_rtTDDFT/16_NO_vel_TDDFT/INPUT +++ b/tests/05_rtTDDFT/16_NO_vel_TDDFT/INPUT @@ -15,6 +15,7 @@ ks_solver scalapack_gvx basis_type lcao gamma_only 0 md_nstep 3 +estep_per_md 1 mixing_type broyden mixing_beta 0.7 diff --git a/tests/05_rtTDDFT/16_NO_vel_TDDFT/refcurrent_total.dat b/tests/05_rtTDDFT/16_NO_vel_TDDFT/refcurrent_total.dat index 4ee29a7eaf..77e00cbc27 100644 --- a/tests/05_rtTDDFT/16_NO_vel_TDDFT/refcurrent_total.dat +++ b/tests/05_rtTDDFT/16_NO_vel_TDDFT/refcurrent_total.dat @@ -1,4 +1,4 @@ 0 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 -1 1.6700828194296424e-03 3.5669278705442575e-05 5.7061051081810922e-05 -2 1.6385312870572283e-04 4.3242072196134118e-05 6.9166714437575135e-05 -3 7.0853994605125762e-04 1.5375830219108638e-05 2.4580087680048089e-05 +1 2.7669187278007260e-07 -1.3892875565558252e-09 -2.2297436846799228e-09 +2 2.2955881029817558e-07 3.4521250836946458e-09 5.5110950473557321e-09 +3 1.3457006814286624e-07 1.5269022218929118e-08 2.4393767948848288e-08 diff --git a/tests/05_rtTDDFT/16_NO_vel_TDDFT/result.ref b/tests/05_rtTDDFT/16_NO_vel_TDDFT/result.ref index bcab77040f..dcbb5f1498 100644 --- a/tests/05_rtTDDFT/16_NO_vel_TDDFT/result.ref +++ b/tests/05_rtTDDFT/16_NO_vel_TDDFT/result.ref @@ -1,6 +1,6 @@ -etotref -30.91272078341993 -etotperatomref -15.4563603917 -totalforceref 0.459664 -totalstressref 0.945878 +etotref -30.91272578807960 +etotperatomref -15.4563628940 +totalforceref 0.479236 +totalstressref 0.980314 CompareCurrent_pass 0 totaltimeref 1.81 diff --git a/tests/05_rtTDDFT/17_NO_vel_TDDFT/INPUT b/tests/05_rtTDDFT/17_NO_vel_TDDFT/INPUT index 5ddd65843d..9148d55634 100644 --- a/tests/05_rtTDDFT/17_NO_vel_TDDFT/INPUT +++ b/tests/05_rtTDDFT/17_NO_vel_TDDFT/INPUT @@ -5,6 +5,7 @@ calculation md esolver_type tddft md_type nve md_nstep 2 +estep_per_md 1 md_dt 0.05 md_tfirst 0 diff --git a/tests/05_rtTDDFT/17_NO_vel_TDDFT/result.ref b/tests/05_rtTDDFT/17_NO_vel_TDDFT/result.ref index da8c639f1b..2ab84c92e8 100644 --- a/tests/05_rtTDDFT/17_NO_vel_TDDFT/result.ref +++ b/tests/05_rtTDDFT/17_NO_vel_TDDFT/result.ref @@ -1,4 +1,4 @@ -etotref -194.7716932784952 -etotperatomref -97.3858466392 +etotref -194.7715239600903 +etotperatomref -97.3857619800 CompareCurrent_pass 0 totaltimeref 6.74 diff --git a/tests/05_rtTDDFT/Autotest.sh b/tests/05_rtTDDFT/Autotest.sh new file mode 100644 index 0000000000..ba39cb886c --- /dev/null +++ b/tests/05_rtTDDFT/Autotest.sh @@ -0,0 +1,329 @@ +#!/bin/bash + +# ABACUS executable path +abacus=/public/home/hlx/zaotian/ABACUS/tmp/git-25-7-8/bin/abacus +# number of MPI processes +np=4 +nt=$OMP_NUM_THREADS # number of OpenMP threads, default is $OMP_NUM_THREADS +# threshold with unit: eV +threshold=0.0000001 +force_threshold=0.0001 +stress_threshold=0.001 +# check accuracy +ca=8 +# specify the test cases file +cases_file=CASES_CPU.txt +# regex of case name +case='^[^#].*_.*$' +# enable AddressSanitizer +sanitize=false + +threshold_file="threshold" +# can specify the threshold for each test case +# threshold file example: +# threshold 0.0000001 +# force_threshold 0.0001 +# stress_threshold 0.001 +# fatal_threshold 1 + + +while getopts a:n:t:c:s:r:f:go: flag +do + case "${flag}" in + a) abacus=${OPTARG};; + n) np=${OPTARG};; + t) threshold=${OPTARG};; + c) ca=${OPTARG};; + s) sanitize=${OPTARG};; + r) case=${OPTARG};; + f) cases_file=${OPTARG};; + g) g=true;; #generate test reference + o) nt=${OPTARG};; # number of OpenMP threads + esac +done + +# number of OpenMP threads +if [[ -z "$nt" ]]; then + nt=$(expr `nproc` / ${np}) +fi +export OMP_NUM_THREADS=${nt} + +echo "-----AUTO TESTS OF ABACUS ------" +echo "ABACUS path: $abacus" +echo "Number of processes: $np" +echo "Number of threads: $nt" +echo "Test accuracy totenergy: $threshold eV" +echo "Test accuracy force: $force_threshold" +echo "Test accuracy stress: $stress_threshold" +echo "Check accuaracy: $ca" +echo "Test cases file: $cases_file" +echo "Test cases regex: $case" +echo "Generate reference: $g" +echo "--------------------------------" +echo "" + + +#---------------------------------------------------------- +# check_deviation() +#---------------------------------------------------------- +check_deviation_pass(){ + deviation=$1 + thr=$2 + echo $(awk -v deviation="$deviation" -v thr="$thr" 'BEGIN{ if (sqrt(deviation*deviation) < thr) print 1; else print 0}') +} + +#---------------------------------------------------------- +# define a function named 'check_out' +#---------------------------------------------------------- +check_out(){ + #------------------------------------------------------ + # input file $1 is 'result.out' in each test directory + #------------------------------------------------------ + outfile=$1 + thr=$2 + force_thr=$3 + stress_thr=$4 + fatal_thr=$5 + + #------------------------------------------------------ + # outfile = result.out + #------------------------------------------------------ + properties=`awk '{print $1}' $outfile` + + #------------------------------------------------------ + # README + #------------------------------------------------------ + if test -e "README"; then + readme=`cat README` + echo "[----------] $readme" + fi + + #------------------------------------------------------ + # check every 'key' word + #------------------------------------------------------ + ifail=0 # if all properties have no warning. 0: no warning, 1: warning + ifatal=0 # if all properties have no fatal error. 0: no fatal error, 1: fatal error + for key in $properties; do + + if [ $key == "totaltimeref" ]; then + # echo "time=$cal ref=$ref" + break + fi + + #-------------------------------------------------- + # calculated value + #-------------------------------------------------- + cal=`grep -w "$key" result.out | awk '{printf "%.'$ca'f\n",$2}'` + + #-------------------------------------------------- + # reference value + #-------------------------------------------------- + ref=`grep -w "$key" result.ref | awk '{printf "%.'$ca'f\n",$2}'` + + #-------------------------------------------------- + # computed the deviation between the calculated + # and reference value + #-------------------------------------------------- + deviation=`awk 'BEGIN {x='$ref';y='$cal';printf "%.'$ca'f\n",x-y}'` + + + #-------------------------------------------------- + # If deviation < thr, then the test passes, + # otherwise, the test prints out warning + # Daye Zheng found bug on 2021-06-20, + # deviation should be positively defined + #-------------------------------------------------- + if [ ! -n "$deviation" ]; then + echo -e "\e[0;31m[ERROR ] Fatal Error: key $key not found in output.\e[0m" + let fatal++ + fatal_case_list+=$dir'\n' + break + else + if [ $(check_deviation_pass $deviation $thr) = 0 ]; then + if [ $key == "totalforceref" ]; then + if [ $(check_deviation_pass $deviation $force_thr) = 0 ]; then + echo -e "[WARNING ] "\ + "$key cal=$cal ref=$ref deviation=$deviation" + ifail=1 + else + echo -e "\e[0;32m[ OK ] \e[0m $key" + fi + + elif [ $key == "totalstressref" ]; then + if [ $(check_deviation_pass $deviation $stress_thr) = 0 ]; then + echo -e "[WARNING ] "\ + "$key cal=$cal ref=$ref deviation=$deviation" + ifail=1 + else + echo -e "\e[0;32m[ OK ] \e[0m $key" + fi + + else + echo -e "[WARNING ] "\ + "$key cal=$cal ref=$ref deviation=$deviation" + ifail=1 + fi + + if [ $(check_deviation_pass $deviation $fatal_thr) = 0 ]; then + ifatal=1 + fi + else + echo -e "\e[0;32m[ OK ] \e[0m $key" + fi + fi + let ok++ + done + if [ $ifail -eq 1 ]; then + let failed++ + failed_case_list+=$dir'\n' + calculation=`grep calculation INPUT | grep -v '^#' | awk '{print $2}' | sed s/[[:space:]]//g` + # mohan comment out 2025-04-22, we don't need to print so many details on the screen + #running_path=`echo "OUT.autotest/running_$calculation"".log"` + #cat $running_path + case_status+=$dir' 0\n' + else + case_status+=$dir' 1\n' + fi + + if [ $ifatal -eq 1 ]; then + let fatal++ + echo -e "\e[0;31m[ERROR ] \e[0m"\ + "An unacceptable deviation occurs." + fatal_case_list+=$dir'\n' + fi +} + +#--------------------------------------------- +# function to read the threshold from the file +#--------------------------------------------- +get_threshold() +{ + threshold_f=$1 + threshold_name=$2 + default_value=$3 + if [ -e $threshold_f ]; then + threshold_value=$(awk -v tn="$threshold_name" '$1==tn {print $2}' "$threshold_f") + if [ -n "$threshold_value" ]; then + echo $threshold_value + else + echo $default_value + fi + else + echo $default_value + fi +} + +#--------------------------------------------- +# the file name that contains all of the tests +#--------------------------------------------- + +test -e $cases_file || (echo "Please specify test cases file by -f option." && exit 1) +which $abacus > /dev/null || (echo "No ABACUS executable was found." && exit 1) + +testdir=`cat $cases_file | grep -E $case` +failed=0 +failed_case_list=() +ok=0 +fatal=0 +fatal_case_list=() +case_status=() # record if the test case passed or not +fatal_threshold=1 +report="" +repo="$(realpath ..)/" + +if [ "$sanitize" == true ]; then + echo "Testing with Address Sanitizer..." + mkdir ../html + echo -e "# Address Sanitizer Diagnostics\n" > ../html/README.md + report=$(realpath ../html/README.md) + export ASAN_OPTIONS="log_path=asan" +fi + +for dir in $testdir; do + if [ ! -d $dir ];then + echo -e "\e[0;31m[ERROR ]\e[0m $dir is not a directory.\n" + let fatal++ + fatal_case_list+=$dir'\n' + continue + fi + cd $dir + echo -e "\e[0;32m[ RUN ]\e[0m $dir" + TIMEFORMAT='[----------] Time elapsed: %R seconds' + #parallel test + time { + if [ "$case" = "282_NO_RPA" ]; then + mpirun -np 1 $abacus > log.txt + else + mpirun -np $np $abacus > log.txt + fi + + # if ABACUS failed, print out the error message + if [ $? -ne 0 ]; then + echo -e "\e[0;31m[ERROR ]\e[0m $dir failed." + let failed++ + failed_case_list+=$dir'\n' + case_status+=$dir' 0\n' + cat log.txt + else + # check the output + test -d OUT.autotest || (echo "No 'OUT.autotest' dir presented. Some errors may happened in ABACUS." && exit 1) + if test -z $g + then + bash -e ../../integrate/tools/catch_properties.sh result.out + if [ $? -ne 0 ]; then + echo -e "\e[0;31m [ERROR ] Fatal Error in catch_properties.sh \e[0m" + let fatal++ + fatal_case_list+=$dir'\n' + else + my_threshold=$(get_threshold $threshold_file "threshold" $threshold) + my_force_threshold=$(get_threshold $threshold_file "force_threshold" $force_threshold) + my_stress_threshold=$(get_threshold $threshold_file "stress_threshold" $stress_threshold) + my_fatal_threshold=$(get_threshold $threshold_file "fatal_threshold" $fatal_threshold) + check_out result.out $my_threshold $my_force_threshold $my_stress_threshold $my_fatal_threshold + fi + else + ../tools/catch_properties.sh result.ref + fi + fi + + if [ "$sanitize" == true ]; then + echo -e "## Test case ${dir}\n" >> ${report} + for diagnostic in asan.*; do + echo -e "### On process id ${diagnostic}\n" >> ${report} + echo -e "\`\`\`bash" >> ${report} + cat ${diagnostic} >> ${report} + echo -e "\`\`\`\n" >> ${report} + done + fi + } + echo "" + cd ../ +done + +if [ "$sanitize" == true ]; then + if [[ `uname` == "Darwin" ]]; then + sed -i '' "s,${repo},,g" ${report} + else + sed -i "s,${repo},,g" ${report} + fi +fi + +if [ -z $g ] +then +echo -e $case_status > test.sum +if [[ "$failed" -eq 0 && "$fatal" -eq 0 ]] +then + echo -e "\e[0;32m[ PASSED ] \e[0m $ok test cases passed." +else + echo -e "[WARNING]\e[0m $failed test cases out of $[ $failed + $ok ] failed." + echo -e $failed_case_list + if [ $fatal -gt 0 ] + then + echo -e "\e[0;31m[ERROR ]\e[0m $fatal test cases out of $[ $failed + $ok ] produced fatal error." + echo -e $fatal_case_list + fi + exit 1 +fi +else +echo "Generate test cases complete." +fi diff --git a/tests/05_rtTDDFT/test.sum b/tests/05_rtTDDFT/test.sum new file mode 100644 index 0000000000..4b90496f24 --- /dev/null +++ b/tests/05_rtTDDFT/test.sum @@ -0,0 +1,16 @@ +01_NO_KP_ocp_TDDFT 1 +03_NO_CO_TDDFT 1 +04_NO_CO_ocp_TDDFT 1 +05_NO_cur_TDDFT 1 +06_NO_dir_TDDFT 1 +07_NO_EDM_TDDFT 1 +08_NO_ETRS_TDDFT 1 +09_NO_HEAV_TDDFT 1 +10_NO_HHG_TDDFT 1 +11_NO_O3_TDDFT 1 +12_NO_re_TDDFT 0 +13_NO_Taylor_TDDFT 1 +14_NO_TRAP_TDDFT 1 +15_NO_TRI_TDDFT 1 +16_NO_vel_TDDFT 1 + diff --git a/tests/rttest.zip b/tests/rttest.zip new file mode 100644 index 0000000000000000000000000000000000000000..2d7949a0d32b1bea8af022bcba23fd1abd16b83f GIT binary patch literal 49456 zcmeF3byVF;vhQ&ZuEE{i-QC^Y-3e~NgKL6o2o_ud!QGu;A-KB}>}}56cjuga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hsNVk%DvJacbPx#r|DqS@+4T>{4IS&B>L2{n z58weqf$WrbR`r87s03ZIQRo2wSo`2VW_$Udig8BepX`7LDv2mRR165+|DqQnG~I(6 z^Ec>F|5Wwhw=>>?;POEB=sVk?58j~2X*`4w=+&a&;hdTA-brYQST?a z%7Mx;3l#!F?Z4J#R0}3p`F;23S zoYh-^GZKNW7!r`C4=Tq=jDPGgz;B|8tWN_v)oc7TbZ`nCPJbX+ki)qMBok#x?KO%=D@>I^1I+TCs|p5opXk86r7U< zblsd!LHHwk`+YcKUK;KdZw0w6W>PxTKT zj$C#CM}a8&KdZw5r>Fp3GIQtv|5*EfyUrimMcxUj7-v-eNlpY%N$Q|uKqnx?qZ~Pyzl(^`HR>xayhRp`x6s`kz1Iz{|x! zC3y}Vj4)yPtwSzafJP=iHXEE!OCBdKz)(#!ur&<4^I2dxRes9)Deo)2u1G5G%76p~W z6*|V*&H7mF;5DG2Fev^|Mft5+pAzPsEYbu8{dgKEm|6d#ToY1N;FXo2P*3kemG5-3 z{`o@}yxtHLWFi0z1fu%zY~c-fA}n8K&Kyn05<*E4eMmJ z8tAkYL15E@)vf`b{ENCZP^F$sdIg=kI}&W}pDD1w#K$SHCtjK05soi5EP?;L=wM*t Jj&t2${s#)Va?bz& literal 0 HcmV?d00001 From 587b492f07139ac11ddce64f30075380787f7a90 Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Wed, 9 Jul 2025 12:05:55 +0800 Subject: [PATCH 02/16] update tests --- tests/05_rtTDDFT/Autotest.sh | 329 ---------------------- tests/05_rtTDDFT/test.sum | 16 -- tests/integrate/tools/catch_properties.sh | 2 +- tests/rttest.zip | Bin 49456 -> 0 bytes 4 files changed, 1 insertion(+), 346 deletions(-) delete mode 100644 tests/05_rtTDDFT/Autotest.sh delete mode 100644 tests/05_rtTDDFT/test.sum delete mode 100644 tests/rttest.zip diff --git a/tests/05_rtTDDFT/Autotest.sh b/tests/05_rtTDDFT/Autotest.sh deleted file mode 100644 index ba39cb886c..0000000000 --- a/tests/05_rtTDDFT/Autotest.sh +++ /dev/null @@ -1,329 +0,0 @@ -#!/bin/bash - -# ABACUS executable path -abacus=/public/home/hlx/zaotian/ABACUS/tmp/git-25-7-8/bin/abacus -# number of MPI processes -np=4 -nt=$OMP_NUM_THREADS # number of OpenMP threads, default is $OMP_NUM_THREADS -# threshold with unit: eV -threshold=0.0000001 -force_threshold=0.0001 -stress_threshold=0.001 -# check accuracy -ca=8 -# specify the test cases file -cases_file=CASES_CPU.txt -# regex of case name -case='^[^#].*_.*$' -# enable AddressSanitizer -sanitize=false - -threshold_file="threshold" -# can specify the threshold for each test case -# threshold file example: -# threshold 0.0000001 -# force_threshold 0.0001 -# stress_threshold 0.001 -# fatal_threshold 1 - - -while getopts a:n:t:c:s:r:f:go: flag -do - case "${flag}" in - a) abacus=${OPTARG};; - n) np=${OPTARG};; - t) threshold=${OPTARG};; - c) ca=${OPTARG};; - s) sanitize=${OPTARG};; - r) case=${OPTARG};; - f) cases_file=${OPTARG};; - g) g=true;; #generate test reference - o) nt=${OPTARG};; # number of OpenMP threads - esac -done - -# number of OpenMP threads -if [[ -z "$nt" ]]; then - nt=$(expr `nproc` / ${np}) -fi -export OMP_NUM_THREADS=${nt} - -echo "-----AUTO TESTS OF ABACUS ------" -echo "ABACUS path: $abacus" -echo "Number of processes: $np" -echo "Number of threads: $nt" -echo "Test accuracy totenergy: $threshold eV" -echo "Test accuracy force: $force_threshold" -echo "Test accuracy stress: $stress_threshold" -echo "Check accuaracy: $ca" -echo "Test cases file: $cases_file" -echo "Test cases regex: $case" -echo "Generate reference: $g" -echo "--------------------------------" -echo "" - - -#---------------------------------------------------------- -# check_deviation() -#---------------------------------------------------------- -check_deviation_pass(){ - deviation=$1 - thr=$2 - echo $(awk -v deviation="$deviation" -v thr="$thr" 'BEGIN{ if (sqrt(deviation*deviation) < thr) print 1; else print 0}') -} - -#---------------------------------------------------------- -# define a function named 'check_out' -#---------------------------------------------------------- -check_out(){ - #------------------------------------------------------ - # input file $1 is 'result.out' in each test directory - #------------------------------------------------------ - outfile=$1 - thr=$2 - force_thr=$3 - stress_thr=$4 - fatal_thr=$5 - - #------------------------------------------------------ - # outfile = result.out - #------------------------------------------------------ - properties=`awk '{print $1}' $outfile` - - #------------------------------------------------------ - # README - #------------------------------------------------------ - if test -e "README"; then - readme=`cat README` - echo "[----------] $readme" - fi - - #------------------------------------------------------ - # check every 'key' word - #------------------------------------------------------ - ifail=0 # if all properties have no warning. 0: no warning, 1: warning - ifatal=0 # if all properties have no fatal error. 0: no fatal error, 1: fatal error - for key in $properties; do - - if [ $key == "totaltimeref" ]; then - # echo "time=$cal ref=$ref" - break - fi - - #-------------------------------------------------- - # calculated value - #-------------------------------------------------- - cal=`grep -w "$key" result.out | awk '{printf "%.'$ca'f\n",$2}'` - - #-------------------------------------------------- - # reference value - #-------------------------------------------------- - ref=`grep -w "$key" result.ref | awk '{printf "%.'$ca'f\n",$2}'` - - #-------------------------------------------------- - # computed the deviation between the calculated - # and reference value - #-------------------------------------------------- - deviation=`awk 'BEGIN {x='$ref';y='$cal';printf "%.'$ca'f\n",x-y}'` - - - #-------------------------------------------------- - # If deviation < thr, then the test passes, - # otherwise, the test prints out warning - # Daye Zheng found bug on 2021-06-20, - # deviation should be positively defined - #-------------------------------------------------- - if [ ! -n "$deviation" ]; then - echo -e "\e[0;31m[ERROR ] Fatal Error: key $key not found in output.\e[0m" - let fatal++ - fatal_case_list+=$dir'\n' - break - else - if [ $(check_deviation_pass $deviation $thr) = 0 ]; then - if [ $key == "totalforceref" ]; then - if [ $(check_deviation_pass $deviation $force_thr) = 0 ]; then - echo -e "[WARNING ] "\ - "$key cal=$cal ref=$ref deviation=$deviation" - ifail=1 - else - echo -e "\e[0;32m[ OK ] \e[0m $key" - fi - - elif [ $key == "totalstressref" ]; then - if [ $(check_deviation_pass $deviation $stress_thr) = 0 ]; then - echo -e "[WARNING ] "\ - "$key cal=$cal ref=$ref deviation=$deviation" - ifail=1 - else - echo -e "\e[0;32m[ OK ] \e[0m $key" - fi - - else - echo -e "[WARNING ] "\ - "$key cal=$cal ref=$ref deviation=$deviation" - ifail=1 - fi - - if [ $(check_deviation_pass $deviation $fatal_thr) = 0 ]; then - ifatal=1 - fi - else - echo -e "\e[0;32m[ OK ] \e[0m $key" - fi - fi - let ok++ - done - if [ $ifail -eq 1 ]; then - let failed++ - failed_case_list+=$dir'\n' - calculation=`grep calculation INPUT | grep -v '^#' | awk '{print $2}' | sed s/[[:space:]]//g` - # mohan comment out 2025-04-22, we don't need to print so many details on the screen - #running_path=`echo "OUT.autotest/running_$calculation"".log"` - #cat $running_path - case_status+=$dir' 0\n' - else - case_status+=$dir' 1\n' - fi - - if [ $ifatal -eq 1 ]; then - let fatal++ - echo -e "\e[0;31m[ERROR ] \e[0m"\ - "An unacceptable deviation occurs." - fatal_case_list+=$dir'\n' - fi -} - -#--------------------------------------------- -# function to read the threshold from the file -#--------------------------------------------- -get_threshold() -{ - threshold_f=$1 - threshold_name=$2 - default_value=$3 - if [ -e $threshold_f ]; then - threshold_value=$(awk -v tn="$threshold_name" '$1==tn {print $2}' "$threshold_f") - if [ -n "$threshold_value" ]; then - echo $threshold_value - else - echo $default_value - fi - else - echo $default_value - fi -} - -#--------------------------------------------- -# the file name that contains all of the tests -#--------------------------------------------- - -test -e $cases_file || (echo "Please specify test cases file by -f option." && exit 1) -which $abacus > /dev/null || (echo "No ABACUS executable was found." && exit 1) - -testdir=`cat $cases_file | grep -E $case` -failed=0 -failed_case_list=() -ok=0 -fatal=0 -fatal_case_list=() -case_status=() # record if the test case passed or not -fatal_threshold=1 -report="" -repo="$(realpath ..)/" - -if [ "$sanitize" == true ]; then - echo "Testing with Address Sanitizer..." - mkdir ../html - echo -e "# Address Sanitizer Diagnostics\n" > ../html/README.md - report=$(realpath ../html/README.md) - export ASAN_OPTIONS="log_path=asan" -fi - -for dir in $testdir; do - if [ ! -d $dir ];then - echo -e "\e[0;31m[ERROR ]\e[0m $dir is not a directory.\n" - let fatal++ - fatal_case_list+=$dir'\n' - continue - fi - cd $dir - echo -e "\e[0;32m[ RUN ]\e[0m $dir" - TIMEFORMAT='[----------] Time elapsed: %R seconds' - #parallel test - time { - if [ "$case" = "282_NO_RPA" ]; then - mpirun -np 1 $abacus > log.txt - else - mpirun -np $np $abacus > log.txt - fi - - # if ABACUS failed, print out the error message - if [ $? -ne 0 ]; then - echo -e "\e[0;31m[ERROR ]\e[0m $dir failed." - let failed++ - failed_case_list+=$dir'\n' - case_status+=$dir' 0\n' - cat log.txt - else - # check the output - test -d OUT.autotest || (echo "No 'OUT.autotest' dir presented. Some errors may happened in ABACUS." && exit 1) - if test -z $g - then - bash -e ../../integrate/tools/catch_properties.sh result.out - if [ $? -ne 0 ]; then - echo -e "\e[0;31m [ERROR ] Fatal Error in catch_properties.sh \e[0m" - let fatal++ - fatal_case_list+=$dir'\n' - else - my_threshold=$(get_threshold $threshold_file "threshold" $threshold) - my_force_threshold=$(get_threshold $threshold_file "force_threshold" $force_threshold) - my_stress_threshold=$(get_threshold $threshold_file "stress_threshold" $stress_threshold) - my_fatal_threshold=$(get_threshold $threshold_file "fatal_threshold" $fatal_threshold) - check_out result.out $my_threshold $my_force_threshold $my_stress_threshold $my_fatal_threshold - fi - else - ../tools/catch_properties.sh result.ref - fi - fi - - if [ "$sanitize" == true ]; then - echo -e "## Test case ${dir}\n" >> ${report} - for diagnostic in asan.*; do - echo -e "### On process id ${diagnostic}\n" >> ${report} - echo -e "\`\`\`bash" >> ${report} - cat ${diagnostic} >> ${report} - echo -e "\`\`\`\n" >> ${report} - done - fi - } - echo "" - cd ../ -done - -if [ "$sanitize" == true ]; then - if [[ `uname` == "Darwin" ]]; then - sed -i '' "s,${repo},,g" ${report} - else - sed -i "s,${repo},,g" ${report} - fi -fi - -if [ -z $g ] -then -echo -e $case_status > test.sum -if [[ "$failed" -eq 0 && "$fatal" -eq 0 ]] -then - echo -e "\e[0;32m[ PASSED ] \e[0m $ok test cases passed." -else - echo -e "[WARNING]\e[0m $failed test cases out of $[ $failed + $ok ] failed." - echo -e $failed_case_list - if [ $fatal -gt 0 ] - then - echo -e "\e[0;31m[ERROR ]\e[0m $fatal test cases out of $[ $failed + $ok ] produced fatal error." - echo -e $fatal_case_list - fi - exit 1 -fi -else -echo "Generate test cases complete." -fi diff --git a/tests/05_rtTDDFT/test.sum b/tests/05_rtTDDFT/test.sum deleted file mode 100644 index 4b90496f24..0000000000 --- a/tests/05_rtTDDFT/test.sum +++ /dev/null @@ -1,16 +0,0 @@ -01_NO_KP_ocp_TDDFT 1 -03_NO_CO_TDDFT 1 -04_NO_CO_ocp_TDDFT 1 -05_NO_cur_TDDFT 1 -06_NO_dir_TDDFT 1 -07_NO_EDM_TDDFT 1 -08_NO_ETRS_TDDFT 1 -09_NO_HEAV_TDDFT 1 -10_NO_HHG_TDDFT 1 -11_NO_O3_TDDFT 1 -12_NO_re_TDDFT 0 -13_NO_Taylor_TDDFT 1 -14_NO_TRAP_TDDFT 1 -15_NO_TRI_TDDFT 1 -16_NO_vel_TDDFT 1 - diff --git a/tests/integrate/tools/catch_properties.sh b/tests/integrate/tools/catch_properties.sh index 6b88b326b5..4485c28fba 100755 --- a/tests/integrate/tools/catch_properties.sh +++ b/tests/integrate/tools/catch_properties.sh @@ -462,7 +462,7 @@ if ! test -z "$has_lowf" && [ $has_lowf == 1 ]; then printf "\n" } else {print $0} - }' OUT.autotest/"$wfc_name".txt > OUT.autotest/"$wfc_name"_mod.txt + }' OUT.autotest/WFC/"$wfc_name".txt > OUT.autotest/"$wfc_name"_mod.txt wfc_cal=OUT.autotest/"$wfc_name"_mod.txt wfc_ref="$wfc_name"_mod.txt.ref fi diff --git a/tests/rttest.zip b/tests/rttest.zip deleted file mode 100644 index 2d7949a0d32b1bea8af022bcba23fd1abd16b83f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 49456 zcmeF3byVF;vhQ&ZuEE{i-QC^Y-3e~NgKL6o2o_ud!QGu;A-KB}>}}56cjugaW=>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Vk%DvJacbPx#r|DqS@+4T>{4IS&B>L2{n z58weqf$WrbR`r87s03ZIQRo2wSo`2VW_$Udig8BepX`7LDv2mRR165+|DqQnG~I(6 z^Ec>F|5Wwhw=>>?;POEB=sVk?58j~2X*`4w=+&a&;hdTA-brYQST?a z%7Mx;3l#!F?Z4J#R0}3p`F;23S zoYh-^GZKNW7!r`C4=Tq=jDPGgz;B|8tWN_v)oc7TbZ`nCPJbX+ki)qMBok#x?KO%=D@>I^1I+TCs|p5opXk86r7U< zblsd!LHHwk`+YcKUK;KdZw0w6W>PxTKT zj$C#CM}a8&KdZw5r>Fp3GIQtv|5*EfyUrimMcxUj7-v-eNlpY%N$Q|uKqnx?qZ~Pyzl(^`HR>xayhRp`x6s`kz1Iz{|x! zC3y}Vj4)yPtwSzafJP=iHXEE!OCBdKz)(#!ur&<4^I2dxRes9)Deo)2u1G5G%76p~W z6*|V*&H7mF;5DG2Fev^|Mft5+pAzPsEYbu8{dgKEm|6d#ToY1N;FXo2P*3kemG5-3 z{`o@}yxtHLWFi0z1fu%zY~c-fA}n8K&Kyn05<*E4eMmJ z8tAkYL15E@)vf`b{ENCZP^F$sdIg=kI}&W}pDD1w#K$SHCtjK05soi5EP?;L=wM*t Jj&t2${s#)Va?bz& From d365a6eb9d9fc93bd61b998862d032511534bf54 Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Wed, 9 Jul 2025 17:04:11 +0800 Subject: [PATCH 03/16] update --- source/source_estate/module_dm/density_matrix.cpp | 2 +- source/source_estate/module_dm/density_matrix.h | 2 +- source/source_estate/module_pot/H_TDDFT_pw.cpp | 8 ++++---- source/source_io/output_log.cpp | 4 ++-- source/source_io/td_current_io.cpp | 8 ++++---- source/source_io/test/read_input_ptest.cpp | 1 - source/source_io/test/support/INPUT | 1 - source/source_io/test_serial/read_input_test.cpp | 1 + source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp | 2 +- .../source_lcao/module_operator_lcao/test/CMakeLists.txt | 6 ++++++ source/source_lcao/module_rt/td_folding.cpp | 2 +- source/source_lcao/module_rt/td_info.cpp | 8 ++++---- source/source_lcao/module_rt/td_info.h | 2 +- source/source_lcao/module_rt/velocity_op.cpp | 2 +- 14 files changed, 27 insertions(+), 22 deletions(-) diff --git a/source/source_estate/module_dm/density_matrix.cpp b/source/source_estate/module_dm/density_matrix.cpp index f883ca79e3..8dd87e73c4 100644 --- a/source/source_estate/module_dm/density_matrix.cpp +++ b/source/source_estate/module_dm/density_matrix.cpp @@ -279,7 +279,7 @@ void DensityMatrix, double>::cal_DMR_td(const UnitCell& uce #endif target_DMR_mat_vec[ir] = target_mat->get_pointer(); double arg_td = 0.0; - //cal tddft phase for hybrid gague + //cal tddft phase for hybrid gauge ModuleBase::Vector3 dtau = ucell.cal_dtau(iat1, iat2, r_index); arg_td = At * dtau * ucell.lat0; for(int ik = 0; ik < this->_nk; ++ik) diff --git a/source/source_estate/module_dm/density_matrix.h b/source/source_estate/module_dm/density_matrix.h index 17afea0cc4..5716340e07 100644 --- a/source/source_estate/module_dm/density_matrix.h +++ b/source/source_estate/module_dm/density_matrix.h @@ -182,7 +182,7 @@ class DensityMatrix void cal_DMR(const int ik_in = -1); /** - * @brief calculate density matrix DMR with additional vector potential phase, used for hybrid gague tddft + * @brief calculate density matrix DMR with additional vector potential phase, used for hybrid gauge tddft * if ik_in < 0, calculate all k-points * if ik_in >= 0, calculate only one k-point without summing over k-points */ diff --git a/source/source_estate/module_pot/H_TDDFT_pw.cpp b/source/source_estate/module_pot/H_TDDFT_pw.cpp index 3b52c53eb1..165f1fe5b4 100644 --- a/source/source_estate/module_pot/H_TDDFT_pw.cpp +++ b/source/source_estate/module_pot/H_TDDFT_pw.cpp @@ -45,7 +45,7 @@ double H_TDDFT_pw::lcut2; // velocity gauge ModuleBase::Vector3 H_TDDFT_pw::At; ModuleBase::Vector3 H_TDDFT_pw::At_laststep; -// hybrid gague +// hybrid gauge ModuleBase::Vector3 H_TDDFT_pw::Et; // time domain parameters @@ -85,12 +85,12 @@ std::vector H_TDDFT_pw::heavi_amp; // Ry/bohr void H_TDDFT_pw::current_step_info(const std::string& file_dir, int& istep) { std::stringstream ssc; - ssc << file_dir << "Restart_td.dat"; + ssc << file_dir << "Restart_td.txt"; std::ifstream file(ssc.str().c_str()); if (!file) { - ModuleBase::WARNING_QUIT("H_TDDFT_pw::current_step_info", "No Restart_td.dat!"); + ModuleBase::WARNING_QUIT("H_TDDFT_pw::current_step_info", "No Restart_td.txt!"); } file >> istep; @@ -104,7 +104,7 @@ void H_TDDFT_pw::cal_fixed_v(double* vl_pseudo) { ModuleBase::TITLE("H_TDDFT_pw", "cal_fixed_v"); - // skip if not length gague + // skip if not length gauge if (stype != 0) { return; diff --git a/source/source_io/output_log.cpp b/source/source_io/output_log.cpp index 87cdd3b63b..da843f5086 100644 --- a/source/source_io/output_log.cpp +++ b/source/source_io/output_log.cpp @@ -350,11 +350,11 @@ void write_head(std::ofstream& ofs, const int& istep, const int& iter, const std void write_head_td(std::ofstream& ofs, const int& istep, const int& estep, const int& iter, const std::string& basisname) { ofs << "\n"; - ofs << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<< std::endl; + ofs << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<< std::endl; ofs << " --> IONIC RELAXATION STEP=" << std::setw(6) << istep+1 << " ELECTRON PROPAGATION STEP=" << std::setw(6) << estep << " ELECTRONIC ITERATION STEP=" << std::setw(6) << iter << "\n"; - ofs << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<< std::endl; + ofs << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<< std::endl; // ofs << "\n " << basisname << " ALGORITHM --------------- ION=" << std::setw(4) << istep + 1 // << " ELEC=" << std::setw(4) << estep << " iter=" << std::setw(4) << iter << "--------------------------------\n"; diff --git a/source/source_io/td_current_io.cpp b/source/source_io/td_current_io.cpp index 9de2b8d7bb..164ae66ec9 100644 --- a/source/source_io/td_current_io.cpp +++ b/source/source_io/td_current_io.cpp @@ -58,7 +58,7 @@ void ModuleIO::write_current(const UnitCell& ucell, { if (TD_info::td_vel_op == nullptr) { - ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gague infos is null!"); + ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gauge infos is null!"); } for (int dir = 0; dir < 3; dir++) { @@ -250,7 +250,7 @@ void ModuleIO::cal_tmp_DM_k(const UnitCell& ucell, double arg_td = 0.0; if(elecstate::H_TDDFT_pw::stype == 2) { - //cal tddft phase for hybrid gague + //cal tddft phase for hybrid gauge const int iat1 = tmp_ap_real.get_atom_i(); const int iat2 = tmp_ap_real.get_atom_j(); ModuleBase::Vector3 dtau = ucell.cal_dtau(iat1, iat2, r_index); @@ -320,7 +320,7 @@ void ModuleIO::cal_tmp_DM_k(const UnitCell& ucell, if(elecstate::H_TDDFT_pw::stype == 2) { //new - //cal tddft phase for mixing gague + //cal tddft phase for mixing gauge const int iat1 = tmp_ap_real.get_atom_i(); const int iat2 = tmp_ap_real.get_atom_j(); ModuleBase::Vector3 dtau = ucell.cal_dtau(iat1, iat2, r_index); @@ -424,7 +424,7 @@ void ModuleIO::write_current_eachk(const UnitCell& ucell, { if (TD_info::td_vel_op == nullptr) { - ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gague infos is null!"); + ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gauge infos is null!"); } for (int dir = 0; dir < 3; dir++) { diff --git a/source/source_io/test/read_input_ptest.cpp b/source/source_io/test/read_input_ptest.cpp index f81eedeaaa..a3a2f5a15a 100644 --- a/source/source_io/test/read_input_ptest.cpp +++ b/source/source_io/test/read_input_ptest.cpp @@ -301,7 +301,6 @@ TEST_F(InputParaTest, ParaRead) EXPECT_FALSE(param.inp.noncolin); EXPECT_FALSE(param.inp.lspinorb); EXPECT_DOUBLE_EQ(param.inp.soc_lambda, 1.0); - EXPECT_DOUBLE_EQ(param.inp.td_force_dt, 0.02); EXPECT_EQ(param.inp.td_vext, 0); EXPECT_EQ(param.inp.propagator, 0); EXPECT_EQ(param.inp.td_stype, 0); diff --git a/source/source_io/test/support/INPUT b/source/source_io/test/support/INPUT index d5d473add4..5e70e8ef95 100644 --- a/source/source_io/test/support/INPUT +++ b/source/source_io/test/support/INPUT @@ -295,7 +295,6 @@ exx_opt_orb_ecut 0 # exx_opt_orb_tolerence 0 # #Parameters (16.tddft) -td_force_dt 0.02 #time of force change td_vext 0 #add extern potential or not td_vext_dire 1 #extern potential direction td_propagator 0 # method of propagator diff --git a/source/source_io/test_serial/read_input_test.cpp b/source/source_io/test_serial/read_input_test.cpp index 8e28810b6d..1d2b3acfc1 100644 --- a/source/source_io/test_serial/read_input_test.cpp +++ b/source/source_io/test_serial/read_input_test.cpp @@ -33,6 +33,7 @@ namespace Global_File void make_dir_out(const std::string& suffix, const std::string& calculation, const bool& out_dir, + const bool& out_wfc_dir, const int rank, const bool& restart, const bool out_alllog) diff --git a/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp b/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp index fffb439674..a750680460 100644 --- a/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp +++ b/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp @@ -238,7 +238,7 @@ void hamilt::TD_pot_hybrid>::init_td() template void hamilt::TD_pot_hybrid>::update_td() { - //std::cout<<"hybrid gague" <cart_At = TD_info::td_vel_op->cart_At; //std::cout<<"At: "<< TD_info::td_vel_op->cart_At[0] <<" "<cart_At[1]<<" "<cart_At[2]<<" "<& hR, const ModuleBase::Vector3 r_index = tmp.get_R_index(ir); //new - //cal tddft phase for hybrid gague + //cal tddft phase for hybrid gauge const int iat1 = tmp.get_atom_i(); const int iat2 = tmp.get_atom_j(); ModuleBase::Vector3 dtau = ucell->cal_dtau(iat1, iat2, r_index); diff --git a/source/source_lcao/module_rt/td_info.cpp b/source/source_lcao/module_rt/td_info.cpp index b076bac0be..6b5fc772a9 100644 --- a/source/source_lcao/module_rt/td_info.cpp +++ b/source/source_lcao/module_rt/td_info.cpp @@ -28,11 +28,11 @@ TD_info::TD_info(const UnitCell* ucell_in) if(PARAM.inp.mdp.md_restart) { std::stringstream ssc; - ssc << PARAM.globalv.global_readin_dir << "Restart_td.dat"; + ssc << PARAM.globalv.global_readin_dir << "Restart_td.txt"; std::ifstream file(ssc.str().c_str()); if (!file) { - ModuleBase::WARNING_QUIT("TD_info::TD_info", "No Restart_td.dat!"); + ModuleBase::WARNING_QUIT("TD_info::TD_info", "No Restart_td.txt!"); } file >> estep_shift; //std::cout<<"estep_shift"< void folding_HR_td(const hamilt::HContainer& hR, std::complex* hk, diff --git a/source/source_lcao/module_rt/velocity_op.cpp b/source/source_lcao/module_rt/velocity_op.cpp index afa49a93cd..603d2314de 100644 --- a/source/source_lcao/module_rt/velocity_op.cpp +++ b/source/source_lcao/module_rt/velocity_op.cpp @@ -19,7 +19,7 @@ Velocity_op::Velocity_op(const UnitCell* ucell_in, const TwoCenterIntegrator* intor) : ucell(ucell_in), paraV(paraV) , orb_(orb), intor_(intor) { - // for length gague, the A(t) = 0 for all the time. + // for length gauge, the A(t) = 0 for all the time. this->cart_At = ModuleBase::Vector3(0,0,0); this->initialize_grad_term(GridD_in, paraV); this->initialize_vcomm_r(GridD_in, paraV); From 472f6efee8a346e5ff2d12b3c89389a9a4acb174 Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Wed, 9 Jul 2025 18:52:02 +0800 Subject: [PATCH 04/16] update --- docs/advanced/input_files/input-main.md | 15 ++++++++++ .../source_esolver/esolver_ks_lcao_tddft.cpp | 8 +++--- source/source_io/td_current_io.cpp | 12 ++++---- .../module_deepks/test/CMakeLists.txt | 3 ++ .../module_operator_lcao/operator_lcao.cpp | 5 ++-- .../module_operator_lcao/overlap_new.cpp | 5 ++-- .../module_operator_lcao/td_ekinetic_lcao.cpp | 2 +- .../module_operator_lcao/td_nonlocal_lcao.cpp | 2 +- .../module_operator_lcao/td_pot_hybrid.cpp | 4 +-- source/source_lcao/module_rt/td_folding.cpp | 28 ++++++++++++------- source/source_lcao/module_rt/td_folding.h | 14 ++++++++++ source/source_lcao/module_rt/td_info.cpp | 13 +++++---- source/source_lcao/module_rt/td_info.h | 11 +------- 13 files changed, 78 insertions(+), 44 deletions(-) create mode 100644 source/source_lcao/module_rt/td_folding.h diff --git a/docs/advanced/input_files/input-main.md b/docs/advanced/input_files/input-main.md index cab2cb5072..5e76ca303f 100644 --- a/docs/advanced/input_files/input-main.md +++ b/docs/advanced/input_files/input-main.md @@ -375,6 +375,8 @@ - [out\_wannier\_unk](#out_wannier_unk) - [out\_wannier\_wvfn\_formatted](#out_wannier_wvfn_formatted) - [rt-TDDFT: Real-time time dependent density functional theory](#tddft-time-dependent-density-functional-theory) + - [estep\_per\_md](#estep_per_md) + - [td\_dt](#td_dt) - [td\_edm](#td_edm) - [td\_print\_eij](#td_print_eij) - [td\_propagator](#td_propagator) @@ -3687,6 +3689,18 @@ These variables are used to control berry phase and wannier90 interface paramete ## TDDFT: time dependent density functional theory +### estep_per_md + +- **Type**: Integer +- **Description**: The number of electron propagation steps between two ionic steps. +- **Default**: 1 + +### td_dt + +- **Type**: Real +- **Description**: The time step used in electron propagation. Setting td_dt will reset the md_dt value to td_dt * estep_per_md. +- **Default**: md_dt/estep_per_md + ### td_edm - **Type**: Integer @@ -3739,6 +3753,7 @@ These variables are used to control berry phase and wannier90 interface paramete Type of electric field in space domain - 0: length gauge. - 1: velocity gauge. + - 2: hybrid gauge. - **Default**: 0 ### td_ttype diff --git a/source/source_esolver/esolver_ks_lcao_tddft.cpp b/source/source_esolver/esolver_ks_lcao_tddft.cpp index d13c89de7a..5ca6bfac4c 100644 --- a/source/source_esolver/esolver_ks_lcao_tddft.cpp +++ b/source/source_esolver/esolver_ks_lcao_tddft.cpp @@ -144,9 +144,9 @@ void ESolver_KS_LCAO_TDDFT::runner(UnitCell& ucell, const int istep) { elecstate::H_TDDFT_pw::update_At(); td_p->cal_cart_At(elecstate::H_TDDFT_pw::At); - ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Ax(t)", td_p->cart_At[0]); - ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Ay(t)", td_p->cart_At[1]); - ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Az(t)", td_p->cart_At[2]); + ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Ax(t)", TD_info::cart_At[0]); + ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Ay(t)", TD_info::cart_At[1]); + ModuleBase::GlobalFunc::OUT(GlobalV::ofs_running, "Cartesian vector potential Az(t)", TD_info::cart_At[2]); } if(estep!=0) @@ -588,7 +588,7 @@ void ESolver_KS_LCAO_TDDFT::weight_dm_rho(const UnitCell& ucell) elecstate::cal_dm_psi(_pes->DM->get_paraV_pointer(), _pes->wg, this->psi[0], *(_pes->DM)); if(PARAM.inp.td_stype == 2) { - _pes->DM->cal_DMR_td(ucell, td_p->cart_At); + _pes->DM->cal_DMR_td(ucell, TD_info::cart_At); } else { diff --git a/source/source_io/td_current_io.cpp b/source/source_io/td_current_io.cpp index 164ae66ec9..88b8c576b1 100644 --- a/source/source_io/td_current_io.cpp +++ b/source/source_io/td_current_io.cpp @@ -58,7 +58,7 @@ void ModuleIO::write_current(const UnitCell& ucell, { if (TD_info::td_vel_op == nullptr) { - ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gauge infos is null!"); + ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gague infos is null!"); } for (int dir = 0; dir < 3; dir++) { @@ -250,12 +250,12 @@ void ModuleIO::cal_tmp_DM_k(const UnitCell& ucell, double arg_td = 0.0; if(elecstate::H_TDDFT_pw::stype == 2) { - //cal tddft phase for hybrid gauge + //cal tddft phase for hybrid gague const int iat1 = tmp_ap_real.get_atom_i(); const int iat2 = tmp_ap_real.get_atom_j(); ModuleBase::Vector3 dtau = ucell.cal_dtau(iat1, iat2, r_index); double& tmp_lat0 = ucell.lat0; - arg_td = TD_info::td_vel_op->cart_At * dtau * tmp_lat0; + arg_td = TD_info::cart_At * dtau * tmp_lat0; } // cal k_phase // if TK==std::complex, kphase is e^{ikR} @@ -320,12 +320,12 @@ void ModuleIO::cal_tmp_DM_k(const UnitCell& ucell, if(elecstate::H_TDDFT_pw::stype == 2) { //new - //cal tddft phase for mixing gauge + //cal tddft phase for mixing gague const int iat1 = tmp_ap_real.get_atom_i(); const int iat2 = tmp_ap_real.get_atom_j(); ModuleBase::Vector3 dtau = ucell.cal_dtau(iat1, iat2, r_index); double& tmp_lat0 = ucell.lat0; - arg_td = TD_info::td_vel_op->cart_At * dtau * tmp_lat0; + arg_td = TD_info::cart_At * dtau * tmp_lat0; } const double arg = (DM_real.get_kvec_d()[ik] * dR) * ModuleBase::TWO_PI + arg_td; double sinp, cosp; @@ -424,7 +424,7 @@ void ModuleIO::write_current_eachk(const UnitCell& ucell, { if (TD_info::td_vel_op == nullptr) { - ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gauge infos is null!"); + ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gague infos is null!"); } for (int dir = 0; dir < 3; dir++) { diff --git a/source/source_lcao/module_deepks/test/CMakeLists.txt b/source/source_lcao/module_deepks/test/CMakeLists.txt index 8a013e31a5..4ea1cd1625 100644 --- a/source/source_lcao/module_deepks/test/CMakeLists.txt +++ b/source/source_lcao/module_deepks/test/CMakeLists.txt @@ -37,6 +37,9 @@ add_executable( ../../../source_lcao/module_operator_lcao/deepks_lcao.cpp ../../../source_lcao/module_operator_lcao/operator_lcao.cpp ../../../source_hamilt/operator.cpp + ../../../source_lcao/module_rt/td_info.cpp + ../../../source_lcao/module_rt/td_folding.cpp + ../../../source_estate/module_pot/H_TDDFT_pw.cpp ) target_link_libraries( diff --git a/source/source_lcao/module_operator_lcao/operator_lcao.cpp b/source/source_lcao/module_operator_lcao/operator_lcao.cpp index 82eae42192..a7e47450fe 100644 --- a/source/source_lcao/module_operator_lcao/operator_lcao.cpp +++ b/source/source_lcao/module_operator_lcao/operator_lcao.cpp @@ -13,6 +13,7 @@ #endif #include "source_lcao/module_rt/td_info.h" +#include "source_lcao/module_rt/td_folding.h" namespace hamilt { @@ -268,7 +269,7 @@ void OperatorLCAO::contributeHk(int ik) { const int nrow = this->hsk->get_pv()->get_row_size(); if(PARAM.inp.td_stype == 2) { - TD_info::td_vel_op->folding_HR_td(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], nrow, 1); + module_rt::folding_HR_td(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], nrow, 1, TD_info::td_vel_op->get_ucell(), TD_info::cart_At); } else { @@ -280,7 +281,7 @@ void OperatorLCAO::contributeHk(int ik) { const int ncol = this->hsk->get_pv()->get_col_size(); if(PARAM.inp.td_stype == 2) { - TD_info::td_vel_op->folding_HR_td(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], ncol, 0); + module_rt::folding_HR_td(*this->hR, this->hsk->get_hk(), this->kvec_d[ik], ncol, 0, TD_info::td_vel_op->get_ucell(), TD_info::cart_At); } else { diff --git a/source/source_lcao/module_operator_lcao/overlap_new.cpp b/source/source_lcao/module_operator_lcao/overlap_new.cpp index a0c967ba65..1200400151 100644 --- a/source/source_lcao/module_operator_lcao/overlap_new.cpp +++ b/source/source_lcao/module_operator_lcao/overlap_new.cpp @@ -8,6 +8,7 @@ #include "source_lcao/module_hcontainer/hcontainer_funcs.h" #include #include "source_lcao/module_rt/td_info.h" +#include "source_lcao/module_rt/td_folding.h" template hamilt::OverlapNew>::OverlapNew(HS_Matrix_K* hsk_in, @@ -231,7 +232,7 @@ void hamilt::OverlapNew>::contributeHk(int ik) const int nrow = this->SR->get_atom_pair(0).get_paraV()->get_row_size(); if(PARAM.inp.td_stype == 2) { - TD_info::td_vel_op->folding_HR_td(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], nrow, 1); + module_rt::folding_HR_td(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], nrow, 1, ucell, TD_info::cart_At); } else { @@ -243,7 +244,7 @@ void hamilt::OverlapNew>::contributeHk(int ik) const int ncol = this->SR->get_atom_pair(0).get_paraV()->get_col_size(); if(PARAM.inp.td_stype == 2) { - TD_info::td_vel_op->folding_HR_td(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], ncol, 0); + module_rt::folding_HR_td(*this->SR, this->hsk->get_sk(), this->kvec_d[ik], ncol, 0, ucell, TD_info::cart_At); } else { diff --git a/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.cpp b/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.cpp index c155cd84cc..e81aafade2 100644 --- a/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.cpp +++ b/source/source_lcao/module_operator_lcao/td_ekinetic_lcao.cpp @@ -227,7 +227,7 @@ template void TDEkinetic>::update_td() { //std::cout<<"velocity"<cart_At = TD_info::td_vel_op->cart_At; + this->cart_At = TD_info::cart_At; } template diff --git a/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.cpp b/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.cpp index 7743003761..a5eba57688 100644 --- a/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.cpp +++ b/source/source_lcao/module_operator_lcao/td_nonlocal_lcao.cpp @@ -45,7 +45,7 @@ template void hamilt::TDNonlocal>::update_td() { // calculate At in cartesian coorinates. - this->cart_At = TD_info::td_vel_op->cart_At; + this->cart_At = TD_info::cart_At; } // initialize_HR() template diff --git a/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp b/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp index a750680460..231aef3870 100644 --- a/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp +++ b/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp @@ -238,8 +238,8 @@ void hamilt::TD_pot_hybrid>::init_td() template void hamilt::TD_pot_hybrid>::update_td() { - //std::cout<<"hybrid gauge" <cart_At = TD_info::td_vel_op->cart_At; + //std::cout<<"hybrid gague" <cart_At = TD_info::cart_At; //std::cout<<"At: "<< TD_info::td_vel_op->cart_At[0] <<" "<cart_At[1]<<" "<cart_At[2]<<" "< -void TD_info::folding_HR_td(const hamilt::HContainer& hR, +void folding_HR_td(const hamilt::HContainer& hR, std::complex* hk, const ModuleBase::Vector3& kvec_d_in, const int ncol, - const int hk_type) + const int hk_type, + const UnitCell& ucell, + const ModuleBase::Vector3& cart_At) { #ifdef _OPENMP #pragma omp parallel for @@ -18,11 +21,11 @@ void TD_info::folding_HR_td(const hamilt::HContainer& hR, const ModuleBase::Vector3 r_index = tmp.get_R_index(ir); //new - //cal tddft phase for hybrid gauge + //cal tddft phase for hybrid gague const int iat1 = tmp.get_atom_i(); const int iat2 = tmp.get_atom_j(); - ModuleBase::Vector3 dtau = ucell->cal_dtau(iat1, iat2, r_index); - const double arg_td = cart_At * dtau * ucell->lat0; + ModuleBase::Vector3 dtau = ucell.cal_dtau(iat1, iat2, r_index); + const double arg_td = cart_At * dtau * ucell.lat0; //new // cal k_phase @@ -39,14 +42,19 @@ void TD_info::folding_HR_td(const hamilt::HContainer& hR, } } template -void TD_info::folding_HR_td(const hamilt::HContainer& hR, +void folding_HR_td(const hamilt::HContainer& hR, std::complex* hk, const ModuleBase::Vector3& kvec_d_in, const int ncol, - const int hk_type); + const int hk_type, + const UnitCell& ucell, + const ModuleBase::Vector3& At); template -void TD_info::folding_HR_td>(const hamilt::HContainer>& hR, +void folding_HR_td>(const hamilt::HContainer>& hR, std::complex* hk, const ModuleBase::Vector3& kvec_d_in, const int ncol, - const int hk_type); \ No newline at end of file + const int hk_type, + const UnitCell& ucell, + const ModuleBase::Vector3& At); +}// namespace module_rt \ No newline at end of file diff --git a/source/source_lcao/module_rt/td_folding.h b/source/source_lcao/module_rt/td_folding.h new file mode 100644 index 0000000000..b13b68a415 --- /dev/null +++ b/source/source_lcao/module_rt/td_folding.h @@ -0,0 +1,14 @@ +#ifndef TD_FOLDING_H +#define TD_FOLDING_H + +namespace module_rt{ +// folding HR to hk, for hybrid gague +template +void folding_HR_td(const hamilt::HContainer& hR, + std::complex* hk, + const ModuleBase::Vector3& kvec_d_in, + const int ncol, + const int hk_type, + const UnitCell& ucell, + const ModuleBase::Vector3& At); +}// namespace module_rt \ No newline at end of file diff --git a/source/source_lcao/module_rt/td_info.cpp b/source/source_lcao/module_rt/td_info.cpp index 6b5fc772a9..35d6fd729a 100644 --- a/source/source_lcao/module_rt/td_info.cpp +++ b/source/source_lcao/module_rt/td_info.cpp @@ -15,6 +15,7 @@ TD_info* TD_info::td_vel_op = nullptr; int TD_info::estep_shift = 0; int TD_info::istep = -1; int TD_info::max_istep = -1; +ModuleBase::Vector3 TD_info::cart_At; std::vector> TD_info::At_from_file; TD_info::TD_info(const UnitCell* ucell_in) @@ -28,11 +29,11 @@ TD_info::TD_info(const UnitCell* ucell_in) if(PARAM.inp.mdp.md_restart) { std::stringstream ssc; - ssc << PARAM.globalv.global_readin_dir << "Restart_td.txt"; + ssc << PARAM.globalv.global_readin_dir << "Restart_td.dat"; std::ifstream file(ssc.str().c_str()); if (!file) { - ModuleBase::WARNING_QUIT("TD_info::TD_info", "No Restart_td.txt!"); + ModuleBase::WARNING_QUIT("TD_info::TD_info", "No Restart_td.dat!"); } file >> estep_shift; //std::cout<<"estep_shift"<& At) istep++; if (init_vecpot_file) { - this->cart_At = At_from_file[istep > max_istep ? max_istep : istep]; + cart_At = At_from_file[istep > max_istep ? max_istep : istep]; } else { // transfrom into atomic unit - this->cart_At = At / 2.0; + cart_At = At / 2.0; } // output the vector potential if needed if (out_vecpot == true) @@ -164,10 +165,10 @@ void TD_info::out_restart_info(const int nstep, if (GlobalV::MY_RANK == 0) { // open file - std::string outdir = PARAM.globalv.global_out_dir + "Restart_td.txt"; + std::string outdir = PARAM.globalv.global_out_dir + "Restart_td.dat"; std::ofstream outFile(outdir); if (!outFile) { - ModuleBase::WARNING_QUIT("out_restart_info", "no Restart_td.txt!"); + ModuleBase::WARNING_QUIT("out_restart_info", "no Restart_td.dat!"); } // write data outFile << nstep << std::endl; diff --git a/source/source_lcao/module_rt/td_info.h b/source/source_lcao/module_rt/td_info.h index 630d06ebb3..6b2f3a839e 100644 --- a/source/source_lcao/module_rt/td_info.h +++ b/source/source_lcao/module_rt/td_info.h @@ -39,7 +39,7 @@ class TD_info static int estep_shift; /// @brief Store the vector potential for tddft calculation - ModuleBase::Vector3 cart_At; + static ModuleBase::Vector3 cart_At; /// @brief calculate the At in cartesian coordinate void cal_cart_At(const ModuleBase::Vector3& At); @@ -57,15 +57,6 @@ class TD_info return this->current_term[i]; } - - // folding HR to hk, for hybrid gauge - template - void folding_HR_td(const hamilt::HContainer& hR, - std::complex* hk, - const ModuleBase::Vector3& kvec_d_in, - const int ncol, - const int hk_type); - int get_istep() { return istep; From e72545e1b5127123adeebd00bf7d6b08ccd0c671 Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Wed, 9 Jul 2025 18:57:28 +0800 Subject: [PATCH 05/16] update --- source/source_lcao/module_rt/td_folding.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/source_lcao/module_rt/td_folding.h b/source/source_lcao/module_rt/td_folding.h index b13b68a415..efe0ebbff5 100644 --- a/source/source_lcao/module_rt/td_folding.h +++ b/source/source_lcao/module_rt/td_folding.h @@ -1,5 +1,7 @@ #ifndef TD_FOLDING_H #define TD_FOLDING_H +#include "source_lcao/module_hcontainer/hcontainer.h" +#include "source_base/abfs-vector3_order.h" namespace module_rt{ // folding HR to hk, for hybrid gague @@ -11,4 +13,6 @@ void folding_HR_td(const hamilt::HContainer& hR, const int hk_type, const UnitCell& ucell, const ModuleBase::Vector3& At); -}// namespace module_rt \ No newline at end of file +}// namespace module_rt + +#endif \ No newline at end of file From 109723aa44d0324bbae21c856c2ac2dcd0786ae9 Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Wed, 9 Jul 2025 19:14:11 +0800 Subject: [PATCH 06/16] update --- source/source_lcao/module_rt/td_folding.cpp | 10 +++++----- source/source_lcao/module_rt/td_folding.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/source_lcao/module_rt/td_folding.cpp b/source/source_lcao/module_rt/td_folding.cpp index 5b256118be..2157d366c2 100644 --- a/source/source_lcao/module_rt/td_folding.cpp +++ b/source/source_lcao/module_rt/td_folding.cpp @@ -7,7 +7,7 @@ void folding_HR_td(const hamilt::HContainer& hR, const ModuleBase::Vector3& kvec_d_in, const int ncol, const int hk_type, - const UnitCell& ucell, + const UnitCell* ucell, const ModuleBase::Vector3& cart_At) { #ifdef _OPENMP @@ -24,8 +24,8 @@ void folding_HR_td(const hamilt::HContainer& hR, //cal tddft phase for hybrid gague const int iat1 = tmp.get_atom_i(); const int iat2 = tmp.get_atom_j(); - ModuleBase::Vector3 dtau = ucell.cal_dtau(iat1, iat2, r_index); - const double arg_td = cart_At * dtau * ucell.lat0; + ModuleBase::Vector3 dtau = ucell->cal_dtau(iat1, iat2, r_index); + const double arg_td = cart_At * dtau * ucell->lat0; //new // cal k_phase @@ -47,7 +47,7 @@ void folding_HR_td(const hamilt::HContainer& hR, const ModuleBase::Vector3& kvec_d_in, const int ncol, const int hk_type, - const UnitCell& ucell, + const UnitCell* ucell, const ModuleBase::Vector3& At); template void folding_HR_td>(const hamilt::HContainer>& hR, @@ -55,6 +55,6 @@ void folding_HR_td>(const hamilt::HContainer& kvec_d_in, const int ncol, const int hk_type, - const UnitCell& ucell, + const UnitCell* ucell, const ModuleBase::Vector3& At); }// namespace module_rt \ No newline at end of file diff --git a/source/source_lcao/module_rt/td_folding.h b/source/source_lcao/module_rt/td_folding.h index efe0ebbff5..0b4d5902ba 100644 --- a/source/source_lcao/module_rt/td_folding.h +++ b/source/source_lcao/module_rt/td_folding.h @@ -11,7 +11,7 @@ void folding_HR_td(const hamilt::HContainer& hR, const ModuleBase::Vector3& kvec_d_in, const int ncol, const int hk_type, - const UnitCell& ucell, + const UnitCell* ucell, const ModuleBase::Vector3& At); }// namespace module_rt From 30b3300e912ada4cb1e8fbfd1c9f31ac502cf72b Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Wed, 9 Jul 2025 19:45:57 +0800 Subject: [PATCH 07/16] update unit test --- source/source_io/test/read_wfc_nao_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/source_io/test/read_wfc_nao_test.cpp b/source/source_io/test/read_wfc_nao_test.cpp index f0d7e8a5d8..cd6ed05350 100644 --- a/source/source_io/test/read_wfc_nao_test.cpp +++ b/source/source_io/test/read_wfc_nao_test.cpp @@ -105,6 +105,7 @@ TEST_F(ReadWfcNaoTest, ReadWfcNaoPart) PARAM.sys.global_readin_dir = "./support/"; const int nks = 1; const int nspin = 1; + const int nstep = -1; int my_rank = 0; Parallel_Orbitals ParaV; @@ -130,7 +131,7 @@ TEST_F(ReadWfcNaoTest, ReadWfcNaoPart) // Act ModuleIO::read_wfc_nao(PARAM.sys.global_readin_dir, ParaV, psid, - &(pelec), ik2iktot, nkstot, nspin, skip_band); + &(pelec), ik2iktot, nkstot, nspin, nstep, skip_band); // Assert EXPECT_NEAR(pelec.ekb(0, 1), 7.4141254894954844445464914e-01, 1e-5); From 4c562d3f57f8047864b45b040988eeef361b91aa Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Wed, 9 Jul 2025 19:56:07 +0800 Subject: [PATCH 08/16] fix tests --- source/source_io/read_input_item_tddft.cpp | 6 ----- tests/15_rtTDDFT_GPU/CASES_GPU.txt | 30 +++++++++++----------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/source/source_io/read_input_item_tddft.cpp b/source/source_io/read_input_item_tddft.cpp index 0e44754db1..89751fd224 100644 --- a/source/source_io/read_input_item_tddft.cpp +++ b/source/source_io/read_input_item_tddft.cpp @@ -27,12 +27,6 @@ void ReadInput::item_rt_tddft() read_sync_int(input.estep_per_md); this->add_item(item); } - { - Input_Item item("td_dt"); - item.annotation = "time step of propagation"; - read_sync_double(input.td_dt); - this->add_item(item); - } { Input_Item item("td_vext"); item.annotation = "add extern potential or not"; diff --git a/tests/15_rtTDDFT_GPU/CASES_GPU.txt b/tests/15_rtTDDFT_GPU/CASES_GPU.txt index c930799511..dac3fe5ed9 100644 --- a/tests/15_rtTDDFT_GPU/CASES_GPU.txt +++ b/tests/15_rtTDDFT_GPU/CASES_GPU.txt @@ -1,15 +1,15 @@ -01_NO_KP_ocp_TDDFT_GPU -02_NO_CH_TDDFT_GPU -03_NO_CO_TDDFT_GPU -04_NO_CO_ocp_TDDFT_GPU -05_NO_cur_TDDFT_GPU -06_NO_dir_TDDFT_GPU -07_NO_EDM_TDDFT_GPU -09_NO_HEAV_TDDFT_GPU -10_NO_HHG_TDDFT_GPU -11_NO_O3_TDDFT_GPU -12_NO_re_TDDFT_GPU -14_NO_TRAP_TDDFT_GPU -15_NO_TRI_TDDFT_GPU -16_NO_vel_TDDFT_GPU -17_NO_vel_TDDFT_GPU +#01_NO_KP_ocp_TDDFT_GPU +#02_NO_CH_TDDFT_GPU +#03_NO_CO_TDDFT_GPU +#04_NO_CO_ocp_TDDFT_GPU +#05_NO_cur_TDDFT_GPU +#06_NO_dir_TDDFT_GPU +#07_NO_EDM_TDDFT_GPU +#09_NO_HEAV_TDDFT_GPU +#10_NO_HHG_TDDFT_GPU +#11_NO_O3_TDDFT_GPU +#12_NO_re_TDDFT_GPU +#14_NO_TRAP_TDDFT_GPU +#15_NO_TRI_TDDFT_GPU +#16_NO_vel_TDDFT_GPU +#17_NO_vel_TDDFT_GPU From 000cc1d644a6cc01ec1e8817f551d1cc2fa72a36 Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Wed, 9 Jul 2025 20:39:16 +0800 Subject: [PATCH 09/16] update tests --- .../12_NO_re_TDDFT/restart/Restart_td.txt | 3 ++ .../{wfs1k1_nao.txt => WFC/wfs1k1g6_nao.txt} | 0 .../17_NO_vel_TDDFT/refcurrent_total.dat | 4 +-- .../01_NO_KP_ocp_TDDFT_GPU/result.ref | 8 ++--- .../02_NO_CH_TDDFT_GPU/result.ref | 8 ++--- .../03_NO_CO_TDDFT_GPU/result.ref | 8 ++--- .../04_NO_CO_ocp_TDDFT_GPU/result.ref | 8 ++--- .../05_NO_cur_TDDFT_GPU/result.ref | 8 ++--- .../06_NO_dir_TDDFT_GPU/result.ref | 8 ++--- .../07_NO_EDM_TDDFT_GPU/result.ref | 8 ++--- .../09_NO_HEAV_TDDFT_GPU/result.ref | 8 ++--- .../10_NO_HHG_TDDFT_GPU/result.ref | 8 ++--- .../11_NO_O3_TDDFT_GPU/result.ref | 8 ++--- .../12_NO_re_TDDFT_GPU/restart/Restart_td.txt | 3 ++ .../{wfs1k1_nao.txt => WFC/wfs1k1g6_nao.txt} | 0 .../14_NO_TRAP_TDDFT_GPU/result.ref | 8 ++--- .../15_NO_TRI_TDDFT_GPU/result.ref | 8 ++--- .../16_NO_vel_TDDFT_GPU/result.ref | 8 ++--- .../17_NO_vel_TDDFT_GPU/refcurrent_total.dat | 4 +-- .../17_NO_vel_TDDFT_GPU/result.ref | 4 +-- tests/15_rtTDDFT_GPU/CASES_GPU.txt | 30 +++++++++---------- tests/integrate/tools/catch_properties.sh | 4 +-- 22 files changed, 81 insertions(+), 75 deletions(-) create mode 100644 tests/05_rtTDDFT/12_NO_re_TDDFT/restart/Restart_td.txt rename tests/05_rtTDDFT/12_NO_re_TDDFT/restart/{wfs1k1_nao.txt => WFC/wfs1k1g6_nao.txt} (100%) create mode 100644 tests/15_rtTDDFT_GPU/12_NO_re_TDDFT_GPU/restart/Restart_td.txt rename tests/15_rtTDDFT_GPU/12_NO_re_TDDFT_GPU/restart/{wfs1k1_nao.txt => WFC/wfs1k1g6_nao.txt} (100%) diff --git a/tests/05_rtTDDFT/12_NO_re_TDDFT/restart/Restart_td.txt b/tests/05_rtTDDFT/12_NO_re_TDDFT/restart/Restart_td.txt new file mode 100644 index 0000000000..4bcfc2a96f --- /dev/null +++ b/tests/05_rtTDDFT/12_NO_re_TDDFT/restart/Restart_td.txt @@ -0,0 +1,3 @@ +5 +0 0 0 +0 0 0 \ No newline at end of file diff --git a/tests/05_rtTDDFT/12_NO_re_TDDFT/restart/wfs1k1_nao.txt b/tests/05_rtTDDFT/12_NO_re_TDDFT/restart/WFC/wfs1k1g6_nao.txt similarity index 100% rename from tests/05_rtTDDFT/12_NO_re_TDDFT/restart/wfs1k1_nao.txt rename to tests/05_rtTDDFT/12_NO_re_TDDFT/restart/WFC/wfs1k1g6_nao.txt diff --git a/tests/05_rtTDDFT/17_NO_vel_TDDFT/refcurrent_total.dat b/tests/05_rtTDDFT/17_NO_vel_TDDFT/refcurrent_total.dat index c9f84ba227..b17941d582 100644 --- a/tests/05_rtTDDFT/17_NO_vel_TDDFT/refcurrent_total.dat +++ b/tests/05_rtTDDFT/17_NO_vel_TDDFT/refcurrent_total.dat @@ -1,3 +1,3 @@ 0 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 -1 -9.0873653377507955e-16 3.9425556023172989e-16 -9.4623183996671908e-03 -2 -2.8433625051390163e-15 7.3755027825125381e-16 -6.7585654059417327e-03 +1 -1.4281057782732242e-18 5.1480765086224919e-18 5.1985933203093457e-06 +2 -3.1989018653041680e-18 1.4638762354532585e-17 1.3886066143094195e-05 diff --git a/tests/15_rtTDDFT_GPU/01_NO_KP_ocp_TDDFT_GPU/result.ref b/tests/15_rtTDDFT_GPU/01_NO_KP_ocp_TDDFT_GPU/result.ref index d63ad6d41e..c513b14752 100644 --- a/tests/15_rtTDDFT_GPU/01_NO_KP_ocp_TDDFT_GPU/result.ref +++ b/tests/15_rtTDDFT_GPU/01_NO_KP_ocp_TDDFT_GPU/result.ref @@ -1,5 +1,5 @@ -etotref -18.05532086783207 -etotperatomref -9.0276604339 -totalforceref 44.849994 -totalstressref 79.412932 +etotref -18.06593168523523 +etotperatomref -9.0329658426 +totalforceref 40.752890 +totalstressref 72.113950 totaltimeref 1.51 diff --git a/tests/15_rtTDDFT_GPU/02_NO_CH_TDDFT_GPU/result.ref b/tests/15_rtTDDFT_GPU/02_NO_CH_TDDFT_GPU/result.ref index a83b015cd4..ded16345fe 100644 --- a/tests/15_rtTDDFT_GPU/02_NO_CH_TDDFT_GPU/result.ref +++ b/tests/15_rtTDDFT_GPU/02_NO_CH_TDDFT_GPU/result.ref @@ -1,5 +1,5 @@ -etotref -323.5397668883450 -etotperatomref -107.8465889628 -totalforceref 19.372571 -totalstressref 328.906753 +etotref -323.5398327660267 +etotperatomref -107.8466109220 +totalforceref 19.450256 +totalstressref 329.292627 totaltimeref 2.06 diff --git a/tests/15_rtTDDFT_GPU/03_NO_CO_TDDFT_GPU/result.ref b/tests/15_rtTDDFT_GPU/03_NO_CO_TDDFT_GPU/result.ref index 19ab9cb76f..c4d08e3f9f 100644 --- a/tests/15_rtTDDFT_GPU/03_NO_CO_TDDFT_GPU/result.ref +++ b/tests/15_rtTDDFT_GPU/03_NO_CO_TDDFT_GPU/result.ref @@ -1,5 +1,5 @@ -etotref -603.4339685991257 -etotperatomref -301.7169842996 -totalforceref 14.762982 -totalstressref 32.741000 +etotref -603.4339802028381 +etotperatomref -301.7169901014 +totalforceref 12.079250 +totalstressref 28.046553 totaltimeref 2.53 diff --git a/tests/15_rtTDDFT_GPU/04_NO_CO_ocp_TDDFT_GPU/result.ref b/tests/15_rtTDDFT_GPU/04_NO_CO_ocp_TDDFT_GPU/result.ref index 10320d8162..afac7efc1f 100644 --- a/tests/15_rtTDDFT_GPU/04_NO_CO_ocp_TDDFT_GPU/result.ref +++ b/tests/15_rtTDDFT_GPU/04_NO_CO_ocp_TDDFT_GPU/result.ref @@ -1,5 +1,5 @@ -etotref -603.4339685991248 -etotperatomref -301.7169842996 -totalforceref 14.762982 -totalstressref 32.737292 +etotref -603.4337824685499 +etotperatomref -301.7168912343 +totalforceref 12.090612 +totalstressref 27.990852 totaltimeref 2.71 diff --git a/tests/15_rtTDDFT_GPU/05_NO_cur_TDDFT_GPU/result.ref b/tests/15_rtTDDFT_GPU/05_NO_cur_TDDFT_GPU/result.ref index dbe64306cd..d3cd1841df 100644 --- a/tests/15_rtTDDFT_GPU/05_NO_cur_TDDFT_GPU/result.ref +++ b/tests/15_rtTDDFT_GPU/05_NO_cur_TDDFT_GPU/result.ref @@ -1,6 +1,6 @@ -etotref -30.91255706614114 -etotperatomref -15.4562785331 -totalforceref 0.459938 -totalstressref 0.946457 +etotref -30.91255300422832 +etotperatomref -15.4562765021 +totalforceref 0.479532 +totalstressref 0.981046 CompareCurrent_pass 0 totaltimeref 1.72 diff --git a/tests/15_rtTDDFT_GPU/06_NO_dir_TDDFT_GPU/result.ref b/tests/15_rtTDDFT_GPU/06_NO_dir_TDDFT_GPU/result.ref index ed14fa024d..8cab4cc796 100644 --- a/tests/15_rtTDDFT_GPU/06_NO_dir_TDDFT_GPU/result.ref +++ b/tests/15_rtTDDFT_GPU/06_NO_dir_TDDFT_GPU/result.ref @@ -1,5 +1,5 @@ -etotref -30.45466274119030 -etotperatomref -15.2273313706 -totalforceref 0.57439400 -totalstressref 4.285714 +etotref -30.45454376271162 +etotperatomref -15.2272718814 +totalforceref 0.595498 +totalstressref 4.286358 totaltimeref 1.55 diff --git a/tests/15_rtTDDFT_GPU/07_NO_EDM_TDDFT_GPU/result.ref b/tests/15_rtTDDFT_GPU/07_NO_EDM_TDDFT_GPU/result.ref index e8e3d2d48c..dc986d3d6b 100644 --- a/tests/15_rtTDDFT_GPU/07_NO_EDM_TDDFT_GPU/result.ref +++ b/tests/15_rtTDDFT_GPU/07_NO_EDM_TDDFT_GPU/result.ref @@ -1,5 +1,5 @@ -etotref -18.05466171990316 -etotperatomref -9.0273308600 -totalforceref 43.10812600 -totalstressref 76.35413900 +etotref -18.06494189760856 +etotperatomref -9.0324709488 +totalforceref 41.359252 +totalstressref 73.228950 totaltimeref 1.53 diff --git a/tests/15_rtTDDFT_GPU/09_NO_HEAV_TDDFT_GPU/result.ref b/tests/15_rtTDDFT_GPU/09_NO_HEAV_TDDFT_GPU/result.ref index 7fe9afe5ac..19989e81b8 100644 --- a/tests/15_rtTDDFT_GPU/09_NO_HEAV_TDDFT_GPU/result.ref +++ b/tests/15_rtTDDFT_GPU/09_NO_HEAV_TDDFT_GPU/result.ref @@ -1,5 +1,5 @@ -etotref -22.97718184915547 -etotperatomref -11.4885909246 -totalforceref 0.56587600 -totalstressref 76.073961 +etotref -22.97638349080424 +etotperatomref -11.4881917454 +totalforceref 0.582042 +totalstressref 76.025571 totaltimeref 1.56 diff --git a/tests/15_rtTDDFT_GPU/10_NO_HHG_TDDFT_GPU/result.ref b/tests/15_rtTDDFT_GPU/10_NO_HHG_TDDFT_GPU/result.ref index 6e676b2f56..91dd29c0e7 100644 --- a/tests/15_rtTDDFT_GPU/10_NO_HHG_TDDFT_GPU/result.ref +++ b/tests/15_rtTDDFT_GPU/10_NO_HHG_TDDFT_GPU/result.ref @@ -1,5 +1,5 @@ -etotref 20.38731422853930 -etotperatomref 10.1936571143 -totalforceref 0.73949000 -totalstressref 489.377111 +etotref 20.47683114572230 +etotperatomref 10.2384155729 +totalforceref 0.451670 +totalstressref 487.779801 totaltimeref 1.56 diff --git a/tests/15_rtTDDFT_GPU/11_NO_O3_TDDFT_GPU/result.ref b/tests/15_rtTDDFT_GPU/11_NO_O3_TDDFT_GPU/result.ref index fb20ab8d24..777bb60370 100644 --- a/tests/15_rtTDDFT_GPU/11_NO_O3_TDDFT_GPU/result.ref +++ b/tests/15_rtTDDFT_GPU/11_NO_O3_TDDFT_GPU/result.ref @@ -1,5 +1,5 @@ -etotref -1336.999614848928 -etotperatomref -445.6665382830 -totalforceref 11.103409 -totalstressref 61.267028 +etotref -1336.999498209980 +etotperatomref -445.6664994033 +totalforceref 11.627501 +totalstressref 64.927558 totaltimeref 2.42 diff --git a/tests/15_rtTDDFT_GPU/12_NO_re_TDDFT_GPU/restart/Restart_td.txt b/tests/15_rtTDDFT_GPU/12_NO_re_TDDFT_GPU/restart/Restart_td.txt new file mode 100644 index 0000000000..4bcfc2a96f --- /dev/null +++ b/tests/15_rtTDDFT_GPU/12_NO_re_TDDFT_GPU/restart/Restart_td.txt @@ -0,0 +1,3 @@ +5 +0 0 0 +0 0 0 \ No newline at end of file diff --git a/tests/15_rtTDDFT_GPU/12_NO_re_TDDFT_GPU/restart/wfs1k1_nao.txt b/tests/15_rtTDDFT_GPU/12_NO_re_TDDFT_GPU/restart/WFC/wfs1k1g6_nao.txt similarity index 100% rename from tests/15_rtTDDFT_GPU/12_NO_re_TDDFT_GPU/restart/wfs1k1_nao.txt rename to tests/15_rtTDDFT_GPU/12_NO_re_TDDFT_GPU/restart/WFC/wfs1k1g6_nao.txt diff --git a/tests/15_rtTDDFT_GPU/14_NO_TRAP_TDDFT_GPU/result.ref b/tests/15_rtTDDFT_GPU/14_NO_TRAP_TDDFT_GPU/result.ref index 264acd99d0..86ddde6b25 100644 --- a/tests/15_rtTDDFT_GPU/14_NO_TRAP_TDDFT_GPU/result.ref +++ b/tests/15_rtTDDFT_GPU/14_NO_TRAP_TDDFT_GPU/result.ref @@ -1,5 +1,5 @@ -etotref -30.89965242483882 -etotperatomref -15.4498262124 -totalforceref 0.57561800 -totalstressref 1.03619000 +etotref -30.89964815765920 +etotperatomref -15.4498240788 +totalforceref 0.596612 +totalstressref 1.073053 totaltimeref 1.44 diff --git a/tests/15_rtTDDFT_GPU/15_NO_TRI_TDDFT_GPU/result.ref b/tests/15_rtTDDFT_GPU/15_NO_TRI_TDDFT_GPU/result.ref index 6948429d12..39d05e0518 100644 --- a/tests/15_rtTDDFT_GPU/15_NO_TRI_TDDFT_GPU/result.ref +++ b/tests/15_rtTDDFT_GPU/15_NO_TRI_TDDFT_GPU/result.ref @@ -1,5 +1,5 @@ -etotref -30.90912142263002 -etotperatomref -15.4545607113 -totalforceref 0.57561800 -totalstressref 1.11089700 +etotref -30.90911715730047 +etotperatomref -15.4545585787 +totalforceref 0.596616 +totalstressref 1.147852 totaltimeref 1.43 diff --git a/tests/15_rtTDDFT_GPU/16_NO_vel_TDDFT_GPU/result.ref b/tests/15_rtTDDFT_GPU/16_NO_vel_TDDFT_GPU/result.ref index bcab77040f..dcbb5f1498 100644 --- a/tests/15_rtTDDFT_GPU/16_NO_vel_TDDFT_GPU/result.ref +++ b/tests/15_rtTDDFT_GPU/16_NO_vel_TDDFT_GPU/result.ref @@ -1,6 +1,6 @@ -etotref -30.91272078341993 -etotperatomref -15.4563603917 -totalforceref 0.459664 -totalstressref 0.945878 +etotref -30.91272578807960 +etotperatomref -15.4563628940 +totalforceref 0.479236 +totalstressref 0.980314 CompareCurrent_pass 0 totaltimeref 1.81 diff --git a/tests/15_rtTDDFT_GPU/17_NO_vel_TDDFT_GPU/refcurrent_total.dat b/tests/15_rtTDDFT_GPU/17_NO_vel_TDDFT_GPU/refcurrent_total.dat index c9f84ba227..8802e3f5cd 100644 --- a/tests/15_rtTDDFT_GPU/17_NO_vel_TDDFT_GPU/refcurrent_total.dat +++ b/tests/15_rtTDDFT_GPU/17_NO_vel_TDDFT_GPU/refcurrent_total.dat @@ -1,3 +1,3 @@ 0 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 -1 -9.0873653377507955e-16 3.9425556023172989e-16 -9.4623183996671908e-03 -2 -2.8433625051390163e-15 7.3755027825125381e-16 -6.7585654059417327e-03 +1 3.9383095821745186e-19 -7.1789081877293453e-18 5.1985933203197939e-06 +2 -3.7148491227321649e-18 -1.9227633196995937e-17 1.3886066143115769e-05 diff --git a/tests/15_rtTDDFT_GPU/17_NO_vel_TDDFT_GPU/result.ref b/tests/15_rtTDDFT_GPU/17_NO_vel_TDDFT_GPU/result.ref index da8c639f1b..cbb6ccf527 100644 --- a/tests/15_rtTDDFT_GPU/17_NO_vel_TDDFT_GPU/result.ref +++ b/tests/15_rtTDDFT_GPU/17_NO_vel_TDDFT_GPU/result.ref @@ -1,4 +1,4 @@ -etotref -194.7716932784952 -etotperatomref -97.3858466392 +etotref -194.7715239600904 +etotperatomref -97.3857619800 CompareCurrent_pass 0 totaltimeref 6.74 diff --git a/tests/15_rtTDDFT_GPU/CASES_GPU.txt b/tests/15_rtTDDFT_GPU/CASES_GPU.txt index dac3fe5ed9..c930799511 100644 --- a/tests/15_rtTDDFT_GPU/CASES_GPU.txt +++ b/tests/15_rtTDDFT_GPU/CASES_GPU.txt @@ -1,15 +1,15 @@ -#01_NO_KP_ocp_TDDFT_GPU -#02_NO_CH_TDDFT_GPU -#03_NO_CO_TDDFT_GPU -#04_NO_CO_ocp_TDDFT_GPU -#05_NO_cur_TDDFT_GPU -#06_NO_dir_TDDFT_GPU -#07_NO_EDM_TDDFT_GPU -#09_NO_HEAV_TDDFT_GPU -#10_NO_HHG_TDDFT_GPU -#11_NO_O3_TDDFT_GPU -#12_NO_re_TDDFT_GPU -#14_NO_TRAP_TDDFT_GPU -#15_NO_TRI_TDDFT_GPU -#16_NO_vel_TDDFT_GPU -#17_NO_vel_TDDFT_GPU +01_NO_KP_ocp_TDDFT_GPU +02_NO_CH_TDDFT_GPU +03_NO_CO_TDDFT_GPU +04_NO_CO_ocp_TDDFT_GPU +05_NO_cur_TDDFT_GPU +06_NO_dir_TDDFT_GPU +07_NO_EDM_TDDFT_GPU +09_NO_HEAV_TDDFT_GPU +10_NO_HHG_TDDFT_GPU +11_NO_O3_TDDFT_GPU +12_NO_re_TDDFT_GPU +14_NO_TRAP_TDDFT_GPU +15_NO_TRI_TDDFT_GPU +16_NO_vel_TDDFT_GPU +17_NO_vel_TDDFT_GPU diff --git a/tests/integrate/tools/catch_properties.sh b/tests/integrate/tools/catch_properties.sh index 4485c28fba..a5e9749a84 100755 --- a/tests/integrate/tools/catch_properties.sh +++ b/tests/integrate/tools/catch_properties.sh @@ -447,7 +447,7 @@ if ! test -z "$has_lowf" && [ $has_lowf == 1 ]; then wfc_ref=wfs1_nao.txt.ref else # multi-k point case if ! test -z "$out_app_flag" && [ $out_app_flag == 0 ]; then - wfc_name=wfs1k1g3_nao + wfc_name=WFC/wfs1k1g3_nao else wfc_name=wfs1k2_nao fi @@ -462,7 +462,7 @@ if ! test -z "$has_lowf" && [ $has_lowf == 1 ]; then printf "\n" } else {print $0} - }' OUT.autotest/WFC/"$wfc_name".txt > OUT.autotest/"$wfc_name"_mod.txt + }' OUT.autotest/"$wfc_name".txt > OUT.autotest/"$wfc_name"_mod.txt wfc_cal=OUT.autotest/"$wfc_name"_mod.txt wfc_ref="$wfc_name"_mod.txt.ref fi From cc3ca5f03752960ab026bffb44f6d2a1aa4289d5 Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Wed, 9 Jul 2025 20:48:59 +0800 Subject: [PATCH 10/16] fix read_wfc --- source/source_esolver/esolver_ks_lcao_tddft.cpp | 1 + source/source_io/read_wfc_nao.cpp | 4 ++-- source/source_io/read_wfc_nao.h | 4 ++-- source/source_io/test/read_wfc_nao_test.cpp | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/source_esolver/esolver_ks_lcao_tddft.cpp b/source/source_esolver/esolver_ks_lcao_tddft.cpp index 5ca6bfac4c..dbeb81dca9 100644 --- a/source/source_esolver/esolver_ks_lcao_tddft.cpp +++ b/source/source_esolver/esolver_ks_lcao_tddft.cpp @@ -104,6 +104,7 @@ void ESolver_KS_LCAO_TDDFT::before_all_runners(UnitCell& ucell, cons this->pelec->klist->ik2iktot, this->pelec->klist->get_nkstot(), PARAM.inp.nspin, + 0, TD_info::estep_shift)) { ModuleBase::WARNING_QUIT("ESolver_KS_LCAO", "read electronic wave functions failed"); diff --git a/source/source_io/read_wfc_nao.cpp b/source/source_io/read_wfc_nao.cpp index fcc4fab4af..78de44dca1 100644 --- a/source/source_io/read_wfc_nao.cpp +++ b/source/source_io/read_wfc_nao.cpp @@ -30,8 +30,8 @@ bool ModuleIO::read_wfc_nao( const std::vector &ik2iktot, const int nkstot, const int nspin, - const int nstep, - const int skip_band) + const int skip_band, + const int nstep) { ModuleBase::TITLE("ModuleIO", "read_wfc_nao"); ModuleBase::timer::tick("ModuleIO", "read_wfc_nao"); diff --git a/source/source_io/read_wfc_nao.h b/source/source_io/read_wfc_nao.h index e0993d2482..f1df8a7c6d 100644 --- a/source/source_io/read_wfc_nao.h +++ b/source/source_io/read_wfc_nao.h @@ -44,8 +44,8 @@ bool read_wfc_nao( const std::vector &ik2iktot, const int nkstot, const int nspin, - const int nstep = -1, - const int skip_band = 0); + const int skip_band = 0, + const int nstep = -1); } // namespace ModuleIO diff --git a/source/source_io/test/read_wfc_nao_test.cpp b/source/source_io/test/read_wfc_nao_test.cpp index cd6ed05350..703223b20f 100644 --- a/source/source_io/test/read_wfc_nao_test.cpp +++ b/source/source_io/test/read_wfc_nao_test.cpp @@ -131,7 +131,7 @@ TEST_F(ReadWfcNaoTest, ReadWfcNaoPart) // Act ModuleIO::read_wfc_nao(PARAM.sys.global_readin_dir, ParaV, psid, - &(pelec), ik2iktot, nkstot, nspin, nstep, skip_band); + &(pelec), ik2iktot, nkstot, nspin, skip_band, nstep); // Assert EXPECT_NEAR(pelec.ekb(0, 1), 7.4141254894954844445464914e-01, 1e-5); From a2a7f0f4a490e95dd181ba0b3236e03efaf9a772 Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Wed, 9 Jul 2025 21:06:40 +0800 Subject: [PATCH 11/16] fix catch_properties.sh --- tests/integrate/tools/catch_properties.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/integrate/tools/catch_properties.sh b/tests/integrate/tools/catch_properties.sh index a5e9749a84..a5b1d9eb17 100755 --- a/tests/integrate/tools/catch_properties.sh +++ b/tests/integrate/tools/catch_properties.sh @@ -447,9 +447,11 @@ if ! test -z "$has_lowf" && [ $has_lowf == 1 ]; then wfc_ref=wfs1_nao.txt.ref else # multi-k point case if ! test -z "$out_app_flag" && [ $out_app_flag == 0 ]; then - wfc_name=WFC/wfs1k1g3_nao + wfc_name=wfs1k1g3_nao + input_file=WFC/wfs1k1g3_nao else wfc_name=wfs1k2_nao + input_file=wfs1k2_nao fi awk 'BEGIN {flag=999} { @@ -462,7 +464,7 @@ if ! test -z "$has_lowf" && [ $has_lowf == 1 ]; then printf "\n" } else {print $0} - }' OUT.autotest/"$wfc_name".txt > OUT.autotest/"$wfc_name"_mod.txt + }' OUT.autotest/"$input_file".txt > OUT.autotest/"$wfc_name"_mod.txt wfc_cal=OUT.autotest/"$wfc_name"_mod.txt wfc_ref="$wfc_name"_mod.txt.ref fi From 1a12d24aa3c54fef8c250916d00229b008f92d64 Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Wed, 9 Jul 2025 21:09:18 +0800 Subject: [PATCH 12/16] fix restart --- source/source_lcao/module_rt/td_info.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/source_lcao/module_rt/td_info.cpp b/source/source_lcao/module_rt/td_info.cpp index 35d6fd729a..259580d47d 100644 --- a/source/source_lcao/module_rt/td_info.cpp +++ b/source/source_lcao/module_rt/td_info.cpp @@ -29,11 +29,11 @@ TD_info::TD_info(const UnitCell* ucell_in) if(PARAM.inp.mdp.md_restart) { std::stringstream ssc; - ssc << PARAM.globalv.global_readin_dir << "Restart_td.dat"; + ssc << PARAM.globalv.global_readin_dir << "Restart_td.txt"; std::ifstream file(ssc.str().c_str()); if (!file) { - ModuleBase::WARNING_QUIT("TD_info::TD_info", "No Restart_td.dat!"); + ModuleBase::WARNING_QUIT("TD_info::TD_info", "No Restart_td.txt!"); } file >> estep_shift; //std::cout<<"estep_shift"< Date: Wed, 9 Jul 2025 21:22:08 +0800 Subject: [PATCH 13/16] update gpu test --- .../15_rtTDDFT_GPU/16_NO_vel_TDDFT_GPU/refcurrent_total.dat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/15_rtTDDFT_GPU/16_NO_vel_TDDFT_GPU/refcurrent_total.dat b/tests/15_rtTDDFT_GPU/16_NO_vel_TDDFT_GPU/refcurrent_total.dat index 4ee29a7eaf..0173583ef3 100644 --- a/tests/15_rtTDDFT_GPU/16_NO_vel_TDDFT_GPU/refcurrent_total.dat +++ b/tests/15_rtTDDFT_GPU/16_NO_vel_TDDFT_GPU/refcurrent_total.dat @@ -1,4 +1,4 @@ 0 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 -1 1.6700828194296424e-03 3.5669278705442575e-05 5.7061051081810922e-05 -2 1.6385312870572283e-04 4.3242072196134118e-05 6.9166714437575135e-05 -3 7.0853994605125762e-04 1.5375830219108638e-05 2.4580087680048089e-05 +1 2.7669187278010950e-07 -1.3892875566265775e-09 -2.2297436847453706e-09 +2 2.2955881029815080e-07 3.4521250838755370e-09 5.5110950477892839e-09 +3 1.3457006814283194e-07 1.5269022219384739e-08 2.4393767949504196e-08 From a21959dc7cfd02b15afc38a1b970229d78f8cec2 Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Wed, 9 Jul 2025 21:33:11 +0800 Subject: [PATCH 14/16] update tests --- .../15_rtTDDFT_GPU/05_NO_cur_TDDFT_GPU/refcurrent_total.dat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/15_rtTDDFT_GPU/05_NO_cur_TDDFT_GPU/refcurrent_total.dat b/tests/15_rtTDDFT_GPU/05_NO_cur_TDDFT_GPU/refcurrent_total.dat index 5f225fd90f..4c3b1c5d5e 100644 --- a/tests/15_rtTDDFT_GPU/05_NO_cur_TDDFT_GPU/refcurrent_total.dat +++ b/tests/15_rtTDDFT_GPU/05_NO_cur_TDDFT_GPU/refcurrent_total.dat @@ -1,4 +1,4 @@ 0 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 -1 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 -2 -4.2482488063038011e-04 3.6208093141272442e-05 5.7880862345902912e-05 -3 1.7506474069499989e-04 9.7936761289276890e-05 1.5650847511644919e-04 \ No newline at end of file +1 1.3253329345179453e-07 -1.1309759467848516e-08 -1.8100967211060974e-08 +2 -1.8712729254911609e-07 -1.9255546268139507e-08 -3.0821009248084689e-08 +3 1.6157844599821334e-08 1.2274265606153575e-08 1.9637494050035531e-08 From a6172e53907b95987370513f04c0a6ca95531cb3 Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Wed, 9 Jul 2025 22:01:35 +0800 Subject: [PATCH 15/16] fix --- source/source_io/td_current_io.cpp | 8 ++++---- source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp | 2 +- source/source_lcao/module_rt/td_folding.cpp | 2 +- source/source_lcao/module_rt/td_folding.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/source_io/td_current_io.cpp b/source/source_io/td_current_io.cpp index 88b8c576b1..4cf0e56045 100644 --- a/source/source_io/td_current_io.cpp +++ b/source/source_io/td_current_io.cpp @@ -58,7 +58,7 @@ void ModuleIO::write_current(const UnitCell& ucell, { if (TD_info::td_vel_op == nullptr) { - ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gague infos is null!"); + ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gauge infos is null!"); } for (int dir = 0; dir < 3; dir++) { @@ -250,7 +250,7 @@ void ModuleIO::cal_tmp_DM_k(const UnitCell& ucell, double arg_td = 0.0; if(elecstate::H_TDDFT_pw::stype == 2) { - //cal tddft phase for hybrid gague + //cal tddft phase for hybrid gauge const int iat1 = tmp_ap_real.get_atom_i(); const int iat2 = tmp_ap_real.get_atom_j(); ModuleBase::Vector3 dtau = ucell.cal_dtau(iat1, iat2, r_index); @@ -320,7 +320,7 @@ void ModuleIO::cal_tmp_DM_k(const UnitCell& ucell, if(elecstate::H_TDDFT_pw::stype == 2) { //new - //cal tddft phase for mixing gague + //cal tddft phase for mixing gauge const int iat1 = tmp_ap_real.get_atom_i(); const int iat2 = tmp_ap_real.get_atom_j(); ModuleBase::Vector3 dtau = ucell.cal_dtau(iat1, iat2, r_index); @@ -424,7 +424,7 @@ void ModuleIO::write_current_eachk(const UnitCell& ucell, { if (TD_info::td_vel_op == nullptr) { - ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gague infos is null!"); + ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gauge infos is null!"); } for (int dir = 0; dir < 3; dir++) { diff --git a/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp b/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp index 231aef3870..f024c6fbff 100644 --- a/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp +++ b/source/source_lcao/module_operator_lcao/td_pot_hybrid.cpp @@ -238,7 +238,7 @@ void hamilt::TD_pot_hybrid>::init_td() template void hamilt::TD_pot_hybrid>::update_td() { - //std::cout<<"hybrid gague" <cart_At = TD_info::cart_At; //std::cout<<"At: "<< TD_info::td_vel_op->cart_At[0] <<" "<cart_At[1]<<" "<cart_At[2]<<" "<& hR, const ModuleBase::Vector3 r_index = tmp.get_R_index(ir); //new - //cal tddft phase for hybrid gague + //cal tddft phase for hybrid gauge const int iat1 = tmp.get_atom_i(); const int iat2 = tmp.get_atom_j(); ModuleBase::Vector3 dtau = ucell->cal_dtau(iat1, iat2, r_index); diff --git a/source/source_lcao/module_rt/td_folding.h b/source/source_lcao/module_rt/td_folding.h index 0b4d5902ba..954d01d776 100644 --- a/source/source_lcao/module_rt/td_folding.h +++ b/source/source_lcao/module_rt/td_folding.h @@ -4,7 +4,7 @@ #include "source_base/abfs-vector3_order.h" namespace module_rt{ -// folding HR to hk, for hybrid gague +// folding HR to hk, for hybrid gauge template void folding_HR_td(const hamilt::HContainer& hR, std::complex* hk, From 604e17b9c0379b4c7a9464cdeeb09a72fc35e68d Mon Sep 17 00:00:00 2001 From: ESROAMER Date: Thu, 10 Jul 2025 00:30:33 +0800 Subject: [PATCH 16/16] fix input_conv --- docs/advanced/input_files/input-main.md | 2 +- source/source_io/input_conv.cpp | 39 ++++++++++++++++--------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/docs/advanced/input_files/input-main.md b/docs/advanced/input_files/input-main.md index 5e76ca303f..40abf00c3b 100644 --- a/docs/advanced/input_files/input-main.md +++ b/docs/advanced/input_files/input-main.md @@ -1730,7 +1730,7 @@ These variables are used to control the output of properties. - **Type**: Integer - **Availability**: Numerical atomic orbital basis -- **Description**: Whether to output the electronic wavefunction coefficients into files and store them in the folder `OUT.${suffix}`. The files are named as `wf{s}{spin index}{k(optional)}{k-point index}{g(optional)}{geometry index1}{_nao} + {".txt"/".dat"}`. Here, 's' refers to spin, where s1 means spin up channel while s2 means spin down channel, and 's12' refer to spinor wave functions that contains both spin channels with spin-orbital coupling or noncollinear calculations enabled. In addition, if 'gamma_only' is set to 0, then the optinoal k-point sampling index appears with the k-point index attached to the electronic wave function file names. Finally, if [out_app_flag](#out_app_flag) is set to false, the file name contains the optional 'g' index for each ionic step that may have different geometries, and if [out_app_flag](#out_app_flag) is set to true, the wave functions accumulate during ionic steps. +- **Description**: Whether to output the electronic wavefunction coefficients into files and store them in the folder `OUT.${suffix}`. The files are named as `wf{s}{spin index}{k(optional)}{k-point index}{g(optional)}{geometry index1}{_nao} + {".txt"/".dat"}`. Here, 's' refers to spin, where s1 means spin up channel while s2 means spin down channel, and 's12' refer to spinor wave functions that contains both spin channels with spin-orbital coupling or noncollinear calculations enabled. In addition, if 'gamma_only' is set to 0, then the optinoal k-point sampling index appears with the k-point index attached to the electronic wave function file names. Finally, if [out_app_flag](#out_app_flag) is set to false, the file name contains the optional 'g' index for each ionic step that may have different geometries, and if [out_app_flag](#out_app_flag) is set to true, the wave functions accumulate during ionic steps. If the out_app_flag is set to false, a new folder named WFC will be created, and the wave function files will be saved into it. - 0: no output - 1: (txt format) - gamma-only: `wfs1_nao.txt` or `wfs2_nao.txt`, ...; diff --git a/source/source_io/input_conv.cpp b/source/source_io/input_conv.cpp index 9a4b19d4f7..abf613c6bc 100644 --- a/source/source_io/input_conv.cpp +++ b/source/source_io/input_conv.cpp @@ -298,7 +298,12 @@ void Input_Conv::Convert() if (dft_functional_lower == "hf" || dft_functional_lower == "pbe0" || dft_functional_lower == "hse" || dft_functional_lower == "opt_orb" - || dft_functional_lower == "scan0") { + || dft_functional_lower == "scan0" + || dft_functional_lower == "lc_pbe" + || dft_functional_lower == "lc_wpbe" + || dft_functional_lower == "lrc_wpbe" + || dft_functional_lower == "lrc_wpbeh" + || dft_functional_lower == "cam_pbeh") { GlobalC::restart.info_load.load_charge = true; GlobalC::restart.info_load.load_H = true; } @@ -323,10 +328,15 @@ void Input_Conv::Convert() dft_functional_lower.begin(), tolower); if (dft_functional_lower == "hf" - || dft_functional_lower == "pbe0" || dft_functional_lower == "b3lyp" || dft_functional_lower == "hse" - || dft_functional_lower == "scan0" - || dft_functional_lower == "muller" || dft_functional_lower == "power" - || dft_functional_lower == "cwp22" || dft_functional_lower == "wp22") + || dft_functional_lower == "pbe0" || dft_functional_lower == "b3lyp" || dft_functional_lower == "hse" + || dft_functional_lower == "scan0" + || dft_functional_lower == "muller" || dft_functional_lower == "power" + || dft_functional_lower == "cwp22" || dft_functional_lower == "wp22" + || dft_functional_lower == "lc_pbe" + || dft_functional_lower == "lc_wpbe" + || dft_functional_lower == "lrc_wpbe" + || dft_functional_lower == "lrc_wpbeh" + || dft_functional_lower == "cam_pbeh") { GlobalC::exx_info.info_global.cal_exx = true; @@ -356,9 +366,9 @@ void Input_Conv::Convert() GlobalC::exx_info.info_global.coulomb_param[Conv_Coulomb_Pot_K::Coulomb_Type::Fock].resize(fock_alpha.size()); for(std::size_t i=0; i