Skip to content

Test: Add RT-TDDFT GPU integrate tests and fix some related bugs/typos #6201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ jobs:
cd tests/13_NAO_multik_GPU
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt

- name: Test 15_rtTDDFT_GPU
run: |
cd tests/15_rtTDDFT_GPU
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt

- name: Test 16_SDFT_GPU
run: |
cd tests/16_SDFT_GPU
Expand Down
11 changes: 4 additions & 7 deletions examples/tddft/README
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
/*******************************************************************************/

These examples show how to do a real-time tddft calculation.
One can set 'calculation' to be 'md' and esolver_type to be 'tddft' to do TDDFT calculation.
One can set 'calculation' to be 'md' and 'esolver_type' to be 'tddft' to do TDDFT calculation.

A time-dependent E-field can be applied by setting 'td_vext' to '1'.
- For Non-periodic system, you could set 'stype' to '0' to do length gauge calculation, which would be faster.
- For Periodic system, you could set 'stype' to '1' to do velocity gauge calculation.
velocity gague has not been fully tested yet, so be careful about its results.



- For non-periodic system, you could set 'stype' to '0' to do length gauge calculation, which would be faster.
- For periodic system, you could set 'stype' to '1' to do velocity gauge calculation.
Velocity gauge has not been fully tested yet, so be careful about its results.
2 changes: 1 addition & 1 deletion source/module_elecstate/module_pot/H_TDDFT_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void H_TDDFT_pw::cal_fixed_v(double* vl_pseudo)
{
ModuleBase::TITLE("H_TDDFT_pw", "cal_fixed_v");

// skip if velocity_gague
// skip if velocity_gauge
if (stype == 1)
{
return;
Expand Down
4 changes: 2 additions & 2 deletions source/module_hamilt_lcao/hamilt_lcaodft/hamilt_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ HamiltLCAO<TK, TR>::HamiltLCAO(Gint_Gamma* GG_in,
orb.cutoffs(),
&grid_d,
two_center_bundle.overlap_orb_beta.get());
// TDDFT velocity gague will calculate full non-local potential including the original one and the
// TDDFT velocity gauge will calculate full non-local potential including the original one and the
// correction on its own. So the original non-local potential term should be skipped
if (PARAM.inp.esolver_type != "tddft" || elecstate::H_TDDFT_pw::stype != 1)
{
Expand Down Expand Up @@ -343,7 +343,7 @@ HamiltLCAO<TK, TR>::HamiltLCAO(Gint_Gamma* GG_in,
this->V_delta_R = dynamic_cast<DeePKS<OperatorLCAO<TK, TR>>*>(deepks)->get_V_delta_R();
}
#endif
// TDDFT_velocity_gague
// TDDFT_velocity_gauge
if (TD_Velocity::tddft_velocity)
{
if (!TD_Velocity::init_vecpot_file)
Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_lcao/module_tddft/td_current.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ TD_current::TD_current(const UnitCell* ucell_in,
const TwoCenterIntegrator* intor)
: ucell(ucell_in), paraV(paraV), orb_(orb), Grid(GridD_in), 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<double>(0, 0, 0);
this->initialize_vcomm_r(GridD_in, paraV);
this->initialize_grad_term(GridD_in, paraV);
Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_lcao/module_tddft/td_current.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "module_base/vector3.h"

#ifdef __LCAO
//design to calculate current for length gague
//design to calculate current for length gauge
class TD_current
{
public:
Expand Down
4 changes: 2 additions & 2 deletions source/module_hamilt_lcao/module_tddft/td_velocity.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "module_hamilt_lcao/module_hcontainer/hcontainer.h"

#include <map>
// Class to store TDDFT velocity gague infos.
// Class to store TDDFT velocity gauge infos.
class TD_Velocity
{
public:
Expand Down Expand Up @@ -49,7 +49,7 @@ class TD_Velocity
return this->current_term[i];
}

// For TDDFT velocity gague, to fix the output of HR
// For TDDFT velocity gauge, to fix the output of HR
std::map<Abfs::Vector3_Order<int>, std::map<size_t, std::map<size_t, std::complex<double>>>> HR_sparse_td_vel[2];

private:
Expand Down
2 changes: 1 addition & 1 deletion source/module_io/td_current_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void ModuleIO::write_current(const UnitCell& ucell,
{
if (TD_Velocity::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++)
{
Expand Down
52 changes: 26 additions & 26 deletions tests/05_rtTDDFT/01_NO_KP_ocp_TDDFT/INPUT
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
INPUT_PARAMETERS
#Parameters (General)
suffix autotest
pseudo_dir ../../PP_ORB
orbital_dir ../../PP_ORB
#Parameters (General)
suffix autotest
pseudo_dir ../../PP_ORB
orbital_dir ../../PP_ORB

nbands 5
calculation md
esolver_type tddft
nbands 5
calculation md
esolver_type tddft

#Parameter (Accuracy)
ecutwfc 20
scf_nmax 50
ecutwfc 20
scf_nmax 50

ks_solver scalapack_gvx
basis_type lcao
gamma_only 0
md_nstep 2
ks_solver scalapack_gvx
basis_type lcao
gamma_only 0
md_nstep 2

mixing_type broyden
mixing_beta 0.7
mixing_gg0 0.0
scf_thr 1.0e-6
mixing_type broyden
mixing_beta 0.7
mixing_gg0 0.0
scf_thr 1.0e-6

cal_stress 1
stress_thr 1e-6
cal_force 1
force_thr_ev 1.0e-3
cal_stress 1
stress_thr 1e-6
cal_force 1
force_thr_ev 1.0e-3

md_type nve
md_dt 0.05
init_vel 1
ocp 1
ocp_set 1*1 1*1 3*0
md_type nve
md_dt 0.05
init_vel 1
ocp 1
ocp_set 1*1 1*1 3*0
52 changes: 26 additions & 26 deletions tests/05_rtTDDFT/02_NO_CH_TDDFT/INPUT
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
INPUT_PARAMETERS
#Parameters (General)
suffix autotest
pseudo_dir ../../PP_ORB
orbital_dir ../../PP_ORB
#Parameters (General)
suffix autotest
pseudo_dir ../../PP_ORB
orbital_dir ../../PP_ORB

nbands 10
calculation md
esolver_type tddft
nbands 10
calculation md
esolver_type tddft

#Parameter (Accuracy)
ecutwfc 5
scf_nmax 50
ecutwfc 5
scf_nmax 50

smearing_method gaussian
smearing_sigma 0.02
smearing_method gaussian
smearing_sigma 0.02

ks_solver scalapack_gvx
basis_type lcao
gamma_only 0
md_nstep 2
ks_solver scalapack_gvx
basis_type lcao
gamma_only 0
md_nstep 2

mixing_type broyden
mixing_beta 0.7
mixing_gg0 0.0
scf_thr 1.0e-6
mixing_type broyden
mixing_beta 0.7
mixing_gg0 0.0
scf_thr 1.0e-6

cal_stress 1
stress_thr 1e-6
cal_force 1
force_thr_ev 1e-3
cal_stress 1
stress_thr 1e-6
cal_force 1
force_thr_ev 1e-3

md_type nve
md_dt 0.01
init_vel 1
md_type nve
md_dt 0.01
init_vel 1
52 changes: 26 additions & 26 deletions tests/05_rtTDDFT/03_NO_CO_TDDFT/INPUT
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
INPUT_PARAMETERS
#Parameters (General)
suffix autotest
pseudo_dir ../../PP_ORB
orbital_dir ../../PP_ORB
#Parameters (General)
suffix autotest
pseudo_dir ../../PP_ORB
orbital_dir ../../PP_ORB

nbands 10
calculation md
esolver_type tddft
nbands 10
calculation md
esolver_type tddft

#Parameter (Accuracy)
ecutwfc 20
scf_nmax 50
ecutwfc 20
scf_nmax 50

ks_solver scalapack_gvx
basis_type lcao
gamma_only 0
md_nstep 2
ks_solver scalapack_gvx
basis_type lcao
gamma_only 0
md_nstep 2

mixing_type broyden
mixing_beta 0.7
mixing_gg0 0.0
scf_thr 1.0e-6
mixing_type broyden
mixing_beta 0.7
mixing_gg0 0.0
scf_thr 1.0e-6

cal_stress 1
stress_thr 1e-6
cal_force 1
force_thr_ev 1.0e-3
cal_stress 1
stress_thr 1e-6
cal_force 1
force_thr_ev 1.0e-3

md_type nve
md_dt 0.05
init_vel 1
ocp 1
ocp_set 4*2 2*1 4*0
md_type nve
md_dt 0.05
init_vel 1
ocp 1
ocp_set 4*2 2*1 4*0
54 changes: 26 additions & 28 deletions tests/05_rtTDDFT/04_NO_CO_ocp_TDDFT/INPUT
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
INPUT_PARAMETERS
#Parameters (General)
suffix autotest
pseudo_dir ../../PP_ORB
orbital_dir ../../PP_ORB
#Parameters (General)
suffix autotest
pseudo_dir ../../PP_ORB
orbital_dir ../../PP_ORB

nbands 10
calculation md
esolver_type tddft
nbands 10
calculation md
esolver_type tddft

#Parameter (Accuracy)
ecutwfc 20
scf_nmax 50
ecutwfc 20
scf_nmax 50

#ks_solver lapack
ks_solver scalapack_gvx
basis_type lcao
gamma_only 0
md_nstep 2
ks_solver scalapack_gvx
basis_type lcao
gamma_only 0
md_nstep 2

mixing_type broyden
mixing_beta 0.7
mixing_gg0 0.0
scf_thr 1.0e-6
#out_alllog 1
mixing_type broyden
mixing_beta 0.7
mixing_gg0 0.0
scf_thr 1.0e-6

cal_stress 1
stress_thr 1e-6
cal_force 1
force_thr_ev 1.0e-3
cal_stress 1
stress_thr 1e-6
cal_force 1
force_thr_ev 1.0e-3

md_type nve
md_dt 0.05
init_vel 1
ocp 1
ocp_set 4*2 1*1 1*0 1*1 3*0
md_type nve
md_dt 0.05
init_vel 1
ocp 1
ocp_set 4*2 1*1 1*0 1*1 3*0
Loading
Loading