LCOV - code coverage report
Current view: top level - src - input_cp2k_properties_dft.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:ca6acae) Lines: 99.9 % 957 956
Test Date: 2026-01-02 06:29:53 Functions: 100.0 % 21 21

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

Generated by: LCOV version 2.0-1