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