LCOV - code coverage report
Current view: top level - src - input_cp2k_properties_dft.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:5c1df3d) Lines: 99.9 % 1161 1160
Test Date: 2026-09-14 06:34:43 Functions: 100.0 % 27 27

            Line data    Source code
       1              : !--------------------------------------------------------------------------------------------------!
       2              : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3              : !   Copyright 2000-2026 CP2K developers group <https://cp2k.org>                                   !
       4              : !                                                                                                  !
       5              : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6              : !--------------------------------------------------------------------------------------------------!
       7              : 
       8              : ! **************************************************************************************************
       9              : !> \brief function that build the dft section of the input
      10              : !> \par History
      11              : !>      01.2013 moved out of input_cp2k_dft [MI]
      12              : !> \author MI
      13              : ! **************************************************************************************************
      14              : MODULE input_cp2k_properties_dft
      15              :    USE bibliography, ONLY: Futera2017, &
      16              :                            Hanasaki2025, &
      17              :                            Hernandez2025, &
      18              :                            Iannuzzi2005, &
      19              :                            Kondov2007, &
      20              :                            KuhneHeskeProdan2020, &
      21              :                            Luber2014, &
      22              :                            Putrino2000, &
      23              :                            Putrino2002, &
      24              :                            Sebastiani2001, &
      25              :                            Weber2009, &
      26              :                            VazdaCruz2021
      27              :    USE cp_output_handling, ONLY: add_last_numeric, &
      28              :                                  cp_print_key_section_create, &
      29              :                                  debug_print_level, &
      30              :                                  high_print_level, &
      31              :                                  low_print_level, &
      32              :                                  medium_print_level, &
      33              :                                  silent_print_level
      34              :    USE cp_units, ONLY: cp_unit_to_cp2k
      35              :    USE input_constants, ONLY: &
      36              :       current_gauge_atom, current_gauge_r, current_gauge_r_and_step_func, &
      37              :       current_orb_center_atom, current_orb_center_box, current_orb_center_common, &
      38              :       current_orb_center_wannier, do_et_ddapc, do_full_density, do_no_et, do_spin_density, &
      39              :       evGW0, G0W0, &
      40              :       gto_cartesian, gto_spherical, int_ldos_none, int_ldos_x, int_ldos_y, int_ldos_z, oe_gllb, &
      41              :       oe_lb, oe_none, oe_saop, oe_shift, ot_precond_full_all, ot_precond_full_kinetic, &
      42              :       ot_precond_full_single, ot_precond_full_single_inverse, ot_precond_none, &
      43              :       ot_precond_s_inverse, scan_x, scan_xy, scan_xyz, scan_xz, scan_y, scan_yz, scan_z, &
      44              :       tddfpt_dipole_berry, tddfpt_dipole_length, tddfpt_dipole_scf_moment, &
      45              :       tddfpt_dipole_velocity, tddfpt_dipole_velocity_old, tddfpt_kernel_full, tddfpt_kernel_none, &
      46              :       tddfpt_kernel_stda, no_sf_tddfpt, tddfpt_sf_col, tddfpt_sf_noncol, use_mom_ref_coac, &
      47              :       use_mom_ref_com, use_mom_ref_user, use_mom_ref_zero
      48              :    USE input_cp2k_atprop, ONLY: create_atprop_section
      49              :    USE input_cp2k_dft, ONLY: create_interp_section, &
      50              :                              create_mgrid_section
      51              :    USE input_cp2k_qs, ONLY: create_ddapc_restraint_section, &
      52              :                             create_lrigpw_section
      53              :    USE input_cp2k_kpoints, ONLY: create_kpoint_set_section
      54              :    USE input_cp2k_loc, ONLY: create_localize_section
      55              :    USE input_cp2k_resp, ONLY: create_resp_section
      56              :    USE input_cp2k_xc, ONLY: create_xc_section
      57              :    USE input_keyword_types, ONLY: keyword_create, &
      58              :                                   keyword_release, &
      59              :                                   keyword_type
      60              :    USE input_section_types, ONLY: section_add_keyword, &
      61              :                                   section_add_subsection, &
      62              :                                   section_create, &
      63              :                                   section_release, &
      64              :                                   section_type
      65              :    USE input_val_types, ONLY: char_t, &
      66              :                               integer_t, &
      67              :                               lchar_t, &
      68              :                               logical_t, &
      69              :                               real_t
      70              :    USE input_cp2k_xas, ONLY: create_xas_tdp_section
      71              :    USE kinds, ONLY: dp
      72              :    USE string_utilities, ONLY: s2a
      73              : #include "./base/base_uses.f90"
      74              : 
      75              :    IMPLICIT NONE
      76              :    PRIVATE
      77              : 
      78              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      79              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_properties_dft'
      80              : 
      81              :    PUBLIC :: create_properties_section
      82              : 
      83              : CONTAINS
      84              : 
      85              : ! **************************************************************************************************
      86              : !> \brief Create the PROPERTIES section
      87              : !> \param section the section to create
      88              : !> \author teo
      89              : ! **************************************************************************************************
      90         1360 :    SUBROUTINE create_properties_section(section)
      91              :       TYPE(section_type), POINTER                        :: section
      92              : 
      93              :       TYPE(keyword_type), POINTER                        :: keyword
      94              :       TYPE(section_type), POINTER                        :: subsection
      95              : 
      96         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
      97              :       CALL section_create(section, __LOCATION__, name="PROPERTIES", &
      98              :                           description="This section is used to set up the PROPERTIES calculation.", &
      99         1360 :                           n_keywords=0, n_subsections=6, repeats=.FALSE.)
     100              : 
     101         1360 :       NULLIFY (subsection, keyword)
     102              : 
     103         1360 :       CALL create_linres_section(subsection, create_subsections=.TRUE.)
     104         1360 :       CALL section_add_subsection(section, subsection)
     105         1360 :       CALL section_release(subsection)
     106              : 
     107         1360 :       CALL create_et_coupling_section(subsection)
     108         1360 :       CALL section_add_subsection(section, subsection)
     109         1360 :       CALL section_release(subsection)
     110              : 
     111         1360 :       CALL create_resp_section(subsection)
     112         1360 :       CALL section_add_subsection(section, subsection)
     113         1360 :       CALL section_release(subsection)
     114              : 
     115         1360 :       CALL create_atprop_section(subsection)
     116         1360 :       CALL section_add_subsection(section, subsection)
     117         1360 :       CALL section_release(subsection)
     118              : 
     119              :       CALL cp_print_key_section_create(subsection, __LOCATION__, name="FIT_CHARGE", &
     120              :                                        description="This section is used to print the density derived atomic point charges. "// &
     121              :                                        "The fit of the charges is controlled through the DENSITY_FITTING section", &
     122         1360 :                                        print_level=high_print_level, filename="__STD_OUT__")
     123              :       CALL keyword_create(keyword, __LOCATION__, name="TYPE_OF_DENSITY", &
     124              :                           description="Specifies the type of density used for the fitting", &
     125              :                           usage="TYPE_OF_DENSITY (FULL|SPIN)", &
     126              :                           enum_c_vals=s2a("FULL", "SPIN"), &
     127              :                           enum_i_vals=[do_full_density, do_spin_density], &
     128              :                           enum_desc=s2a("Full density", "Spin density"), &
     129         1360 :                           default_i_val=do_full_density)
     130         1360 :       CALL section_add_keyword(subsection, keyword)
     131         1360 :       CALL keyword_release(keyword)
     132         1360 :       CALL section_add_subsection(section, subsection)
     133         1360 :       CALL section_release(subsection)
     134              : 
     135         1360 :       CALL create_tddfpt2_section(subsection)
     136         1360 :       CALL section_add_subsection(section, subsection)
     137         1360 :       CALL section_release(subsection)
     138              : 
     139         1360 :       CALL create_rixs_section(subsection)
     140         1360 :       CALL section_add_subsection(section, subsection)
     141         1360 :       CALL section_release(subsection)
     142              : 
     143         1360 :       CALL create_kubo_transport_section(subsection)
     144         1360 :       CALL section_add_subsection(section, subsection)
     145         1360 :       CALL section_release(subsection)
     146              : 
     147         1360 :       CALL create_bandstructure_section(subsection)
     148         1360 :       CALL section_add_subsection(section, subsection)
     149         1360 :       CALL section_release(subsection)
     150              : 
     151         1360 :       CALL create_tipscan_section(subsection)
     152         1360 :       CALL section_add_subsection(section, subsection)
     153         1360 :       CALL section_release(subsection)
     154              : 
     155         1360 :    END SUBROUTINE create_properties_section
     156              : 
     157              : ! **************************************************************************************************
     158              : !> \brief creates the input structure used to activate finite-volume Kubo transport
     159              : ! **************************************************************************************************
     160              : 
     161         1360 :    SUBROUTINE create_kubo_transport_section(section)
     162              :       TYPE(section_type), POINTER                        :: section
     163              :       TYPE(keyword_type), POINTER                        :: keyword
     164              : 
     165         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
     166              : 
     167         1360 :       NULLIFY (keyword)
     168              : 
     169              :       CALL section_create(section, __LOCATION__, name="KUBO_TRANSPORT", &
     170              :                           description="Finite-volume Kubo-Greenwood transport coefficients from the "// &
     171              :                           "converged Quickstep Hamiltonian, overlap matrix, and atomic geometry. "// &
     172              :                           "For one- and two-dimensional cells, transport is projected onto the "// &
     173              :                           "periodic subspace and normalized by the periodic length or area.", &
     174              :                           n_keywords=8, n_subsections=0, repeats=.FALSE., &
     175         2720 :                           citations=[KuhneHeskeProdan2020])
     176              : 
     177              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     178              :                           description="Controls the activation of the Kubo transport calculation.", &
     179              :                           default_l_val=.FALSE., &
     180         1360 :                           lone_keyword_l_val=.TRUE.)
     181         1360 :       CALL section_add_keyword(section, keyword)
     182         1360 :       CALL keyword_release(keyword)
     183              : 
     184              :       CALL keyword_create(keyword, __LOCATION__, name="METHOD", &
     185              :                           description="Transport algorithm. DIAGONALIZATION evaluates the finite-volume "// &
     186              :                           "Kubo-Greenwood expression from the explicit spectrum. TD and CHEBYSHEV are "// &
     187              :                           "reserved for future diagonalization-free implementations.", &
     188              :                           usage="METHOD DIAGONALIZATION", &
     189         1360 :                           n_var=1, type_of_var=char_t, default_c_val="DIAGONALIZATION")
     190         1360 :       CALL section_add_keyword(section, keyword)
     191         1360 :       CALL keyword_release(keyword)
     192              : 
     193              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
     194              :                           description="Electronic temperature used in the Fermi operator.", &
     195              :                           usage="TEMPERATURE 1.0", &
     196              :                           default_r_val=cp_unit_to_cp2k(value=1.0_dp, unit_str="K"), &
     197         1360 :                           n_var=1, type_of_var=real_t, unit_str="K")
     198         1360 :       CALL section_add_keyword(section, keyword)
     199         1360 :       CALL keyword_release(keyword)
     200              : 
     201              :       CALL keyword_create(keyword, __LOCATION__, name="DISSIPATION", &
     202              :                           description="Dissipation/broadening parameter in the finite-temperature "// &
     203              :                           "Kubo formula.", &
     204              :                           usage="DISSIPATION 300.0", &
     205              :                           default_r_val=cp_unit_to_cp2k(value=300.0_dp, unit_str="K"), &
     206         1360 :                           n_var=1, type_of_var=real_t, unit_str="K")
     207         1360 :       CALL section_add_keyword(section, keyword)
     208         1360 :       CALL keyword_release(keyword)
     209              : 
     210              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_RANGE", &
     211              :                           description="Absolute chemical-potential range. The default 0 0 uses the "// &
     212              :                           "full eigenvalue range of the finite-volume Hamiltonian.", &
     213              :                           usage="ENERGY_RANGE -0.5 0.5", &
     214              :                           default_r_vals=[0.0_dp, 0.0_dp], n_var=2, type_of_var=real_t, &
     215         1360 :                           unit_str="hartree")
     216         1360 :       CALL section_add_keyword(section, keyword)
     217         1360 :       CALL keyword_release(keyword)
     218              : 
     219              :       CALL keyword_create(keyword, __LOCATION__, name="NEUTRAL_MU", &
     220              :                           description="Optional fixed neutral chemical potential. If omitted, the "// &
     221              :                           "neutral point is found from the eigenvalue spectrum and total electron count.", &
     222              :                           usage="NEUTRAL_MU 0.245467619658419", &
     223         1360 :                           n_var=1, type_of_var=real_t, unit_str="hartree")
     224         1360 :       CALL section_add_keyword(section, keyword)
     225         1360 :       CALL keyword_release(keyword)
     226              : 
     227              :       CALL keyword_create(keyword, __LOCATION__, name="N_MU", &
     228              :                           description="Number of chemical-potential grid points.", &
     229              :                           usage="N_MU 200", &
     230         1360 :                           default_i_val=200, n_var=1, type_of_var=integer_t)
     231         1360 :       CALL section_add_keyword(section, keyword)
     232         1360 :       CALL keyword_release(keyword)
     233              : 
     234              :       CALL keyword_create(keyword, __LOCATION__, name="NEUTRAL_GRID", &
     235              :                           description="Number of grid points used to locate the neutral chemical potential.", &
     236              :                           usage="NEUTRAL_GRID 10000", &
     237         1360 :                           default_i_val=10000, n_var=1, type_of_var=integer_t)
     238         1360 :       CALL section_add_keyword(section, keyword)
     239         1360 :       CALL keyword_release(keyword)
     240              : 
     241         1360 :    END SUBROUTINE create_kubo_transport_section
     242              : 
     243              : ! **************************************************************************************************
     244              : !> \brief creates the input structure used to activate
     245              : !>      a resonant inelastic xray scattering (RIXS) calculation
     246              : ! **************************************************************************************************
     247              : 
     248         1360 :    SUBROUTINE create_rixs_section(section)
     249              :       TYPE(section_type), POINTER                        :: section
     250              :       TYPE(section_type), POINTER                        :: subsection, print_key
     251              :       TYPE(keyword_type), POINTER                        :: keyword
     252              : 
     253         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
     254              : 
     255         1360 :       NULLIFY (keyword, subsection, print_key)
     256              : 
     257              :       CALL section_create(section, __LOCATION__, name="RIXS", &
     258              :                           description="Resonant Inelastic Xray Scattering using XAS_TDP and TDDFPT.", &
     259              :                           n_keywords=1, n_subsections=3, repeats=.FALSE., &
     260         2720 :                           citations=[VazdaCruz2021])
     261              : 
     262              :       CALL keyword_create(keyword, __LOCATION__, &
     263              :                           name="_SECTION_PARAMETERS_", &
     264              :                           description="Controls the activation of the RIXS procedure", &
     265              :                           default_l_val=.FALSE., &
     266         1360 :                           lone_keyword_l_val=.TRUE.)
     267         1360 :       CALL section_add_keyword(section, keyword)
     268         1360 :       CALL keyword_release(keyword)
     269              : 
     270              :       CALL keyword_create(keyword, __LOCATION__, name="CORE_STATES", &
     271              :                           description="Number of core excited states to be used in the RIXS "// &
     272              :                           "calculation. Restricting this number reduces computational cost. "// &
     273              :                           "-1 means all available core states will be used.", &
     274         1360 :                           n_var=1, type_of_var=integer_t, default_i_val=-1)
     275         1360 :       CALL section_add_keyword(section, keyword)
     276         1360 :       CALL keyword_release(keyword)
     277              : 
     278              :       CALL keyword_create(keyword, __LOCATION__, name="VALENCE_STATES", &
     279              :                           description="Number of valence excited states to be used in the RIXS "// &
     280              :                           "calculation. Restricting this number reduces computational cost, but "// &
     281              :                           "removes spectral features corresponding to higher excitations. Should be "// &
     282              :                           "used with care. -1 means all available valence states will be used.", &
     283         1360 :                           n_var=1, type_of_var=integer_t, default_i_val=-1)
     284         1360 :       CALL section_add_keyword(section, keyword)
     285         1360 :       CALL keyword_release(keyword)
     286              : 
     287         1360 :       CALL create_tddfpt2_section(subsection)
     288         1360 :       CALL section_add_subsection(section, subsection)
     289         1360 :       CALL section_release(subsection)
     290              : 
     291         1360 :       CALL create_xas_tdp_section(subsection)
     292         1360 :       CALL section_add_subsection(section, subsection)
     293         1360 :       CALL section_release(subsection)
     294              : 
     295              :       CALL section_create(subsection, __LOCATION__, "PRINT", "Controls the printing of information "// &
     296         1360 :                           "during RIXS calculations", repeats=.FALSE.)
     297              : 
     298              :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="SPECTRUM", &
     299              :                                        description="Controles the printing of the RIXS spectrum "// &
     300              :                                        "in output files", &
     301              :                                        print_level=low_print_level, filename="", &
     302         1360 :                                        common_iter_levels=3)
     303         1360 :       CALL section_add_subsection(subsection, print_key)
     304         1360 :       CALL section_release(print_key)
     305              : 
     306         1360 :       CALL section_add_subsection(section, subsection)
     307         1360 :       CALL section_release(subsection)
     308              : 
     309         1360 :    END SUBROUTINE create_rixs_section
     310              : 
     311              : ! **************************************************************************************************
     312              : !> \brief creates the input structure used to activate
     313              : !>      a linear response calculation
     314              : !>      Available properties : none
     315              : !> \param section the section to create
     316              : !> \param create_subsections indicates whether or not subsections should be created
     317              : !> \param default_set_tdlr default parameters to be used if called from TDDFPT
     318              : !> \author MI
     319              : ! **************************************************************************************************
     320         4080 :    SUBROUTINE create_linres_section(section, create_subsections, default_set_tdlr)
     321              :       TYPE(section_type), POINTER                        :: section
     322              :       LOGICAL, INTENT(in)                                :: create_subsections
     323              :       LOGICAL, INTENT(IN), OPTIONAL                      :: default_set_tdlr
     324              : 
     325              :       INTEGER                                            :: def_max_iter, def_precond
     326              :       REAL(KIND=DP)                                      :: def_egap, def_eps, def_eps_filter
     327              :       TYPE(keyword_type), POINTER                        :: keyword
     328              :       TYPE(section_type), POINTER                        :: print_key, subsection
     329              : 
     330              :       CHARACTER(len=256)                      :: desc
     331              : 
     332         4080 :       NULLIFY (keyword, print_key)
     333              : 
     334         4080 :       IF (PRESENT(default_set_tdlr)) THEN
     335         2720 :          def_egap = 0.02_dp
     336         2720 :          def_eps = 1.0e-10_dp
     337         2720 :          def_eps_filter = 1.0e-15_dp
     338         2720 :          def_max_iter = 100
     339         2720 :          def_precond = ot_precond_full_single_inverse
     340         2720 :          desc = "Controls the parameters of the LINRES force calculations for excited states."
     341              :       ELSE
     342         1360 :          def_egap = 0.2_dp
     343         1360 :          def_eps = 1.e-6_dp
     344         1360 :          def_eps_filter = 0.0_dp
     345         1360 :          def_max_iter = 50
     346         1360 :          def_precond = ot_precond_none
     347         1360 :          desc = "The linear response is used to calculate one of the following properties: nmr, epr, raman, ..."
     348              :       END IF
     349              : 
     350         4080 :       CPASSERT(.NOT. ASSOCIATED(section))
     351              :       CALL section_create(section, __LOCATION__, name="linres", &
     352              :                           description=desc, n_keywords=5, n_subsections=2, repeats=.FALSE., &
     353         8160 :                           citations=[Putrino2000])
     354              : 
     355              :       CALL keyword_create(keyword, __LOCATION__, name="EPS", &
     356              :                           description="target accuracy for the convergence of the conjugate gradient.", &
     357         4080 :                           usage="EPS 1.e-6", default_r_val=def_eps)
     358         4080 :       CALL section_add_keyword(section, keyword)
     359         4080 :       CALL keyword_release(keyword)
     360              : 
     361              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER", &
     362              :                           description="Filter threshold for response density matrix.", &
     363         4080 :                           usage="EPS_FILTER 1.e-8", default_r_val=def_eps_filter)
     364         4080 :       CALL section_add_keyword(section, keyword)
     365         4080 :       CALL keyword_release(keyword)
     366              : 
     367              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
     368              :                           description="Maximum number of conjugate gradient iteration to be performed for one optimization.", &
     369         4080 :                           usage="MAX_ITER 200", default_i_val=def_max_iter)
     370         4080 :       CALL section_add_keyword(section, keyword)
     371         4080 :       CALL keyword_release(keyword)
     372              : 
     373              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_EVERY", &
     374              :                           description="Restart the conjugate gradient after the specified number of iterations.", &
     375         4080 :                           usage="RESTART_EVERY 200", default_i_val=50)
     376         4080 :       CALL section_add_keyword(section, keyword)
     377         4080 :       CALL keyword_release(keyword)
     378              : 
     379              :       CALL keyword_create( &
     380              :          keyword, __LOCATION__, name="PRECONDITIONER", &
     381              :          description="Type of preconditioner to be used with all minimization schemes. "// &
     382              :          "They differ in effectiveness, cost of construction, cost of application. "// &
     383              :          "Properly preconditioned minimization can be orders of magnitude faster than doing nothing.", &
     384              :          usage="PRECONDITIONER FULL_ALL", &
     385              :          default_i_val=def_precond, &
     386              :          enum_c_vals=s2a("FULL_ALL", "FULL_SINGLE_INVERSE", "FULL_SINGLE", "FULL_KINETIC", "FULL_S_INVERSE", &
     387              :                          "NONE"), &
     388              :          enum_desc=s2a("Most effective state selective preconditioner based on diagonalization, "// &
     389              :                        "requires the ENERGY_GAP parameter to be an underestimate of the HOMO-LUMO gap. "// &
     390              :                        "This preconditioner is recommended for almost all systems, except very large systems where "// &
     391              :                        "make_preconditioner would dominate the total computational cost.", &
     392              :                        "Based on H-eS cholesky inversion, similar to FULL_SINGLE in preconditioning efficiency "// &
     393              :                        "but cheaper to construct, "// &
     394              :                        "might be somewhat less robust. Recommended for large systems.", &
     395              :                        "Based on H-eS diagonalisation, not as good as FULL_ALL, but somewhat cheaper to apply. ", &
     396              :                        "Cholesky inversion of S and T, fast construction, robust, and relatively good, "// &
     397              :                        "use for very large systems.", &
     398              :                        "Cholesky inversion of S, not as good as FULL_KINETIC, yet equally expensive.", &
     399              :                        "skip preconditioning"), &
     400              :          enum_i_vals=[ot_precond_full_all, ot_precond_full_single_inverse, ot_precond_full_single, &
     401         4080 :                       ot_precond_full_kinetic, ot_precond_s_inverse, ot_precond_none])
     402         4080 :       CALL section_add_keyword(section, keyword)
     403         4080 :       CALL keyword_release(keyword)
     404              : 
     405              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_GAP", &
     406              :                           description="Energy gap estimate [a.u.] for preconditioning", &
     407              :                           usage="ENERGY_GAP 0.1", &
     408         4080 :                           default_r_val=def_egap)
     409         4080 :       CALL section_add_keyword(section, keyword)
     410         4080 :       CALL keyword_release(keyword)
     411              : 
     412              :       CALL keyword_create(keyword, __LOCATION__, name="EVERY_N_STEP", &
     413              :                           description="Perform a linear response calculation every N-th step for MD run", &
     414         4080 :                           usage="EVERY_N_STEP 50", default_i_val=1)
     415         4080 :       CALL section_add_keyword(section, keyword)
     416         4080 :       CALL keyword_release(keyword)
     417              : 
     418              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART", &
     419              :                           description="Restart the response calculation if the restart file exists", &
     420              :                           usage="RESTART", &
     421         4080 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     422         4080 :       CALL section_add_keyword(section, keyword)
     423         4080 :       CALL keyword_release(keyword)
     424              : 
     425              :       CALL keyword_create(keyword, __LOCATION__, name="WFN_RESTART_FILE_NAME", &
     426              :                           variants=["RESTART_FILE_NAME"], &
     427              :                           description="Root of the file names where to read the response functions from "// &
     428              :                           "which to restart the calculation of the linear response", &
     429              :                           usage="WFN_RESTART_FILE_NAME <FILENAME>", &
     430         8160 :                           type_of_var=lchar_t)
     431         4080 :       CALL section_add_keyword(section, keyword)
     432         4080 :       CALL keyword_release(keyword)
     433              : 
     434         4080 :       IF (create_subsections) THEN
     435         1360 :          NULLIFY (subsection)
     436              : 
     437         1360 :          CALL create_localize_section(subsection)
     438         1360 :          CALL section_add_subsection(section, subsection)
     439         1360 :          CALL section_release(subsection)
     440              : 
     441         1360 :          CALL create_current_section(subsection)
     442         1360 :          CALL section_add_subsection(section, subsection)
     443         1360 :          CALL section_release(subsection)
     444              : 
     445         1360 :          CALL create_nmr_section(subsection)
     446         1360 :          CALL section_add_subsection(section, subsection)
     447         1360 :          CALL section_release(subsection)
     448              : 
     449         1360 :          CALL create_spin_spin_section(subsection)
     450         1360 :          CALL section_add_subsection(section, subsection)
     451         1360 :          CALL section_release(subsection)
     452              : 
     453         1360 :          CALL create_epr_section(subsection)
     454         1360 :          CALL section_add_subsection(section, subsection)
     455         1360 :          CALL section_release(subsection)
     456              : 
     457         1360 :          CALL create_polarizability_section(subsection)
     458         1360 :          CALL section_add_subsection(section, subsection)
     459         1360 :          CALL section_release(subsection)
     460              : 
     461         1360 :          CALL create_dcdr_section(subsection)
     462         1360 :          CALL section_add_subsection(section, subsection)
     463         1360 :          CALL section_release(subsection)
     464              : 
     465         1360 :          CALL create_vcd_section(subsection)
     466         1360 :          CALL section_add_subsection(section, subsection)
     467         1360 :          CALL section_release(subsection)
     468              : 
     469              :          CALL section_create(subsection, __LOCATION__, name="PRINT", &
     470              :                              description="printing of information during the linear response calculation", &
     471         1360 :                              repeats=.FALSE.)
     472              : 
     473              :          CALL cp_print_key_section_create( &
     474              :             print_key, __LOCATION__, "program_run_info", &
     475              :             description="Controls the printing of basic iteration information during the LINRES calculation", &
     476         1360 :             print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     477         1360 :          CALL section_add_subsection(subsection, print_key)
     478         1360 :          CALL section_release(print_key)
     479              : 
     480              :          CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
     481              :                                           description="Controls the dumping of restart file of the response wavefunction. "// &
     482              :                                           "For each set of response functions, i.e. for each perturbation, "// &
     483              :                                           "one different restart file is dumped. These restart files should be "// &
     484              :                                           "employed only to restart the same type of LINRES calculation, "// &
     485              :                                           "i.e. with the same perturbation.", &
     486              :                                           print_level=low_print_level, common_iter_levels=3, each_iter_names=s2a("ITER"), &
     487         1360 :                                           add_last=add_last_numeric, each_iter_values=[3], filename="")
     488         1360 :          CALL section_add_subsection(subsection, print_key)
     489         1360 :          CALL section_release(print_key)
     490              : 
     491         1360 :          CALL section_add_subsection(section, subsection)
     492         1360 :          CALL section_release(subsection)
     493              : 
     494              :       END IF
     495              : 
     496         4080 :    END SUBROUTINE create_linres_section
     497              : 
     498              : ! **************************************************************************************************
     499              : !> \brief creates the input structure used to activate
     500              : !>      calculation of position perturbation  DFPT
     501              : !> \param section ...
     502              : !> \author Sandra Luber, Edward Ditler
     503              : ! **************************************************************************************************
     504         1360 :    SUBROUTINE create_dcdr_section(section)
     505              : 
     506              :       TYPE(section_type), POINTER                        :: section
     507              : 
     508              :       LOGICAL                                            :: failure
     509              :       TYPE(keyword_type), POINTER                        :: keyword
     510              :       TYPE(section_type), POINTER                        :: print_key, subsection
     511              : 
     512         1360 :       failure = .FALSE.
     513         1360 :       NULLIFY (keyword, print_key, subsection)
     514              : 
     515         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
     516              : 
     517              :       IF (.NOT. failure) THEN
     518              :          CALL section_create(section, __LOCATION__, name="DCDR", &
     519              :                              description="Compute analytical gradients the dipole moments.", &
     520         1360 :                              n_keywords=50, n_subsections=1, repeats=.FALSE.)
     521              : 
     522              :          CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     523              :                              description="Controls the activation of the APT calculation. "// &
     524              :                              "Analytical derivatives are not available for functionals that depend on "// &
     525              :                              "the kinetic energy density; use APT_FD for these functionals.", &
     526              :                              usage="&DCDR T", &
     527              :                              default_l_val=.FALSE., &
     528         1360 :                              lone_keyword_l_val=.TRUE.)
     529         1360 :          CALL section_add_keyword(section, keyword)
     530         1360 :          CALL keyword_release(keyword)
     531              : 
     532              :          CALL keyword_create(keyword, __LOCATION__, name="LIST_OF_ATOMS", &
     533              :                              description="Specifies a list of atoms.", &
     534              :                              usage="LIST_OF_ATOMS {integer} {integer} .. {integer}", repeats=.TRUE., &
     535         1360 :                              n_var=-1, type_of_var=integer_t)
     536         1360 :          CALL section_add_keyword(section, keyword)
     537         1360 :          CALL keyword_release(keyword)
     538              : 
     539              :          CALL keyword_create(keyword, __LOCATION__, name="DISTRIBUTED_ORIGIN", &
     540              :                              variants=["DO_GAUGE"], &
     541              :                              description="Use the distributed origin (DO) gauge?", &
     542              :                              usage="DISTRIBUTED_ORIGIN T", &
     543         2720 :                              default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     544         1360 :          CALL section_add_keyword(section, keyword)
     545         1360 :          CALL keyword_release(keyword)
     546              : 
     547              :          CALL keyword_create(keyword, __LOCATION__, name="ORBITAL_CENTER", &
     548              :                              description="The orbital center.", &
     549              :                              usage="ORBITAL_CENTER WANNIER", &
     550              :                              default_i_val=current_orb_center_wannier, &
     551              :                              enum_c_vals=s2a("WANNIER", "COMMON", "ATOM", "BOX"), &
     552              :                              enum_desc=s2a("Use the Wannier centers.", &
     553              :                                            "Use a common center (works only for an isolate molecule).", &
     554              :                                            "Use the atoms as center.", &
     555              :                                            "Boxing."), &
     556              :                              enum_i_vals=[current_orb_center_wannier, current_orb_center_common, &
     557         1360 :                                           current_orb_center_atom, current_orb_center_box])
     558         1360 :          CALL section_add_keyword(section, keyword)
     559         1360 :          CALL keyword_release(keyword)
     560              : 
     561              :          CALL keyword_create(keyword, __LOCATION__, name="REFERENCE", &
     562              :                              description="Gauge origin of the velocity gauge factor.", &
     563              :                              enum_c_vals=s2a("COM", "COAC", "USER_DEFINED", "ZERO"), &
     564              :                              enum_desc=s2a("Use Center of Mass", &
     565              :                                            "Use Center of Atomic Charges", &
     566              :                                            "Use User-defined Point", &
     567              :                                            "Use Origin of Coordinate System"), &
     568              :                              enum_i_vals=[use_mom_ref_com, &
     569              :                                           use_mom_ref_coac, &
     570              :                                           use_mom_ref_user, &
     571              :                                           use_mom_ref_zero], &
     572         1360 :                              default_i_val=use_mom_ref_zero)
     573         1360 :          CALL section_add_keyword(section, keyword)
     574         1360 :          CALL keyword_release(keyword)
     575              : 
     576              :          CALL keyword_create(keyword, __LOCATION__, name="REFERENCE_POINT", &
     577              :                              description="User-defined reference point of the velocity gauge factor.", &
     578              :                              usage="REFERENCE_POINT x y z", &
     579         1360 :                              repeats=.FALSE., n_var=3, type_of_var=real_t, unit_str='bohr')
     580         1360 :          CALL section_add_keyword(section, keyword)
     581         1360 :          CALL keyword_release(keyword)
     582              : 
     583              :          CALL keyword_create(keyword, __LOCATION__, name="Z_MATRIX_METHOD", &
     584              :                              description="Use Z_matrix method to solve the response equation", &
     585              :                              usage="Z_MATRIX_METHOD T", &
     586         1360 :                              default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     587         1360 :          CALL section_add_keyword(section, keyword)
     588         1360 :          CALL keyword_release(keyword)
     589              : 
     590              :          CALL keyword_create(keyword, __LOCATION__, name="APT_FD", &
     591              :                              description="Use numerical differentiation to compute the APT, "// &
     592              :                              "switches off the calculation of dcdr analytical derivatives. "// &
     593              :                              "Requires RUN_TYPE = ENERGY_FORCE or MD.", &
     594              :                              usage="APT_FD T", &
     595         1360 :                              default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     596         1360 :          CALL section_add_keyword(section, keyword)
     597         1360 :          CALL keyword_release(keyword)
     598              : 
     599              :          CALL keyword_create(keyword, __LOCATION__, name="APT_FD_DE", &
     600              :                              description="Electric field strength (atomic units) to use for finite differences", &
     601              :                              repeats=.FALSE., &
     602              :                              n_var=1, &
     603              :                              type_of_var=real_t, &
     604              :                              default_r_val=0.0003_dp, &
     605         1360 :                              usage="APT_FD_DE 1.0E-4")
     606         1360 :          CALL section_add_keyword(section, keyword)
     607         1360 :          CALL keyword_release(keyword)
     608              : 
     609              :          CALL keyword_create(keyword, __LOCATION__, name="APT_FD_METHOD", &
     610              :                              description="Numerical differentiation method", &
     611              :                              usage="APT_FD_METHOD FD", &
     612              :                              default_i_val=1, &
     613              :                              !enum_c_vals=s2a("FD", "2PNT"), &
     614              :                              enum_c_vals=s2a("2PNT"), &
     615              :                              !enum_desc=s2a("Forward differences.", &
     616              :                              !              "Symmetric two-point differences."), &
     617              :                              enum_desc=s2a("Symmetric two-point differences."), &
     618              :                              !enum_i_vals=(/0, 1/))
     619         1360 :                              enum_i_vals=[1])
     620         1360 :          CALL section_add_keyword(section, keyword)
     621         1360 :          CALL keyword_release(keyword)
     622              : 
     623         1360 :          NULLIFY (subsection)
     624              :          CALL section_create(subsection, __LOCATION__, name="PRINT", &
     625              :                              description="print results of the magnetic dipole moment calculation", &
     626         1360 :                              repeats=.FALSE.)
     627              : 
     628              :          CALL cp_print_key_section_create(print_key, __LOCATION__, "APT", &
     629              :                                           description="Controls the printing of the electric dipole gradient", &
     630         1360 :                                           print_level=low_print_level, add_last=add_last_numeric, filename="")
     631         1360 :          CALL section_add_subsection(subsection, print_key)
     632         1360 :          CALL section_release(print_key)
     633              : 
     634         1360 :          CALL section_add_subsection(section, subsection)
     635         1360 :          CALL section_release(subsection)
     636              : 
     637         1360 :          NULLIFY (subsection)
     638         1360 :          CALL create_interp_section(subsection)
     639         1360 :          CALL section_add_subsection(section, subsection)
     640         1360 :          CALL section_release(subsection)
     641              : 
     642              :       END IF
     643              : 
     644         1360 :    END SUBROUTINE create_dcdr_section
     645              : 
     646              : ! **************************************************************************************************
     647              : !> \brief creates the input structure used to activate
     648              : !>      calculation of VCD spectra using DFPT
     649              : !> \param section ...
     650              : !> \author Sandra Luber, Tomas Zimmermann, Edward Ditler
     651              : ! **************************************************************************************************
     652         1360 :    SUBROUTINE create_vcd_section(section)
     653              : 
     654              :       TYPE(section_type), POINTER                        :: section
     655              : 
     656              :       TYPE(keyword_type), POINTER                        :: keyword
     657              :       TYPE(section_type), POINTER                        :: print_key, subsection
     658              : 
     659         1360 :       NULLIFY (keyword, print_key, subsection)
     660              : 
     661         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
     662              : 
     663              :       CALL section_create(section, __LOCATION__, name="VCD", &
     664              :                           description="Carry out a VCD calculation.", &
     665         1360 :                           n_keywords=50, n_subsections=1, repeats=.FALSE.)
     666              : 
     667              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     668              :                           description="controls the activation of the APT/AAT calculation", &
     669              :                           usage="&VCD T", &
     670              :                           default_l_val=.FALSE., &
     671         1360 :                           lone_keyword_l_val=.TRUE.)
     672         1360 :       CALL section_add_keyword(section, keyword)
     673         1360 :       CALL keyword_release(keyword)
     674              : 
     675              :       CALL keyword_create(keyword, __LOCATION__, name="LIST_OF_ATOMS", &
     676              :                           description="Specifies a list of atoms.", &
     677              :                           usage="LIST_OF_ATOMS {integer} {integer} .. {integer}", repeats=.TRUE., &
     678         1360 :                           n_var=-1, type_of_var=integer_t)
     679         1360 :       CALL section_add_keyword(section, keyword)
     680         1360 :       CALL keyword_release(keyword)
     681              : 
     682              :       CALL keyword_create(keyword, __LOCATION__, name="DISTRIBUTED_ORIGIN", &
     683              :                           variants=["DO_GAUGE"], &
     684              :                           description="Use the distributed origin (DO) gauge?", &
     685              :                           usage="DISTRIBUTED_ORIGIN T", &
     686         2720 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     687         1360 :       CALL section_add_keyword(section, keyword)
     688         1360 :       CALL keyword_release(keyword)
     689              : 
     690              :       CALL keyword_create(keyword, __LOCATION__, name="ORIGIN_DEPENDENT_MFP", &
     691              :                           description="Use the origin dependent MFP operator.", &
     692              :                           usage="ORIGIN_DEPENDENT_MFP T", &
     693         1360 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     694         1360 :       CALL section_add_keyword(section, keyword)
     695         1360 :       CALL keyword_release(keyword)
     696              : 
     697              :       CALL keyword_create(keyword, __LOCATION__, name="ORBITAL_CENTER", &
     698              :                           description="The orbital center.", &
     699              :                           usage="ORBITAL_CENTER WANNIER", &
     700              :                           default_i_val=current_orb_center_wannier, &
     701              :                           enum_c_vals=s2a("WANNIER", "COMMON", "ATOM", "BOX"), &
     702              :                           enum_desc=s2a("Use the Wannier centers.", &
     703              :                                         "Use a common center (works only for an isolate molecule).", &
     704              :                                         "Use the atoms as center.", &
     705              :                                         "Boxing."), &
     706              :                           enum_i_vals=[current_orb_center_wannier, current_orb_center_common, &
     707         1360 :                                        current_orb_center_atom, current_orb_center_box])
     708         1360 :       CALL section_add_keyword(section, keyword)
     709         1360 :       CALL keyword_release(keyword)
     710              : 
     711              :       ! The origin of the magnetic dipole operator (r - MAGNETIC_ORIGIN) x momentum
     712              :       CALL keyword_create(keyword, __LOCATION__, name="MAGNETIC_ORIGIN", &
     713              :                           description="Gauge origin of the magnetic dipole operator.", &
     714              :                           enum_c_vals=s2a("COM", "COAC", "USER_DEFINED", "ZERO"), &
     715              :                           enum_desc=s2a("Use Center of Mass", &
     716              :                                         "Use Center of Atomic Charges", &
     717              :                                         "Use User-defined Point", &
     718              :                                         "Use Origin of Coordinate System"), &
     719              :                           enum_i_vals=[use_mom_ref_com, &
     720              :                                        use_mom_ref_coac, &
     721              :                                        use_mom_ref_user, &
     722              :                                        use_mom_ref_zero], &
     723         1360 :                           default_i_val=use_mom_ref_zero)
     724         1360 :       CALL section_add_keyword(section, keyword)
     725         1360 :       CALL keyword_release(keyword)
     726              : 
     727              :       CALL keyword_create(keyword, __LOCATION__, name="MAGNETIC_ORIGIN_REFERENCE", &
     728              :                           description="User-defined reference point of the magnetic dipole operator.", &
     729              :                           usage="MAGNETIC_ORIGIN_REFERENCE x y z", &
     730         1360 :                           repeats=.FALSE., n_var=3, type_of_var=real_t, unit_str='bohr')
     731         1360 :       CALL section_add_keyword(section, keyword)
     732         1360 :       CALL keyword_release(keyword)
     733              : 
     734              :       ! The origin of the coordinate system
     735              :       CALL keyword_create(keyword, __LOCATION__, name="SPATIAL_ORIGIN", &
     736              :                           description="Gauge origin of the velocity gauge factor/spatial origin.", &
     737              :                           enum_c_vals=s2a("COM", "COAC", "USER_DEFINED", "ZERO"), &
     738              :                           enum_desc=s2a("Use Center of Mass", &
     739              :                                         "Use Center of Atomic Charges", &
     740              :                                         "Use User-defined Point", &
     741              :                                         "Use Origin of Coordinate System"), &
     742              :                           enum_i_vals=[use_mom_ref_com, &
     743              :                                        use_mom_ref_coac, &
     744              :                                        use_mom_ref_user, &
     745              :                                        use_mom_ref_zero], &
     746         1360 :                           default_i_val=use_mom_ref_zero)
     747         1360 :       CALL section_add_keyword(section, keyword)
     748         1360 :       CALL keyword_release(keyword)
     749              : 
     750              :       CALL keyword_create(keyword, __LOCATION__, name="SPATIAL_ORIGIN_REFERENCE", &
     751              :                           description="User-defined reference point of the velocity gauge factor/spatial origin.", &
     752              :                           usage="SPATIAL_ORIGIN_REFERENCE x y z", &
     753         1360 :                           repeats=.FALSE., n_var=3, type_of_var=real_t, unit_str='bohr')
     754         1360 :       CALL section_add_keyword(section, keyword)
     755         1360 :       CALL keyword_release(keyword)
     756              : 
     757         1360 :       NULLIFY (subsection)
     758              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
     759              :                           description="print results of the magnetic dipole moment calculation", &
     760         1360 :                           repeats=.FALSE.)
     761              : 
     762              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "VCD", &
     763              :                                        description="Controls the printing of the APTs and AATs", &
     764         1360 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="")
     765         1360 :       CALL section_add_subsection(subsection, print_key)
     766         1360 :       CALL section_release(print_key)
     767              : 
     768         1360 :       CALL section_add_subsection(section, subsection)
     769         1360 :       CALL section_release(subsection)
     770              : 
     771         1360 :       NULLIFY (subsection)
     772         1360 :       CALL create_interp_section(subsection)
     773         1360 :       CALL section_add_subsection(section, subsection)
     774         1360 :       CALL section_release(subsection)
     775              : 
     776         1360 :    END SUBROUTINE create_vcd_section
     777              : 
     778              : ! **************************************************************************************************
     779              : !> \brief creates the input structure used to activate
     780              : !>      calculation of induced current  DFPT
     781              : !>      Available properties : none
     782              : !> \param section the section to create
     783              : !> \author  MI/VW
     784              : ! **************************************************************************************************
     785         1360 :    SUBROUTINE create_current_section(section)
     786              :       TYPE(section_type), POINTER                        :: section
     787              : 
     788              :       TYPE(keyword_type), POINTER                        :: keyword
     789              :       TYPE(section_type), POINTER                        :: print_key, subsection
     790              : 
     791         1360 :       NULLIFY (keyword, print_key, subsection)
     792              : 
     793         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
     794              :       CALL section_create(section, __LOCATION__, name="current", &
     795              :                           description="The induced current density is calculated by DFPT.", &
     796              :                           n_keywords=4, n_subsections=1, repeats=.FALSE., &
     797         4080 :                           citations=[Sebastiani2001, Weber2009])
     798              : 
     799              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     800              :                           description="controls the activation of the induced current calculation", &
     801              :                           usage="&CURRENT T", &
     802              :                           default_l_val=.FALSE., &
     803         1360 :                           lone_keyword_l_val=.TRUE.)
     804         1360 :       CALL section_add_keyword(section, keyword)
     805         1360 :       CALL keyword_release(keyword)
     806              : 
     807              :       CALL keyword_create(keyword, __LOCATION__, name="GAUGE", &
     808              :                           description="The gauge used to compute the induced current within GAPW.", &
     809              :                           usage="GAUGE R", &
     810              :                           default_i_val=current_gauge_r_and_step_func, &
     811              :                           enum_c_vals=s2a("R", "R_AND_STEP_FUNCTION", "ATOM"), &
     812              :                           enum_desc=s2a("Position gauge (doesnt work well).", &
     813              :                                         "Position and step function for the soft and the local parts, respectively.", &
     814              :                                         "Atoms."), &
     815         1360 :                           enum_i_vals=[current_gauge_r, current_gauge_r_and_step_func, current_gauge_atom])
     816         1360 :       CALL section_add_keyword(section, keyword)
     817         1360 :       CALL keyword_release(keyword)
     818              : 
     819              :       CALL keyword_create(keyword, __LOCATION__, name="GAUGE_ATOM_RADIUS", &
     820              :                           description="Build the gauge=atom using only the atoms within this radius.", &
     821              :                           usage="GAUGE_ATOM_RADIUS 10.0", &
     822              :                           type_of_var=real_t, &
     823              :                           default_r_val=cp_unit_to_cp2k(value=4.0_dp, unit_str="angstrom"), &
     824         1360 :                           unit_str="angstrom")
     825         1360 :       CALL section_add_keyword(section, keyword)
     826         1360 :       CALL keyword_release(keyword)
     827              : 
     828              :       CALL keyword_create(keyword, __LOCATION__, name="USE_OLD_GAUGE_ATOM", &
     829              :                           description="Use the old way to compute the gauge.", &
     830              :                           usage="USE_OLD_GAUGE_ATOM T", &
     831         1360 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     832         1360 :       CALL section_add_keyword(section, keyword)
     833         1360 :       CALL keyword_release(keyword)
     834              : 
     835              :       CALL keyword_create(keyword, __LOCATION__, name="ORBITAL_CENTER", &
     836              :                           description="The orbital center.", &
     837              :                           usage="ORBITAL_CENTER WANNIER", &
     838              :                           default_i_val=current_orb_center_wannier, &
     839              :                           enum_c_vals=s2a("WANNIER", "COMMON", "ATOM", "BOX"), &
     840              :                           enum_desc=s2a("Use the Wannier centers.", &
     841              :                                         "Use a common center (works only for an isolate molecule).", &
     842              :                                         "Use the atoms as center.", &
     843              :                                         "Boxing."), &
     844              :                           enum_i_vals=[current_orb_center_wannier, current_orb_center_common, &
     845         1360 :                                        current_orb_center_atom, current_orb_center_box])
     846         1360 :       CALL section_add_keyword(section, keyword)
     847         1360 :       CALL keyword_release(keyword)
     848              : 
     849              :       CALL keyword_create(keyword, __LOCATION__, name="COMMON_CENTER", &
     850              :                           description="The common center ", usage="COMMON_CENTER 0.0 1.0 0.0", &
     851              :                           n_var=3, default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp], type_of_var=real_t, &
     852         1360 :                           unit_str="angstrom")
     853         1360 :       CALL section_add_keyword(section, keyword)
     854         1360 :       CALL keyword_release(keyword)
     855              : 
     856              :       CALL keyword_create(keyword, __LOCATION__, name="NBOX", &
     857              :                           description="How many boxes along each directions ", usage="NBOX 6 6 5", &
     858         1360 :                           n_var=3, default_i_vals=[4, 4, 4], type_of_var=integer_t)
     859         1360 :       CALL section_add_keyword(section, keyword)
     860         1360 :       CALL keyword_release(keyword)
     861              : 
     862              :       CALL keyword_create(keyword, __LOCATION__, name="CHI_PBC", &
     863              :                           description="Calculate the succeptibility correction to the shift with PBC", &
     864              :                           usage="CHI_PBC T", &
     865         1360 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     866         1360 :       CALL section_add_keyword(section, keyword)
     867         1360 :       CALL keyword_release(keyword)
     868              : 
     869              :       CALL keyword_create(keyword, __LOCATION__, name="FORCE_NO_FULL", &
     870              :                           description="Avoid the calculation of the state dependent perturbation term, "// &
     871              :                           "even if the orbital centers are set at Wannier centers or at Atom centers", &
     872              :                           usage="FORCE_NO_FULL T", &
     873         1360 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     874         1360 :       CALL section_add_keyword(section, keyword)
     875         1360 :       CALL keyword_release(keyword)
     876              : 
     877              :       CALL keyword_create(keyword, __LOCATION__, name="SELECTED_STATES_ON_ATOM_LIST", &
     878              :                           description="Indexes of the atoms for selecting"// &
     879              :                           " the states to be used for the response calculations.", &
     880              :                           usage="SELECTED_STATES_ON_ATOM_LIST 1 2 10", &
     881         1360 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
     882         1360 :       CALL section_add_keyword(section, keyword)
     883         1360 :       CALL keyword_release(keyword)
     884              : 
     885              :       CALL keyword_create(keyword, __LOCATION__, name="SELECTED_STATES_ATOM_RADIUS", &
     886              :                           description="Select all the states included in the given radius around each atoms "// &
     887              :                           "in SELECTED_STATES_ON_ATOM_LIST.", &
     888              :                           usage="SELECTED_STATES_ATOM_RADIUS 2.0", &
     889              :                           type_of_var=real_t, &
     890              :                           default_r_val=cp_unit_to_cp2k(value=4.0_dp, unit_str="angstrom"), &
     891         1360 :                           unit_str="angstrom")
     892         1360 :       CALL section_add_keyword(section, keyword)
     893         1360 :       CALL keyword_release(keyword)
     894              : 
     895              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_CURRENT", &
     896              :                           description="Restart the induced current density calculation"// &
     897              :                           " from a previous run (not working yet).", &
     898              :                           usage="RESTART_CURRENT", default_l_val=.FALSE., &
     899         1360 :                           lone_keyword_l_val=.TRUE.)
     900         1360 :       CALL section_add_keyword(section, keyword)
     901         1360 :       CALL keyword_release(keyword)
     902              : 
     903         1360 :       NULLIFY (subsection)
     904              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
     905              :                           description="print results of induced current density calculation", &
     906         1360 :                           repeats=.FALSE.)
     907              : 
     908              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CURRENT_CUBES", &
     909              :                                        description="Controls the printing of the induced current density (not working yet).", &
     910         1360 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
     911              :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
     912              :                           description="The stride (X,Y,Z) used to write the cube file "// &
     913              :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
     914              :                           " 1 number valid for all components (not working yet).", &
     915         1360 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
     916         1360 :       CALL section_add_keyword(print_key, keyword)
     917         1360 :       CALL keyword_release(keyword)
     918              :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
     919              :                           description="append the cube files when they already exist", &
     920         1360 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     921         1360 :       CALL section_add_keyword(print_key, keyword)
     922         1360 :       CALL keyword_release(keyword)
     923              : 
     924         1360 :       CALL section_add_subsection(subsection, print_key)
     925         1360 :       CALL section_release(print_key)
     926              : 
     927              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESPONSE_FUNCTION_CUBES", &
     928              :                                        description="Controls the printing of the response functions (not working yet).", &
     929         1360 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
     930              :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
     931              :                           description="The stride (X,Y,Z) used to write the cube file "// &
     932              :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
     933              :                           " 1 number valid for all components (not working yet).", &
     934         1360 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
     935         1360 :       CALL section_add_keyword(print_key, keyword)
     936         1360 :       CALL keyword_release(keyword)
     937              : 
     938              :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LU_BOUNDS", &
     939              :                           variants=["CUBES_LU"], &
     940              :                           description="The lower and upper index of the states to be printed as cube (not working yet).", &
     941              :                           usage="CUBES_LU_BOUNDS integer integer", &
     942         2720 :                           n_var=2, default_i_vals=[0, -2], type_of_var=integer_t)
     943         1360 :       CALL section_add_keyword(print_key, keyword)
     944         1360 :       CALL keyword_release(keyword)
     945              : 
     946              :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LIST", &
     947              :                           description="Indexes of the states to be printed as cube files "// &
     948              :                           "This keyword can be repeated several times "// &
     949              :                           "(useful if you have to specify many indexes) (not working yet).", &
     950              :                           usage="CUBES_LIST 1 2", &
     951         1360 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
     952         1360 :       CALL section_add_keyword(print_key, keyword)
     953         1360 :       CALL keyword_release(keyword)
     954              :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
     955              :                           description="append the cube files when they already exist", &
     956         1360 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     957         1360 :       CALL section_add_keyword(print_key, keyword)
     958         1360 :       CALL keyword_release(keyword)
     959              : 
     960         1360 :       CALL section_add_subsection(subsection, print_key)
     961         1360 :       CALL section_release(print_key)
     962              : 
     963         1360 :       CALL section_add_subsection(section, subsection)
     964         1360 :       CALL section_release(subsection)
     965              : 
     966         1360 :       NULLIFY (subsection)
     967         1360 :       CALL create_interp_section(subsection)
     968         1360 :       CALL section_add_subsection(section, subsection)
     969         1360 :       CALL section_release(subsection)
     970              : 
     971         1360 :    END SUBROUTINE create_current_section
     972              : 
     973              : ! **************************************************************************************************
     974              : !> \brief creates the input structure used to activate
     975              : !>         calculation of NMR chemical shift using
     976              : !>         the induced current obtained from DFPT
     977              : !>      Available properties : none
     978              : !> \param section the section to create
     979              : !> \author  MI/VW
     980              : ! **************************************************************************************************
     981         1360 :    SUBROUTINE create_nmr_section(section)
     982              :       TYPE(section_type), POINTER                        :: section
     983              : 
     984              :       TYPE(keyword_type), POINTER                        :: keyword
     985              :       TYPE(section_type), POINTER                        :: print_key, subsection
     986              : 
     987         1360 :       NULLIFY (keyword, print_key, subsection)
     988              : 
     989         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
     990              :       CALL section_create(section, __LOCATION__, name="nmr", &
     991              :                           description="The chemical shift is calculated by DFPT.", &
     992              :                           n_keywords=5, n_subsections=1, repeats=.FALSE., &
     993         2720 :                           citations=[Weber2009])
     994              : 
     995              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     996              :                           description="controls the activation of the nmr calculation", &
     997              :                           usage="&NMR T", &
     998              :                           default_l_val=.FALSE., &
     999         1360 :                           lone_keyword_l_val=.TRUE.)
    1000         1360 :       CALL section_add_keyword(section, keyword)
    1001         1360 :       CALL keyword_release(keyword)
    1002              : 
    1003              :       CALL keyword_create(keyword, __LOCATION__, name="INTERPOLATE_SHIFT", &
    1004              :                           description="Calculate the soft part of the chemical shift by interpolation ", &
    1005              :                           usage="INTERPOLATE_SHIFT T", &
    1006         1360 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1007         1360 :       CALL section_add_keyword(section, keyword)
    1008         1360 :       CALL keyword_release(keyword)
    1009              : 
    1010              :       CALL keyword_create(keyword, __LOCATION__, name="NICS", &
    1011              :                           description="Calculate the chemical shift in a set of points"// &
    1012              :                           " given from an external file", usage="NICS", &
    1013         1360 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1014         1360 :       CALL section_add_keyword(section, keyword)
    1015         1360 :       CALL keyword_release(keyword)
    1016              : 
    1017              :       CALL keyword_create(keyword, __LOCATION__, name="NICS_FILE_NAME", &
    1018              :                           description="Name of the file with the NICS points coordinates", &
    1019              :                           usage="NICS_FILE_NAME nics_file", &
    1020         1360 :                           default_lc_val="nics_file")
    1021         1360 :       CALL section_add_keyword(section, keyword)
    1022         1360 :       CALL keyword_release(keyword)
    1023              : 
    1024              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_NMR", &
    1025              :                           description="Restart the NMR calculation from a previous run (NOT WORKING YET)", &
    1026              :                           usage="RESTART_NMR", default_l_val=.FALSE., &
    1027         1360 :                           lone_keyword_l_val=.TRUE.)
    1028         1360 :       CALL section_add_keyword(section, keyword)
    1029         1360 :       CALL keyword_release(keyword)
    1030              : 
    1031              :       CALL keyword_create(keyword, __LOCATION__, name="SHIFT_GAPW_RADIUS", &
    1032              :                           description="While computing the local part of the shift (GAPW), "// &
    1033              :                           "the integration is restricted to nuclei that are within this radius.", &
    1034              :                           usage="SHIFT_GAPW_RADIUS 20.0", &
    1035              :                           type_of_var=real_t, &
    1036              :                           default_r_val=cp_unit_to_cp2k(value=60.0_dp, unit_str="angstrom"), &
    1037         1360 :                           unit_str="angstrom")
    1038         1360 :       CALL section_add_keyword(section, keyword)
    1039         1360 :       CALL keyword_release(keyword)
    1040              : 
    1041         1360 :       NULLIFY (subsection)
    1042              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    1043              :                           description="print results of nmr calculation", &
    1044         1360 :                           repeats=.FALSE.)
    1045              : 
    1046              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESPONSE_FUNCTION_CUBES", &
    1047              :                                        description="Controls the printing of the response functions ", &
    1048         1360 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
    1049              :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    1050              :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1051              :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1052              :                           " 1 number valid for all components.", &
    1053         1360 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
    1054         1360 :       CALL section_add_keyword(print_key, keyword)
    1055         1360 :       CALL keyword_release(keyword)
    1056              : 
    1057              :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LU_BOUNDS", &
    1058              :                           variants=["CUBES_LU"], &
    1059              :                           description="The lower and upper index of the states to be printed as cube", &
    1060              :                           usage="CUBES_LU_BOUNDS integer integer", &
    1061         2720 :                           n_var=2, default_i_vals=[0, -2], type_of_var=integer_t)
    1062         1360 :       CALL section_add_keyword(print_key, keyword)
    1063         1360 :       CALL keyword_release(keyword)
    1064              : 
    1065              :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LIST", &
    1066              :                           description="Indexes of the states to be printed as cube files "// &
    1067              :                           "This keyword can be repeated several times "// &
    1068              :                           "(useful if you have to specify many indexes).", &
    1069              :                           usage="CUBES_LIST 1 2", &
    1070         1360 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    1071         1360 :       CALL section_add_keyword(print_key, keyword)
    1072         1360 :       CALL keyword_release(keyword)
    1073              :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1074              :                           description="append the cube files when they already exist", &
    1075         1360 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1076         1360 :       CALL section_add_keyword(print_key, keyword)
    1077         1360 :       CALL keyword_release(keyword)
    1078              : 
    1079         1360 :       CALL section_add_subsection(subsection, print_key)
    1080         1360 :       CALL section_release(print_key)
    1081              : 
    1082              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CHI_TENSOR", &
    1083              :                                        description="Controls the printing of susceptibility", &
    1084         1360 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
    1085         1360 :       CALL section_add_subsection(subsection, print_key)
    1086         1360 :       CALL section_release(print_key)
    1087              : 
    1088              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "SHIELDING_TENSOR", &
    1089              :                                        description="Controls the printing of the chemical shift", &
    1090         1360 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="")
    1091              : 
    1092              :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS_LU_BOUNDS", &
    1093              :                           variants=["ATOMS_LU"], &
    1094              :                           description="The lower and upper atomic index for which the tensor is printed", &
    1095              :                           usage="ATOMS_LU_BOUNDS integer integer", &
    1096         2720 :                           n_var=2, default_i_vals=[0, -2], type_of_var=integer_t)
    1097         1360 :       CALL section_add_keyword(print_key, keyword)
    1098         1360 :       CALL keyword_release(keyword)
    1099              : 
    1100              :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS_LIST", &
    1101              :                           description="list of atoms for which the shift is printed into a file ", &
    1102              :                           usage="ATOMS_LIST 1 2", n_var=-1, &
    1103         1360 :                           type_of_var=integer_t, repeats=.TRUE.)
    1104         1360 :       CALL section_add_keyword(print_key, keyword)
    1105         1360 :       CALL keyword_release(keyword)
    1106              : 
    1107         1360 :       CALL section_add_subsection(subsection, print_key)
    1108         1360 :       CALL section_release(print_key)
    1109              : 
    1110         1360 :       CALL section_add_subsection(section, subsection)
    1111         1360 :       CALL section_release(subsection)
    1112              : 
    1113         1360 :       NULLIFY (subsection)
    1114         1360 :       CALL create_interp_section(subsection)
    1115         1360 :       CALL section_add_subsection(section, subsection)
    1116         1360 :       CALL section_release(subsection)
    1117              : 
    1118         1360 :    END SUBROUTINE create_nmr_section
    1119              : 
    1120              : ! **************************************************************************************************
    1121              : !> \brief creates the input structure used to activate
    1122              : !>      calculation of NMR spin-spin coupling (implementation not operating)
    1123              : !>      Available properties : none
    1124              : !> \param section the section to create
    1125              : !> \author  VW
    1126              : ! **************************************************************************************************
    1127         1360 :    SUBROUTINE create_spin_spin_section(section)
    1128              :       TYPE(section_type), POINTER                        :: section
    1129              : 
    1130              :       TYPE(keyword_type), POINTER                        :: keyword
    1131              :       TYPE(section_type), POINTER                        :: print_key, subsection
    1132              : 
    1133         1360 :       NULLIFY (keyword, print_key, subsection)
    1134              : 
    1135         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
    1136              :       CALL section_create(section, __LOCATION__, name="spinspin", &
    1137              :                           description="Compute indirect spin-spin coupling constants.", &
    1138         1360 :                           n_keywords=5, n_subsections=1, repeats=.FALSE.)
    1139              : 
    1140              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    1141              :                           description="controls the activation of the nmr calculation", &
    1142              :                           usage="&SPINSPIN T", &
    1143              :                           default_l_val=.FALSE., &
    1144         1360 :                           lone_keyword_l_val=.TRUE.)
    1145         1360 :       CALL section_add_keyword(section, keyword)
    1146         1360 :       CALL keyword_release(keyword)
    1147              : 
    1148              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_SPINSPIN", &
    1149              :                           description="Restart the spin-spin calculation from a previous run (NOT WORKING YET)", &
    1150              :                           usage="RESTART_SPINSPIN", default_l_val=.FALSE., &
    1151         1360 :                           lone_keyword_l_val=.TRUE.)
    1152         1360 :       CALL section_add_keyword(section, keyword)
    1153         1360 :       CALL keyword_release(keyword)
    1154              : 
    1155              :       CALL keyword_create(keyword, __LOCATION__, name="ISSC_ON_ATOM_LIST", &
    1156              :                           description="Atoms for which the issc is computed.", &
    1157              :                           usage="ISSC_ON_ATOM_LIST 1 2 10", &
    1158         1360 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    1159         1360 :       CALL section_add_keyword(section, keyword)
    1160         1360 :       CALL keyword_release(keyword)
    1161              : 
    1162              :       CALL keyword_create(keyword, __LOCATION__, name="DO_FC", &
    1163              :                           description="Compute the Fermi contact contribution", &
    1164              :                           usage="DO_FC F", &
    1165         1360 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1166         1360 :       CALL section_add_keyword(section, keyword)
    1167         1360 :       CALL keyword_release(keyword)
    1168              : 
    1169              :       CALL keyword_create(keyword, __LOCATION__, name="DO_SD", &
    1170              :                           description="Compute the spin-dipolar contribution", &
    1171              :                           usage="DO_SD F", &
    1172         1360 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1173         1360 :       CALL section_add_keyword(section, keyword)
    1174         1360 :       CALL keyword_release(keyword)
    1175              : 
    1176              :       CALL keyword_create(keyword, __LOCATION__, name="DO_PSO", &
    1177              :                           description="Compute the paramagnetic spin-orbit contribution", &
    1178              :                           usage="DO_PSO F", &
    1179         1360 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1180         1360 :       CALL section_add_keyword(section, keyword)
    1181         1360 :       CALL keyword_release(keyword)
    1182              : 
    1183              :       CALL keyword_create(keyword, __LOCATION__, name="DO_DSO", &
    1184              :                           description="Compute the diamagnetic spin-orbit contribution (NOT YET IMPLEMENTED)", &
    1185              :                           usage="DO_DSO F", &
    1186         1360 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1187         1360 :       CALL section_add_keyword(section, keyword)
    1188         1360 :       CALL keyword_release(keyword)
    1189              : 
    1190         1360 :       NULLIFY (subsection)
    1191              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    1192              :                           description="print results of the indirect spin-spin calculation", &
    1193         1360 :                           repeats=.FALSE.)
    1194              : 
    1195              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "K_MATRIX", &
    1196              :                                        description="Controls the printing of the indirect spin-spin matrix", &
    1197         1360 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="")
    1198              : 
    1199              :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS_LIST", &
    1200              :                           description="list of atoms for which the indirect spin-spin is printed into a file ", &
    1201              :                           usage="ATOMS_LIST 1 2", n_var=-1, &
    1202         1360 :                           type_of_var=integer_t, repeats=.TRUE.)
    1203         1360 :       CALL section_add_keyword(print_key, keyword)
    1204         1360 :       CALL keyword_release(keyword)
    1205              : 
    1206         1360 :       CALL section_add_subsection(subsection, print_key)
    1207         1360 :       CALL section_release(print_key)
    1208              : 
    1209         1360 :       CALL section_add_subsection(section, subsection)
    1210         1360 :       CALL section_release(subsection)
    1211              : 
    1212         1360 :       NULLIFY (subsection)
    1213         1360 :       CALL create_interp_section(subsection)
    1214         1360 :       CALL section_add_subsection(section, subsection)
    1215         1360 :       CALL section_release(subsection)
    1216              : 
    1217         1360 :    END SUBROUTINE create_spin_spin_section
    1218              : 
    1219              : ! **************************************************************************************************
    1220              : !> \brief creates the input structure used to activate
    1221              : !>         calculation of EPR using
    1222              : !>         the induced current obtained from DFPT
    1223              : !>      Available properties : none
    1224              : !> \param section the section to create
    1225              : !> \author  VW
    1226              : ! **************************************************************************************************
    1227         1360 :    SUBROUTINE create_epr_section(section)
    1228              :       TYPE(section_type), POINTER                        :: section
    1229              : 
    1230              :       TYPE(keyword_type), POINTER                        :: keyword
    1231              :       TYPE(section_type), POINTER                        :: print_key, subsection, subsubsection
    1232              : 
    1233         1360 :       NULLIFY (keyword, print_key, subsection, subsubsection)
    1234              : 
    1235         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
    1236              :       CALL section_create(section, __LOCATION__, name="EPR", &
    1237              :                           description="The g tensor is calculated by DFPT ", &
    1238              :                           n_keywords=5, n_subsections=1, repeats=.FALSE., &
    1239         2720 :                           citations=[Weber2009])
    1240              : 
    1241              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    1242              :                           description="controls the activation of the epr calculation", &
    1243              :                           usage="&EPR T", &
    1244              :                           default_l_val=.FALSE., &
    1245         1360 :                           lone_keyword_l_val=.TRUE.)
    1246         1360 :       CALL section_add_keyword(section, keyword)
    1247         1360 :       CALL keyword_release(keyword)
    1248              : 
    1249              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_EPR", &
    1250              :                           description="Restart the EPR calculation from a previous run (NOT WORKING)", &
    1251              :                           usage="RESTART_EPR", default_l_val=.FALSE., &
    1252         1360 :                           lone_keyword_l_val=.TRUE.)
    1253         1360 :       CALL section_add_keyword(section, keyword)
    1254         1360 :       CALL keyword_release(keyword)
    1255              : 
    1256         1360 :       NULLIFY (subsection)
    1257              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    1258              :                           description="print results of epr calculation", &
    1259         1360 :                           repeats=.FALSE.)
    1260              : 
    1261              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "NABLAVKS_CUBES", &
    1262              :                                        description="Controls the printing of the components of nabla v_ks ", &
    1263         1360 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
    1264              :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    1265              :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1266              :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1267              :                           " 1 number valid for all components.", &
    1268         1360 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
    1269         1360 :       CALL section_add_keyword(print_key, keyword)
    1270         1360 :       CALL keyword_release(keyword)
    1271              :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1272              :                           description="append the cube files when they already exist", &
    1273         1360 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1274         1360 :       CALL section_add_keyword(print_key, keyword)
    1275         1360 :       CALL keyword_release(keyword)
    1276              : 
    1277         1360 :       CALL section_add_subsection(subsection, print_key)
    1278         1360 :       CALL section_release(print_key)
    1279              : 
    1280              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "G_TENSOR", &
    1281              :                                        description="Controls the printing of the g tensor", &
    1282         1360 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
    1283         1360 :       CALL create_xc_section(subsubsection)
    1284         1360 :       CALL section_add_subsection(print_key, subsubsection)
    1285         1360 :       CALL section_release(subsubsection)
    1286              : 
    1287              :       CALL keyword_create(keyword, __LOCATION__, name="GAPW_MAX_ALPHA", &
    1288              :                           description="Maximum alpha of GTH potentials allowed on the soft grids ", &
    1289         1360 :                           usage="GAPW_MAX_ALPHA real", default_r_val=5.0_dp)
    1290         1360 :       CALL section_add_keyword(print_key, keyword)
    1291         1360 :       CALL keyword_release(keyword)
    1292              : 
    1293              :       CALL keyword_create(keyword, __LOCATION__, name="SOO_RHO_HARD", &
    1294              :                           description="Whether or not to include the atomic parts of the density "// &
    1295              :                           "in the SOO part of the g tensor", usage="SOO_RHO_HARD", &
    1296         1360 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1297         1360 :       CALL section_add_keyword(print_key, keyword)
    1298         1360 :       CALL keyword_release(keyword)
    1299              : 
    1300         1360 :       CALL section_add_subsection(subsection, print_key)
    1301         1360 :       CALL section_release(print_key)
    1302              : 
    1303              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESPONSE_FUNCTION_CUBES", &
    1304              :                                        description="Controls the printing of the response functions ", &
    1305         1360 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
    1306              :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    1307              :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1308              :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1309              :                           " 1 number valid for all components.", &
    1310         1360 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
    1311         1360 :       CALL section_add_keyword(print_key, keyword)
    1312         1360 :       CALL keyword_release(keyword)
    1313              : 
    1314              :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LU_BOUNDS", &
    1315              :                           variants=["CUBES_LU"], &
    1316              :                           description="The lower and upper index of the states to be printed as cube", &
    1317              :                           usage="CUBES_LU_BOUNDS integer integer", &
    1318         2720 :                           n_var=2, default_i_vals=[0, -2], type_of_var=integer_t)
    1319         1360 :       CALL section_add_keyword(print_key, keyword)
    1320         1360 :       CALL keyword_release(keyword)
    1321              : 
    1322              :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LIST", &
    1323              :                           description="Indexes of the states to be printed as cube files "// &
    1324              :                           "This keyword can be repeated several times "// &
    1325              :                           "(useful if you have to specify many indexes).", &
    1326              :                           usage="CUBES_LIST 1 2", &
    1327         1360 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    1328         1360 :       CALL section_add_keyword(print_key, keyword)
    1329         1360 :       CALL keyword_release(keyword)
    1330              :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1331              :                           description="append the cube files when they already exist", &
    1332         1360 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1333         1360 :       CALL section_add_keyword(print_key, keyword)
    1334         1360 :       CALL keyword_release(keyword)
    1335              : 
    1336         1360 :       CALL section_add_subsection(subsection, print_key)
    1337         1360 :       CALL section_release(print_key)
    1338              : 
    1339         1360 :       CALL section_add_subsection(section, subsection)
    1340         1360 :       CALL section_release(subsection)
    1341              : 
    1342         1360 :       NULLIFY (subsection)
    1343         1360 :       CALL create_interp_section(subsection)
    1344         1360 :       CALL section_add_subsection(section, subsection)
    1345         1360 :       CALL section_release(subsection)
    1346              : 
    1347         1360 :    END SUBROUTINE create_epr_section
    1348              : 
    1349              : ! **************************************************************************************************
    1350              : !> \brief creates the input structure used to activate
    1351              : !>      calculation of polarizability tensor DFPT
    1352              : !>      Available properties : none
    1353              : !> \param section the section to create
    1354              : !> \author SL
    1355              : ! **************************************************************************************************
    1356         1360 :    SUBROUTINE create_polarizability_section(section)
    1357              : 
    1358              :       TYPE(section_type), POINTER                        :: section
    1359              : 
    1360              :       TYPE(keyword_type), POINTER                        :: keyword
    1361              :       TYPE(section_type), POINTER                        :: print_key, subsection
    1362              : 
    1363         1360 :       NULLIFY (keyword, print_key, subsection)
    1364              : 
    1365         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
    1366              :       CALL section_create(section, __LOCATION__, name="POLAR", &
    1367              :                           description="Compute polarizabilities.", &
    1368              :                           n_keywords=5, n_subsections=1, repeats=.FALSE., &
    1369         2720 :                           citations=[Putrino2002])
    1370              : 
    1371              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    1372              :                           description="controls the activation of the polarizability calculation", &
    1373              :                           usage="&POLAR T", &
    1374              :                           default_l_val=.FALSE., &
    1375         1360 :                           lone_keyword_l_val=.TRUE.)
    1376         1360 :       CALL section_add_keyword(section, keyword)
    1377         1360 :       CALL keyword_release(keyword)
    1378              : 
    1379              :       CALL keyword_create(keyword, __LOCATION__, name="DO_RAMAN", &
    1380              :                           description="Compute the electric-dipole--electric-dipole polarizability", &
    1381              :                           usage="DO_RAMAN F", &
    1382              :                           citations=[Luber2014], &
    1383         2720 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1384         1360 :       CALL section_add_keyword(section, keyword)
    1385         1360 :       CALL keyword_release(keyword)
    1386              : 
    1387              :       CALL keyword_create(keyword, __LOCATION__, name="PERIODIC_DIPOLE_OPERATOR", &
    1388              :                           description="Type of dipole operator: Berry phase(T) or Local(F)", &
    1389              :                           usage="PERIODIC_DIPOLE_OPERATOR T", &
    1390         1360 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1391         1360 :       CALL section_add_keyword(section, keyword)
    1392         1360 :       CALL keyword_release(keyword)
    1393              : 
    1394         1360 :       NULLIFY (subsection)
    1395              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    1396              :                           description="print results of the polarizability calculation", &
    1397         1360 :                           repeats=.FALSE.)
    1398              : 
    1399              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "POLAR_MATRIX", &
    1400              :                                        description="Controls the printing of the polarizabilities", &
    1401         1360 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="")
    1402              : 
    1403         1360 :       CALL section_add_subsection(subsection, print_key)
    1404         1360 :       CALL section_release(print_key)
    1405         1360 :       CALL section_add_subsection(section, subsection)
    1406         1360 :       CALL section_release(subsection)
    1407              : 
    1408         1360 :       NULLIFY (subsection)
    1409         1360 :       CALL create_interp_section(subsection)
    1410         1360 :       CALL section_add_subsection(section, subsection)
    1411         1360 :       CALL section_release(subsection)
    1412              : 
    1413         1360 :    END SUBROUTINE create_polarizability_section
    1414              : 
    1415              : ! **************************************************************************************************
    1416              : !> \brief creates the section for electron transfer coupling
    1417              : !> \param section ...
    1418              : !> \author fschiff
    1419              : ! **************************************************************************************************
    1420         1360 :    SUBROUTINE create_et_coupling_section(section)
    1421              :       TYPE(section_type), POINTER                        :: section
    1422              : 
    1423              :       TYPE(keyword_type), POINTER                        :: keyword
    1424              :       TYPE(section_type), POINTER                        :: print_key, subsection
    1425              : 
    1426         1360 :       NULLIFY (keyword)
    1427         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
    1428              :       CALL section_create(section, __LOCATION__, name="ET_COUPLING", &
    1429              :                           description="specifies the two constraints/restraints for extracting ET coupling elements", &
    1430         4080 :                           n_keywords=1, n_subsections=4, repeats=.FALSE., citations=[Kondov2007, Futera2017])
    1431              : 
    1432         1360 :       NULLIFY (subsection)
    1433         1360 :       CALL create_ddapc_restraint_section(subsection, "DDAPC_RESTRAINT_A")
    1434         1360 :       CALL section_add_subsection(section, subsection)
    1435         1360 :       CALL section_release(subsection)
    1436              : 
    1437         1360 :       NULLIFY (subsection)
    1438         1360 :       CALL create_ddapc_restraint_section(subsection, "DDAPC_RESTRAINT_B")
    1439         1360 :       CALL section_add_subsection(section, subsection)
    1440         1360 :       CALL section_release(subsection)
    1441              : 
    1442         1360 :       NULLIFY (subsection)
    1443         1360 :       CALL create_projection(subsection, "PROJECTION")
    1444         1360 :       CALL section_add_subsection(section, subsection)
    1445         1360 :       CALL section_release(subsection)
    1446              : 
    1447              :       CALL keyword_create(keyword, __LOCATION__, name="TYPE_OF_CONSTRAINT", &
    1448              :                           description="Specifies the type of constraint", &
    1449              :                           usage="TYPE_OF_CONSTRAINT DDAPC", &
    1450              :                           enum_c_vals=s2a("NONE", "DDAPC"), &
    1451              :                           enum_i_vals=[do_no_et, do_et_ddapc], &
    1452              :                           enum_desc=s2a("NONE", "DDAPC Constraint"), &
    1453         1360 :                           default_i_val=do_no_et)
    1454         1360 :       CALL section_add_keyword(section, keyword)
    1455         1360 :       CALL keyword_release(keyword)
    1456              : 
    1457         1360 :       NULLIFY (print_key)
    1458              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
    1459              :                                        description="Controls the printing basic info about the method", &
    1460         1360 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    1461         1360 :       CALL section_add_subsection(section, print_key)
    1462         1360 :       CALL section_release(print_key)
    1463              : 
    1464         1360 :    END SUBROUTINE create_et_coupling_section
    1465              : 
    1466              : ! **************************************************************************************************
    1467              : !> \brief defines input sections for specification of Hilbert space partitioning
    1468              : !>        in projection-operator approach of electronic coupling calulation
    1469              : !> \param section pointer to the section data structure
    1470              : !> \param section_name name of the projection section
    1471              : !> \author Z. Futera (02.2017)
    1472              : ! **************************************************************************************************
    1473         1360 :    SUBROUTINE create_projection(section, section_name)
    1474              : 
    1475              :       ! Routine arguments
    1476              :       TYPE(section_type), POINTER                        :: section
    1477              :       CHARACTER(len=*), INTENT(in)                       :: section_name
    1478              : 
    1479              :       TYPE(keyword_type), POINTER                        :: keyword
    1480              :       TYPE(section_type), POINTER                        :: print_key, section_block, section_print
    1481              : 
    1482              : ! Routine name for dubug purposes
    1483              : 
    1484              :       ! Sanity check
    1485            0 :       CPASSERT(.NOT. ASSOCIATED(section))
    1486              : 
    1487              :       ! Initialization
    1488         1360 :       NULLIFY (keyword)
    1489         1360 :       NULLIFY (print_key)
    1490         1360 :       NULLIFY (section_block)
    1491         1360 :       NULLIFY (section_print)
    1492              : 
    1493              :       ! Input-file section definition
    1494              :       CALL section_create(section, __LOCATION__, name=TRIM(ADJUSTL(section_name)), &
    1495              :                           description="Projection-operator approach fo ET coupling calculation", &
    1496         1360 :                           n_keywords=0, n_subsections=2, repeats=.FALSE.)
    1497              : 
    1498              :       ! Subsection #0: Log printing
    1499              :       CALL cp_print_key_section_create(print_key, __LOCATION__, 'PROGRAM_RUN_INFO', &
    1500              :                                        description="Controls printing of data and informations to log file", &
    1501         1360 :                                        print_level=low_print_level, filename="__STD_OUT__")
    1502         1360 :       CALL section_add_subsection(section, print_key)
    1503         1360 :       CALL section_release(print_key)
    1504              : 
    1505              :       ! Subsection #1: Atomic blocks
    1506              :       CALL section_create(section_block, __LOCATION__, name='BLOCK', &
    1507              :                           description="Part of the system (donor, acceptor, bridge,...)", &
    1508         1360 :                           n_keywords=2, n_subsections=1, repeats=.TRUE.)
    1509         1360 :       CALL section_add_subsection(section, section_block)
    1510              : 
    1511              :       ! S#1 - Keyword #1: Atom IDs defining a Hilbert space block
    1512              :       CALL keyword_create(keyword, __LOCATION__, name='ATOMS', &
    1513              :                           description="Array of atom IDs in the system part", &
    1514              :                           usage="ATOMS {integer} {integer} .. {integer}", &
    1515         1360 :                           n_var=-1, type_of_var=integer_t, repeats=.FALSE.)
    1516         1360 :       CALL section_add_keyword(section_block, keyword)
    1517         1360 :       CALL keyword_release(keyword)
    1518              : 
    1519              :       ! S#1 - Keyword #1: Atom IDs defining a Hilbert space block
    1520              :       CALL keyword_create(keyword, __LOCATION__, name='NELECTRON', &
    1521              :                           description="Number of electrons expected in the system part", &
    1522         1360 :                           usage="NELECTRON {integer}", default_i_val=0)
    1523         1360 :       CALL section_add_keyword(section_block, keyword)
    1524         1360 :       CALL keyword_release(keyword)
    1525              : 
    1526              :       ! S#1 - Subsection #1: Printing setting
    1527              :       CALL section_create(section_print, __LOCATION__, name='PRINT', &
    1528              :                           description="Possible printing options in ET system part", &
    1529         1360 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
    1530         1360 :       CALL section_add_subsection(section_block, section_print)
    1531              : 
    1532              :       ! S#1 - S#1 - Keyword #1: MO coefficient on specific atom
    1533              :       CALL keyword_create(keyword, __LOCATION__, name='MO_COEFF_ATOM', &
    1534              :                           description="Print out MO coeffiecients on given atom", &
    1535              :                           usage="MO_COEFF_ATOM {integer} {integer} .. {integer}", &
    1536         1360 :                           type_of_var=integer_t, n_var=-1, repeats=.TRUE.)
    1537         1360 :       CALL section_add_keyword(section_print, keyword)
    1538         1360 :       CALL keyword_release(keyword)
    1539              : 
    1540              :       ! S#1 - S#1 - Keyword #1: MO coefficient of specific state
    1541              :       CALL keyword_create(keyword, __LOCATION__, name='MO_COEFF_ATOM_STATE', &
    1542              :                           description="Print out MO coeffiecients of specific state", &
    1543              :                           usage="MO_COEFF_ATOM_STATE {integer} {integer} .. {integer}", &
    1544         1360 :                           type_of_var=integer_t, n_var=-1, repeats=.TRUE.)
    1545         1360 :       CALL section_add_keyword(section_print, keyword)
    1546         1360 :       CALL keyword_release(keyword)
    1547              : 
    1548              :       ! S#1 - S#1 - Subsection #1: Saving MOs to CUBE files
    1549              :       CALL cp_print_key_section_create(print_key, __LOCATION__, 'MO_CUBES', &
    1550              :                                        description="Controls saving of MO cube files", &
    1551         1360 :                                        print_level=high_print_level, filename="")
    1552              : 
    1553              :       ! S#1 - S#1 - S#1 - Keyword #1: Stride
    1554              :       CALL keyword_create(keyword, __LOCATION__, name='STRIDE', &
    1555              :                           description="The stride (X,Y,Z) used to write the cube file", &
    1556              :                           usage="STRIDE {integer} {integer} {integer}", n_var=-1, &
    1557         1360 :                           default_i_vals=[2, 2, 2], type_of_var=integer_t)
    1558         1360 :       CALL section_add_keyword(print_key, keyword)
    1559         1360 :       CALL keyword_release(keyword)
    1560              : 
    1561              :       ! S#1 - S#1 - S#1 - Keyword #2: List of MO IDs
    1562              :       CALL keyword_create(keyword, __LOCATION__, name='MO_LIST', &
    1563              :                           description="Indices of molecular orbitals to save", &
    1564              :                           usage="MO_LIST {integer} {integer} .. {integer}", &
    1565         1360 :                           type_of_var=integer_t, n_var=-1, repeats=.TRUE.)
    1566         1360 :       CALL section_add_keyword(print_key, keyword)
    1567         1360 :       CALL keyword_release(keyword)
    1568              : 
    1569              :       ! S#1 - S#1 - S#1 - Keyword #2: Number of unoccupied states
    1570              :       CALL keyword_create(keyword, __LOCATION__, name='NLUMO', &
    1571              :                           description="Number of unoccupied molecular orbitals to save", &
    1572         1360 :                           usage="NLUMO {integer}", default_i_val=1)
    1573         1360 :       CALL section_add_keyword(print_key, keyword)
    1574         1360 :       CALL keyword_release(keyword)
    1575              : 
    1576              :       ! S#1 - S#1 - S#1 - Keyword #3: Number of occupied states
    1577              :       CALL keyword_create(keyword, __LOCATION__, name='NHOMO', &
    1578              :                           description="Number of occupied molecular orbitals to save", &
    1579         1360 :                           usage="NHOMO {integer}", default_i_val=1)
    1580         1360 :       CALL section_add_keyword(print_key, keyword)
    1581         1360 :       CALL keyword_release(keyword)
    1582              : 
    1583         1360 :       CALL section_add_subsection(section_print, print_key)
    1584         1360 :       CALL section_release(print_key)
    1585              : 
    1586              :       ! S#1 - S#1 - Clean
    1587         1360 :       CALL section_release(section_print)
    1588              : 
    1589              :       ! S#1 - Clean
    1590         1360 :       CALL section_release(section_block)
    1591              : 
    1592              :       ! S#1 - Subsection #1: Printing setting
    1593              :       CALL section_create(section_print, __LOCATION__, name='PRINT', &
    1594              :                           description="Possible printing options in ET", &
    1595         1360 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
    1596         1360 :       CALL section_add_subsection(section, section_print)
    1597              : 
    1598              :       ! Print couplings
    1599              :       CALL cp_print_key_section_create(print_key, __LOCATION__, 'COUPLINGS', &
    1600              :                                        description="Controls printing couplings onto file", &
    1601         1360 :                                        print_level=low_print_level, filename="")
    1602              : 
    1603              :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1604              :                           description="append the files when they already exist", &
    1605         1360 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1606         1360 :       CALL section_add_keyword(print_key, keyword)
    1607         1360 :       CALL keyword_release(keyword)
    1608              : 
    1609         1360 :       CALL section_add_subsection(section_print, print_key)
    1610         1360 :       CALL section_release(print_key)
    1611              : 
    1612         1360 :       CALL section_release(section_print)
    1613              : 
    1614         1360 :    END SUBROUTINE create_projection
    1615              : 
    1616              : ! **************************************************************************************************
    1617              : !> \brief creates an input section for tddfpt calculation
    1618              : !> \param section section to create
    1619              : !> \par History
    1620              : !>    * 05.2016 forked from create_tddfpt_section [Sergey Chulkov]
    1621              : !>    * 08.2016 moved from module input_cp2k_dft [Sergey Chulkov]
    1622              : ! **************************************************************************************************
    1623         2720 :    SUBROUTINE create_tddfpt2_section(section)
    1624              :       TYPE(section_type), POINTER                        :: section
    1625              : 
    1626              :       TYPE(keyword_type), POINTER                        :: keyword
    1627              :       TYPE(section_type), POINTER                        :: print_key, subsection
    1628              : 
    1629         2720 :       CPASSERT(.NOT. ASSOCIATED(section))
    1630              :       CALL section_create(section, __LOCATION__, name="TDDFPT", &
    1631              :                           description="Controls time-dependent density functional perturbation theory "// &
    1632              :                           "(TDDFPT) calculations for electronic excitations and related properties.", &
    1633              :                           n_keywords=14, n_subsections=4, repeats=.FALSE., &
    1634        10880 :                           citations=[Iannuzzi2005, Hanasaki2025, Hernandez2025])
    1635              : 
    1636         2720 :       NULLIFY (keyword, print_key, subsection)
    1637              : 
    1638              :       CALL keyword_create(keyword, __LOCATION__, &
    1639              :                           name="_SECTION_PARAMETERS_", &
    1640              :                           description="Activates the TDDFPT procedure.", &
    1641              :                           default_l_val=.FALSE., &
    1642         2720 :                           lone_keyword_l_val=.TRUE.)
    1643         2720 :       CALL section_add_keyword(section, keyword)
    1644         2720 :       CALL keyword_release(keyword)
    1645              : 
    1646              :       ! Integer
    1647              :       CALL keyword_create(keyword, __LOCATION__, name="NSTATES", &
    1648              :                           description="Number of excited states to converge.", &
    1649              :                           n_var=1, type_of_var=integer_t, &
    1650         2720 :                           default_i_val=1)
    1651         2720 :       CALL section_add_keyword(section, keyword)
    1652         2720 :       CALL keyword_release(keyword)
    1653              : 
    1654              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
    1655              :                           description="Maximal number of iterations to be performed.", &
    1656              :                           n_var=1, type_of_var=integer_t, &
    1657         2720 :                           default_i_val=50)
    1658         2720 :       CALL section_add_keyword(section, keyword)
    1659         2720 :       CALL keyword_release(keyword)
    1660              : 
    1661              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_KV", &
    1662              :                           description="Maximal number of Krylov space vectors. "// &
    1663              :                           "Davidson iterations will be restarted upon reaching this limit.", &
    1664              :                           n_var=1, type_of_var=integer_t, &
    1665         2720 :                           default_i_val=5000)
    1666         2720 :       CALL section_add_keyword(section, keyword)
    1667         2720 :       CALL keyword_release(keyword)
    1668              : 
    1669              :       CALL keyword_create(keyword, __LOCATION__, name="NLUMO", &
    1670              :                           description="Number of unoccupied orbitals to consider. "// &
    1671              :                           "Default is to use all unoccupied orbitals (-1).", &
    1672              :                           n_var=1, type_of_var=integer_t, &
    1673         2720 :                           default_i_val=-1)
    1674         2720 :       CALL section_add_keyword(section, keyword)
    1675         2720 :       CALL keyword_release(keyword)
    1676              : 
    1677              :       CALL keyword_create(keyword, __LOCATION__, name="NPROC_STATE", &
    1678              :                           description="Number of MPI processes to be used per excited state. "// &
    1679              :                           "Default is to use all MPI processes (0).", &
    1680              :                           n_var=1, type_of_var=integer_t, &
    1681         2720 :                           default_i_val=0)
    1682         2720 :       CALL section_add_keyword(section, keyword)
    1683         2720 :       CALL keyword_release(keyword)
    1684              : 
    1685              :       ! kernel type
    1686              :       CALL keyword_create(keyword, __LOCATION__, name="KERNEL", &
    1687              :                           description="Options to compute the kernel", &
    1688              :                           usage="KERNEL FULL", &
    1689              :                           enum_c_vals=s2a("FULL", "sTDA", "NONE"), &
    1690              :                           enum_i_vals=[tddfpt_kernel_full, tddfpt_kernel_stda, tddfpt_kernel_none], &
    1691         2720 :                           default_i_val=tddfpt_kernel_full)
    1692         2720 :       CALL section_add_keyword(section, keyword)
    1693         2720 :       CALL keyword_release(keyword)
    1694              : 
    1695              :       ! spin-flip TDDFPT options
    1696              :       CALL keyword_create(keyword, __LOCATION__, name="SPINFLIP", &
    1697              :                           description="Selects the type of spin-flip TDDFPT kernel", &
    1698              :                           usage="SPINFLIP NONCOLLINEAR", &
    1699              :                           enum_c_vals=s2a("NONE", "COLLINEAR", "NONCOLLINEAR"), &
    1700              :                           enum_i_vals=[no_sf_tddfpt, tddfpt_sf_col, tddfpt_sf_noncol], &
    1701              :                           enum_desc=s2a("Only molecular orbital energy differences are considered", &
    1702              :                                         "MO energy diferences and Fock exchange contributions are "// &
    1703              :                                         "considered", &
    1704              :                                         "MO energy differences, Fock exchange and "// &
    1705              :                                         "Noncollinear local exchange-correlation "// &
    1706              :                                         "kernel are considered"), &
    1707         5440 :                           default_i_val=no_sf_tddfpt, citations=[Hernandez2025])
    1708         2720 :       CALL section_add_keyword(section, keyword)
    1709         2720 :       CALL keyword_release(keyword)
    1710              : 
    1711              :       CALL keyword_create(keyword, __LOCATION__, name="OE_CORR", &
    1712              :                           description="Orbital energy correction potential.", &
    1713              :                           enum_c_vals=s2a("NONE", "LB94", "GLLB", "SAOP", "SHIFT"), &
    1714              :                           enum_i_vals=[oe_none, oe_lb, oe_gllb, oe_saop, oe_shift], &
    1715              :                           enum_desc=s2a("No orbital correction scheme is used", &
    1716              :                                         "van Leeuwen and Baerends. PRA, 49:2421, 1994", &
    1717              :                                         "Gritsenko, van Leeuwen, van Lenthe, Baerends. PRA, 51:1944, 1995", &
    1718              :                                         "Gritsenko, Schipper, Baerends. Chem. Phys. Lett., 302:199, 1999", &
    1719              :                                         "Constant shift of virtual and/or open-shell orbitals"), &
    1720         2720 :                           default_i_val=oe_none)
    1721         2720 :       CALL section_add_keyword(section, keyword)
    1722         2720 :       CALL keyword_release(keyword)
    1723              : 
    1724              :       ! SHIFTS
    1725              :       CALL keyword_create(keyword, __LOCATION__, name="EV_SHIFT", &
    1726              :                           variants=s2a("VIRTUAL_SHIFT"), &
    1727              :                           description="Constant shift of virtual state eigenvalues.", &
    1728              :                           usage="EV_SHIFT 0.500", &
    1729              :                           n_var=1, type_of_var=real_t, &
    1730              :                           unit_str="eV", &
    1731         2720 :                           default_r_val=0.0_dp)
    1732         2720 :       CALL section_add_keyword(section, keyword)
    1733         2720 :       CALL keyword_release(keyword)
    1734              :       !
    1735              :       CALL keyword_create(keyword, __LOCATION__, name="EOS_SHIFT", &
    1736              :                           variants=s2a("OPEN_SHELL_SHIFT"), &
    1737              :                           description="Constant shift of open shell eigenvalues.", &
    1738              :                           usage="EOS_SHIFT 0.200", &
    1739              :                           n_var=1, type_of_var=real_t, &
    1740              :                           unit_str="eV", &
    1741         2720 :                           default_r_val=0.0_dp)
    1742         2720 :       CALL section_add_keyword(section, keyword)
    1743         2720 :       CALL keyword_release(keyword)
    1744              : 
    1745              :       ! Real
    1746              :       CALL keyword_create(keyword, __LOCATION__, name="CONVERGENCE", &
    1747              :                           description="Target accuracy for excited state energies.", &
    1748              :                           n_var=1, type_of_var=real_t, unit_str="hartree", &
    1749         2720 :                           default_r_val=1.0e-5_dp)
    1750         2720 :       CALL section_add_keyword(section, keyword)
    1751         2720 :       CALL keyword_release(keyword)
    1752              : 
    1753              :       CALL keyword_create(keyword, __LOCATION__, name="MIN_AMPLITUDE", &
    1754              :                           description="The smallest excitation amplitude to print.", &
    1755              :                           n_var=1, type_of_var=real_t, &
    1756         2720 :                           default_r_val=5.0e-2_dp)
    1757         2720 :       CALL section_add_keyword(section, keyword)
    1758         2720 :       CALL keyword_release(keyword)
    1759              : 
    1760              :       CALL keyword_create(keyword, __LOCATION__, name="ORTHOGONAL_EPS", &
    1761              :                           description="The largest possible overlap between the ground state and "// &
    1762              :                           "orthogonalised excited state wave-functions. Davidson iterations "// &
    1763              :                           "will be restarted when the overlap goes beyond this threshold in "// &
    1764              :                           "order to prevent numerical instability.", &
    1765              :                           n_var=1, type_of_var=real_t, &
    1766         2720 :                           default_r_val=1.0e-4_dp)
    1767         2720 :       CALL section_add_keyword(section, keyword)
    1768         2720 :       CALL keyword_release(keyword)
    1769              : 
    1770              :       ! Logical
    1771              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART", &
    1772              :                           description="Restart the TDDFPT calculation if a restart file exists", &
    1773              :                           n_var=1, type_of_var=logical_t, &
    1774         2720 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1775         2720 :       CALL section_add_keyword(section, keyword)
    1776         2720 :       CALL keyword_release(keyword)
    1777              : 
    1778              :       CALL keyword_create(keyword, __LOCATION__, name="RKS_TRIPLETS", &
    1779              :                           description="Compute triplet excited states using spin-unpolarised molecular orbitals.", &
    1780              :                           n_var=1, type_of_var=logical_t, &
    1781         2720 :                           default_l_val=.FALSE.)
    1782         2720 :       CALL section_add_keyword(section, keyword)
    1783         2720 :       CALL keyword_release(keyword)
    1784              : 
    1785              :       CALL keyword_create(keyword, __LOCATION__, name="ADMM_KERNEL_XC_CORRECTION", &
    1786              :                           description="Use/Ignore ADMM correction xc functional for TD kernel. "// &
    1787              :                           "XC correction functional is defined in ground state XC section.", &
    1788              :                           n_var=1, type_of_var=logical_t, &
    1789         2720 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1790         2720 :       CALL section_add_keyword(section, keyword)
    1791         2720 :       CALL keyword_release(keyword)
    1792              : 
    1793              :       CALL keyword_create(keyword, __LOCATION__, name="ADMM_KERNEL_CORRECTION_SYMMETRIC", &
    1794              :                           description="ADMM correction functional in kernel is applied symmetrically. "// &
    1795              :                           "Original implementation is using a non-symmetric formula.", &
    1796              :                           n_var=1, type_of_var=logical_t, &
    1797         2720 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1798         2720 :       CALL section_add_keyword(section, keyword)
    1799         2720 :       CALL keyword_release(keyword)
    1800              : 
    1801              :       CALL keyword_create(keyword, __LOCATION__, name="DO_LRIGPW", &
    1802              :                           description="Local resolution of identity for Coulomb contribution.", &
    1803              :                           n_var=1, type_of_var=logical_t, &
    1804         2720 :                           default_l_val=.FALSE.)
    1805         2720 :       CALL section_add_keyword(section, keyword)
    1806         2720 :       CALL keyword_release(keyword)
    1807              : 
    1808              :       CALL keyword_create(keyword, __LOCATION__, name="AUTO_BASIS", &
    1809              :                           description="Specify type and size of automatically generated auxiliary "// &
    1810              :                           "(RI) basis sets. Exactly two arguments are required for this option. "// &
    1811              :                           "The first argument of basis type should be one of the following: "// &
    1812              :                           "`P_LRI_AUX`. The second argument of basis size should be one of the "// &
    1813              :                           "following: `SMALL`, `MEDIUM`, `LARGE`, or `HUGE`. The default is not "// &
    1814              :                           "using any of these basis sets, requested by `AUTO_BASIS X X` (exactly "// &
    1815              :                           "as written here).", &
    1816              :                           usage="AUTO_BASIS {basis_type} {basis_size}", &
    1817         8160 :                           type_of_var=char_t, repeats=.TRUE., n_var=-1, default_c_vals=["X", "X"])
    1818         2720 :       CALL section_add_keyword(section, keyword)
    1819         2720 :       CALL keyword_release(keyword)
    1820              : 
    1821              :       CALL keyword_create(keyword, __LOCATION__, name="DO_SMEARING", &
    1822              :                           description="Implying smeared occupation. ", &
    1823              :                           n_var=1, type_of_var=logical_t, &
    1824         2720 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1825         2720 :       CALL section_add_keyword(section, keyword)
    1826         2720 :       CALL keyword_release(keyword)
    1827              : 
    1828              :       CALL keyword_create(keyword, __LOCATION__, name="EXCITON_DESCRIPTORS", &
    1829              :                           description="Compute exciton descriptors. "// &
    1830              :                           "Details given in Manual section about Bethe Salpeter equation.", &
    1831              :                           n_var=1, type_of_var=logical_t, &
    1832         2720 :                           default_l_val=.FALSE.)
    1833         2720 :       CALL section_add_keyword(section, keyword)
    1834         2720 :       CALL keyword_release(keyword)
    1835              : 
    1836              :       CALL keyword_create(keyword, __LOCATION__, name="DIRECTIONAL_EXCITON_DESCRIPTORS", &
    1837              :                           description="Print cartesian components of exciton descriptors.", &
    1838              :                           n_var=1, type_of_var=logical_t, &
    1839         2720 :                           default_l_val=.FALSE.)
    1840         2720 :       CALL section_add_keyword(section, keyword)
    1841         2720 :       CALL keyword_release(keyword)
    1842              : 
    1843              :       ! Strings
    1844              :       CALL keyword_create(keyword, __LOCATION__, name="WFN_RESTART_FILE_NAME", &
    1845              :                           variants=["RESTART_FILE_NAME"], &
    1846              :                           description="Name of the wave function restart file, may include a path."// &
    1847              :                           " If no file is specified, the default is to open the file as generated by"// &
    1848              :                           " the wave function restart print key.", &
    1849              :                           usage="WFN_RESTART_FILE_NAME <FILENAME>", &
    1850         5440 :                           type_of_var=lchar_t)
    1851         2720 :       CALL section_add_keyword(section, keyword)
    1852         2720 :       CALL keyword_release(keyword)
    1853              : 
    1854              :       ! DIPOLE subsection
    1855              :       CALL section_create(subsection, __LOCATION__, name="DIPOLE_MOMENTS", &
    1856              :                           description="Parameters to compute oscillator strengths in the dipole approximation.", &
    1857         2720 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
    1858              : 
    1859              :       CALL keyword_create(keyword, __LOCATION__, name="DIPOLE_FORM", &
    1860              :                           description="Form of dipole transition integrals.", &
    1861              :                           enum_c_vals=s2a("BERRY", "LENGTH", "VELOCITY", "VELOCITY_OLD", &
    1862              :                                           "SCF_MOMENT"), &
    1863              :                           enum_desc=s2a("Based on Berry phase formula (valid for fully periodic molecular systems only)", &
    1864              :                                         "Length form &lang; i | r | j &rang; (valid for non-periodic molecular systems only)", &
    1865              :                                         "Velocity form &lang; i | d/dr | j &rang;", &
    1866              :                                         "Old velocity form &lang; i | d/dr | j &rang;", &
    1867              :                                         "SCF molecular-orbital moment form for k-point TDDFPT"), &
    1868              :                           enum_i_vals=[tddfpt_dipole_berry, tddfpt_dipole_length, &
    1869              :                                        tddfpt_dipole_velocity, tddfpt_dipole_velocity_old, &
    1870              :                                        tddfpt_dipole_scf_moment], &
    1871         2720 :                           default_i_val=tddfpt_dipole_velocity)
    1872         2720 :       CALL section_add_keyword(subsection, keyword)
    1873         2720 :       CALL keyword_release(keyword)
    1874              : 
    1875              :       CALL keyword_create(keyword, __LOCATION__, name="REFERENCE", &
    1876              :                           description="Reference point to calculate electric "// &
    1877              :                           "dipole moments using the dipole integrals in the length form.", &
    1878              :                           enum_c_vals=s2a("COM", "COAC", "USER_DEFINED", "ZERO"), &
    1879              :                           enum_desc=s2a("Use Center of Mass", &
    1880              :                                         "Use Center of Atomic Charges", &
    1881              :                                         "Use User-defined Point", &
    1882              :                                         "Use Origin of Coordinate System"), &
    1883              :                           enum_i_vals=[use_mom_ref_com, &
    1884              :                                        use_mom_ref_coac, &
    1885              :                                        use_mom_ref_user, &
    1886              :                                        use_mom_ref_zero], &
    1887         2720 :                           default_i_val=use_mom_ref_com)
    1888         2720 :       CALL section_add_keyword(subsection, keyword)
    1889         2720 :       CALL keyword_release(keyword)
    1890              : 
    1891              :       CALL keyword_create(keyword, __LOCATION__, name="REFERENCE_POINT", &
    1892              :                           description="User-defined reference point.", &
    1893              :                           usage="REFERENCE_POINT x y z", &
    1894         2720 :                           repeats=.FALSE., n_var=3, type_of_var=real_t, unit_str='bohr')
    1895         2720 :       CALL section_add_keyword(subsection, keyword)
    1896         2720 :       CALL keyword_release(keyword)
    1897              : 
    1898         2720 :       CALL section_add_subsection(section, subsection)
    1899         2720 :       CALL section_release(subsection)
    1900              : 
    1901              :       ! SOC functional
    1902              : 
    1903              :       CALL section_create(subsection, __LOCATION__, name="SOC", &
    1904              :                           description="Is jet to be implemented", &
    1905         2720 :                           n_keywords=2, n_subsections=0, repeats=.FALSE.)
    1906              : 
    1907              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER", &
    1908              :                           variants=s2a("EPS_FILTER_MATRIX"), &
    1909              :                           description="The threshold used for sparse matrix operations", &
    1910              :                           usage="EPS_FILTER {real}", &
    1911              :                           type_of_var=real_t, &
    1912         2720 :                           default_r_val=1.0E-10_dp)
    1913         2720 :       CALL section_add_keyword(subsection, keyword)
    1914         2720 :       CALL keyword_release(keyword)
    1915              : 
    1916              :       CALL keyword_create(keyword, __LOCATION__, name="GRID", &
    1917              :                           variants=["ATOMIC_GRID"], &
    1918              :                           description="Specification of the atomic angular and radial grids for "// &
    1919              :                           "a atomic kind. This keyword must be repeated for all kinds!  "// &
    1920              :                           "Usage: GRID < LEBEDEV_GRID > < RADIAL_GRID >", &
    1921              :                           usage="GRID {string} {integer} {integer}", &
    1922         5440 :                           n_var=3, type_of_var=char_t, repeats=.TRUE.)
    1923         2720 :       CALL section_add_keyword(subsection, keyword)
    1924         2720 :       CALL keyword_release(keyword)
    1925              : 
    1926         2720 :       CALL section_add_subsection(section, subsection)
    1927         2720 :       CALL section_release(subsection)
    1928              : 
    1929              :       ! kernel XC functional
    1930         2720 :       CALL create_xc_section(subsection)
    1931         2720 :       CALL section_add_subsection(section, subsection)
    1932         2720 :       CALL section_release(subsection)
    1933              : 
    1934              :       ! MGRID subsection
    1935         2720 :       CALL create_mgrid_section(subsection, create_subsections=.FALSE.)
    1936         2720 :       CALL section_add_subsection(section, subsection)
    1937         2720 :       CALL section_release(subsection)
    1938              : 
    1939              :       ! sTDA subsection
    1940         2720 :       CALL create_stda_section(subsection)
    1941         2720 :       CALL section_add_subsection(section, subsection)
    1942         2720 :       CALL section_release(subsection)
    1943              : 
    1944              :       ! RSE subsection
    1945         2720 :       CALL create_res_section(subsection)
    1946         2720 :       CALL section_add_subsection(section, subsection)
    1947         2720 :       CALL section_release(subsection)
    1948              : 
    1949              :       CALL keyword_create(keyword, __LOCATION__, name="DO_BSE", &
    1950              :                           description="Choosing BSE kernel.", &
    1951         2720 :                           usage="DO_BSE", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1952         2720 :       CALL section_add_keyword(section, keyword)
    1953         2720 :       CALL keyword_release(keyword)
    1954              : 
    1955              :       CALL keyword_create(keyword, __LOCATION__, name="DO_BSE_W_ONLY", &
    1956              :                           description="Debug option for BSE kernel.", &
    1957         2720 :                           usage="DO_BSE_W_ONLY", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1958         2720 :       CALL section_add_keyword(section, keyword)
    1959         2720 :       CALL keyword_release(keyword)
    1960              : 
    1961              :       CALL keyword_create(keyword, __LOCATION__, name="DO_BSE_GW_ONLY", &
    1962              :                           description="Debug option for BSE kernel.", &
    1963         2720 :                           usage="DO_BSE_GW_ONLY", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1964         2720 :       CALL section_add_keyword(section, keyword)
    1965         2720 :       CALL keyword_release(keyword)
    1966              : 
    1967              :       ! LRI subsection
    1968         2720 :       CALL create_lrigpw_section(subsection)
    1969         2720 :       CALL section_add_subsection(section, subsection)
    1970         2720 :       CALL section_release(subsection)
    1971              : 
    1972              :       ! LINRES section
    1973         2720 :       CALL create_linres_section(subsection, create_subsections=.FALSE., default_set_tdlr=.TRUE.)
    1974         2720 :       CALL section_add_subsection(section, subsection)
    1975         2720 :       CALL section_release(subsection)
    1976              : 
    1977              :       ! PRINT subsection
    1978              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    1979         2720 :                           description="Printing of information during the TDDFT run.", repeats=.FALSE.)
    1980              : 
    1981              :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="PROGRAM_BANNER", &
    1982              :                                        description="Controls the printing of the banner for TDDFPT program", &
    1983         2720 :                                        print_level=silent_print_level, filename="__STD_OUT__")
    1984         2720 :       CALL section_add_subsection(subsection, print_key)
    1985         2720 :       CALL section_release(print_key)
    1986              : 
    1987              :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="GUESS_VECTORS", &
    1988              :                                        description="Controls the printing of initial guess vectors.", &
    1989         2720 :                                        print_level=low_print_level, filename="__STD_OUT__")
    1990         2720 :       CALL section_add_subsection(subsection, print_key)
    1991         2720 :       CALL section_release(print_key)
    1992              : 
    1993              :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="ITERATION_INFO", &
    1994              :                                        description="Controls the printing of basic iteration information "// &
    1995              :                                        "during the TDDFT run.", &
    1996         2720 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    1997         2720 :       CALL section_add_subsection(subsection, print_key)
    1998         2720 :       CALL section_release(print_key)
    1999              : 
    2000              :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="DETAILED_ENERGY", &
    2001              :                                        description="Controls the printing of detailed energy information "// &
    2002              :                                        "during the TDDFT run.", &
    2003         2720 :                                        print_level=medium_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    2004         2720 :       CALL section_add_subsection(subsection, print_key)
    2005         2720 :       CALL section_release(print_key)
    2006              : 
    2007              :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="BASIS_SET_FILE", &
    2008              :                                        description="Controls the printing of a file with all basis sets used.", &
    2009         2720 :                                        print_level=debug_print_level, filename="BASIS_SETS")
    2010         2720 :       CALL section_add_subsection(subsection, print_key)
    2011         2720 :       CALL section_release(print_key)
    2012              : 
    2013              :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="RESTART", &
    2014              :                                        description="Controls the dumping of the MO restart file during TDDFPT. "// &
    2015              :                                        "By default keeps a short history of three restarts.", &
    2016              :                                        print_level=low_print_level, common_iter_levels=3, &
    2017              :                                        each_iter_names=s2a("TDDFT_SCF"), each_iter_values=[10], &
    2018         2720 :                                        add_last=add_last_numeric, filename="RESTART")
    2019              :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    2020              :                           description="Specifies the maximum number of backup copies.", &
    2021              :                           usage="BACKUP_COPIES {int}", &
    2022         2720 :                           default_i_val=1)
    2023         2720 :       CALL section_add_keyword(print_key, keyword)
    2024         2720 :       CALL keyword_release(keyword)
    2025         2720 :       CALL section_add_subsection(subsection, print_key)
    2026         2720 :       CALL section_release(print_key)
    2027              : 
    2028              :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="NTO_ANALYSIS", &
    2029              :                                        description="Perform a natural transition orbital analysis.", &
    2030         2720 :                                        print_level=medium_print_level)
    2031              :       CALL keyword_create(keyword, __LOCATION__, name="THRESHOLD", &
    2032              :                           description="Threshold for sum of NTO eigenvalues considered", &
    2033              :                           usage="Threshold 0.95", &
    2034              :                           n_var=1, &
    2035              :                           type_of_var=real_t, &
    2036         2720 :                           default_r_val=0.975_dp)
    2037         2720 :       CALL section_add_keyword(print_key, keyword)
    2038         2720 :       CALL keyword_release(keyword)
    2039              :       CALL keyword_create(keyword, __LOCATION__, name="INTENSITY_THRESHOLD", &
    2040              :                           description="Threshold for oscillator strength to screen states.", &
    2041              :                           usage="Intensity_threshold 0.01", &
    2042              :                           n_var=1, &
    2043              :                           type_of_var=real_t, &
    2044         2720 :                           default_r_val=0.0_dp)
    2045         2720 :       CALL section_add_keyword(print_key, keyword)
    2046         2720 :       CALL keyword_release(keyword)
    2047              :       CALL keyword_create(keyword, __LOCATION__, name="STATE_LIST", &
    2048              :                           description="Specifies a list of states for the NTO calculations.", &
    2049              :                           usage="STATE_LIST {integer} {integer} .. {integer}", &
    2050         2720 :                           n_var=-1, type_of_var=integer_t)
    2051         2720 :       CALL section_add_keyword(print_key, keyword)
    2052         2720 :       CALL keyword_release(keyword)
    2053              :       CALL keyword_create(keyword, __LOCATION__, name="CUBE_FILES", &
    2054              :                           description="Print NTOs on Cube Files", &
    2055              :                           usage="CUBE_FILES {logical}", repeats=.FALSE., n_var=1, &
    2056         2720 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE., type_of_var=logical_t)
    2057         2720 :       CALL section_add_keyword(print_key, keyword)
    2058         2720 :       CALL keyword_release(keyword)
    2059              :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    2060              :                           description="The stride (X,Y,Z) used to write the cube file "// &
    2061              :                           "(larger values result in smaller cube files). Provide 3 numbers (for X,Y,Z) or"// &
    2062              :                           " 1 number valid for all components.", &
    2063         2720 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
    2064         2720 :       CALL section_add_keyword(print_key, keyword)
    2065         2720 :       CALL keyword_release(keyword)
    2066              :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    2067              :                           description="append the cube files when they already exist", &
    2068         2720 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2069         2720 :       CALL section_add_keyword(print_key, keyword)
    2070         2720 :       CALL keyword_release(keyword)
    2071         2720 :       CALL section_add_subsection(subsection, print_key)
    2072         2720 :       CALL section_release(print_key)
    2073              : 
    2074              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MOS_MOLDEN", &
    2075              :                                        description="Write the NTO in Molden file format, for visualisation.", &
    2076         2720 :                                        print_level=debug_print_level + 1, add_last=add_last_numeric, filename="MOS")
    2077              :       CALL keyword_create(keyword, __LOCATION__, name="UNIT", &
    2078              :                           description="Unit for coordinates and cell in the MOLDEN file.", &
    2079              :                           usage="UNIT ANGSTROM", &
    2080              :                           enum_c_vals=s2a("BOHR", "ANGSTROM"), &
    2081              :                           enum_desc=s2a("Write in Bohr (AU)", "Write in Angstrom"), &
    2082              :                           enum_i_vals=[1, 2], &
    2083         2720 :                           default_i_val=1)
    2084         2720 :       CALL section_add_keyword(print_key, keyword)
    2085         2720 :       CALL keyword_release(keyword)
    2086              :       CALL keyword_create(keyword, __LOCATION__, name="WRITE_CELL", &
    2087              :                           description="Controls whether the [Cell] block is written to the MOLDEN file.", &
    2088              :                           usage="WRITE_CELL TRUE", &
    2089         2720 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2090         2720 :       CALL section_add_keyword(print_key, keyword)
    2091         2720 :       CALL keyword_release(keyword)
    2092              :       CALL keyword_create(keyword, __LOCATION__, name="WRITE_PSEUDO", &
    2093              :                           description="Controls whether the [Pseudo] block is written to the MOLDEN file.", &
    2094              :                           usage="WRITE_PSEUDO TRUE", &
    2095         2720 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2096         2720 :       CALL section_add_keyword(print_key, keyword)
    2097         2720 :       CALL keyword_release(keyword)
    2098              :       CALL keyword_create(keyword, __LOCATION__, name="MARK_GHOST", &
    2099              :                           description="Controls whether ghost atoms are marked in the [Atoms] block by "// &
    2100              :                           "setting their atomic number to zero.", &
    2101              :                           usage="MARK_GHOST T", &
    2102         2720 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2103         2720 :       CALL section_add_keyword(print_key, keyword)
    2104         2720 :       CALL keyword_release(keyword)
    2105              :       CALL keyword_create(keyword, __LOCATION__, name="NDIGITS", &
    2106              :                           description="Specifies the number of significant digits retained. 3 is OK for visualization.", &
    2107              :                           usage="NDIGITS {int}", &
    2108         2720 :                           default_i_val=3)
    2109         2720 :       CALL section_add_keyword(print_key, keyword)
    2110         2720 :       CALL keyword_release(keyword)
    2111              :       CALL keyword_create(keyword, __LOCATION__, name="GTO_KIND", &
    2112              :                           description="Representation of Gaussian-type orbitals", &
    2113              :                           default_i_val=gto_spherical, &
    2114              :                           enum_c_vals=s2a("CARTESIAN", "SPHERICAL"), &
    2115              :                           enum_desc=s2a( &
    2116              :                           "Cartesian Gaussian orbitals. Use with caution", &
    2117              :                           "Spherical Gaussian orbitals. Incompatible with VMD"), &
    2118         2720 :                           enum_i_vals=[gto_cartesian, gto_spherical])
    2119         2720 :       CALL section_add_keyword(print_key, keyword)
    2120         2720 :       CALL keyword_release(keyword)
    2121         2720 :       CALL section_add_subsection(subsection, print_key)
    2122         2720 :       CALL section_release(print_key)
    2123              : 
    2124              :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="NAMD_PRINT", &
    2125              :                                        description="Controls the printout required for NAMD with NEWTONX.", &
    2126         2720 :                                        print_level=debug_print_level + 1, filename="CP2K_NEWTONX")
    2127              :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_VIRTUALS", &
    2128              :                           description="Print occupied AND virtual molecular orbital coefficients", &
    2129         2720 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2130         2720 :       CALL section_add_keyword(print_key, keyword)
    2131         2720 :       CALL keyword_release(keyword)
    2132              :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_PHASES", &
    2133              :                           description="Print phases of occupied and virtuals MOs.", &
    2134         2720 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2135         2720 :       CALL section_add_keyword(print_key, keyword)
    2136         2720 :       CALL keyword_release(keyword)
    2137              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_WITH_PHASES", &
    2138              :                           description="Scale ES eigenvectors with phases of occupied and virtuals MOs.", &
    2139         2720 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2140         2720 :       CALL section_add_keyword(print_key, keyword)
    2141         2720 :       CALL keyword_release(keyword)
    2142         2720 :       CALL section_add_subsection(subsection, print_key)
    2143         2720 :       CALL section_release(print_key)
    2144              : 
    2145              :       !! SOC PRINT SECTION
    2146              :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="SOC_PRINT", &
    2147              :                                        description="Controls the printout of the tddfpt2_soc modul", &
    2148         2720 :                                        print_level=debug_print_level + 1, filename="SOC")
    2149              :       CALL keyword_create(keyword, __LOCATION__, name="UNIT_eV", &
    2150              :                           description="Will detrement if output in eVolt will be printef.", &
    2151         2720 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    2152         2720 :       CALL section_add_keyword(print_key, keyword)
    2153         2720 :       CALL keyword_release(keyword)
    2154              :       CALL keyword_create(keyword, __LOCATION__, name="UNIT_wn", &
    2155              :                           description="Will detrement if output in wavenumbers will be printed.", &
    2156         2720 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2157         2720 :       CALL section_add_keyword(print_key, keyword)
    2158         2720 :       CALL keyword_release(keyword)
    2159              :       CALL keyword_create(keyword, __LOCATION__, name="SPLITTING", &
    2160              :                           description="Will add the SOC-Splitting as additional output", &
    2161         2720 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2162         2720 :       CALL section_add_keyword(print_key, keyword)
    2163         2720 :       CALL keyword_release(keyword)
    2164              :       CALL keyword_create(keyword, __LOCATION__, name="SOME", &
    2165              :                           description="Will add the SOC-Matrix as additional output in a different file", &
    2166         2720 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2167         2720 :       CALL section_add_keyword(print_key, keyword)
    2168         2720 :       CALL keyword_release(keyword)
    2169         2720 :       CALL section_add_subsection(subsection, print_key)
    2170         2720 :       CALL section_release(print_key)
    2171              : 
    2172              :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="FORCES", &
    2173              :                                        description="Controls the calculation and printing of excited state forces. "// &
    2174              :                                        "This needs a RUN_TYPE that includes force evaluation, e.g. ENERGY_FORCE", &
    2175         2720 :                                        print_level=debug_print_level, filename="TDFORCE")
    2176              :       CALL keyword_create(keyword, __LOCATION__, name="LIST", &
    2177              :                           description="Specifies a list of states for the force calculations.", &
    2178              :                           usage="LIST {integer} {integer} .. {integer}", repeats=.TRUE., &
    2179         2720 :                           n_var=-1, type_of_var=integer_t)
    2180         2720 :       CALL section_add_keyword(print_key, keyword)
    2181         2720 :       CALL keyword_release(keyword)
    2182              :       CALL keyword_create(keyword, __LOCATION__, name="THRESHOLD", &
    2183              :                           description="Threshold for oszillator strength to screen states.", &
    2184              :                           usage="Threshold 0.01", &
    2185              :                           n_var=1, &
    2186              :                           type_of_var=real_t, &
    2187         2720 :                           default_r_val=0.0_dp)
    2188         2720 :       CALL section_add_keyword(print_key, keyword)
    2189         2720 :       CALL keyword_release(keyword)
    2190         2720 :       CALL section_add_subsection(subsection, print_key)
    2191         2720 :       CALL section_release(print_key)
    2192              : 
    2193         2720 :       CALL section_add_subsection(section, subsection)
    2194         2720 :       CALL section_release(subsection)
    2195              : 
    2196         2720 :    END SUBROUTINE create_tddfpt2_section
    2197              : 
    2198              : ! **************************************************************************************************
    2199              : !> \brief creates the stda input section (simplified Tamm Dancoff Approximation)
    2200              : !> \param section the section to create
    2201              : ! **************************************************************************************************
    2202         2720 :    SUBROUTINE create_stda_section(section)
    2203              :       TYPE(section_type), POINTER                        :: section
    2204              : 
    2205              :       TYPE(keyword_type), POINTER                        :: keyword
    2206              : 
    2207         2720 :       CPASSERT(.NOT. ASSOCIATED(section))
    2208              :       CALL section_create(section, __LOCATION__, name="sTDA", &
    2209              :                           description="parameters needed and setup for sTDA calculations", &
    2210         2720 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
    2211         2720 :       NULLIFY (keyword)
    2212              : 
    2213              :       CALL keyword_create(keyword, __LOCATION__, name="FRACTION", &
    2214              :                           variants=["HFX_FRACTION"], &
    2215              :                           description="The fraction of TB Hartree-Fock exchange to use in the Kernel. "// &
    2216              :                           "0.0 implies no HFX part is used in the kernel. ", &
    2217         5440 :                           usage="FRACTION 0.0", default_r_val=0.0_dp)
    2218         2720 :       CALL section_add_keyword(section, keyword)
    2219         2720 :       CALL keyword_release(keyword)
    2220              : 
    2221              :       ! even if scaling parameter for exchange FRACTION (see above) is zero, the semi-empirical electron repulsion
    2222              :       ! operator for exchange is not, so that a keyword is required to switch off sTDA exchange (if wanted)
    2223              :       CALL keyword_create(keyword, __LOCATION__, name="DO_EXCHANGE", &
    2224              :                           description="Explicitly including or switching off sTDA exchange", &
    2225         2720 :                           usage="DO_EXCHANGE", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    2226         2720 :       CALL section_add_keyword(section, keyword)
    2227         2720 :       CALL keyword_release(keyword)
    2228              : 
    2229              :       CALL keyword_create(keyword, __LOCATION__, name="DO_EWALD", &
    2230              :                           description="Use Ewald type method for Coulomb interaction", &
    2231         2720 :                           usage="DO_EWALD", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2232         2720 :       CALL section_add_keyword(section, keyword)
    2233         2720 :       CALL keyword_release(keyword)
    2234              : 
    2235              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_TD_FILTER", &
    2236              :                           description="Threshold for filtering the transition density matrix", &
    2237         2720 :                           usage="EPS_TD_FILTER epsf", default_r_val=1.e-10_dp)
    2238         2720 :       CALL section_add_keyword(section, keyword)
    2239         2720 :       CALL keyword_release(keyword)
    2240              : 
    2241              :       CALL keyword_create(keyword, __LOCATION__, name="MATAGA_NISHIMOTO_CEXP", &
    2242              :                           description="Exponent used in Mataga-Nishimoto formula for Coulomb (alpha). "// &
    2243              :                           "Default value is method dependent!", &
    2244         2720 :                           usage="MATAGA_NISHIMOTO_CEXP cexp", default_r_val=-99.0_dp)
    2245         2720 :       CALL section_add_keyword(section, keyword)
    2246         2720 :       CALL keyword_release(keyword)
    2247              : 
    2248              :       CALL keyword_create(keyword, __LOCATION__, name="MATAGA_NISHIMOTO_XEXP", &
    2249              :                           description="Exponent used in Mataga-Nishimoto formula for Exchange (beta). "// &
    2250              :                           "Default value is method dependent!", &
    2251         2720 :                           usage="MATAGA_NISHIMOTO_XEXP xexp", default_r_val=-99.0_dp)
    2252         2720 :       CALL section_add_keyword(section, keyword)
    2253         2720 :       CALL keyword_release(keyword)
    2254              : 
    2255              :       CALL keyword_create(keyword, __LOCATION__, name="COULOMB_SR_CUT", &
    2256              :                           description="Maximum range of short range part of Coulomb interaction.", &
    2257         2720 :                           usage="COULOMB_SR_CUT rcut", default_r_val=20.0_dp)
    2258         2720 :       CALL section_add_keyword(section, keyword)
    2259         2720 :       CALL keyword_release(keyword)
    2260              : 
    2261              :       CALL keyword_create(keyword, __LOCATION__, name="COULOMB_SR_EPS", &
    2262              :                           description="Threshold for short range part of Coulomb interaction.", &
    2263         2720 :                           usage="COULOMB_SR_EPS sreps", default_r_val=1.e-03_dp)
    2264         2720 :       CALL section_add_keyword(section, keyword)
    2265         2720 :       CALL keyword_release(keyword)
    2266              : 
    2267         2720 :    END SUBROUTINE create_stda_section
    2268              : 
    2269              : ! **************************************************************************************************
    2270              : !> \brief creates the RES input section (Reduced Excitation Space)
    2271              : !> \param section the section to create
    2272              : ! **************************************************************************************************
    2273         2720 :    SUBROUTINE create_res_section(section)
    2274              :       TYPE(section_type), POINTER                        :: section
    2275              : 
    2276              :       TYPE(keyword_type), POINTER                        :: keyword
    2277              : 
    2278         2720 :       CPASSERT(.NOT. ASSOCIATED(section))
    2279              :       CALL section_create(section, __LOCATION__, name="REDUCED_EXCITATION_SPACE", &
    2280              :                           description="Sets up a restricted (reduced) excitation space for TDDFT", &
    2281         2720 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
    2282              : 
    2283         2720 :       NULLIFY (keyword)
    2284              :       CALL keyword_create(keyword, __LOCATION__, &
    2285              :                           name="_SECTION_PARAMETERS_", &
    2286              :                           description="Controls the activation of RES calculation.", &
    2287              :                           default_l_val=.FALSE., &
    2288         2720 :                           lone_keyword_l_val=.TRUE.)
    2289         2720 :       CALL section_add_keyword(section, keyword)
    2290         2720 :       CALL keyword_release(keyword)
    2291              : 
    2292              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_WINDOW", &
    2293              :                           description="Upper and lower cutoffs [eV] for orbitals to be included for excitations. ", &
    2294              :                           usage="ENERGY_WINDOW -5.0 0.0", default_r_vals=[-1.0E10_dp, 1.0E10_dp], &
    2295         2720 :                           type_of_var=real_t, unit_str="eV")
    2296         2720 :       CALL section_add_keyword(section, keyword)
    2297         2720 :       CALL keyword_release(keyword)
    2298              : 
    2299              :       CALL keyword_create(keyword, __LOCATION__, name="UPPER_ENERGY_CUTOFF", &
    2300              :                           description="Upper energy cutoff [eV] for orbitals to be included in excitations.", &
    2301              :                           usage="UPPER_ENERGY_CUTOFF -5.0", default_r_val=1.0E10_dp, &
    2302         2720 :                           type_of_var=real_t, unit_str="eV")
    2303         2720 :       CALL section_add_keyword(section, keyword)
    2304         2720 :       CALL keyword_release(keyword)
    2305              : 
    2306              :       CALL keyword_create(keyword, __LOCATION__, name="LOWER_ENERGY_CUTOFF", &
    2307              :                           description="Lower energy cutoff [eV] for orbitals to be included in excitations.", &
    2308              :                           usage="LOWER_ENERGY_CUTOFF -5.0", default_r_val=-1.0E10_dp, &
    2309         2720 :                           type_of_var=real_t, unit_str="eV")
    2310         2720 :       CALL section_add_keyword(section, keyword)
    2311         2720 :       CALL keyword_release(keyword)
    2312              : 
    2313              :       CALL keyword_create(keyword, __LOCATION__, name="MOLECULE_LIST", &
    2314              :                           description="Indices of molecules to be excited. "// &
    2315              :                           "This implies the calculation of molecular states through orbital location "// &
    2316              :                           "and subspace diagonalization.", &
    2317              :                           usage="MOLECULE_LIST {integer}  {integer} ..  {integer} ", &
    2318         2720 :                           n_var=-1, type_of_var=integer_t, repeats=.FALSE.)
    2319         2720 :       CALL section_add_keyword(section, keyword)
    2320         2720 :       CALL keyword_release(keyword)
    2321              : 
    2322         2720 :    END SUBROUTINE create_res_section
    2323              : 
    2324              : ! **************************************************************************************************
    2325              : !> \brief creates an input section for electronic band structure calculations
    2326              : !> \param section section to create
    2327              : !> \par History
    2328              : !>    * 07.2023 created [Jan Wilhelm]
    2329              : ! **************************************************************************************************
    2330         1360 :    SUBROUTINE create_bandstructure_section(section)
    2331              :       TYPE(section_type), POINTER                        :: section
    2332              : 
    2333              :       TYPE(keyword_type), POINTER                        :: keyword
    2334              :       TYPE(section_type), POINTER                        :: subsection
    2335              : 
    2336         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
    2337              :       CALL section_create(section, __LOCATION__, name="BANDSTRUCTURE", &
    2338              :                           description="Parameters needed to set up a calculation for "// &
    2339              :                           "electronic level energies of molecules and the electronic band "// &
    2340              :                           "structure of materials from post-SCF schemes (GW, perturbative "// &
    2341              :                           "spin-orbit coupling). Also, the density of states (DOS), "// &
    2342              :                           "projected density of states (PDOS), local density of states (LDOS), "// &
    2343              :                           "local valence band maximum (LVBM), local conduction band minimum "// &
    2344              :                           "(LCBM) and local band gap can be calculated. Please note that "// &
    2345              :                           "all methods in this section start from a Gamma-only DFT SCF. "// &
    2346              :                           "You need to make sure that the cell chosen in the DFT SCF is "// &
    2347              :                           "converged in the cell size. Band structures are computed "// &
    2348              :                           "for the primitive cell (i.e. the smallest possible unit cell of "// &
    2349              :                           "the input structure which is detected automatically). Moreover, "// &
    2350              :                           "spin-orbit coupling (SOC) on eigenvalues and band structures is "// &
    2351              :                           "available using Hartwigsen-Goedecker-Hutter "// &
    2352              :                           "pseudopotentials.", &
    2353         1360 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
    2354              : 
    2355         1360 :       NULLIFY (keyword, subsection)
    2356              :       CALL keyword_create(keyword, __LOCATION__, &
    2357              :                           name="_SECTION_PARAMETERS_", &
    2358              :                           description="Controls the activation of the band structure calculation.", &
    2359              :                           default_l_val=.FALSE., &
    2360         1360 :                           lone_keyword_l_val=.TRUE.)
    2361         1360 :       CALL section_add_keyword(section, keyword)
    2362         1360 :       CALL keyword_release(keyword)
    2363              : 
    2364              :       ! here we generate a subsection for getting a k-point path for the bandstructure
    2365         1360 :       CALL create_kpoint_set_section(subsection, "BANDSTRUCTURE_PATH")
    2366         1360 :       CALL section_add_subsection(section, subsection)
    2367         1360 :       CALL section_release(subsection)
    2368              : 
    2369         1360 :       CALL create_gw_section(subsection)
    2370         1360 :       CALL section_add_subsection(section, subsection)
    2371         1360 :       CALL section_release(subsection)
    2372              : 
    2373         1360 :       CALL create_soc_section(subsection)
    2374         1360 :       CALL section_add_subsection(section, subsection)
    2375         1360 :       CALL section_release(subsection)
    2376              : 
    2377         1360 :       CALL create_dos_section(subsection)
    2378         1360 :       CALL section_add_subsection(section, subsection)
    2379         1360 :       CALL section_release(subsection)
    2380              : 
    2381         1360 :       CALL create_floquet_section(subsection)
    2382         1360 :       CALL section_add_subsection(section, subsection)
    2383         1360 :       CALL section_release(subsection)
    2384              : 
    2385         1360 :    END SUBROUTINE create_bandstructure_section
    2386              : 
    2387              : ! **************************************************************************************************
    2388              : !> \brief creates an input section for a GW calculation for the electronic band structure
    2389              : !> \param section section to create
    2390              : !> \par History
    2391              : !>    * 07.2023 created [Jan Wilhelm]
    2392              : ! **************************************************************************************************
    2393         1360 :    SUBROUTINE create_gw_section(section)
    2394              :       TYPE(section_type), POINTER                        :: section
    2395              : 
    2396              :       TYPE(keyword_type), POINTER                        :: keyword
    2397              :       TYPE(section_type), POINTER                        :: print_key, subsection
    2398              : 
    2399         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
    2400              :       CALL section_create(section, __LOCATION__, name="GW", &
    2401              :                           description="Parameters needed to set up a GW calculation for "// &
    2402              :                           "electronic level energies $\varepsilon_{n\mathbf{k}}^{G_0W_0}$ "// &
    2403              :                           "of molecules and the band structure of materials: "// &
    2404              :                           "$\varepsilon_{n\mathbf{k}}^{G_0W_0}=  "// &
    2405              :                           "\varepsilon_{n\mathbf{k}}^\text{DFT}+\Sigma_{n\mathbf{k}} "// &
    2406              :                           "-v^\text{xc}_{n\mathbf{k}}$. "// &
    2407              :                           "For the GW algorithm for molecules, see "// &
    2408              :                           "<https://doi.org/10.1021/acs.jctc.0c01282>. "// &
    2409              :                           "For 2D materials, see <https://doi.org/10.1021/acs.jctc.3c01230>.", &
    2410         1360 :                           n_keywords=1, n_subsections=4, repeats=.FALSE.)
    2411              : 
    2412         1360 :       NULLIFY (keyword)
    2413              :       CALL keyword_create(keyword, __LOCATION__, &
    2414              :                           name="_SECTION_PARAMETERS_", &
    2415              :                           description="Controls the activation of the GW calculation.", &
    2416              :                           default_l_val=.FALSE., &
    2417         1360 :                           lone_keyword_l_val=.TRUE.)
    2418         1360 :       CALL section_add_keyword(section, keyword)
    2419         1360 :       CALL keyword_release(keyword)
    2420              : 
    2421              :       CALL keyword_create(keyword, __LOCATION__, name="NUM_TIME_FREQ_POINTS", &
    2422              :                           description="Number of discrete points for the imaginary-time "// &
    2423              :                           "grid and the imaginary-frequency grid. The more points, the more "// &
    2424              :                           "precise is the calculation. Typically, 10 points are good "// &
    2425              :                           "for 0.1 eV precision of band structures and molecular energy "// &
    2426              :                           "levels, 20 points for 0.03 eV precision, "// &
    2427              :                           "and 30 points for 0.01 eV precision, see Table I in "// &
    2428              :                           "<https://doi.org/10.1021/acs.jctc.0c01282>. GW computation time "// &
    2429              :                           "increases linearly with `NUM_TIME_FREQ_POINTS`.", &
    2430              :                           usage="NUM_TIME_FREQ_POINTS 30", &
    2431         1360 :                           default_i_val=30)
    2432         1360 :       CALL section_add_keyword(section, keyword)
    2433         1360 :       CALL keyword_release(keyword)
    2434              : 
    2435              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER", &
    2436              :                           description="Determines a threshold for the DBCSR based sparse "// &
    2437              :                           "multiplications. Normally, `EPS_FILTER` determines accuracy "// &
    2438              :                           "and timing of low-scaling GW calculations. (Lower filter means "// &
    2439              :                           "higher numerical precision, but higher computational cost.)", &
    2440              :                           usage="EPS_FILTER 1.0E-6", &
    2441         1360 :                           default_r_val=1.0E-8_dp)
    2442         1360 :       CALL section_add_keyword(section, keyword)
    2443         1360 :       CALL keyword_release(keyword)
    2444              : 
    2445              :       CALL keyword_create(keyword, __LOCATION__, name="REGULARIZATION_MINIMAX", &
    2446              :                           description="Parameter to regularize the Fourier transformation with minimax grids. "// &
    2447              :                           "In case the parameter 0.0 is chosen, no regularization is performed.", &
    2448              :                           usage="REGULARIZATION_MINIMAX 1.0E-4", &
    2449         1360 :                           default_r_val=-1.0_dp)
    2450         1360 :       CALL section_add_keyword(section, keyword)
    2451         1360 :       CALL keyword_release(keyword)
    2452              : 
    2453              :       CALL keyword_create(keyword, __LOCATION__, name="REGULARIZATION_RI", &
    2454              :                           description="Regularization applied to the GW RI fitting matrix "// &
    2455              :                           "$M_{PQ}$. A negative value selects the context-dependent default: "// &
    2456              :                           "zero for molecules and 1.0E-2 for periodic systems.", &
    2457              :                           usage="REGULARIZATION_RI 1.0E-4", &
    2458         1360 :                           default_r_val=-1.0_dp)
    2459         1360 :       CALL section_add_keyword(section, keyword)
    2460         1360 :       CALL keyword_release(keyword)
    2461              : 
    2462              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS_RI", &
    2463              :                           description="The cutoff radius (in Angstrom) for the truncated  "// &
    2464              :                           "Coulomb operator. The larger the cutoff radius, the faster "// &
    2465              :                           "converges the resolution of the identity (RI) with respect to the "// &
    2466              :                           "RI basis set size. Larger cutoff radius means higher computational "// &
    2467              :                           "cost.", &
    2468              :                           usage="CUTOFF_RADIUS_RI 3.0", &
    2469              :                           default_r_val=cp_unit_to_cp2k(value=3.0_dp, unit_str="angstrom"), &
    2470         1360 :                           type_of_var=real_t, unit_str="angstrom")
    2471         1360 :       CALL section_add_keyword(section, keyword)
    2472         1360 :       CALL keyword_release(keyword)
    2473              : 
    2474              :       CALL keyword_create(keyword, __LOCATION__, name="MEMORY_PER_PROC", &
    2475              :                           description="Specify the available memory per MPI process. Set "// &
    2476              :                           "`MEMORY_PER_PROC` as accurately as possible for good performance. If "// &
    2477              :                           "`MEMORY_PER_PROC` is set lower as the actually available "// &
    2478              :                           "memory per MPI process, the performance will be "// &
    2479              :                           "bad; if `MEMORY_PER_PROC` is set higher as the actually "// &
    2480              :                           "available memory per MPI process, the program might run out of "// &
    2481              :                           "memory. You can calculate `MEMORY_PER_PROC` as follows: "// &
    2482              :                           "Get the memory per node on your machine, mem_per_node "// &
    2483              :                           "(for example, from a supercomputer website, typically between "// &
    2484              :                           "100 GB and 2 TB), get the number of "// &
    2485              :                           "MPI processes per node, n_MPI_proc_per_node"// &
    2486              :                           " (for example from your run-script; if you "// &
    2487              :                           "use slurm, the number behind '--ntasks-per-node' is the number "// &
    2488              :                           "of MPI processes per node). Then calculate "// &
    2489              :                           "`MEMORY_PER_PROC` = mem_per_node / n_MPI_proc_per_node "// &
    2490              :                           "(typically between 2 GB and 50 GB). Unit of keyword: Gigabyte (GB). "// &
    2491              :                           "Note: This keyword is not used for GW calculations with RI-RS, "// &
    2492              :                           "where the available memory is detected automatically.", &
    2493              :                           usage="MEMORY_PER_PROC 16", &
    2494         1360 :                           default_r_val=2.0_dp)
    2495         1360 :       CALL section_add_keyword(section, keyword)
    2496         1360 :       CALL keyword_release(keyword)
    2497              : 
    2498              :       CALL keyword_create(keyword, __LOCATION__, name="APPROX_KP_EXTRAPOL", &
    2499              :                           description="If true, use only a 4x4 kpoint mesh for frequency "// &
    2500              :                           "points $\omega_j, j \ge 2$ (instead of a 4x4 and 6x6 k-point mesh). "// &
    2501              :                           "The k-point extrapolation of $W_{PQ}(i\omega_j,\mathbf{q})$ "// &
    2502              :                           "is done approximately from $W_{PQ}(i\omega_1,\mathbf{q})$.", &
    2503              :                           usage="APPROX_KP_EXTRAPOL", &
    2504         1360 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2505         1360 :       CALL section_add_keyword(section, keyword)
    2506         1360 :       CALL keyword_release(keyword)
    2507              : 
    2508              :       CALL keyword_create(keyword, __LOCATION__, name="SIZE_LATTICE_SUM", &
    2509              :                           description="Parameter determines how many neighbor cells $\mathbf{R}$ "// &
    2510              :                           "are used for computing "// &
    2511              :                           "$V_{PQ}(\mathbf{k}) = "// &
    2512              :                           "\sum_{\mathbf{R}} e^{i\mathbf{k}\cdot\mathbf{R}}\,\langle P, "// &
    2513              :                           "\text{cell}{=}\mathbf{0}|1/r|Q,\text{cell}{=}\mathbf{R}\rangle$. "// &
    2514              :                           "Normally, parameter does not need to be touched.", &
    2515              :                           usage="SIZE_LATTICE_SUM 4", &
    2516         1360 :                           default_i_val=3)
    2517         1360 :       CALL section_add_keyword(section, keyword)
    2518         1360 :       CALL keyword_release(keyword)
    2519              : 
    2520              :       CALL keyword_create( &
    2521              :          keyword, __LOCATION__, name="KPOINTS_W", &
    2522              :          description="Monkhorst-Pack k-point mesh of size N_x, N_y, N_z for calculating "// &
    2523              :          "$W_{PQ}^\mathbf{R}=\int_\text{BZ}\frac{d\mathbf{k}}{\Omega_\text{BZ}}\, "// &
    2524              :          "e^{-i\mathbf{k}\cdot\mathbf{R}}\,W_{PQ}(\mathbf{k})$. "// &
    2525              :          "For non-periodic directions α, choose N_α = 1. "// &
    2526              :          "Automatic choice of the k-point mesh for negative "// &
    2527              :          "values, i.e. KPOINTS_W -1 -1 -1. "// &
    2528              :          "K-point extrapolation of W is automatically switched on.", &
    2529              :          usage="KPOINTS_W N_x  N_y  N_z", &
    2530         1360 :          n_var=3, type_of_var=integer_t, default_i_vals=[-1, -1, -1])
    2531         1360 :       CALL section_add_keyword(section, keyword)
    2532         1360 :       CALL keyword_release(keyword)
    2533              : 
    2534              :       CALL keyword_create(keyword, __LOCATION__, name="HEDIN_SHIFT", &
    2535              :                           description="If true, use Hedin's shift in G0W0, evGW and evGW0. "// &
    2536              :                           "Details see in Li et al. JCTC 18, 7570 "// &
    2537              :                           "(2022), Figure 1. G0W0 with Hedin's shift should give "// &
    2538              :                           "similar GW eigenvalues as evGW0; at a lower "// &
    2539              :                           "computational cost.", &
    2540              :                           usage="HEDIN_SHIFT", &
    2541              :                           default_l_val=.FALSE., &
    2542         1360 :                           lone_keyword_l_val=.TRUE.)
    2543         1360 :       CALL section_add_keyword(section, keyword)
    2544         1360 :       CALL keyword_release(keyword)
    2545              : 
    2546              :       CALL keyword_create(keyword, __LOCATION__, name="FREQ_MAX_FIT", &
    2547              :                           description="For analytic continuation, a fit on Σ(iω) is performed. "// &
    2548              :                           "This fit is then evaluated at a real frequency, Σ(ω), which is used "// &
    2549              :                           "in the quasiparticle equation "// &
    2550              :                           "$\varepsilon_{n\mathbf{k}}^{G_0W_0}=  "// &
    2551              :                           "\varepsilon_{n\mathbf{k}}^\text{DFT}+\Sigma_{n\mathbf{k}} "// &
    2552              :                           "-v^\text{xc}_{n\mathbf{k}}$. The keyword FREQ_MAX_FIT "// &
    2553              :                           "determines fitting range for the self-energy Σ(iω) on "// &
    2554              :                           "imaginary axis: i*[0, ω_max] for empty orbitals/bands, i*[-ω_max,0] "// &
    2555              :                           "for occ orbitals. A smaller ω_max might lead to better numerical "// &
    2556              :                           "stability (i.e., if you observe clearly wrong GW eigenvalues/bands "// &
    2557              :                           "around HOMO/LUMO, decreasing ω_max might fix this issue). "// &
    2558              :                           "A small benchmark of ω_max is contained in Fig. 5 of "// &
    2559              :                           "J. Wilhelm et al., JCTC 12, 3623-3635 (2016). "// &
    2560              :                           "Note that we used ω_max = 1 Ha = 27.211 eV in the benchmark "// &
    2561              :                           "M. Azizi et al., PRB 109, 245101 (2024).", &
    2562              :                           unit_str="eV", &
    2563              :                           usage="FREQ_MAX_FIT 20.0", &
    2564         1360 :                           default_r_val=cp_unit_to_cp2k(value=10.0_dp, unit_str="eV"))
    2565         1360 :       CALL section_add_keyword(section, keyword)
    2566         1360 :       CALL keyword_release(keyword)
    2567              : 
    2568         1360 :       NULLIFY (subsection, print_key)
    2569              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    2570              :                           description="Printing of GW restarts.", &
    2571         1360 :                           n_keywords=2, n_subsections=1, repeats=.FALSE.)
    2572              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
    2573              :                                        description="Controls the printing of restart files "// &
    2574              :                                        "for χ, W, Σ.", &
    2575              :                                        filename="", print_level=low_print_level, &
    2576         1360 :                                        common_iter_levels=3)
    2577         1360 :       CALL section_add_subsection(subsection, print_key)
    2578         1360 :       CALL section_release(print_key)
    2579              : 
    2580         1360 :       CALL section_add_subsection(section, subsection)
    2581         1360 :       CALL section_release(subsection)
    2582              : 
    2583         1360 :       NULLIFY (subsection)
    2584         1360 :       CALL create_ri_rs_section(subsection)
    2585         1360 :       CALL section_add_subsection(section, subsection)
    2586         1360 :       CALL section_release(subsection)
    2587              : 
    2588         1360 :       NULLIFY (subsection)
    2589         1360 :       CALL create_auto_ri_section(subsection)
    2590         1360 :       CALL section_add_subsection(section, subsection)
    2591         1360 :       CALL section_release(subsection)
    2592              : 
    2593         1360 :       NULLIFY (subsection)
    2594         1360 :       CALL create_evgw0_section(subsection)
    2595         1360 :       CALL section_add_subsection(section, subsection)
    2596         1360 :       CALL section_release(subsection)
    2597              : 
    2598         1360 :    END SUBROUTINE create_gw_section
    2599              : 
    2600              : ! **************************************************************************************************
    2601              : !> \brief Creates the automatic RI basis set optimization section.
    2602              : !> \param section AUTO_RI input section
    2603              : ! **************************************************************************************************
    2604         1360 :    SUBROUTINE create_auto_ri_section(section)
    2605              :       TYPE(section_type), POINTER                        :: section
    2606              : 
    2607              :       TYPE(keyword_type), POINTER                        :: keyword
    2608              : 
    2609         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
    2610              :       CALL section_create(section, __LOCATION__, name="AUTO_RI", &
    2611              :                           description="Optimizes the RI basis for non-periodic RI-RS GW "// &
    2612              :                           "calculations. The fitting target combines occupied-empty "// &
    2613              :                           "transitions and exchange products. Atom-local (AA) functions are "// &
    2614              :                           "selected first. Neighbor-pair (AB) functions are also used to fit "// &
    2615              :                           "occupied-empty transitions and exchange products. Currently only "// &
    2616              :                           "non-periodic molecules are supported.", &
    2617         1360 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
    2618         1360 :       NULLIFY (keyword)
    2619              :       CALL keyword_create(keyword, __LOCATION__, name="RI_AO_RATIO", &
    2620              :                           description="Ratio between the numbers of optimized RI and AO basis "// &
    2621              :                           "functions. For example, RI_AO_RATIO 3 requires an RI basis with "// &
    2622              :                           "three times as many functions as the AO basis. Compare values such "// &
    2623              :                           "as 1, 1.5, 2, 3 and 4 until the GW energies are converged. "// &
    2624              :                           "Larger values increase time and memory, but also increase the "// &
    2625              :                           "numerical accuracy.", &
    2626         1360 :                           default_r_val=2.0_dp, usage="RI_AO_RATIO 2")
    2627         1360 :       CALL section_add_keyword(section, keyword)
    2628         1360 :       CALL keyword_release(keyword)
    2629              :       CALL keyword_create(keyword, __LOCATION__, name="OCC_EMPTY_FRONTIER_ORBITAL_WINDOW", &
    2630              :                           description="The exchange contribution to the RI optimization "// &
    2631              :                           "objective includes GW levels within the energy window "// &
    2632              :                           "$[\epsilon_{\mathrm{HOMO}}-w,\epsilon_{\mathrm{LUMO}}+w]$. "// &
    2633              :                           "The default of 5 eV is usually sufficient, for example for "// &
    2634              :                           "GW-BSE excitations up to 10 eV.", &
    2635              :                           default_r_val=cp_unit_to_cp2k(value=5.0_dp, unit_str="eV"), &
    2636         1360 :                           unit_str="eV", usage="OCC_EMPTY_FRONTIER_ORBITAL_WINDOW [eV] 5.0")
    2637         1360 :       CALL section_add_keyword(section, keyword)
    2638         1360 :       CALL keyword_release(keyword)
    2639              :       CALL keyword_create(keyword, __LOCATION__, name="NEIGHBOR_RADIUS", &
    2640              :                           description="The RI basis also contains contractions of Gaussian "// &
    2641              :                           "functions centered on different atoms. An atom pair A-B is "// &
    2642              :                           "included for these contractions when its distance is smaller than "// &
    2643              :                           "NEIGHBOR_RADIUS. Larger radii increase the computational cost. "// &
    2644              :                           "Three angstrom is a reasonable value and usually does not need to "// &
    2645              :                           "be changed.", &
    2646              :                           default_r_val=cp_unit_to_cp2k(value=3.0_dp, unit_str="angstrom"), &
    2647         1360 :                           unit_str="angstrom", usage="NEIGHBOR_RADIUS [angstrom] 3.0")
    2648         1360 :       CALL section_add_keyword(section, keyword)
    2649         1360 :       CALL keyword_release(keyword)
    2650              : 
    2651         1360 :    END SUBROUTINE create_auto_ri_section
    2652              : 
    2653              : ! **************************************************************************************************
    2654              : !> \brief creates the input section collecting all parameters of the real-space resolution of
    2655              : !>        the identity (RI-RS) used in GW
    2656              : !> \param section section to create
    2657              : ! **************************************************************************************************
    2658         1360 :    SUBROUTINE create_ri_rs_section(section)
    2659              :       TYPE(section_type), POINTER                        :: section
    2660              : 
    2661              :       TYPE(keyword_type), POINTER                        :: keyword
    2662              :       TYPE(section_type), POINTER                        :: subsection
    2663              : 
    2664         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
    2665              :       CALL section_create(section, __LOCATION__, name="RI_RS", &
    2666              :                           description="Real-Space Resolution of Identity (RI-RS) method. This "// &
    2667              :                           "approximation replaces the conventional 3-center RI integrals "// &
    2668              :                           "$(\mu\nu|P)$ by a factorized representation on an atom-centered "// &
    2669              :                           "real-space grid with points $\mathbf{r}_\ell$: "// &
    2670              :                           "$(\mu\nu|P) \approx \sum_\ell \varphi_\mu(\mathbf{r}_\ell) "// &
    2671              :                           "\varphi_\nu(\mathbf{r}_\ell) Z_{\ell P}$. "// &
    2672              :                           "The coefficients $Z_{\ell P}$ combine the numerical integration "// &
    2673              :                           "weights and the Coulomb potential of the auxiliary basis function "// &
    2674              :                           "$P$ evaluated at grid point $\mathbf{r}_\ell$. To reduce the "// &
    2675              :                           "computational cost, only grid points within the sphere $B^P$ around "// &
    2676              :                           "atom $P$ are included, i.e. the points with "// &
    2677              :                           "$|\mathbf{r}_\ell - \mathbf{R}_P| < R_c + r_P$. "// &
    2678              :                           "Here, $r_P$ is the effective radius of the most diffuse RI "// &
    2679              :                           "auxiliary Gaussian on atom $P$, at which the basis function "// &
    2680              :                           "magnitude falls below a threshold $\delta$ "// &
    2681              :                           "(currently controlled through EPS_FILTER). "// &
    2682              :                           "This locality approximation yields a sparse representation of the "// &
    2683              :                           "3-center integrals and enables reduced computational cost. "// &
    2684              :                           "See details in https://doi.org/10.1063/1.5090605.", &
    2685         1360 :                           n_keywords=11, n_subsections=1, repeats=.FALSE.)
    2686              : 
    2687         1360 :       NULLIFY (keyword)
    2688              :       CALL keyword_create(keyword, __LOCATION__, &
    2689              :                           name="_SECTION_PARAMETERS_", &
    2690              :                           description="Controls the activation of RI-RS in the GW calculation. "// &
    2691              :                           "An empty section, &RI_RS ... &END RI_RS, switches RI-RS on with "// &
    2692              :                           "default parameters.", &
    2693              :                           usage="&RI_RS .TRUE.", &
    2694              :                           default_l_val=.FALSE., &
    2695         1360 :                           lone_keyword_l_val=.TRUE.)
    2696         1360 :       CALL section_add_keyword(section, keyword)
    2697         1360 :       CALL keyword_release(keyword)
    2698              : 
    2699              :       CALL keyword_create(keyword, __LOCATION__, name="TIKHONOV", &
    2700              :                           description="Regularization parameter $\alpha$ used to stabilize "// &
    2701              :                           "the inversion of the grid-overlap matrix "// &
    2702              :                           "$D$ in the RI-RS method. "// &
    2703              :                           "See Equation (9) in https://doi.org/10.1063/1.5090605.", &
    2704              :                           usage="TIKHONOV 1.0E-8", &
    2705         1360 :                           default_r_val=1.0E-08_dp)
    2706         1360 :       CALL section_add_keyword(section, keyword)
    2707         1360 :       CALL keyword_release(keyword)
    2708              : 
    2709              :       CALL keyword_create(keyword, __LOCATION__, name="GRID_SELECT", &
    2710              :                           description="Selection of the atom-centered grid type used "// &
    2711              :                           "in RI-RS optimized by Duchemin and Blase. "// &
    2712              :                           "(1) def2-TZVPP: Available for elements up to the fourth row "// &
    2713              :                           "of the periodic table (see https://doi.org/10.1021/acs.jctc.1c00101). "// &
    2714              :                           "(2) cc-pVTZ: Available for H, C, N, and O atoms "// &
    2715              :                           "(see https://doi.org/10.1063/1.5090605). "// &
    2716              :                           "(3) User-provided grids: per-element grid files supplied by the "// &
    2717              :                           "user, read as ri_rs_grid/<Element><suffix> in the same format as "// &
    2718              :                           "the built-in sets; the suffix is _rirs.ion by default and can be "// &
    2719              :                           "changed with GRID_FILE_SUFFIX.", &
    2720              :                           usage="GRID_SELECT 1", &
    2721         1360 :                           default_i_val=1)
    2722         1360 :       CALL section_add_keyword(section, keyword)
    2723         1360 :       CALL keyword_release(keyword)
    2724              : 
    2725              :       CALL keyword_create(keyword, __LOCATION__, name="GRID_FILE_SUFFIX", &
    2726              :                           description="Overrides the per-element grid file suffix used by "// &
    2727              :                           "GRID_SELECT 3; grid files are read as ri_rs_grid/<Element><suffix>.", &
    2728              :                           usage="GRID_FILE_SUFFIX _my-grids.ion", &
    2729         1360 :                           default_lc_val="")
    2730         1360 :       CALL section_add_keyword(section, keyword)
    2731         1360 :       CALL keyword_release(keyword)
    2732              : 
    2733              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS_RL_RI", &
    2734              :                           description="Real-space cutoff radius (in Angstrom) for evaluating "// &
    2735              :                           "the RI-RS integration domain $B^P$. Overrides the default "// &
    2736              :                           "$R_c + r_P$, where $R_c$ is the truncated-Coulomb cutoff of the "// &
    2737              :                           "RI metric and $r_P$ the radius of the most diffuse RI auxiliary "// &
    2738              :                           "Gaussian on atom $P$.", &
    2739              :                           usage="CUTOFF_RADIUS_RL_RI 15.0", &
    2740              :                           default_r_val=cp_unit_to_cp2k(value=-1.0_dp, unit_str="angstrom"), &
    2741         1360 :                           type_of_var=real_t, unit_str="angstrom")
    2742         1360 :       CALL section_add_keyword(section, keyword)
    2743         1360 :       CALL keyword_release(keyword)
    2744              : 
    2745              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS_RL_AO", &
    2746              :                           description="Real-space cutoff radius (in Angstrom) for evaluating "// &
    2747              :                           "the AO basis functions on the RI-RS grid. Override the default radius "// &
    2748              :                           "derived automatically from the most diffuse AO Gaussian on each atom. ", &
    2749              :                           usage="CUTOFF_RADIUS_RL_AO 8.0", &
    2750              :                           default_r_val=cp_unit_to_cp2k(value=-1.0_dp, unit_str="angstrom"), &
    2751         1360 :                           type_of_var=real_t, unit_str="angstrom")
    2752         1360 :       CALL section_add_keyword(section, keyword)
    2753         1360 :       CALL keyword_release(keyword)
    2754              : 
    2755              :       CALL keyword_create(keyword, __LOCATION__, name="N_PROCS_PER_ATOM_Z_LP", &
    2756              :                           description="Number of MPI ranks that cooperate on one atom's "// &
    2757              :                           "Cholesky factorisation in computation of $Z_{\ell P}$ in RI-RS. "// &
    2758              :                           "Default -1 = AUTO: "// &
    2759              :                           "each atom is solved single-rank (fast BLAS) unless its dense "// &
    2760              :                           "grid-overlap matrix would exceed the available memory per process, "// &
    2761              :                           "in which case it is distributed across a rank subgroup sized "// &
    2762              :                           "automatically (ScaLAPACK). Set to 1 to force single-rank for all "// &
    2763              :                           "atoms, or > 1 to force that fixed subgroup size for all atoms.", &
    2764              :                           usage="N_PROCS_PER_ATOM_Z_LP 2", &
    2765         1360 :                           default_i_val=-1)
    2766         1360 :       CALL section_add_keyword(section, keyword)
    2767         1360 :       CALL keyword_release(keyword)
    2768              : 
    2769              :       CALL keyword_create(keyword, __LOCATION__, name="N_PANELS", &
    2770              :                           description="Number of grid panels (batches) the real-space grid is "// &
    2771              :                           "split into for the streaming chi/W/Sigma contractions in RI-RS. More "// &
    2772              :                           "panels means lower peak memory per step but more overhead. Default 1 = a "// &
    2773              :                           "single whole-grid panel. On large cells the number of panels is "// &
    2774              :                           "automatically increased beyond the request to keep per-rank DBCSR "// &
    2775              :                           "messages under the 32-bit length limit.", &
    2776              :                           usage="N_PANELS 4", &
    2777         1360 :                           default_i_val=1)
    2778         1360 :       CALL section_add_keyword(section, keyword)
    2779         1360 :       CALL keyword_release(keyword)
    2780              : 
    2781              :       CALL keyword_create(keyword, __LOCATION__, name="KEEP_SPARSITY_RL", &
    2782              :                           description="If `.TRUE.` (default), the W/V matrices in the "// &
    2783              :                           "grid-basis contractions of RI-RSwill used the sparsity pattern of the "// &
    2784              :                           "corresponding G/D matrices. "// &
    2785              :                           "Set `.FALSE.` to build W/V fully dense.", &
    2786              :                           usage="KEEP_SPARSITY_RL .FALSE.", &
    2787         1360 :                           default_l_val=.TRUE.)
    2788         1360 :       CALL section_add_keyword(section, keyword)
    2789         1360 :       CALL keyword_release(keyword)
    2790              : 
    2791              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS_RL_W", &
    2792              :                           description="Real-space truncation radius (Angstrom) for the grid-basis "// &
    2793              :                           "G operators in the RI-RS GW self-energy. "// &
    2794              :                           "Default -1.0 disables the truncation (exact grid-basis operators).", &
    2795              :                           usage="CUTOFF_RADIUS_RL_W 20.0", &
    2796              :                           default_r_val=cp_unit_to_cp2k(value=-1.0_dp, unit_str="angstrom"), &
    2797         1360 :                           type_of_var=real_t, unit_str="angstrom")
    2798         1360 :       CALL section_add_keyword(section, keyword)
    2799         1360 :       CALL keyword_release(keyword)
    2800              : 
    2801              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS_G_W", &
    2802              :                           description="Atom-pair distance truncation radius (Angstrom) applied to "// &
    2803              :                           "the AO/RI-space operator matrices G, D, V and W themselves in the RI-RS "// &
    2804              :                           "GW contractions: matrix blocks between atoms further apart than this "// &
    2805              :                           "radius are dropped. Physically consistent with CUTOFF_RADIUS_RL_W, "// &
    2806              :                           "which truncates the grid-basis products at the same kind of range. "// &
    2807              :                           "Default -1.0 disables the truncation (exact operators).", &
    2808              :                           usage="CUTOFF_RADIUS_G_W 20.0", &
    2809              :                           default_r_val=cp_unit_to_cp2k(value=-1.0_dp, unit_str="angstrom"), &
    2810         1360 :                           type_of_var=real_t, unit_str="angstrom")
    2811         1360 :       CALL section_add_keyword(section, keyword)
    2812         1360 :       CALL keyword_release(keyword)
    2813              : 
    2814         1360 :       NULLIFY (subsection)
    2815         1360 :       CALL create_ri_rs_grid_optimization_section(subsection)
    2816         1360 :       CALL section_add_subsection(section, subsection)
    2817         1360 :       CALL section_release(subsection)
    2818              : 
    2819         1360 :    END SUBROUTINE create_ri_rs_section
    2820              : 
    2821              : ! **************************************************************************************************
    2822              : !> \brief Creates the GW RI-RS in-memory grid optimizer section.
    2823              : !> \param section ...
    2824              : ! **************************************************************************************************
    2825         1360 :    SUBROUTINE create_ri_rs_grid_optimization_section(section)
    2826              :       TYPE(section_type), POINTER                        :: section
    2827              : 
    2828              :       TYPE(keyword_type), POINTER                        :: keyword
    2829         1360 :       NULLIFY (keyword)
    2830         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
    2831              :       CALL section_create( &
    2832              :          section, __LOCATION__, name="GRID_OPTIMIZATION", repeats=.FALSE., &
    2833              :          description="Optimizes RI-RS grids using small local atomic environments. For every atom "// &
    2834              :          "in the structure, a cluster is formed from all atoms whose distance from the centre atom "// &
    2835              :          "is smaller than CUTOFF_ATOMIC_CLUSTER. All three-centre integrals within each cluster are "// &
    2836              :          "computed analytically and serve as exact reference values. The grid points are optimized "// &
    2837              :          "such that the corresponding RI-RS three-centre integrals reproduce these references. "// &
    2838              :          "For a cluster $C_I$, the normalized squared RI-RS error is "// &
    2839              :          "$E_I = \frac{1}{N_I} \sum_{P\mu\nu \in C_I} \left|(\mu\nu|P) - "// &
    2840              :          "\sum_{\mathbf{r}_{A\ell} \in C_I} \varphi_\mu(\mathbf{r}_{A\ell}) "// &
    2841              :          "\varphi_\nu(\mathbf{r}_{A\ell}) Z_{A\ell P}\right|^2$. The total objective is "// &
    2842              :          "the average over all local clusters, "// &
    2843              :          "$E_\mathrm{loc} = \frac{1}{N_\mathrm{at}} "// &
    2844              :          "\sum_{I=1}^{N_\mathrm{at}} E_I$. Starting from pre-tabulated atom-specific grids, "// &
    2845              :          "the optimization adapts the grid to the chemical environment and composition of the "// &
    2846              :          "structure and can permit substantially smaller grids. Compact grids often work well for "// &
    2847              :          "small basis sets, but the point count specified with GRID_SIZE or N_POINT_PERCENTAGE "// &
    2848         1360 :          "should be tuned and converged for the chosen basis sets and chemical system.")
    2849              : 
    2850              :       CALL keyword_create( &
    2851              :          keyword, __LOCATION__, name="GRID_SIZE", &
    2852              :          description="Specifies how many grid points are used per atom for a given element. "// &
    2853              :          "Repeat this keyword once for every element in the structure.", &
    2854         1360 :          usage="GRID_SIZE Si 100", type_of_var=char_t, repeats=.TRUE., n_var=2)
    2855         1360 :       CALL section_add_keyword(section, keyword)
    2856         1360 :       CALL keyword_release(keyword)
    2857              : 
    2858              :       CALL keyword_create( &
    2859              :          keyword, __LOCATION__, name="N_POINT_PERCENTAGE", &
    2860              :          description="The element grids are read from the .ion files selected by GRID_SELECT; "// &
    2861              :          "GRID_FILE_SUFFIX determines user-provided filenames. From these initial grids, only "// &
    2862              :          "N_POINT_PERCENTAGE % of each element's grid points are taken in the actual GW calculation.", &
    2863         1360 :          usage="N_POINT_PERCENTAGE 20", type_of_var=real_t, default_r_val=-1.0_dp)
    2864         1360 :       CALL section_add_keyword(section, keyword)
    2865         1360 :       CALL keyword_release(keyword)
    2866              : 
    2867              :       CALL keyword_create( &
    2868              :          keyword, __LOCATION__, name="CUTOFF_ATOMIC_CLUSTER", &
    2869              :          description="Radius of the atom-centred cluster used to construct the local three-centre "// &
    2870              :          "integral fitting objective. Atoms within this distance of the centre atom are included.", &
    2871              :          usage="CUTOFF_ATOMIC_CLUSTER [angstrom] 3.0", type_of_var=real_t, &
    2872              :          default_r_val=cp_unit_to_cp2k(value=3.0_dp, unit_str="angstrom"), &
    2873         1360 :          unit_str="angstrom")
    2874         1360 :       CALL section_add_keyword(section, keyword)
    2875         1360 :       CALL keyword_release(keyword)
    2876              : 
    2877              :       CALL keyword_create( &
    2878              :          keyword, __LOCATION__, name="MAX_ITER", &
    2879              :          description="Maximum number of objective-and-gradient evaluations in the single "// &
    2880              :          "cooperative Cartesian grid optimization.", &
    2881         1360 :          usage="MAX_ITER 100", default_i_val=100)
    2882         1360 :       CALL section_add_keyword(section, keyword)
    2883         1360 :       CALL keyword_release(keyword)
    2884              : 
    2885         1360 :    END SUBROUTINE create_ri_rs_grid_optimization_section
    2886              : 
    2887              : ! **************************************************************************************************
    2888              : !> \brief creates the input section for eigenvalue self-consistent GW0 (evGW0)
    2889              : !> \param section section to create
    2890              : ! **************************************************************************************************
    2891         1360 :    SUBROUTINE create_evgw0_section(section)
    2892              :       TYPE(section_type), POINTER                        :: section
    2893              : 
    2894              :       TYPE(keyword_type), POINTER                        :: keyword
    2895              : 
    2896         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
    2897              :       CALL section_create(section, __LOCATION__, name="EVGW0", &
    2898              :                           description="Eigenvalue self-consistent GW0. The quasiparticle "// &
    2899              :                           "energies replace the Kohn-Sham eigenvalues in the Green's function "// &
    2900              :                           "and the cycle is repeated, while the screened Coulomb interaction "// &
    2901              :                           "$W$ stays at its RPA@DFT value. Only the correlation self-energy "// &
    2902              :                           "and the quasiparticle equation are recomputed per cycle; $W$, the "// &
    2903              :                           "exchange self-energy and the RI-RS grid quantities are computed "// &
    2904              :                           "once. This implementation requires RI-RS. Without this section a "// &
    2905              :                           "single-shot G0W0 calculation is performed.", &
    2906         1360 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
    2907              : 
    2908         1360 :       NULLIFY (keyword)
    2909              :       CALL keyword_create(keyword, __LOCATION__, &
    2910              :                           name="_SECTION_PARAMETERS_", &
    2911              :                           description="Controls the activation of evGW0. An empty section, "// &
    2912              :                           "&EVGW0 ... &END EVGW0, switches evGW0 on with default parameters.", &
    2913              :                           usage="&EVGW0 .TRUE.", &
    2914              :                           default_l_val=.FALSE., &
    2915         1360 :                           lone_keyword_l_val=.TRUE.)
    2916         1360 :       CALL section_add_keyword(section, keyword)
    2917         1360 :       CALL keyword_release(keyword)
    2918              : 
    2919              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
    2920              :                           description="Maximum number of evGW0 cycles.", &
    2921              :                           usage="MAX_ITER 20", &
    2922         1360 :                           default_i_val=20)
    2923         1360 :       CALL section_add_keyword(section, keyword)
    2924         1360 :       CALL keyword_release(keyword)
    2925              : 
    2926              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ITER", &
    2927              :                           description="Target accuracy of the eigenvalue self-consistency. "// &
    2928              :                           "The cycle stops once the quasiparticle HOMO, the quasiparticle "// &
    2929              :                           "LUMO and the HOMO-LUMO gap all change by less than this value "// &
    2930              :                           "between two successive cycles. Unit: Hartree.", &
    2931              :                           usage="EPS_ITER 0.00005", &
    2932         1360 :                           default_r_val=5.0E-5_dp)
    2933         1360 :       CALL section_add_keyword(section, keyword)
    2934         1360 :       CALL keyword_release(keyword)
    2935              : 
    2936         1360 :    END SUBROUTINE create_evgw0_section
    2937              : 
    2938              : ! **************************************************************************************************
    2939              : !> \brief creates an input section for calculation SOC for the electronic band structure
    2940              : !> \param section section to create
    2941              : !> \par History
    2942              : !>    * 09.2023 created [Jan Wilhelm]
    2943              : ! **************************************************************************************************
    2944         1360 :    SUBROUTINE create_soc_section(section)
    2945              :       TYPE(section_type), POINTER                        :: section
    2946              : 
    2947              :       TYPE(keyword_type), POINTER                        :: keyword
    2948              : 
    2949         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
    2950              :       CALL section_create(section, __LOCATION__, name="SOC", &
    2951              :                           description="Switch on or off spin-orbit coupling. Use SOC "// &
    2952              :                           "parameters from non-local pseudopotentials as given in "// &
    2953              :                           "Hartwigsen, Goedecker, Hutter, Eq.(18), (19), "// &
    2954              :                           "<https://doi.org/10.1103/PhysRevB.58.3641>, "// &
    2955              :                           "$V_{\mu\nu}^{\mathrm{SOC}, (\alpha)} = "// &
    2956              :                           "(\hbar/2) \langle \phi_\mu | \sum_l \Delta "// &
    2957              :                           "V_l^\mathrm{SO}(\mathbf{r},\mathbf{r}') "// &
    2958              :                           "L^{(\alpha)} | \phi_\nu \rangle, "// &
    2959              :                           "\alpha = x, y, z$.", &
    2960         1360 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
    2961              : 
    2962         1360 :       NULLIFY (keyword)
    2963              :       CALL keyword_create(keyword, __LOCATION__, &
    2964              :                           name="_SECTION_PARAMETERS_", &
    2965              :                           description="Controls the activation of the SOC calculation.", &
    2966              :                           default_l_val=.FALSE., &
    2967         1360 :                           lone_keyword_l_val=.TRUE.)
    2968         1360 :       CALL section_add_keyword(section, keyword)
    2969         1360 :       CALL keyword_release(keyword)
    2970              : 
    2971              :       CALL keyword_create(keyword, __LOCATION__, name="SOC_WINDOW_OCC", &
    2972              :                           description="Apply SOC only for states with eigenvalues below VBM "// &
    2973              :                           "in the interval $[\varepsilon_\mathrm{VBM}-E_\mathrm{window\_occ}, \ "// &
    2974              :                           "\varepsilon_\mathrm{VBM}]$. "// &
    2975              :                           "to use for large systems to prevent numerical instabilities.", &
    2976              :                           usage="SOC_WINDOW_OCC 5.0", &
    2977              :                           default_r_val=-1.0_dp, &
    2978         1360 :                           unit_str="eV")
    2979         1360 :       CALL section_add_keyword(section, keyword)
    2980         1360 :       CALL keyword_release(keyword)
    2981              : 
    2982              :       CALL keyword_create(keyword, __LOCATION__, name="SOC_WINDOW_VIRT", &
    2983              :                           description="Apply SOC only for states with eigenvalues above CBM "// &
    2984              :                           "in the interval $[\varepsilon_\mathrm{CBM},\ "// &
    2985              :                           "\varepsilon_\mathrm{CBM}+E_\mathrm{window\_virt}]$, "// &
    2986              :                           "to use for large systems to prevent numerical instabilities.", &
    2987              :                           usage="SOC_WINDOW_VIRT 5.0", &
    2988              :                           default_r_val=-1.0_dp, &
    2989         1360 :                           unit_str="eV")
    2990         1360 :       CALL section_add_keyword(section, keyword)
    2991         1360 :       CALL keyword_release(keyword)
    2992              : 
    2993              :       CALL keyword_create(keyword, __LOCATION__, name="SOC_WINDOW_SMEARING", &
    2994              :                           description="Width of the Fermi-like smoothing at the SOC energy-window edge. "// &
    2995              :                           "Default reproduces the value of 1 eV. "// &
    2996              :                           "only effective when at least one SOC window is active.", &
    2997              :                           usage="SOC_WINDOW_SMEARING 1.0", &
    2998              :                           default_r_val=cp_unit_to_cp2k(value=1.0_dp, unit_str="eV"), &
    2999         1360 :                           unit_str="eV")
    3000         1360 :       CALL section_add_keyword(section, keyword)
    3001         1360 :       CALL keyword_release(keyword)
    3002              : 
    3003         1360 :    END SUBROUTINE create_soc_section
    3004              : 
    3005              : ! **************************************************************************************************
    3006              : !> \brief input section for computing the density of states and the projected density of states
    3007              : !> \param section section to create
    3008              : !> \par History
    3009              : !>    * 09.2023 created [Jan Wilhelm]
    3010              : ! **************************************************************************************************
    3011         1360 :    SUBROUTINE create_dos_section(section)
    3012              :       TYPE(section_type), POINTER                        :: section
    3013              : 
    3014              :       TYPE(keyword_type), POINTER                        :: keyword
    3015              :       TYPE(section_type), POINTER                        :: subsection
    3016              : 
    3017         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
    3018              :       CALL section_create(section, __LOCATION__, name="DOS", &
    3019              :                           description="Parameters needed to calculate the density of states "// &
    3020              :                           "(DOS) and the projected density of states (PDOS).", &
    3021         1360 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
    3022              : 
    3023         1360 :       NULLIFY (keyword)
    3024              :       CALL keyword_create(keyword, __LOCATION__, &
    3025              :                           name="_SECTION_PARAMETERS_", &
    3026              :                           description="Controls the activation of the DOS calculation.", &
    3027              :                           default_l_val=.FALSE., &
    3028         1360 :                           lone_keyword_l_val=.TRUE.)
    3029         1360 :       CALL section_add_keyword(section, keyword)
    3030         1360 :       CALL keyword_release(keyword)
    3031              : 
    3032              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_WINDOW", &
    3033              :                           description="Print DOS and PDOS in the energy window "// &
    3034              :                           "$[\varepsilon_\mathrm{VBM}-E_\mathrm{window}/2,  "// &
    3035              :                           "\varepsilon_\mathrm{CBM}+E_\mathrm{window}/2]$,"// &
    3036              :                           " where VBM is the valence "// &
    3037              :                           "band maximum (or highest occupied molecular orbital, HOMO, for "// &
    3038              :                           "molecules) and CBM the conduction band minimum (or lowest "// &
    3039              :                           "unoccupied molecular orbital, LUMO, for molecules).", &
    3040              :                           usage="ENERGY_WINDOW 5.0", &
    3041              :                           default_r_val=cp_unit_to_cp2k(value=10.0_dp, unit_str="eV"), &
    3042         1360 :                           unit_str="eV")
    3043         1360 :       CALL section_add_keyword(section, keyword)
    3044         1360 :       CALL keyword_release(keyword)
    3045              : 
    3046              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_STEP", &
    3047              :                           description="Resolution of the energy E when computing the $\rho(E)$.", &
    3048              :                           usage="ENERGY_STEP 0.01", &
    3049              :                           default_r_val=cp_unit_to_cp2k(value=0.01_dp, unit_str="eV"), &
    3050         1360 :                           unit_str="eV")
    3051         1360 :       CALL section_add_keyword(section, keyword)
    3052         1360 :       CALL keyword_release(keyword)
    3053              : 
    3054              :       CALL keyword_create(keyword, __LOCATION__, name="BROADENING", &
    3055              :                           description="Broadening α in Gaussians used in the DOS; "// &
    3056              :                           "$\rho(E) = \sum_n \exp(((E-\varepsilon_n)/\alpha)^2)/("// &
    3057              :                           " \sqrt{2\pi} \alpha)$.", &
    3058              :                           usage="BROADENING 0.01", &
    3059              :                           default_r_val=cp_unit_to_cp2k(value=0.01_dp, unit_str="eV"), &
    3060         1360 :                           unit_str="eV")
    3061         1360 :       CALL section_add_keyword(section, keyword)
    3062         1360 :       CALL keyword_release(keyword)
    3063              : 
    3064              :       CALL keyword_create( &
    3065              :          keyword, __LOCATION__, name="KPOINTS", &
    3066              :          description="Monkhorst-Pack k-point mesh of size N_x, N_y, N_z for calculating "// &
    3067              :          "the density of states (DOS). In GW, the KPOINT_DOS mesh is thus used as k-point "// &
    3068              :          "mesh for the self-energy. For non-periodic directions α, choose N_α = 1. "// &
    3069              :          "Automatic choice of the k-point mesh for negative "// &
    3070              :          "values, i.e. KPOINTS_DOS -1 -1 -1 (automatic choice: N_α = 1 in non-periodic "// &
    3071              :          "direction, 8 k-points in periodic direction). If you like to compute a "// &
    3072              :          "band structure along a k-path, you can specify the k-path in "// &
    3073              :          "&KPOINT_SET.", &
    3074              :          usage="KPOINTS N_x  N_y  N_z", &
    3075         1360 :          n_var=3, type_of_var=integer_t, default_i_vals=[-1, -1, -1])
    3076         1360 :       CALL section_add_keyword(section, keyword)
    3077         1360 :       CALL keyword_release(keyword)
    3078              : 
    3079         1360 :       NULLIFY (subsection)
    3080         1360 :       CALL create_ldos_section(subsection)
    3081         1360 :       CALL section_add_subsection(section, subsection)
    3082         1360 :       CALL section_release(subsection)
    3083              : 
    3084         1360 :    END SUBROUTINE create_dos_section
    3085              : 
    3086              : ! **************************************************************************************************
    3087              : !> \brief ...
    3088              : !> \param section ...
    3089              : ! **************************************************************************************************
    3090         1360 :    SUBROUTINE create_ldos_section(section)
    3091              :       TYPE(section_type), POINTER                        :: section
    3092              : 
    3093              :       TYPE(keyword_type), POINTER                        :: keyword
    3094              : 
    3095         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
    3096              :       CALL section_create(section, __LOCATION__, name="LDOS", &
    3097              :                           description="Parameters needed to calculate the local density "// &
    3098              :                           "of states (LDOS).  "// &
    3099              :                           "The LDOS is computed as $\rho(\mathbf{r},E) = "// &
    3100              :                           "\sum\limits_{n,\mathbf{k}}"// &
    3101              :                           " |\psi_{n\mathbf{k}}(r)|^2\, w_\mathbf{k}\, g(E-\varepsilon_{n\mathbf{k}})$ "// &
    3102              :                           "using the Gaussian weight function "// &
    3103              :                           "$g(x) = \exp(x^2/\alpha^2)/(\sqrt{2\pi}\alpha)$, $\alpha$ is the broadening "// &
    3104              :                           "from the &DOS section, and the k-point weight "// &
    3105              :                           "$w_\mathbf{k}$. The k-mesh is taken from the &DOS section.", &
    3106         1360 :                           n_keywords=2, repeats=.FALSE.)
    3107              : 
    3108         1360 :       NULLIFY (keyword)
    3109              :       CALL keyword_create(keyword, __LOCATION__, &
    3110              :                           name="_SECTION_PARAMETERS_", &
    3111              :                           description="Activates the local VBM CBM gap calculation.", &
    3112              :                           default_l_val=.FALSE., &
    3113         1360 :                           lone_keyword_l_val=.TRUE.)
    3114         1360 :       CALL section_add_keyword(section, keyword)
    3115         1360 :       CALL keyword_release(keyword)
    3116              : 
    3117              :       CALL keyword_create(keyword, __LOCATION__, name="INTEGRATION", &
    3118              :                           description="Defines whether the LDOS is integrated along a "// &
    3119              :                           "coordinate. As an example, for INTEGRATION Z, the LDOS "// &
    3120              :                           "$\rho(x,y,E) = \int dz\, \rho(x,y,z,E)$ is computed.", &
    3121              :                           usage="INTEGRATION Z", &
    3122              :                           enum_c_vals=s2a("X", "Y", "Z", "NONE"), &
    3123              :                           enum_i_vals=[int_ldos_x, int_ldos_y, int_ldos_z, int_ldos_none], &
    3124              :                           enum_desc=s2a("Integrate over x coordinate (not yet implemented).", &
    3125              :                                         "Integrate over y coordinate (not yet implemented).", &
    3126              :                                         "Integrate over z coordinate.", &
    3127              :                                         "No integration, print cube file as function "// &
    3128              :                                         "of x,y,z (not yet implemented)."), &
    3129         1360 :                           default_i_val=int_ldos_z)
    3130         1360 :       CALL section_add_keyword(section, keyword)
    3131         1360 :       CALL keyword_release(keyword)
    3132              : 
    3133              :       CALL keyword_create( &
    3134              :          keyword, __LOCATION__, name="BIN_MESH", &
    3135              :          description="Mesh of size n x m for binning the space coordinates x and y of "// &
    3136              :          "the LDOS $\rho(x,y,E)$. If -1, no binning is performed and the "// &
    3137              :          "fine x, y resolution of the electron density from SCF is used.", &
    3138              :          usage="BIN_MESH  n m", &
    3139         1360 :          n_var=2, type_of_var=integer_t, default_i_vals=[10, 10])
    3140         1360 :       CALL section_add_keyword(section, keyword)
    3141         1360 :       CALL keyword_release(keyword)
    3142              : 
    3143         1360 :    END SUBROUTINE create_ldos_section
    3144              : 
    3145              : ! **************************************************************************************************
    3146              : !> \brief creates an input section for a tip scan calculation
    3147              : !> \param section section to create
    3148              : !> \par History
    3149              : !>    * 04.2021 created [JGH]
    3150              : ! **************************************************************************************************
    3151         1360 :    SUBROUTINE create_tipscan_section(section)
    3152              :       TYPE(section_type), POINTER                        :: section
    3153              : 
    3154              :       TYPE(keyword_type), POINTER                        :: keyword
    3155              : 
    3156         1360 :       CPASSERT(.NOT. ASSOCIATED(section))
    3157              :       CALL section_create(section, __LOCATION__, name="TIP_SCAN", &
    3158              :                           description="Parameters needed to set up a Tip Scan. "// &
    3159              :                           "Needs external definition of tip induced field.", &
    3160         1360 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
    3161              : 
    3162         1360 :       NULLIFY (keyword)
    3163              : 
    3164              :       CALL keyword_create(keyword, __LOCATION__, &
    3165              :                           name="_SECTION_PARAMETERS_", &
    3166              :                           description="Controls the activation of the Tip Scan procedure", &
    3167              :                           default_l_val=.FALSE., &
    3168         1360 :                           lone_keyword_l_val=.TRUE.)
    3169         1360 :       CALL section_add_keyword(section, keyword)
    3170         1360 :       CALL keyword_release(keyword)
    3171              : 
    3172              :       CALL keyword_create(keyword, __LOCATION__, name="SCAN_DIRECTION", &
    3173              :                           description="Defines scan direction and scan type(line, plane).", &
    3174              :                           usage="SCAN_DIRECTION XY", &
    3175              :                           enum_c_vals=s2a("X", "Y", "Z", "XY", "XZ", "YZ", "XYZ"), &
    3176              :                           enum_i_vals=[scan_x, scan_y, scan_z, scan_xy, scan_xz, scan_yz, scan_xyz], &
    3177         1360 :                           default_i_val=scan_xy)
    3178         1360 :       CALL section_add_keyword(section, keyword)
    3179         1360 :       CALL keyword_release(keyword)
    3180              : 
    3181              :       CALL keyword_create(keyword, __LOCATION__, name="REFERENCE_POINT", &
    3182              :                           description="The reference point to define the absolute position of the scan. ", &
    3183              :                           usage="REFERENCE_POINT 0.0 0.0 1.0", &
    3184              :                           n_var=3, default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp], type_of_var=real_t, &
    3185         1360 :                           unit_str="angstrom")
    3186         1360 :       CALL section_add_keyword(section, keyword)
    3187         1360 :       CALL keyword_release(keyword)
    3188              : 
    3189              :       CALL keyword_create(keyword, __LOCATION__, name="SCAN_POINTS", &
    3190              :                           description="Number of points calculated for each scan direction.", &
    3191              :                           usage="SCAN_POINTS 20 20", &
    3192         1360 :                           n_var=-1, type_of_var=integer_t)
    3193         1360 :       CALL section_add_keyword(section, keyword)
    3194         1360 :       CALL keyword_release(keyword)
    3195              : 
    3196              :       CALL keyword_create(keyword, __LOCATION__, name="SCAN_STEP", &
    3197              :                           description="Step size for each scan direction.", &
    3198              :                           usage="SCAN_STEP 0.01 0.01", &
    3199         1360 :                           n_var=-1, type_of_var=real_t, unit_str="angstrom")
    3200         1360 :       CALL section_add_keyword(section, keyword)
    3201         1360 :       CALL keyword_release(keyword)
    3202              : 
    3203              :       CALL keyword_create(keyword, __LOCATION__, name="TIP_FILENAME", &
    3204              :                           description="Filename of tip potential defined in cube file format.", &
    3205              :                           usage="TIP_FILENAME <filename>", &
    3206         1360 :                           type_of_var=lchar_t)
    3207         1360 :       CALL section_add_keyword(section, keyword)
    3208         1360 :       CALL keyword_release(keyword)
    3209              : 
    3210         1360 :    END SUBROUTINE create_tipscan_section
    3211              : 
    3212              : ! **************************************************************************************************
    3213              : !> \brief ...
    3214              : !> \param section ...
    3215              : !> \param section_name ...
    3216              : !> \author Shridhar Shanbhag
    3217              : ! **************************************************************************************************
    3218         1360 :    SUBROUTINE create_floquet_section(section)
    3219              :       TYPE(section_type), POINTER                        :: section
    3220              : 
    3221              :       TYPE(keyword_type), POINTER                        :: keyword
    3222              : 
    3223              :       CALL section_create(section, __LOCATION__, name="FLOQUET", &
    3224              :                           description="Parameters controlling the calculation of the "// &
    3225              :                           "Floquet band structure and Quasi-energies of a system driven "// &
    3226              :                           "by a periodic monochromatic electric field with any arbitrary "// &
    3227              :                           "polarisation state.", &
    3228         1360 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    3229         1360 :       NULLIFY (keyword)
    3230              : 
    3231              :       CALL keyword_create(keyword, __LOCATION__, name="AMPLITUDE", &
    3232              :                           description="Electric field amplitude of the monochromatic light.", &
    3233              :                           usage="AMPLITUDE [Vm-1] 1.0E9", n_var=1, type_of_var=real_t, &
    3234         1360 :                           unit_str="Vm-1", default_r_val=0.0_dp)
    3235         1360 :       CALL section_add_keyword(section, keyword)
    3236         1360 :       CALL keyword_release(keyword)
    3237              : 
    3238              :       CALL keyword_create(keyword, __LOCATION__, name="FREQUENCY", &
    3239              :                           description="Frequency of the electric field for Floquet calculations "// &
    3240              :                           "expressed in terms of the energy of a photon in eV.", &
    3241              :                           usage="FREQUENCY 1.5", unit_str="eV", n_var=1, type_of_var=real_t, &
    3242         1360 :                           default_r_val=cp_unit_to_cp2k(value=1.0_dp, unit_str="eV"))
    3243         1360 :       CALL section_add_keyword(section, keyword)
    3244         1360 :       CALL keyword_release(keyword)
    3245              : 
    3246              :       CALL keyword_create(keyword, __LOCATION__, name="POLARISATION", &
    3247              :                           description="Polarisation vector of the input light. The "// &
    3248              :                           "amplitude in each direction is the product of the AMPLITUDE "// &
    3249              :                           "and the POLARISATION vector component. Eg. for light polarized "// &
    3250              :                           "in the x direction, use 1 0 0. For left-circularly polarized "// &
    3251              :                           "light travelling in the +z direction use 1 1 0 and set "// &
    3252              :                           "PHASE_OFFSET 0 0.5 0 for a +π/2 offset", &
    3253              :                           usage="POLARISATION  0.0 0.0 1.0", &
    3254         1360 :                           default_r_vals=[0.0_dp, 0.0_dp, 1.0_dp])
    3255         1360 :       CALL section_add_keyword(section, keyword)
    3256         1360 :       CALL keyword_release(keyword)
    3257              : 
    3258              :       CALL keyword_create(keyword, __LOCATION__, name="PHASE_OFFSETS", &
    3259              :                           description="Phase offset of the electric field in the "// &
    3260              :                           "x, y, and z directions given in multiples of π. For "// &
    3261              :                           "linearly polarized light, use 0 0 0 and for left-circularly "// &
    3262              :                           "polarized light travelling in the +z direction use "// &
    3263              :                           "PHASE_OFFSET 0.0 0.5 0 ", &
    3264              :                           usage="PHASE_OFFSETS  0.5 0 0", &
    3265         1360 :                           default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp])
    3266         1360 :       CALL section_add_keyword(section, keyword)
    3267         1360 :       CALL keyword_release(keyword)
    3268              : 
    3269              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_FLOQUET_INDEX", &
    3270              :                           description="Largest absolute Floquet index up to which "// &
    3271              :                           "Floquet Hamiltonian is truncated. Use a larger value to "// &
    3272              :                           "ensure convergence at higher computational cost and a "// &
    3273              :                           "smaller value for faster computation. EPS_FLOQUET checks "// &
    3274              :                           "to ensure that the error due to truncation is small.", &
    3275              :                           usage="MAX_FLOQUET_INDEX 50", &
    3276         1360 :                           default_i_val=50)
    3277         1360 :       CALL section_add_keyword(section, keyword)
    3278         1360 :       CALL keyword_release(keyword)
    3279              : 
    3280              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FLOQUET", &
    3281              :                           description="Threshold on the error due to truncation of "// &
    3282              :                           "the Floquet Hamiltonian. Used to verify that MAX_FLOQUET_INDEX "// &
    3283              :                           "is large enough that truncation errors are small. "// &
    3284              :                           "If negative, the check is removed (not recommended).", &
    3285         1360 :                           usage="EPS_FLOQUET 1.e-10", default_r_val=1.0e-10_dp)
    3286         1360 :       CALL section_add_keyword(section, keyword)
    3287         1360 :       CALL keyword_release(keyword)
    3288              : 
    3289              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_WINDOW", &
    3290              :                           description="Half-width of the energy range, in eV, centred "// &
    3291              :                           "on the Fermi level, over which the Floquet spectral "// &
    3292              :                           "function is evaluated.", &
    3293              :                           usage="ENERGY_WINDOW 5.0", &
    3294              :                           default_r_val=cp_unit_to_cp2k(value=10.0_dp, unit_str="eV"), &
    3295         1360 :                           unit_str="eV")
    3296         1360 :       CALL section_add_keyword(section, keyword)
    3297         1360 :       CALL keyword_release(keyword)
    3298              : 
    3299              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_STEP", &
    3300              :                           description="Resolution of the energy E used to compute the "// &
    3301              :                           "spectral function within the energy window.", &
    3302              :                           usage="ENERGY_STEP 0.01", &
    3303              :                           default_r_val=cp_unit_to_cp2k(value=0.01_dp, unit_str="eV"), &
    3304         1360 :                           unit_str="eV")
    3305         1360 :       CALL section_add_keyword(section, keyword)
    3306         1360 :       CALL keyword_release(keyword)
    3307              : 
    3308              :       CALL keyword_create(keyword, __LOCATION__, name="BROADENING", &
    3309              :                           description="Lorentzian broadening applied to the peaks of the "// &
    3310              :                           "Floquet spectral function.", &
    3311              :                           usage="BROADENING 0.02", &
    3312              :                           default_r_val=cp_unit_to_cp2k(value=0.02_dp, unit_str="eV"), &
    3313         1360 :                           unit_str="eV")
    3314         1360 :       CALL section_add_keyword(section, keyword)
    3315         1360 :       CALL keyword_release(keyword)
    3316              : 
    3317              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
    3318              :                           description="Electronic temperature (in K) of the wide-band fermion "// &
    3319              :                           "bath used to weight the Floquet DOS by Fermi-Dirac occupations, adding "// &
    3320              :                           "an occupied spectral-weight column f(E)*A(E) to the DOS file. If "// &
    3321              :                           "negative (default), that column is not written.", &
    3322         1360 :                           usage="TEMPERATURE 300.0", default_r_val=-1.0_dp)
    3323         1360 :       CALL section_add_keyword(section, keyword)
    3324         1360 :       CALL keyword_release(keyword)
    3325              : 
    3326              :       CALL keyword_create(keyword, __LOCATION__, name="FLOQUET_DOS_FILE_NAME", &
    3327              :                           description="File name used for the Floquet spectral function.", &
    3328              :                           usage="FLOQUET_DOS_FILE_NAME FLOQUET_DOS", &
    3329         1360 :                           default_lc_val="FLOQUET_DOS")
    3330         1360 :       CALL section_add_keyword(section, keyword)
    3331         1360 :       CALL keyword_release(keyword)
    3332              : 
    3333              :       CALL keyword_create(keyword, __LOCATION__, name="QUASI_ENERGIES_FILE_NAME", &
    3334              :                           description="File name used for the Floquet quasi-energies.", &
    3335              :                           usage="QUASI_ENERGIES_FILE_NAME QUASI_ENERGIES", &
    3336         1360 :                           default_lc_val="QUASI_ENERGIES")
    3337         1360 :       CALL section_add_keyword(section, keyword)
    3338         1360 :       CALL keyword_release(keyword)
    3339              : 
    3340              :       CALL keyword_create(keyword, __LOCATION__, name="FLOQUET_BS_FILE_NAME", &
    3341              :                           description="File name used for the Floquet m=0 (central-sector) "// &
    3342              :                           "band structure.", &
    3343              :                           usage="FLOQUET_BS_FILE_NAME FLOQUET_BANDSTRUCTURE", &
    3344         1360 :                           default_lc_val="FLOQUET_BANDSTRUCTURE")
    3345         1360 :       CALL section_add_keyword(section, keyword)
    3346         1360 :       CALL keyword_release(keyword)
    3347              : 
    3348              :       CALL keyword_create(keyword, __LOCATION__, name="MEM_FILL_FRACTION", &
    3349              :                           description="Fraction of the computation memory that may be filled "// &
    3350              :                           "by Floquet Hamiltonian matrices. Reduce if process gets OOMP killed.", &
    3351         1360 :                           usage="MEM_FILL_FRACTION 0.5", default_r_val=0.8_dp)
    3352         1360 :       CALL section_add_keyword(section, keyword)
    3353         1360 :       CALL keyword_release(keyword)
    3354              : 
    3355         1360 :    END SUBROUTINE create_floquet_section
    3356              : 
    3357              : END MODULE input_cp2k_properties_dft
        

Generated by: LCOV version 2.0-1