Line data Source code
1 : !--------------------------------------------------------------------------------------------------!
2 : ! CP2K: A general program to perform molecular dynamics simulations !
3 : ! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4 : ! !
5 : ! SPDX-License-Identifier: GPL-2.0-or-later !
6 : !--------------------------------------------------------------------------------------------------!
7 :
8 : ! **************************************************************************************************
9 : !> \brief input section for MP2
10 : !> \par History
11 : !> 05.2011 created
12 : !> \author MDB
13 : ! **************************************************************************************************
14 : MODULE input_cp2k_mp2
15 : USE bibliography, ONLY: &
16 : Bates2013, DelBen2012, DelBen2013, DelBen2015, DelBen2015b, Rybkin2016, Wilhelm2016a, &
17 : Wilhelm2016b, Wilhelm2017, Wilhelm2018, Wilhelm2021, Stein2022, Stein2024, Bussy2023, Hedin1965, &
18 : Hybertsen1986, Tyagi2024, Tyagi2026, Graml2026
19 : USE cp_eri_mme_interface, ONLY: create_eri_mme_section
20 : USE cp_output_handling, ONLY: add_last_numeric, &
21 : cp_print_key_section_create, &
22 : debug_print_level, &
23 : high_print_level, &
24 : low_print_level, &
25 : medium_print_level, &
26 : silent_print_level
27 : USE cp_units, ONLY: cp_unit_to_cp2k
28 : USE input_constants, ONLY: &
29 : bse_fulldiag, bse_iterdiag, bse_tda, bse_abba, bse_both, &
30 : bse_screening_w0, bse_screening_tdhf, bse_screening_rpa, bse_screening_alpha, &
31 : cohsex_diagonal, cohsex_off, cohsex_qp_update, &
32 : bse_abba_mk_davidson, bse_abba_olsen_stratmann, bse_iter_and_cond, bse_iter_en_cond, &
33 : bse_iter_or_cond, bse_iter_res_cond, bse_precond_full_diag, bse_precond_qp_diff, bse_singlet, &
34 : bse_triplet, do_eri_gpw, do_eri_mme, do_eri_os, do_potential_coulomb, do_potential_id, &
35 : do_potential_long, do_potential_mix_cl, do_potential_short, do_potential_truncated, &
36 : do_potential_tshpsc, eri_default, gaussian, gw_no_print_exx, gw_pade_approx, gw_print_exx, &
37 : gw_read_exx, gw_skip_for_regtest, gw_two_pole_model, kp_weights_W_auto, &
38 : kp_weights_W_tailored, kp_weights_W_uniform, mp2_method_direct, mp2_method_gpw, &
39 : mp2_method_none, numerical, ot_precond_full_all, ot_precond_full_kinetic, &
40 : ot_precond_full_single, ot_precond_full_single_inverse, ot_precond_none, &
41 : ot_precond_s_inverse, ri_default, ri_rpa_g0w0_crossing_bisection, &
42 : ri_rpa_g0w0_crossing_newton, ri_rpa_g0w0_crossing_z_shot, soc_lda, soc_none, soc_pbe, &
43 : wfc_mm_style_gemm, wfc_mm_style_syrk, z_solver_cg, z_solver_pople, z_solver_richardson, &
44 : z_solver_sd, rpa_exchange_none, rpa_exchange_axk, rpa_exchange_sosex, G0W0, evGW0, evGW, &
45 : sigma_none, sigma_PBE0_S1, sigma_PBE0_S2, sigma_PBE_S1, sigma_PBE_S2
46 : USE input_cp2k_hfx, ONLY: create_hfx_section
47 : USE input_cp2k_kpoints, ONLY: create_kpoint_set_section
48 : USE input_keyword_types, ONLY: keyword_create, &
49 : keyword_release, &
50 : keyword_type
51 : USE input_section_types, ONLY: section_add_keyword, &
52 : section_add_subsection, &
53 : section_create, &
54 : section_release, &
55 : section_type
56 :
57 : USE input_val_types, ONLY: char_t, &
58 : integer_t, &
59 : logical_t, &
60 : real_t
61 : USE kinds, ONLY: dp
62 : USE string_utilities, ONLY: newline, &
63 : s2a
64 : #include "./base/base_uses.f90"
65 :
66 : IMPLICIT NONE
67 : PRIVATE
68 :
69 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_mp2'
70 :
71 : PUBLIC :: create_mp2_section, create_bse_section
72 :
73 : CONTAINS
74 :
75 : ! **************************************************************************************************
76 : !> \brief creates the input section for the mp2 part
77 : !> \param section the section to create
78 : !> \author MDB
79 : ! **************************************************************************************************
80 11788 : SUBROUTINE create_mp2_section(section)
81 : TYPE(section_type), POINTER :: section
82 :
83 : TYPE(keyword_type), POINTER :: keyword
84 : TYPE(section_type), POINTER :: print_key, subsection
85 :
86 11788 : CPASSERT(.NOT. ASSOCIATED(section))
87 : CALL section_create(section, __LOCATION__, name="WF_CORRELATION", &
88 : description="Controls wavefunction-based correlation methods such as MP2, "// &
89 : "RI-MP2, RI-SOS-MP2, RI-RPA, and GW inside RI-RPA.", &
90 : n_keywords=4, n_subsections=7, repeats=.TRUE., &
91 : citations=[DelBen2012, DelBen2013, DelBen2015, DelBen2015b, Rybkin2016, &
92 : Wilhelm2016a, Wilhelm2016b, Wilhelm2017, Wilhelm2018, Stein2022, &
93 153244 : Stein2024, Bussy2023])
94 :
95 11788 : NULLIFY (keyword, subsection)
96 :
97 : CALL keyword_create( &
98 : keyword, __LOCATION__, &
99 : name="MEMORY", &
100 : description="Maximum allowed total memory usage during MP2 and related WF_CORRELATION methods [MiB].", &
101 : usage="MEMORY 1500 ", &
102 11788 : default_r_val=1.024E+3_dp)
103 11788 : CALL section_add_keyword(section, keyword)
104 11788 : CALL keyword_release(keyword)
105 :
106 : CALL keyword_create( &
107 : keyword, __LOCATION__, &
108 : name="E_GAP", &
109 : description="Gap energy for integration grids in Hartree. Defaults to -1.0 (automatic determination). "// &
110 : "Recommended to set if several RPA or SOS-MP2 gradient calculations are requested or to be restarted. "// &
111 : "In this way, differences of integration grids across different runs are removed as CP2K "// &
112 : "does not include derivatives thereof.", &
113 : usage="E_GAP 0.5", &
114 11788 : default_r_val=-1.0_dp)
115 11788 : CALL section_add_keyword(section, keyword)
116 11788 : CALL keyword_release(keyword)
117 :
118 : CALL keyword_create( &
119 : keyword, __LOCATION__, &
120 : name="E_RANGE", &
121 : description="Energy range (ratio of largest and smallest) energy difference "// &
122 : "of unoccupied and occupied orbitals for integration grids. Defaults to 0.0 (automatic determination). "// &
123 : "Recommended to set if several RPA or SOS-MP2 gradient calculations are requested or to be restarted. "// &
124 : "In this way, differences of integration grids across different runs are removed as CP2K "// &
125 : "does not include derivatives thereof.", &
126 : usage="E_RANGE 10.0", &
127 11788 : default_r_val=-1.0_dp)
128 11788 : CALL section_add_keyword(section, keyword)
129 11788 : CALL keyword_release(keyword)
130 :
131 : CALL keyword_create( &
132 : keyword, __LOCATION__, &
133 : name="SCALE_S", &
134 : description="Scaling factor of the singlet energy component (opposite spin, OS) of the "// &
135 : "MP2, RI-MP2 and SOS-MP2 correlation energy. ", &
136 : usage="SCALE_S 1.0", &
137 11788 : default_r_val=1.0_dp)
138 11788 : CALL section_add_keyword(section, keyword)
139 11788 : CALL keyword_release(keyword)
140 :
141 : CALL keyword_create( &
142 : keyword, __LOCATION__, &
143 : name="SCALE_T", &
144 : description="Scaling factor of the triplet energy component (same spin, SS) of the MP2 "// &
145 : "and RI-MP2 correlation energy.", &
146 : usage="SCALE_T 1.0", &
147 11788 : default_r_val=1.0_dp)
148 11788 : CALL section_add_keyword(section, keyword)
149 11788 : CALL keyword_release(keyword)
150 :
151 : CALL keyword_create( &
152 : keyword, __LOCATION__, &
153 : name="GROUP_SIZE", &
154 : variants=["NUMBER_PROC"], &
155 : description="Group size used in the computation of GPW and MME integrals and the MP2 correlation energy. "// &
156 : "The group size must be a divisor of the total number of MPI ranks. "// &
157 : "A smaller group size (for example the number of MPI ranks per node) "// &
158 : "accelerates the computation of integrals but a too large group size increases communication costs. "// &
159 : "A too small group size may lead to out of memory.", &
160 : usage="GROUP_SIZE 2", &
161 23576 : default_i_val=1)
162 11788 : CALL section_add_keyword(section, keyword)
163 11788 : CALL keyword_release(keyword)
164 :
165 11788 : NULLIFY (subsection)
166 11788 : CALL create_mp2_details_section(subsection)
167 11788 : CALL section_add_subsection(section, subsection)
168 11788 : CALL section_release(subsection)
169 :
170 11788 : CALL create_ri_mp2(subsection)
171 11788 : CALL section_add_subsection(section, subsection)
172 11788 : CALL section_release(subsection)
173 :
174 11788 : CALL create_ri_rpa(subsection)
175 11788 : CALL section_add_subsection(section, subsection)
176 11788 : CALL section_release(subsection)
177 :
178 11788 : CALL create_ri_laplace(subsection)
179 11788 : CALL section_add_subsection(section, subsection)
180 11788 : CALL section_release(subsection)
181 :
182 : ! here we generate an imag. time subsection to use with RPA or Laplace-SOS-MP2
183 11788 : CALL create_low_scaling(subsection)
184 11788 : CALL section_add_subsection(section, subsection)
185 11788 : CALL section_release(subsection)
186 :
187 11788 : CALL create_ri_section(subsection)
188 11788 : CALL section_add_subsection(section, subsection)
189 11788 : CALL section_release(subsection)
190 :
191 11788 : CALL create_integrals_section(subsection)
192 11788 : CALL section_add_subsection(section, subsection)
193 11788 : CALL section_release(subsection)
194 :
195 11788 : CALL create_canonical_gradients(subsection)
196 11788 : CALL section_add_subsection(section, subsection)
197 11788 : CALL section_release(subsection)
198 :
199 11788 : NULLIFY (print_key)
200 : CALL cp_print_key_section_create(print_key, __LOCATION__, "PRINT", &
201 : description="Controls the printing basic info about WFC methods", &
202 11788 : print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
203 11788 : CALL section_add_subsection(section, print_key)
204 11788 : CALL section_release(print_key)
205 :
206 11788 : END SUBROUTINE create_mp2_section
207 :
208 : ! **************************************************************************************************
209 : !> \brief ...
210 : !> \param section ...
211 : ! **************************************************************************************************
212 11788 : SUBROUTINE create_mp2_details_section(section)
213 : TYPE(section_type), POINTER :: section
214 :
215 : TYPE(keyword_type), POINTER :: keyword
216 :
217 11788 : CPASSERT(.NOT. ASSOCIATED(section))
218 : CALL section_create(section, __LOCATION__, name="MP2", &
219 : description="Parameters influencing MP2 (non-RI).", &
220 11788 : n_keywords=3, n_subsections=0, repeats=.FALSE.)
221 :
222 11788 : NULLIFY (keyword)
223 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
224 : description="Activates MP2 calculations.", &
225 : usage="&MP2 .TRUE.", &
226 11788 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
227 11788 : CALL section_add_keyword(section, keyword)
228 11788 : CALL keyword_release(keyword)
229 :
230 : CALL keyword_create( &
231 : keyword, __LOCATION__, &
232 : name="METHOD", &
233 : citations=[DelBen2012, DelBen2013], &
234 : description="Selects the implementation used to compute the canonical MP2 energy.", &
235 : usage="METHOD MP2_GPW", &
236 : enum_c_vals=s2a("NONE", "DIRECT_CANONICAL", "MP2_GPW"), &
237 : enum_i_vals=[mp2_method_none, mp2_method_direct, mp2_method_gpw], &
238 : enum_desc=s2a("Skip MP2 calculation.", &
239 : "Use the direct canonical MP2 approach.", &
240 : "Use the GPW approach to MP2 integrals."), &
241 35364 : default_i_val=mp2_method_direct)
242 11788 : CALL section_add_keyword(section, keyword)
243 11788 : CALL keyword_release(keyword)
244 :
245 : CALL keyword_create( &
246 : keyword, __LOCATION__, &
247 : name="BIG_SEND", &
248 : description="Influencing the direct canonical MP2 method: Send big "// &
249 : "messages between processes (useful for >48 processors).", &
250 : usage="BIG_SEND", &
251 : default_l_val=.TRUE., &
252 11788 : lone_keyword_l_val=.TRUE.)
253 11788 : CALL section_add_keyword(section, keyword)
254 11788 : CALL keyword_release(keyword)
255 :
256 11788 : END SUBROUTINE create_mp2_details_section
257 :
258 : ! **************************************************************************************************
259 : !> \brief ...
260 : !> \param section ...
261 : ! **************************************************************************************************
262 11788 : SUBROUTINE create_ri_mp2(section)
263 : TYPE(section_type), POINTER :: section
264 :
265 : TYPE(keyword_type), POINTER :: keyword
266 :
267 11788 : CPASSERT(.NOT. ASSOCIATED(section))
268 : CALL section_create(section, __LOCATION__, name="RI_MP2", &
269 : description="Parameters influencing the RI-MP2 method. RI-MP2 supports gradients.", &
270 : n_keywords=3, n_subsections=1, repeats=.FALSE., &
271 23576 : citations=[DelBen2013])
272 :
273 11788 : NULLIFY (keyword)
274 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
275 : description="Activates an RI-MP2 calculation.", &
276 : usage="&RI_MP2 .TRUE.", &
277 11788 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
278 11788 : CALL section_add_keyword(section, keyword)
279 11788 : CALL keyword_release(keyword)
280 :
281 : CALL keyword_create(keyword, __LOCATION__, name="BLOCK_SIZE", &
282 : variants=["MESSAGE_SIZE"], &
283 : description="Determines the blocking used for communication in RI-MP2. Larger BLOCK_SIZE "// &
284 : "reduces communication but requires more memory. The default (-1) is automatic.", &
285 : usage="BLOCK_SIZE 2", &
286 23576 : default_i_val=-1)
287 11788 : CALL section_add_keyword(section, keyword)
288 11788 : CALL keyword_release(keyword)
289 :
290 : CALL keyword_create(keyword, __LOCATION__, name="NUMBER_INTEGRATION_GROUPS", &
291 : description="Sets the number of integration groups of the communication scheme in RI-MP2. "// &
292 : "Integrals will be replicated such that each integration group has all integrals available. "// &
293 : "Must be a divisor of the number of subgroups (see GROUP_SIZE keyword in the WF_CORRELATION "// &
294 : "section. Smaller groups reduce the communication costs but increase the memory developments. "// &
295 : "If the provided value is non-positive or not a divisor of the number of subgroups, "// &
296 : "the number of integration groups is determined automatically (default).", &
297 : usage="NUMBER_INTEGRATION_GROUPS 2", &
298 11788 : default_i_val=-1)
299 11788 : CALL section_add_keyword(section, keyword)
300 11788 : CALL keyword_release(keyword)
301 :
302 : CALL keyword_create( &
303 : keyword, __LOCATION__, &
304 : name="PRINT_DGEMM_INFO", &
305 : description="Print details about all DGEMM calls.", &
306 : lone_keyword_l_val=.TRUE., &
307 11788 : default_l_val=.FALSE.)
308 11788 : CALL section_add_keyword(section, keyword)
309 11788 : CALL keyword_release(keyword)
310 :
311 11788 : END SUBROUTINE create_ri_mp2
312 :
313 : ! **************************************************************************************************
314 : !> \brief ...
315 : !> \param section ...
316 : ! **************************************************************************************************
317 11788 : SUBROUTINE create_opt_ri_basis(section)
318 : TYPE(section_type), POINTER :: section
319 :
320 : TYPE(keyword_type), POINTER :: keyword
321 :
322 11788 : CPASSERT(.NOT. ASSOCIATED(section))
323 : CALL section_create(section, __LOCATION__, name="OPT_RI_BASIS", &
324 : description="Parameters influencing the optimization of the RI MP2 basis. "// &
325 : "Only exponents of non-contracted auxiliary basis can be optimized. "// &
326 : "An initial RI auxiliary basis has to be specified.", &
327 : n_keywords=6, n_subsections=0, repeats=.FALSE., &
328 23576 : citations=[DelBen2013])
329 11788 : NULLIFY (keyword)
330 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
331 : description="Putting the &OPT_RI_BASIS section activates optimization of RI basis.", &
332 : usage="&OPT_RI_BASIS .TRUE.", &
333 11788 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
334 11788 : CALL section_add_keyword(section, keyword)
335 11788 : CALL keyword_release(keyword)
336 :
337 : CALL keyword_create(keyword, __LOCATION__, name="DELTA_I_REL", &
338 : variants=["DI_REL"], &
339 : description="Target accuracy in the relative deviation of the amplitudes calculated with "// &
340 : "and without RI approximation, (more details in Chem.Phys.Lett.294(1998)143).", &
341 : usage="DELTA_I_REL 1.0E-6_dp", &
342 23576 : default_r_val=1.0E-6_dp)
343 11788 : CALL section_add_keyword(section, keyword)
344 11788 : CALL keyword_release(keyword)
345 :
346 : CALL keyword_create(keyword, __LOCATION__, name="DELTA_RI", &
347 : variants=["DRI"], &
348 : description="Target accuracy in the absolute difference between the RI-MP2 "// &
349 : "and the exact MP2 energy, DRI=ABS(E_MP2-E_RI-MP2).", &
350 : usage="DELTA_RI 1.0E-6_dp", &
351 23576 : default_r_val=5.0E-6_dp)
352 11788 : CALL section_add_keyword(section, keyword)
353 11788 : CALL keyword_release(keyword)
354 :
355 : CALL keyword_create(keyword, __LOCATION__, name="EPS_DERIV", &
356 : variants=["EPS_NUM_DERIV"], &
357 : description="The derivatives of the MP2 energy with respect to the "// &
358 : "exponents of the basis are calculated numerically. "// &
359 : "The change in the exponent a_i employed for the numerical evaluation "// &
360 : "is defined as h_i=EPS_DERIV*a_i.", &
361 : usage="EPS_DERIV 1.0E-3_dp", &
362 23576 : default_r_val=1.0E-3_dp)
363 11788 : CALL section_add_keyword(section, keyword)
364 11788 : CALL keyword_release(keyword)
365 :
366 : CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
367 : variants=["MAX_NUM_ITER"], &
368 : description="Specifies the maximum number of steps in the RI basis optimization.", &
369 : usage="MAX_ITER 100", &
370 23576 : default_i_val=50)
371 11788 : CALL section_add_keyword(section, keyword)
372 11788 : CALL keyword_release(keyword)
373 :
374 : CALL keyword_create(keyword, __LOCATION__, name="NUM_FUNC", &
375 : description="Specifies the number of function, for each angular momentum (s, p, d ...), "// &
376 : "employed in the automatically generated initial guess. "// &
377 : "This will be effective only if RI_AUX_BASIS_SET in the KIND section is not specified.", &
378 : usage="NUM_FUNC {number of s func.} {number of p func.} ...", &
379 11788 : n_var=-1, default_i_vals=[-1], type_of_var=integer_t)
380 11788 : CALL section_add_keyword(section, keyword)
381 11788 : CALL keyword_release(keyword)
382 :
383 : CALL keyword_create(keyword, __LOCATION__, name="BASIS_SIZE", &
384 : description="Specifies the size of the auxiliary basis set automatically "// &
385 : "generated as initial guess. This will be effective only if RI_AUX_BASIS_SET "// &
386 : "in the KIND section and NUM_FUNC are not specified.", &
387 : usage="BASIS_SIZE (MEDIUM|LARGE|VERY_LARGE)", &
388 : enum_c_vals=s2a("MEDIUM", "LARGE", "VERY_LARGE"), &
389 : enum_i_vals=[0, 1, 2], &
390 11788 : default_i_val=0)
391 11788 : CALL section_add_keyword(section, keyword)
392 11788 : CALL keyword_release(keyword)
393 :
394 11788 : END SUBROUTINE create_opt_ri_basis
395 :
396 : ! **************************************************************************************************
397 : !> \brief ...
398 : !> \param section ...
399 : ! **************************************************************************************************
400 11788 : SUBROUTINE create_ri_laplace(section)
401 : TYPE(section_type), POINTER :: section
402 :
403 : TYPE(keyword_type), POINTER :: keyword
404 :
405 11788 : CPASSERT(.NOT. ASSOCIATED(section))
406 : CALL section_create(section, __LOCATION__, name="RI_SOS_MP2", &
407 : description="Parameters influencing the RI-SOS-MP2-Laplace method", &
408 : n_keywords=3, n_subsections=1, repeats=.FALSE., &
409 23576 : citations=[DelBen2013])
410 :
411 11788 : NULLIFY (keyword)
412 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
413 : description="Putting the &RI_SOS_MP2 section activates RI-SOS-MP2 calculation.", &
414 : usage="&RI_SOS_MP2 .TRUE.", &
415 11788 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
416 11788 : CALL section_add_keyword(section, keyword)
417 11788 : CALL keyword_release(keyword)
418 :
419 : CALL keyword_create( &
420 : keyword, __LOCATION__, name="QUADRATURE_POINTS", &
421 : variants=["LAPLACE_NUM_QUAD_POINTS"], &
422 : description="Number of quadrature points for the numerical integration in the RI-SOS-MP2-Laplace method.", &
423 : usage="QUADRATURE_POINTS 6", &
424 23576 : default_i_val=5)
425 11788 : CALL section_add_keyword(section, keyword)
426 11788 : CALL keyword_release(keyword)
427 :
428 : CALL keyword_create( &
429 : keyword, __LOCATION__, name="NUM_INTEG_GROUPS", &
430 : description="Number of groups for the integration in the Laplace method. Each groups processes "// &
431 : "the same amount of quadrature points. It must be a divisor of the number of quadrature points and "// &
432 : "NUM_INTEG_GROUPS*GROUP_SIZE must be a divisor of the total number of processes. The default (-1) is automatic.", &
433 : usage="NUM_INTEG_GROUPS 2", &
434 11788 : default_i_val=-1)
435 11788 : CALL section_add_keyword(section, keyword)
436 11788 : CALL keyword_release(keyword)
437 :
438 11788 : END SUBROUTINE create_ri_laplace
439 :
440 : ! **************************************************************************************************
441 : !> \brief ...
442 : !> \param section ...
443 : ! **************************************************************************************************
444 11788 : SUBROUTINE create_canonical_gradients(section)
445 : TYPE(section_type), POINTER :: section
446 :
447 : TYPE(keyword_type), POINTER :: keyword
448 : TYPE(section_type), POINTER :: subsection
449 :
450 11788 : CPASSERT(.NOT. ASSOCIATED(section))
451 : CALL section_create(section, __LOCATION__, name="CANONICAL_GRADIENTS", &
452 : description="Parameters influencing gradient calculations of canonical RI methods. "// &
453 : "Ignored if the IM_TIME section is set.", &
454 : n_keywords=3, n_subsections=1, repeats=.FALSE., &
455 58940 : citations=[DelBen2015b, Rybkin2016, Stein2022, Stein2024])
456 :
457 11788 : NULLIFY (subsection, keyword)
458 11788 : CALL create_cphf(subsection)
459 11788 : CALL section_add_subsection(section, subsection)
460 11788 : CALL section_release(subsection)
461 :
462 : CALL keyword_create(keyword, __LOCATION__, name="EPS_CANONICAL", &
463 : description="Threshold under which a given ij or ab pair is considered to be degenerate and "// &
464 : "its contribution to the density matrix is calculated directly. "// &
465 : "Ignored in case of energy-only calculation.", &
466 : usage="EPS_CANONICAL 1.0E-8", type_of_var=real_t, &
467 11788 : default_r_val=1.0E-7_dp)
468 11788 : CALL section_add_keyword(section, keyword)
469 11788 : CALL keyword_release(keyword)
470 :
471 : CALL keyword_create( &
472 : keyword, __LOCATION__, &
473 : name="FREE_HFX_BUFFER", &
474 : description="Free the buffer containing the 4 center integrals used in the Hartree-Fock exchange calculation. "// &
475 : "Ignored for energy-only calculations. May fail.", &
476 : usage="FREE_HFX_BUFFER", &
477 : default_l_val=.FALSE., &
478 11788 : lone_keyword_l_val=.TRUE.)
479 11788 : CALL section_add_keyword(section, keyword)
480 11788 : CALL keyword_release(keyword)
481 :
482 : CALL keyword_create( &
483 : keyword, __LOCATION__, &
484 : name="DOT_PRODUCT_BLKSIZE", &
485 : description="Dot products for the calculation of the RPA/SOS-MP2 density matrices "// &
486 : "are calculated in batches of the size given by this keyword. Larger block sizes "// &
487 : "improve the performance but reduce the numerical accuracy. Recommended block sizes are multiples of the number of "// &
488 : "doubles per cache line (usually 8). Ignored with MP2 gradients. Set it to -1 to prevent blocking.", &
489 11788 : default_i_val=-1)
490 11788 : CALL section_add_keyword(section, keyword)
491 11788 : CALL keyword_release(keyword)
492 :
493 : CALL keyword_create( &
494 : keyword, __LOCATION__, &
495 : name="MAX_PARALLEL_COMM", &
496 : description="Sets the maximum number of parallel communication steps of the non-blocking communication scheme. "// &
497 : "The number of channels is determined from the available memory. If set to a value smaller than one, "// &
498 : "CP2K will use all memory for communication. A value of one enforces the blocking communication scheme "// &
499 : "increasing the communication costs.", &
500 11788 : default_i_val=2)
501 11788 : CALL section_add_keyword(section, keyword)
502 11788 : CALL keyword_release(keyword)
503 :
504 11788 : END SUBROUTINE create_canonical_gradients
505 :
506 : ! **************************************************************************************************
507 : !> \brief ...
508 : !> \param section ...
509 : ! **************************************************************************************************
510 11788 : SUBROUTINE create_ri_rpa(section)
511 : TYPE(section_type), POINTER :: section
512 :
513 : TYPE(keyword_type), POINTER :: keyword
514 : TYPE(section_type), POINTER :: subsection
515 :
516 11788 : CPASSERT(.NOT. ASSOCIATED(section))
517 : CALL section_create(section, __LOCATION__, name="RI_RPA", &
518 : description="Controls RI-RPA and GW calculations.", &
519 : n_keywords=8, n_subsections=4, repeats=.FALSE., &
520 35364 : citations=[DelBen2013, DelBen2015])
521 :
522 11788 : NULLIFY (keyword, subsection)
523 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
524 : description="Activates an RI-RPA calculation.", &
525 : usage="&RI_RPA .TRUE.", &
526 11788 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
527 11788 : CALL section_add_keyword(section, keyword)
528 11788 : CALL keyword_release(keyword)
529 :
530 : CALL keyword_create( &
531 : keyword, __LOCATION__, &
532 : name="SIGMA_FUNCTIONAL", &
533 : description="Determine parametrization for sigma-functional", &
534 : usage="SIGMA_FUNCTIONAL PBE_S2", &
535 : enum_c_vals=s2a("NONE", "PBE0_S1", "PBE0_S2", "PBE_S1", "PBE_S2"), &
536 : enum_i_vals=[sigma_none, sigma_PBE0_S1, sigma_PBE0_S2, sigma_PBE_S1, sigma_PBE_S2], &
537 : enum_desc=s2a("No sigma functional calculation", &
538 : "use parameters based on PBE0 with S1 set.", &
539 : "use parameters based on PBE0 with S2 set.", &
540 : "use parameters based on PBE with S1 set.", &
541 : "use parameters based on PBE with S2 set." &
542 : ), &
543 11788 : default_i_val=sigma_none)
544 11788 : CALL section_add_keyword(section, keyword)
545 11788 : CALL keyword_release(keyword)
546 :
547 : CALL keyword_create(keyword, __LOCATION__, name="QUADRATURE_POINTS", &
548 : variants=["RPA_NUM_QUAD_POINTS"], &
549 : description="Number of quadrature points for the RI-RPA numerical integration.", &
550 : usage="QUADRATURE_POINTS 60", &
551 23576 : default_i_val=40)
552 11788 : CALL section_add_keyword(section, keyword)
553 11788 : CALL keyword_release(keyword)
554 :
555 : CALL keyword_create(keyword, __LOCATION__, name="NUM_INTEG_GROUPS", &
556 : description="Number of groups for the integration in the Laplace method. Each groups processes "// &
557 : "the same amount of quadrature points. It must be a divisor of the number of quadrature points and "// &
558 : "NUM_INTEG_GROUPS*GROUP_SIZE must be a divisor of the total number of processes. "// &
559 : "The default (-1) is automatic.", &
560 : usage="NUM_INTEG_GROUPS 2", &
561 11788 : default_i_val=-1)
562 11788 : CALL section_add_keyword(section, keyword)
563 11788 : CALL keyword_release(keyword)
564 :
565 : CALL keyword_create(keyword, __LOCATION__, &
566 : name="MM_STYLE", &
567 : description="Matrix multiplication style for the Q matrix.", &
568 : usage="MM_STYLE GEMM", &
569 : enum_c_vals=s2a("GEMM", "SYRK"), &
570 : enum_i_vals=[wfc_mm_style_gemm, wfc_mm_style_syrk], &
571 : enum_desc=s2a("Use pdgemm: more flops, maybe faster.", &
572 : "Use pdysrk: fewer flops, maybe slower."), &
573 11788 : default_i_val=wfc_mm_style_gemm)
574 11788 : CALL section_add_keyword(section, keyword)
575 11788 : CALL keyword_release(keyword)
576 :
577 : CALL keyword_create( &
578 : keyword, __LOCATION__, &
579 : name="MINIMAX_QUADRATURE", &
580 : variants=["MINIMAX"], &
581 : description="Use the Minimax quadrature scheme for the numerical integration. "// &
582 : "It usually needs fewer quadrature points than Clenshaw-Curtis but is limited to 20 points.", &
583 : usage="MINIMAX_QUADRATURE", &
584 : default_l_val=.FALSE., &
585 23576 : lone_keyword_l_val=.TRUE.)
586 11788 : CALL section_add_keyword(section, keyword)
587 11788 : CALL keyword_release(keyword)
588 :
589 : CALL keyword_create( &
590 : keyword, __LOCATION__, &
591 : name="RSE", &
592 : variants=["SE"], &
593 : description="Decide whether to add singles correction.", &
594 : usage="RSE", &
595 : default_l_val=.FALSE., &
596 23576 : lone_keyword_l_val=.TRUE.)
597 11788 : CALL section_add_keyword(section, keyword)
598 11788 : CALL keyword_release(keyword)
599 :
600 : CALL keyword_create( &
601 : keyword, __LOCATION__, &
602 : name="ADMM", &
603 : description="Decide whether to use ADMM in the exact-exchange calculation for RPA and/or GW. "// &
604 : "The ADMM XC correction is governed by the AUXILIARY_DENSITY_MATRIX_METHOD section in &DFT. "// &
605 : "ADMM can provide significant speedup and memory savings, especially with diffuse basis sets. "// &
606 : "For GW band-gap calculations, RI_SIGMA_X can also be used. ", &
607 : usage="ADMM", &
608 : default_l_val=.FALSE., &
609 11788 : lone_keyword_l_val=.TRUE.)
610 11788 : CALL section_add_keyword(section, keyword)
611 11788 : CALL keyword_release(keyword)
612 :
613 : CALL keyword_create( &
614 : keyword, __LOCATION__, &
615 : name="SCALE_RPA", &
616 : description="Scales RPA energy contributions (RPA, exchange correction).", &
617 : usage="SCALE_RPA 1.0", &
618 11788 : default_r_val=1.0_dp)
619 11788 : CALL section_add_keyword(section, keyword)
620 11788 : CALL keyword_release(keyword)
621 :
622 : CALL keyword_create( &
623 : keyword, __LOCATION__, &
624 : name="PRINT_DGEMM_INFO", &
625 : description="Print details about all DGEMM calls.", &
626 : lone_keyword_l_val=.TRUE., &
627 11788 : default_l_val=.FALSE.)
628 11788 : CALL section_add_keyword(section, keyword)
629 11788 : CALL keyword_release(keyword)
630 :
631 : ! here we generate a hfx subsection to use in the case EXX has to be computed after RPA
632 11788 : CALL create_hfx_section(subsection)
633 11788 : CALL section_add_subsection(section, subsection)
634 11788 : CALL section_release(subsection)
635 :
636 : ! here we generate a G0W0 subsection to use if G0W0 is desired
637 11788 : CALL create_ri_g0w0(subsection)
638 11788 : CALL section_add_subsection(section, subsection)
639 11788 : CALL section_release(subsection)
640 :
641 : ! here we the RPA exchange section
642 11788 : CALL create_rpa_exchange(subsection)
643 11788 : CALL section_add_subsection(section, subsection)
644 11788 : CALL section_release(subsection)
645 :
646 11788 : END SUBROUTINE create_ri_rpa
647 :
648 : ! **************************************************************************************************
649 : !> \brief ...
650 : !> \param section ...
651 : ! **************************************************************************************************
652 11788 : SUBROUTINE create_rpa_exchange(section)
653 : TYPE(section_type), POINTER :: section
654 :
655 : TYPE(keyword_type), POINTER :: keyword
656 :
657 11788 : CPASSERT(.NOT. ASSOCIATED(section))
658 : CALL section_create(section, __LOCATION__, name="EXCHANGE_CORRECTION", &
659 : description="Parameters influencing exchange corrections to RPA. No gradients available.", &
660 11788 : n_keywords=3, n_subsections=1, repeats=.FALSE.)
661 :
662 11788 : NULLIFY (keyword)
663 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
664 : description="Choose the kind of exchange correction.", &
665 : usage="&EXCHANGE_CORRECTION AXK", &
666 : enum_c_vals=s2a("NONE", "AXK", "SOSEX"), &
667 : enum_i_vals=[rpa_exchange_none, rpa_exchange_axk, rpa_exchange_sosex], &
668 : enum_desc=s2a("Apply no exchange correction.", &
669 : "Apply Approximate eXchange Kernel (AXK) correction.", &
670 : "Apply Second Order Screened eXchange (SOSEX) correction."), &
671 11788 : default_i_val=rpa_exchange_none)
672 11788 : CALL section_add_keyword(section, keyword)
673 11788 : CALL keyword_release(keyword)
674 :
675 : CALL keyword_create( &
676 : keyword, __LOCATION__, &
677 : name="BLOCK_SIZE", &
678 : description="Choose the block size of the contraction step. Larger block sizes improve performance but "// &
679 : "require more memory (quadratically!, number of stored elements: $o^2\cdot N_B^2$). "// &
680 : "Nonpositive numbers turn off blocking.", &
681 : usage="BLOCK_SIZE 1", &
682 11788 : default_i_val=1)
683 11788 : CALL section_add_keyword(section, keyword)
684 11788 : CALL keyword_release(keyword)
685 :
686 : CALL keyword_create( &
687 : keyword, __LOCATION__, &
688 : name="USE_HFX_IMPLEMENTATION", &
689 : description="Use a HF-based implementation with RI_RPA%HF section. Recommended for large systems.", &
690 : usage="USE_HFX_IMPLEMENTATION T", &
691 11788 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
692 11788 : CALL section_add_keyword(section, keyword)
693 11788 : CALL keyword_release(keyword)
694 :
695 11788 : END SUBROUTINE create_rpa_exchange
696 :
697 : ! **************************************************************************************************
698 : !> \brief ...
699 : !> \param section ...
700 : ! **************************************************************************************************
701 11788 : SUBROUTINE create_ri_g0w0(section)
702 : TYPE(section_type), POINTER :: section
703 :
704 : TYPE(keyword_type), POINTER :: keyword
705 : TYPE(section_type), POINTER :: subsection
706 :
707 11788 : CPASSERT(.NOT. ASSOCIATED(section))
708 : CALL section_create(section, __LOCATION__, name="GW", &
709 : description="GW quasiparticle calculations. Use EXACT_RPA_DIAG for direct full-RPA "// &
710 : "diagonalization, or ANALYTIC_CONTINUATION for continuation from imaginary frequencies.", &
711 11788 : n_keywords=24, n_subsections=1, repeats=.FALSE.)
712 :
713 11788 : NULLIFY (keyword, subsection)
714 :
715 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
716 : description="Activates GW calculations.", &
717 : usage="&GW .TRUE.", &
718 11788 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
719 11788 : CALL section_add_keyword(section, keyword)
720 11788 : CALL keyword_release(keyword)
721 :
722 : CALL keyword_create(keyword, __LOCATION__, name="SELF_CONSISTENCY", &
723 : description="Decide the level of self-consistency of eigenvalues "// &
724 : "(= quasiparticle energies = single-electron energies) in GW. "// &
725 : "Updates of Kohn-Sham orbitals (for example qsGW) are not implemented. "// &
726 : "For details which type of eigenvalue self-consistency might be good, "// &
727 : "please consult Golze, Dvorak, Rinke, Front. Chem. 2019.", &
728 : usage="SELF_CONSISTENCY evGW0", &
729 : enum_c_vals=s2a("G0W0", "evGW0", "evGW"), &
730 : enum_i_vals=[G0W0, evGW0, evGW], &
731 : enum_desc=s2a("Use DFT eigenvalues; not update.", &
732 : "Update DFT eigenvalues in G, not in W.", &
733 : "Update DFT eigenvalues in G and W."), &
734 11788 : default_i_val=G0W0)
735 11788 : CALL section_add_keyword(section, keyword)
736 11788 : CALL keyword_release(keyword)
737 :
738 : CALL keyword_create(keyword, __LOCATION__, name="COHSEX", &
739 : description="Static Coulomb-hole screened-exchange (COHSEX) approximation to "// &
740 : "$G_0W_0$. Only the static screened Coulomb interaction $W(\omega=0)$ is computed; "// &
741 : "its correlation part $W^\text{c}(0) = W(0) - v$ gives the static correlation "// &
742 : "self-energy $\Sigma^\text{c}_{mn} = \frac{1}{2}\sum_p \text{sgn}(\varepsilon_p - "// &
743 : "\varepsilon_\text{F})\, W^\text{c}_{mp,pn}(\omega=0)$. The quasiparticle Hamiltonian "// &
744 : "$H^\text{QP}_{mn} = \varepsilon_n^\text{DFT}\delta_{mn} + \Sigma^\text{x}_{mn} - "// &
745 : "v^\text{xc}_{mn} + \Sigma^\text{c}_{mn}$ is built for the MOs selected by "// &
746 : "CORR_MOS_OCC and CORR_MOS_VIRT; its occupied-virtual blocks are set to zero. "// &
747 : "A subsequent BSE uses $W(\omega=0)$ and the quasiparticle energies (and MOs) "// &
748 : "selected here. No RPA correlation energy is computed.", &
749 : usage="COHSEX QP_UPDATE", &
750 : enum_c_vals=s2a("OFF", "DIAGONAL", "QP_UPDATE"), &
751 : enum_i_vals=[cohsex_off, cohsex_diagonal, cohsex_qp_update], &
752 : enum_desc=s2a("No static COHSEX (default without the keyword).", &
753 : "Diagonal static COHSEX (Hedin 1965; Hybertsen and Louie 1986): the "// &
754 : "quasiparticle energies are the diagonal elements "// &
755 : "$\varepsilon_n^\text{DG} = H^\text{QP}_{nn}$. "// &
756 : "A subsequent BSE uses $\varepsilon_n^\text{DG}$ with the Kohn-Sham MOs. "// &
757 : "Default of the lone keyword.", &
758 : "Static COHSEX with quasiparticle update (Tyagi and Voora 2024): the "// &
759 : "occupied-occupied and virtual-virtual blocks of $H^\text{QP}$ are "// &
760 : "diagonalized separately, giving the canonical static COHSEX energies "// &
761 : "$\varepsilon_n^\text{CN}$ and MOs. Both $\varepsilon_n^\text{DG}$ and "// &
762 : "MOs are printed with DFT%PRINT%MO and "// &
763 : "DFT%PRINT%MO_CUBES. A subsequent BSE uses $\varepsilon_n^\text{CN}$ "// &
764 : "with the canonical MOs."), &
765 : citations=[Hedin1965, Hybertsen1986, Tyagi2024], &
766 47152 : default_i_val=cohsex_off, lone_keyword_i_val=cohsex_diagonal)
767 11788 : CALL section_add_keyword(section, keyword)
768 11788 : CALL keyword_release(keyword)
769 :
770 : CALL keyword_create(keyword, __LOCATION__, name="COHSEX_SCALE_OCC", &
771 : description="Scaling factor of the static COHSEX correlation self-energy in the "// &
772 : "occupied-occupied block of $H^\text{QP}$.", &
773 : usage="COHSEX_SCALE_OCC 0.6", &
774 : citations=[Tyagi2026], &
775 23576 : default_r_val=1.0_dp)
776 11788 : CALL section_add_keyword(section, keyword)
777 11788 : CALL keyword_release(keyword)
778 :
779 : CALL keyword_create(keyword, __LOCATION__, name="COHSEX_SCALE_VIRT", &
780 : description="Scaling factor of the static COHSEX correlation self-energy in the "// &
781 : "virtual-virtual block of $H^\text{QP}$.", &
782 : usage="COHSEX_SCALE_VIRT 0.6", &
783 : citations=[Tyagi2026], &
784 23576 : default_r_val=1.0_dp)
785 11788 : CALL section_add_keyword(section, keyword)
786 11788 : CALL keyword_release(keyword)
787 :
788 : CALL keyword_create(keyword, __LOCATION__, name="CORR_MOS_OCC", &
789 : variants=["CORR_OCC"], &
790 : description="Number of occupied MOs whose energies are corrected in GW. "// &
791 : "Counting beginning from HOMO, e.g. 3 corrected occ. MOs correspond "// &
792 : "to correction of HOMO, HOMO-1 and HOMO-2. Numerical effort and "// &
793 : "storage of RI-G0W0 increase linearly with this number. In case you "// &
794 : "want to correct all occ. MOs, insert either a negative number or "// &
795 : "a number larger than the number of occ. MOs. Invoking CORR_MOS_OCC -2 "// &
796 : "together with a BSE cutoff, sets a sufficiently large CORR_MOS_OCC "// &
797 : "for the given BSE cutoff deduced from DFT eigenvalues.", &
798 : usage="CORR_OCC 3", &
799 23576 : default_i_val=10)
800 11788 : CALL section_add_keyword(section, keyword)
801 11788 : CALL keyword_release(keyword)
802 :
803 : CALL keyword_create(keyword, __LOCATION__, name="CORR_MOS_VIRT", &
804 : variants=["CORR_VIRT"], &
805 : description="Number of virtual MOs whose energies are corrected by GW. "// &
806 : "Counting beginning from LUMO, e.g. 3 corrected occ. MOs correspond "// &
807 : "to correction of LUMO, LUMO+1 and LUMO+2. Numerical effort and "// &
808 : "storage of RI-G0W0 increase linearly with this number. In case you "// &
809 : "want to correct all virt. MOs, insert either a negative number or "// &
810 : "a number larger than the number of virt. MOs. Invoking CORR_MOS_VIRT -2 "// &
811 : "together with a BSE cutoff, sets a sufficiently large CORR_MOS_VIRT "// &
812 : "for the given BSE cutoff deduced from DFT eigenvalues.", &
813 : usage="CORR_VIRT 3", &
814 23576 : default_i_val=10)
815 11788 : CALL section_add_keyword(section, keyword)
816 11788 : CALL keyword_release(keyword)
817 :
818 : CALL keyword_create(keyword, __LOCATION__, name="NUMB_POLES", &
819 : description="Number of poles for the fitting. Usually, two poles are sufficient. ", &
820 : usage="NUMB_POLES 2", &
821 11788 : default_i_val=2)
822 11788 : CALL section_add_keyword(section, keyword)
823 11788 : CALL keyword_release(keyword)
824 :
825 : CALL keyword_create(keyword, __LOCATION__, name="OMEGA_MAX_FIT", &
826 : description="Determines fitting range for the self-energy on the imaginary axis: "// &
827 : "[0, OMEGA_MAX_FIT] for virt orbitals, [-OMEGA_MAX_FIT,0] for occ orbitals. "// &
828 : "Unit: Hartree. Default: 0.734996 H = 20 eV. ", &
829 : usage="OMEGA_MAX_FIT 0.5", &
830 11788 : default_r_val=0.734996_dp)
831 11788 : CALL section_add_keyword(section, keyword)
832 11788 : CALL keyword_release(keyword)
833 :
834 : CALL keyword_create(keyword, __LOCATION__, name="CROSSING_SEARCH", &
835 : description="Determines, how the self_energy is evaluated on the real axis.", &
836 : usage="CROSSING_SEARCH Z_SHOT", &
837 : enum_c_vals=s2a("Z_SHOT", "NEWTON", "BISECTION"), &
838 : enum_i_vals=[ri_rpa_g0w0_crossing_z_shot, &
839 : ri_rpa_g0w0_crossing_newton, ri_rpa_g0w0_crossing_bisection], &
840 : enum_desc=s2a("Calculate the derivative of Sigma and out of it Z. Then extrapolate using Z.", &
841 : "Make a Newton-Raphson fix point iteration.", &
842 : "Make a bisection fix point iteration."), &
843 11788 : default_i_val=ri_rpa_g0w0_crossing_newton)
844 11788 : CALL section_add_keyword(section, keyword)
845 11788 : CALL keyword_release(keyword)
846 :
847 : CALL keyword_create(keyword, __LOCATION__, name="FERMI_LEVEL_OFFSET", &
848 : description="Fermi level for occ. orbitals: e_HOMO + FERMI_LEVEL_OFFSET; "// &
849 : "Fermi level for virt. orbitals: e_LUMO - FERMI_LEVEL_OFFSET. "// &
850 : "In case e_homo + FERMI_LEVEL_OFFSET < e_lumo - FERMI_LEVEL_OFFSET, "// &
851 : "we set Fermi level = (e_HOMO+e_LUMO)/2. For cubic-scaling GW, the Fermi level "// &
852 : "is always equal to (e_HOMO+e_LUMO)/2 regardless of FERMI_LEVEL_OFFSET.", &
853 : usage="FERMI_LEVEL_OFFSET 1.0E-2", &
854 11788 : default_r_val=2.0E-2_dp)
855 11788 : CALL section_add_keyword(section, keyword)
856 11788 : CALL keyword_release(keyword)
857 :
858 : CALL keyword_create(keyword, __LOCATION__, name="HEDIN_SHIFT", &
859 : description="If true, use Hedin's shift in G0W0, evGW and evGW0 "// &
860 : "(aka scGW0). Details see in Li et al. JCTC 18, 7570 "// &
861 : "(2022), Figure 1. G0W0 with Hedin's shift should give "// &
862 : "similar GW eigenvalues as evGW0; at a lower "// &
863 : "computational cost.", &
864 : usage="HEDIN_SHIFT", &
865 : default_l_val=.FALSE., &
866 11788 : lone_keyword_l_val=.TRUE.)
867 11788 : CALL section_add_keyword(section, keyword)
868 11788 : CALL keyword_release(keyword)
869 :
870 : CALL keyword_create(keyword, __LOCATION__, name="EV_GW_ITER", &
871 : description="Maximum number of iterations for eigenvalue "// &
872 : "self-consistency cycle. The computational effort of GW scales "// &
873 : "linearly with this number. In case of choosing "// &
874 : "GW_SELF_CONSISTENCY EVGW, the code sets EV_GW_ITER 10.", &
875 : usage="EV_GW_ITER 3", &
876 11788 : default_i_val=1)
877 11788 : CALL section_add_keyword(section, keyword)
878 11788 : CALL keyword_release(keyword)
879 :
880 : CALL keyword_create(keyword, __LOCATION__, name="SC_GW0_ITER", &
881 : description="Maximum number of iterations for GW0 "// &
882 : "self-consistency cycle. The computational effort "// &
883 : "of GW is not much affected by the number of scGW0 cycles. "// &
884 : "In case of choosing "// &
885 : "GW_SELF_CONSISTENCY EVGW0, the code sets SC_GW0_ITER 10.", &
886 : usage="SC_GW0_ITER 3", &
887 11788 : default_i_val=1)
888 11788 : CALL section_add_keyword(section, keyword)
889 11788 : CALL keyword_release(keyword)
890 :
891 : CALL keyword_create(keyword, __LOCATION__, name="EPS_ITER", &
892 : description="Target accuracy for the eigenvalue self-consistency. "// &
893 : "If the G0W0 HOMO-LUMO gap differs by less than the "// &
894 : "target accuracy during the iteration, the eigenvalue "// &
895 : "self-consistency cycle stops. Unit: Hartree.", &
896 : usage="EPS_ITER 0.00005", &
897 : default_r_val=cp_unit_to_cp2k(value=0.00136_dp, unit_str="eV"), &
898 11788 : unit_str="eV")
899 :
900 11788 : CALL section_add_keyword(section, keyword)
901 11788 : CALL keyword_release(keyword)
902 :
903 : CALL keyword_create(keyword, __LOCATION__, name="PRINT_EXX", &
904 : description="Print exchange self-energy minus exchange correlation potential for Gamma-only "// &
905 : "calculation (PRINT). For a GW calculation with k-points we use this output as "// &
906 : "exchange self-energy (READ). This is a temporary solution because the hybrid MPI/OMP "// &
907 : "parallelization in the HFX by Manuel Guidon conflicts with the parallelization in "// &
908 : "low-scaling GW k-points which is most efficient with maximum number of MPI tasks and "// &
909 : "minimum number of OMP threads. For HFX by M. Guidon, the density matrix is "// &
910 : "fully replicated on every MPI rank which necessitates a high number of OMP threads per MPI "// &
911 : "rank for large systems to prevent out of memory. "// &
912 : "Such a high number of OMP threads would slow down the GW calculation "// &
913 : "severely. Therefore, it was decided to temporarily divide the GW k-point calculation in a "// &
914 : "Gamma-only HF calculation with high number of OMP threads to prevent out of memory and "// &
915 : "a GW k-point calculation with 1 OMP thread per MPI rank reading the previousHF output.", &
916 : usage="PRINT_EXX TRUE", &
917 : enum_c_vals=s2a("TRUE", "FALSE", "READ", "SKIP_FOR_REGTEST"), &
918 : enum_i_vals=[gw_print_exx, gw_no_print_exx, gw_read_exx, gw_skip_for_regtest], &
919 : enum_desc=s2a("Please, put TRUE for Gamma only calculation to get the exchange self-energy. "// &
920 : "If 'SIGMA_X' and the corresponding values for the exchange-energy are written, "// &
921 : "the writing has been successful", &
922 : "FALSE is needed if you want to do nothing here.", &
923 : "Please, put READ for the k-point GW calculation to read the exact exchange. "// &
924 : "You have to provide an output file including the exact exchange. This file "// &
925 : "has to be named 'exx.dat'.", &
926 : "SKIP_FOR_REGTEST is only used for the GW k-point regtest where no exchange "// &
927 : "self-energy is computed."), &
928 11788 : default_i_val=gw_no_print_exx)
929 11788 : CALL section_add_keyword(section, keyword)
930 11788 : CALL keyword_release(keyword)
931 :
932 : CALL keyword_create(keyword, __LOCATION__, name="PRINT_SELF_ENERGY", &
933 : description="Write the correlation self-energy and spectral function "// &
934 : "to GW_level_N_self_energy.dat. Set the frequency grid with PRINT/GW_DOS/LOWER_BOUND, "// &
935 : "UPPER_BOUND and a positive STEP. Orbital selection uses MIN_LEVEL_SELF_ENERGY "// &
936 : "and MAX_LEVEL_SELF_ENERGY (zero maximum includes all corrected orbitals).", &
937 : usage="PRINT_SELF_ENERGY", &
938 : default_l_val=.FALSE., &
939 11788 : lone_keyword_l_val=.TRUE.)
940 11788 : CALL section_add_keyword(section, keyword)
941 11788 : CALL keyword_release(keyword)
942 :
943 : CALL keyword_create(keyword, __LOCATION__, name="RI_SIGMA_X", &
944 : description="If true, the exchange self-energy is calculated approximatively with RI. "// &
945 : "If false, the Hartree-Fock implementation in CP2K is used.", &
946 : usage="RI_SIGMA_X", &
947 : default_l_val=.TRUE., &
948 11788 : lone_keyword_l_val=.TRUE.)
949 11788 : CALL section_add_keyword(section, keyword)
950 11788 : CALL keyword_release(keyword)
951 :
952 : CALL keyword_create(keyword, __LOCATION__, name="IC_CORR_LIST", &
953 : description="List of image charge correction from a previous calculation to be applied in G0W0 "// &
954 : "or evGW. Keyword is active, if the first entry is positive (since IC corrections are positive "// &
955 : "occupied MOs. The start corresponds to the first corrected GW level.", &
956 : usage="IC_CORR_LIST <REAL> ... <REAL>", &
957 : default_r_vals=[-1.0_dp], &
958 11788 : type_of_var=real_t, n_var=-1, unit_str="eV")
959 11788 : CALL section_add_keyword(section, keyword)
960 11788 : CALL keyword_release(keyword)
961 :
962 : CALL keyword_create(keyword, __LOCATION__, name="IC_CORR_LIST_BETA", &
963 : description="IC_CORR_LIST for beta spins in case of open shell calculation.", &
964 : usage="IC_CORR_LIST_BETA <REAL> ... <REAL>", &
965 : default_r_vals=[-1.0_dp], &
966 11788 : type_of_var=real_t, n_var=-1, unit_str="eV")
967 11788 : CALL section_add_keyword(section, keyword)
968 11788 : CALL keyword_release(keyword)
969 :
970 : CALL keyword_create(keyword, __LOCATION__, name="PERIODIC_CORRECTION", &
971 : description="If true, the periodic correction scheme is used employing k-points. "// &
972 : "Method is not recommended to use, use instead PERIODIC_LOW_SCALING which much "// &
973 : "more accurate than the periodic correction.", &
974 : usage="PERIODIC_CORRECTION", &
975 : default_l_val=.FALSE., &
976 11788 : lone_keyword_l_val=.TRUE.)
977 11788 : CALL section_add_keyword(section, keyword)
978 11788 : CALL keyword_release(keyword)
979 :
980 : CALL keyword_create(keyword, __LOCATION__, name="IMAGE_CHARGE_MODEL", &
981 : variants=["IC"], &
982 : description="If true, an image charge model is applied to mimic the renormalization of "// &
983 : "electronic levels of a molecule at a metallic surface. For this calculation, the molecule "// &
984 : "has to be reflected on the desired xy image plane. The coordinates of the reflected molecule "// &
985 : "have to be added to the coord file as ghost atoms. For the ghost atoms, identical basis sets "// &
986 : "the normal atoms have to be used.", &
987 : usage="IC TRUE", &
988 : default_l_val=.FALSE., &
989 23576 : lone_keyword_l_val=.TRUE.)
990 11788 : CALL section_add_keyword(section, keyword)
991 11788 : CALL keyword_release(keyword)
992 :
993 : CALL keyword_create(keyword, __LOCATION__, name="ANALYTIC_CONTINUATION", &
994 : description="Defines which type of analytic continuation for the self energy is used", &
995 : usage="ANALYTIC_CONTINUATION", &
996 : enum_c_vals=s2a("TWO_POLE", "PADE"), &
997 : enum_i_vals=[gw_two_pole_model, gw_pade_approx], &
998 : enum_desc=s2a("Use 'two-pole' model.", &
999 : "Use Pade approximation."), &
1000 11788 : default_i_val=gw_pade_approx)
1001 11788 : CALL section_add_keyword(section, keyword)
1002 11788 : CALL keyword_release(keyword)
1003 :
1004 : CALL keyword_create(keyword, __LOCATION__, name="NPARAM_PADE", &
1005 : description="Number of parameters for the Pade approximation "// &
1006 : "when using the latter for the analytic continuation of the "// &
1007 : "self energy. 16 parameters (corresponding to 8 poles) are "// &
1008 : "are recommended.", &
1009 : usage="NPARAM_PADE 16", &
1010 11788 : default_i_val=16)
1011 11788 : CALL section_add_keyword(section, keyword)
1012 11788 : CALL keyword_release(keyword)
1013 :
1014 : CALL keyword_create(keyword, __LOCATION__, name="GAMMA_ONLY_SIGMA", &
1015 : variants=["GAMMA"], &
1016 : description="If true, the correlation self-energy is only computed at the Gamma point. "// &
1017 : "The Gamma point itself is obtained by averaging over all kpoints of the DFT mesh.", &
1018 : usage="GAMMA TRUE", &
1019 : default_l_val=.FALSE., &
1020 23576 : lone_keyword_l_val=.TRUE.)
1021 11788 : CALL section_add_keyword(section, keyword)
1022 11788 : CALL keyword_release(keyword)
1023 :
1024 : CALL keyword_create(keyword, __LOCATION__, name="UPDATE_XC_ENERGY", &
1025 : description="If true, the Hartree-Fock and RPA total energy are printed and the total energy "// &
1026 : "is corrected using exact exchange and the RPA correlation energy.", &
1027 : usage="UPDATE_XC_ENERGY", &
1028 : default_l_val=.FALSE., &
1029 11788 : lone_keyword_l_val=.TRUE.)
1030 11788 : CALL section_add_keyword(section, keyword)
1031 11788 : CALL keyword_release(keyword)
1032 :
1033 : CALL keyword_create(keyword, __LOCATION__, name="KPOINTS_SELF_ENERGY", &
1034 : description="Specify number of k-points for the k-point grid of the self-energy. Internally, a "// &
1035 : "Monkhorst-Pack grid is used. A dense k-point grid may be necessary to compute an accurate density "// &
1036 : "of state from GW. Large self-energy k-meshes do not cost much more computation time.", &
1037 : usage="KPOINTS_SELF_ENERGY nx ny nz", repeats=.TRUE., &
1038 11788 : n_var=3, type_of_var=integer_t, default_i_vals=[0, 0, 0])
1039 11788 : CALL section_add_keyword(section, keyword)
1040 11788 : CALL keyword_release(keyword)
1041 :
1042 : CALL keyword_create(keyword, __LOCATION__, name="REGULARIZATION_MINIMAX", &
1043 : description="Tikhonov regularization for computing weights of the Fourier transform "// &
1044 : "from imaginary time to imaginary frequency and vice versa. Needed for large minimax "// &
1045 : "grids with 20 or more points and a small range.", &
1046 : usage="REGULARIZATION_MINIMAX 1.0E-6", &
1047 11788 : default_r_val=0.0_dp)
1048 11788 : CALL section_add_keyword(section, keyword)
1049 11788 : CALL keyword_release(keyword)
1050 :
1051 : CALL keyword_create(keyword, __LOCATION__, name="SOC", &
1052 : description="Calculate the spin-orbit splitting of the eigenvalues/band structure "// &
1053 : "using the spin-orbit part of the GTH pseudos parametrized in Hartwigsen, Goedecker, "// &
1054 : "Hutter, Phys. Rev. B 58, 3641 (1998), Eq. 19, "// &
1055 : "parameters in Table I.", &
1056 : usage="SOC", &
1057 : enum_c_vals=s2a("NONE", "LDA", "PBE"), &
1058 : enum_i_vals=[soc_none, soc_lda, soc_pbe], &
1059 : enum_desc=s2a("No SOC.", &
1060 : "Use parameters from LDA (PADE) pseudopotential.", &
1061 : "Use parameters from PBE pseudopotential."), &
1062 11788 : default_i_val=soc_none)
1063 11788 : CALL section_add_keyword(section, keyword)
1064 11788 : CALL keyword_release(keyword)
1065 :
1066 : CALL keyword_create(keyword, __LOCATION__, name="SOC_ENERGY_WINDOW", &
1067 : description="For perturbative SOC calculation, only "// &
1068 : "take frontier levels in an energy window "// &
1069 : "[E_HOMO - SOC_ENERGY_WINDOW/2 , E_LUMO + SOC_ENERGY_WINDOW/2 "// &
1070 : "into account for the diagonalization of H^GW,SOC.", &
1071 : usage="SOC_ENERGY_WINDOW 20.0_eV", &
1072 : default_r_val=cp_unit_to_cp2k(value=50.0_dp, unit_str="eV"), &
1073 11788 : unit_str="eV")
1074 11788 : CALL section_add_keyword(section, keyword)
1075 11788 : CALL keyword_release(keyword)
1076 :
1077 11788 : CALL create_exact_rpa_diag_section(subsection)
1078 11788 : CALL section_add_subsection(section, subsection)
1079 11788 : CALL section_release(subsection)
1080 :
1081 : ! here we generate a subsection for the periodic GW correction
1082 11788 : CALL create_periodic_gw_correction_section(subsection)
1083 11788 : CALL section_add_subsection(section, subsection)
1084 11788 : CALL section_release(subsection)
1085 :
1086 : ! here we generate a subsection for Bethe-Salpeter
1087 11788 : CALL create_bse_section(subsection, run_bse_from_band_structure_section=.FALSE.)
1088 11788 : CALL section_add_subsection(section, subsection)
1089 11788 : CALL section_release(subsection)
1090 :
1091 : ! here we generate a subsection for image charge calculations
1092 11788 : CALL create_ic_section(subsection)
1093 11788 : CALL section_add_subsection(section, subsection)
1094 11788 : CALL section_release(subsection)
1095 :
1096 : ! here we generate a subsection for calculating the GW band structures
1097 11788 : CALL create_kpoint_set_section(subsection)
1098 11788 : CALL section_add_subsection(section, subsection)
1099 11788 : CALL section_release(subsection)
1100 :
1101 : ! here we generate a subsection for additional printing
1102 11788 : CALL create_print_section(subsection)
1103 11788 : CALL section_add_subsection(section, subsection)
1104 11788 : CALL section_release(subsection)
1105 :
1106 11788 : END SUBROUTINE create_ri_g0w0
1107 :
1108 : ! **************************************************************************************************
1109 : !> \brief Input for GW from direct diagonalization of the full singlet RPA problem.
1110 : ! **************************************************************************************************
1111 11788 : SUBROUTINE create_exact_rpa_diag_section(section)
1112 : TYPE(section_type), POINTER :: section
1113 : TYPE(keyword_type), POINTER :: keyword
1114 :
1115 11788 : NULLIFY (keyword)
1116 : CALL section_create(section, __LOCATION__, name="EXACT_RPA_DIAG", &
1117 : description="Compute GW self-energies by full RPA diagonalization, without analytic continuation. "// &
1118 : "Available for closed-shell molecular, conventional one-shot GW."//CHAR(10)//CHAR(10)// &
1119 : "**RPA excitations.** Indices $i,j$ denote occupied orbitals, $a,b$ virtual orbitals, "// &
1120 : "$P$ an auxiliary RI index, and $\varepsilon_p$ an SCF orbital energy. "// &
1121 : "Coulomb factors satisfy $(pq|rt)\approx\sum_P B_{P,pq}B_{P,rt}$. "// &
1122 : "With $\Delta_{ia}=\varepsilon_a-\varepsilon_i$ and "// &
1123 : "$K_{ia,jb}=\sum_P B_{P,ia}B_{P,jb}$, the singlet RPA matrices are"//CHAR(10)//CHAR(10)// &
1124 : "$$A_{ia,jb}=\Delta_{ia}\delta_{ij}\delta_{ab}+2K_{ia,jb}, "// &
1125 : "\qquad B^{\mathrm{RPA}}_{ia,jb}=2K_{ia,jb}.$$"//CHAR(10)//CHAR(10)// &
1126 : "The symmetric squared RPA matrix is diagonalized:"// &
1127 : CHAR(10)//CHAR(10)// &
1128 : "$$C_{ia,jb}=\sqrt{\Delta_{ia}}(A+B^{\mathrm{RPA}})_{ia,jb}\sqrt{\Delta_{jb}}, "// &
1129 : "\qquad \sum_{jb}C_{ia,jb}U_{jb,s}=\Omega_s^2U_{ia,s}.$$"//CHAR(10)//CHAR(10)// &
1130 : "Here $s$ labels excitations, $\Omega_s>0$, and $U$ has orthonormal columns."//CHAR(10)//CHAR(10)// &
1131 : "**Self-energy.** For output orbital $n$ and intermediate orbital $m$, define "// &
1132 : "$g_{nm,s}=\sqrt{2/\Omega_s}\sum_{P,ia}B_{P,nm}B_{P,ia}\sqrt{\Delta_{ia}}U_{ia,s}$. "// &
1133 : "The retarded correlation self-energy and orbital spectrum are"//CHAR(10)//CHAR(10)// &
1134 : "$$\Sigma_n^{c,R}(\omega)=\sum_{m,s}\frac{g_{nm,s}^2} "// &
1135 : "{\omega-\varepsilon_m+\tau_m\Omega_s+i\eta}, "// &
1136 : "\qquad A_n(\omega)=-\frac1\pi\mathrm{Im} "// &
1137 : "[\omega+i\eta_G-\varepsilon_n-\Delta_n^x-\Sigma_n^{c,R}(\omega)]^{-1}.$$"// &
1138 : CHAR(10)//CHAR(10)// &
1139 : "Here $\tau_m=+1$ for occupied and $-1$ for virtual orbitals, "// &
1140 : "$\Delta_n^x=\langle n|\Sigma_x-v_{xc}|n\rangle$, "// &
1141 : "$\eta$ is BROADENING_ETA and $\eta_G$ is PRINT/GW_DOS/BROADENING. "// &
1142 : "Frequencies are energies ($\hbar=1$). Use PRINT_SELF_ENERGY for orbital files and "// &
1143 : "PRINT/GW_DOS for the frequency grid and summed spectrum. CROSSING_SEARCH selects "// &
1144 : "Z_SHOT or NEWTON for quasiparticle energies.", &
1145 11788 : n_keywords=2, n_subsections=0, repeats=.FALSE.)
1146 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
1147 : description="Use direct full-RPA diagonalization for the GW self-energy.", &
1148 11788 : usage="&EXACT_RPA_DIAG", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1149 11788 : CALL section_add_keyword(section, keyword)
1150 11788 : CALL keyword_release(keyword)
1151 : CALL keyword_create(keyword, __LOCATION__, name="BROADENING_ETA", &
1152 : description="Positive $\eta$ in the retarded self-energy denominators shown above. "// &
1153 : "Smaller values resolve narrower poles and require a finer frequency grid. "// &
1154 : "The Green-function broadening is set separately by PRINT/GW_DOS/BROADENING.", &
1155 : usage="BROADENING_ETA [eV] 0.1", &
1156 11788 : default_r_val=cp_unit_to_cp2k(value=0.1_dp, unit_str="eV"), unit_str="eV")
1157 11788 : CALL section_add_keyword(section, keyword)
1158 11788 : CALL keyword_release(keyword)
1159 :
1160 11788 : END SUBROUTINE create_exact_rpa_diag_section
1161 :
1162 : ! **************************************************************************************************
1163 : !> \brief ...
1164 : !> \param section ...
1165 : ! **************************************************************************************************
1166 11788 : SUBROUTINE create_print_section(section)
1167 : TYPE(section_type), POINTER :: section
1168 :
1169 : TYPE(keyword_type), POINTER :: keyword
1170 : TYPE(section_type), POINTER :: gw_dos_section, print_key
1171 :
1172 11788 : CPASSERT(.NOT. ASSOCIATED(section))
1173 11788 : NULLIFY (print_key, keyword)
1174 11788 : NULLIFY (gw_dos_section, keyword)
1175 : CALL section_create(section, __LOCATION__, name="PRINT", &
1176 : description="Section of possible print options specific for the GW code.", &
1177 11788 : n_keywords=0, n_subsections=2, repeats=.FALSE.)
1178 :
1179 : CALL cp_print_key_section_create(print_key, __LOCATION__, "LOCAL_BANDGAP", &
1180 : description="Prints a local bandgap E_gap(r), derived from the local density of "// &
1181 : "states rho(r,E). Details and formulae in the SI of the periodic GW paper (2023).", &
1182 : print_level=high_print_level, add_last=add_last_numeric, &
1183 : filename="LOCAL_BANDGAP", &
1184 11788 : common_iter_levels=3)
1185 :
1186 : CALL keyword_create(keyword, __LOCATION__, name="ENERGY_WINDOW", &
1187 : description="Energy window in the LDOS for searching the gap.", &
1188 : usage="ENERGY_WINDOW 6.0", &
1189 : default_r_val=cp_unit_to_cp2k(value=6.0_dp, unit_str="eV"), &
1190 11788 : unit_str="eV")
1191 11788 : CALL section_add_keyword(print_key, keyword)
1192 11788 : CALL keyword_release(keyword)
1193 :
1194 : CALL keyword_create(keyword, __LOCATION__, name="ENERGY_SPACING", &
1195 : description="Energy spacing of the LDOS for searching the gap.", &
1196 : usage="ENERGY_SPACING 0.03", &
1197 : default_r_val=cp_unit_to_cp2k(value=0.03_dp, unit_str="eV"), &
1198 11788 : unit_str="eV")
1199 11788 : CALL section_add_keyword(print_key, keyword)
1200 11788 : CALL keyword_release(keyword)
1201 :
1202 : CALL keyword_create(keyword, __LOCATION__, name="LDOS_THRESHOLD_GAP", &
1203 : description="Relative LDOS threshold that determines the local bandgap.", &
1204 : usage="LDOS_THRESHOLD_GAP 0.1", &
1205 11788 : default_r_val=0.1_dp)
1206 11788 : CALL section_add_keyword(print_key, keyword)
1207 11788 : CALL keyword_release(keyword)
1208 :
1209 : CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
1210 : description="The stride (X,Y,Z) used to write the cube file "// &
1211 : "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
1212 : " 1 number valid for all components.", &
1213 11788 : usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
1214 11788 : CALL section_add_keyword(print_key, keyword)
1215 11788 : CALL keyword_release(keyword)
1216 :
1217 11788 : CALL section_add_subsection(section, print_key)
1218 11788 : CALL section_release(print_key)
1219 :
1220 : CALL section_create(gw_dos_section, __LOCATION__, name="GW_DOS", &
1221 : description="Real-frequency grid and orbital selection for GW self-energy and spectral output. "// &
1222 : "A positive STEP writes the summed spectral function to spectral.dat.", &
1223 11788 : n_keywords=6, n_subsections=0, repeats=.FALSE.)
1224 :
1225 : CALL keyword_create(keyword, __LOCATION__, name="LOWER_BOUND", &
1226 : description="Lower real-frequency bound for self-energy and spectral output, in eV.", &
1227 : usage="LOWER_BOUND -20.0", &
1228 : default_r_val=cp_unit_to_cp2k(value=-20.0_dp, unit_str="eV"), &
1229 11788 : unit_str="eV")
1230 11788 : CALL section_add_keyword(gw_dos_section, keyword)
1231 11788 : CALL keyword_release(keyword)
1232 :
1233 : CALL keyword_create(keyword, __LOCATION__, name="UPPER_BOUND", &
1234 : description="Upper real-frequency bound for self-energy and spectral output, in eV. "// &
1235 : "The upper endpoint is excluded.", &
1236 : usage="UPPER_BOUND 5.0", &
1237 : default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="eV"), &
1238 11788 : unit_str="eV")
1239 11788 : CALL section_add_keyword(gw_dos_section, keyword)
1240 11788 : CALL keyword_release(keyword)
1241 :
1242 : CALL keyword_create(keyword, __LOCATION__, name="STEP", &
1243 : description="Spacing of the real-frequency grid. Zero disables the grid; use a positive "// &
1244 : "value for PRINT_SELF_ENERGY or spectral output. Resolve the chosen broadening.", &
1245 : usage="STEP 0.1", &
1246 : default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="eV"), &
1247 11788 : unit_str="eV")
1248 11788 : CALL section_add_keyword(gw_dos_section, keyword)
1249 11788 : CALL keyword_release(keyword)
1250 :
1251 : CALL keyword_create(keyword, __LOCATION__, name="MIN_LEVEL_SPECTRAL", &
1252 : description="Lowest corrected molecular orbital included in the summed spectral function.", &
1253 : usage="MIN_LEVEL_SPECTRAL 3", &
1254 11788 : default_i_val=1)
1255 11788 : CALL section_add_keyword(gw_dos_section, keyword)
1256 11788 : CALL keyword_release(keyword)
1257 :
1258 : CALL keyword_create(keyword, __LOCATION__, name="MAX_LEVEL_SPECTRAL", &
1259 : description="Highest corrected molecular orbital included in the summed spectral function. "// &
1260 : "Zero includes all corrected orbitals.", &
1261 : usage="MAX_LEVEL_SPECTRAL 6", &
1262 11788 : default_i_val=0)
1263 11788 : CALL section_add_keyword(gw_dos_section, keyword)
1264 11788 : CALL keyword_release(keyword)
1265 :
1266 : CALL keyword_create(keyword, __LOCATION__, name="MIN_LEVEL_SELF_ENERGY", &
1267 : description="Lowest corrected molecular orbital selected for self-energy files.", &
1268 : usage="MIN_LEVEL_SELF_ENERGY 3", &
1269 11788 : default_i_val=1)
1270 11788 : CALL section_add_keyword(gw_dos_section, keyword)
1271 11788 : CALL keyword_release(keyword)
1272 :
1273 : CALL keyword_create(keyword, __LOCATION__, name="MAX_LEVEL_SELF_ENERGY", &
1274 : description="Highest corrected molecular orbital selected for self-energy files. A positive "// &
1275 : "value also enables these files without PRINT_SELF_ENERGY. Zero selects all "// &
1276 : "corrected orbitals when PRINT_SELF_ENERGY is enabled.", &
1277 : usage="MAX_LEVEL_SELF_ENERGY 6", &
1278 11788 : default_i_val=0)
1279 11788 : CALL section_add_keyword(gw_dos_section, keyword)
1280 11788 : CALL keyword_release(keyword)
1281 :
1282 : CALL keyword_create(keyword, __LOCATION__, name="BROADENING", &
1283 : description="Nonnegative Green-function broadening $\eta_G$ for the spectral function. "// &
1284 : "For EXACT_RPA_DIAG the total width is $\eta_G-\mathrm{Im}\Sigma_n^{c,R}$. "// &
1285 : "PADE uses $\eta_G+|\mathrm{Im}\Sigma_n^c|$, following the GW_DOS convention.", &
1286 : usage="BROADENING 0.001", &
1287 : default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="eV"), &
1288 11788 : unit_str="eV")
1289 11788 : CALL section_add_keyword(gw_dos_section, keyword)
1290 11788 : CALL keyword_release(keyword)
1291 :
1292 11788 : CALL section_add_subsection(section, gw_dos_section)
1293 11788 : CALL section_release(gw_dos_section)
1294 :
1295 11788 : END SUBROUTINE create_print_section
1296 :
1297 : ! **************************************************************************************************
1298 : !> \brief ...
1299 : !> \param section ...
1300 : ! **************************************************************************************************
1301 11788 : SUBROUTINE create_periodic_gw_correction_section(section)
1302 : TYPE(section_type), POINTER :: section
1303 :
1304 : TYPE(keyword_type), POINTER :: keyword
1305 :
1306 11788 : CPASSERT(.NOT. ASSOCIATED(section))
1307 : CALL section_create(section, __LOCATION__, name="PERIODIC_CORRECTION", &
1308 : description="Parameters influencing correction for periodic GW. Old method, "// &
1309 : "not recommended to use", &
1310 11788 : n_keywords=12, n_subsections=1, repeats=.FALSE.)
1311 :
1312 11788 : NULLIFY (keyword)
1313 :
1314 : CALL keyword_create(keyword, __LOCATION__, name="KPOINTS", &
1315 : description="Specify number of k-points for a single k-point grid. Internally, a "// &
1316 : "Monkhorst-Pack grid is used. Typically, even numbers are chosen such that the Gamma "// &
1317 : "point is excluded from the k-point mesh.", &
1318 : usage="KPOINTS nx ny nz", repeats=.TRUE., &
1319 11788 : n_var=3, type_of_var=integer_t, default_i_vals=[16, 16, 16])
1320 11788 : CALL section_add_keyword(section, keyword)
1321 11788 : CALL keyword_release(keyword)
1322 :
1323 : CALL keyword_create(keyword, __LOCATION__, name="NUM_KP_GRIDS", &
1324 : description="Number of k-point grids around the Gamma point with different resolution. "// &
1325 : "E.g. for KPOINTS 4 4 4 and NUM_KP_GRIDS 3, there will be a 3x3x3 Monkhorst-Pack (MP) k-point "// &
1326 : "grid for the whole Brillouin zone (excluding Gamma), another 3x3x3 MP grid with smaller "// &
1327 : "spacing around Gamma (again excluding Gamma) and a very fine 4x4x4 MP grid around Gamma.", &
1328 : usage="NUM_KP_GRIDS 5", &
1329 11788 : default_i_val=1)
1330 11788 : CALL section_add_keyword(section, keyword)
1331 11788 : CALL keyword_release(keyword)
1332 :
1333 : CALL keyword_create(keyword, __LOCATION__, name="EPS_KPOINT", &
1334 : description="If the absolute value of a k-point is below EPS_KPOINT, this kpoint is "// &
1335 : "neglected since the Gamma point is not included in the periodic correction.", &
1336 : usage="EPS_KPOINT 1.0E-4", &
1337 11788 : default_r_val=1.0E-05_dp)
1338 11788 : CALL section_add_keyword(section, keyword)
1339 11788 : CALL keyword_release(keyword)
1340 :
1341 : CALL keyword_create(keyword, __LOCATION__, name="MO_COEFF_GAMMA", &
1342 : description="If true, only the MO coefficients at the Gamma point are used for the periodic "// &
1343 : "correction. Otherwise, the MO coeffs are computed at every k-point which is much more "// &
1344 : "expensive. It should be okay to use the Gamma MO coefficients.", &
1345 : usage="MO_COEFF_GAMMA", &
1346 : default_l_val=.TRUE., &
1347 11788 : lone_keyword_l_val=.TRUE.)
1348 11788 : CALL section_add_keyword(section, keyword)
1349 11788 : CALL keyword_release(keyword)
1350 :
1351 : CALL keyword_create(keyword, __LOCATION__, name="AVERAGE_DEGENERATE_LEVELS", &
1352 : variants=["ADL"], &
1353 : description="If true, the correlation self-energy of degenerate levels is averaged.", &
1354 : usage="AVERAGE_DEGENERATE_LEVELS", &
1355 : default_l_val=.TRUE., &
1356 23576 : lone_keyword_l_val=.TRUE.)
1357 11788 : CALL section_add_keyword(section, keyword)
1358 11788 : CALL keyword_release(keyword)
1359 :
1360 : CALL keyword_create(keyword, __LOCATION__, name="EPS_EIGENVAL", &
1361 : description="Threshold for considering levels as degenerate. Unit: Hartree.", &
1362 : usage="EPS_EIGENVAL 1.0E-5", &
1363 11788 : default_r_val=2.0E-04_dp)
1364 11788 : CALL section_add_keyword(section, keyword)
1365 11788 : CALL keyword_release(keyword)
1366 :
1367 : CALL keyword_create(keyword, __LOCATION__, name="EXTRAPOLATE_KPOINTS", &
1368 : variants=["EXTRAPOLATE"], &
1369 : description="If true, extrapolates the k-point mesh. Only working if k-point mesh numbers are "// &
1370 : "divisible by 4, e.g. 8x8x8 or 12x12x12 is recommended.", &
1371 : usage="EXTRAPOLATE_KPOINTS FALSE", &
1372 : default_l_val=.TRUE., &
1373 23576 : lone_keyword_l_val=.TRUE.)
1374 11788 : CALL section_add_keyword(section, keyword)
1375 11788 : CALL keyword_release(keyword)
1376 :
1377 : CALL keyword_create(keyword, __LOCATION__, name="DO_AUX_BAS_GW", &
1378 : description="If true, use a different basis for the periodic correction. This can be necessary "// &
1379 : "in case a diffused basis is used for GW to converge the HOMO-LUMO gap. In this case, "// &
1380 : "numerical problems may occur due to diffuse functions in the basis. This keyword only works if "// &
1381 : "AUX_GW <basis set> is specified in the kind section for every atom kind.", &
1382 : usage="DO_AUX_BAS_GW TRUE", &
1383 : default_l_val=.FALSE., &
1384 11788 : lone_keyword_l_val=.TRUE.)
1385 11788 : CALL section_add_keyword(section, keyword)
1386 11788 : CALL keyword_release(keyword)
1387 :
1388 : CALL keyword_create(keyword, __LOCATION__, name="FRACTION_AUX_MOS", &
1389 : description="Fraction how many MOs are used in the auxiliary basis.", &
1390 : usage="FRACTION_AUX_MOS 0.6", &
1391 11788 : default_r_val=0.5_dp)
1392 11788 : CALL section_add_keyword(section, keyword)
1393 11788 : CALL keyword_release(keyword)
1394 :
1395 : CALL keyword_create(keyword, __LOCATION__, name="NUM_OMEGA_POINTS", &
1396 : description="Number of Clenshaw-Curtis integration points for the periodic correction in cubic- "// &
1397 : "scaling GW. This variable is a dummy variable for canonical N^4 GW calculations.", &
1398 : usage="NUM_OMEGA_POINTS 200", &
1399 11788 : default_i_val=300)
1400 11788 : CALL section_add_keyword(section, keyword)
1401 11788 : CALL keyword_release(keyword)
1402 :
1403 11788 : END SUBROUTINE create_periodic_gw_correction_section
1404 :
1405 : ! **************************************************************************************************
1406 : !> \brief The &BSE section, built once under RI_RPA%GW and once under PROPERTIES
1407 : !> \param section the section, created here
1408 : !> \param run_bse_from_band_structure_section .TRUE. for the copy under PROPERTIES, .FALSE. for the one under RI_RPA%GW;
1409 : !> selects the sentence of the description that names the GW behind the section
1410 : ! **************************************************************************************************
1411 13250 : SUBROUTINE create_bse_section(section, run_bse_from_band_structure_section)
1412 : TYPE(section_type), POINTER :: section
1413 : LOGICAL, INTENT(IN) :: run_bse_from_band_structure_section
1414 :
1415 13250 : CHARACTER(LEN=:), ALLOCATABLE :: where_from
1416 : TYPE(keyword_type), POINTER :: keyword
1417 : TYPE(section_type), POINTER :: subsection
1418 :
1419 13250 : CPASSERT(.NOT. ASSOCIATED(section))
1420 13250 : IF (run_bse_from_band_structure_section) THEN
1421 : where_from = "This section runs the BSE on the quasiparticle energies, the static screened "// &
1422 : "interaction and the RI integrals of the low-scaling GW of PROPERTIES%BANDSTRUCTURE%GW "// &
1423 : "(three-center RI integrals in the atomic-orbital basis; \[Wilhelm2021\]), which must be "// &
1424 : "present in the same input and must not use RI_RS; its CUTOFF_RADIUS_RI and RI basis set "// &
1425 : "are convergence parameters of PROPERTIES%BSE as well. "// &
1426 : "The same section under XC%WF_CORRELATION%RI_RPA%GW "// &
1427 : "runs the BSE on the $O(N^4)$-scaling GW of RI_RPA%GW (molecular-orbital basis; "// &
1428 1462 : "\[Wilhelm2016a\]) instead. Both sections treat non-periodic systems only."
1429 : ELSE
1430 : where_from = "This section runs the BSE on the $O(N^4)$-scaling GW of RI_RPA%GW (molecular-orbital "// &
1431 : "basis; \[Wilhelm2016a\]), which provides the quasiparticle energies and the screening. "// &
1432 : "The same section under PROPERTIES runs the BSE on the "// &
1433 : "low-scaling GW of PROPERTIES%BANDSTRUCTURE%GW (three-center RI integrals in the "// &
1434 : "atomic-orbital basis; \[Wilhelm2021\]) instead. Both sections treat non-periodic "// &
1435 11788 : "systems only."
1436 : END IF
1437 : CALL section_create(section, __LOCATION__, name="BSE", &
1438 : description="Parameters for a calculation solving the Bethe-Salpeter equation "// &
1439 : "(BSE) for electronic excitations. The full BSE "// &
1440 : "$\left( \begin{array}{cc}A & B\\B & A\end{array} \right)$ "// &
1441 : "$\left( \begin{array}{cc}\mathbf{X}^{(n)}\\\mathbf{Y}^{(n)}\end{array} \right) = "// &
1442 : "\Omega^{(n)}\left(\begin{array}{cc}1&0\\0&-1\end{array}\right)$ "// &
1443 : "$\left(\begin{array}{cc}\mathbf{X}^{(n)}\\\mathbf{Y}^{(n)}\end{array}\right)$ "// &
1444 : "enables, for example, the computation of electronic excitation energies $\Omega^{(n)}$ "// &
1445 : "as well as optical properties. The BSE can be solved by diagonalizing "// &
1446 : "the full ABBA-matrix or by setting B=0, i.e. within the Tamm-Dancoff approximation (TDA). "// &
1447 : "Reference: Eq. (8) (the full BSE), Eq. (10) (the matrix elements A and B with the "// &
1448 : "singlet and triplet prefactors) and Eq. (18) (TDA) in \[Graml2026\]."// &
1449 : newline//newline//where_from, citations=[Wilhelm2016a, Wilhelm2021, Graml2026], &
1450 53000 : n_keywords=9, n_subsections=4, repeats=.FALSE.)
1451 :
1452 13250 : NULLIFY (keyword)
1453 :
1454 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
1455 : description="Activates BSE calculations.", &
1456 : usage="&BSE .TRUE.", &
1457 13250 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1458 13250 : CALL section_add_keyword(section, keyword)
1459 13250 : CALL keyword_release(keyword)
1460 :
1461 : CALL keyword_create(keyword, __LOCATION__, name="SPIN_CONFIG", &
1462 : description="Choose between calculation of singlet or triplet excitation (cf. given Reference above).", &
1463 : usage="SPIN_CONFIG TRIPLET", &
1464 : enum_c_vals=s2a("SINGLET", "TRIPLET"), &
1465 : enum_i_vals=[bse_singlet, bse_triplet], &
1466 : enum_desc=s2a("Computes singlet excitations.", &
1467 : "Computes triplet excitations."), &
1468 13250 : default_i_val=bse_singlet)
1469 13250 : CALL section_add_keyword(section, keyword)
1470 13250 : CALL keyword_release(keyword)
1471 :
1472 : CALL keyword_create(keyword, __LOCATION__, name="BSE_DIAG_METHOD", &
1473 : description="Method for BSE calculations. "// &
1474 : "Choose between full or iterative diagonalization.", &
1475 : usage="BSE_DIAG_METHOD FULLDIAG", &
1476 : enum_c_vals=s2a("FULLDIAG", "ITERDIAG"), &
1477 : enum_i_vals=[bse_fulldiag, bse_iterdiag], &
1478 : enum_desc=s2a("Fully diagonalizes the BSE matrices within the chosen level of approximation.", &
1479 : "Block Davidson iteration for the lowest NUM_EXC_EN excitations, "// &
1480 : "applying the BSE matrices without forming them; settings in BSE_ITERAT."), &
1481 13250 : default_i_val=bse_fulldiag)
1482 13250 : CALL section_add_keyword(section, keyword)
1483 13250 : CALL keyword_release(keyword)
1484 :
1485 : CALL keyword_create(keyword, __LOCATION__, name="TDA", &
1486 : description="Level of approximation applied to BSE calculations. "// &
1487 : "Choose between Tamm Dancoff approximation (TDA) and/or diagonalization of the full ABBA-matrix.", &
1488 : usage="TDA ON", &
1489 : enum_c_vals=s2a("ON", "OFF", "TDA+ABBA"), &
1490 : enum_i_vals=[bse_tda, bse_abba, bse_both], &
1491 : enum_desc=s2a("The TDA is applied, i.e. B=0.", &
1492 : "The ABBA-matrix is diagonalized, i.e. the TDA is not applied.", &
1493 : "The BSE is solved within the TDA (B=0) as well as for the full ABBA-matrix."), &
1494 13250 : default_i_val=bse_tda)
1495 13250 : CALL section_add_keyword(section, keyword)
1496 13250 : CALL keyword_release(keyword)
1497 :
1498 : CALL keyword_create(keyword, __LOCATION__, name="ENERGY_CUTOFF_OCC", &
1499 : description="Remove all orbitals with indices i,j from A_ia,jb and B_ia,jb with energy difference "// &
1500 : "to HOMO level larger than the given energy cutoff, i.e. "// &
1501 : "$\varepsilon_i\in[\varepsilon_{i=\text{HOMO}}^{DFT}-E_\text{cut}^\text{occ},\varepsilon_{i=\text{HOMO}}^{DFT}]$. "// &
1502 : "The cutoff is applied to the DFT eigenvalues, also when the BSE takes quasiparticle "// &
1503 : "energies from the GW. "// &
1504 : "Can be used to accelerate runtime and reduce memory consumption.", &
1505 : usage="ENERGY_CUTOFF_OCC 10.0", unit_str="eV", &
1506 13250 : type_of_var=real_t, default_r_val=-1.0_dp)
1507 13250 : CALL section_add_keyword(section, keyword)
1508 13250 : CALL keyword_release(keyword)
1509 :
1510 : CALL keyword_create(keyword, __LOCATION__, name="ENERGY_CUTOFF_EMPTY", &
1511 : description="Remove all orbitals with indices a,b from A_ia,jb and B_ia,jb with energy difference "// &
1512 : "to LUMO level larger than the given energy cutoff, i.e. "// &
1513 : "$\varepsilon_a\in[\varepsilon_{a=\text{LUMO}}^{DFT},\varepsilon_{a=\text{LUMO}}^{DFT}+E_\text{cut}^\text{empty}]$. "// &
1514 : "The cutoff is applied to the DFT eigenvalues, also when the BSE takes quasiparticle "// &
1515 : "energies from the GW. "// &
1516 : "Can be used to accelerate runtime and reduce memory consumption.", &
1517 : usage="ENERGY_CUTOFF_EMPTY 10.0", unit_str="eV", &
1518 13250 : type_of_var=real_t, default_r_val=-1.0_dp)
1519 13250 : CALL section_add_keyword(section, keyword)
1520 13250 : CALL keyword_release(keyword)
1521 :
1522 : CALL keyword_create(keyword, __LOCATION__, name="MEMORY_PER_PROC", &
1523 : description="Memory per MPI rank in GB available to the BSE, the counterpart of "// &
1524 : "MEMORY_PER_PROC in the GW section. -1: detected when the BSE first needs it, as the "// &
1525 : "memory the rank holds plus 80 percent of the free memory of the node divided by its "// &
1526 : "ranks. Every memory-heavy step takes what is left after the memory the rank holds "// &
1527 : "at that moment: under PROPERTIES the three-center integrals are transformed in "// &
1528 : "batches of RI atoms that fit, down to one atom per batch; with ITERDIAG the "// &
1529 : "subspace ceiling and the matvec blocks are lowered to fit; with FULLDIAG the "// &
1530 : "memory of the BSE matrices is fixed by the active window, and the run stops before "// &
1531 : "the GW when it does not fit.", &
1532 : usage="MEMORY_PER_PROC 8.0", &
1533 13250 : default_r_val=-1.0_dp)
1534 13250 : CALL section_add_keyword(section, keyword)
1535 13250 : CALL keyword_release(keyword)
1536 :
1537 : CALL keyword_create(keyword, __LOCATION__, name="BSE_DEBUG_PRINT", &
1538 : description="Activates debug print statements in the BSE calculation.", &
1539 : usage="BSE_DEBUG_PRINT .TRUE.", &
1540 13250 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1541 13250 : CALL section_add_keyword(section, keyword)
1542 13250 : CALL keyword_release(keyword)
1543 :
1544 : CALL keyword_create(keyword, __LOCATION__, name="NUM_PRINT_EXC", &
1545 : description="Number of printed excitation levels with respective "// &
1546 : "energies and oscillator strengths. Does not affect computation time.", &
1547 : usage="NUM_PRINT_EXC 25", &
1548 13250 : default_i_val=25)
1549 13250 : CALL section_add_keyword(section, keyword)
1550 13250 : CALL keyword_release(keyword)
1551 :
1552 : CALL keyword_create(keyword, __LOCATION__, name="NUM_PRINT_EXC_DESCR", &
1553 : description="Number of excitation levels for which the exciton "// &
1554 : "descriptors are computed. Negative or too large "// &
1555 : "NUM_PRINT_EXC_DESCR defaults to NUM_PRINT_EXC.", &
1556 : usage="NUM_PRINT_EXC_DESCR 5", &
1557 13250 : default_i_val=0)
1558 13250 : CALL section_add_keyword(section, keyword)
1559 13250 : CALL keyword_release(keyword)
1560 :
1561 : CALL keyword_create(keyword, __LOCATION__, name="PRINT_DIRECTIONAL_EXC_DESCR", &
1562 : description="Activates printing of exciton descriptors per direction.", &
1563 : usage="PRINT_DIRECTIONAL_EXC_DESCR .TRUE.", &
1564 13250 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1565 13250 : CALL section_add_keyword(section, keyword)
1566 13250 : CALL keyword_release(keyword)
1567 :
1568 : CALL keyword_create(keyword, __LOCATION__, name="PRINT_DIRECTIONAL_CROSSCORRELATION", &
1569 : description="Prints the electron-hole crosscorrelation matrix as part of the "// &
1570 : "exciton descriptors per direction. Only active together with "// &
1571 : "PRINT_DIRECTIONAL_EXC_DESCR.", &
1572 : usage="PRINT_DIRECTIONAL_CROSSCORRELATION .FALSE.", &
1573 13250 : default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
1574 13250 : CALL section_add_keyword(section, keyword)
1575 13250 : CALL keyword_release(keyword)
1576 :
1577 : CALL keyword_create(keyword, __LOCATION__, name="EPS_X", &
1578 : description="Threshold for printing contributions of singleparticle "// &
1579 : "transitions, i.e. elements of the eigenvectors $X_{ia}^{(n)}$ and $Y_{ia}^{(n)}$.", &
1580 : usage="EPS_X 0.1", &
1581 13250 : type_of_var=real_t, default_r_val=0.1_dp)
1582 13250 : CALL section_add_keyword(section, keyword)
1583 13250 : CALL keyword_release(keyword)
1584 :
1585 : CALL keyword_create(keyword, __LOCATION__, name="USE_KS_ENERGIES", &
1586 : description="Uses KS energies instead of GW quasiparticle energies.", &
1587 : usage="USE_KS_ENERGIES .TRUE.", &
1588 13250 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1589 13250 : CALL section_add_keyword(section, keyword)
1590 13250 : CALL keyword_release(keyword)
1591 :
1592 13250 : NULLIFY (subsection)
1593 13250 : CALL create_bse_screening_section(subsection)
1594 13250 : CALL section_add_subsection(section, subsection)
1595 13250 : CALL section_release(subsection)
1596 :
1597 13250 : NULLIFY (subsection)
1598 13250 : CALL create_bse_iterat_section(subsection)
1599 13250 : CALL section_add_subsection(section, subsection)
1600 13250 : CALL section_release(subsection)
1601 :
1602 13250 : NULLIFY (subsection)
1603 13250 : CALL create_bse_spectrum_section(subsection)
1604 13250 : CALL section_add_subsection(section, subsection)
1605 13250 : CALL section_release(subsection)
1606 :
1607 13250 : NULLIFY (subsection)
1608 13250 : CALL create_bse_nto_section(subsection)
1609 13250 : CALL section_add_subsection(section, subsection)
1610 13250 : CALL section_release(subsection)
1611 :
1612 13250 : END SUBROUTINE create_bse_section
1613 :
1614 13250 : SUBROUTINE create_bse_screening_section(section)
1615 : TYPE(section_type), POINTER :: section
1616 :
1617 : TYPE(keyword_type), POINTER :: keyword
1618 :
1619 13250 : CPASSERT(.NOT. ASSOCIATED(section))
1620 :
1621 : CALL section_create(section, __LOCATION__, name="SCREENING_IN_W", &
1622 : description="Screening $\epsilon$ applied to $W(\omega=0)=\epsilon^{-1}(\omega=0) v $ "// &
1623 : "in the BSE calculation. Besides default BSE, i.e. $W_0$ (screening with DFT energies), "// &
1624 : "a fixed $\alpha = \epsilon^{-1}(\omega)$ can be applied, which is similar to the mixing "// &
1625 : "parameter for hybrid functionals in LR-TDDFT. In addition, the keywords TDHF "// &
1626 : "(no screening - $\alpha = 1$) and RPA (infinite screening - $\alpha = 0$) can be applied.", &
1627 13250 : n_keywords=2, n_subsections=0, repeats=.FALSE.)
1628 :
1629 13250 : NULLIFY (keyword)
1630 :
1631 : CALL keyword_create( &
1632 : keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
1633 : description="Shortcut for the most common functional combinations.", &
1634 : usage="&xc_functional BLYP", &
1635 : enum_c_vals=s2a("W_0", "TDHF", "RPA", "ALPHA"), &
1636 : enum_i_vals=[bse_screening_w0, bse_screening_tdhf, bse_screening_rpa, bse_screening_alpha], &
1637 : enum_desc=s2a("The Coulomb interaction is screened by applying DFT energies "// &
1638 : "$\varepsilon_p^{DFT}$, which is typically used for GW-BSE and "// &
1639 : "often labeled as $W_0$.", &
1640 : "The Coulomb interaction is not screened, i.e. $W_{pq,rs}(\omega=0) "// &
1641 : "\rightarrow v_{pq,rs}$ enters.", &
1642 : "Infinite screening is applied, i.e. $W_{pq,rs}(\omega=0) \rightarrow 0$.", &
1643 : "Arbitrary screening parameter. Specify within section."), &
1644 : default_i_val=bse_screening_w0, &
1645 13250 : lone_keyword_i_val=bse_screening_w0)
1646 13250 : CALL section_add_keyword(section, keyword)
1647 13250 : CALL keyword_release(keyword)
1648 :
1649 : CALL keyword_create(keyword, __LOCATION__, name="ALPHA", &
1650 : description="Screening parameter similar to the mixing in hybrid functionals used in TDDFT. "// &
1651 : "$\alpha$ mimicks the screening $\epsilon^{-1}(\omega)$ and enforces $W = \alpha v$ "// &
1652 : "in the BSE calculation.", &
1653 : usage="ALPHA 0.25", &
1654 13250 : type_of_var=real_t, default_r_val=-1.00_dp)
1655 13250 : CALL section_add_keyword(section, keyword)
1656 13250 : CALL keyword_release(keyword)
1657 :
1658 13250 : END SUBROUTINE create_bse_screening_section
1659 :
1660 13250 : SUBROUTINE create_bse_nto_section(print_key)
1661 : TYPE(section_type), POINTER :: print_key
1662 :
1663 : TYPE(keyword_type), POINTER :: keyword
1664 :
1665 13250 : CPASSERT(.NOT. ASSOCIATED(print_key))
1666 :
1667 : CALL cp_print_key_section_create(print_key, __LOCATION__, name="NTO_ANALYSIS", &
1668 : description="Perform a natural transition orbital analysis, i.e. the transition density matrix "// &
1669 : "$T^{(n)}=\left( \begin{array}{cc}0& {X}^{(n)}\\ \left({Y}^{(n)} \right)^T & 0\end{array} \right)$ "// &
1670 : "is decomposed into its singular values "// &
1671 : "$T^{(n)} = {U}^{(n)} {\Lambda^{(n)}} \left({V}^{(n)}\right)^T$ "// &
1672 : "in order to compute the NTO pairs "// &
1673 : "$\phi_I^{(n)}(\mathbf{r}_e) = \sum_{p=1}^{N_b} \varphi_p(\mathbf{r}_e) V_{p,I}^{(n)}$ for the electron and "// &
1674 : "$\chi_I^{(n)}(\mathbf{r}_h) = \sum_{q=1}^{N_b} \varphi_q(\mathbf{r}_h) U_{q,I}^{(n)}$ for the hole.", &
1675 : print_level=debug_print_level + 1, & ! Corresponds to "off" as default behavior
1676 13250 : filename="BSE-NTO_ANALYSIS") ! All other print levels will trigger the analysis
1677 : ! cf. input/cp_output_handling.F:cp_print_key_section_create
1678 :
1679 13250 : NULLIFY (keyword)
1680 : CALL keyword_create(keyword, __LOCATION__, name="EPS_NTO_EIGVAL", &
1681 : description="Threshold for NTO eigenvalues, i.e. only "// &
1682 : "${\left(\lambda_I^{(n)}\right)}^2$ > EPS_NTO_EIGVAL are considered.", &
1683 : usage="EPS_NTO_EIGVAL 0.01", &
1684 : n_var=1, &
1685 : type_of_var=real_t, &
1686 13250 : default_r_val=0.01_dp)
1687 13250 : CALL section_add_keyword(print_key, keyword)
1688 13250 : CALL keyword_release(keyword)
1689 :
1690 : CALL keyword_create(keyword, __LOCATION__, name="EPS_OSC_STR", &
1691 : description="Threshold of oscillator strengths $f^{(n)}$ for an excitation level. "// &
1692 : "In case, the excitation level n has a smaller oscillator strength, the "// &
1693 : "NTOs for this excitation level are not printed.", &
1694 : usage="EPS_OSC_STR 0.01", &
1695 : n_var=1, &
1696 : type_of_var=real_t, &
1697 13250 : default_r_val=-1.0_dp)
1698 13250 : CALL section_add_keyword(print_key, keyword)
1699 13250 : CALL keyword_release(keyword)
1700 :
1701 : CALL keyword_create(keyword, __LOCATION__, name="NUM_PRINT_EXC_NTOS", &
1702 : description="Number of excitation level $n$ up to which NTOs are printed. "// &
1703 : "By default, this is set to NUM_PRINT_EXC. Negative or too large "// &
1704 : "NUM_PRINT_EXC_NTOS defaults to NUM_PRINT_EXC.", &
1705 : usage="NUM_PRINT_EXC_NTOS 5", &
1706 : n_var=1, &
1707 : type_of_var=integer_t, &
1708 13250 : default_i_val=-1)
1709 13250 : CALL section_add_keyword(print_key, keyword)
1710 13250 : CALL keyword_release(keyword)
1711 :
1712 : CALL keyword_create(keyword, __LOCATION__, name="STATE_LIST", &
1713 : description="Specifies a list of excitation levels $n$ for which NTOs are printed. "// &
1714 : "Overrides NUM_PRINT_EXC_NTOS.", &
1715 : usage="STATE_LIST {integer} {integer} .. {integer}", &
1716 13250 : n_var=-1, type_of_var=integer_t)
1717 13250 : CALL section_add_keyword(print_key, keyword)
1718 13250 : CALL keyword_release(keyword)
1719 :
1720 : CALL keyword_create(keyword, __LOCATION__, name="CUBE_FILES", &
1721 : description="Print NTOs on Cube Files", &
1722 : usage="CUBE_FILES {logical}", repeats=.FALSE., n_var=1, &
1723 13250 : default_l_val=.TRUE., lone_keyword_l_val=.TRUE., type_of_var=logical_t)
1724 13250 : CALL section_add_keyword(print_key, keyword)
1725 13250 : CALL keyword_release(keyword)
1726 :
1727 : CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
1728 : description="The stride (X,Y,Z) used to write the cube file "// &
1729 : "(larger values result in smaller cube files). Provide 3 numbers (for X,Y,Z) or"// &
1730 : " 1 number valid for all components.", &
1731 13250 : usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
1732 13250 : CALL section_add_keyword(print_key, keyword)
1733 13250 : CALL keyword_release(keyword)
1734 :
1735 : CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
1736 : description="append the cube files when they already exist", &
1737 13250 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1738 13250 : CALL section_add_keyword(print_key, keyword)
1739 13250 : CALL keyword_release(keyword)
1740 :
1741 13250 : END SUBROUTINE create_bse_nto_section
1742 :
1743 13250 : SUBROUTINE create_bse_spectrum_section(section)
1744 : TYPE(section_type), POINTER :: section
1745 :
1746 : TYPE(keyword_type), POINTER :: keyword
1747 :
1748 13250 : CPASSERT(.NOT. ASSOCIATED(section))
1749 : CALL section_create(section, __LOCATION__, name="BSE_SPECTRUM", &
1750 : description="Parameters influencing the output of the optical absorption spectrum, i.e. "// &
1751 : "the dynamical dipole polarizability tensor $\alpha_{\mu,\mu'}(\omega)$ "// &
1752 : "($\mu,\mu'\in\{x,y,z\}$), obtained from a BSE calculation, which is defined as "// &
1753 : "$ \alpha_{\mu,\mu'}(\omega) = \sum_n \frac{2 E^{(n)} d^{(n)}_{\mu} d^{(n)}_{\mu'}} "// &
1754 : "{(\omega+i\eta)^2-\left(\Omega^{(n)}\right)^2} $. "// &
1755 : "The printed file will contain the specified frequency range $\omega$ and the "// &
1756 : "corresponding imaginary part of the average $\bar{\alpha}(\omega)=\frac{1}{3}\mathrm{Tr} "// &
1757 : "\left[ \alpha_{\mu,\mu'}(\omega)\right]$ as well as of the elements of $\alpha_{\mu,\mu'}(\omega)$.", &
1758 13250 : n_keywords=9, n_subsections=0, repeats=.FALSE.)
1759 :
1760 13250 : NULLIFY (keyword)
1761 :
1762 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
1763 : description="Activates printing of optical absorption spectrum from the BSE calculation.", &
1764 : usage="&BSE .TRUE.", &
1765 13250 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1766 13250 : CALL section_add_keyword(section, keyword)
1767 13250 : CALL keyword_release(keyword)
1768 :
1769 : CALL keyword_create(keyword, __LOCATION__, name="FREQUENCY_STEP_SIZE", &
1770 : description="Step size of frequencies for the optical absorption spectrum.", &
1771 : usage="FREQUENCY_STEP_SIZE 0.1", unit_str="eV", &
1772 : type_of_var=real_t, &
1773 13250 : default_r_val=cp_unit_to_cp2k(value=0.1_dp, unit_str="eV"))
1774 13250 : CALL section_add_keyword(section, keyword)
1775 13250 : CALL keyword_release(keyword)
1776 :
1777 : CALL keyword_create(keyword, __LOCATION__, name="FREQUENCY_STARTING_POINT", &
1778 : description="First frequency to print in the optical absorption spectrum.", &
1779 : usage="FREQUENCY_STARTING_POINT 0", unit_str="eV", &
1780 13250 : type_of_var=real_t, default_r_val=0.0_dp)
1781 13250 : CALL section_add_keyword(section, keyword)
1782 13250 : CALL keyword_release(keyword)
1783 :
1784 : CALL keyword_create(keyword, __LOCATION__, name="FREQUENCY_END_POINT", &
1785 : description="Last frequency to print in the optical absorption spectrum.", &
1786 : usage="FREQUENCY_END_POINT 0", unit_str="eV", &
1787 : type_of_var=real_t, &
1788 13250 : default_r_val=cp_unit_to_cp2k(value=100.0_dp, unit_str="eV"))
1789 13250 : CALL section_add_keyword(section, keyword)
1790 13250 : CALL keyword_release(keyword)
1791 :
1792 : CALL keyword_create(keyword, __LOCATION__, name="ETA_LIST", &
1793 : description="List of broadening of the peaks in the optical absorption spectrum.", &
1794 : usage="ETA_LIST 0.01 ...", unit_str="eV", &
1795 : default_r_vals=[cp_unit_to_cp2k(value=0.01_dp, unit_str="eV")], &
1796 26500 : type_of_var=real_t, n_var=-1)
1797 13250 : CALL section_add_keyword(section, keyword)
1798 13250 : CALL keyword_release(keyword)
1799 :
1800 13250 : END SUBROUTINE create_bse_spectrum_section
1801 :
1802 : ! **************************************************************************************************
1803 : !> \brief ...
1804 : !> \param section ...
1805 : ! **************************************************************************************************
1806 13250 : SUBROUTINE create_bse_iterat_section(section)
1807 : TYPE(section_type), POINTER :: section
1808 :
1809 : TYPE(keyword_type), POINTER :: keyword
1810 :
1811 13250 : CPASSERT(.NOT. ASSOCIATED(section))
1812 : CALL section_create(section, __LOCATION__, name="BSE_ITERAT", &
1813 : description="Parameters of the iterative (block Davidson) solution of the "// &
1814 : "Bethe-Salpeter equation for the lowest excitations, which is invoked by "// &
1815 : "BSE_DIAG_METHOD ITERDIAG.", &
1816 13250 : n_keywords=8, n_subsections=0, repeats=.FALSE.)
1817 :
1818 13250 : NULLIFY (keyword)
1819 :
1820 : CALL keyword_create(keyword, __LOCATION__, name="NUM_EXC_EN", &
1821 : description="Number of lowest excitation energies computed and printed. "// &
1822 : "The absorption spectrum of BSE_SPECTRUM sums over these states only.", &
1823 : usage="NUM_EXC_EN 10", &
1824 13250 : default_i_val=10)
1825 13250 : CALL section_add_keyword(section, keyword)
1826 13250 : CALL keyword_release(keyword)
1827 :
1828 : CALL keyword_create(keyword, __LOCATION__, name="NUM_BUFFER_STATES", &
1829 : description="States carried above NUM_EXC_EN so that a degenerate group at the "// &
1830 : "upper boundary converges as a whole. They are not printed and need not converge.", &
1831 : usage="NUM_BUFFER_STATES 4", &
1832 13250 : default_i_val=4)
1833 13250 : CALL section_add_keyword(section, keyword)
1834 13250 : CALL keyword_release(keyword)
1835 :
1836 : CALL keyword_create(keyword, __LOCATION__, name="NUM_GUESS_TRANSITIONS", &
1837 : description="Number of transitions with the lowest diagonal on which A (and B) "// &
1838 : "are built exactly and diagonalized for the initial guess. Its eigenvalues bound "// &
1839 : "the true energies from above and are checked against the converged ones. "// &
1840 : "0: unit vectors on the lowest diagonal entries. The default is large because "// &
1841 : "the block is cheap against the solver's iterations and a large block also seeds "// &
1842 : "excitations built from transitions far up the diagonal ordering. Memory: the "// &
1843 : "square of this number in doubles per MPI rank.", &
1844 : usage="NUM_GUESS_TRANSITIONS 512", &
1845 13250 : default_i_val=512)
1846 13250 : CALL section_add_keyword(section, keyword)
1847 13250 : CALL keyword_release(keyword)
1848 :
1849 : CALL keyword_create(keyword, __LOCATION__, name="BLOCK_SIZE", &
1850 : description="Maximum number of correction vectors (and kernel applications) "// &
1851 : "added to the subspace per iteration. -1: 32, or the number of tracked states "// &
1852 : "if fewer. Measured on a 200-state nanographene: 32 within 5 % of the best "// &
1853 : "width, 8 twice as slow.", &
1854 : usage="BLOCK_SIZE 8", &
1855 13250 : default_i_val=-1)
1856 13250 : CALL section_add_keyword(section, keyword)
1857 13250 : CALL keyword_release(keyword)
1858 :
1859 : CALL keyword_create(keyword, __LOCATION__, name="MAX_SUBSPACE_FACTOR", &
1860 : description="Subspace ceiling in units of (NUM_EXC_EN+NUM_BUFFER_STATES) before a "// &
1861 : "thick restart, lowered to what MEMORY_PER_PROC of the BSE section leaves; -1 starts "// &
1862 : "from 20.", &
1863 : usage="MAX_SUBSPACE_FACTOR 5", &
1864 13250 : default_i_val=10)
1865 13250 : CALL section_add_keyword(section, keyword)
1866 13250 : CALL keyword_release(keyword)
1867 :
1868 : CALL keyword_create(keyword, __LOCATION__, name="MATVEC_BLOCK_COLUMNS", &
1869 : description="Trial vectors the kernel applies per pass. The replicated work "// &
1870 : "arrays of one pass are n_arrays*N_ov*MATVEC_BLOCK_COLUMNS doubles, n_arrays 3 for "// &
1871 : "the TDA and 4 otherwise. Never more than the columns of the call. Measured: flat "// &
1872 : "from 8 to 64, up to 28x slower in the gather at 128 and above. -1: as many as "// &
1873 : "the memory MEMORY_PER_PROC of the BSE section leaves allows.", &
1874 : usage="MATVEC_BLOCK_COLUMNS 32", &
1875 13250 : default_i_val=32)
1876 13250 : CALL section_add_keyword(section, keyword)
1877 13250 : CALL keyword_release(keyword)
1878 :
1879 : CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
1880 : description="Maximum number of Davidson iterations. The calculation aborts if it "// &
1881 : "is reached before convergence.", &
1882 : usage="MAX_ITER 100", &
1883 13250 : default_i_val=100)
1884 13250 : CALL section_add_keyword(section, keyword)
1885 13250 : CALL keyword_release(keyword)
1886 :
1887 : CALL keyword_create(keyword, __LOCATION__, name="CONVERGENCE_CRITERION", &
1888 : description="Which of EPS_ENERGY (change of each excitation energy between "// &
1889 : "iterations) and EPS_RES (residual norm of each state) must hold.", &
1890 : usage="CONVERGENCE_CRITERION AND", &
1891 : enum_c_vals=s2a("EN", "RES", "OR", "AND"), &
1892 : enum_i_vals=[bse_iter_en_cond, bse_iter_res_cond, bse_iter_or_cond, &
1893 : bse_iter_and_cond], &
1894 : enum_desc=s2a("The energy criterion EPS_ENERGY has to hold.", &
1895 : "The residual criterion EPS_RES has to hold.", &
1896 : "One of the two criteria has to hold.", &
1897 : "Both criteria have to hold."), &
1898 13250 : default_i_val=bse_iter_and_cond)
1899 13250 : CALL section_add_keyword(section, keyword)
1900 13250 : CALL keyword_release(keyword)
1901 :
1902 : CALL keyword_create(keyword, __LOCATION__, name="EPS_RES", &
1903 : description="Threshold on the Euclidean residual norm of every requested state "// &
1904 : "(atomic units). Controls the eigenvector accuracy and thereby oscillator "// &
1905 : "strengths and descriptors.", &
1906 : usage="EPS_RES 1.0E-6", &
1907 13250 : type_of_var=real_t, default_r_val=1.0E-6_dp)
1908 13250 : CALL section_add_keyword(section, keyword)
1909 13250 : CALL keyword_release(keyword)
1910 :
1911 : CALL keyword_create(keyword, __LOCATION__, name="EPS_ENERGY", &
1912 : description="Threshold on the change of every requested excitation energy "// &
1913 : "between two iterations.", &
1914 : usage="EPS_ENERGY 1.0E-6", unit_str="eV", &
1915 : type_of_var=real_t, &
1916 13250 : default_r_val=cp_unit_to_cp2k(value=1.0E-6_dp, unit_str="eV"))
1917 13250 : CALL section_add_keyword(section, keyword)
1918 13250 : CALL keyword_release(keyword)
1919 :
1920 : CALL keyword_create(keyword, __LOCATION__, name="PRECONDITIONER", &
1921 : description="Diagonal used in the Davidson correction: the diagonal of A "// &
1922 : "including the kernel, or the bare quasiparticle energy differences.", &
1923 : usage="PRECONDITIONER FULL_DIAGONAL", &
1924 : enum_c_vals=s2a("FULL_DIAGONAL", "QP_DIFFERENCE"), &
1925 : enum_i_vals=[bse_precond_full_diag, bse_precond_qp_diff], &
1926 : enum_desc=s2a("Diagonal of A including the exchange and the screened term.", &
1927 : "Quasiparticle energy differences."), &
1928 13250 : default_i_val=bse_precond_full_diag)
1929 13250 : CALL section_add_keyword(section, keyword)
1930 13250 : CALL keyword_release(keyword)
1931 :
1932 : CALL keyword_create(keyword, __LOCATION__, name="ABBA_SOLVER", &
1933 : description="Paired solver beyond the TDA: block Davidson on (A+B)(A-B) in the "// &
1934 : "(A-B) inner product, or the paired-subspace Davidson of Olsen and Stratmann. "// &
1935 : "No automatic fallback between the two.", &
1936 : usage="ABBA_SOLVER MK_DAVIDSON", &
1937 : enum_c_vals=s2a("MK_DAVIDSON", "OLSEN_STRATMANN"), &
1938 : enum_i_vals=[bse_abba_mk_davidson, bse_abba_olsen_stratmann], &
1939 : enum_desc=s2a("Block Davidson on (A+B)(A-B) in the (A-B) inner product.", &
1940 : "Paired-subspace Davidson of Olsen and Stratmann."), &
1941 13250 : default_i_val=bse_abba_mk_davidson)
1942 13250 : CALL section_add_keyword(section, keyword)
1943 13250 : CALL keyword_release(keyword)
1944 13250 : END SUBROUTINE create_bse_iterat_section
1945 :
1946 : ! **************************************************************************************************
1947 : !> \brief ...
1948 : !> \param section ...
1949 : ! **************************************************************************************************
1950 11788 : SUBROUTINE create_ic_section(section)
1951 : TYPE(section_type), POINTER :: section
1952 :
1953 : TYPE(keyword_type), POINTER :: keyword
1954 :
1955 11788 : CPASSERT(.NOT. ASSOCIATED(section))
1956 : CALL section_create(section, __LOCATION__, name="IC", &
1957 : description="Parameters influencing the image charge correction. "// &
1958 : "The image plane is always an xy plane, so adjust the molecule according "// &
1959 : "to that. ", &
1960 11788 : n_keywords=3, n_subsections=1, repeats=.FALSE.)
1961 :
1962 11788 : NULLIFY (keyword)
1963 :
1964 : CALL keyword_create(keyword, __LOCATION__, name="PRINT_IC_LIST", &
1965 : description="If true, the image charge correction values are printed in a list, "// &
1966 : "such that it can be used as input for a subsequent evGW calculation.", &
1967 : usage="PRINT_IC_LIST .TRUE.", &
1968 : default_l_val=.FALSE., &
1969 11788 : lone_keyword_l_val=.TRUE.)
1970 11788 : CALL section_add_keyword(section, keyword)
1971 11788 : CALL keyword_release(keyword)
1972 :
1973 : CALL keyword_create(keyword, __LOCATION__, name="EPS_DIST", &
1974 : description="Threshold where molecule and image molecule have to coincide. ", &
1975 : usage="EPS_DIST 0.1", unit_str="angstrom", &
1976 11788 : type_of_var=real_t, default_r_val=3.0E-02_dp, repeats=.FALSE.)
1977 11788 : CALL section_add_keyword(section, keyword)
1978 11788 : CALL keyword_release(keyword)
1979 :
1980 11788 : END SUBROUTINE create_ic_section
1981 :
1982 : ! **************************************************************************************************
1983 : !> \brief ...
1984 : !> \param section ...
1985 : ! **************************************************************************************************
1986 11788 : SUBROUTINE create_low_scaling(section)
1987 : TYPE(section_type), POINTER :: section
1988 :
1989 : TYPE(keyword_type), POINTER :: keyword
1990 : TYPE(section_type), POINTER :: subsection
1991 :
1992 11788 : CPASSERT(.NOT. ASSOCIATED(section))
1993 : CALL section_create( &
1994 : section, __LOCATION__, name="LOW_SCALING", &
1995 : description="Cubic scaling RI-RPA, GW and Laplace-SOS-MP2 method using the imaginary time formalism. "// &
1996 : "EPS_GRID in WFC_GPW section controls accuracy / req. memory for 3-center integrals. "// &
1997 : "SORT_BASIS EXP should be specified in DFT section.", &
1998 : n_keywords=12, n_subsections=2, repeats=.FALSE., &
1999 47152 : citations=[Wilhelm2016b, Wilhelm2018, Bussy2023])
2000 :
2001 11788 : NULLIFY (keyword)
2002 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
2003 : description="Activates cubic-scaling RPA, GW and Laplace-SOS-MP2 calculations.", &
2004 : usage="&LOW_SCALING .TRUE.", &
2005 11788 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
2006 11788 : CALL section_add_keyword(section, keyword)
2007 11788 : CALL keyword_release(keyword)
2008 :
2009 : CALL keyword_create(keyword, __LOCATION__, name="MEMORY_CUT", &
2010 : description="Reduces memory for sparse tensor contractions by this factor. "// &
2011 : "A high value leads to some loss of performance. "// &
2012 : "This memory reduction factor applies to storage of the tensors 'M occ' / 'M virt' "// &
2013 : "but does not reduce storage of '3c ints'.", &
2014 : usage="MEMORY_CUT 16", &
2015 11788 : default_i_val=5)
2016 11788 : CALL section_add_keyword(section, keyword)
2017 11788 : CALL keyword_release(keyword)
2018 :
2019 : CALL keyword_create(keyword, __LOCATION__, name="MEMORY_INFO", &
2020 : description="Decide whether to print memory info on the sparse matrices.", &
2021 : usage="MEMORY_INFO", &
2022 : default_l_val=.FALSE., &
2023 11788 : lone_keyword_l_val=.TRUE.)
2024 11788 : CALL section_add_keyword(section, keyword)
2025 11788 : CALL keyword_release(keyword)
2026 :
2027 : CALL keyword_create( &
2028 : keyword, __LOCATION__, name="EPS_FILTER", &
2029 : description="Determines a threshold for the DBCSR based multiply. "// &
2030 : "Normally, this EPS_FILTER determines accuracy and timing of low-scaling RPA and GW calculations.", &
2031 : usage="EPS_FILTER 1.0E-10 ", type_of_var=real_t, &
2032 11788 : default_r_val=1.0E-9_dp)
2033 11788 : CALL section_add_keyword(section, keyword)
2034 11788 : CALL keyword_release(keyword)
2035 :
2036 : CALL keyword_create( &
2037 : keyword, __LOCATION__, name="EPS_FILTER_FACTOR", &
2038 : description="Multiply EPS_FILTER with this factor to determine filter epsilon "// &
2039 : "for DBCSR based multiply P(it)=(Mocc(it))^T*Mvirt(it) "// &
2040 : "Default should be kept.", &
2041 : type_of_var=real_t, &
2042 11788 : default_r_val=10.0_dp)
2043 11788 : CALL section_add_keyword(section, keyword)
2044 11788 : CALL keyword_release(keyword)
2045 :
2046 : CALL keyword_create( &
2047 : keyword, __LOCATION__, &
2048 : name="EPS_STORAGE_SCALING", &
2049 : variants=["EPS_STORAGE"], &
2050 : description="Scaling factor to scale EPS_FILTER. Storage threshold for compression "// &
2051 : "will be EPS_FILTER*EPS_STORAGE_SCALING.", &
2052 23576 : default_r_val=1.0E-3_dp)
2053 11788 : CALL section_add_keyword(section, keyword)
2054 11788 : CALL keyword_release(keyword)
2055 :
2056 : CALL keyword_create( &
2057 : keyword, __LOCATION__, &
2058 : name="DO_KPOINTS", &
2059 : description="Besides in DFT, this keyword has to be switched on if one wants to do kpoints in. "// &
2060 : "cubic RPA.", &
2061 : usage="DO_KPOINTS", &
2062 : default_l_val=.FALSE., &
2063 11788 : lone_keyword_l_val=.TRUE.)
2064 11788 : CALL section_add_keyword(section, keyword)
2065 11788 : CALL keyword_release(keyword)
2066 :
2067 : CALL keyword_create( &
2068 : keyword, __LOCATION__, name="KPOINTS", &
2069 : description="Keyword activates periodic, low-scaling GW calculations (&LOW_SCALING section also needed). "// &
2070 : "For periodic calculations, kpoints are used for the density response, the "// &
2071 : "Coulomb interaction and the screened Coulomb interaction. For 2d periodic systems, e.g. xz "// &
2072 : "periodicity, please also specify KPOINTS, e.g. N_x 1 N_z.", &
2073 : usage="KPOINTS N_x N_y N_z", &
2074 11788 : n_var=3, type_of_var=integer_t, default_i_vals=[0, 0, 0])
2075 11788 : CALL section_add_keyword(section, keyword)
2076 11788 : CALL keyword_release(keyword)
2077 :
2078 : CALL keyword_create( &
2079 : keyword, __LOCATION__, &
2080 : name="KPOINT_WEIGHTS_W", &
2081 : description="For kpoints in low-scaling GW, a Monkhorst-Pack mesh is used. The screened Coulomb "// &
2082 : "interaction W(k) needs special care near the Gamma point (e.g. in 3d, W(k) diverges at the "// &
2083 : "Gamma point with W(k) ~ k^alpha). KPOINT_WEIGHTS_W decides how the weights of the "// &
2084 : "Monkhorst-Pack mesh are chosen to compute W(R) = int_BZ W(k) exp(ikR) dk (BZ=Brllouin zone). ", &
2085 : usage="KPOINT_WEIGHTS_W AUTO", &
2086 : enum_c_vals=s2a("TAILORED", "AUTO", "UNIFORM"), &
2087 : enum_i_vals=[kp_weights_W_tailored, kp_weights_W_auto, kp_weights_W_uniform], &
2088 : enum_desc=s2a("Choose k-point integration weights such that the function f(k)=k^alpha is "// &
2089 : "exactly integrated. alpha is specified using EXPONENT_TAILORED_WEIGHTS.", &
2090 : "As 'TAILORED', but alpha is chosen automatically according to dimensionality "// &
2091 : "(3D: alpha = -2 for 3D, 2D: alpha = -1 for exchange self-energy, uniform "// &
2092 : "weights for correlation self-energy).", &
2093 : "Choose the same weight for every k-point (original Monkhorst-Pack method)."), &
2094 11788 : default_i_val=kp_weights_W_uniform)
2095 11788 : CALL section_add_keyword(section, keyword)
2096 11788 : CALL keyword_release(keyword)
2097 :
2098 : CALL keyword_create( &
2099 : keyword, __LOCATION__, &
2100 : name="EXPONENT_TAILORED_WEIGHTS", &
2101 : description="Gives the exponent of exactly integrated function in case 'KPOINT_WEIGHTS_W "// &
2102 : "TAILORED' is chosen.", &
2103 : usage="EXPONENT_TAILORED_WEIGHTS -2", &
2104 11788 : default_r_val=-2.0_dp)
2105 11788 : CALL section_add_keyword(section, keyword)
2106 11788 : CALL keyword_release(keyword)
2107 :
2108 : CALL keyword_create( &
2109 : keyword, __LOCATION__, &
2110 : name="REGULARIZATION_RI", &
2111 : description="Parameter to reduce the expansion coefficients in RI for periodic GW. Larger parameter "// &
2112 : "means smaller expansion coefficients that leads to a more stable calculation at the price "// &
2113 : "of a slightly worse RI approximation. In case the parameter 0.0 is chosen, ordinary RI is used.", &
2114 : usage="REGULARIZATION_RI 1.0E-4", &
2115 11788 : default_r_val=0.0_dp)
2116 11788 : CALL section_add_keyword(section, keyword)
2117 11788 : CALL keyword_release(keyword)
2118 :
2119 : CALL keyword_create( &
2120 : keyword, __LOCATION__, &
2121 : name="EPS_EIGVAL_S", &
2122 : description="Parameter to reduce the expansion coefficients in RI for periodic GW. Removes all "// &
2123 : "eigenvectors and eigenvalues of S_PQ(k) that are smaller than EPS_EIGVAL_S. ", &
2124 : usage="EPS_EIGVAL_S 1.0E-3", &
2125 11788 : default_r_val=0.0_dp)
2126 11788 : CALL section_add_keyword(section, keyword)
2127 11788 : CALL keyword_release(keyword)
2128 :
2129 : CALL keyword_create( &
2130 : keyword, __LOCATION__, &
2131 : name="EPS_EIGVAL_S_GAMMA", &
2132 : description="Parameter to reduce the expansion coefficients in RI for periodic GW. Removes all "// &
2133 : "eigenvectors and eigenvalues of M_PQ(k=0) that are smaller than EPS_EIGVAL_S. ", &
2134 : usage="EPS_EIGVAL_S_GAMMA 1.0E-3", &
2135 11788 : default_r_val=0.0_dp)
2136 11788 : CALL section_add_keyword(section, keyword)
2137 11788 : CALL keyword_release(keyword)
2138 :
2139 : CALL keyword_create( &
2140 : keyword, __LOCATION__, &
2141 : name="MAKE_CHI_POS_DEFINITE", &
2142 : description="If true, makes eigenvalue decomposition of chi(iw,k) and removes negative "// &
2143 : "eigenvalues. May increase computational cost significantly. Only recommended to try in case "// &
2144 : "Cholesky decomposition of epsilon(iw,k) fails.", &
2145 : usage="MAKE_CHI_POS_DEFINITE", &
2146 : default_l_val=.TRUE., &
2147 11788 : lone_keyword_l_val=.TRUE.)
2148 11788 : CALL section_add_keyword(section, keyword)
2149 11788 : CALL keyword_release(keyword)
2150 :
2151 : CALL keyword_create( &
2152 : keyword, __LOCATION__, &
2153 : name="MAKE_OVERLAP_MAT_AO_POS_DEFINITE", &
2154 : description="If true, makes eigenvalue decomposition of S_mu,nu(k) and removes negative "// &
2155 : "eigenvalues. Slightly increases computational cost. Only recommended to try in case "// &
2156 : "Cholesky decomposition of S_mu,nu(k) fails (error message: Cholesky decompose failed: "// &
2157 : "matrix is not positive definite or ill-conditioned; when calling create_kp_and_calc_kp_orbitals).", &
2158 : usage="MAKE_OVERLAP_MAT_AO_POS_DEFINITE", &
2159 : default_l_val=.FALSE., &
2160 11788 : lone_keyword_l_val=.TRUE.)
2161 11788 : CALL section_add_keyword(section, keyword)
2162 11788 : CALL keyword_release(keyword)
2163 :
2164 : CALL keyword_create( &
2165 : keyword, __LOCATION__, &
2166 : name="DO_EXTRAPOLATE_KPOINTS", &
2167 : description="If true, use a larger k-mesh to extrapolate the k-point integration of W. "// &
2168 : "For example, in 2D, when using KPOINTS 4 4 1, an additional 6x6x1 mesh will be used to "// &
2169 : "extrapolate the k-point integration of W with N_k^-0.5, where Nk is the number of k-points.", &
2170 : usage="DO_EXTRAPOLATE_KPOINTS FALSE", &
2171 : default_l_val=.TRUE., &
2172 11788 : lone_keyword_l_val=.TRUE.)
2173 11788 : CALL section_add_keyword(section, keyword)
2174 11788 : CALL keyword_release(keyword)
2175 :
2176 : CALL keyword_create( &
2177 : keyword, __LOCATION__, &
2178 : name="TRUNC_COULOMB_RI_X", &
2179 : description="If true, use the truncated Coulomb operator for the exchange-self-energy in "// &
2180 : "periodic GW.", &
2181 : usage="TRUNC_COULOMB_RI_X", &
2182 : default_l_val=.TRUE., &
2183 11788 : lone_keyword_l_val=.TRUE.)
2184 11788 : CALL section_add_keyword(section, keyword)
2185 11788 : CALL keyword_release(keyword)
2186 :
2187 : CALL keyword_create( &
2188 : keyword, __LOCATION__, &
2189 : name="REL_CUTOFF_TRUNC_COULOMB_RI_X", &
2190 : description="Only active in case TRUNC_COULOMB_RI_X = True. Normally, relative cutoff = 0.5 is "// &
2191 : "good choice; still needs to be evaluated for RI schemes. ", &
2192 : usage="REL_CUTOFF_TRUNC_COULOMB_RI_X 0.3", &
2193 11788 : default_r_val=0.5_dp)
2194 11788 : CALL section_add_keyword(section, keyword)
2195 11788 : CALL keyword_release(keyword)
2196 :
2197 : CALL keyword_create( &
2198 : keyword, __LOCATION__, &
2199 : name="KEEP_QUADRATURE", &
2200 : variants=s2a("KEEP_WEIGHTS", "KEEP_QUAD", "KEEP_WEIGHT"), &
2201 : description="Keep the Laplace quadrature defined at the first energy evaluations throughout "// &
2202 : "the run. Allows to have consistent force evaluations.", &
2203 : usage="KEEP_QUADRATURE", &
2204 : default_l_val=.TRUE., &
2205 11788 : lone_keyword_l_val=.TRUE.)
2206 11788 : CALL section_add_keyword(section, keyword)
2207 11788 : CALL keyword_release(keyword)
2208 :
2209 : CALL keyword_create( &
2210 : keyword, __LOCATION__, &
2211 : name="K_MESH_G_FACTOR", &
2212 : description="The k-mesh for the Green's function can be chosen to be larger than the k-mesh for "// &
2213 : "W (without much higher computational cost). The factor given here multiplies the mesh for W to obtain "// &
2214 : "the k-mesh for G. Example: factor 4, k-mesh for W: 4x4x1 -> k-mesh for G: 16x16x1 (z-dir. is "// &
2215 : "non-periodic).", &
2216 11788 : default_i_val=1)
2217 11788 : CALL section_add_keyword(section, keyword)
2218 11788 : CALL keyword_release(keyword)
2219 :
2220 : CALL keyword_create( &
2221 : keyword, __LOCATION__, &
2222 : name="MIN_BLOCK_SIZE", &
2223 : description="Minimum tensor block size. Adjusting this value may have minor effect on "// &
2224 : "performance but default should be good enough.", &
2225 11788 : default_i_val=5)
2226 11788 : CALL section_add_keyword(section, keyword)
2227 11788 : CALL keyword_release(keyword)
2228 :
2229 : CALL keyword_create( &
2230 : keyword, __LOCATION__, &
2231 : name="MIN_BLOCK_SIZE_MO", &
2232 : description="Tensor block size for MOs. Only relevant for GW calculations. "// &
2233 : "The memory consumption of GW scales as O(MIN_BLOCK_SIZE_MO). It is recommended to "// &
2234 : "set this parameter to a smaller number if GW runs out of memory. "// &
2235 : "Otherwise the default should not be changed.", &
2236 11788 : default_i_val=64)
2237 11788 : CALL section_add_keyword(section, keyword)
2238 11788 : CALL keyword_release(keyword)
2239 :
2240 11788 : NULLIFY (subsection)
2241 11788 : CALL create_low_scaling_cphf(subsection)
2242 11788 : CALL section_add_subsection(section, subsection)
2243 11788 : CALL section_release(subsection)
2244 :
2245 11788 : END SUBROUTINE create_low_scaling
2246 :
2247 : ! **************************************************************************************************
2248 : !> \brief ...
2249 : !> \param section ...
2250 : ! **************************************************************************************************
2251 11788 : SUBROUTINE create_wfc_gpw(section)
2252 : TYPE(section_type), POINTER :: section
2253 :
2254 : TYPE(keyword_type), POINTER :: keyword
2255 :
2256 11788 : CPASSERT(.NOT. ASSOCIATED(section))
2257 : CALL section_create(section, __LOCATION__, name="WFC_GPW", &
2258 : description="Parameters for the GPW approach in Wavefunction-based Correlation methods", &
2259 11788 : n_keywords=5, n_subsections=0, repeats=.FALSE.)
2260 :
2261 11788 : NULLIFY (keyword)
2262 : CALL keyword_create(keyword, __LOCATION__, name="EPS_GRID", &
2263 : description="Determines a threshold for the GPW based integration", &
2264 : usage="EPS_GRID 1.0E-9 ", type_of_var=real_t, &
2265 11788 : default_r_val=1.0E-8_dp)
2266 11788 : CALL section_add_keyword(section, keyword)
2267 11788 : CALL keyword_release(keyword)
2268 :
2269 : CALL keyword_create( &
2270 : keyword, __LOCATION__, name="EPS_FILTER", &
2271 : description="Determines a threshold for the DBCSR based multiply (usually 10 times smaller than EPS_GRID). "// &
2272 : "Normally, this EPS_FILTER determines accuracy and timing of cubic-scaling RPA calculation.", &
2273 : usage="EPS_FILTER 1.0E-10 ", type_of_var=real_t, &
2274 11788 : default_r_val=1.0E-9_dp)
2275 11788 : CALL section_add_keyword(section, keyword)
2276 11788 : CALL keyword_release(keyword)
2277 :
2278 : CALL keyword_create(keyword, __LOCATION__, name="CUTOFF", &
2279 : description="The cutoff of the finest grid level in the MP2 gpw integration.", &
2280 : usage="CUTOFF 300", type_of_var=real_t, &
2281 11788 : default_r_val=300.0_dp)
2282 11788 : CALL section_add_keyword(section, keyword)
2283 11788 : CALL keyword_release(keyword)
2284 :
2285 : CALL keyword_create(keyword, __LOCATION__, name="REL_CUTOFF", &
2286 : variants=["RELATIVE_CUTOFF"], &
2287 : description="Determines the grid at which a Gaussian is mapped.", &
2288 : usage="REL_CUTOFF 50", type_of_var=real_t, &
2289 23576 : default_r_val=50.0_dp)
2290 11788 : CALL section_add_keyword(section, keyword)
2291 11788 : CALL keyword_release(keyword)
2292 :
2293 : CALL keyword_create(keyword, __LOCATION__, name="PRINT_LEVEL", &
2294 : variants=["IOLEVEL"], &
2295 : description="How much output is written by the individual groups.", &
2296 : usage="PRINT_LEVEL HIGH", &
2297 : default_i_val=silent_print_level, enum_c_vals= &
2298 : s2a("SILENT", "LOW", "MEDIUM", "HIGH", "DEBUG"), &
2299 : enum_desc=s2a("Almost no output", &
2300 : "Little output", "Quite some output", "Lots of output", &
2301 : "Everything is written out, useful for debugging purposes only"), &
2302 : enum_i_vals=[silent_print_level, low_print_level, medium_print_level, &
2303 23576 : high_print_level, debug_print_level])
2304 11788 : CALL section_add_keyword(section, keyword)
2305 11788 : CALL keyword_release(keyword)
2306 :
2307 : CALL keyword_create( &
2308 : keyword, __LOCATION__, name="EPS_PGF_ORB_S", &
2309 : description="Screening for overlap matrix in RI. Usually, it is best to choose this parameter "// &
2310 : "to be very small since the inversion of overlap matrix might be ill-conditioned.", &
2311 : usage="EPS_PGF_ORB_S 1.0E-10 ", type_of_var=real_t, &
2312 11788 : default_r_val=1.0E-10_dp)
2313 11788 : CALL section_add_keyword(section, keyword)
2314 11788 : CALL keyword_release(keyword)
2315 :
2316 11788 : END SUBROUTINE create_wfc_gpw
2317 :
2318 : ! **************************************************************************************************
2319 : !> \brief ...
2320 : !> \param section ...
2321 : ! **************************************************************************************************
2322 11788 : SUBROUTINE create_cphf(section)
2323 : TYPE(section_type), POINTER :: section
2324 :
2325 : TYPE(keyword_type), POINTER :: keyword
2326 :
2327 11788 : CPASSERT(.NOT. ASSOCIATED(section))
2328 : CALL section_create( &
2329 : section, __LOCATION__, name="CPHF", &
2330 : description="Parameters influencing the solution of the Z-vector equations in MP2 gradients calculations.", &
2331 : n_keywords=2, n_subsections=0, repeats=.FALSE., &
2332 23576 : citations=[DelBen2013])
2333 :
2334 11788 : NULLIFY (keyword)
2335 :
2336 : CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
2337 : variants=["MAX_NUM_ITER"], &
2338 : description="Maximum number of iterations allowed for the solution of the Z-vector equations.", &
2339 : usage="MAX_ITER 50", &
2340 23576 : default_i_val=30)
2341 11788 : CALL section_add_keyword(section, keyword)
2342 11788 : CALL keyword_release(keyword)
2343 :
2344 : CALL keyword_create(keyword, __LOCATION__, name="RESTART_EVERY", &
2345 : description="Restart iteration every given number of steps.", &
2346 : usage="RESTART_EVERY 5", &
2347 11788 : default_i_val=5)
2348 11788 : CALL section_add_keyword(section, keyword)
2349 11788 : CALL keyword_release(keyword)
2350 :
2351 : CALL keyword_create(keyword, __LOCATION__, name="SOLVER_METHOD", &
2352 : description="Chose solver of the z-vector equations.", &
2353 : usage="SOLVER_METHOD POPLE", enum_c_vals= &
2354 : s2a("POPLE", "CG", "RICHARDSON", "SD"), &
2355 : enum_desc=s2a("Pople's method (Default).", &
2356 : "Conjugated gradient method (equivalent to Pople).", &
2357 : "Richardson iteration", &
2358 : "Steepest Descent iteration"), &
2359 : enum_i_vals=[z_solver_pople, z_solver_cg, z_solver_richardson, z_solver_sd], &
2360 11788 : default_i_val=z_solver_pople)
2361 11788 : CALL section_add_keyword(section, keyword)
2362 11788 : CALL keyword_release(keyword)
2363 :
2364 : CALL keyword_create(keyword, __LOCATION__, name="EPS_CONV", &
2365 : description="Convergence threshold for the solution of the Z-vector equations. "// &
2366 : "The Z-vector equations have the form of a linear system of equations Ax=b, "// &
2367 : "convergence is achieved when |Ax-b|<=EPS_CONV.", &
2368 : usage="EPS_CONV 1.0E-6", type_of_var=real_t, &
2369 11788 : default_r_val=1.0E-4_dp)
2370 11788 : CALL section_add_keyword(section, keyword)
2371 11788 : CALL keyword_release(keyword)
2372 :
2373 : CALL keyword_create(keyword, __LOCATION__, name="SCALE_STEP_SIZE", &
2374 : description="Scaling factor of each step.", &
2375 : usage="SCALE_STEP_SIZE 1.0", &
2376 11788 : default_r_val=1.0_dp)
2377 11788 : CALL section_add_keyword(section, keyword)
2378 11788 : CALL keyword_release(keyword)
2379 :
2380 : CALL keyword_create(keyword, __LOCATION__, name="ENFORCE_DECREASE", &
2381 : description="Restarts if residual does not decrease.", &
2382 : usage="ENFORCE_DECREASE T", &
2383 : lone_keyword_l_val=.TRUE., &
2384 11788 : default_l_val=.FALSE.)
2385 11788 : CALL section_add_keyword(section, keyword)
2386 11788 : CALL keyword_release(keyword)
2387 :
2388 : CALL keyword_create(keyword, __LOCATION__, name="DO_POLAK_RIBIERE", &
2389 : description="Use a Polak-Ribiere update of the search vector in CG instead of the Fletcher "// &
2390 : "Reeves update. Improves the convergence with modified step sizes. "// &
2391 : "Ignored with other methods than CG.", &
2392 : usage="DO_POLAK_RIBIERE T", &
2393 : lone_keyword_l_val=.TRUE., &
2394 11788 : default_l_val=.FALSE.)
2395 11788 : CALL section_add_keyword(section, keyword)
2396 11788 : CALL keyword_release(keyword)
2397 :
2398 : CALL keyword_create(keyword, __LOCATION__, name="RECALC_RESIDUAL", &
2399 : description="Recalculates residual in every step.", &
2400 : usage="RECALC_RESIDUAL T", &
2401 : lone_keyword_l_val=.TRUE., &
2402 11788 : default_l_val=.FALSE.)
2403 11788 : CALL section_add_keyword(section, keyword)
2404 11788 : CALL keyword_release(keyword)
2405 :
2406 11788 : END SUBROUTINE create_cphf
2407 :
2408 : ! **************************************************************************************************
2409 : !> \brief ...
2410 : !> \param section ...
2411 : ! **************************************************************************************************
2412 11788 : SUBROUTINE create_low_scaling_cphf(section)
2413 : TYPE(section_type), POINTER :: section
2414 :
2415 : TYPE(keyword_type), POINTER :: keyword
2416 :
2417 11788 : NULLIFY (keyword)
2418 :
2419 11788 : CPASSERT(.NOT. ASSOCIATED(section))
2420 : CALL section_create(section, __LOCATION__, name="CPHF", &
2421 : description="Parameters influencing the solution of the Z-vector equations "// &
2422 : "in low-scaling Laplace-SOS-MP2 gradients calculations.", &
2423 11788 : n_keywords=5, n_subsections=0, repeats=.FALSE.)
2424 :
2425 : CALL keyword_create(keyword, __LOCATION__, name="EPS_CONV", &
2426 : description="Target accuracy for Z-vector euation solution.", &
2427 11788 : usage="EPS_CONV 1.e-6", default_r_val=1.e-6_dp)
2428 11788 : CALL section_add_keyword(section, keyword)
2429 11788 : CALL keyword_release(keyword)
2430 :
2431 : CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
2432 : description="Maximum number of conjugate gradient iteration to be performed for one optimization.", &
2433 11788 : usage="MAX_ITER 200", default_i_val=50)
2434 11788 : CALL section_add_keyword(section, keyword)
2435 11788 : CALL keyword_release(keyword)
2436 :
2437 : CALL keyword_create( &
2438 : keyword, __LOCATION__, name="PRECONDITIONER", &
2439 : description="Type of preconditioner to be used with all minimization schemes. "// &
2440 : "They differ in effectiveness, cost of construction, cost of application. "// &
2441 : "Properly preconditioned minimization can be orders of magnitude faster than doing nothing.", &
2442 : usage="PRECONDITIONER FULL_ALL", &
2443 : default_i_val=ot_precond_full_all, &
2444 : enum_c_vals=s2a("FULL_ALL", "FULL_SINGLE_INVERSE", "FULL_SINGLE", "FULL_KINETIC", "FULL_S_INVERSE", &
2445 : "NONE"), &
2446 : enum_desc=s2a("Most effective state selective preconditioner based on diagonalization, "// &
2447 : "requires the ENERGY_GAP parameter to be an underestimate of the HOMO-LUMO gap. "// &
2448 : "This preconditioner is recommended for almost all systems, except very large systems where "// &
2449 : "make_preconditioner would dominate the total computational cost.", &
2450 : "Based on H-eS cholesky inversion, similar to FULL_SINGLE in preconditioning efficiency "// &
2451 : "but cheaper to construct, "// &
2452 : "might be somewhat less robust. Recommended for large systems.", &
2453 : "Based on H-eS diagonalisation, not as good as FULL_ALL, but somewhat cheaper to apply. ", &
2454 : "Cholesky inversion of S and T, fast construction, robust, and relatively good, "// &
2455 : "use for very large systems.", &
2456 : "Cholesky inversion of S, not as good as FULL_KINETIC, yet equally expensive.", &
2457 : "skip preconditioning"), &
2458 : enum_i_vals=[ot_precond_full_all, ot_precond_full_single_inverse, ot_precond_full_single, &
2459 11788 : ot_precond_full_kinetic, ot_precond_s_inverse, ot_precond_none])
2460 11788 : CALL section_add_keyword(section, keyword)
2461 11788 : CALL keyword_release(keyword)
2462 :
2463 : CALL keyword_create(keyword, __LOCATION__, name="ENERGY_GAP", &
2464 : description="Energy gap estimate [a.u.] for preconditioning", &
2465 : usage="ENERGY_GAP 0.1", &
2466 11788 : default_r_val=0.2_dp)
2467 11788 : CALL section_add_keyword(section, keyword)
2468 11788 : CALL keyword_release(keyword)
2469 :
2470 11788 : END SUBROUTINE create_low_scaling_cphf
2471 :
2472 : ! **************************************************************************************************
2473 : !> \brief ...
2474 : !> \param section ...
2475 : ! **************************************************************************************************
2476 11788 : SUBROUTINE create_mp2_potential(section)
2477 : TYPE(section_type), POINTER :: section
2478 :
2479 : TYPE(keyword_type), POINTER :: keyword
2480 :
2481 11788 : CPASSERT(.NOT. ASSOCIATED(section))
2482 : CALL section_create(section, __LOCATION__, name="INTERACTION_POTENTIAL", &
2483 : description="Parameters the interaction potential in computing the biel integrals", &
2484 11788 : n_keywords=4, n_subsections=0, repeats=.FALSE.)
2485 :
2486 11788 : NULLIFY (keyword)
2487 : CALL keyword_create( &
2488 : keyword, __LOCATION__, &
2489 : name="POTENTIAL_TYPE", &
2490 : description="Which interaction potential should be used "// &
2491 : "(Coulomb, TShPSC operator).", &
2492 : usage="POTENTIAL_TYPE TSHPSC", &
2493 : enum_c_vals=s2a("COULOMB", "TShPSC", "LONGRANGE", "SHORTRANGE", "TRUNCATED", "MIX_CL", "IDENTITY"), &
2494 : enum_i_vals=[do_potential_coulomb, &
2495 : do_potential_TShPSC, &
2496 : do_potential_long, &
2497 : do_potential_short, &
2498 : do_potential_truncated, &
2499 : do_potential_mix_cl, &
2500 : do_potential_id], &
2501 : enum_desc=s2a("Coulomb potential: 1/r", &
2502 : "| Range | TShPSC |"//newline// &
2503 : "| ----- | ------ |"//newline// &
2504 : "| $ x \leq R_c $ | $ 1/x - s/R_c $ |"//newline// &
2505 : "| $ R_c < x \leq nR_c $ | "// &
2506 : "$ (1 - s)/R_c - (x - R_c)/R_c^2 + (x - R_c)^2/R_c^3 - "// &
2507 : "(2n^2 - 7n + 9 - 4s)(x - R_c)^3/(R_c^4(n^2 - 2n + 1)(n - 1)) + "// &
2508 : "(6-3s - 4n + n^2)(x - R_c)^4/(R_c^5(n^4 - 4n^3 + 6n^2 - 4n + 1)) $ "// &
2509 : "(4th order polynomial) | "//newline// &
2510 : "| $ x > nR_c $ | $ 0 $ | "//newline, &
2511 : "Longrange Coulomb potential: $ \operatorname{erf}(wr)/r $", &
2512 : "Shortrange Coulomb potential: $ \operatorname{erfc}(wr)/r $", &
2513 : "Truncated Coulomb potential", &
2514 : "Mixed Coulomb/Longrange Coulomb potential", &
2515 : "Delta potential"), &
2516 11788 : default_i_val=do_potential_coulomb)
2517 11788 : CALL section_add_keyword(section, keyword)
2518 11788 : CALL keyword_release(keyword)
2519 :
2520 : CALL keyword_create(keyword, __LOCATION__, name="TRUNCATION_RADIUS", &
2521 : variants=["CUTOFF_RADIUS"], &
2522 : description="Determines truncation radius for the truncated potentials. "// &
2523 : "Only valid when doing truncated calculations", &
2524 : usage="TRUNCATION_RADIUS 10.0", type_of_var=real_t, &
2525 : default_r_val=10.0_dp, &
2526 23576 : unit_str="angstrom")
2527 11788 : CALL section_add_keyword(section, keyword)
2528 11788 : CALL keyword_release(keyword)
2529 :
2530 : CALL keyword_create( &
2531 : keyword, __LOCATION__, &
2532 : name="POTENTIAL_DATA", &
2533 : variants=s2a("TShPSC_DATA", "T_C_G_DATA"), &
2534 : description="Location of the file TShPSC.dat or t_c_g.dat that contains the data for the "// &
2535 : "evaluation of the evaluation of the truncated potentials", &
2536 : usage="TShPSC_DATA t_sh_p_s_c.dat", &
2537 11788 : default_c_val="t_sh_p_s_c.dat")
2538 11788 : CALL section_add_keyword(section, keyword)
2539 11788 : CALL keyword_release(keyword)
2540 :
2541 : CALL keyword_create( &
2542 : keyword, __LOCATION__, &
2543 : name="OMEGA", &
2544 : description="Range separation parameter for the longrange or shortrange potential. "// &
2545 : "Only valid when longrange or shortrange potential is requested.", &
2546 : usage="OMEGA 0.5", type_of_var=real_t, &
2547 11788 : default_r_val=0.5_dp)
2548 11788 : CALL section_add_keyword(section, keyword)
2549 11788 : CALL keyword_release(keyword)
2550 :
2551 : CALL keyword_create( &
2552 : keyword, __LOCATION__, &
2553 : name="SCALE_COULOMB", &
2554 : description="Scaling factor of (truncated) Coulomb potential in mixed (truncated) Coulomb/Longrange potential. "// &
2555 : "Only valid when mixed potential is requested.", &
2556 : usage="SCALE_COULOMB 0.5", type_of_var=real_t, &
2557 11788 : default_r_val=1.0_dp)
2558 11788 : CALL section_add_keyword(section, keyword)
2559 11788 : CALL keyword_release(keyword)
2560 :
2561 : CALL keyword_create( &
2562 : keyword, __LOCATION__, &
2563 : name="SCALE_LONGRANGE", &
2564 : description="Scaling factor of longrange Coulomb potential in mixed (truncated) Coulomb/Longrange potential. "// &
2565 : "Only valid when mixed potential is requested.", &
2566 : usage="SCALE_LONGRANGE 0.5", type_of_var=real_t, &
2567 11788 : default_r_val=1.0_dp)
2568 11788 : CALL section_add_keyword(section, keyword)
2569 11788 : CALL keyword_release(keyword)
2570 :
2571 11788 : END SUBROUTINE create_mp2_potential
2572 :
2573 : ! **************************************************************************************************
2574 : !> \brief ...
2575 : !> \param section ...
2576 : ! **************************************************************************************************
2577 11788 : SUBROUTINE create_ri_section(section)
2578 : TYPE(section_type), POINTER :: section
2579 :
2580 : TYPE(keyword_type), POINTER :: keyword
2581 : TYPE(section_type), POINTER :: subsection
2582 :
2583 11788 : CPASSERT(.NOT. ASSOCIATED(section))
2584 : CALL section_create(section, __LOCATION__, name="RI", &
2585 : description="Parameters influencing resolution of the identity (RI) that is "// &
2586 : "used in RI-MP2, RI-RPA, RI-SOS-MP2 and GW (inside RI-RPA).", &
2587 11788 : n_keywords=6, n_subsections=2, repeats=.FALSE.)
2588 :
2589 11788 : NULLIFY (subsection)
2590 11788 : CALL create_RI_metric_section(subsection)
2591 11788 : CALL section_add_subsection(section, subsection)
2592 11788 : CALL section_release(subsection)
2593 :
2594 11788 : CALL create_opt_ri_basis(subsection)
2595 11788 : CALL section_add_subsection(section, subsection)
2596 11788 : CALL section_release(subsection)
2597 :
2598 11788 : NULLIFY (keyword)
2599 : CALL keyword_create( &
2600 : keyword, __LOCATION__, &
2601 : name="ROW_BLOCK", &
2602 : variants=["ROW_BLOCK_SIZE"], &
2603 : description="Size of the row block used in the SCALAPACK block cyclic data distribution. "// &
2604 : "Default is (ROW_BLOCK=-1) is automatic. "// &
2605 : "A proper choice can speedup the parallel matrix multiplication in the case of RI-RPA and RI-SOS-MP2-Laplace.", &
2606 : usage="ROW_BLOCK 512", &
2607 23576 : default_i_val=-1)
2608 11788 : CALL section_add_keyword(section, keyword)
2609 11788 : CALL keyword_release(keyword)
2610 :
2611 : CALL keyword_create( &
2612 : keyword, __LOCATION__, &
2613 : name="COL_BLOCK", &
2614 : variants=["COL_BLOCK_SIZE"], &
2615 : description="Size of the column block used in the SCALAPACK block cyclic data distribution. "// &
2616 : "Default is (COL_BLOCK=-1) is automatic. "// &
2617 : "A proper choice can speedup the parallel matrix multiplication in the case of RI-RPA and RI-SOS-MP2-Laplace.", &
2618 : usage="COL_BLOCK 512", &
2619 23576 : default_i_val=-1)
2620 11788 : CALL section_add_keyword(section, keyword)
2621 11788 : CALL keyword_release(keyword)
2622 :
2623 : CALL keyword_create( &
2624 : keyword, __LOCATION__, &
2625 : name="CALC_COND_NUM", &
2626 : variants=["CALC_CONDITION_NUMBER"], &
2627 : description="Calculate the condition number of the (P|Q) matrix for the RI methods.", &
2628 : usage="CALC_COND_NUM", &
2629 : default_l_val=.FALSE., &
2630 23576 : lone_keyword_l_val=.TRUE.)
2631 11788 : CALL section_add_keyword(section, keyword)
2632 11788 : CALL keyword_release(keyword)
2633 :
2634 : CALL keyword_create(keyword, __LOCATION__, name="DO_SVD", &
2635 : description="Wether to perform a singular value decomposition instead of the Cholesky decomposition "// &
2636 : "of the potential operator in the RI basis. Computationally expensive but numerically more stable. "// &
2637 : "It reduces the computational costs of some subsequent steps. Recommended when a longrange Coulomb "// &
2638 : "potential is employed.", &
2639 : usage="DO_SVD .TRUE.", &
2640 11788 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
2641 11788 : CALL section_add_keyword(section, keyword)
2642 11788 : CALL keyword_release(keyword)
2643 :
2644 : CALL keyword_create(keyword, __LOCATION__, name="EPS_SVD", &
2645 : description="Determines the upper bound of eigenvectors to be removed during the SVD (see DO_SVD).", &
2646 : usage="EPS_SVD 1E-5", &
2647 11788 : default_r_val=0.0_dp)
2648 11788 : CALL section_add_keyword(section, keyword)
2649 11788 : CALL keyword_release(keyword)
2650 :
2651 : CALL keyword_create(keyword, __LOCATION__, name="ERI_BLKSIZE", &
2652 : description="block sizes for tensors (only used if ERI_METHOD=MME). First value "// &
2653 : "is the block size for ORB basis, second value is the block size for RI_AUX basis.", &
2654 : usage="ERI_BLKSIZE", &
2655 : n_var=2, &
2656 11788 : default_i_vals=[4, 16])
2657 11788 : CALL section_add_keyword(section, keyword)
2658 11788 : CALL keyword_release(keyword)
2659 :
2660 11788 : END SUBROUTINE create_ri_section
2661 :
2662 : ! **************************************************************************************************
2663 : !> \brief ...
2664 : !> \param section ...
2665 : ! **************************************************************************************************
2666 11788 : SUBROUTINE create_integrals_section(section)
2667 : TYPE(section_type), POINTER :: section
2668 :
2669 : TYPE(keyword_type), POINTER :: keyword
2670 : TYPE(section_type), POINTER :: subsection
2671 :
2672 11788 : CPASSERT(.NOT. ASSOCIATED(section))
2673 : CALL section_create(section, __LOCATION__, name="INTEGRALS", &
2674 : description="Parameters controlling how to compute integrals that are needed "// &
2675 : "in MP2, RI-MP2, RI-RPA, RI-SOS-MP2 and GW (inside RI-RPA).", &
2676 11788 : n_keywords=2, n_subsections=3, repeats=.FALSE.)
2677 :
2678 11788 : NULLIFY (subsection)
2679 11788 : CALL create_eri_mme_section(subsection)
2680 11788 : CALL section_add_subsection(section, subsection)
2681 11788 : CALL section_release(subsection)
2682 :
2683 11788 : CALL create_wfc_gpw(subsection)
2684 11788 : CALL section_add_subsection(section, subsection)
2685 11788 : CALL section_release(subsection)
2686 :
2687 11788 : CALL create_mp2_potential(subsection)
2688 11788 : CALL section_add_subsection(section, subsection)
2689 11788 : CALL section_release(subsection)
2690 :
2691 11788 : NULLIFY (keyword)
2692 : CALL keyword_create(keyword, __LOCATION__, name="ERI_METHOD", &
2693 : description="Method for calculating periodic electron repulsion integrals "// &
2694 : "(MME method is faster but experimental, forces not yet implemented). "// &
2695 : "Obara-Saika (OS) for the Coulomb operator can only be used for non-periodic calculations.", &
2696 : usage="ERI_METHOD MME", &
2697 : enum_c_vals=s2a("DEFAULT", "GPW", "MME", "OS"), &
2698 : enum_i_vals=[eri_default, do_eri_gpw, do_eri_mme, do_eri_os], &
2699 : enum_desc=s2a("Use default ERI method (for periodic systems: GPW, for molecules: OS, "// &
2700 : "for MP2 and RI-MP2: GPW in any case).", &
2701 : "Uses Gaussian Plane Wave method [DelBen2013].", &
2702 : "Uses MiniMax-Ewald method (experimental, ERI_MME subsection, only for fully periodic "// &
2703 : "systems with orthorhombic cells).", &
2704 : "Use analytical Obara-Saika method."), &
2705 11788 : default_i_val=eri_default)
2706 11788 : CALL section_add_keyword(section, keyword)
2707 11788 : CALL keyword_release(keyword)
2708 :
2709 : CALL keyword_create(keyword, __LOCATION__, name="SIZE_LATTICE_SUM", &
2710 : description="Size of sum range L. ", &
2711 : usage="SIZE_LATTICE_SUM 10", &
2712 11788 : default_i_val=5)
2713 11788 : CALL section_add_keyword(section, keyword)
2714 11788 : CALL keyword_release(keyword)
2715 :
2716 11788 : END SUBROUTINE create_integrals_section
2717 :
2718 : ! **************************************************************************************************
2719 : !> \brief ...
2720 : !> \param section ...
2721 : ! **************************************************************************************************
2722 11788 : SUBROUTINE create_RI_metric_section(section)
2723 : TYPE(section_type), POINTER :: section
2724 :
2725 : TYPE(keyword_type), POINTER :: keyword
2726 :
2727 11788 : CPASSERT(.NOT. ASSOCIATED(section))
2728 : CALL section_create(section, __LOCATION__, name="RI_METRIC", &
2729 : description="Sets up RI metric", &
2730 11788 : repeats=.FALSE.)
2731 :
2732 11788 : NULLIFY (keyword)
2733 : CALL keyword_create( &
2734 : keyword, __LOCATION__, &
2735 : name="POTENTIAL_TYPE", &
2736 : description="Decides which operator/metric is used for resolution of the identity (RI).", &
2737 : usage="POTENTIAL_TYPE DEFAULT", &
2738 : enum_c_vals=s2a("DEFAULT", "COULOMB", "IDENTITY", "LONGRANGE", "SHORTRANGE", "TRUNCATED"), &
2739 : enum_i_vals=[ri_default, do_potential_coulomb, do_potential_id, do_potential_long, &
2740 : do_potential_short, do_potential_truncated], &
2741 : enum_desc=s2a("Use Coulomb metric for RI-MP2 and normal-scaling RI-SOS-MP2, RI-RPA and GW. "// &
2742 : "Use Overlap metric for low-scaling RI-SOS-MP2, RI-RPA and GW for periodic systems. "// &
2743 : "Use truncated Coulomb metric for low-scaling RI-SOS-MP2, RI-RPA and GW for non-periodic systems.", &
2744 : "Coulomb metric: 1/r. Recommended for RI-MP2,", &
2745 : "Overlap metric: delta(r).", &
2746 : "Longrange metric: erf(omega*r)/r. Not recommended with DO_SVD .TRUE.", &
2747 : "Shortrange metric: erfc(omega*r)/r", &
2748 : "Truncated Coulomb metric: if (r < R_c) 1/r else 0. More "// &
2749 : "accurate than IDENTITY for non-periodic systems. Recommended for low-scaling methods."), &
2750 11788 : default_i_val=ri_default)
2751 11788 : CALL section_add_keyword(section, keyword)
2752 11788 : CALL keyword_release(keyword)
2753 :
2754 11788 : NULLIFY (keyword)
2755 : CALL keyword_create( &
2756 : keyword, __LOCATION__, &
2757 : name="OMEGA", &
2758 : description="The range parameter for the short/long range operator (in 1/a0).", &
2759 : usage="OMEGA 0.5", &
2760 11788 : default_r_val=0.0_dp)
2761 11788 : CALL section_add_keyword(section, keyword)
2762 11788 : CALL keyword_release(keyword)
2763 :
2764 : CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
2765 : description="The cutoff radius (in Angstrom) for the truncated Coulomb operator.", &
2766 : usage="CUTOFF_RADIUS 3.0", default_r_val=cp_unit_to_cp2k(value=3.0_dp, unit_str="angstrom"), &
2767 11788 : type_of_var=real_t, unit_str="angstrom")
2768 11788 : CALL section_add_keyword(section, keyword)
2769 11788 : CALL keyword_release(keyword)
2770 :
2771 : CALL keyword_create( &
2772 : keyword, __LOCATION__, &
2773 : name="T_C_G_DATA", &
2774 : description="Location of the file t_c_g.dat that contains the data for the "// &
2775 : "evaluation of the truncated gamma function ", &
2776 11788 : default_c_val="t_c_g.dat")
2777 11788 : CALL section_add_keyword(section, keyword)
2778 11788 : CALL keyword_release(keyword)
2779 :
2780 : CALL keyword_create(keyword, __LOCATION__, name="EPS_RANGE", &
2781 : description="The threshold to determine the effective range of the short range "// &
2782 : "RI metric: erfc(omega*eff_range)/eff_range = EPS_RANGE", &
2783 : default_r_val=1.0E-08_dp, &
2784 11788 : repeats=.FALSE.)
2785 11788 : CALL section_add_keyword(section, keyword)
2786 11788 : CALL keyword_release(keyword)
2787 :
2788 11788 : END SUBROUTINE create_RI_metric_section
2789 :
2790 : END MODULE input_cp2k_mp2
|