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