From 20f799052003bc3b0bc15c68cda31fc32296811e Mon Sep 17 00:00:00 2001 From: JWilhelm Date: Sat, 15 Feb 2025 14:11:06 +0100 Subject: [PATCH] =?UTF-8?q?Defining=20fitting=20range=20=CF=89=20in=20[0,?= =?UTF-8?q?=20=CF=89=5Fmax]=20for=20analytical=20continuation=20=CE=A3(i?= =?UTF-8?q?=CF=89)=20->=20=CE=A3(=CF=89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gw_utils.F | 49 ++++++------------- src/input_cp2k_properties_dft.F | 19 ++++--- src/post_scf_bandstructure_types.F | 3 +- src/post_scf_bandstructure_utils.F | 17 +++---- tests/QS/regtest-rtbse/h2_delta.inp | 1 + tests/QS/regtest-rtbse/h2_delta_cont.inp | 1 + tests/QS/regtest-rtbse/h2_ft.inp | 1 + tests/QS/regtest-rtbse/h2_rt.inp | 1 + tests/QS/regtest-rtbse/h2_rt_cont.inp | 1 + .../G0W0_periodic_H2.inp | 1 + .../G0W0_periodic_H2.inp | 1 + .../G0W0_periodic_H2.inp | 1 + .../01_G0W0_periodic_H2O.inp | 1 + .../02_G0W0_IH_SOC_LDOS.inp | 1 + .../03_G0W0_bandstructure_IH_chain.inp | 1 + ...0_SOC_TeH_chain_open_shell_kp_extrapol.inp | 1 + .../05_G0W0_SOC_TeH_chain_open_shell.inp | 1 + .../06_G0W0_periodic_H2O_Hedin_shift.inp | 1 + .../07_G0W0_periodic_H2Te_kp_sampling_SCF.inp | 1 + ...Te_kp_sampling_SCF_FREQ_MAX_FIT_10_eV.inp} | 2 +- tests/QS/regtest-scalable-gw/TEST_FILES | 24 ++++----- 21 files changed, 62 insertions(+), 67 deletions(-) rename tests/QS/regtest-scalable-gw/{08_G0W0_periodic_H2Te_kp_sampling_SCF_minimax_2.inp => 08_G0W0_periodic_H2Te_kp_sampling_SCF_FREQ_MAX_FIT_10_eV.inp} (98%) diff --git a/src/gw_utils.F b/src/gw_utils.F index aed0ac743a..2473611675 100644 --- a/src/gw_utils.F +++ b/src/gw_utils.F @@ -286,7 +286,7 @@ CONTAINS CALL section_vals_val_get(gw_sec, "SIZE_LATTICE_SUM", i_val=bs_env%size_lattice_sum_V) CALL section_vals_val_get(gw_sec, "KPOINTS_W", i_vals=bs_env%nkp_grid_chi_eps_W_input) CALL section_vals_val_get(gw_sec, "HEDIN_SHIFT", l_val=bs_env%do_hedin_shift) - CALL section_vals_val_get(gw_sec, "MINIMAX_VERSION", i_val=bs_env%minimax_version) + CALL section_vals_val_get(gw_sec, "FREQ_MAX_FIT", r_val=bs_env%freq_max_fit) CALL timestop(handle) @@ -1511,26 +1511,15 @@ CONTAINS ! for periodic systems and for 20 minimax points, we use a regularized minimax mesh ! (from experience: regularized minimax meshes converges faster for periodic systems ! and for 20 pts) - SELECT CASE (bs_env%minimax_version) - CASE (1) - IF (SUM(bs_env%periodic) .NE. 0 .OR. bs_env%num_time_freq_points >= 20) THEN - bs_env%regularization_minimax = 1.0E-6_dp - ELSE - bs_env%regularization_minimax = 0.0_dp - END IF - CASE (2) - bs_env%regularization_minimax = 1.0E-5_dp - CASE DEFAULT - CPABORT("Only minimax regularization version 1 and 2 available.") - END SELECT + IF (SUM(bs_env%periodic) .NE. 0 .OR. bs_env%num_time_freq_points >= 20) THEN + bs_env%regularization_minimax = 1.0E-6_dp + ELSE + bs_env%regularization_minimax = 0.0_dp + END IF bs_env%stabilize_exp = 70.0_dp bs_env%eps_atom_grid_2d_mat = 1.0E-50_dp - ! only use interval ω in [0, 1 Ha] (1 Hartree = 27.211 eV) for virt, and ω in [-1 Ha, 0] - ! for occ for use in analytic continuation of self-energy Σ^c_n(iω,k) -> Σ^c_n(ϵ,k) - bs_env%freq_max_fit = 1.0_dp - ! use a 16-parameter Padé fit bs_env%nparam_pade = 16 @@ -1598,23 +1587,18 @@ CONTAINS u = bs_env%unit_nr IF (u > 0) THEN - WRITE (u, *) ' ' - WRITE (u, '(T2,2A)') '------------------------------------------------', & - '-------------------------------' - WRITE (u, '(T2,2A)') '- ', & - ' -' - WRITE (u, '(T2,2A)') '- GW CALCULATION ', & - ' -' - WRITE (u, '(T2,2A)') '- ', & - ' -' - WRITE (u, '(T2,2A)') '------------------------------------------------', & - '-------------------------------' + WRITE (u, '(T2,A)') ' ' + WRITE (u, '(T2,A)') REPEAT('-', 79) + WRITE (u, '(T2,A,A78)') '-', '-' + WRITE (u, '(T2,A,A46,A32)') '-', 'GW CALCULATION', '-' + WRITE (u, '(T2,A,A78)') '-', '-' + WRITE (u, '(T2,A)') REPEAT('-', 79) WRITE (u, '(T2,A)') ' ' WRITE (u, '(T2,A,I45)') 'Input: Number of time/freq. points', bs_env%num_time_freq_points - WRITE (u, FMT="(T2,A,I59)") 'Minimax grid version', bs_env%minimax_version + WRITE (u, "(T2,A,F44.1,A)") 'Input: ω_max for fitting Σ(iω) (eV)', bs_env%freq_max_fit*evolt WRITE (u, '(T2,A,ES27.1)') 'Input: Filter threshold for sparse tensor operations', & bs_env%eps_filter - WRITE (u, FMT="(T2,A,L62)") 'Apply Hedin shift', bs_env%do_hedin_shift + WRITE (u, "(T2,A,L55)") 'Input: Apply Hedin shift', bs_env%do_hedin_shift END IF CALL timestop(handle) @@ -1805,11 +1789,6 @@ CONTAINS E_max = MAX(E_max, E_max_ispin) END DO - IF (bs_env%minimax_version == 2) THEN - E_min = MAX(E_min - 0.5_dp/evolt, 0.3_dp/evolt) - E_max = 2*E_max - END IF - E_range = E_max/E_min ALLOCATE (points_and_weights(2*num_time_freq_points)) diff --git a/src/input_cp2k_properties_dft.F b/src/input_cp2k_properties_dft.F index 9e7edbdae7..c0a17eaee8 100644 --- a/src/input_cp2k_properties_dft.F +++ b/src/input_cp2k_properties_dft.F @@ -2190,12 +2190,19 @@ CONTAINS CALL section_add_keyword(section, keyword) CALL keyword_release(keyword) - CALL keyword_create(keyword, __LOCATION__, name="MINIMAX_VERSION", & - description="Version of the minimax time and frequency grid "// & - "for Fourier transforms χ(iτ) -> χ(iω) -> W(iω) -> W(iτ) -> "// & - "Σ(iτ) -> Σ(iω). At present, version 1 and 2 is available.", & - usage="MINIMAX_VERSION 2", & - default_i_val=1) + CALL keyword_create(keyword, __LOCATION__, name="FREQ_MAX_FIT", & + description="Determines fitting range for the self-energy Σ(iω) on "// & + "imaginary axis: i*[0, ω_max] for empty orbitals/bands, i*[-ω_max,0] "// & + "for occ orbitals. A smaller ω_max might lead to better numerical "// & + "stability (i.e., if you observe clearly wrong GW eigenvalues/bands "// & + "around HOMO/LUMO, decreasing ω_max might fix this issue). "// & + "A small benchmark of ω_max is contained in Fig. 5 of "// & + "J. Wilhelm et al., JCTC 12, 3623-3635 (2016). "// & + "Note that we used ω_max = 1 Ha = 27.211 eV in the benchmark "// & + "M. Azizi et al., PRB 109, 245101 (2024).", & + unit_str="eV", & + usage="FREQ_MAX_FIT 20.0", & + default_r_val=cp_unit_to_cp2k(value=10.0_dp, unit_str="eV")) CALL section_add_keyword(section, keyword) CALL keyword_release(keyword) diff --git a/src/post_scf_bandstructure_types.F b/src/post_scf_bandstructure_types.F index 0e9f575a0f..f25cb0db18 100644 --- a/src/post_scf_bandstructure_types.F +++ b/src/post_scf_bandstructure_types.F @@ -128,8 +128,7 @@ MODULE post_scf_bandstructure_types ! imaginary time and frequency grids INTEGER :: num_time_freq_points = -1, & - num_freq_points_fit = -1, & - minimax_version = -1 + num_freq_points_fit = -1 REAL(KIND=dp), DIMENSION(:), ALLOCATABLE :: imag_time_points, & imag_time_weights_freq_zero, & imag_freq_points, & diff --git a/src/post_scf_bandstructure_utils.F b/src/post_scf_bandstructure_utils.F index ce0f879a43..b6c2db6c36 100644 --- a/src/post_scf_bandstructure_utils.F +++ b/src/post_scf_bandstructure_utils.F @@ -254,17 +254,12 @@ CONTAINS u = bs_env%unit_nr IF (u > 0) THEN - WRITE (u, *) ' ' - WRITE (u, '(T2,2A)') '-------------------------------------------------', & - '------------------------------' - WRITE (u, '(T2,2A)') '- ', & - ' -' - WRITE (u, '(T2,2A)') '- BANDSTRUCTURE CALCULATION', & - ' -' - WRITE (u, '(T2,2A)') '- ', & - ' -' - WRITE (u, '(T2,2A)') '--------------------------------------------------', & - '-----------------------------' + WRITE (u, '(T2,A)') ' ' + WRITE (u, '(T2,A)') REPEAT('-', 79) + WRITE (u, '(T2,A,A78)') '-', '-' + WRITE (u, '(T2,A,A51,A27)') '-', 'BANDSTRUCTURE CALCULATION', '-' + WRITE (u, '(T2,A,A78)') '-', '-' + WRITE (u, '(T2,A)') REPEAT('-', 79) WRITE (u, '(T2,A)') ' ' END IF diff --git a/tests/QS/regtest-rtbse/h2_delta.inp b/tests/QS/regtest-rtbse/h2_delta.inp index 5b27300de3..66bb51f8a0 100644 --- a/tests/QS/regtest-rtbse/h2_delta.inp +++ b/tests/QS/regtest-rtbse/h2_delta.inp @@ -75,6 +75,7 @@ &PROPERTIES &BANDSTRUCTURE &GW + FREQ_MAX_FIT 27.211 ! Simplest setting for quick checks NUM_TIME_FREQ_POINTS 20 &END GW diff --git a/tests/QS/regtest-rtbse/h2_delta_cont.inp b/tests/QS/regtest-rtbse/h2_delta_cont.inp index 244413b0a5..c4d4841740 100644 --- a/tests/QS/regtest-rtbse/h2_delta_cont.inp +++ b/tests/QS/regtest-rtbse/h2_delta_cont.inp @@ -75,6 +75,7 @@ &PROPERTIES &BANDSTRUCTURE &GW + FREQ_MAX_FIT 27.211 ! Simplest setting for quick checks NUM_TIME_FREQ_POINTS 20 &END GW diff --git a/tests/QS/regtest-rtbse/h2_ft.inp b/tests/QS/regtest-rtbse/h2_ft.inp index 0d580aedbb..058bdfab35 100644 --- a/tests/QS/regtest-rtbse/h2_ft.inp +++ b/tests/QS/regtest-rtbse/h2_ft.inp @@ -76,6 +76,7 @@ &PROPERTIES &BANDSTRUCTURE &GW + FREQ_MAX_FIT 27.211 ! Simplest setting for quick checks NUM_TIME_FREQ_POINTS 20 &END GW diff --git a/tests/QS/regtest-rtbse/h2_rt.inp b/tests/QS/regtest-rtbse/h2_rt.inp index 94afe9ca60..759c1d1e04 100644 --- a/tests/QS/regtest-rtbse/h2_rt.inp +++ b/tests/QS/regtest-rtbse/h2_rt.inp @@ -83,6 +83,7 @@ &PROPERTIES &BANDSTRUCTURE &GW + FREQ_MAX_FIT 27.211 ! Simplest setting for quick checks NUM_TIME_FREQ_POINTS 20 &END GW diff --git a/tests/QS/regtest-rtbse/h2_rt_cont.inp b/tests/QS/regtest-rtbse/h2_rt_cont.inp index 8eb5d13dd0..e94287bbdf 100644 --- a/tests/QS/regtest-rtbse/h2_rt_cont.inp +++ b/tests/QS/regtest-rtbse/h2_rt_cont.inp @@ -83,6 +83,7 @@ &PROPERTIES &BANDSTRUCTURE &GW + FREQ_MAX_FIT 27.211 ! Simplest setting for quick checks NUM_TIME_FREQ_POINTS 20 &END GW diff --git a/tests/QS/regtest-scalable-gw-restart-1/G0W0_periodic_H2.inp b/tests/QS/regtest-scalable-gw-restart-1/G0W0_periodic_H2.inp index 958bcbef57..7f8e6cde8f 100644 --- a/tests/QS/regtest-scalable-gw-restart-1/G0W0_periodic_H2.inp +++ b/tests/QS/regtest-scalable-gw-restart-1/G0W0_periodic_H2.inp @@ -36,6 +36,7 @@ &PROPERTIES &BANDSTRUCTURE &GW + FREQ_MAX_FIT 27.211 NUM_TIME_FREQ_POINTS 6 &END GW &END BANDSTRUCTURE diff --git a/tests/QS/regtest-scalable-gw-restart-2/G0W0_periodic_H2.inp b/tests/QS/regtest-scalable-gw-restart-2/G0W0_periodic_H2.inp index 958bcbef57..7f8e6cde8f 100644 --- a/tests/QS/regtest-scalable-gw-restart-2/G0W0_periodic_H2.inp +++ b/tests/QS/regtest-scalable-gw-restart-2/G0W0_periodic_H2.inp @@ -36,6 +36,7 @@ &PROPERTIES &BANDSTRUCTURE &GW + FREQ_MAX_FIT 27.211 NUM_TIME_FREQ_POINTS 6 &END GW &END BANDSTRUCTURE diff --git a/tests/QS/regtest-scalable-gw-restart-3/G0W0_periodic_H2.inp b/tests/QS/regtest-scalable-gw-restart-3/G0W0_periodic_H2.inp index c3dc43ff63..cdc395a3c2 100644 --- a/tests/QS/regtest-scalable-gw-restart-3/G0W0_periodic_H2.inp +++ b/tests/QS/regtest-scalable-gw-restart-3/G0W0_periodic_H2.inp @@ -36,6 +36,7 @@ &PROPERTIES &BANDSTRUCTURE &GW + FREQ_MAX_FIT 27.211 NUM_TIME_FREQ_POINTS 6 &END GW &END BANDSTRUCTURE diff --git a/tests/QS/regtest-scalable-gw/01_G0W0_periodic_H2O.inp b/tests/QS/regtest-scalable-gw/01_G0W0_periodic_H2O.inp index 02cd8723e3..87842f525b 100644 --- a/tests/QS/regtest-scalable-gw/01_G0W0_periodic_H2O.inp +++ b/tests/QS/regtest-scalable-gw/01_G0W0_periodic_H2O.inp @@ -40,6 +40,7 @@ KPOINTS 1 2 2 &END DOS &GW + FREQ_MAX_FIT 27.211 HEDIN_SHIFT FALSE NUM_TIME_FREQ_POINTS 6 &END GW diff --git a/tests/QS/regtest-scalable-gw/02_G0W0_IH_SOC_LDOS.inp b/tests/QS/regtest-scalable-gw/02_G0W0_IH_SOC_LDOS.inp index d58b53ff3e..028f9d1b64 100644 --- a/tests/QS/regtest-scalable-gw/02_G0W0_IH_SOC_LDOS.inp +++ b/tests/QS/regtest-scalable-gw/02_G0W0_IH_SOC_LDOS.inp @@ -48,6 +48,7 @@ &END DOS &GW EPS_FILTER 1.0E-6 + FREQ_MAX_FIT 27.211 HEDIN_SHIFT FALSE NUM_TIME_FREQ_POINTS 10 &END GW diff --git a/tests/QS/regtest-scalable-gw/03_G0W0_bandstructure_IH_chain.inp b/tests/QS/regtest-scalable-gw/03_G0W0_bandstructure_IH_chain.inp index 75f09dcdaf..6fb65f9e50 100644 --- a/tests/QS/regtest-scalable-gw/03_G0W0_bandstructure_IH_chain.inp +++ b/tests/QS/regtest-scalable-gw/03_G0W0_bandstructure_IH_chain.inp @@ -50,6 +50,7 @@ &END BANDSTRUCTURE_PATH &GW EPS_FILTER 1.0E-5 + FREQ_MAX_FIT 27.211 HEDIN_SHIFT FALSE NUM_TIME_FREQ_POINTS 10 &END GW diff --git a/tests/QS/regtest-scalable-gw/04_G0W0_SOC_TeH_chain_open_shell_kp_extrapol.inp b/tests/QS/regtest-scalable-gw/04_G0W0_SOC_TeH_chain_open_shell_kp_extrapol.inp index 1946c2b542..eb19d6e95a 100644 --- a/tests/QS/regtest-scalable-gw/04_G0W0_SOC_TeH_chain_open_shell_kp_extrapol.inp +++ b/tests/QS/regtest-scalable-gw/04_G0W0_SOC_TeH_chain_open_shell_kp_extrapol.inp @@ -41,6 +41,7 @@ &GW APPROX_KP_EXTRAPOL EPS_FILTER 1.0E-6 + FREQ_MAX_FIT 27.211 HEDIN_SHIFT FALSE NUM_TIME_FREQ_POINTS 10 &END GW diff --git a/tests/QS/regtest-scalable-gw/05_G0W0_SOC_TeH_chain_open_shell.inp b/tests/QS/regtest-scalable-gw/05_G0W0_SOC_TeH_chain_open_shell.inp index 6c0f74e50c..b60aecaa3f 100644 --- a/tests/QS/regtest-scalable-gw/05_G0W0_SOC_TeH_chain_open_shell.inp +++ b/tests/QS/regtest-scalable-gw/05_G0W0_SOC_TeH_chain_open_shell.inp @@ -40,6 +40,7 @@ &BANDSTRUCTURE &GW EPS_FILTER 1.0E-6 + FREQ_MAX_FIT 27.211 HEDIN_SHIFT FALSE NUM_TIME_FREQ_POINTS 10 &END GW diff --git a/tests/QS/regtest-scalable-gw/06_G0W0_periodic_H2O_Hedin_shift.inp b/tests/QS/regtest-scalable-gw/06_G0W0_periodic_H2O_Hedin_shift.inp index 8a80cf852f..2ee61a6c82 100644 --- a/tests/QS/regtest-scalable-gw/06_G0W0_periodic_H2O_Hedin_shift.inp +++ b/tests/QS/regtest-scalable-gw/06_G0W0_periodic_H2O_Hedin_shift.inp @@ -40,6 +40,7 @@ KPOINTS 1 2 2 &END DOS &GW + FREQ_MAX_FIT 27.211 HEDIN_SHIFT NUM_TIME_FREQ_POINTS 6 &END GW diff --git a/tests/QS/regtest-scalable-gw/07_G0W0_periodic_H2Te_kp_sampling_SCF.inp b/tests/QS/regtest-scalable-gw/07_G0W0_periodic_H2Te_kp_sampling_SCF.inp index 508381d833..d5a686711a 100644 --- a/tests/QS/regtest-scalable-gw/07_G0W0_periodic_H2Te_kp_sampling_SCF.inp +++ b/tests/QS/regtest-scalable-gw/07_G0W0_periodic_H2Te_kp_sampling_SCF.inp @@ -46,6 +46,7 @@ &END DOS &GW EPS_FILTER 1.0E-5 + FREQ_MAX_FIT 27.211 NUM_TIME_FREQ_POINTS 6 &END GW &SOC diff --git a/tests/QS/regtest-scalable-gw/08_G0W0_periodic_H2Te_kp_sampling_SCF_minimax_2.inp b/tests/QS/regtest-scalable-gw/08_G0W0_periodic_H2Te_kp_sampling_SCF_FREQ_MAX_FIT_10_eV.inp similarity index 98% rename from tests/QS/regtest-scalable-gw/08_G0W0_periodic_H2Te_kp_sampling_SCF_minimax_2.inp rename to tests/QS/regtest-scalable-gw/08_G0W0_periodic_H2Te_kp_sampling_SCF_FREQ_MAX_FIT_10_eV.inp index a8bb4aa44d..d5964a135b 100644 --- a/tests/QS/regtest-scalable-gw/08_G0W0_periodic_H2Te_kp_sampling_SCF_minimax_2.inp +++ b/tests/QS/regtest-scalable-gw/08_G0W0_periodic_H2Te_kp_sampling_SCF_FREQ_MAX_FIT_10_eV.inp @@ -46,7 +46,7 @@ &END DOS &GW EPS_FILTER 1.0E-5 - MINIMAX_VERSION 2 + FREQ_MAX_FIT 10.0 NUM_TIME_FREQ_POINTS 6 &END GW &SOC diff --git a/tests/QS/regtest-scalable-gw/TEST_FILES b/tests/QS/regtest-scalable-gw/TEST_FILES index 6be2661152..21f658bb47 100644 --- a/tests/QS/regtest-scalable-gw/TEST_FILES +++ b/tests/QS/regtest-scalable-gw/TEST_FILES @@ -1,13 +1,13 @@ -01_G0W0_periodic_H2O.inp 106 1e-03 9.861 -02_G0W0_IH_SOC_LDOS.inp 106 1e-03 17.826 -02_G0W0_IH_SOC_LDOS.inp 107 1e-03 11.344 -03_G0W0_bandstructure_IH_chain.inp 106 5e-04 21.962 -03_G0W0_bandstructure_IH_chain.inp 108 5e-04 21.678 -04_G0W0_SOC_TeH_chain_open_shell_kp_extrapol.inp 106 1e-03 5.174 -05_G0W0_SOC_TeH_chain_open_shell.inp 106 5e-04 5.178 -05_G0W0_SOC_TeH_chain_open_shell.inp 107 5e-04 0.306 -05_G0W0_SOC_TeH_chain_open_shell.inp 108 5e-04 5.134 -06_G0W0_periodic_H2O_Hedin_shift.inp 106 1e-03 10.417 -07_G0W0_periodic_H2Te_kp_sampling_SCF.inp 108 5e-04 10.315 -08_G0W0_periodic_H2Te_kp_sampling_SCF_minimax_2.inp 108 5e-04 10.318 +01_G0W0_periodic_H2O.inp 106 1e-03 9.861 +02_G0W0_IH_SOC_LDOS.inp 106 1e-03 17.826 +02_G0W0_IH_SOC_LDOS.inp 107 1e-03 11.344 +03_G0W0_bandstructure_IH_chain.inp 106 5e-04 21.962 +03_G0W0_bandstructure_IH_chain.inp 108 5e-04 21.678 +04_G0W0_SOC_TeH_chain_open_shell_kp_extrapol.inp 106 1e-03 5.174 +05_G0W0_SOC_TeH_chain_open_shell.inp 106 5e-04 5.178 +05_G0W0_SOC_TeH_chain_open_shell.inp 107 5e-04 0.306 +05_G0W0_SOC_TeH_chain_open_shell.inp 108 5e-04 5.134 +06_G0W0_periodic_H2O_Hedin_shift.inp 106 1e-03 10.417 +07_G0W0_periodic_H2Te_kp_sampling_SCF.inp 108 5e-04 10.315 +08_G0W0_periodic_H2Te_kp_sampling_SCF_FREQ_MAX_FIT_10_eV.inp 108 5e-04 10.780 #EOF