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

Generated by: LCOV version 2.0-1