Line data Source code
1 : !--------------------------------------------------------------------------------------------------!
2 : ! CP2K: A general program to perform molecular dynamics simulations !
3 : ! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4 : ! !
5 : ! SPDX-License-Identifier: GPL-2.0-or-later !
6 : !--------------------------------------------------------------------------------------------------!
7 :
8 : ! **************************************************************************************************
9 : !> \brief Types needed for MP2 calculations
10 : !> \par History
11 : !> 2011.05 created [Mauro Del Ben]
12 : !> \author MDB
13 : ! **************************************************************************************************
14 : MODULE mp2_setup
15 : USE cp_eri_mme_interface, ONLY: cp_eri_mme_init_read_input
16 : USE cp_log_handling, ONLY: cp_get_default_logger,&
17 : cp_logger_type
18 : USE cp_output_handling, ONLY: cp_p_file,&
19 : cp_print_key_finished_output,&
20 : cp_print_key_should_output,&
21 : cp_print_key_unit_nr,&
22 : debug_print_level
23 : USE cp_parser_methods, ONLY: read_float_object
24 : USE input_constants, ONLY: &
25 : do_eri_mme, do_potential_short, evGW, evGW0, mp2_method_direct, mp2_method_gpw, &
26 : mp2_method_none, mp2_ri_optimize_basis, ri_mp2_laplace, ri_mp2_method_gpw, &
27 : ri_rpa_method_gpw
28 : USE input_section_types, ONLY: section_vals_get_subs_vals,&
29 : section_vals_type,&
30 : section_vals_val_get
31 : USE kinds, ONLY: default_string_length,&
32 : dp,&
33 : max_line_length
34 : USE machine, ONLY: m_flush
35 : USE mathlib, ONLY: erfc_cutoff
36 : USE mp2_types, ONLY: mp2_method_direct,&
37 : mp2_method_gpw,&
38 : mp2_method_none,&
39 : mp2_ri_optimize_basis,&
40 : mp2_type,&
41 : ri_mp2_laplace,&
42 : ri_mp2_method_gpw,&
43 : ri_rpa_method_gpw
44 : #include "./base/base_uses.f90"
45 :
46 : IMPLICIT NONE
47 :
48 : PRIVATE
49 :
50 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'mp2_setup'
51 :
52 : PUBLIC :: read_mp2_section
53 :
54 : CONTAINS
55 :
56 : ! **************************************************************************************************
57 : !> \brief ...
58 : !> \param input ...
59 : !> \param mp2_env ...
60 : ! **************************************************************************************************
61 466 : SUBROUTINE read_mp2_section(input, mp2_env)
62 : TYPE(section_vals_type), POINTER :: input
63 : TYPE(mp2_type), INTENT(INOUT) :: mp2_env
64 :
65 : CHARACTER(len=*), PARAMETER :: routineN = 'read_mp2_section'
66 :
67 : CHARACTER(LEN=default_string_length), &
68 466 : DIMENSION(:), POINTER :: string_pointer
69 : CHARACTER(LEN=max_line_length) :: error_message
70 : INTEGER :: gw_sc, handle, i, i_special_kp, ival, &
71 : print_level_NTO_analysis, unit_nr
72 466 : INTEGER, DIMENSION(:), POINTER :: tmplist
73 : LOGICAL :: do_mp2, do_opt_ri_basis, do_ri_mp2, &
74 : do_ri_sos_mp2, do_rpa
75 466 : REAL(KIND=dp), DIMENSION(:), POINTER :: r_vals
76 : TYPE(cp_logger_type), POINTER :: logger
77 : TYPE(section_vals_type), POINTER :: bse_section, cphf_section, &
78 : eri_mme_section, gw_section, &
79 : low_scaling_section, mp2_section
80 :
81 466 : CALL timeset(routineN, handle)
82 466 : logger => cp_get_default_logger()
83 :
84 466 : mp2_section => section_vals_get_subs_vals(input, "DFT%XC%WF_CORRELATION")
85 :
86 466 : mp2_env%method = mp2_method_none
87 :
88 : ! should come from input
89 466 : CALL section_vals_val_get(mp2_section, "MEMORY", r_val=mp2_env%mp2_memory)
90 466 : CALL section_vals_val_get(mp2_section, "SCALE_S", r_val=mp2_env%scale_S)
91 466 : CALL section_vals_val_get(mp2_section, "SCALE_T", r_val=mp2_env%scale_T)
92 466 : CALL section_vals_val_get(mp2_section, "GROUP_SIZE", i_val=mp2_env%mp2_num_proc)
93 466 : CALL section_vals_val_get(mp2_section, "E_GAP", r_val=mp2_env%e_gap)
94 466 : CALL section_vals_val_get(mp2_section, "E_RANGE", r_val=mp2_env%e_range)
95 :
96 466 : CALL section_vals_val_get(mp2_section, "MP2%_SECTION_PARAMETERS_", l_val=do_mp2)
97 466 : CALL section_vals_val_get(mp2_section, "MP2%BIG_SEND", l_val=mp2_env%direct_canonical%big_send)
98 466 : IF (do_mp2) THEN
99 32 : CALL check_method(mp2_env%method)
100 32 : CALL section_vals_val_get(mp2_section, "MP2%METHOD", i_val=mp2_env%method)
101 : END IF
102 :
103 466 : CALL section_vals_val_get(mp2_section, "RI_RPA%_SECTION_PARAMETERS_", l_val=do_rpa)
104 :
105 : !CALL section_vals_val_get(mp2_section, "RI_RPA%SIGMA_FUNCTIONAL",l_val=mp2_env%ri_rpa%do_sigma)
106 466 : CALL section_vals_val_get(mp2_section, "RI_RPA%SIGMA_FUNCTIONAL", i_val=mp2_env%ri_rpa%sigma_param)
107 :
108 466 : IF (do_rpa) THEN
109 212 : CALL check_method(mp2_env%method)
110 212 : mp2_env%method = ri_rpa_method_gpw
111 : END IF
112 466 : CALL section_vals_val_get(mp2_section, "RI_RPA%RPA_NUM_QUAD_POINTS", i_val=mp2_env%ri_rpa%rpa_num_quad_points)
113 466 : CALL section_vals_val_get(mp2_section, "RI_RPA%NUM_INTEG_GROUPS", i_val=mp2_env%ri_rpa%rpa_num_integ_groups)
114 466 : CALL section_vals_val_get(mp2_section, "RI_RPA%MM_STYLE", i_val=mp2_env%ri_rpa%mm_style)
115 466 : CALL section_vals_val_get(mp2_section, "RI_RPA%MINIMAX_QUADRATURE", l_val=mp2_env%ri_rpa%minimax_quad)
116 466 : CALL section_vals_val_get(mp2_section, "RI_RPA%ADMM", l_val=mp2_env%ri_rpa%do_admm)
117 466 : CALL section_vals_val_get(mp2_section, "RI_RPA%SCALE_RPA", r_val=mp2_env%ri_rpa%scale_rpa)
118 466 : mp2_env%ri_rpa%reuse_hfx = .FALSE.
119 :
120 : CALL section_vals_val_get(mp2_section, "RI_RPA%EXCHANGE_CORRECTION%_SECTION_PARAMETERS_", &
121 466 : i_val=mp2_env%ri_rpa%exchange_correction)
122 : CALL section_vals_val_get(mp2_section, "RI_RPA%EXCHANGE_CORRECTION%BLOCK_SIZE", &
123 466 : i_val=mp2_env%ri_rpa%exchange_block_size)
124 : CALL section_vals_val_get(mp2_section, "RI_RPA%EXCHANGE_CORRECTION%USE_HFX_IMPLEMENTATION", &
125 466 : l_val=mp2_env%ri_rpa%use_hfx_implementation)
126 :
127 466 : CALL section_vals_val_get(mp2_section, "RI_RPA%RSE", l_val=mp2_env%ri_rpa%do_rse)
128 :
129 466 : CALL section_vals_val_get(mp2_section, "RI_RPA%PRINT_DGEMM_INFO", l_val=mp2_env%ri_rpa%print_dgemm_info)
130 :
131 466 : NULLIFY (gw_section)
132 466 : gw_section => section_vals_get_subs_vals(mp2_section, "RI_RPA%GW")
133 : CALL section_vals_val_get(gw_section, "_SECTION_PARAMETERS_", &
134 466 : l_val=mp2_env%ri_rpa%do_ri_g0w0)
135 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%SELF_CONSISTENCY", &
136 466 : i_val=gw_sc)
137 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%CORR_MOS_OCC", &
138 466 : i_val=mp2_env%ri_g0w0%corr_mos_occ)
139 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%CORR_MOS_VIRT", &
140 466 : i_val=mp2_env%ri_g0w0%corr_mos_virt)
141 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%NUMB_POLES", &
142 466 : i_val=mp2_env%ri_g0w0%num_poles)
143 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%NPARAM_PADE", &
144 466 : i_val=mp2_env%ri_g0w0%nparam_pade)
145 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%ANALYTIC_CONTINUATION", &
146 466 : i_val=mp2_env%ri_g0w0%analytic_continuation)
147 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%OMEGA_MAX_FIT", &
148 466 : r_val=mp2_env%ri_g0w0%omega_max_fit)
149 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%CROSSING_SEARCH", &
150 466 : i_val=mp2_env%ri_g0w0%crossing_search)
151 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%FERMI_LEVEL_OFFSET", &
152 466 : r_val=mp2_env%ri_g0w0%fermi_level_offset)
153 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%HEDIN_SHIFT", &
154 466 : l_val=mp2_env%ri_g0w0%do_hedin_shift)
155 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%EV_GW_ITER", &
156 466 : i_val=mp2_env%ri_g0w0%iter_evGW)
157 466 : IF (gw_sc == evGW) mp2_env%ri_g0w0%iter_evGW = 10
158 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%SC_GW0_ITER", &
159 466 : i_val=mp2_env%ri_g0w0%iter_sc_GW0)
160 466 : IF (gw_sc == evGW0) mp2_env%ri_g0w0%iter_sc_GW0 = 10
161 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%EPS_ITER", &
162 466 : r_val=mp2_env%ri_g0w0%eps_iter)
163 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PRINT_EXX", &
164 466 : i_val=mp2_env%ri_g0w0%print_exx)
165 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PRINT_SELF_ENERGY", &
166 466 : l_val=mp2_env%ri_g0w0%print_self_energy)
167 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%RI_SIGMA_X", &
168 466 : l_val=mp2_env%ri_g0w0%do_ri_Sigma_x)
169 :
170 466 : NULLIFY (r_vals)
171 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%IC_CORR_LIST", &
172 466 : r_vals=r_vals)
173 1398 : ALLOCATE (mp2_env%ri_g0w0%ic_corr_list(1)%array(SIZE(r_vals)))
174 932 : mp2_env%ri_g0w0%ic_corr_list(1)%array(:) = r_vals(:)
175 466 : NULLIFY (r_vals)
176 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%IC_CORR_LIST_BETA", &
177 466 : r_vals=r_vals)
178 1398 : ALLOCATE (mp2_env%ri_g0w0%ic_corr_list(2)%array(SIZE(r_vals)))
179 932 : mp2_env%ri_g0w0%ic_corr_list(2)%array(:) = r_vals(:)
180 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%GAMMA_ONLY_SIGMA", &
181 466 : l_val=mp2_env%ri_g0w0%do_gamma_only_sigma)
182 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%UPDATE_XC_ENERGY", &
183 466 : l_val=mp2_env%ri_g0w0%update_xc_energy)
184 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%REGULARIZATION_MINIMAX", &
185 466 : r_val=mp2_env%ri_g0w0%regularization_minimax)
186 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%SOC", &
187 466 : i_val=mp2_env%ri_g0w0%soc_type)
188 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%SOC_ENERGY_WINDOW", &
189 466 : r_val=mp2_env%ri_g0w0%soc_energy_window)
190 :
191 466 : NULLIFY (bse_section)
192 466 : bse_section => section_vals_get_subs_vals(mp2_section, "RI_RPA%GW%BSE")
193 : CALL section_vals_val_get(bse_section, "_SECTION_PARAMETERS_", &
194 466 : l_val=mp2_env%bse%do_bse)
195 : CALL section_vals_val_get(bse_section, "SPIN_CONFIG", &
196 466 : i_val=mp2_env%bse%bse_spin_config)
197 : CALL section_vals_val_get(bse_section, "ENERGY_CUTOFF_OCC", &
198 466 : r_val=mp2_env%bse%bse_cutoff_occ)
199 : CALL section_vals_val_get(bse_section, "ENERGY_CUTOFF_EMPTY", &
200 466 : r_val=mp2_env%bse%bse_cutoff_empty)
201 : CALL section_vals_val_get(bse_section, "NUM_PRINT_EXC", &
202 466 : i_val=mp2_env%bse%num_print_exc)
203 : CALL section_vals_val_get(bse_section, "NUM_PRINT_EXC_DESCR", &
204 466 : i_val=mp2_env%bse%num_print_exc_descr)
205 : CALL section_vals_val_get(bse_section, "PRINT_DIRECTIONAL_EXC_DESCR", &
206 466 : l_val=mp2_env%bse%print_directional_exc_descr)
207 : CALL section_vals_val_get(bse_section, "EPS_X", &
208 466 : r_val=mp2_env%bse%eps_x)
209 : CALL section_vals_val_get(bse_section, "BSE_ITERAT%DAVIDSON_ABORT_COND", &
210 466 : i_val=mp2_env%bse%davidson_abort_cond)
211 : CALL section_vals_val_get(bse_section, "BSE_ITERAT%NUM_EXC_EN", &
212 466 : i_val=mp2_env%bse%num_exc_en)
213 : CALL section_vals_val_get(bse_section, "BSE_ITERAT%NUM_ADD_START_Z_SPACE", &
214 466 : i_val=mp2_env%bse%num_add_start_z_space)
215 : CALL section_vals_val_get(bse_section, "BSE_ITERAT%FAC_MAX_Z_SPACE", &
216 466 : i_val=mp2_env%bse%fac_max_z_space)
217 : CALL section_vals_val_get(bse_section, "BSE_ITERAT%NUM_NEW_T", &
218 466 : i_val=mp2_env%bse%num_new_t)
219 : CALL section_vals_val_get(bse_section, "BSE_ITERAT%EPS_RES", &
220 466 : r_val=mp2_env%bse%eps_res)
221 : CALL section_vals_val_get(bse_section, "BSE_ITERAT%EPS_EXC_EN", &
222 466 : r_val=mp2_env%bse%eps_exc_en)
223 : CALL section_vals_val_get(bse_section, "BSE_ITERAT%NUM_DAVIDSON_ITER", &
224 466 : i_val=mp2_env%bse%num_davidson_iter)
225 : CALL section_vals_val_get(bse_section, "BSE_ITERAT%Z_SPACE_ENERGY_CUTOFF", &
226 466 : r_val=mp2_env%bse%z_space_energy_cutoff)
227 : CALL section_vals_val_get(bse_section, "BSE_DIAG_METHOD", &
228 466 : i_val=mp2_env%bse%bse_diag_method)
229 : CALL section_vals_val_get(bse_section, "TDA", &
230 466 : i_val=mp2_env%bse%flag_tda)
231 : CALL section_vals_val_get(bse_section, "BSE_DEBUG_PRINT", &
232 466 : l_val=mp2_env%bse%bse_debug_print)
233 : CALL section_vals_val_get(bse_section, "BSE_SPECTRUM%_SECTION_PARAMETERS_", &
234 466 : l_val=mp2_env%bse%bse_print_spectrum)
235 : CALL section_vals_val_get(bse_section, "BSE_SPECTRUM%FREQUENCY_STEP_SIZE", &
236 466 : r_val=mp2_env%bse%bse_spectrum_freq_step_size)
237 : CALL section_vals_val_get(bse_section, "BSE_SPECTRUM%FREQUENCY_STARTING_POINT", &
238 466 : r_val=mp2_env%bse%bse_spectrum_freq_start)
239 : CALL section_vals_val_get(bse_section, "BSE_SPECTRUM%FREQUENCY_END_POINT", &
240 466 : r_val=mp2_env%bse%bse_spectrum_freq_end)
241 : CALL section_vals_val_get(bse_section, "BSE_SPECTRUM%ETA_LIST", &
242 466 : r_vals=mp2_env%bse%bse_eta_spectrum_list)
243 : CALL section_vals_val_get(bse_section, "NTO_ANALYSIS%_SECTION_PARAMETERS_", &
244 466 : i_val=print_level_NTO_analysis)
245 : ! All other print levels besides "off" should trigger the analysis
246 : ! cf. input/cp_output_handling.F:cp_print_key_section_create
247 466 : IF (print_level_NTO_analysis /= debug_print_level + 1) THEN
248 4 : mp2_env%bse%do_nto_analysis = .TRUE.
249 : ELSE
250 462 : mp2_env%bse%do_nto_analysis = .FALSE.
251 : END IF
252 : CALL section_vals_val_get(bse_section, "NTO_ANALYSIS%EPS_NTO_EIGVAL", &
253 466 : r_val=mp2_env%bse%eps_nto_eigval)
254 : CALL section_vals_val_get(bse_section, "NTO_ANALYSIS%EPS_OSC_STR", &
255 466 : r_val=mp2_env%bse%eps_nto_osc_str)
256 : CALL section_vals_val_get(bse_section, "NTO_ANALYSIS%NUM_PRINT_EXC_NTOS", &
257 466 : i_val=mp2_env%bse%num_print_exc_ntos)
258 : CALL section_vals_val_get(bse_section, "NTO_ANALYSIS%STATE_LIST", &
259 466 : EXPLICIT=mp2_env%bse%explicit_nto_list)
260 466 : IF (mp2_env%bse%explicit_nto_list) THEN
261 : CALL section_vals_val_get(bse_section, "NTO_ANALYSIS%STATE_LIST", &
262 0 : i_vals=mp2_env%bse%bse_nto_state_list)
263 : END IF
264 :
265 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%IMAGE_CHARGE_MODEL", &
266 466 : l_val=mp2_env%ri_g0w0%do_ic_model)
267 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%IC%PRINT_IC_LIST", &
268 466 : l_val=mp2_env%ri_g0w0%print_ic_values)
269 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%IC%EPS_DIST", &
270 466 : r_val=mp2_env%ri_g0w0%eps_dist)
271 :
272 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PERIODIC_CORRECTION", &
273 466 : l_val=mp2_env%ri_g0w0%do_periodic)
274 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PERIODIC_CORRECTION%KPOINTS", &
275 466 : i_vals=mp2_env%ri_g0w0%kp_grid)
276 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PERIODIC_CORRECTION%NUM_KP_GRIDS", &
277 466 : i_val=mp2_env%ri_g0w0%num_kp_grids)
278 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PERIODIC_CORRECTION%EPS_KPOINT", &
279 466 : r_val=mp2_env%ri_g0w0%eps_kpoint)
280 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PERIODIC_CORRECTION%MO_COEFF_GAMMA", &
281 466 : l_val=mp2_env%ri_g0w0%do_mo_coeff_gamma)
282 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PERIODIC_CORRECTION%AVERAGE_DEGENERATE_LEVELS", &
283 466 : l_val=mp2_env%ri_g0w0%do_average_deg_levels)
284 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PERIODIC_CORRECTION%EPS_EIGENVAL", &
285 466 : r_val=mp2_env%ri_g0w0%eps_eigenval)
286 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PERIODIC_CORRECTION%EXTRAPOLATE_KPOINTS", &
287 466 : l_val=mp2_env%ri_g0w0%do_extra_kpoints)
288 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PERIODIC_CORRECTION%DO_AUX_BAS_GW", &
289 466 : l_val=mp2_env%ri_g0w0%do_aux_bas_gw)
290 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PERIODIC_CORRECTION%FRACTION_AUX_MOS", &
291 466 : r_val=mp2_env%ri_g0w0%frac_aux_mos)
292 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PERIODIC_CORRECTION%NUM_OMEGA_POINTS", &
293 466 : i_val=mp2_env%ri_g0w0%num_omega_points)
294 :
295 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%KPOINT_SET%NPOINTS", &
296 466 : i_val=mp2_env%ri_g0w0%n_kp_in_kp_line)
297 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%KPOINT_SET%SPECIAL_POINT", &
298 466 : n_rep_val=mp2_env%ri_g0w0%n_special_kp)
299 948 : ALLOCATE (mp2_env%ri_g0w0%xkp_special_kp(3, mp2_env%ri_g0w0%n_special_kp))
300 498 : DO i_special_kp = 1, mp2_env%ri_g0w0%n_special_kp
301 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%KPOINT_SET%SPECIAL_POINT", &
302 32 : i_rep_val=i_special_kp, c_vals=string_pointer)
303 32 : CPASSERT(SIZE(string_pointer(:), 1) == 3)
304 594 : DO i = 1, 3
305 : CALL read_float_object(string_pointer(i), &
306 : mp2_env%ri_g0w0%xkp_special_kp(i, i_special_kp), &
307 96 : error_message)
308 128 : IF (LEN_TRIM(error_message) > 0) CPABORT(TRIM(error_message))
309 : END DO
310 : END DO
311 :
312 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%KPOINTS_SELF_ENERGY", &
313 466 : i_vals=mp2_env%ri_g0w0%kp_grid_Sigma)
314 :
315 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PRINT%GW_DOS%LOWER_BOUND", &
316 466 : r_val=mp2_env%ri_g0w0%dos_lower)
317 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PRINT%GW_DOS%UPPER_BOUND", &
318 466 : r_val=mp2_env%ri_g0w0%dos_upper)
319 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PRINT%GW_DOS%STEP", &
320 466 : r_val=mp2_env%ri_g0w0%dos_prec)
321 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PRINT%GW_DOS%MIN_LEVEL_SPECTRAL", &
322 466 : i_val=mp2_env%ri_g0w0%dos_min)
323 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PRINT%GW_DOS%MAX_LEVEL_SPECTRAL", &
324 466 : i_val=mp2_env%ri_g0w0%dos_max)
325 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PRINT%GW_DOS%MIN_LEVEL_SELF_ENERGY", &
326 466 : i_val=mp2_env%ri_g0w0%min_level_self_energy)
327 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PRINT%GW_DOS%MAX_LEVEL_SELF_ENERGY", &
328 466 : i_val=mp2_env%ri_g0w0%max_level_self_energy)
329 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PRINT%GW_DOS%BROADENING", &
330 466 : r_val=mp2_env%ri_g0w0%dos_eta)
331 :
332 : mp2_env%ri_g0w0%do_kpoints_Sigma = mp2_env%ri_g0w0%n_special_kp > 0 .OR. &
333 : mp2_env%ri_g0w0%kp_grid_Sigma(1)* &
334 : mp2_env%ri_g0w0%kp_grid_Sigma(2)* &
335 466 : mp2_env%ri_g0w0%kp_grid_Sigma(3) > 0
336 :
337 : mp2_env%ri_g0w0%print_local_bandgap = BTEST(cp_print_key_should_output(logger%iter_info, &
338 : mp2_section, "RI_RPA%GW%PRINT%LOCAL_BANDGAP"), &
339 466 : cp_p_file)
340 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PRINT%LOCAL_BANDGAP%ENERGY_WINDOW", &
341 466 : r_val=mp2_env%ri_g0w0%energy_window_print_loc_bandgap)
342 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PRINT%LOCAL_BANDGAP%ENERGY_SPACING", &
343 466 : r_val=mp2_env%ri_g0w0%energy_spacing_print_loc_bandgap)
344 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PRINT%LOCAL_BANDGAP%LDOS_THRESHOLD_GAP", &
345 466 : r_val=mp2_env%ri_g0w0%ldos_thresh_print_loc_bandgap)
346 : CALL section_vals_val_get(mp2_section, "RI_RPA%GW%PRINT%LOCAL_BANDGAP%STRIDE", &
347 466 : i_vals=mp2_env%ri_g0w0%stride_loc_bandgap)
348 :
349 466 : NULLIFY (low_scaling_section)
350 466 : low_scaling_section => section_vals_get_subs_vals(mp2_section, "LOW_SCALING")
351 : CALL section_vals_val_get(low_scaling_section, "_SECTION_PARAMETERS_", &
352 466 : l_val=mp2_env%do_im_time)
353 :
354 466 : CALL section_vals_val_get(low_scaling_section, "MEMORY_CUT", i_val=mp2_env%ri_rpa_im_time%cut_memory)
355 466 : CALL section_vals_val_get(low_scaling_section, "MEMORY_INFO", l_val=mp2_env%ri_rpa_im_time%memory_info)
356 466 : CALL section_vals_val_get(low_scaling_section, "EPS_FILTER", r_val=mp2_env%ri_rpa_im_time%eps_filter)
357 466 : CALL section_vals_val_get(low_scaling_section, "EPS_STORAGE_SCALING", r_val=mp2_env%ri_rpa_im_time%eps_compress)
358 466 : mp2_env%ri_rpa_im_time%eps_compress = mp2_env%ri_rpa_im_time%eps_compress*mp2_env%ri_rpa_im_time%eps_filter
359 466 : mp2_env%ri_rpa_im_time%eps_compress = MAX(mp2_env%ri_rpa_im_time%eps_compress, 1.0E-16_dp)
360 466 : CALL section_vals_val_get(low_scaling_section, "EPS_FILTER_FACTOR", r_val=mp2_env%ri_rpa_im_time%eps_filter_factor)
361 :
362 : CALL section_vals_val_get(low_scaling_section, "DO_KPOINTS", &
363 466 : l_val=mp2_env%ri_rpa_im_time%do_im_time_kpoints)
364 : CALL section_vals_val_get(low_scaling_section, "KPOINTS", &
365 466 : i_vals=mp2_env%ri_rpa_im_time%kp_grid)
366 1864 : mp2_env%ri_rpa_im_time%do_kpoints_from_Gamma = SUM(mp2_env%ri_rpa_im_time%kp_grid) > 0
367 466 : IF (mp2_env%ri_rpa_im_time%do_kpoints_from_Gamma) THEN
368 18 : CPASSERT(mp2_env%ri_g0w0%do_kpoints_Sigma)
369 : END IF
370 : CALL section_vals_val_get(low_scaling_section, "KPOINT_WEIGHTS_W", &
371 466 : i_val=mp2_env%ri_rpa_im_time%kpoint_weights_W_method)
372 : CALL section_vals_val_get(low_scaling_section, "EXPONENT_TAILORED_WEIGHTS", &
373 466 : r_val=mp2_env%ri_rpa_im_time%exp_tailored_weights)
374 : CALL section_vals_val_get(low_scaling_section, "REGULARIZATION_RI", &
375 466 : r_val=mp2_env%ri_rpa_im_time%regularization_RI)
376 : CALL section_vals_val_get(low_scaling_section, "EPS_EIGVAL_S", &
377 466 : r_val=mp2_env%ri_rpa_im_time%eps_eigval_S)
378 : CALL section_vals_val_get(low_scaling_section, "EPS_EIGVAL_S_GAMMA", &
379 466 : r_val=mp2_env%ri_rpa_im_time%eps_eigval_S_Gamma)
380 : CALL section_vals_val_get(low_scaling_section, "MAKE_CHI_POS_DEFINITE", &
381 466 : l_val=mp2_env%ri_rpa_im_time%make_chi_pos_definite)
382 : CALL section_vals_val_get(low_scaling_section, "MAKE_OVERLAP_MAT_AO_POS_DEFINITE", &
383 466 : l_val=mp2_env%ri_rpa_im_time%make_overlap_mat_ao_pos_definite)
384 : CALL section_vals_val_get(low_scaling_section, "TRUNC_COULOMB_RI_X", &
385 466 : l_val=mp2_env%ri_rpa_im_time%trunc_coulomb_ri_x)
386 : CALL section_vals_val_get(low_scaling_section, "DO_EXTRAPOLATE_KPOINTS", &
387 466 : l_val=mp2_env%ri_rpa_im_time%do_extrapolate_kpoints)
388 : CALL section_vals_val_get(low_scaling_section, "REL_CUTOFF_TRUNC_COULOMB_RI_X", &
389 466 : r_val=mp2_env%ri_rpa_im_time%rel_cutoff_trunc_coulomb_ri_x)
390 : CALL section_vals_val_get(low_scaling_section, "K_MESH_G_FACTOR", &
391 466 : i_val=mp2_env%ri_rpa_im_time%k_mesh_g_factor)
392 :
393 : CALL section_vals_val_get(low_scaling_section, "KEEP_QUADRATURE", &
394 466 : l_val=mp2_env%ri_rpa_im_time%keep_quad)
395 466 : NULLIFY (mp2_env%ri_rpa_im_time%tau_tj)
396 466 : NULLIFY (mp2_env%ri_rpa_im_time%tau_wj)
397 466 : NULLIFY (mp2_env%ri_rpa_im_time%tj)
398 466 : NULLIFY (mp2_env%ri_rpa_im_time%wj)
399 466 : NULLIFY (mp2_env%ri_rpa_im_time%weights_cos_tf_t_to_w)
400 466 : NULLIFY (mp2_env%ri_rpa_im_time%weights_cos_tf_w_to_t)
401 :
402 : CALL section_vals_val_get(low_scaling_section, "MIN_BLOCK_SIZE", &
403 466 : i_val=mp2_env%ri_rpa_im_time%min_bsize)
404 :
405 : CALL section_vals_val_get(low_scaling_section, "MIN_BLOCK_SIZE_MO", &
406 466 : i_val=mp2_env%ri_rpa_im_time%min_bsize_mo)
407 :
408 466 : CALL section_vals_val_get(mp2_section, "RI_SOS_MP2%_SECTION_PARAMETERS_", l_val=do_ri_sos_mp2)
409 466 : IF (do_ri_sos_mp2) THEN
410 38 : CALL check_method(mp2_env%method)
411 38 : mp2_env%method = ri_mp2_laplace
412 : END IF
413 466 : CALL section_vals_val_get(mp2_section, "RI_SOS_MP2%QUADRATURE_POINTS", i_val=mp2_env%ri_laplace%n_quadrature)
414 466 : CALL section_vals_val_get(mp2_section, "RI_SOS_MP2%NUM_INTEG_GROUPS", i_val=mp2_env%ri_laplace%num_integ_groups)
415 :
416 466 : CALL section_vals_val_get(mp2_section, "RI_MP2%_SECTION_PARAMETERS_", l_val=do_ri_mp2)
417 466 : IF (do_ri_mp2) THEN
418 178 : CALL check_method(mp2_env%method)
419 178 : mp2_env%method = ri_mp2_method_gpw
420 : END IF
421 466 : CALL section_vals_val_get(mp2_section, "RI_MP2%BLOCK_SIZE", i_val=mp2_env%ri_mp2%block_size)
422 466 : CALL section_vals_val_get(mp2_section, "RI_MP2%NUMBER_INTEGRATION_GROUPS", i_val=mp2_env%ri_mp2%number_integration_groups)
423 466 : CALL section_vals_val_get(mp2_section, "RI_MP2%PRINT_DGEMM_INFO", l_val=mp2_env%ri_mp2%print_dgemm_info)
424 :
425 466 : CALL section_vals_val_get(mp2_section, "RI%ROW_BLOCK", i_val=mp2_env%block_size_row)
426 466 : CALL section_vals_val_get(mp2_section, "RI%COL_BLOCK", i_val=mp2_env%block_size_col)
427 466 : CALL section_vals_val_get(mp2_section, "RI%CALC_COND_NUM", l_val=mp2_env%calc_PQ_cond_num)
428 466 : CALL section_vals_val_get(mp2_section, "RI%DO_SVD", l_val=mp2_env%do_svd)
429 466 : CALL section_vals_val_get(mp2_section, "RI%ERI_BLKSIZE", i_vals=mp2_env%eri_blksize)
430 466 : CALL section_vals_val_get(mp2_section, "RI%RI_METRIC%POTENTIAL_TYPE", i_val=mp2_env%ri_metric%potential_type)
431 466 : CALL section_vals_val_get(mp2_section, "RI%RI_METRIC%OMEGA", r_val=mp2_env%ri_metric%omega)
432 466 : CALL section_vals_val_get(mp2_section, "RI%RI_METRIC%EPS_RANGE", r_val=mp2_env%eps_range)
433 466 : CALL section_vals_val_get(mp2_section, "RI%RI_METRIC%CUTOFF_RADIUS", r_val=mp2_env%ri_metric%cutoff_radius)
434 466 : CALL section_vals_val_get(mp2_section, "RI%RI_METRIC%T_C_G_DATA", c_val=mp2_env%ri_metric%filename)
435 466 : IF (mp2_env%ri_metric%potential_type == do_potential_short) THEN
436 0 : CALL erfc_cutoff(mp2_env%eps_range, mp2_env%ri_metric%omega, mp2_env%ri_metric%cutoff_radius)
437 : END IF
438 :
439 466 : CALL section_vals_val_get(mp2_section, "RI%OPT_RI_BASIS%_SECTION_PARAMETERS_", l_val=do_opt_ri_basis)
440 466 : IF (do_opt_ri_basis) THEN
441 6 : CALL check_method(mp2_env%method)
442 6 : mp2_env%method = mp2_ri_optimize_basis
443 : END IF
444 : CALL section_vals_val_get(mp2_section, "RI%OPT_RI_BASIS%DELTA_I_REL", &
445 466 : r_val=mp2_env%ri_opt_param%DI_rel)
446 : CALL section_vals_val_get(mp2_section, "RI%OPT_RI_BASIS%DELTA_RI", &
447 466 : r_val=mp2_env%ri_opt_param%DRI)
448 : CALL section_vals_val_get(mp2_section, "RI%OPT_RI_BASIS%EPS_DERIV", &
449 466 : r_val=mp2_env%ri_opt_param%eps_step)
450 : CALL section_vals_val_get(mp2_section, "RI%OPT_RI_BASIS%MAX_ITER", &
451 466 : i_val=mp2_env%ri_opt_param%max_num_iter)
452 : CALL section_vals_val_get(mp2_section, "RI%OPT_RI_BASIS%BASIS_SIZE", &
453 466 : i_val=mp2_env%ri_opt_param%basis_quality)
454 466 : NULLIFY (tmplist)
455 : CALL section_vals_val_get(mp2_section, "RI%OPT_RI_BASIS%NUM_FUNC", &
456 466 : i_vals=tmplist)
457 466 : IF (tmplist(1) > 0) THEN
458 6 : ALLOCATE (mp2_env%ri_opt_param%RI_nset_per_l(0:SIZE(tmplist) - 1))
459 10 : mp2_env%ri_opt_param%RI_nset_per_l = 0
460 10 : DO ival = 1, SIZE(tmplist)
461 10 : mp2_env%ri_opt_param%RI_nset_per_l(ival - 1) = tmplist(ival)
462 : END DO
463 : END IF
464 :
465 466 : CALL section_vals_val_get(mp2_section, "INTEGRALS%ERI_METHOD", i_val=mp2_env%eri_method)
466 466 : CALL section_vals_val_get(mp2_section, "INTEGRALS%SIZE_LATTICE_SUM", i_val=mp2_env%mp2_gpw%size_lattice_sum)
467 466 : CALL section_vals_val_get(mp2_section, "INTEGRALS%WFC_GPW%EPS_FILTER", r_val=mp2_env%mp2_gpw%eps_filter)
468 466 : CALL section_vals_val_get(mp2_section, "INTEGRALS%WFC_GPW%EPS_GRID", r_val=mp2_env%mp2_gpw%eps_grid)
469 466 : CALL section_vals_val_get(mp2_section, "INTEGRALS%WFC_GPW%CUTOFF", r_val=mp2_env%mp2_gpw%cutoff)
470 466 : CALL section_vals_val_get(mp2_section, "INTEGRALS%WFC_GPW%REL_CUTOFF", r_val=mp2_env%mp2_gpw%relative_cutoff)
471 466 : CALL section_vals_val_get(mp2_section, "INTEGRALS%WFC_GPW%PRINT_LEVEL", i_val=mp2_env%mp2_gpw%print_level)
472 466 : CALL section_vals_val_get(mp2_section, "INTEGRALS%WFC_GPW%EPS_PGF_ORB_S", r_val=mp2_env%mp2_gpw%eps_pgf_orb_S)
473 : CALL section_vals_val_get(mp2_section, "INTEGRALS%INTERACTION_POTENTIAL%POTENTIAL_TYPE", &
474 466 : i_val=mp2_env%potential_parameter%potential_type)
475 : CALL section_vals_val_get(mp2_section, "INTEGRALS%INTERACTION_POTENTIAL%TRUNCATION_RADIUS", &
476 466 : r_val=mp2_env%potential_parameter%cutoff_radius)
477 : CALL section_vals_val_get(mp2_section, "INTEGRALS%INTERACTION_POTENTIAL%POTENTIAL_DATA", &
478 466 : c_val=mp2_env%potential_parameter%filename)
479 : CALL section_vals_val_get(mp2_section, "INTEGRALS%INTERACTION_POTENTIAL%OMEGA", &
480 466 : r_val=mp2_env%potential_parameter%omega)
481 : CALL section_vals_val_get(mp2_section, "INTEGRALS%INTERACTION_POTENTIAL%SCALE_COULOMB", &
482 466 : r_val=mp2_env%potential_parameter%scale_coulomb)
483 : CALL section_vals_val_get(mp2_section, "INTEGRALS%INTERACTION_POTENTIAL%SCALE_LONGRANGE", &
484 466 : r_val=mp2_env%potential_parameter%scale_longrange)
485 :
486 : NULLIFY (mp2_env%eri_mme_param)
487 11650 : ALLOCATE (mp2_env%eri_mme_param)
488 :
489 466 : IF (mp2_env%eri_method .EQ. do_eri_mme) THEN
490 34 : eri_mme_section => section_vals_get_subs_vals(mp2_section, "INTEGRALS%ERI_MME")
491 34 : CALL cp_eri_mme_init_read_input(eri_mme_section, mp2_env%eri_mme_param)
492 : END IF
493 :
494 : ! Set some parameters in case of P screening
495 466 : mp2_env%not_last_hfx = .TRUE.
496 466 : mp2_env%p_screen = .TRUE.
497 :
498 : ! Set the CPHF section
499 466 : CALL section_vals_val_get(mp2_section, "CANONICAL_GRADIENTS%FREE_HFX_BUFFER", l_val=mp2_env%ri_grad%free_hfx_buffer)
500 466 : CALL section_vals_val_get(mp2_section, "CANONICAL_GRADIENTS%EPS_CANONICAL", r_val=mp2_env%ri_grad%eps_canonical)
501 466 : CALL section_vals_val_get(mp2_section, "CANONICAL_GRADIENTS%DOT_PRODUCT_BLKSIZE", i_val=mp2_env%ri_grad%dot_blksize)
502 466 : CALL section_vals_val_get(mp2_section, "CANONICAL_GRADIENTS%MAX_PARALLEL_COMM", i_val=mp2_env%ri_grad%max_parallel_comm)
503 466 : cphf_section => section_vals_get_subs_vals(mp2_section, "CANONICAL_GRADIENTS%CPHF")
504 466 : IF (ASSOCIATED(cphf_section)) THEN
505 466 : CALL section_vals_val_get(cphf_section, "MAX_ITER", i_val=mp2_env%ri_grad%cphf_max_num_iter)
506 466 : CALL section_vals_val_get(cphf_section, "EPS_CONV", r_val=mp2_env%ri_grad%cphf_eps_conv)
507 466 : CALL section_vals_val_get(cphf_section, "SCALE_STEP_SIZE", r_val=mp2_env%ri_grad%scale_step_size)
508 466 : CALL section_vals_val_get(cphf_section, "SOLVER_METHOD", i_val=mp2_env%ri_grad%z_solver_method)
509 466 : CALL section_vals_val_get(cphf_section, "RESTART_EVERY", i_val=mp2_env%ri_grad%cphf_restart)
510 466 : CALL section_vals_val_get(cphf_section, "ENFORCE_DECREASE", l_val=mp2_env%ri_grad%enforce_decrease)
511 466 : CALL section_vals_val_get(cphf_section, "RECALC_RESIDUAL", l_val=mp2_env%ri_grad%recalc_residual)
512 466 : CALL section_vals_val_get(cphf_section, "DO_POLAK_RIBIERE", l_val=mp2_env%ri_grad%polak_ribiere)
513 : END IF
514 :
515 : ! print some info about the MP2 parameters
516 : unit_nr = cp_print_key_unit_nr(logger, mp2_section, "PRINT", &
517 466 : extension=".mp2Log")
518 466 : IF ((mp2_env%method .NE. mp2_method_none) .AND. unit_nr > 0) THEN
519 233 : WRITE (unit_nr, '(T2,A)') ""
520 242 : SELECT CASE (mp2_env%method)
521 : CASE (mp2_method_direct)
522 9 : WRITE (unit_nr, '(T2,A)') "MP2| using direct canonical MP2"
523 : CASE (mp2_method_gpw)
524 7 : WRITE (unit_nr, '(T2,A)') "MP2| using MP2 GPW style"
525 : CASE (ri_mp2_method_gpw)
526 89 : WRITE (unit_nr, '(T2,A)') "MP2| using RI-MP2-GPW"
527 : CASE (ri_rpa_method_gpw)
528 106 : WRITE (unit_nr, '(T2,A)') "RI-RPA| using GPW style"
529 : CASE (ri_mp2_laplace)
530 19 : WRITE (unit_nr, '(T2,A)') "RI-SOS-Laplace-MP2| using GPW style"
531 : CASE (mp2_ri_optimize_basis)
532 3 : WRITE (unit_nr, '(T2,A)') "MP2| Optimize RI auxiliary basis"
533 : CASE DEFAULT
534 233 : CPABORT("")
535 : END SELECT
536 233 : WRITE (unit_nr, '(T2,A)') ""
537 233 : CALL m_flush(unit_nr)
538 : END IF
539 :
540 : CALL cp_print_key_finished_output(unit_nr, logger, mp2_section, &
541 466 : "PRINT")
542 :
543 466 : CALL timestop(handle)
544 :
545 3728 : END SUBROUTINE read_mp2_section
546 :
547 : ! **************************************************************************************************
548 : !> \brief ...
549 : !> \param method ...
550 : ! **************************************************************************************************
551 466 : SUBROUTINE check_method(method)
552 : INTEGER, INTENT(IN) :: method
553 :
554 : CHARACTER(len=*), PARAMETER :: routineN = 'check_method'
555 :
556 : INTEGER :: handle
557 :
558 466 : CALL timeset(routineN, handle)
559 :
560 466 : IF (method .NE. mp2_method_none) THEN
561 0 : CPABORT("Please use not more than one method to compute the correlation energy.")
562 : END IF
563 :
564 466 : CALL timestop(handle)
565 :
566 466 : END SUBROUTINE check_method
567 : END MODULE mp2_setup
|