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