@@ -16,14 +16,16 @@ high_symmetry = let
16
16
Atom (:O , [x, y, y]u " bohr" , magnetic_moment= 0 ),
17
17
]
18
18
system = periodic_system (atoms, lattice)
19
- merge (DFTK. parse_system (system), (; temperature= 0.03 , Ecut= 10 , kgrid= [4 ,4 ,4 ],
20
- n_electrons= 45 ))
19
+ merge (DFTK. parse_system (system), (; temperature= 0.03 , Ecut= 20 , kgrid= [4 ,4 ,4 ],
20
+ n_electrons= 45 , description = " high_sym " ))
21
21
end
22
- high_kpoints = merge (magnesium, (; kgrid= [13 ,13 ,13 ], Ecut= 10 ))
23
- high_Ecut = merge (magnesium, (; kgrid= [4 ,4 ,4 ], Ecut= 60 ))
22
+ high_kpoints = merge (magnesium, (; kgrid= [13 ,13 ,13 ], Ecut= 20 , description= " high_kpoint" ))
23
+ high_Ecut = merge (magnesium, (; kgrid= [4 ,4 ,4 ], Ecut= 60 , description= " high_Ecut" ))
24
+
24
25
testcases = (; high_symmetry, high_kpoints, high_Ecut)
25
26
end
26
27
28
+
27
29
@testitem " Hamiltonian application" tags= [:regression ] setup= [TestCases, Regression] begin
28
30
using DFTK
29
31
using LinearAlgebra
46
48
47
49
(; ham) = energy_hamiltonian (basis, ψ, occupation)
48
50
49
- SUITE[" ham" ] = BenchmarkGroup ()
50
- SUITE[ " ham " ] = @benchmarkable for ik = 1 : length ($ (basis. kpoints))
51
- $ (ham. blocks)[ik]* $ ψ[ik]
52
- end
51
+ SUITE[" ham" ][testcase . description] =
52
+ @benchmarkable for ik = 1 : length ($ (basis. kpoints))
53
+ $ (ham. blocks)[ik]* $ ψ[ik]
54
+ end
53
55
end
54
56
end
55
57
62
64
model = model_LDA (testcase. lattice, testcase. atoms, testcase. positions;
63
65
testcase. temperature)
64
66
basis = PlaneWaveBasis (model; testcase. Ecut, testcase. kgrid)
65
- SUITE[" scf" ] = BenchmarkGroup ()
66
- SUITE[ " scf " ] = @benchmarkable self_consistent_field ($ basis; tol= 1e5 )
67
+ SUITE[" scf" ][testcase . description] =
68
+ @benchmarkable self_consistent_field ($ basis; tol= 1e5 )
67
69
end
68
70
end
69
71
81
83
ψ, occupation = DFTK. select_occupied_orbitals (basis, scfres. ψ, scfres. occupation;
82
84
threshold= 1e-6 )
83
85
84
- SUITE[" density" , " ρ" , " sym" ] = BenchmarkGroup ()
85
- SUITE[" density" , " ρ" ] = @benchmarkable compute_density ($ basis, $ ψ, $ occupation)
86
- SUITE[" density" , " sym" ] = @benchmarkable DFTK. symmetrize_ρ ($ basis, $ (scfres. ρ))
86
+ SUITE[" density" ][" ρ" ][testcase. description] =
87
+ @benchmarkable compute_density ($ basis, $ ψ, $ occupation)
88
+ SUITE[" density" ][" sym" ][testcase. description] =
89
+ @benchmarkable DFTK. symmetrize_ρ ($ basis, $ (scfres. ρ))
87
90
end
88
91
end
89
92
95
98
for testcase in Regression. testcases
96
99
model = model_LDA (testcase. lattice, testcase. atoms, testcase. positions;
97
100
testcase. temperature)
98
- SUITE[" basis" ] = BenchmarkGroup ()
99
- SUITE[ " basis " ] = @benchmarkable PlaneWaveBasis ($ model; Ecut = $ (testcase . Ecut),
100
- kgrid= $ (testcase. kgrid))
101
+ SUITE[" basis" ][testcase . description] =
102
+ @benchmarkable PlaneWaveBasis ($ model;
103
+ Ecut = $ (testcase . Ecut), kgrid= $ (testcase. kgrid))
101
104
end
102
105
end
103
106
113
116
scfres = self_consistent_field (basis; tol= 10 )
114
117
115
118
rhs = DFTK. compute_projected_gradient (basis, scfres. ψ, scfres. occupation)
116
- SUITE[" sternheimer" ] = BenchmarkGroup ()
117
- SUITE[ " sternheimer " ] = @benchmarkable DFTK. solve_ΩplusK_split ($ scfres, $ rhs)
119
+ SUITE[" response " ][ " sternheimer" ][testcase . description] =
120
+ @benchmarkable DFTK. solve_ΩplusK_split ($ scfres, $ rhs; tol = 1e-2 )
118
121
end
119
122
end
120
123
@@ -146,11 +149,10 @@ end
146
149
end
147
150
148
151
# Function to compute the dipole for a given field strength
149
- function compute_dipole (ε; tol= 1e-8 , kwargs... )
152
+ function compute_dipole (ε; tol= 1e-2 , kwargs... )
150
153
scfres = self_consistent_field (make_basis (ε; kwargs... ); tol)
151
154
dipole (scfres. basis, scfres. ρ)
152
155
end
153
156
154
- SUITE[" response" , " ad" ] = BenchmarkGroup ()
155
- SUITE[" response" , " ad" ] = @benchmarkable ForwardDiff. derivative ($ compute_dipole, 0.0 )
157
+ SUITE[" response" ][" ad" ] = @benchmarkable ForwardDiff. derivative ($ compute_dipole, 0.0 )
156
158
end
0 commit comments