Skip to content

Commit eb20d48

Browse files
authored
Test: Add RT-TDDFT GPU integrate tests and fix some related bugs/typos (#6201)
* Add RT-TDDFT GPU test cases and fix some bugs * Modify GitHub CI/CD config file * Trigger ReadTheDocs rebuild * Trigger ReadTheDocs rebuild * Delete useless info in result.ref
1 parent 7071de6 commit eb20d48

File tree

109 files changed

+1918
-564
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+1918
-564
lines changed

.github/workflows/cuda.yml

+5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ jobs:
5252
cd tests/13_NAO_multik_GPU
5353
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt
5454
55+
- name: Test 15_rtTDDFT_GPU
56+
run: |
57+
cd tests/15_rtTDDFT_GPU
58+
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt
59+
5560
- name: Test 16_SDFT_GPU
5661
run: |
5762
cd tests/16_SDFT_GPU

examples/tddft/README

+4-7
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@
55
/*******************************************************************************/
66

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

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

source/module_elecstate/module_pot/H_TDDFT_pw.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void H_TDDFT_pw::cal_fixed_v(double* vl_pseudo)
9999
{
100100
ModuleBase::TITLE("H_TDDFT_pw", "cal_fixed_v");
101101

102-
// skip if velocity_gague
102+
// skip if velocity_gauge
103103
if (stype == 1)
104104
{
105105
return;

source/module_hamilt_lcao/hamilt_lcaodft/hamilt_lcao.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ HamiltLCAO<TK, TR>::HamiltLCAO(Gint_Gamma* GG_in,
314314
orb.cutoffs(),
315315
&grid_d,
316316
two_center_bundle.overlap_orb_beta.get());
317-
// TDDFT velocity gague will calculate full non-local potential including the original one and the
317+
// TDDFT velocity gauge will calculate full non-local potential including the original one and the
318318
// correction on its own. So the original non-local potential term should be skipped
319319
if (PARAM.inp.esolver_type != "tddft" || elecstate::H_TDDFT_pw::stype != 1)
320320
{
@@ -343,7 +343,7 @@ HamiltLCAO<TK, TR>::HamiltLCAO(Gint_Gamma* GG_in,
343343
this->V_delta_R = dynamic_cast<DeePKS<OperatorLCAO<TK, TR>>*>(deepks)->get_V_delta_R();
344344
}
345345
#endif
346-
// TDDFT_velocity_gague
346+
// TDDFT_velocity_gauge
347347
if (TD_Velocity::tddft_velocity)
348348
{
349349
if (!TD_Velocity::init_vecpot_file)

source/module_hamilt_lcao/module_tddft/td_current.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ TD_current::TD_current(const UnitCell* ucell_in,
1515
const TwoCenterIntegrator* intor)
1616
: ucell(ucell_in), paraV(paraV), orb_(orb), Grid(GridD_in), intor_(intor)
1717
{
18-
// for length gague, the A(t) = 0 for all the time.
18+
// for length gauge, the A(t) = 0 for all the time.
1919
this->cart_At = ModuleBase::Vector3<double>(0, 0, 0);
2020
this->initialize_vcomm_r(GridD_in, paraV);
2121
this->initialize_grad_term(GridD_in, paraV);

source/module_hamilt_lcao/module_tddft/td_current.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "module_base/vector3.h"
1111

1212
#ifdef __LCAO
13-
//design to calculate current for length gague
13+
//design to calculate current for length gauge
1414
class TD_current
1515
{
1616
public:

source/module_hamilt_lcao/module_tddft/td_velocity.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "module_hamilt_lcao/module_hcontainer/hcontainer.h"
66

77
#include <map>
8-
// Class to store TDDFT velocity gague infos.
8+
// Class to store TDDFT velocity gauge infos.
99
class TD_Velocity
1010
{
1111
public:
@@ -49,7 +49,7 @@ class TD_Velocity
4949
return this->current_term[i];
5050
}
5151

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

5555
private:

source/module_io/td_current_io.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void ModuleIO::write_current(const UnitCell& ucell,
148148
{
149149
if (TD_Velocity::td_vel_op == nullptr)
150150
{
151-
ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gague infos is null!");
151+
ModuleBase::WARNING_QUIT("ModuleIO::write_current", "velocity gauge infos is null!");
152152
}
153153
for (int dir = 0; dir < 3; dir++)
154154
{
+26-26
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
INPUT_PARAMETERS
2-
#Parameters (General)
3-
suffix autotest
4-
pseudo_dir ../../PP_ORB
5-
orbital_dir ../../PP_ORB
2+
#Parameters (General)
3+
suffix autotest
4+
pseudo_dir ../../PP_ORB
5+
orbital_dir ../../PP_ORB
66

7-
nbands 5
8-
calculation md
9-
esolver_type tddft
7+
nbands 5
8+
calculation md
9+
esolver_type tddft
1010

1111
#Parameter (Accuracy)
12-
ecutwfc 20
13-
scf_nmax 50
12+
ecutwfc 20
13+
scf_nmax 50
1414

15-
ks_solver scalapack_gvx
16-
basis_type lcao
17-
gamma_only 0
18-
md_nstep 2
15+
ks_solver scalapack_gvx
16+
basis_type lcao
17+
gamma_only 0
18+
md_nstep 2
1919

20-
mixing_type broyden
21-
mixing_beta 0.7
22-
mixing_gg0 0.0
23-
scf_thr 1.0e-6
20+
mixing_type broyden
21+
mixing_beta 0.7
22+
mixing_gg0 0.0
23+
scf_thr 1.0e-6
2424

25-
cal_stress 1
26-
stress_thr 1e-6
27-
cal_force 1
28-
force_thr_ev 1.0e-3
25+
cal_stress 1
26+
stress_thr 1e-6
27+
cal_force 1
28+
force_thr_ev 1.0e-3
2929

30-
md_type nve
31-
md_dt 0.05
32-
init_vel 1
33-
ocp 1
34-
ocp_set 1*1 1*1 3*0
30+
md_type nve
31+
md_dt 0.05
32+
init_vel 1
33+
ocp 1
34+
ocp_set 1*1 1*1 3*0

tests/05_rtTDDFT/02_NO_CH_TDDFT/INPUT

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
INPUT_PARAMETERS
2-
#Parameters (General)
3-
suffix autotest
4-
pseudo_dir ../../PP_ORB
5-
orbital_dir ../../PP_ORB
2+
#Parameters (General)
3+
suffix autotest
4+
pseudo_dir ../../PP_ORB
5+
orbital_dir ../../PP_ORB
66

7-
nbands 10
8-
calculation md
9-
esolver_type tddft
7+
nbands 10
8+
calculation md
9+
esolver_type tddft
1010

1111
#Parameter (Accuracy)
12-
ecutwfc 5
13-
scf_nmax 50
12+
ecutwfc 5
13+
scf_nmax 50
1414

15-
smearing_method gaussian
16-
smearing_sigma 0.02
15+
smearing_method gaussian
16+
smearing_sigma 0.02
1717

18-
ks_solver scalapack_gvx
19-
basis_type lcao
20-
gamma_only 0
21-
md_nstep 2
18+
ks_solver scalapack_gvx
19+
basis_type lcao
20+
gamma_only 0
21+
md_nstep 2
2222

23-
mixing_type broyden
24-
mixing_beta 0.7
25-
mixing_gg0 0.0
26-
scf_thr 1.0e-6
23+
mixing_type broyden
24+
mixing_beta 0.7
25+
mixing_gg0 0.0
26+
scf_thr 1.0e-6
2727

28-
cal_stress 1
29-
stress_thr 1e-6
30-
cal_force 1
31-
force_thr_ev 1e-3
28+
cal_stress 1
29+
stress_thr 1e-6
30+
cal_force 1
31+
force_thr_ev 1e-3
3232

33-
md_type nve
34-
md_dt 0.01
35-
init_vel 1
33+
md_type nve
34+
md_dt 0.01
35+
init_vel 1

tests/05_rtTDDFT/03_NO_CO_TDDFT/INPUT

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
INPUT_PARAMETERS
2-
#Parameters (General)
3-
suffix autotest
4-
pseudo_dir ../../PP_ORB
5-
orbital_dir ../../PP_ORB
2+
#Parameters (General)
3+
suffix autotest
4+
pseudo_dir ../../PP_ORB
5+
orbital_dir ../../PP_ORB
66

7-
nbands 10
8-
calculation md
9-
esolver_type tddft
7+
nbands 10
8+
calculation md
9+
esolver_type tddft
1010

1111
#Parameter (Accuracy)
12-
ecutwfc 20
13-
scf_nmax 50
12+
ecutwfc 20
13+
scf_nmax 50
1414

15-
ks_solver scalapack_gvx
16-
basis_type lcao
17-
gamma_only 0
18-
md_nstep 2
15+
ks_solver scalapack_gvx
16+
basis_type lcao
17+
gamma_only 0
18+
md_nstep 2
1919

20-
mixing_type broyden
21-
mixing_beta 0.7
22-
mixing_gg0 0.0
23-
scf_thr 1.0e-6
20+
mixing_type broyden
21+
mixing_beta 0.7
22+
mixing_gg0 0.0
23+
scf_thr 1.0e-6
2424

25-
cal_stress 1
26-
stress_thr 1e-6
27-
cal_force 1
28-
force_thr_ev 1.0e-3
25+
cal_stress 1
26+
stress_thr 1e-6
27+
cal_force 1
28+
force_thr_ev 1.0e-3
2929

30-
md_type nve
31-
md_dt 0.05
32-
init_vel 1
33-
ocp 1
34-
ocp_set 4*2 2*1 4*0
30+
md_type nve
31+
md_dt 0.05
32+
init_vel 1
33+
ocp 1
34+
ocp_set 4*2 2*1 4*0
+26-28
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
INPUT_PARAMETERS
2-
#Parameters (General)
3-
suffix autotest
4-
pseudo_dir ../../PP_ORB
5-
orbital_dir ../../PP_ORB
2+
#Parameters (General)
3+
suffix autotest
4+
pseudo_dir ../../PP_ORB
5+
orbital_dir ../../PP_ORB
66

7-
nbands 10
8-
calculation md
9-
esolver_type tddft
7+
nbands 10
8+
calculation md
9+
esolver_type tddft
1010

1111
#Parameter (Accuracy)
12-
ecutwfc 20
13-
scf_nmax 50
12+
ecutwfc 20
13+
scf_nmax 50
1414

15-
#ks_solver lapack
16-
ks_solver scalapack_gvx
17-
basis_type lcao
18-
gamma_only 0
19-
md_nstep 2
15+
ks_solver scalapack_gvx
16+
basis_type lcao
17+
gamma_only 0
18+
md_nstep 2
2019

21-
mixing_type broyden
22-
mixing_beta 0.7
23-
mixing_gg0 0.0
24-
scf_thr 1.0e-6
25-
#out_alllog 1
20+
mixing_type broyden
21+
mixing_beta 0.7
22+
mixing_gg0 0.0
23+
scf_thr 1.0e-6
2624

27-
cal_stress 1
28-
stress_thr 1e-6
29-
cal_force 1
30-
force_thr_ev 1.0e-3
25+
cal_stress 1
26+
stress_thr 1e-6
27+
cal_force 1
28+
force_thr_ev 1.0e-3
3129

32-
md_type nve
33-
md_dt 0.05
34-
init_vel 1
35-
ocp 1
36-
ocp_set 4*2 1*1 1*0 1*1 3*0
30+
md_type nve
31+
md_dt 0.05
32+
init_vel 1
33+
ocp 1
34+
ocp_set 4*2 1*1 1*0 1*1 3*0

0 commit comments

Comments
 (0)