LCOV - code coverage report
Current view: top level - src - input_cp2k_properties_dft.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:936074a) Lines: 99.9 % 948 947
Test Date: 2025-12-04 06:27:48 Functions: 100.0 % 21 21

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

Generated by: LCOV version 2.0-1