From b0259176ecd3425dd931caf2a3ec7271d03effe6 Mon Sep 17 00:00:00 2001 From: JWilhelm Date: Fri, 14 Feb 2025 17:37:39 +0100 Subject: [PATCH] second version of minimax grids is now available; might be numerically more stable than first version --- src/gw_utils.F | 26 ++++-- src/input_cp2k_properties_dft.F | 9 +++ src/post_scf_bandstructure_types.F | 3 +- ...eriodic_H2Te_kp_sampling_SCF_minimax_2.inp | 81 +++++++++++++++++++ tests/QS/regtest-scalable-gw/TEST_FILES | 1 + 5 files changed, 113 insertions(+), 7 deletions(-) create mode 100644 tests/QS/regtest-scalable-gw/08_G0W0_periodic_H2Te_kp_sampling_SCF_minimax_2.inp diff --git a/src/gw_utils.F b/src/gw_utils.F index eac288adb8..aed0ac743a 100644 --- a/src/gw_utils.F +++ b/src/gw_utils.F @@ -286,6 +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 timestop(handle) @@ -1510,11 +1511,18 @@ 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) - 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 + 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 bs_env%stabilize_exp = 70.0_dp bs_env%eps_atom_grid_2d_mat = 1.0E-50_dp @@ -1603,9 +1611,10 @@ CONTAINS '-------------------------------' 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,ES27.1)') 'Input: Filter threshold for sparse tensor operations', & bs_env%eps_filter - WRITE (bs_env%unit_nr, FMT="(T2,A,L62)") "Apply Hedin shift", bs_env%do_hedin_shift + WRITE (u, FMT="(T2,A,L62)") 'Apply Hedin shift', bs_env%do_hedin_shift END IF CALL timestop(handle) @@ -1796,6 +1805,11 @@ 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 0768ceca92..9e7edbdae7 100644 --- a/src/input_cp2k_properties_dft.F +++ b/src/input_cp2k_properties_dft.F @@ -2190,6 +2190,15 @@ 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 section_add_keyword(section, keyword) + CALL keyword_release(keyword) + NULLIFY (subsection, print_key) CALL section_create(subsection, __LOCATION__, name="PRINT", & description="Printing of GW restarts.", & diff --git a/src/post_scf_bandstructure_types.F b/src/post_scf_bandstructure_types.F index f25cb0db18..0e9f575a0f 100644 --- a/src/post_scf_bandstructure_types.F +++ b/src/post_scf_bandstructure_types.F @@ -128,7 +128,8 @@ MODULE post_scf_bandstructure_types ! imaginary time and frequency grids INTEGER :: num_time_freq_points = -1, & - num_freq_points_fit = -1 + num_freq_points_fit = -1, & + minimax_version = -1 REAL(KIND=dp), DIMENSION(:), ALLOCATABLE :: imag_time_points, & imag_time_weights_freq_zero, & imag_freq_points, & 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_minimax_2.inp new file mode 100644 index 0000000000..a8bb4aa44d --- /dev/null +++ b/tests/QS/regtest-scalable-gw/08_G0W0_periodic_H2Te_kp_sampling_SCF_minimax_2.inp @@ -0,0 +1,81 @@ +&GLOBAL + PRINT_LEVEL SILENT + PROJECT scalable_GW + RUN_TYPE ENERGY + &TIMINGS + THRESHOLD 0.01 + &END TIMINGS +&END GLOBAL + +&FORCE_EVAL + METHOD Quickstep + &DFT + BASIS_SET_FILE_NAME BASIS_MOLOPT + BASIS_SET_FILE_NAME HFX_BASIS + BASIS_SET_FILE_NAME ./REGTEST_BASIS + POTENTIAL_FILE_NAME GTH_SOC_POTENTIALS + SORT_BASIS EXP + &KPOINTS + PARALLEL_GROUP_SIZE -1 + SCHEME MONKHORST-PACK 1 4 4 + &END KPOINTS + &MGRID + CUTOFF 100 + REL_CUTOFF 20 + &END MGRID + &QS + EPS_DEFAULT 1.0E-15 + EPS_PGF_ORB 1.0E-15 + METHOD GPW + &END QS + &SCF + ADDED_MOS -1 + EPS_SCF 1.0E-5 + MAX_SCF 100 + SCF_GUESS ATOMIC + &END SCF + &XC + &XC_FUNCTIONAL PBE + &END XC_FUNCTIONAL + &END XC + &END DFT + &PROPERTIES + &BANDSTRUCTURE + &DOS + KPOINTS 1 2 2 + &END DOS + &GW + EPS_FILTER 1.0E-5 + MINIMAX_VERSION 2 + NUM_TIME_FREQ_POINTS 6 + &END GW + &SOC + &END SOC + &END BANDSTRUCTURE + &END PROPERTIES + &SUBSYS + &CELL + ABC [angstrom] 12.000 6.000 8.000 + MULTIPLE_UNIT_CELL 1 1 1 + PERIODIC YZ + &END CELL + &COORD + H 0.0 -0.5 -4.5 + Te 0.5 0.0 4.5 + H 0.0 0.5 -4.5 + &END COORD + &KIND H + BASIS_SET ORB DZVP-GTH + BASIS_SET RI_AUX RI-dummy-regtest + POTENTIAL GTH-PBE-q1 + &END KIND + &KIND Te + BASIS_SET ORB SZV-MOLOPT-SR-GTH + BASIS_SET RI_AUX RI-dummy-regtest + POTENTIAL GTH-PBE-q6 + &END KIND + &TOPOLOGY + MULTIPLE_UNIT_CELL 1 1 1 + &END TOPOLOGY + &END SUBSYS +&END FORCE_EVAL diff --git a/tests/QS/regtest-scalable-gw/TEST_FILES b/tests/QS/regtest-scalable-gw/TEST_FILES index 243681d1b3..6be2661152 100644 --- a/tests/QS/regtest-scalable-gw/TEST_FILES +++ b/tests/QS/regtest-scalable-gw/TEST_FILES @@ -9,4 +9,5 @@ 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 #EOF