LCOV - code coverage report
Current view: top level - src - input_cp2k_xas.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:42dac4a) Lines: 100.0 % 313 313
Test Date: 2025-07-25 12:55:17 Functions: 100.0 % 2 2

            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 XAS section of the input
      10              : !> \par History
      11              : !>      10.2005 moved out of input_cp2k [fawzi]
      12              : !>      07.2024 moved out of input_cp2k_dft [JGH]
      13              : !> \author fawzi
      14              : ! **************************************************************************************************
      15              : MODULE input_cp2k_xas
      16              :    USE bibliography,                    ONLY: Iannuzzi2007,&
      17              :                                               Shigeta2001
      18              :    USE cp_output_handling,              ONLY: add_last_numeric,&
      19              :                                               cp_print_key_section_create,&
      20              :                                               debug_print_level,&
      21              :                                               high_print_level,&
      22              :                                               low_print_level
      23              :    USE input_constants,                 ONLY: &
      24              :         do_potential_coulomb, do_potential_id, do_potential_short, do_potential_truncated, &
      25              :         gaussian, ot_mini_cg, ot_mini_diis, tddfpt_singlet, tddfpt_spin_cons, tddfpt_spin_flip, &
      26              :         tddfpt_triplet, xas_1s_type, xas_2p_type, xas_2s_type, xas_3d_type, xas_3p_type, &
      27              :         xas_3s_type, xas_4d_type, xas_4f_type, xas_4p_type, xas_4s_type, xas_dip_len, xas_dip_vel, &
      28              :         xas_dscf, xas_none, xas_not_excited, xas_tdp_by_index, xas_tdp_by_kind, xas_tp_fh, &
      29              :         xas_tp_flex, xas_tp_hh, xas_tp_xfh, xas_tp_xhh, xes_tp_val
      30              :    USE input_cp2k_loc,                  ONLY: create_localize_section,&
      31              :                                               print_wanniers
      32              :    USE input_cp2k_print_dft,            ONLY: create_pdos_section
      33              :    USE input_cp2k_scf,                  ONLY: create_scf_section
      34              :    USE input_cp2k_xc,                   ONLY: create_xc_fun_section
      35              :    USE input_keyword_types,             ONLY: keyword_create,&
      36              :                                               keyword_release,&
      37              :                                               keyword_type
      38              :    USE input_section_types,             ONLY: section_add_keyword,&
      39              :                                               section_add_subsection,&
      40              :                                               section_create,&
      41              :                                               section_release,&
      42              :                                               section_type
      43              :    USE input_val_types,                 ONLY: char_t,&
      44              :                                               integer_t,&
      45              :                                               lchar_t,&
      46              :                                               real_t
      47              :    USE kinds,                           ONLY: dp
      48              :    USE string_utilities,                ONLY: s2a
      49              : #include "./base/base_uses.f90"
      50              : 
      51              :    IMPLICIT NONE
      52              :    PRIVATE
      53              : 
      54              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_xas'
      55              : 
      56              :    PUBLIC :: create_xas_section, create_xas_tdp_section
      57              : 
      58              : CONTAINS
      59              : 
      60              : ! **************************************************************************************************
      61              : !> \brief makes the input section for core-level spectroscopy simulations
      62              : !> \param section ...
      63              : !> \par History
      64              : !>      03.2005 created [MI]
      65              : ! **************************************************************************************************
      66         9254 :    SUBROUTINE create_xas_section(section)
      67              :       TYPE(section_type), POINTER                        :: section
      68              : 
      69              :       TYPE(keyword_type), POINTER                        :: keyword
      70              :       TYPE(section_type), POINTER                        :: print_key, subsection
      71              : 
      72         9254 :       CPASSERT(.NOT. ASSOCIATED(section))
      73              :       CALL section_create(section, __LOCATION__, name="xas", &
      74              :                           description="Sets the method of choice to calculate core-level excitation spectra. "// &
      75              :                           "The occupied states from  which we calculate the "// &
      76              :                           "excitation should be specified. "// &
      77              :                           "Localization of the orbitals may be useful.", &
      78              :                           n_keywords=10, n_subsections=1, repeats=.FALSE., &
      79        18508 :                           citations=(/Iannuzzi2007/))
      80              : 
      81         9254 :       NULLIFY (keyword, subsection, print_key)
      82              : 
      83              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
      84              :                           description="controls the activation of core-level spectroscopy simulations", &
      85              :                           usage="&XAS T", &
      86              :                           default_l_val=.FALSE., &
      87         9254 :                           lone_keyword_l_val=.TRUE.)
      88         9254 :       CALL section_add_keyword(section, keyword)
      89         9254 :       CALL keyword_release(keyword)
      90              : 
      91              :       CALL keyword_create(keyword, __LOCATION__, name="METHOD", &
      92              :                           variants=(/"XAS_METHOD"/), &
      93              :                           description="Method to be used to calculate core-level excitation spectra", &
      94              :                           usage="METHOD TP_HH", &
      95              :                           default_i_val=xas_none, &
      96              :                           enum_c_vals=s2a("NONE", "TP_HH", "TP_FH", "TP_VAL", "TP_XHH", "TP_XFH", "DSCF", "TP_FLEX"), &
      97              :                           enum_desc=s2a( &
      98              :                           "No core electron spectroscopy", "Transition potential half-hole", &
      99              :                           "Transition potential full-hole", "Hole in homo for X-ray emission only ", &
     100              :                           "Transition potential excited half-hole", &
     101              :                           "Transition potential excited full-hole ", &
     102              :                           "DSCF calculations to compute the first (core)excited state", &
     103              :                           "Transition potential with generalized core occupation and total number of electrons"), &
     104              :                           enum_i_vals=(/xas_none, xas_tp_hh, xas_tp_fh, xes_tp_val, xas_tp_xhh, &
     105        18508 :                                         xas_tp_xfh, xas_dscf, xas_tp_flex/))
     106         9254 :       CALL section_add_keyword(section, keyword)
     107         9254 :       CALL keyword_release(keyword)
     108              : 
     109              :       CALL keyword_create(keyword, __LOCATION__, name="XAS_CORE", &
     110              :                           description="Occupation of the core state in XAS calculation by TP_FLEX.", &
     111              :                           usage="XAS_CORE 0.5", &
     112         9254 :                           default_r_val=0.5_dp)
     113         9254 :       CALL section_add_keyword(section, keyword)
     114         9254 :       CALL keyword_release(keyword)
     115              : 
     116              :       CALL keyword_create(keyword, __LOCATION__, name="XAS_TOT_EL", &
     117              :                           description="Total number of electrons for spin channel alpha, in XAS calculation by TP_FLEX. "// &
     118              :                           "If it is a negative value, the number of electrons is set to GS number of electrons "// &
     119              :                           "minus the amount subtracted from the core state", &
     120              :                           usage="XAS_TOT_EL 10", &
     121         9254 :                           default_r_val=-1._dp)
     122         9254 :       CALL section_add_keyword(section, keyword)
     123         9254 :       CALL keyword_release(keyword)
     124              : 
     125              :       CALL keyword_create(keyword, __LOCATION__, name="XES_CORE", &
     126              :                           description="Occupation of the core state in XES calculation by TP_VAL. "// &
     127              :                           "The HOMO is emptied by the same amount.", &
     128              :                           usage="XES_CORE 0.5", &
     129         9254 :                           default_r_val=1._dp)
     130         9254 :       CALL section_add_keyword(section, keyword)
     131         9254 :       CALL keyword_release(keyword)
     132              : 
     133              :       CALL keyword_create(keyword, __LOCATION__, name="XES_EMPTY_HOMO", &
     134              :                           description="Set the occupation of the HOMO in XES calculation by TP_VAL. "// &
     135              :                           "The HOMO can be emptied or not, if the core is still full.", &
     136              :                           usage="XES_EMPTY_HOMO", &
     137              :                           default_l_val=.FALSE., &
     138         9254 :                           lone_keyword_l_val=.TRUE.)
     139         9254 :       CALL section_add_keyword(section, keyword)
     140         9254 :       CALL keyword_release(keyword)
     141              : 
     142              :       CALL keyword_create(keyword, __LOCATION__, name="DIPOLE_FORM", &
     143              :                           variants=(/"DIP_FORM"/), &
     144              :                           description="Type of integral to get the oscillator strengths "// &
     145              :                           "in the diipole approximation", &
     146              :                           usage="DIPOLE_FORM string", &
     147              :                           default_i_val=xas_dip_vel, &
     148              :                           enum_c_vals=s2a("LENGTH", "VELOCITY"), &
     149              :                           enum_desc=s2a("Length form &lang; i | e r | j &rang;", &
     150              :                                         "Velocity form &lang; i | d/dr | j &rang;"), &
     151        18508 :                           enum_i_vals=(/xas_dip_len, xas_dip_vel/))
     152         9254 :       CALL section_add_keyword(section, keyword)
     153         9254 :       CALL keyword_release(keyword)
     154              : 
     155              : !   replace the specialized keyword with standard scf section
     156              : !    scf_env is added to xas_env
     157              : 
     158         9254 :       NULLIFY (subsection)
     159         9254 :       CALL create_scf_section(subsection)
     160         9254 :       CALL section_add_subsection(section, subsection)
     161         9254 :       CALL section_release(subsection)
     162              : 
     163              :       CALL keyword_create(keyword, __LOCATION__, name="STATE_TYPE", &
     164              :                           variants=(/"TYPE"/), &
     165              :                           description="Type of the orbitals that are excited for the xas spectra calculation", &
     166              :                           usage="STATE_TYPE 1S", &
     167              :                           default_i_val=xas_1s_type, &
     168              :                           enum_c_vals=s2a("1S", "2S", "2P", "3S", "3P", "3D", "4S", "4P", "4D", "4F"), &
     169              :                           enum_desc=s2a("1s orbitals", "2s orbitals", "2p orbitals", "3s orbitals", "3p orbitals", &
     170              :                                         "3d orbitals", "4s orbitals", "4p orbitals", "4d orbitals", "4f orbitals"), &
     171              :                           enum_i_vals=(/xas_1s_type, xas_2s_type, xas_2p_type, xas_3s_type, xas_3p_type, xas_3d_type, &
     172        18508 :                                         xas_4s_type, xas_4p_type, xas_4d_type, xas_4f_type/))
     173         9254 :       CALL section_add_keyword(section, keyword)
     174         9254 :       CALL keyword_release(keyword)
     175              : 
     176              :       CALL keyword_create(keyword, __LOCATION__, name="STATE_SEARCH", &
     177              :                           description="# of states where to look for the one to be excited", &
     178              :                           usage="STATE_SEARCH 1", &
     179         9254 :                           default_i_val=-1)
     180         9254 :       CALL section_add_keyword(section, keyword)
     181         9254 :       CALL keyword_release(keyword)
     182              : 
     183              :       CALL keyword_create(keyword, __LOCATION__, name="SPIN_CHANNEL", &
     184              :                           description="# Spin channel of the excited orbital", &
     185              :                           usage="SPIN_CHANNEL 1", &
     186         9254 :                           default_i_val=1)
     187         9254 :       CALL section_add_keyword(section, keyword)
     188         9254 :       CALL keyword_release(keyword)
     189              : 
     190              :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS_LIST", &
     191              :                           variants=(/"AT_LIST"/), &
     192              :                           description="Indexes of the atoms to be excited. "// &
     193              :                           "This keyword can be repeated several times "// &
     194              :                           "(useful if you have to specify many indexes).", &
     195              :                           usage="ATOMS_LIST {integer}  {integer} ..  {integer} ", &
     196        18508 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
     197         9254 :       CALL section_add_keyword(section, keyword)
     198         9254 :       CALL keyword_release(keyword)
     199              : 
     200              :       CALL keyword_create(keyword, __LOCATION__, name="OVERLAP_THRESHOLD", &
     201              :                           description="Threshold for including more than one initial core excited state "// &
     202              :                           "per atom. The threshold is taken relative to the maximum overlap.", &
     203         9254 :                           usage="OVERLAP_THRESHOLD 8.e-1", default_r_val=1.0_dp)
     204         9254 :       CALL section_add_keyword(section, keyword)
     205         9254 :       CALL keyword_release(keyword)
     206              : 
     207              :       CALL keyword_create(keyword, __LOCATION__, name="ORBITAL_LIST", &
     208              :                           variants=(/"ORBITAL_LIST"/), &
     209              :                           description="Indices of the localized orbitals to be excited. "// &
     210              :                           "This keyword can be repeated several times "// &
     211              :                           "(useful if you have to specify many indexes).", &
     212              :                           usage="ORBITAL_LIST {integer}  {integer} ..  {integer} ", &
     213        18508 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
     214         9254 :       CALL section_add_keyword(section, keyword)
     215         9254 :       CALL keyword_release(keyword)
     216              : 
     217              :       CALL keyword_create(keyword, __LOCATION__, name="ADDED_MOS", &
     218              :                           description="Number of additional MOS added spin up only", &
     219         9254 :                           usage="ADDED_MOS {integer}", default_i_val=-1)
     220         9254 :       CALL section_add_keyword(section, keyword)
     221         9254 :       CALL keyword_release(keyword)
     222              : 
     223              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER_ADDED", &
     224              :                           description="maximum number of iteration in calculation of added orbitals", &
     225         9254 :                           usage="MAX_ITER_ADDED 100", default_i_val=2999)
     226         9254 :       CALL section_add_keyword(section, keyword)
     227         9254 :       CALL keyword_release(keyword)
     228              : 
     229              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ADDED", &
     230              :                           description="target accuracy incalculation of the added orbitals", &
     231         9254 :                           usage="EPS_ADDED 1.e-6", default_r_val=1.0e-5_dp)
     232         9254 :       CALL section_add_keyword(section, keyword)
     233         9254 :       CALL keyword_release(keyword)
     234              : 
     235              :       CALL keyword_create(keyword, __LOCATION__, name="NGAUSS", &
     236              :                           description="Number of gto's for the expansion of the STO "// &
     237              :                           "of the type given by STATE_TYPE", &
     238         9254 :                           usage="NGAUSS {integer}", default_i_val=3)
     239         9254 :       CALL section_add_keyword(section, keyword)
     240         9254 :       CALL keyword_release(keyword)
     241              : 
     242              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART", &
     243              :                           description="Restart the excited state if the restart file exists", &
     244              :                           usage="RESTART", &
     245         9254 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     246         9254 :       CALL section_add_keyword(section, keyword)
     247         9254 :       CALL keyword_release(keyword)
     248              : 
     249              :       CALL keyword_create(keyword, __LOCATION__, name="WFN_RESTART_FILE_NAME", &
     250              :                           variants=(/"RESTART_FILE_NAME"/), &
     251              :                           description="Root of the file names where to read the MOS from "// &
     252              :                           "which to restart the calculation of the core level excited states", &
     253              :                           usage="WFN_RESTART_FILE_NAME <FILENAME>", &
     254        18508 :                           type_of_var=lchar_t)
     255         9254 :       CALL section_add_keyword(section, keyword)
     256         9254 :       CALL keyword_release(keyword)
     257              : 
     258         9254 :       CALL create_localize_section(subsection)
     259         9254 :       CALL section_add_subsection(section, subsection)
     260         9254 :       CALL section_release(subsection)
     261              : 
     262              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
     263              :                           description="printing of information during the core-level spectroscopy simulation", &
     264         9254 :                           repeats=.FALSE.)
     265              : 
     266              :       ! Add printing of wannier infos
     267         9254 :       CALL print_wanniers(subsection)
     268              : 
     269              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "iteration_info", &
     270              :                                        description="Controls the printing of basic iteration information during the XAS SCF.", &
     271         9254 :                                        print_level=low_print_level, filename="__STD_OUT__")
     272              :       CALL keyword_create(keyword, __LOCATION__, name="time_cumul", &
     273              :                           description="If the printkey is activated switches the printing of timings"// &
     274              :                           " to cumulative (over the SCF).", &
     275         9254 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     276         9254 :       CALL section_add_keyword(print_key, keyword)
     277         9254 :       CALL keyword_release(keyword)
     278         9254 :       CALL section_add_subsection(subsection, print_key)
     279         9254 :       CALL section_release(print_key)
     280              : 
     281              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
     282              :                                        description="Controls the printing of basic iteration information in CLS", &
     283         9254 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     284         9254 :       CALL section_add_subsection(subsection, print_key)
     285         9254 :       CALL section_release(print_key)
     286              : 
     287              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "XES_SPECTRUM", &
     288              :                                        description="Controls the dumping of the CLS output files containing the emission spectra", &
     289         9254 :                                        print_level=low_print_level, common_iter_levels=3, filename="")
     290         9254 :       CALL section_add_subsection(subsection, print_key)
     291         9254 :       CALL section_release(print_key)
     292              : 
     293              :       CALL cp_print_key_section_create( &
     294              :          print_key, __LOCATION__, "XAS_SPECTRUM", &
     295              :          description="Controls the dumping of the CLS output files containing the absorption spectra", &
     296         9254 :          print_level=low_print_level, common_iter_levels=3, filename="")
     297         9254 :       CALL section_add_subsection(subsection, print_key)
     298         9254 :       CALL section_release(print_key)
     299              : 
     300         9254 :       CALL create_pdos_section(print_key)
     301         9254 :       CALL section_add_subsection(subsection, print_key)
     302         9254 :       CALL section_release(print_key)
     303              : 
     304              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
     305              :                                        description="Controls the dumping of MO restart file during the SCF. "// &
     306              :                                        "of a Core-Level-Spectroscopy calculation. For each new excited atom, "// &
     307              :                                        "one different restart file is dumped. These restart files should be "// &
     308              :                                        "employed only to restart the same type of CLS calculation, "// &
     309              :                                        "i.e. with the same core potential.", &
     310              :                                        print_level=low_print_level, common_iter_levels=3, each_iter_names=s2a("XAS_SCF"), &
     311         9254 :                                        add_last=add_last_numeric, each_iter_values=(/3/), filename="")
     312         9254 :       CALL section_add_subsection(subsection, print_key)
     313         9254 :       CALL section_release(print_key)
     314              : 
     315              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FULL_RESTART", &
     316              :                                        description="Controls the dumping of a standard MO restart file "// &
     317              :                                        "where coefficients and occupation numbers are those of the TP scheme, "// &
     318              :                                        "i.e. with emptied core state.", &
     319              :                                        print_level=high_print_level, common_iter_levels=3, each_iter_names=s2a("XAS_SCF"), &
     320         9254 :                                        add_last=add_last_numeric, each_iter_values=(/3/), filename="")
     321         9254 :       CALL section_add_subsection(subsection, print_key)
     322         9254 :       CALL section_release(print_key)
     323              : 
     324              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CLS_FUNCTION_CUBES", &
     325              :                                        description="Controls the printing of the relaxed orbitals ", &
     326         9254 :                                        print_level=high_print_level, common_iter_levels=3, add_last=add_last_numeric, filename="")
     327              :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
     328              :                           description="The stride (X,Y,Z) used to write the cube file "// &
     329              :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
     330              :                           " 1 number valid for all components.", &
     331         9254 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
     332         9254 :       CALL section_add_keyword(print_key, keyword)
     333         9254 :       CALL keyword_release(keyword)
     334              : 
     335              :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LU_BOUNDS", &
     336              :                           variants=(/"CUBES_LU"/), &
     337              :                           description="The lower and upper index of the states to be printed as cube", &
     338              :                           usage="CUBES_LU_BOUNDS integer integer", &
     339        18508 :                           n_var=2, default_i_vals=(/0, -2/), type_of_var=integer_t)
     340         9254 :       CALL section_add_keyword(print_key, keyword)
     341         9254 :       CALL keyword_release(keyword)
     342              : 
     343              :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LIST", &
     344              :                           description="Indexes of the states to be printed as cube files "// &
     345              :                           "This keyword can be repeated several times "// &
     346              :                           "(useful if you have to specify many indexes).", &
     347              :                           usage="CUBES_LIST 1 2", &
     348         9254 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
     349         9254 :       CALL section_add_keyword(print_key, keyword)
     350         9254 :       CALL keyword_release(keyword)
     351              :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
     352              :                           description="append the cube files when they already exist", &
     353         9254 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     354         9254 :       CALL section_add_keyword(print_key, keyword)
     355         9254 :       CALL keyword_release(keyword)
     356              : 
     357         9254 :       CALL section_add_subsection(subsection, print_key)
     358         9254 :       CALL section_release(print_key)
     359              : 
     360         9254 :       CALL section_add_subsection(section, subsection)
     361         9254 :       CALL section_release(subsection)
     362              : 
     363         9254 :    END SUBROUTINE create_xas_section
     364              : 
     365              : ! **************************************************************************************************
     366              : !> \brief makes the input section for core-level spectroscopy simulations using
     367              : !>        linear response TDDFT
     368              : !> \param section ...
     369              : !> \par History
     370              : !>      11.2017 created [AB]
     371              : ! **************************************************************************************************
     372        18492 :    SUBROUTINE create_xas_tdp_section(section)
     373              :       TYPE(section_type), POINTER                        :: section
     374              : 
     375              :       TYPE(keyword_type), POINTER                        :: keyword
     376              :       TYPE(section_type), POINTER                        :: print_key, subsection, subsubsection, &
     377              :                                                             subsubsubsection
     378              : 
     379        18492 :       NULLIFY (keyword, print_key, subsection, subsubsection, subsubsubsection)
     380              : 
     381        18492 :       CPASSERT(.NOT. ASSOCIATED(section))
     382              :       CALL section_create(section, __LOCATION__, name="XAS_TDP", &
     383              :                           description="XAS simulations using linear-response TDDFT. Excitation from "// &
     384              :                           "specified core orbitals are considered one at a time. In case of high "// &
     385              :                           "symmetry structures, donor core orbitals should be localized.", &
     386        18492 :                           n_keywords=19, n_subsections=4, repeats=.FALSE.)
     387              : 
     388        18492 :       NULLIFY (keyword, subsection, print_key)
     389              : 
     390              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     391              :                           description="controls the activation of XAS simulations with linear "// &
     392              :                           "response TDDFT.", &
     393              :                           usage="&TDP_XAS {logical}", &
     394              :                           default_l_val=.FALSE., &
     395        18492 :                           lone_keyword_l_val=.TRUE.)
     396        18492 :       CALL section_add_keyword(section, keyword)
     397        18492 :       CALL keyword_release(keyword)
     398              : 
     399              :       CALL keyword_create(keyword, __LOCATION__, name="CHECK_ONLY", &
     400              :                           description="This keyword defines whether the full calculation should "// &
     401              :                           "be done or not. If set to .TRUE., only the determination "// &
     402              :                           "of donor MOs is conducted. This run option allows for "// &
     403              :                           "cheap verification of the input parameters", &
     404              :                           usage="CHECK_ONLY {logical}", &
     405              :                           default_l_val=.FALSE., &
     406              :                           lone_keyword_l_val=.TRUE., &
     407        18492 :                           repeats=.FALSE.)
     408        18492 :       CALL section_add_keyword(section, keyword)
     409        18492 :       CALL keyword_release(keyword)
     410              : 
     411              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_FROM_FILE", &
     412              :                           variants=s2a("RESTART_FILENAME", "RST_FILENAME", "RESTART_FILE", "RST_FILE"), &
     413              :                           description="By providing a RESTART file containing the linear-response "// &
     414              :                           "orbitals and excitations energies from a previous calculation, "// &
     415              :                           "all computations are skipped except for the corresponding "// &
     416              :                           "PDOS and/or CUBE file printing as defined in the PRINT "// &
     417              :                           "subsection. Basis sets and geometry need to be consistent.", &
     418              :                           usage="RESTART_FROM_FILE <FILENAME>", &
     419        18492 :                           type_of_var=char_t, n_var=-1)
     420        18492 :       CALL section_add_keyword(section, keyword)
     421        18492 :       CALL keyword_release(keyword)
     422              : 
     423              :       CALL keyword_create(keyword, __LOCATION__, name="EXCITATIONS", &
     424              :                           variants=(/"EXCITATION"/), &
     425              :                           description="Specify the type of excitation to consider. In case of a "// &
     426              :                           "resctricted closed-shell ground state calculation, "// &
     427              :                           "RCS_SINGLET or/and RCS_TRIPLET can be chosen. In case of a "// &
     428              :                           "open-shell ground state calculation (either UKS or ROKS), "// &
     429              :                           "standard spin conserving excitation (OS_SPIN_CONS) or/and "// &
     430              :                           "spin-flip excitation (OS_SPIN_FLIP) can be chosen.", &
     431              :                           usage="EXCITATIONS {string}", &
     432              :                           repeats=.TRUE., &
     433              :                           default_i_val=tddfpt_singlet, &
     434              :                           enum_c_vals=s2a("RCS_SINGLET", "RCS_TRIPLET", "OS_SPIN_CONS", "OS_SPIN_FLIP"), &
     435              :                           enum_desc=s2a("Singlet excitation on top of restricted closed-shell ground state", &
     436              :                                         "Triplet excitation on top of restricted closed-shell ground state", &
     437              :                                         "Spin-conserving excitations on top of open-shell ground state", &
     438              :                                         "Spin-flip excitation on top of open-shell ground state"), &
     439        36984 :                           enum_i_vals=(/tddfpt_singlet, tddfpt_triplet, tddfpt_spin_cons, tddfpt_spin_flip/))
     440        18492 :       CALL section_add_keyword(section, keyword)
     441        18492 :       CALL keyword_release(keyword)
     442              : 
     443              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_PGF_XAS", &
     444              :                           variants=s2a("EPS_PGF", "EPS_PGF_XAS_TDP"), &
     445              :                           description="The threshold used to determine the spacial extent of all "// &
     446              :                           "primitive Gaussian functions used for the construction "// &
     447              :                           "of neighbor lists in the XAS_TDP method. "// &
     448              :                           "By default, takes the value of QS%EPS_PGF_ORB. Useful if "// &
     449              :                           "the former value is tiny due to possible ground state HFX "// &
     450              :                           "contributions.", &
     451              :                           usage="EPS_PGF_XAS {real}", &
     452        18492 :                           type_of_var=real_t)
     453        18492 :       CALL section_add_keyword(section, keyword)
     454        18492 :       CALL keyword_release(keyword)
     455              : 
     456              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER", &
     457              :                           variants=s2a("EPS_FILTER_MATRIX"), &
     458              :                           description="The threshold used for sparse matrix operations", &
     459              :                           usage="EPS_FILTER {real}", &
     460              :                           type_of_var=real_t, &
     461        18492 :                           default_r_val=1.0E-10_dp)
     462        18492 :       CALL section_add_keyword(section, keyword)
     463        18492 :       CALL keyword_release(keyword)
     464              : 
     465              :       CALL keyword_create(keyword, __LOCATION__, name="DIPOLE_FORM", &
     466              :                           variants=(/"DIP_FORM"/), &
     467              :                           description="Type of integral to get the oscillator strengths "// &
     468              :                           "in the dipole approximation", &
     469              :                           usage="DIPOLE_FORM {string}", &
     470              :                           default_i_val=xas_dip_vel, &
     471              :                           enum_c_vals=s2a("LENGTH", "VELOCITY"), &
     472              :                           enum_desc=s2a("Length form &lang; 0 | e r | n &rang;", &
     473              :                                         "Velocity form &lang; 0 | d/dr | n &rang;"), &
     474        36984 :                           enum_i_vals=(/xas_dip_len, xas_dip_vel/))
     475        18492 :       CALL section_add_keyword(section, keyword)
     476        18492 :       CALL keyword_release(keyword)
     477              : 
     478              :       CALL keyword_create(keyword, __LOCATION__, name="QUADRUPOLE", &
     479              :                           variants=s2a("DO_QUADRUPOLE", "DO_QUAD", "QUAD"), &
     480              :                           description="Compute the electric quadrupole contribution to the "// &
     481              :                           "oscillator strenghts (in the length representation with "// &
     482              :                           "the origin set on the relevant excited atom)", &
     483              :                           usage="QUADRUPOLE {logical}", &
     484              :                           default_l_val=.FALSE., &
     485        18492 :                           lone_keyword_l_val=.TRUE.)
     486        18492 :       CALL section_add_keyword(section, keyword)
     487        18492 :       CALL keyword_release(keyword)
     488              : 
     489              :       CALL keyword_create(keyword, __LOCATION__, name="XYZ_DIPOLE", &
     490              :                           variants=s2a("DIPOLE_XYZ"), &
     491              :                           description="Whether the detailed contributions of the dipole oscillator "// &
     492              :                           "strengths along the X,Y,Z directions should be printed.", &
     493              :                           usage="XYZ_DIPOLE {logical}", &
     494              :                           default_l_val=.FALSE., &
     495        18492 :                           lone_keyword_l_val=.TRUE.)
     496        18492 :       CALL section_add_keyword(section, keyword)
     497        18492 :       CALL keyword_release(keyword)
     498              : 
     499              :       CALL keyword_create(keyword, __LOCATION__, name="SPIN_DIPOLE", &
     500              :                           variants=s2a("DIPOLE_SPIN"), &
     501              :                           description="Whether the detailed contributions of the dipole oscillator "// &
     502              :                           "strengths for alpha and beta spins should be printed.", &
     503              :                           usage="SPIN_DIPOLE {logical}", &
     504              :                           default_l_val=.FALSE., &
     505        18492 :                           lone_keyword_l_val=.TRUE.)
     506        18492 :       CALL section_add_keyword(section, keyword)
     507        18492 :       CALL keyword_release(keyword)
     508              : 
     509              : !  the GW2X correction subsection
     510              :       CALL section_create(subsection, __LOCATION__, name="GW2X", &
     511              :                           description="Specifications for the GW2X calculation of core "// &
     512              :                           "ionization potentials. Note that donor states need to be actively "// &
     513              :                           "localized using the LOCALIZE keyword in DONOR_STATES. N_SEARCH "// &
     514              :                           "should be kept to the minimum, such that only core states are localized.", &
     515              :                           citations=(/Shigeta2001/), &
     516              :                           n_keywords=8, &
     517              :                           n_subsections=0, &
     518        36984 :                           repeats=.FALSE.)
     519              : 
     520              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     521              :                           description="Enables the GW2X correction of the core ionization potentials", &
     522              :                           usage="&GW2X {logical}", &
     523              :                           default_l_val=.FALSE., &
     524        18492 :                           lone_keyword_l_val=.TRUE.)
     525        18492 :       CALL section_add_keyword(subsection, keyword)
     526        18492 :       CALL keyword_release(keyword)
     527              : 
     528              :       CALL keyword_create(keyword, __LOCATION__, name="XPS_ONLY", &
     529              :                           description="If set to .TRUE., only run GW2X calculations for XPS "// &
     530              :                           "spectroscopy and ignore all XAS calculations. It is still "// &
     531              :                           "required to define the DONOR_STATES and KERNEL%EXACT_EXCHANGE "// &
     532              :                           "subsections.", &
     533              :                           default_l_val=.FALSE., &
     534        18492 :                           lone_keyword_l_val=.TRUE.)
     535        18492 :       CALL section_add_keyword(subsection, keyword)
     536        18492 :       CALL keyword_release(keyword)
     537              : 
     538              :       CALL keyword_create(keyword, __LOCATION__, name="BATCH_SIZE", &
     539              :                           description="MOs batch size for batched tensor contraction. Larger "// &
     540              :                           "size is faster, but uses more memory. Default should be safe "// &
     541              :                           "in most cases.", &
     542        18492 :                           default_i_val=64)
     543        18492 :       CALL section_add_keyword(subsection, keyword)
     544        18492 :       CALL keyword_release(keyword)
     545              : 
     546              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_GW2X", &
     547              :                           description="Convergence threshold for GW2X iterations (in eV)", &
     548        18492 :                           default_r_val=1.E-2_dp)
     549        18492 :       CALL section_add_keyword(subsection, keyword)
     550        18492 :       CALL keyword_release(keyword)
     551              : 
     552              :       CALL keyword_create(keyword, __LOCATION__, name="C_OS", &
     553              :                           description="Opposite-spin scling factor. SCS => 6/5, SOS => 1.3", &
     554        18492 :                           default_r_val=1.0_dp)
     555        18492 :       CALL section_add_keyword(subsection, keyword)
     556        18492 :       CALL keyword_release(keyword)
     557              : 
     558              :       CALL keyword_create(keyword, __LOCATION__, name="C_SS", &
     559              :                           description="Same-spin scling factor. SCS => 1/3, SOS => 0.0", &
     560        18492 :                           default_r_val=1.0_dp)
     561        18492 :       CALL section_add_keyword(subsection, keyword)
     562        18492 :       CALL keyword_release(keyword)
     563              : 
     564              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_GW2X_ITER", &
     565              :                           description="Maximum number of iterations for GW2X", &
     566        18492 :                           default_i_val=10)
     567        18492 :       CALL section_add_keyword(subsection, keyword)
     568        18492 :       CALL keyword_release(keyword)
     569              : 
     570              :       CALL keyword_create(keyword, __LOCATION__, name="PSEUDO_CANONICAL", &
     571              :                           variants=(/"PSEUDO_CANO"/), &
     572              :                           description="Whether the pseudo-canonical version of GW2X should be used "// &
     573              :                           "(versus only using the diagonal of the generalized Fock matrix)", &
     574        36984 :                           default_l_val=.TRUE.)
     575        18492 :       CALL section_add_keyword(subsection, keyword)
     576        18492 :       CALL keyword_release(keyword)
     577              : 
     578        18492 :       CALL section_add_subsection(section, subsection)
     579        18492 :       CALL section_release(subsection)
     580              : 
     581              : !  The donor state subsection
     582              : 
     583              :       CALL section_create(subsection, __LOCATION__, name="DONOR_STATES", &
     584              :                           description="Specifications for the donor states from which core "// &
     585              :                           "electrons are excited", &
     586              :                           n_keywords=6, &
     587              :                           n_subsections=0, &
     588        18492 :                           repeats=.FALSE.)
     589              : 
     590              :       CALL keyword_create(keyword, __LOCATION__, name="DEFINE_EXCITED", &
     591              :                           description="Whether the atoms to be excited should be defined by "// &
     592              :                           "a list of atom indices or by a list of atom kinds.", &
     593              :                           usage="DEFINE_EXCITED {string}", &
     594              :                           default_i_val=xas_tdp_by_index, &
     595              :                           enum_c_vals=s2a("BY_INDEX", "BY_KIND"), &
     596              :                           enum_i_vals=(/xas_tdp_by_index, xas_tdp_by_kind/), &
     597              :                           enum_desc=s2a("Excited atoms are defined by a list of indices", &
     598        18492 :                                         "Excited atoms are defined by a list of atomic kinds"))
     599        18492 :       CALL section_add_keyword(subsection, keyword)
     600        18492 :       CALL keyword_release(keyword)
     601              : 
     602              :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_LIST", &
     603              :                           variants=(/"AT_LIST"/), &
     604              :                           description="Indices of the atoms to be excited. "// &
     605              :                           "Keyword only taken into account if DEFINE_EXCITED = BY_INDEX", &
     606              :                           usage="ATOM_LIST {integer}  {integer} ..  {integer} ", &
     607        36984 :                           n_var=-1, type_of_var=integer_t, repeats=.FALSE.)
     608        18492 :       CALL section_add_keyword(subsection, keyword)
     609        18492 :       CALL keyword_release(keyword)
     610              : 
     611              :       CALL keyword_create(keyword, __LOCATION__, name="KIND_LIST", &
     612              :                           description="Kind of atoms to be excited. "// &
     613              :                           "All atoms of the specified kinds are considered. "// &
     614              :                           "Keyword only taken into account if DEFINE_EXCITED = BY_KIND", &
     615              :                           usage="KIND_LIST {string}  {string} ..  {string} ", &
     616        18492 :                           n_var=-1, type_of_var=char_t, repeats=.FALSE.)
     617        18492 :       CALL section_add_keyword(subsection, keyword)
     618        18492 :       CALL keyword_release(keyword)
     619              : 
     620              :       CALL keyword_create(keyword, __LOCATION__, name="STATE_TYPES", &
     621              :                           variants=(/"TYPES"/), &
     622              :                           description="Types of orbitals that are excited, for each atom/kind, "// &
     623              :                           "in order to do LR-TDDFT driven xas spectra calculation. "// &
     624              :                           "This keyword MUST have the same number of entries as the relevant "// &
     625              :                           "KIND_LIST or ATOM_LIST. The order of the specified state types must "// &
     626              :                           "correspond to the order of the relevant kinds/indices. "// &
     627              :                           "This keyword can be repeated, useful when multiple orbital types "// &
     628              :                           "should be excited for specific kinds/atoms.", &
     629              :                           n_var=-1, default_i_val=xas_not_excited, repeats=.TRUE., &
     630              :                           usage="STATE_TYPES {string}  {string} .. {string}", &
     631              :                           enum_c_vals=s2a("1S", "2S", "2P", "NE"), &
     632              :                           enum_desc=s2a("1s orbital", "2s orbital", "2p orbitals", "not excited"), &
     633        36984 :                           enum_i_vals=(/xas_1s_type, xas_2s_type, xas_2p_type, xas_not_excited/))
     634        18492 :       CALL section_add_keyword(subsection, keyword)
     635        18492 :       CALL keyword_release(keyword)
     636              : 
     637              :       CALL keyword_create(keyword, __LOCATION__, name="N_SEARCH", &
     638              :                           description="Number of MOs (per spin) to search to find specified donor core "// &
     639              :                           "orbitals, starting from the lowest in energy and upward. By default, "// &
     640              :                           "all HOMOs are searched. If the LOCALIZE keyword is used, "// &
     641              :                           "then all searched states are first localized.", &
     642              :                           usage="N_SEARCH {integer}", &
     643        18492 :                           default_i_val=-1)
     644        18492 :       CALL section_add_keyword(subsection, keyword)
     645        18492 :       CALL keyword_release(keyword)
     646              : 
     647              :       CALL keyword_create(keyword, __LOCATION__, name="LOCALIZE", &
     648              :                           variants=s2a("LOC", "DO_LOC"), &
     649              :                           description="Whether the N_SEARCH potential donor states should be "// &
     650              :                           "actively localized. Necessary in case of excited atoms "// &
     651              :                           "equivalent under symmetry or GW2X correction.", &
     652              :                           usage="LOCALIZE {logical}", &
     653              :                           default_l_val=.FALSE., &
     654        18492 :                           lone_keyword_l_val=.TRUE.)
     655        18492 :       CALL section_add_keyword(subsection, keyword)
     656        18492 :       CALL keyword_release(keyword)
     657              : 
     658        18492 :       CALL section_add_subsection(section, subsection)
     659        18492 :       CALL section_release(subsection)
     660              : ! End of the donor states subsection
     661              : 
     662              : ! The OT solver subsection
     663              :       CALL section_create(subsection, __LOCATION__, name="OT_SOLVER", &
     664              :                           description="Specifications for the iterative OT solver. Note: only "// &
     665              :                           "available within the Tamm-Dancoff approximation. Recommanded if excitations "// &
     666              :                           "from multiple donor states take place.", &
     667              :                           n_keywords=4, &
     668              :                           n_subsections=0, &
     669        18492 :                           repeats=.FALSE.)
     670              : 
     671              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     672              :                           description="Enables the usage of the OT iterator solver", &
     673              :                           usage="&OT_SOLVER {logical}", &
     674              :                           default_l_val=.FALSE., &
     675        18492 :                           lone_keyword_l_val=.TRUE.)
     676        18492 :       CALL section_add_keyword(subsection, keyword)
     677        18492 :       CALL keyword_release(keyword)
     678              : 
     679              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
     680              :                           description="Maximum number of iterations allowed for the OT solver", &
     681              :                           usage="MAX_ITER {integer}", &
     682        18492 :                           default_i_val=50)
     683        18492 :       CALL section_add_keyword(subsection, keyword)
     684        18492 :       CALL keyword_release(keyword)
     685              : 
     686              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ITER", &
     687              :                           description="Convergence threshold for the OT solver", &
     688              :                           usage="EPS_ITER {double}", &
     689        18492 :                           default_r_val=1.0E-4_dp)
     690        18492 :       CALL section_add_keyword(subsection, keyword)
     691        18492 :       CALL keyword_release(keyword)
     692              : 
     693              :       CALL keyword_create(keyword, __LOCATION__, name="MINIMIZER", &
     694              :                           description="Minimizer to be used with the OT solver", &
     695              :                           usage="MINIMIZER DIIS", &
     696              :                           default_i_val=ot_mini_diis, &
     697              :                           enum_c_vals=s2a("CG", "DIIS"), &
     698              :                           enum_desc=s2a("Conjugated gradient: safer", &
     699              :                                         "Direct inversion of the iterative subspace: faster"), &
     700        18492 :                           enum_i_vals=(/ot_mini_cg, ot_mini_diis/))
     701        18492 :       CALL section_add_keyword(subsection, keyword)
     702        18492 :       CALL keyword_release(keyword)
     703              : 
     704        18492 :       CALL section_add_subsection(section, subsection)
     705        18492 :       CALL section_release(subsection)
     706              : ! End of the OT solver subsection
     707              : 
     708              :       CALL keyword_create(keyword, __LOCATION__, name="SPIN_ORBIT_COUPLING", &
     709              :                           variants=(/"SOC"/), &
     710              :                           description="Whether spin-orbit coupling should be added. "// &
     711              :                           "Note: only applies for spin-restricted calculations with "// &
     712              :                           "singlet and triplet excitations OR spin-unrestricted "// &
     713              :                           "calculations with both spin-conserving and spin-flip.", &
     714              :                           usage="SOC {logical}", &
     715              :                           default_l_val=.FALSE., &
     716        36984 :                           lone_keyword_l_val=.TRUE.)
     717        18492 :       CALL section_add_keyword(section, keyword)
     718        18492 :       CALL keyword_release(keyword)
     719              : 
     720              :       CALL keyword_create(keyword, __LOCATION__, name="TAMM_DANCOFF", &
     721              :                           variants=(/"TDA"/), &
     722              :                           description="Whether the Tamm-Dancoff approximation should be used.", &
     723              :                           usage="TAMM_DANCOFF {logical}", &
     724              :                           default_l_val=.TRUE., &
     725        36984 :                           lone_keyword_l_val=.TRUE.)
     726        18492 :       CALL section_add_keyword(section, keyword)
     727        18492 :       CALL keyword_release(keyword)
     728              : 
     729              :       CALL keyword_create(keyword, __LOCATION__, name="GRID", &
     730              :                           variants=(/"ATOMIC_GRID"/), &
     731              :                           description="Specification of the atomic angular and radial grids for "// &
     732              :                           "a given atomic kind. This keyword can/should be repeated "// &
     733              :                           "for each excited kind. The default grid dimensions are "// &
     734              :                           "those set for the GAPW ground state calculation. These "// &
     735              :                           "grids are used for the xc-kernel integration. "// &
     736              :                           "Usage: GRID < KIND > < LEBEDEV_GRID > < RADIAL_GRID >", &
     737              :                           usage="GRID {string} {integer} {integer}", &
     738        36984 :                           n_var=3, type_of_var=char_t, repeats=.TRUE.)
     739        18492 :       CALL section_add_keyword(section, keyword)
     740        18492 :       CALL keyword_release(keyword)
     741              : 
     742              :       CALL keyword_create(keyword, __LOCATION__, name="N_EXCITED", &
     743              :                           variants=(/"N_ROOTS"/), &
     744              :                           description="The number of excited states to compute per donor "// &
     745              :                           "molecular orbital. (e.g. if 2p excitations, "// &
     746              :                           "3*N_EXCITED excited states are considered). "// &
     747              :                           "If N_EXCITED is set to -1, all excitations are considered", &
     748              :                           usage="N_EXCITED {integer}", &
     749        36984 :                           default_i_val=-1)
     750        18492 :       CALL section_add_keyword(section, keyword)
     751        18492 :       CALL keyword_release(keyword)
     752              : 
     753              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_RANGE", &
     754              :                           variants=s2a("E_RANGE"), &
     755              :                           description="The energy range in eV for which excitations are considered. "// &
     756              :                           "Only excitated states within the range of: first excitation "// &
     757              :                           "energy + ENERGY_RANGE are kept. If ENERGY_RANGE "// &
     758              :                           "and N_EXCITED are specified, the former has priority. "// &
     759              :                           "Negative values are ignored and N_EXCITED takes over.", &
     760              :                           usage="ENERGY_RANGE {real}", &
     761        18492 :                           default_r_val=-1.0_dp)
     762        18492 :       CALL section_add_keyword(section, keyword)
     763        18492 :       CALL keyword_release(keyword)
     764              : 
     765              : !  The KERNEL subsection
     766              :       CALL section_create(subsection, __LOCATION__, name="KERNEL", &
     767              :                           description="Defines how the kernel is built in terms of functionals.", &
     768              :                           n_keywords=1, &
     769              :                           n_subsections=1, &
     770        18492 :                           repeats=.FALSE.)
     771              : 
     772              :       CALL keyword_create(keyword, __LOCATION__, name="RI_REGION", &
     773              :                           variants=(/"RI_RADIUS"/), &
     774              :                           description="The region defined by a sphere of the given radius around "// &
     775              :                           "the excited atom defining which RI_XAS basis elements are "// &
     776              :                           "considered for the RI projection of the density. Each basis "// &
     777              :                           "element which center is in this region is taken. The density "// &
     778              :                           "for a given excited atom is expressed as : "// &
     779              :                           "sum_ijkl P_ij (ijk) S_kl^-1 xi_l, where P_ij is the density "// &
     780              :                           "matrix, i,j span the orbital basis and k,l the RI_XAS basis "// &
     781              :                           "in the region. The larger the radius, the more basis "// &
     782              :                           "functions to expand the density. However, it is assumed "// &
     783              :                           "that it is a small number and the code does not scale well "// &
     784              :                           "as the number of RI basis elements gets too large. "// &
     785              :                           "Expressed in Angstrom. If the radius is set to 0.0, only "// &
     786              :                           "the RI basis elements centered on the excited atom are used.", &
     787              :                           usage="RI_REGION {real}", &
     788        36984 :                           default_r_val=0.0_dp)
     789        18492 :       CALL section_add_keyword(subsection, keyword)
     790        18492 :       CALL keyword_release(keyword)
     791              : 
     792              : !  The XC_FUNCTIONAL subsubsection
     793        18492 :       CALL create_xc_fun_section(subsubsection)
     794        18492 :       CALL section_add_subsection(subsection, subsubsection)
     795        18492 :       CALL section_release(subsubsection)
     796              : 
     797              : ! The EXACT_EXCHANGE subsubsection
     798              :       CALL section_create(subsubsection, __LOCATION__, name="EXACT_EXCHANGE", &
     799              :                           description="Whether exact-exchange should be added to the kernel and "// &
     800              :                           "if so, with which fraction and operator.", &
     801              :                           n_keywords=7, &
     802              :                           n_subsections=1, &
     803        18492 :                           repeats=.FALSE.)
     804              : 
     805              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     806              :                           description="Enables the addition of exact exchange to the kernel.", &
     807              :                           usage="&EXACT_EXCHANGE {logical}", &
     808              :                           default_l_val=.FALSE., &
     809        18492 :                           lone_keyword_l_val=.TRUE.)
     810        18492 :       CALL section_add_keyword(subsubsection, keyword)
     811        18492 :       CALL keyword_release(keyword)
     812              : 
     813              :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_TYPE", &
     814              :                           variants=s2a("OP", "OPERATOR", "POTENTIAL"), &
     815              :                           description="The type of operator used for exact exchange. The standard "// &
     816              :                           "Coulomb operator cannot be used in periodic systems.", &
     817              :                           usage="OPERATOR {string}", &
     818              :                           repeats=.FALSE., &
     819              :                           default_i_val=do_potential_coulomb, &
     820              :                           enum_c_vals=s2a("COULOMB", "TRUNCATED", "SHORTRANGE"), &
     821              :                           enum_desc=s2a("Standard Coulomb operator: 1/r", &
     822              :                                         "Truncated Coulomb operator: 1/r if r < R_c, 0 otherwise ", &
     823              :                                         "Short range: erfc(omega*r)/r"), &
     824              :                           enum_i_vals=(/do_potential_coulomb, do_potential_truncated, &
     825        18492 :                                         do_potential_short/))
     826        18492 :       CALL section_add_keyword(subsubsection, keyword)
     827        18492 :       CALL keyword_release(keyword)
     828              : 
     829              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
     830              :                           variants=s2a("R_C", "RC", "RANGE"), &
     831              :                           description="The cutoff radius (in Angstrom) for the truncated Coulomb operator.", &
     832              :                           usage="CUTOFF_RADIUS {double}", &
     833              :                           default_r_val=0.0_dp, &
     834        18492 :                           repeats=.FALSE.)
     835        18492 :       CALL section_add_keyword(subsubsection, keyword)
     836        18492 :       CALL keyword_release(keyword)
     837              : 
     838              :       CALL keyword_create(keyword, __LOCATION__, name="T_C_G_DATA", &
     839              :                           description="Location of the file t_c_g.dat that contains the data for the "// &
     840              :                           "evaluation of the truncated gamma function ", &
     841              :                           usage="T_C_G_DATA {string}", &
     842        18492 :                           default_c_val="t_c_g.dat")
     843        18492 :       CALL section_add_keyword(subsubsection, keyword)
     844        18492 :       CALL keyword_release(keyword)
     845              : 
     846              :       CALL keyword_create(keyword, __LOCATION__, name="OMEGA", &
     847              :                           description="The range parameter for the short range operator (in 1/a0).", &
     848              :                           usage="OMEGA {double}", &
     849              :                           default_r_val=0.0_dp, &
     850        18492 :                           repeats=.FALSE.)
     851        18492 :       CALL section_add_keyword(subsubsection, keyword)
     852        18492 :       CALL keyword_release(keyword)
     853              : 
     854              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_RANGE", &
     855              :                           description="The threshold to determine the effective range of the short range "// &
     856              :                           "operator: erfc(omega*eff_range)/eff_range = EPS_RANGE", &
     857              :                           usage="EPS_RANGE = {double}", &
     858              :                           default_r_val=1.0E-6_dp, &
     859        18492 :                           repeats=.FALSE.)
     860        18492 :       CALL section_add_keyword(subsubsection, keyword)
     861        18492 :       CALL keyword_release(keyword)
     862              : 
     863              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_SCREENING", &
     864              :                           variants=s2a("EPS_SCREEN"), &
     865              :                           description="A threshold to determine which primitive 3-center integrals "// &
     866              :                           "are kept for contraction, as the latter operation can be "// &
     867              :                           "expensive (especially for large basis sets ). "// &
     868              :                           "If |(ab|c)| < EPS_SCREENNING, it is discarded.", &
     869              :                           default_r_val=1.0E-8_dp, &
     870        18492 :                           repeats=.FALSE.)
     871        18492 :       CALL section_add_keyword(subsubsection, keyword)
     872        18492 :       CALL keyword_release(keyword)
     873              : 
     874              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE", &
     875              :                           variants=s2a("FRACTION"), &
     876              :                           description="Scaling of the exact exchange contribution.", &
     877        18492 :                           default_r_val=1.0_dp)
     878        18492 :       CALL section_add_keyword(subsubsection, keyword)
     879        18492 :       CALL keyword_release(keyword)
     880              : 
     881              :       !The RI metric subsection
     882              :       CALL section_create(subsubsubsection, __LOCATION__, name="RI_METRIC", &
     883              :                           description="This subsection allows for the definition of an exchange "// &
     884              :                           "RI metric that is different from the main exchange potential. "// &
     885              :                           "By default (i.e. if this subsection is ignored), the "// &
     886              :                           "exchange kernel is computed in the V approximation: "// &
     887              :                           "(ab|ij) = (ab|P) V^-1 (Q|ij), where V = (P|Q). With a RI "// &
     888              :                           "metric, we have a 2 step RI involving the metric potential "// &
     889              :                           "for the 3-center integrals: "// &
     890              :                           "(ab|ij) = (ab!P) (P!Q)^-1 (Q|R) (R!S)^-1 (S!ij), where | "// &
     891              :                           "stands for the exchange potential and ! for the metric "// &
     892              :                           "potential. This allows for drastic screening of the "// &
     893              :                           "3-center integrals by selecting shorter range metric.", &
     894              :                           n_keywords=5, &
     895              :                           n_subsections=0, &
     896        18492 :                           repeats=.FALSE.)
     897              : 
     898              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     899              :                           description="Enables the use of a RI metric.", &
     900              :                           usage="&EXACT_EXCHANGE {logical}", &
     901              :                           default_l_val=.FALSE., &
     902        18492 :                           lone_keyword_l_val=.TRUE.)
     903        18492 :       CALL section_add_keyword(subsubsubsection, keyword)
     904        18492 :       CALL keyword_release(keyword)
     905              : 
     906              :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_TYPE", &
     907              :                           variants=s2a("OP", "OPERATOR", "POTENTIAL"), &
     908              :                           description="The type of operator used for the metric.", &
     909              :                           usage="OPERATOR {string}", &
     910              :                           repeats=.FALSE., &
     911              :                           default_i_val=do_potential_id, &
     912              :                           enum_c_vals=s2a("OVERLAP", "TRUNCATED", "SHORTRANGE"), &
     913              :                           enum_desc=s2a("Overlap operator (=identity)", &
     914              :                                         "Truncated Coulomb operator: 1/r if r < R_c, 0 otherwise ", &
     915              :                                         "Short range: erfc(omega*r)/r"), &
     916              :                           enum_i_vals=(/do_potential_id, do_potential_truncated, &
     917        18492 :                                         do_potential_short/))
     918        18492 :       CALL section_add_keyword(subsubsubsection, keyword)
     919        18492 :       CALL keyword_release(keyword)
     920              : 
     921              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
     922              :                           variants=s2a("R_C", "RC", "RANGE"), &
     923              :                           description="The cutoff radius (in Angstrom) for the truncated Coulomb operator.", &
     924              :                           usage="CUTOFF_RADIUS {double}", &
     925              :                           default_r_val=0.0_dp, &
     926        18492 :                           repeats=.FALSE.)
     927        18492 :       CALL section_add_keyword(subsubsubsection, keyword)
     928        18492 :       CALL keyword_release(keyword)
     929              : 
     930              :       CALL keyword_create(keyword, __LOCATION__, name="T_C_G_DATA", &
     931              :                           description="Location of the file t_c_g.dat that contains the data for the "// &
     932              :                           "evaluation of the truncated gamma function ", &
     933              :                           usage="T_C_G_DATA {string}", &
     934        18492 :                           default_c_val="t_c_g.dat")
     935        18492 :       CALL section_add_keyword(subsubsubsection, keyword)
     936        18492 :       CALL keyword_release(keyword)
     937              : 
     938              :       CALL keyword_create(keyword, __LOCATION__, name="OMEGA", &
     939              :                           description="The range parameter for the short range operator (in 1/a0).", &
     940              :                           usage="OMEGA {double}", &
     941              :                           default_r_val=0.0_dp, &
     942        18492 :                           repeats=.FALSE.)
     943        18492 :       CALL section_add_keyword(subsubsubsection, keyword)
     944        18492 :       CALL keyword_release(keyword)
     945              : 
     946        18492 :       CALL section_add_subsection(subsubsection, subsubsubsection)
     947        18492 :       CALL section_release(subsubsubsection)
     948              : 
     949        18492 :       CALL section_add_subsection(subsection, subsubsection)
     950        18492 :       CALL section_release(subsubsection)
     951              : 
     952        18492 :       CALL section_add_subsection(section, subsection)
     953        18492 :       CALL section_release(subsection)
     954              : ! End of Kernel subsection
     955              : 
     956              :       CALL section_create(subsection, __LOCATION__, "PRINT", "Controls the printing of information during "// &
     957        18492 :                           "XAS TDP calculations", repeats=.FALSE.)
     958              : 
     959              :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="SPECTRUM", &
     960              :                                        description="Controles the dumping of the XAS TDP spectrum in output files", &
     961        18492 :                                        print_level=low_print_level, filename="", common_iter_levels=3)
     962        18492 :       CALL section_add_subsection(subsection, print_key)
     963        18492 :       CALL section_release(print_key)
     964              : 
     965              :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="RESTART_WFN", &
     966              :                                        description="Controles the dumping of a MO restart file for a given "// &
     967              :                                        "excited state index. Only for K-edge RKS calculations. "// &
     968              :                                        "Can be repeated to get multiple *.wfn files at once.", &
     969        18492 :                                        print_level=debug_print_level, filename="", common_iter_levels=1)
     970              :       CALL keyword_create(keyword, __LOCATION__, name="EXCITED_STATE_INDEX", variants=(/"INDEX"/), &
     971              :                           description="The index of the excited state that should be dumped", &
     972        36984 :                           usage="INDEX {int}", default_i_val=1, repeats=.TRUE.)
     973        18492 :       CALL section_add_keyword(print_key, keyword)
     974        18492 :       CALL keyword_release(keyword)
     975              : 
     976        18492 :       CALL section_add_subsection(subsection, print_key)
     977        18492 :       CALL section_release(print_key)
     978              : 
     979        18492 :       CALL create_pdos_section(print_key)
     980        18492 :       CALL section_add_subsection(subsection, print_key)
     981        18492 :       CALL section_release(print_key)
     982              : 
     983              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CUBES", &
     984              :                                        description="Controls the printing of the linear-response orbitals "// &
     985              :                                        "as *.cube files.", &
     986              :                                        print_level=high_print_level, common_iter_levels=1, &
     987        18492 :                                        add_last=add_last_numeric, filename="")
     988              : 
     989              :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
     990              :                           description="The stride (X,Y,Z) used to write the cube file "// &
     991              :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
     992              :                           " 1 number valid for all components.", &
     993        18492 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
     994        18492 :       CALL section_add_keyword(print_key, keyword)
     995        18492 :       CALL keyword_release(keyword)
     996              : 
     997              :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LU_BOUNDS", &
     998              :                           variants=(/"CUBES_LU"/), &
     999              :                           description="The lower and upper index of the excited states to be printed as cube", &
    1000              :                           usage="CUBES_LU_BOUNDS integer integer", &
    1001        36984 :                           n_var=2, default_i_vals=(/1, 0/), type_of_var=integer_t)
    1002        18492 :       CALL section_add_keyword(print_key, keyword)
    1003        18492 :       CALL keyword_release(keyword)
    1004              : 
    1005              :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LIST", &
    1006              :                           description="Indexes of the excited states to be printed as cube files "// &
    1007              :                           "This keyword can be repeated several times "// &
    1008              :                           "(useful if you have to specify many indexes).", &
    1009              :                           usage="CUBES_LIST 1 2", &
    1010        18492 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    1011        18492 :       CALL section_add_keyword(print_key, keyword)
    1012        18492 :       CALL keyword_release(keyword)
    1013              : 
    1014              :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1015              :                           description="append the cube files when they already exist", &
    1016        18492 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1017        18492 :       CALL section_add_keyword(print_key, keyword)
    1018        18492 :       CALL keyword_release(keyword)
    1019              : 
    1020        18492 :       CALL section_add_subsection(subsection, print_key)
    1021        18492 :       CALL section_release(print_key)
    1022              : 
    1023              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
    1024              :                                        description="Controls the dumping of LR-orbitals coefficients "// &
    1025              :                                        "and corresponding excitation energies such that "// &
    1026              :                                        "the program can be restarted for PDOS or CUBE "// &
    1027              :                                        "printing without the heavy computing.", &
    1028        18492 :                                        print_level=high_print_level, filename="", common_iter_levels=3)
    1029        18492 :       CALL section_add_subsection(subsection, print_key)
    1030        18492 :       CALL section_release(print_key)
    1031              : 
    1032        18492 :       CALL section_add_subsection(section, subsection)
    1033        18492 :       CALL section_release(subsection)
    1034              : 
    1035        18492 :    END SUBROUTINE create_xas_tdp_section
    1036              : 
    1037              : END MODULE input_cp2k_xas
        

Generated by: LCOV version 2.0-1