31#include "./base/base_uses.f90"
36 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'gw_ri_rs_small_cell_full_kp'
114 CHARACTER(LEN=*),
PARAMETER :: routinen =
'gw_calc_ri_rs_small_cell_full_kp'
119 CALL timeset(routinen, handle)
121 gwkp_env => bs_env%gwkp_env
136 CALL compute_sigma_c_and_qp(bs_env, gwkp_env)
143 CALL timestop(handle)
153 SUBROUTINE compute_sigma_c_and_qp(bs_env, gwkp_env)
155 TYPE(
gwkp_type),
INTENT(INOUT) :: gwkp_env
157 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_Sigma_c_and_QP'
159 INTEGER :: handle, i_iter, ispin, n_mo, nkp
160 REAL(
dp) :: cbm, e_fermi_scf(2), max_delta, vbm
161 REAL(
dp),
ALLOCATABLE :: eigenvalues_g_next(:, :, :)
163 CALL timeset(routinen, handle)
165 nkp = bs_env%nkp_scf_desymm
166 n_mo = bs_env%n_mo_retained
167 e_fermi_scf = bs_env%e_fermi
168 IF (bs_env%gw_flavour ==
evgw0)
ALLOCATE (eigenvalues_g_next(n_mo, nkp, bs_env%n_spin))
171 DO i_iter = 1, bs_env%evgw0_n_iter
173 CALL compute_qp_energies(bs_env, gwkp_env%sigma_x_bands, &
174 gwkp_env%sigma_c_bands, i_iter)
175 IF (bs_env%evgw0_n_iter == 1)
EXIT
177 IF (i_iter == 1)
CALL print_first_cycle_band_edges(bs_env)
178 CALL eigenvalues_for_evgw0_g(bs_env, eigenvalues_g_next)
179 max_delta = maxval(abs(eigenvalues_g_next - &
180 bs_env%eigenval_evGW0(1:n_mo, 1:nkp, 1:bs_env%n_spin)))
181 IF (bs_env%unit_nr > 0)
WRITE (bs_env%unit_nr,
'(T2,A,I3,A,I3,A,T66,F12.4,A)') &
182 'evGW0 cycle ', i_iter,
' / ', bs_env%evgw0_n_iter, &
183 ' Max G eigenvalue change:', max_delta*
evolt,
' eV'
184 IF (max_delta < bs_env%evgw0_eps_iter)
EXIT
185 IF (i_iter == bs_env%evgw0_n_iter)
THEN
186 IF (bs_env%unit_nr > 0)
WRITE (bs_env%unit_nr,
'(T2,A)') &
187 'evGW0 reached MAX_ITER before eigenvalue convergence.'
191 bs_env%eigenval_evGW0(1:n_mo, 1:nkp, 1:bs_env%n_spin) = eigenvalues_g_next
192 gwkp_env%eigenvalues_G(1:n_mo, 1:nkp, 1:bs_env%n_spin) = eigenvalues_g_next
193 DO ispin = 1, bs_env%n_spin
194 vbm = maxval(eigenvalues_g_next(bs_env%n_occ(ispin), :, ispin))
195 cbm = minval(eigenvalues_g_next(bs_env%n_occ(ispin) + 1, :, ispin))
196 bs_env%e_fermi(ispin) = 0.5_dp*(vbm + cbm)
201 IF (bs_env%gw_flavour ==
evgw0) bs_env%eigenval_evGW0(:, :, :) = bs_env%eigenval_GW
203 bs_env%e_fermi = e_fermi_scf
205 CALL timestop(handle)
207 END SUBROUTINE compute_sigma_c_and_qp
214 SUBROUTINE print_first_cycle_band_edges(bs_env)
217 CHARACTER(LEN=*),
PARAMETER :: routinen =
'print_first_cycle_band_edges'
222 CALL timeset(routinen, handle)
227 WRITE (u,
'(T2,A)')
'G0W0 from the first evGW0 cycle (without SOC):'
228 WRITE (u,
'(T2,A,T61,F20.3)')
'G0W0 valence band maximum (eV):', band_edges%VBM*
evolt
229 WRITE (u,
'(T2,A,T61,F20.3)')
'G0W0 conduction band minimum (eV):', band_edges%CBM*
evolt
230 WRITE (u,
'(T2,A,T61,F20.3)')
'G0W0 indirect band gap (eV):', band_edges%IDBG*
evolt
231 WRITE (u,
'(T2,A,T61,F20.3)')
'G0W0 direct band gap (eV):', band_edges%DBG*
evolt
234 CALL timestop(handle)
236 END SUBROUTINE print_first_cycle_band_edges
247 SUBROUTINE eigenvalues_for_evgw0_g(bs_env, eigenvalues_G_next)
249 REAL(kind=
dp),
INTENT(OUT) :: eigenvalues_g_next(:, :, :)
251 CHARACTER(LEN=*),
PARAMETER :: routinen =
'eigenvalues_for_evGW0_G'
252 REAL(kind=
dp),
PARAMETER :: window_ev = 5.0_dp
254 INTEGER :: handle, iband, ikp, ispin, n_mo, &
256 REAL(kind=
dp) :: cbm_dft, dft_energy, lower_limit, &
257 mean_shift, qp_energy, upper_limit, &
260 CALL timeset(routinen, handle)
262 nkp = bs_env%nkp_scf_desymm
263 n_mo = bs_env%n_mo_retained
264 cpassert(bs_env%nkp_bs_and_DOS >= nkp)
265 cpassert(n_mo > 0 .AND. n_mo <= bs_env%n_ao)
266 cpassert(all(bs_env%n_occ(1:bs_env%n_spin) > 0))
267 cpassert(all(bs_env%n_occ(1:bs_env%n_spin) < n_mo))
268 DO ispin = 1, bs_env%n_spin
269 nocc = bs_env%n_occ(ispin)
270 vbm_dft = maxval(bs_env%eigenval_scf(nocc, 1:nkp, ispin))
271 cbm_dft = minval(bs_env%eigenval_scf(nocc + 1, 1:nkp, ispin))
272 lower_limit = vbm_dft - window_ev/
evolt
273 upper_limit = cbm_dft + window_ev/
evolt
278 dft_energy = bs_env%eigenval_scf(iband, ikp, ispin)
279 IF (dft_energy < lower_limit) cycle
280 qp_energy = bs_env%eigenval_GW(iband, ikp, ispin)
281 eigenvalues_g_next(iband, ikp, ispin) = qp_energy
282 mean_shift = mean_shift + qp_energy - dft_energy
283 n_window = n_window + 1
285 IF (n_window > 0)
THEN
286 mean_shift = mean_shift/real(n_window, kind=
dp)
288 mean_shift = bs_env%eigenval_GW(nocc, ikp, ispin) - &
289 bs_env%eigenval_scf(nocc, ikp, ispin)
292 dft_energy = bs_env%eigenval_scf(iband, ikp, ispin)
293 IF (dft_energy >= lower_limit) cycle
294 eigenvalues_g_next(iband, ikp, ispin) = dft_energy + mean_shift
299 DO iband = nocc + 1, n_mo
300 dft_energy = bs_env%eigenval_scf(iband, ikp, ispin)
301 IF (dft_energy > upper_limit) cycle
302 qp_energy = bs_env%eigenval_GW(iband, ikp, ispin)
303 eigenvalues_g_next(iband, ikp, ispin) = qp_energy
304 mean_shift = mean_shift + qp_energy - dft_energy
305 n_window = n_window + 1
307 IF (n_window > 0)
THEN
308 mean_shift = mean_shift/real(n_window, kind=
dp)
310 mean_shift = bs_env%eigenval_GW(nocc + 1, ikp, ispin) - &
311 bs_env%eigenval_scf(nocc + 1, ikp, ispin)
313 DO iband = nocc + 1, n_mo
314 dft_energy = bs_env%eigenval_scf(iband, ikp, ispin)
315 IF (dft_energy <= upper_limit) cycle
316 eigenvalues_g_next(iband, ikp, ispin) = dft_energy + mean_shift
321 CALL timestop(handle)
323 END SUBROUTINE eigenvalues_for_evgw0_g
332 SUBROUTINE compute_qp_energies(bs_env, sigma_x_bands, sigma_c_bands, i_iter)
334 REAL(kind=
dp),
INTENT(IN) :: sigma_x_bands(:, :, :), &
335 sigma_c_bands(:, :, :, :, :)
336 INTEGER,
INTENT(IN) :: i_iter
338 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_QP_energies'
340 COMPLEX(KIND=dp),
ALLOCATABLE :: sigma_c_ikp_n_freq(:, :)
341 INTEGER :: handle, ikp, ispin
342 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: sigma_x_ikp_n
343 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: sigma_c_ikp_n_time
345 CALL timeset(routinen, handle)
346 cpassert(
SIZE(sigma_x_bands, 1) == bs_env%n_ao)
347 cpassert(
SIZE(sigma_x_bands, 2) == bs_env%nkp_bs_and_DOS)
348 cpassert(
SIZE(sigma_x_bands, 3) == bs_env%n_spin)
349 cpassert(
SIZE(sigma_c_bands, 1) == bs_env%n_ao)
350 cpassert(
SIZE(sigma_c_bands, 2) == bs_env%nkp_bs_and_DOS)
351 cpassert(
SIZE(sigma_c_bands, 3) == bs_env%num_time_freq_points)
352 cpassert(
SIZE(sigma_c_bands, 4) == 2)
353 cpassert(
SIZE(sigma_c_bands, 5) == bs_env%n_spin)
355 ALLOCATE (sigma_x_ikp_n(bs_env%n_ao))
356 ALLOCATE (sigma_c_ikp_n_time(bs_env%n_ao, bs_env%num_time_freq_points, 2))
357 ALLOCATE (sigma_c_ikp_n_freq(bs_env%n_ao, bs_env%num_freq_points_fit))
359 DO ispin = 1, bs_env%n_spin
361 DO ikp = 1, bs_env%nkp_bs_and_DOS
364 sigma_x_ikp_n(:) = sigma_x_bands(:, ikp, ispin)
365 sigma_c_ikp_n_time(:, :, :) = sigma_c_bands(:, ikp, :, :, ispin)
369 sigma_c_ikp_n_freq(1:bs_env%n_occ(ispin), :) = conjg(sigma_c_ikp_n_freq(1:bs_env%n_occ(ispin), :))
374 sigma_c_ikp_n_freq, &
376 bs_env%v_xc_n(:, ikp, ispin), &
377 bs_env%eigenval_scf(:, ikp, ispin), ikp, ispin, i_iter)
383 CALL timestop(handle)
385 END SUBROUTINE compute_qp_energies
Work data of periodic RI-RS GW with full k-point sampling.
Green functions, screening and self-energy for periodic RI-RS GW.
subroutine, public release_gw_work(bs_env)
Release all periodic RI-RS work data after the last quasiparticle iteration.
subroutine, public compute_w0(qs_env, bs_env, gwkp_env)
Compute ε, Wᶜ and its imaginary-time transform, Eqs. (7)-(8).
subroutine, public prepare_ri_rs(bs_env, gwkp_env)
Prepare RI-RS radial data, grid values, and Bloch orbitals.
subroutine, public compute_g_and_chi(qs_env, bs_env, gwkp_env)
Form the grid Green functions and RI polarizability.
subroutine, public compute_sigma_c_from_w_pq(bs_env, gwkp_env)
Form Σc with one owner per ordered (l,l') pair through both lattice FFTs.
subroutine, public compute_sigma_x(bs_env, gwkp_env)
Evaluate exchange and prepare band orbitals for correlation.
Fully periodic small-cell GW using RI-RS and explicit full k-point sampling.
subroutine, public gw_calc_ri_rs_small_cell_full_kp(qs_env, bs_env)
Periodic RI-RS GW from the converged SCF orbitals and eigenvalues.
subroutine, public de_init_bs_env(qs_env, bs_env)
Releases the memory-heavy GW intermediates that cannot be freed in bs_env_release,...
subroutine, public analyt_conti_and_print(bs_env, sigma_c_ikp_n_freq, sigma_x_ikp_n, v_xc_ikp_n, eigenval_scf, ikp, ispin, i_iter)
...
Defines the basic variable types.
integer, parameter, public dp
Definition of physical constants:
real(kind=dp), parameter, public evolt
subroutine, public get_all_vbm_cbm_bandgaps(bs_env)
...
subroutine, public get_vbm_cbm_bandgaps(band_edges, ev, bs_env)
...
Definition and construction of time/frequency grids for correlation methods.
subroutine, public transform_time_to_frequency(grid, samples_tau, values_omega)
Transform real positive/negative-time samples to complex positive-frequency values....