@@ -16,14 +16,16 @@ high_symmetry = let
1616 Atom (:O , [x, y, y]u " bohr" , magnetic_moment= 0 ),
1717 ]
1818 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 " ))
2121end
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+
2425testcases = (; high_symmetry, high_kpoints, high_Ecut)
2526end
2627
28+
2729@testitem " Hamiltonian application" tags= [:regression ] setup= [TestCases, Regression] begin
2830 using DFTK
2931 using LinearAlgebra
4648
4749 (; ham) = energy_hamiltonian (basis, ψ, occupation)
4850
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
5355 end
5456end
5557
6264 model = model_LDA (testcase. lattice, testcase. atoms, testcase. positions;
6365 testcase. temperature)
6466 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 )
6769 end
6870end
6971
8183 ψ, occupation = DFTK. select_occupied_orbitals (basis, scfres. ψ, scfres. occupation;
8284 threshold= 1e-6 )
8385
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. ρ))
8790 end
8891end
8992
9598 for testcase in Regression. testcases
9699 model = model_LDA (testcase. lattice, testcase. atoms, testcase. positions;
97100 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))
101104 end
102105end
103106
113116 scfres = self_consistent_field (basis; tol= 10 )
114117
115118 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-1 )
118121 end
119122end
120123
@@ -146,11 +149,10 @@ end
146149 end
147150
148151 # 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... )
150153 scfres = self_consistent_field (make_basis (ε; kwargs... ); tol)
151154 dipole (scfres. basis, scfres. ρ)
152155 end
153156
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 )
156158end
0 commit comments