LCOV - code coverage report
Current view: top level - src - input_cp2k_properties_dft.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:561f475) Lines: 99.9 % 1076 1075
Test Date: 2026-06-21 06:48:54 Functions: 100.0 % 24 24

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

Generated by: LCOV version 2.0-1