LCOV - code coverage report
Current view: top level - src - input_cp2k_dft.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:ccc2433) Lines: 3351 3356 99.9 %
Date: 2024-04-25 07:09:54 Functions: 67 68 98.5 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------------------------!
       2             : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3             : !   Copyright 2000-2024 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             : !>      10.2005 moved out of input_cp2k [fawzi]
      12             : !> \author fawzi
      13             : ! **************************************************************************************************
      14             : MODULE input_cp2k_dft
      15             :    USE basis_set_types, ONLY: basis_sort_default, &
      16             :                               basis_sort_zet
      17             :    USE bibliography, ONLY: &
      18             :       Andermatt2016, Andreussi2012, Avezac2005, BaniHashemian2016, Becke1988b, Bengtsson1999, &
      19             :       Blochl1995, Brehm2018, Brelaz1979, Dewar1977, Dewar1985, Dudarev1997, Dudarev1998, &
      20             :       Ehrhardt1985, Eriksen2020, Fattebert2002, Golze2017a, Golze2017b, Guidon2010, &
      21             :       Heinzmann1976, Holmberg2017, Holmberg2018, Iannuzzi2005, Iannuzzi2006, Iannuzzi2007, &
      22             :       Knizia2013, Kolafa2004, Krack2000, Krack2002, Kuhne2007, Kunert2003, Lippert1997, &
      23             :       Lippert1999, Lu2004, Merlot2014, Perdew1981, Repasky2002, Rocha2006, Schenter2008, Schiffmann2015, &
      24             :       Shigeta2001, Stewart1982, Stewart1989, Stewart2007, Thiel1992, VanVoorhis2015, &
      25             :       VandeVondele2003, VandeVondele2005a, VandeVondele2005b, VandeVondele2006, Weber2008, &
      26             :       Yin2017
      27             :    USE cp_output_handling, ONLY: add_last_numeric, &
      28             :                                  cp_print_key_section_create, &
      29             :                                  debug_print_level, &
      30             :                                  high_print_level, &
      31             :                                  low_print_level, &
      32             :                                  medium_print_level, &
      33             :                                  silent_print_level
      34             :    USE cp_spline_utils, ONLY: pw_interp, &
      35             :                               spline3_nopbc_interp, &
      36             :                               spline3_pbc_interp
      37             :    USE cp_units, ONLY: cp_unit_to_cp2k
      38             :    USE input_constants, ONLY: &
      39             :       atomic_guess, becke_cutoff_element, becke_cutoff_global, bqb_opt_exhaustive, &
      40             :       bqb_opt_normal, bqb_opt_off, bqb_opt_patient, bqb_opt_quick, broyden_type_1, &
      41             :       broyden_type_1_explicit, broyden_type_1_explicit_ls, broyden_type_1_ls, broyden_type_2, &
      42             :       broyden_type_2_explicit, broyden_type_2_explicit_ls, broyden_type_2_ls, casci_canonical, &
      43             :       cdft_alpha_constraint, cdft_beta_constraint, cdft_charge_constraint, &
      44             :       cdft_magnetization_constraint, cholesky_dbcsr, cholesky_inverse, cholesky_off, &
      45             :       cholesky_reduce, cholesky_restore, core_guess, diag_block_davidson, diag_block_krylov, &
      46             :       diag_filter_matrix, diag_ot, diag_standard, dmft_model, do_admm_aux_exch_func_bee, &
      47             :       do_admm_aux_exch_func_bee_libxc, do_admm_aux_exch_func_default, &
      48             :       do_admm_aux_exch_func_default_libxc, do_admm_aux_exch_func_none, &
      49             :       do_admm_aux_exch_func_opt, do_admm_aux_exch_func_opt_libxc, do_admm_aux_exch_func_pbex, &
      50             :       do_admm_aux_exch_func_pbex_libxc, do_admm_aux_exch_func_sx_libxc, &
      51             :       do_admm_basis_projection, do_admm_blocked_projection, do_admm_blocking_purify_full, &
      52             :       do_admm_charge_constrained_projection, do_admm_exch_scaling_merlot, &
      53             :       do_admm_exch_scaling_none, do_admm_purify_cauchy, do_admm_purify_cauchy_subspace, &
      54             :       do_admm_purify_mcweeny, do_admm_purify_mo_diag, do_admm_purify_mo_no_diag, &
      55             :       do_admm_purify_none, do_admm_purify_none_dm, do_arnoldi, do_bch, do_cn, &
      56             :       do_ddapc_constraint, do_ddapc_restraint, do_em, do_etrs, do_full_density, do_gapw_gcs, &
      57             :       do_gapw_gct, do_gapw_log, do_iaoloc_energy, do_iaoloc_enone, do_iaoloc_l1, do_iaoloc_occ, &
      58             :       do_iaoloc_pm2, do_iaoloc_pm4, do_lri_inv, do_lri_inv_auto, do_lri_opt_all, &
      59             :       do_lri_opt_coeff, do_lri_opt_exps, do_lri_pseudoinv_diag, do_lri_pseudoinv_svd, &
      60             :       do_method_am1, do_method_dftb, do_method_gapw, do_method_gapw_xc, do_method_gpw, &
      61             :       do_method_lrigpw, do_method_mndo, do_method_mndod, do_method_ofgpw, do_method_pdg, &
      62             :       do_method_pm3, do_method_pm6, do_method_pm6fm, do_method_pnnl, do_method_rigpw, &
      63             :       do_method_rm1, do_method_xtb, do_pade, do_potential_coulomb, do_potential_id, &
      64             :       do_potential_short, do_potential_truncated, do_ppl_analytic, do_ppl_grid, &
      65             :       do_pwgrid_ns_fullspace, do_pwgrid_ns_halfspace, do_pwgrid_spherical, do_s2_constraint, &
      66             :       do_s2_restraint, do_se_is_kdso, do_se_is_kdso_d, do_se_is_slater, do_se_lr_ewald, &
      67             :       do_se_lr_ewald_gks, do_se_lr_ewald_r3, do_se_lr_none, do_spin_density, do_taylor, &
      68             :       ehrenfest, embed_diff, embed_fa, embed_grid_angstrom, embed_grid_bohr, embed_level_shift, &
      69             :       embed_none, embed_quasi_newton, embed_resp, embed_steep_desc, eri_method_full_gpw, &
      70             :       eri_method_gpw_ht, eri_operator_trunc, eri_operator_coulomb, eri_operator_erf, eri_operator_erfc, &
      71             :       eri_operator_gaussian, eri_operator_yukawa, gapw_1c_large, gapw_1c_medium, gapw_1c_orb, &
      72             :       gapw_1c_small, gapw_1c_very_large, gaussian, general_roks, gto_cartesian, gto_spherical, &
      73             :       hf_model, high_spin_roks, history_guess, jacobian_fd1, jacobian_fd1_backward, &
      74             :       jacobian_fd1_central, jacobian_fd2, jacobian_fd2_backward, kg_color_dsatur, &
      75             :       kg_color_greedy, kg_tnadd_atomic, kg_tnadd_embed, kg_tnadd_embed_ri, kg_tnadd_none, &
      76             :       ls_2pnt, ls_3pnt, ls_gold, ls_none, manual_selection, mao_basis_ext, mao_basis_orb, &
      77             :       mao_basis_prim, mao_projection, mopac_guess, no_excitations, no_guess, no_solver, &
      78             :       numerical, oe_gllb, oe_lb, oe_none, oe_saop, oe_sic, orb_dx2, orb_dxy, orb_dy2, orb_dyz, &
      79             :       orb_dz2, orb_dzx, orb_px, orb_py, orb_pz, orb_s, ot_algo_irac, ot_algo_taylor_or_diag, &
      80             :       ot_chol_irac, ot_lwdn_irac, ot_mini_broyden, ot_mini_cg, ot_mini_diis, ot_mini_sd, &
      81             :       ot_poly_irac, ot_precond_full_all, ot_precond_full_kinetic, ot_precond_full_single, &
      82             :       ot_precond_full_single_inverse, ot_precond_none, ot_precond_s_inverse, &
      83             :       ot_precond_solver_default, ot_precond_solver_direct, ot_precond_solver_inv_chol, &
      84             :       ot_precond_solver_update, outer_scf_basis_center_opt, outer_scf_becke_constraint, &
      85             :       outer_scf_cdft_constraint, outer_scf_ddapc_constraint, outer_scf_hirshfeld_constraint, &
      86             :       outer_scf_none, outer_scf_optimizer_bisect, outer_scf_optimizer_broyden, &
      87             :       outer_scf_optimizer_diis, outer_scf_optimizer_newton, outer_scf_optimizer_newton_ls, &
      88             :       outer_scf_optimizer_none, outer_scf_optimizer_sd, outer_scf_optimizer_secant, &
      89             :       outer_scf_s2_constraint, plus_u_lowdin, plus_u_mulliken, plus_u_mulliken_charges, &
      90             :       qiskit_solver, radius_covalent, radius_default, radius_single, radius_user, radius_vdw, &
      91             :       random_guess, real_time_propagation, ref_charge_atomic, ref_charge_mulliken, rel_dkh, &
      92             :       rel_none, rel_pot_erfc, rel_pot_full, rel_sczora_mp, rel_trans_atom, rel_trans_full, &
      93             :       rel_trans_molecule, rel_zora, rel_zora_full, rel_zora_mp, restart_guess, rsdft_model, &
      94             :       sccs_andreussi, sccs_derivative_cd3, sccs_derivative_cd5, sccs_derivative_cd7, &
      95             :       sccs_derivative_fft, sccs_fattebert_gygi, shape_function_density, shape_function_gaussian, &
      96             :       sic_ad, sic_eo, sic_list_all, sic_list_unpaired, sic_mauri_spz, sic_mauri_us, sic_none, &
      97             :       slater, smear_energy_window, smear_fermi_dirac, smear_list, sparse_guess, tddfpt_davidson, &
      98             :       tddfpt_excitations, tddfpt_lanczos, tddfpt_singlet, tddfpt_spin_cons, tddfpt_spin_flip, &
      99             :       tddfpt_triplet, use_mom_ref_coac, use_mom_ref_com, use_mom_ref_user, use_mom_ref_zero, &
     100             :       use_restart_wfn, use_rt_restart, use_scf_wfn, wannier_projection, weight_type_mass, &
     101             :       weight_type_unit, wfi_aspc_nr, wfi_frozen_method_nr, wfi_linear_p_method_nr, &
     102             :       wfi_linear_ps_method_nr, wfi_linear_wf_method_nr, wfi_ps_method_nr, &
     103             :       wfi_use_guess_method_nr, wfi_use_prev_p_method_nr, wfi_use_prev_rho_r_method_nr, &
     104             :       wfi_use_prev_wf_method_nr, wfn_mix_orig_external, wfn_mix_orig_occ, wfn_mix_orig_virtual, &
     105             :       xas_1s_type, xas_2p_type, xas_2s_type, xas_3d_type, xas_3p_type, xas_3s_type, xas_4d_type, &
     106             :       xas_4f_type, xas_4p_type, xas_4s_type, xas_dip_len, xas_dip_vel, xas_dscf, xas_none, &
     107             :       xas_not_excited, xas_tdp_by_index, xas_tdp_by_kind, xas_tp_fh, xas_tp_flex, xas_tp_hh, &
     108             :       xas_tp_xfh, xas_tp_xhh, xes_tp_val, &
     109             :       no_admm_type, admm1_type, admm2_type, admms_type, admmp_type, admmq_type, &
     110             :       e_dens_total_hard_approx, e_dens_total_density, e_dens_soft_density
     111             :    USE input_cp2k_almo, ONLY: create_almo_scf_section
     112             :    USE input_cp2k_distribution, ONLY: create_distribution_section
     113             :    USE input_cp2k_ec, ONLY: create_ec_section
     114             :    USE input_cp2k_exstate, ONLY: create_exstate_section
     115             :    USE input_cp2k_external, ONLY: create_ext_den_section, &
     116             :                                   create_ext_pot_section, &
     117             :                                   create_ext_vxc_section
     118             :    USE input_cp2k_field, ONLY: create_efield_section, &
     119             :                                create_per_efield_section
     120             :    USE input_cp2k_kpoints, ONLY: create_kpoint_set_section, &
     121             :                                  create_kpoints_section
     122             :    USE input_cp2k_loc, ONLY: create_localize_section, &
     123             :                              print_wanniers
     124             :    USE input_cp2k_ls, ONLY: create_ls_scf_section
     125             :    USE input_cp2k_mm, ONLY: create_dipoles_section, &
     126             :                             create_neighbor_lists_section
     127             :    USE input_cp2k_poisson, ONLY: create_poisson_section
     128             :    USE input_cp2k_projection_rtp, ONLY: create_projection_rtp_section
     129             :    USE input_cp2k_rsgrid, ONLY: create_rsgrid_section
     130             :    USE input_cp2k_tb, ONLY: create_dftb_control_section, &
     131             :                             create_xtb_control_section
     132             :    USE input_cp2k_transport, ONLY: create_transport_section
     133             :    USE input_cp2k_voronoi, ONLY: create_print_voronoi_section
     134             :    USE input_cp2k_xc, ONLY: create_xc_fun_section, &
     135             :                             create_xc_section
     136             :    USE input_keyword_types, ONLY: keyword_create, &
     137             :                                   keyword_release, &
     138             :                                   keyword_type
     139             :    USE input_section_types, ONLY: section_add_keyword, &
     140             :                                   section_add_subsection, &
     141             :                                   section_create, &
     142             :                                   section_release, &
     143             :                                   section_type
     144             :    USE input_val_types, ONLY: char_t, &
     145             :                               integer_t, &
     146             :                               lchar_t, &
     147             :                               logical_t, &
     148             :                               real_t
     149             :    USE kinds, ONLY: dp
     150             :    USE pw_grids, ONLY: do_pw_grid_blocked_false, &
     151             :                        do_pw_grid_blocked_free, &
     152             :                        do_pw_grid_blocked_true
     153             :    USE pw_spline_utils, ONLY: no_precond, &
     154             :                               precond_spl3_1, &
     155             :                               precond_spl3_2, &
     156             :                               precond_spl3_3, &
     157             :                               precond_spl3_aint, &
     158             :                               precond_spl3_aint2
     159             :    USE qs_density_mixing_types, ONLY: create_mixing_section
     160             :    USE qs_fb_input, ONLY: create_filtermatrix_section
     161             :    USE qs_mom_types, ONLY: create_mom_section
     162             :    USE string_utilities, ONLY: newline, &
     163             :                                s2a
     164             : #include "./base/base_uses.f90"
     165             : 
     166             :    IMPLICIT NONE
     167             :    PRIVATE
     168             : 
     169             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_dft'
     170             : 
     171             :    PUBLIC :: create_dft_section
     172             :    PUBLIC :: create_bsse_section, create_qs_section
     173             :    PUBLIC :: create_scf_section
     174             :    PUBLIC :: create_interp_section
     175             :    PUBLIC :: create_ddapc_restraint_section
     176             :    PUBLIC :: create_mgrid_section
     177             :    PUBLIC :: create_lrigpw_section
     178             : 
     179             : CONTAINS
     180             : 
     181             : ! **************************************************************************************************
     182             : !> \brief creates the dft section
     183             : !> \param section the section to be created
     184             : !> \author fawzi
     185             : ! **************************************************************************************************
     186        8408 :    SUBROUTINE create_dft_section(section)
     187             :       TYPE(section_type), POINTER                        :: section
     188             : 
     189             :       TYPE(keyword_type), POINTER                        :: keyword
     190             :       TYPE(section_type), POINTER                        :: subsection
     191             : 
     192        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
     193             :       CALL section_create(section, __LOCATION__, name="DFT", &
     194             :                           description="Parameter needed by LCAO DFT programs", &
     195        8408 :                           n_keywords=3, n_subsections=4, repeats=.FALSE.)
     196             : 
     197        8408 :       NULLIFY (keyword)
     198             :       CALL keyword_create(keyword, __LOCATION__, name="BASIS_SET_FILE_NAME", &
     199             :                           description="Name of the basis set file, may include a path", &
     200             :                           usage="BASIS_SET_FILE_NAME <FILENAME>", &
     201             :                           type_of_var=lchar_t, repeats=.TRUE., &
     202        8408 :                           default_lc_val="BASIS_SET", n_var=1)
     203        8408 :       CALL section_add_keyword(section, keyword)
     204        8408 :       CALL keyword_release(keyword)
     205             : 
     206             :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_FILE_NAME", &
     207             :                           description="Name of the pseudo potential file, may include a path", &
     208             :                           usage="POTENTIAL_FILE_NAME <FILENAME>", &
     209        8408 :                           default_lc_val="POTENTIAL")
     210        8408 :       CALL section_add_keyword(section, keyword)
     211        8408 :       CALL keyword_release(keyword)
     212             : 
     213             :       CALL keyword_create(keyword, __LOCATION__, name="WFN_RESTART_FILE_NAME", &
     214             :                           variants=(/"RESTART_FILE_NAME"/), &
     215             :                           description="Name of the wavefunction restart file, may include a path."// &
     216             :                           " If no file is specified, the default is to open the file as generated by the wfn restart print key.", &
     217             :                           usage="WFN_RESTART_FILE_NAME <FILENAME>", &
     218       16816 :                           type_of_var=lchar_t)
     219        8408 :       CALL section_add_keyword(section, keyword)
     220        8408 :       CALL keyword_release(keyword)
     221             : 
     222             :       CALL keyword_create(keyword, __LOCATION__, &
     223             :                           name="UKS", &
     224             :                           variants=s2a("UNRESTRICTED_KOHN_SHAM", &
     225             :                                        "LSD", &
     226             :                                        "SPIN_POLARIZED"), &
     227             :                           description="Requests a spin-polarized calculation using alpha "// &
     228             :                           "and beta orbitals, i.e. no spin restriction is applied", &
     229             :                           usage="LSD", &
     230             :                           default_l_val=.FALSE., &
     231        8408 :                           lone_keyword_l_val=.TRUE.)
     232        8408 :       CALL section_add_keyword(section, keyword)
     233        8408 :       CALL keyword_release(keyword)
     234             :       CALL keyword_create(keyword, __LOCATION__, &
     235             :                           name="ROKS", &
     236             :                           variants=(/"RESTRICTED_OPEN_KOHN_SHAM"/), &
     237             :                           description="Requests a restricted open Kohn-Sham calculation", &
     238             :                           usage="ROKS", &
     239             :                           default_l_val=.FALSE., &
     240       16816 :                           lone_keyword_l_val=.TRUE.)
     241        8408 :       CALL section_add_keyword(section, keyword)
     242        8408 :       CALL keyword_release(keyword)
     243             :       CALL keyword_create(keyword, __LOCATION__, &
     244             :                           name="MULTIPLICITY", &
     245             :                           variants=(/"MULTIP"/), &
     246             :                           description="Two times the total spin plus one. "// &
     247             :                           "Specify 3 for a triplet, 4 for a quartet, "// &
     248             :                           "and so on. Default is 1 (singlet) for an "// &
     249             :                           "even number and 2 (doublet) for an odd number "// &
     250             :                           "of electrons.", &
     251             :                           usage="MULTIPLICITY 3", &
     252       16816 :                           default_i_val=0) ! this default value is just a flag to get the above
     253        8408 :       CALL section_add_keyword(section, keyword)
     254        8408 :       CALL keyword_release(keyword)
     255             :       CALL keyword_create(keyword, __LOCATION__, name="CHARGE", &
     256             :                           description="The total charge of the system", &
     257             :                           usage="CHARGE -1", &
     258        8408 :                           default_i_val=0)
     259        8408 :       CALL section_add_keyword(section, keyword)
     260        8408 :       CALL keyword_release(keyword)
     261             :       CALL keyword_create(keyword, __LOCATION__, name="EXCITATIONS", &
     262             :                           description="If excitations should be calculated", &
     263             :                           usage="EXCITATIONS", &
     264             :                           enum_c_vals=s2a("NONE", "TDLR", "TDDFPT"), &
     265             :                           enum_i_vals=(/no_excitations, tddfpt_excitations, &
     266             :                                         tddfpt_excitations/), &
     267        8408 :                           default_i_val=no_excitations)
     268        8408 :       CALL section_add_keyword(section, keyword)
     269        8408 :       CALL keyword_release(keyword)
     270             : 
     271             :       CALL keyword_create(keyword, __LOCATION__, &
     272             :                           name="PLUS_U_METHOD", &
     273             :                           description="Method employed for the calculation of the DFT+U contribution", &
     274             :                           repeats=.FALSE., &
     275             :                           enum_c_vals=s2a("LOWDIN", "MULLIKEN", "MULLIKEN_CHARGES"), &
     276             :                           enum_i_vals=(/plus_u_lowdin, plus_u_mulliken, plus_u_mulliken_charges/), &
     277             :                           enum_desc=s2a("Method based on Lowdin population analysis "// &
     278             :                                         "(computationally expensive, since the diagonalization of the "// &
     279             :                                         "overlap matrix is required, but possibly more robust than Mulliken)", &
     280             :                                         "Method based on Mulliken population analysis using the net AO and "// &
     281             :                                         "overlap populations (computationally cheap method)", &
     282             :                                         "Method based on Mulliken gross orbital populations (GOP)"), &
     283             :                           n_var=1, &
     284             :                           default_i_val=plus_u_mulliken, &
     285        8408 :                           usage="METHOD Lowdin")
     286        8408 :       CALL section_add_keyword(section, keyword)
     287        8408 :       CALL keyword_release(keyword)
     288             : 
     289             :       CALL keyword_create(keyword, __LOCATION__, &
     290             :                           name="RELAX_MULTIPLICITY", &
     291             :                           variants=(/"RELAX_MULTIP"/), &
     292             :                           description="Tolerance in Hartrees. Do not enforce the occupation "// &
     293             :                           "of alpha and beta MOs due to the initially "// &
     294             :                           "defined multiplicity, but rather follow the Aufbau principle. "// &
     295             :                           "A value greater than zero activates this option. "// &
     296             :                           "Larger tolerance values increase the probability for a spin flip. "// &
     297             :                           "This option is only valid for unrestricted (i.e. spin polarised) "// &
     298             :                           "Kohn-Sham (UKS) calculations.", &
     299             :                           usage="RELAX_MULTIPLICITY 0.00001", &
     300             :                           repeats=.FALSE., &
     301       16816 :                           default_r_val=0.0_dp)
     302        8408 :       CALL section_add_keyword(section, keyword)
     303        8408 :       CALL keyword_release(keyword)
     304             : 
     305             :       CALL keyword_create(keyword, __LOCATION__, name="SUBCELLS", &
     306             :                           description="Read the grid size for subcell generation in the construction of "// &
     307             :                           "neighbor lists.", usage="SUBCELLS 1.5", &
     308        8408 :                           n_var=1, default_r_val=2.0_dp)
     309        8408 :       CALL section_add_keyword(section, keyword)
     310        8408 :       CALL keyword_release(keyword)
     311             : 
     312             :       CALL keyword_create(keyword, __LOCATION__, name="AUTO_BASIS", &
     313             :                           description="Specify size of automatically generated auxiliary (RI) basis sets: "// &
     314             :                           "Options={small,medium,large,huge}", &
     315             :                           usage="AUTO_BASIS {basis_type} {basis_size}", &
     316       25224 :                           type_of_var=char_t, repeats=.TRUE., n_var=-1, default_c_vals=(/"X", "X"/))
     317        8408 :       CALL section_add_keyword(section, keyword)
     318        8408 :       CALL keyword_release(keyword)
     319             : 
     320             :       CALL keyword_create(keyword, __LOCATION__, &
     321             :                           name="SURFACE_DIPOLE_CORRECTION", &
     322             :                           variants=s2a("SURFACE_DIPOLE", &
     323             :                                        "SURF_DIP"), &
     324             :                           description="For slab calculations with asymmetric geometries, activate the correction of "// &
     325             :                           "the electrostatic potential with "// &
     326             :                           "by compensating for the surface dipole. Implemented only for slabs with normal "// &
     327             :                           "parallel to one Cartesian axis. The normal direction is given by the keyword SURF_DIP_DIR", &
     328             :                           usage="SURF_DIP", &
     329             :                           default_l_val=.FALSE., &
     330             :                           lone_keyword_l_val=.TRUE., &
     331       16816 :                           citations=(/Bengtsson1999/))
     332        8408 :       CALL section_add_keyword(section, keyword)
     333        8408 :       CALL keyword_release(keyword)
     334             : 
     335             :       CALL keyword_create(keyword, __LOCATION__, &
     336             :                           name="SURF_DIP_DIR", &
     337             :                           description="Cartesian axis parallel to surface normal.", &
     338             :                           enum_c_vals=s2a("X", "Y", "Z"), &
     339             :                           enum_i_vals=(/1, 2, 3/), &
     340             :                           enum_desc=s2a("Along x", "Along y", "Along z"), &
     341             :                           n_var=1, &
     342             :                           default_i_val=3, &
     343        8408 :                           usage="SURF_DIP_DIR Z")
     344        8408 :       CALL section_add_keyword(section, keyword)
     345        8408 :       CALL keyword_release(keyword)
     346             : 
     347             :       CALL keyword_create(keyword, __LOCATION__, &
     348             :                           name="SURF_DIP_POS", &
     349             :                           description="This keyword assigns an user defined position in Angstroms "// &
     350             :                           "in the direction normal to the surface (given by SURF_DIP_DIR). "// &
     351             :                           "The default value is -1.0_dp which appplies the correction at a position "// &
     352             :                           "that has minimum electron density on the grid.", &
     353             :                           usage="SURF_DIP_POS -1.0_dp", &
     354        8408 :                           default_r_val=-1.0_dp)
     355        8408 :       CALL section_add_keyword(section, keyword)
     356        8408 :       CALL keyword_release(keyword)
     357             : 
     358             :       CALL keyword_create(keyword, __LOCATION__, &
     359             :                           name="SURF_DIP_SWITCH", &
     360             :                           description="WARNING: Experimental feature under development that will help the "// &
     361             :                           "user to switch parameters to facilitate  SCF convergence. In its current form the "// &
     362             :                           "surface dipole correction is switched off if the calculation does not converge in "// &
     363             :                           "(0.5*MAX_SCF + 1) outer_scf steps. "// &
     364             :                           "The default value is .FALSE.", &
     365             :                           usage="SURF_DIP_SWITCH .TRUE.", &
     366             :                           default_l_val=.FALSE., &
     367        8408 :                           lone_keyword_l_val=.TRUE.)
     368        8408 :       CALL section_add_keyword(section, keyword)
     369        8408 :       CALL keyword_release(keyword)
     370             : 
     371             :       CALL keyword_create(keyword, __LOCATION__, &
     372             :                           name="CORE_CORR_DIP", &
     373             :                           description="If the total CORE_CORRECTION is non-zero and surface dipole "// &
     374             :                           "correction is switched on, presence of this keyword will adjust electron "// &
     375             :                           "density via MO occupation to reflect the total CORE_CORRECTION. "// &
     376             :                           "The default value is .FALSE.", &
     377             :                           usage="CORE_CORR_DIP .TRUE.", &
     378             :                           default_l_val=.FALSE., &
     379        8408 :                           lone_keyword_l_val=.TRUE.)
     380        8408 :       CALL section_add_keyword(section, keyword)
     381        8408 :       CALL keyword_release(keyword)
     382             : 
     383             :       CALL keyword_create(keyword, __LOCATION__, &
     384             :                           name="SORT_BASIS", &
     385             :                           description="Sort basis sets according to a certain criterion. ", &
     386             :                           enum_c_vals=s2a("DEFAULT", "EXP"), &
     387             :                           enum_i_vals=(/basis_sort_default, basis_sort_zet/), &
     388             :                           enum_desc=s2a("don't sort", "sort w.r.t. exponent"), &
     389             :                           default_i_val=basis_sort_default, &
     390        8408 :                           usage="SORT_BASIS EXP")
     391        8408 :       CALL section_add_keyword(section, keyword)
     392        8408 :       CALL keyword_release(keyword)
     393             : 
     394        8408 :       NULLIFY (subsection)
     395        8408 :       CALL create_scf_section(subsection)
     396        8408 :       CALL section_add_subsection(section, subsection)
     397        8408 :       CALL section_release(subsection)
     398             : 
     399        8408 :       CALL create_ls_scf_section(subsection)
     400        8408 :       CALL section_add_subsection(section, subsection)
     401        8408 :       CALL section_release(subsection)
     402             : 
     403        8408 :       CALL create_almo_scf_section(subsection)
     404        8408 :       CALL section_add_subsection(section, subsection)
     405        8408 :       CALL section_release(subsection)
     406             : 
     407        8408 :       CALL create_kg_section(subsection)
     408        8408 :       CALL section_add_subsection(section, subsection)
     409        8408 :       CALL section_release(subsection)
     410             : 
     411        8408 :       CALL create_ec_section(subsection)
     412        8408 :       CALL section_add_subsection(section, subsection)
     413        8408 :       CALL section_release(subsection)
     414             : 
     415        8408 :       CALL create_exstate_section(subsection)
     416        8408 :       CALL section_add_subsection(section, subsection)
     417        8408 :       CALL section_release(subsection)
     418             : 
     419        8408 :       CALL create_admm_section(subsection)
     420        8408 :       CALL section_add_subsection(section, subsection)
     421        8408 :       CALL section_release(subsection)
     422             : 
     423        8408 :       CALL create_qs_section(subsection)
     424        8408 :       CALL section_add_subsection(section, subsection)
     425        8408 :       CALL section_release(subsection)
     426             : 
     427        8408 :       CALL create_tddfpt_section(subsection)
     428        8408 :       CALL section_add_subsection(section, subsection)
     429        8408 :       CALL section_release(subsection)
     430             : 
     431        8408 :       CALL create_mgrid_section(subsection, create_subsections=.TRUE.)
     432        8408 :       CALL section_add_subsection(section, subsection)
     433        8408 :       CALL section_release(subsection)
     434             : 
     435        8408 :       CALL create_xc_section(subsection)
     436        8408 :       CALL section_add_subsection(section, subsection)
     437        8408 :       CALL section_release(subsection)
     438             : 
     439        8408 :       CALL create_relativistic_section(subsection)
     440        8408 :       CALL section_add_subsection(section, subsection)
     441        8408 :       CALL section_release(subsection)
     442             : 
     443        8408 :       CALL create_sic_section(subsection)
     444        8408 :       CALL section_add_subsection(section, subsection)
     445        8408 :       CALL section_release(subsection)
     446             : 
     447        8408 :       CALL create_low_spin_roks_section(subsection)
     448        8408 :       CALL section_add_subsection(section, subsection)
     449        8408 :       CALL section_release(subsection)
     450             : 
     451        8408 :       CALL create_efield_section(subsection)
     452        8408 :       CALL section_add_subsection(section, subsection)
     453        8408 :       CALL section_release(subsection)
     454             : 
     455        8408 :       CALL create_per_efield_section(subsection)
     456        8408 :       CALL section_add_subsection(section, subsection)
     457        8408 :       CALL section_release(subsection)
     458             : 
     459        8408 :       CALL create_ext_pot_section(subsection)
     460        8408 :       CALL section_add_subsection(section, subsection)
     461        8408 :       CALL section_release(subsection)
     462             : 
     463        8408 :       CALL create_transport_section(subsection)
     464        8408 :       CALL section_add_subsection(section, subsection)
     465        8408 :       CALL section_release(subsection)
     466             : 
     467             :       ! ZMP sections to include the external density or v_xc potential
     468        8408 :       CALL create_ext_den_section(subsection)
     469        8408 :       CALL section_add_subsection(section, subsection)
     470        8408 :       CALL section_release(subsection)
     471             : 
     472        8408 :       CALL create_ext_vxc_section(subsection)
     473        8408 :       CALL section_add_subsection(section, subsection)
     474        8408 :       CALL section_release(subsection)
     475             : 
     476        8408 :       CALL create_poisson_section(subsection)
     477        8408 :       CALL section_add_subsection(section, subsection)
     478        8408 :       CALL section_release(subsection)
     479             : 
     480        8408 :       CALL create_kpoints_section(subsection)
     481        8408 :       CALL section_add_subsection(section, subsection)
     482        8408 :       CALL section_release(subsection)
     483             : 
     484        8408 :       CALL create_implicit_solv_section(subsection)
     485        8408 :       CALL section_add_subsection(section, subsection)
     486        8408 :       CALL section_release(subsection)
     487             : 
     488        8408 :       CALL create_density_fitting_section(subsection)
     489        8408 :       CALL section_add_subsection(section, subsection)
     490        8408 :       CALL section_release(subsection)
     491             : 
     492        8408 :       CALL create_xas_section(subsection)
     493        8408 :       CALL section_add_subsection(section, subsection)
     494        8408 :       CALL section_release(subsection)
     495             : 
     496        8408 :       CALL create_xas_tdp_section(subsection)
     497        8408 :       CALL section_add_subsection(section, subsection)
     498        8408 :       CALL section_release(subsection)
     499             : 
     500        8408 :       CALL create_localize_section(subsection)
     501        8408 :       CALL section_add_subsection(section, subsection)
     502        8408 :       CALL section_release(subsection)
     503             : 
     504        8408 :       CALL create_rtp_section(subsection)
     505        8408 :       CALL section_add_subsection(section, subsection)
     506        8408 :       CALL section_release(subsection)
     507             : 
     508        8408 :       CALL create_print_dft_section(subsection)
     509        8408 :       CALL section_add_subsection(section, subsection)
     510        8408 :       CALL section_release(subsection)
     511             : 
     512        8408 :       CALL create_sccs_section(subsection)
     513        8408 :       CALL section_add_subsection(section, subsection)
     514        8408 :       CALL section_release(subsection)
     515             : 
     516        8408 :       CALL create_active_space_section(subsection)
     517        8408 :       CALL section_add_subsection(section, subsection)
     518        8408 :       CALL section_release(subsection)
     519             : 
     520        8408 :    END SUBROUTINE create_dft_section
     521             : 
     522             : ! **************************************************************************************************
     523             : !> \brief Implicit Solvation Model
     524             : !> \param section ...
     525             : !> \author tlaino
     526             : ! **************************************************************************************************
     527        8408 :    SUBROUTINE create_implicit_solv_section(section)
     528             :       TYPE(section_type), POINTER                        :: section
     529             : 
     530             :       TYPE(keyword_type), POINTER                        :: keyword
     531             :       TYPE(section_type), POINTER                        :: print_key, subsection
     532             : 
     533        8408 :       NULLIFY (keyword, subsection, print_key)
     534        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
     535             :       CALL section_create(section, __LOCATION__, name="SCRF", &
     536             :                           description="Adds an implicit solvation model to the DFT calculation."// &
     537             :                           " Know also as Self Consistent Reaction Field.", &
     538        8408 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     539             : 
     540             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_OUT", &
     541             :                           description="Value of the dielectric constant outside the sphere", &
     542             :                           usage="EPS_OUT <REAL>", &
     543        8408 :                           default_r_val=1.0_dp)
     544        8408 :       CALL section_add_keyword(section, keyword)
     545        8408 :       CALL keyword_release(keyword)
     546             : 
     547             :       CALL keyword_create(keyword, __LOCATION__, name="LMAX", &
     548             :                           description="Maximum value of L used in the multipole expansion", &
     549             :                           usage="LMAX <INTEGER>", &
     550        8408 :                           default_i_val=3)
     551        8408 :       CALL section_add_keyword(section, keyword)
     552        8408 :       CALL keyword_release(keyword)
     553             : 
     554        8408 :       CALL create_sphere_section(subsection)
     555        8408 :       CALL section_add_subsection(section, subsection)
     556        8408 :       CALL section_release(subsection)
     557             : 
     558             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
     559             :                                        description="Controls the printing basic info about the method", &
     560        8408 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     561        8408 :       CALL section_add_subsection(section, print_key)
     562        8408 :       CALL section_release(print_key)
     563             : 
     564        8408 :    END SUBROUTINE create_implicit_solv_section
     565             : 
     566             : ! **************************************************************************************************
     567             : !> \brief Create Sphere cavity
     568             : !> \param section ...
     569             : !> \author tlaino
     570             : ! **************************************************************************************************
     571        8408 :    SUBROUTINE create_sphere_section(section)
     572             :       TYPE(section_type), POINTER                        :: section
     573             : 
     574             :       TYPE(keyword_type), POINTER                        :: keyword
     575             :       TYPE(section_type), POINTER                        :: subsection
     576             : 
     577        8408 :       NULLIFY (keyword, subsection)
     578        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
     579             :       CALL section_create(section, __LOCATION__, name="SPHERE", &
     580             :                           description="Treats the implicit solvent environment like a sphere", &
     581        8408 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     582             : 
     583             :       CALL keyword_create(keyword, __LOCATION__, name="RADIUS", &
     584             :                           description="Value of the spherical cavity in the dielectric medium", &
     585             :                           usage="RADIUS <REAL>", &
     586             :                           unit_str="angstrom", &
     587        8408 :                           type_of_var=real_t)
     588        8408 :       CALL section_add_keyword(section, keyword)
     589        8408 :       CALL keyword_release(keyword)
     590             : 
     591        8408 :       CALL create_center_section(subsection)
     592        8408 :       CALL section_add_subsection(section, subsection)
     593        8408 :       CALL section_release(subsection)
     594             : 
     595        8408 :    END SUBROUTINE create_sphere_section
     596             : 
     597             : ! **************************************************************************************************
     598             : !> \brief ...
     599             : !> \param section ...
     600             : !> \author tlaino
     601             : ! **************************************************************************************************
     602        8408 :    SUBROUTINE create_center_section(section)
     603             :       TYPE(section_type), POINTER                        :: section
     604             : 
     605             :       TYPE(keyword_type), POINTER                        :: keyword
     606             : 
     607        8408 :       NULLIFY (keyword)
     608        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
     609             :       CALL section_create(section, __LOCATION__, name="CENTER", &
     610             :                           description="Defines the center of the sphere.", &
     611        8408 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     612             :       CALL keyword_create(keyword, __LOCATION__, name="XYZ", &
     613             :                           description="Coordinates of the center of the sphere", &
     614             :                           usage="XYZ <REAL> <REAL> <REAL>", &
     615             :                           unit_str="angstrom", &
     616        8408 :                           type_of_var=real_t, n_var=3)
     617        8408 :       CALL section_add_keyword(section, keyword)
     618        8408 :       CALL keyword_release(keyword)
     619             : 
     620             :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_LIST", &
     621             :                           description="Defines a list of atoms to define the center of the sphere", &
     622             :                           usage="ATOM_LIST <INTEGER> .. <INTEGER>", &
     623        8408 :                           type_of_var=integer_t, n_var=-1)
     624        8408 :       CALL section_add_keyword(section, keyword)
     625        8408 :       CALL keyword_release(keyword)
     626             : 
     627             :       CALL keyword_create(keyword, __LOCATION__, name="WEIGHT_TYPE", &
     628             :                           description="Defines the weight used to define the center of the sphere"// &
     629             :                           " (if ATOM_LIST is provided)", &
     630             :                           usage="WEIGHT (UNIT|MASS)", &
     631             :                           enum_c_vals=(/"UNIT", "MASS"/), &
     632             :                           enum_i_vals=(/weight_type_unit, weight_type_mass/), &
     633       25224 :                           default_i_val=weight_type_unit)
     634        8408 :       CALL section_add_keyword(section, keyword)
     635        8408 :       CALL keyword_release(keyword)
     636             : 
     637             :       CALL keyword_create(keyword, __LOCATION__, name="FIXED", &
     638             :                           description="Specify if the center of the sphere should be fixed or"// &
     639             :                           " allowed to move", &
     640             :                           usage="FIXED <LOGICAL>", &
     641        8408 :                           default_l_val=.TRUE.)
     642        8408 :       CALL section_add_keyword(section, keyword)
     643        8408 :       CALL keyword_release(keyword)
     644        8408 :    END SUBROUTINE create_center_section
     645             : 
     646             : ! **************************************************************************************************
     647             : !> \brief Create the print dft section
     648             : !> \param section the section to create
     649             : !> \author teo
     650             : ! **************************************************************************************************
     651        8408 :    SUBROUTINE create_print_dft_section(section)
     652             :       TYPE(section_type), POINTER                        :: section
     653             : 
     654             :       TYPE(keyword_type), POINTER                        :: keyword
     655             :       TYPE(section_type), POINTER                        :: print_key, sub_print_key, subsection
     656             : 
     657        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
     658             :       CALL section_create(section, __LOCATION__, name="PRINT", &
     659             :                           description="Section of possible print options in DFT code.", &
     660        8408 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
     661             : 
     662        8408 :       NULLIFY (print_key, keyword, subsection)
     663             : 
     664             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_BANNER", &
     665             :                                        description="Controls the printing of the banner of the MM program", &
     666        8408 :                                        print_level=silent_print_level, filename="__STD_OUT__")
     667        8408 :       CALL section_add_subsection(section, print_key)
     668        8408 :       CALL section_release(print_key)
     669             : 
     670             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "BASIS_SET_FILE", &
     671             :                                        description="Controls the printing of a file with all basis sets used.", &
     672        8408 :                                        print_level=high_print_level, filename="LOCAL_BASIS_SETS")
     673        8408 :       CALL section_add_subsection(section, print_key)
     674        8408 :       CALL section_release(print_key)
     675             : 
     676             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "KINETIC_ENERGY", &
     677             :                                        description="Controls the printing of the kinetic energy", &
     678        8408 :                                        print_level=high_print_level, filename="__STD_OUT__")
     679        8408 :       CALL section_add_subsection(section, print_key)
     680        8408 :       CALL section_release(print_key)
     681             : 
     682             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "DERIVATIVES", &
     683             :                                        description="Print all derivatives after the DFT calculation", &
     684        8408 :                                        print_level=high_print_level, filename="__STD_OUT__")
     685             :       CALL keyword_create(keyword, __LOCATION__, &
     686             :                           name="ndigits", &
     687             :                           description="Specify the number of digits used to print derivatives", &
     688        8408 :                           default_i_val=6)
     689        8408 :       CALL section_add_keyword(print_key, keyword)
     690        8408 :       CALL keyword_release(keyword)
     691             : 
     692        8408 :       CALL section_add_subsection(section, print_key)
     693        8408 :       CALL section_release(print_key)
     694             : 
     695             :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="neighbor_lists", &
     696             :                                        description="Controls the printing of the neighbor lists", &
     697        8408 :                                        print_level=debug_print_level, filename="", unit_str="angstrom")
     698             :       CALL keyword_create(keyword, __LOCATION__, &
     699             :                           name="sab_orb", &
     700             :                           description="Activates the printing of the orbital "// &
     701             :                           "orbital neighbor lists, "// &
     702             :                           "i.e. the overlap neighbor lists", &
     703             :                           default_l_val=.FALSE., &
     704        8408 :                           lone_keyword_l_val=.TRUE.)
     705        8408 :       CALL section_add_keyword(print_key, keyword)
     706        8408 :       CALL keyword_release(keyword)
     707             : 
     708             :       CALL keyword_create(keyword, __LOCATION__, &
     709             :                           name="sab_aux_fit", &
     710             :                           description="Activates the printing of the orbital "// &
     711             :                           "orbital neighbor lists wavefunction fitting basis, "// &
     712             :                           "i.e. the overlap neighbor lists", &
     713             :                           default_l_val=.FALSE., &
     714        8408 :                           lone_keyword_l_val=.TRUE.)
     715        8408 :       CALL section_add_keyword(print_key, keyword)
     716        8408 :       CALL keyword_release(keyword)
     717             : 
     718             :       CALL keyword_create(keyword, __LOCATION__, &
     719             :                           name="sab_aux_fit_vs_orb", &
     720             :                           description="Activates the printing of the orbital "// &
     721             :                           "orbital mixed neighbor lists of wavefunction fitting basis, "// &
     722             :                           "and the orbital basis, i.e. the overlap neighbor lists", &
     723             :                           default_l_val=.FALSE., &
     724        8408 :                           lone_keyword_l_val=.TRUE.)
     725        8408 :       CALL section_add_keyword(print_key, keyword)
     726        8408 :       CALL keyword_release(keyword)
     727             : 
     728             :       CALL keyword_create(keyword, __LOCATION__, &
     729             :                           name="sab_scp", &
     730             :                           description="Activates the printing of the vdW SCP "// &
     731             :                           "neighbor lists ", &
     732             :                           default_l_val=.FALSE., &
     733        8408 :                           lone_keyword_l_val=.TRUE.)
     734        8408 :       CALL section_add_keyword(print_key, keyword)
     735        8408 :       CALL keyword_release(keyword)
     736             : 
     737             :       CALL keyword_create(keyword, __LOCATION__, &
     738             :                           name="sab_vdw", &
     739             :                           description="Activates the printing of the vdW "// &
     740             :                           "neighbor lists (from DFT, DFTB, SE), "// &
     741             :                           "i.e. the dispersion neighbor lists", &
     742             :                           default_l_val=.FALSE., &
     743        8408 :                           lone_keyword_l_val=.TRUE.)
     744        8408 :       CALL section_add_keyword(print_key, keyword)
     745        8408 :       CALL keyword_release(keyword)
     746             : 
     747             :       CALL keyword_create(keyword, __LOCATION__, &
     748             :                           name="sab_cn", &
     749             :                           description="Activates the printing of the "// &
     750             :                           "neighbor lists used for coordination numbers in vdW DFT-D3", &
     751             :                           default_l_val=.FALSE., &
     752        8408 :                           lone_keyword_l_val=.TRUE.)
     753        8408 :       CALL section_add_keyword(print_key, keyword)
     754        8408 :       CALL keyword_release(keyword)
     755             : 
     756             :       CALL keyword_create(keyword, __LOCATION__, &
     757             :                           name="sac_ae", &
     758             :                           description="Activates the printing of the orbital "// &
     759             :                           "nuclear attraction neighbor lists (erfc potential)", &
     760             :                           default_l_val=.FALSE., &
     761        8408 :                           lone_keyword_l_val=.TRUE.)
     762        8408 :       CALL section_add_keyword(print_key, keyword)
     763        8408 :       CALL keyword_release(keyword)
     764             : 
     765             :       CALL keyword_create(keyword, __LOCATION__, &
     766             :                           name="sac_ppl", &
     767             :                           description="Activates the printing of the orbital "// &
     768             :                           "GTH-PPL neighbor lists (local part of the "// &
     769             :                           "Goedecker-Teter-Hutter pseudo potentials)", &
     770             :                           default_l_val=.FALSE., &
     771        8408 :                           lone_keyword_l_val=.TRUE.)
     772        8408 :       CALL section_add_keyword(print_key, keyword)
     773        8408 :       CALL keyword_release(keyword)
     774             : 
     775             :       CALL keyword_create(keyword, __LOCATION__, &
     776             :                           name="sap_ppnl", &
     777             :                           description="Activates the printing of the orbital "// &
     778             :                           "GTH-PPNL neighbor lists (non-local part of the "// &
     779             :                           "Goedecker-Teter-Hutter pseudo potentials)", &
     780             :                           default_l_val=.FALSE., &
     781        8408 :                           lone_keyword_l_val=.TRUE.)
     782        8408 :       CALL section_add_keyword(print_key, keyword)
     783        8408 :       CALL keyword_release(keyword)
     784             : 
     785             :       CALL keyword_create(keyword, __LOCATION__, &
     786             :                           name="sap_oce", &
     787             :                           description="Activates the printing of the orbital "// &
     788             :                           "PAW-projector neighbor lists (only GAPW)", &
     789             :                           default_l_val=.FALSE., &
     790        8408 :                           lone_keyword_l_val=.TRUE.)
     791        8408 :       CALL section_add_keyword(print_key, keyword)
     792        8408 :       CALL keyword_release(keyword)
     793             : 
     794             :       CALL keyword_create(keyword, __LOCATION__, &
     795             :                           name="sab_se", &
     796             :                           description="Activates the printing of the two-center "// &
     797             :                           "neighbor lists for Coulomb type interactions in NDDO ", &
     798             :                           default_l_val=.FALSE., &
     799        8408 :                           lone_keyword_l_val=.TRUE.)
     800        8408 :       CALL section_add_keyword(print_key, keyword)
     801        8408 :       CALL keyword_release(keyword)
     802             : 
     803             :       CALL keyword_create(keyword, __LOCATION__, &
     804             :                           name="sab_lrc", &
     805             :                           description="Activates the printing of the long-range SE correction "// &
     806             :                           "neighbor lists (only when doing long-range SE with integral scheme KDSO and KDSO-d)", &
     807        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     808        8408 :       CALL section_add_keyword(print_key, keyword)
     809        8408 :       CALL keyword_release(keyword)
     810             : 
     811             :       CALL keyword_create(keyword, __LOCATION__, &
     812             :                           name="sab_tbe", &
     813             :                           description="Activates the printing of the DFTB Ewald "// &
     814             :                           "neighbor lists ", &
     815             :                           default_l_val=.FALSE., &
     816        8408 :                           lone_keyword_l_val=.TRUE.)
     817        8408 :       CALL section_add_keyword(print_key, keyword)
     818        8408 :       CALL keyword_release(keyword)
     819             : 
     820             :       CALL keyword_create(keyword, __LOCATION__, &
     821             :                           name="sab_xtbe", &
     822             :                           description="Activates the printing of the xTB sr-Coulomb "// &
     823             :                           "neighbor lists ", &
     824             :                           default_l_val=.FALSE., &
     825        8408 :                           lone_keyword_l_val=.TRUE.)
     826        8408 :       CALL section_add_keyword(print_key, keyword)
     827        8408 :       CALL keyword_release(keyword)
     828             : 
     829             :       CALL keyword_create(keyword, __LOCATION__, &
     830             :                           name="sab_core", &
     831             :                           description="Activates the printing of core interaction "// &
     832             :                           "neighbor lists ", &
     833             :                           default_l_val=.FALSE., &
     834        8408 :                           lone_keyword_l_val=.TRUE.)
     835        8408 :       CALL section_add_keyword(print_key, keyword)
     836        8408 :       CALL keyword_release(keyword)
     837             : 
     838             :       CALL keyword_create(keyword, __LOCATION__, &
     839             :                           name="sab_xb", &
     840             :                           description="Activates the printing of XB interaction from (xTB) "// &
     841             :                           "neighbor lists ", &
     842             :                           default_l_val=.FALSE., &
     843        8408 :                           lone_keyword_l_val=.TRUE.)
     844        8408 :       CALL section_add_keyword(print_key, keyword)
     845        8408 :       CALL keyword_release(keyword)
     846             : 
     847             :       CALL keyword_create(keyword, __LOCATION__, &
     848             :                           name="sab_xtb_nonbond", &
     849             :                           description="Activates the printing of nonbonded interaction from (xTB) "// &
     850             :                           "neighbor lists ", &
     851             :                           default_l_val=.FALSE., &
     852        8408 :                           lone_keyword_l_val=.TRUE.)
     853        8408 :       CALL section_add_keyword(print_key, keyword)
     854        8408 :       CALL keyword_release(keyword)
     855             : 
     856             :       CALL keyword_create(keyword, __LOCATION__, &
     857             :                           name="soo_list", &
     858             :                           description="Activates the printing of RI orbital-orbital "// &
     859             :                           "neighbor lists ", &
     860             :                           default_l_val=.FALSE., &
     861        8408 :                           lone_keyword_l_val=.TRUE.)
     862        8408 :       CALL section_add_keyword(print_key, keyword)
     863        8408 :       CALL keyword_release(keyword)
     864             : 
     865             :       CALL keyword_create(keyword, __LOCATION__, &
     866             :                           name="sip_list", &
     867             :                           description="Activates the printing of RI basis-projector interaction "// &
     868             :                           "neighbor lists ", &
     869             :                           default_l_val=.FALSE., &
     870        8408 :                           lone_keyword_l_val=.TRUE.)
     871        8408 :       CALL section_add_keyword(print_key, keyword)
     872        8408 :       CALL keyword_release(keyword)
     873             : 
     874        8408 :       CALL section_add_subsection(section, print_key)
     875        8408 :       CALL section_release(print_key)
     876             : 
     877             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "SUBCELL", &
     878             :                                        description="Activates the printing of the subcells used for the "// &
     879             :                                        "generation of neighbor lists.", unit_str="angstrom", &
     880        8408 :                                        print_level=high_print_level, filename="__STD_OUT__")
     881        8408 :       CALL section_add_subsection(section, print_key)
     882        8408 :       CALL section_release(print_key)
     883             : 
     884             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "AO_MATRICES", &
     885             :                                        description="Controls the printing of the ao (i.e. contracted gaussian) matrices (debug).", &
     886        8408 :                                        print_level=debug_print_level, filename="__STD_OUT__")
     887             :       CALL keyword_create(keyword, __LOCATION__, name="OMIT_HEADERS", &
     888             :                           description="Print only the matrix data, not the row and column headers", &
     889        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     890        8408 :       CALL section_add_keyword(print_key, keyword)
     891        8408 :       CALL keyword_release(keyword)
     892             :       CALL keyword_create(keyword, __LOCATION__, name="NDIGITS", &
     893             :                           description="Specify the number of digits used to print the AO matrices", &
     894        8408 :                           default_i_val=6)
     895        8408 :       CALL section_add_keyword(print_key, keyword)
     896        8408 :       CALL keyword_release(keyword)
     897             :       CALL keyword_create(keyword, __LOCATION__, name="CORE_HAMILTONIAN", &
     898             :                           description="If the printkey is activated controls the printing of the hamiltonian matrix", &
     899        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     900        8408 :       CALL section_add_keyword(print_key, keyword)
     901        8408 :       CALL keyword_release(keyword)
     902             :       CALL keyword_create(keyword, __LOCATION__, name="DENSITY", &
     903             :                           description="If the printkey is activated controls the printing of the density (P) matrix", &
     904        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     905        8408 :       CALL section_add_keyword(print_key, keyword)
     906        8408 :       CALL keyword_release(keyword)
     907             : 
     908             :       CALL keyword_create(keyword, __LOCATION__, name="KINETIC_ENERGY", &
     909             :                           description="If the printkey is activated controls the printing of the kinetic energy matrix", &
     910        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     911        8408 :       CALL section_add_keyword(print_key, keyword)
     912        8408 :       CALL keyword_release(keyword)
     913             :       CALL keyword_create(keyword, __LOCATION__, name="KOHN_SHAM_MATRIX", &
     914             :                           description="If the printkey is activated controls the printing of the kohn-sham matrix", &
     915        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     916        8408 :       CALL section_add_keyword(print_key, keyword)
     917        8408 :       CALL keyword_release(keyword)
     918             :       CALL keyword_create( &
     919             :          keyword, __LOCATION__, name="MATRIX_VXC", &
     920             :          description="If the printkey is activated compute and print the matrix of the exchange and correlation potential. "// &
     921             :          "Only the GGA part for GPW is printed", &
     922        8408 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     923        8408 :       CALL section_add_keyword(print_key, keyword)
     924        8408 :       CALL keyword_release(keyword)
     925             :       CALL keyword_create(keyword, __LOCATION__, name="ORTHO", &
     926             :                           description="If the printkey is activated controls the printing of the orthogonalization matrix", &
     927        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     928        8408 :       CALL section_add_keyword(print_key, keyword)
     929        8408 :       CALL keyword_release(keyword)
     930             :       CALL keyword_create(keyword, __LOCATION__, name="OVERLAP", &
     931             :                           description="If the printkey is activated controls the printing of the overlap matrix", &
     932        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     933        8408 :       CALL section_add_keyword(print_key, keyword)
     934        8408 :       CALL keyword_release(keyword)
     935             :       CALL keyword_create(keyword, __LOCATION__, name="COMMUTATOR_HR", &
     936             :                           description="Controls the printing of the [H,r] commutator matrix", &
     937        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     938        8408 :       CALL section_add_keyword(print_key, keyword)
     939        8408 :       CALL keyword_release(keyword)
     940             : 
     941             :       CALL keyword_create(keyword, __LOCATION__, name="FERMI_CONTACT", &
     942             :                           description="If the printkey is activated controls the printing of the Fermi contact matrix", &
     943        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     944        8408 :       CALL section_add_keyword(print_key, keyword)
     945        8408 :       CALL keyword_release(keyword)
     946             :       CALL keyword_create( &
     947             :          keyword, __LOCATION__, name="PSO", &
     948             :          description="If the printkey is activated controls the printing of the paramagnetic spin-orbit matrices", &
     949        8408 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     950        8408 :       CALL section_add_keyword(print_key, keyword)
     951        8408 :       CALL keyword_release(keyword)
     952             :       CALL keyword_create( &
     953             :          keyword, __LOCATION__, name="EFG", &
     954             :          description="If the printkey is activated controls the printing of the electric field gradient matrices", &
     955        8408 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     956        8408 :       CALL section_add_keyword(print_key, keyword)
     957        8408 :       CALL keyword_release(keyword)
     958             :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_ENERGY", &
     959             :                           description="If the printkey is activated controls the printing of the potential energy matrix", &
     960        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     961        8408 :       CALL section_add_keyword(print_key, keyword)
     962        8408 :       CALL keyword_release(keyword)
     963             :       CALL keyword_create(keyword, __LOCATION__, name="OCE_HARD", &
     964             :                           description="If the printkey is activated controls the printing of the OCE HARD matrix", &
     965        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     966        8408 :       CALL section_add_keyword(print_key, keyword)
     967        8408 :       CALL keyword_release(keyword)
     968             :       CALL keyword_create(keyword, __LOCATION__, name="OCE_SOFT", &
     969             :                           description="If the printkey is activated controls the printing of the OCE SOFT matrix", &
     970        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     971        8408 :       CALL section_add_keyword(print_key, keyword)
     972        8408 :       CALL keyword_release(keyword)
     973             :       CALL keyword_create(keyword, __LOCATION__, name="W_MATRIX", &
     974             :                           description="If the printkey is activated controls the printing of the w matrix", &
     975        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     976        8408 :       CALL section_add_keyword(print_key, keyword)
     977        8408 :       CALL keyword_release(keyword)
     978             :       CALL keyword_create(keyword, __LOCATION__, name="W_MATRIX_AUX_FIT", &
     979             :                           description="If the printkey is activated controls the printing of the w matrix", &
     980        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     981        8408 :       CALL section_add_keyword(print_key, keyword)
     982        8408 :       CALL keyword_release(keyword)
     983             :       CALL keyword_create(keyword, __LOCATION__, name="DERIVATIVES", &
     984             :                           description="If the printkey is activated controls the printing "// &
     985             :                           "of derivatives (for the matrixes that support this)", &
     986        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     987        8408 :       CALL section_add_keyword(print_key, keyword)
     988        8408 :       CALL keyword_release(keyword)
     989        8408 :       CALL section_add_subsection(section, print_key)
     990        8408 :       CALL section_release(print_key)
     991             : 
     992             :       CALL cp_print_key_section_create( &
     993             :          print_key, __LOCATION__, "MO", &
     994             :          description="Controls the printing of the molecular orbital (MO) information. The requested MO information "// &
     995             :          "is printed for all occupied MOs by default. Use the MO_INDEX_RANGE keyword to restrict the number "// &
     996             :          "of the MOs or to print the MO information for unoccupied MOs. With diagonalization, additional MOs "// &
     997             :          "have to be made available for printout using the ADDED_MOS keyword in the SCF section. With OT, "// &
     998             :          "it is sufficient to specify the desired MO_INDEX_RANGE. The OT eigensolver can be controlled with "// &
     999             :          "the EPS_LUMO and MAX_ITER_LUMO keywords in the SCF section.", &
    1000        8408 :          print_level=high_print_level, filename="__STD_OUT__")
    1001             :       CALL keyword_create(keyword, __LOCATION__, name="CARTESIAN", &
    1002             :                           description="Print the MOs in the Cartesian basis instead of the default spherical basis.", &
    1003        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1004        8408 :       CALL section_add_keyword(print_key, keyword)
    1005        8408 :       CALL keyword_release(keyword)
    1006             :       CALL keyword_create(keyword, __LOCATION__, name="ENERGIES", &
    1007             :                           variants=s2a("EIGENVALUES", "EIGVALS"), &
    1008             :                           description="Print the MO energies (eigenvalues).", &
    1009        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1010        8408 :       CALL section_add_keyword(print_key, keyword)
    1011        8408 :       CALL keyword_release(keyword)
    1012             :       CALL keyword_create(keyword, __LOCATION__, name="COEFFICIENTS", &
    1013             :                           variants=s2a("EIGENVECTORS", "EIGVECS"), &
    1014             :                           description="Print the MO coefficients (eigenvectors).", &
    1015        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1016        8408 :       CALL section_add_keyword(print_key, keyword)
    1017        8408 :       CALL keyword_release(keyword)
    1018             :       CALL keyword_create(keyword, __LOCATION__, name="OCCUPATION_NUMBERS", &
    1019             :                           variants=s2a("OCCNUMS"), &
    1020             :                           description="Print the MO occupation numbers.", &
    1021        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1022        8408 :       CALL section_add_keyword(print_key, keyword)
    1023        8408 :       CALL keyword_release(keyword)
    1024             :       CALL keyword_create(keyword, __LOCATION__, name="OCCUPATION_NUMBERS_STATS", &
    1025             :                           variants=s2a("OCCNUMSTATS"), &
    1026             :                           description="Print some stats (max number of occupied MOs, etc.) of the MO occupation numbers."// &
    1027             :                           " First logical toggles stats printing, first real is the occupied threshold.", &
    1028             :                           type_of_var=char_t, n_var=-1, &
    1029             :                           default_c_vals=[".FALSE.", "1.0E-6 "], &
    1030             :                           lone_keyword_c_vals=[".TRUE."], &
    1031       33632 :                           usage="OCCUPATION_NUMBERS_STATS {Logical} [{Real}]")
    1032        8408 :       CALL section_add_keyword(print_key, keyword)
    1033        8408 :       CALL keyword_release(keyword)
    1034             :       CALL keyword_create(keyword, __LOCATION__, name="NDIGITS", &
    1035             :                           description="Specify the number of digits used to print the MO information.", &
    1036        8408 :                           default_i_val=6)
    1037        8408 :       CALL section_add_keyword(print_key, keyword)
    1038        8408 :       CALL keyword_release(keyword)
    1039             :       CALL keyword_create(keyword, __LOCATION__, &
    1040             :                           name="MO_INDEX_RANGE", &
    1041             :                           variants=s2a("MO_RANGE", "RANGE"), &
    1042             :                           description="Print only the requested subset of MOs. The indices of the first and "// &
    1043             :                           "the last MO have to be specified to define the range.", &
    1044             :                           repeats=.FALSE., &
    1045             :                           n_var=2, &
    1046             :                           type_of_var=integer_t, &
    1047             :                           default_i_vals=(/0, 0/), &
    1048        8408 :                           usage="MO_INDEX_RANGE 10 15")
    1049        8408 :       CALL section_add_keyword(print_key, keyword)
    1050        8408 :       CALL keyword_release(keyword)
    1051        8408 :       CALL section_add_subsection(section, print_key)
    1052        8408 :       CALL section_release(print_key)
    1053             : 
    1054             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MO_MOLDEN", &
    1055             :                                        description="Write the molecular orbitals in Molden file format, for visualisation.", &
    1056        8408 :                                        print_level=debug_print_level + 1, add_last=add_last_numeric, filename="MOS")
    1057             :       CALL keyword_create(keyword, __LOCATION__, name="NDIGITS", &
    1058             :                           description="Specifies the number of significant digits retained. 3 is OK for visualization.", &
    1059             :                           usage="NDIGITS {int}", &
    1060        8408 :                           default_i_val=3)
    1061        8408 :       CALL section_add_keyword(print_key, keyword)
    1062        8408 :       CALL keyword_release(keyword)
    1063             :       CALL keyword_create(keyword, __LOCATION__, name="GTO_KIND", &
    1064             :                           description="Representation of Gaussian-type orbitals", &
    1065             :                           default_i_val=gto_spherical, &
    1066             :                           enum_c_vals=s2a("CARTESIAN", "SPHERICAL"), &
    1067             :                           enum_desc=s2a( &
    1068             :                           "Cartesian Gaussian orbitals. Use with caution", &
    1069             :                           "Spherical Gaussian orbitals. Incompatible with VMD"), &
    1070        8408 :                           enum_i_vals=(/gto_cartesian, gto_spherical/))
    1071        8408 :       CALL section_add_keyword(print_key, keyword)
    1072        8408 :       CALL keyword_release(keyword)
    1073        8408 :       CALL section_add_subsection(section, print_key)
    1074        8408 :       CALL section_release(print_key)
    1075             : 
    1076        8408 :       CALL create_mo_cubes_section(print_key)
    1077        8408 :       CALL section_add_subsection(section, print_key)
    1078        8408 :       CALL section_release(print_key)
    1079             : 
    1080        8408 :       CALL create_stm_section(print_key)
    1081        8408 :       CALL section_add_subsection(section, print_key)
    1082        8408 :       CALL section_release(print_key)
    1083             : 
    1084        8408 :       CALL create_wfn_mix_section(subsection)
    1085        8408 :       CALL section_add_subsection(section, subsection)
    1086        8408 :       CALL section_release(subsection)
    1087             : 
    1088             :       CALL section_create(subsection, __LOCATION__, name="GAPW", &
    1089             :                           description="Controls the printing of some gapw related information (debug).", &
    1090        8408 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1091             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "projectors", &
    1092             :                                        description="If the printkey is activated controls if information on"// &
    1093             :                                        " the projectors is printed.", &
    1094        8408 :                                        print_level=debug_print_level, filename="__STD_OUT__")
    1095        8408 :       CALL section_add_subsection(subsection, print_key)
    1096        8408 :       CALL section_release(print_key)
    1097             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "rho0_information", &
    1098             :                                        description="If the printkey is activated controls if information on rho0 is printed.", &
    1099        8408 :                                        print_level=debug_print_level, filename="__STD_OUT__", unit_str="angstrom")
    1100        8408 :       CALL section_add_subsection(subsection, print_key)
    1101        8408 :       CALL section_release(print_key)
    1102        8408 :       CALL section_add_subsection(section, subsection)
    1103        8408 :       CALL section_release(subsection)
    1104             : 
    1105             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "dft_control_parameters", &
    1106             :                                        description="Controls the printing of dft control parameters.", &
    1107        8408 :                                        print_level=medium_print_level, filename="__STD_OUT__")
    1108        8408 :       CALL section_add_subsection(section, print_key)
    1109        8408 :       CALL section_release(print_key)
    1110             : 
    1111             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "KPOINTS", &
    1112             :                                        description="Controls the printing of kpoint information.", &
    1113        8408 :                                        print_level=medium_print_level, filename="__STD_OUT__")
    1114        8408 :       CALL section_add_subsection(section, print_key)
    1115        8408 :       CALL section_release(print_key)
    1116             : 
    1117        8408 :       NULLIFY (subsection)
    1118        8408 :       CALL create_bandstructure_section(subsection)
    1119        8408 :       CALL section_add_subsection(section, subsection)
    1120        8408 :       CALL section_release(subsection)
    1121             : 
    1122             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "OVERLAP_CONDITION", &
    1123             :                                        description="Controls the the checking and printing of and estimate "// &
    1124             :                                        "of the overlap matrix condition number", &
    1125        8408 :                                        print_level=debug_print_level, filename="__STD_OUT__")
    1126             :       CALL keyword_create(keyword, __LOCATION__, name="1-NORM", &
    1127             :                           description="Calculate an estimate of the 1-norm condition number", &
    1128        8408 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1129        8408 :       CALL section_add_keyword(print_key, keyword)
    1130        8408 :       CALL keyword_release(keyword)
    1131             :       CALL keyword_create(keyword, __LOCATION__, name="DIAGONALIZATION", &
    1132             :                           description="Calculate the 1- and 2-norm condition numbers using diagonalization", &
    1133        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1134        8408 :       CALL section_add_keyword(print_key, keyword)
    1135        8408 :       CALL keyword_release(keyword)
    1136             :       CALL keyword_create(keyword, __LOCATION__, name="ARNOLDI", &
    1137             :                           description="Calculate the 2-norm condition number using the Arnoldi code (may not be reliable)", &
    1138        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1139        8408 :       CALL section_add_keyword(print_key, keyword)
    1140        8408 :       CALL keyword_release(keyword)
    1141        8408 :       CALL section_add_subsection(section, print_key)
    1142        8408 :       CALL section_release(print_key)
    1143             : 
    1144             :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="E_DENSITY_CUBE", &
    1145             :                                        description="Controls the printing of cube files with "// &
    1146             :                                        "the electronic density and, for LSD calculations, the spin density.", &
    1147        8408 :                                        print_level=high_print_level, filename="")
    1148             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    1149             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1150             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1151             :                           " 1 number valid for all components.", &
    1152        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    1153        8408 :       CALL section_add_keyword(print_key, keyword)
    1154        8408 :       CALL keyword_release(keyword)
    1155             : 
    1156             :       CALL keyword_create(keyword, __LOCATION__, name="DENSITY_INCLUDE", &
    1157             :                           description="Which parts of the density to include. In GAPW the electronic density "// &
    1158             :                           "is divided into a hard and a soft component, and the default (TOTAL_HARD_APPROX) "// &
    1159             :                           "is to approximate the hard density as a spherical gaussian and to print the smooth "// &
    1160             :                           "density accurately. This avoids potential artefacts originating from the hard density. "// &
    1161             :                           "If the TOTAL_DENSITY keyword is used the hard density will be computed more accurately "// &
    1162             :                           "but may introduce non-physical features. The SOFT_DENSITY keyword will lead to only the "// &
    1163             :                           "soft density being printed. In GPW these options have no effect and the cube file will "// &
    1164             :                           "only contain the valence electron density.", &
    1165             :                           usage="DENSITY_INCLUDE TOTAL_HARD_APPROX", &
    1166             :                           enum_c_vals=s2a("TOTAL_HARD_APPROX", "TOTAL_DENSITY", "SOFT_DENSITY"), &
    1167             :                           enum_desc=s2a("Print (hard+soft) density where the hard components shape is approximated", &
    1168             :                                         "Print (hard+soft) density. Only has an effect "// &
    1169             :                                         "if PAW atoms are present. NOTE: The total "// &
    1170             :                                         "in real space might exhibit unphysical features "// &
    1171             :                                         "like spikes due to the finite and thus "// &
    1172             :                                         "truncated g vector", &
    1173             :                                         "Print only the soft density"), &
    1174             :                           enum_i_vals=(/e_dens_total_hard_approx, &
    1175             :                                         e_dens_total_density, &
    1176             :                                         e_dens_soft_density/), &
    1177        8408 :                           default_i_val=e_dens_total_hard_approx)
    1178        8408 :       CALL section_add_keyword(print_key, keyword)
    1179        8408 :       CALL keyword_release(keyword)
    1180             : 
    1181             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1182             :                           description="append the cube files when they already exist", &
    1183        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1184        8408 :       CALL section_add_keyword(print_key, keyword)
    1185        8408 :       CALL keyword_release(keyword)
    1186             : 
    1187             :       CALL keyword_create(keyword, __LOCATION__, name="XRD_INTERFACE", &
    1188             :                           description="It activates the print out of exponents and coefficients for the"// &
    1189             :                           " Gaussian expansion of the core densities, based on atom calculations for each kind."// &
    1190             :                           " The resulting core dansities are needed to compute the form factors."// &
    1191             :                           " If GAPW the local densities are also given in terms of a Gaussian expansion,"// &
    1192             :                           " by fitting the difference between local-fhard and local-soft density for each atom."// &
    1193             :                           " In this case the keyword SOFT_DENSITY is enabled.", &
    1194        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1195        8408 :       CALL section_add_keyword(print_key, keyword)
    1196        8408 :       CALL keyword_release(keyword)
    1197             : 
    1198             :       CALL keyword_create(keyword, __LOCATION__, name="NGAUSS", &
    1199             :                           description="Number of Gaussian functions used in the expansion of atomic (core) density", &
    1200        8408 :                           usage="NGAUSS 10", n_var=1, default_i_val=12, type_of_var=integer_t)
    1201        8408 :       CALL section_add_keyword(print_key, keyword)
    1202        8408 :       CALL keyword_release(keyword)
    1203             : 
    1204        8408 :       CALL section_add_subsection(section, print_key)
    1205        8408 :       CALL section_release(print_key)
    1206             : 
    1207             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "tot_density_cube", &
    1208             :                                        description="Controls printing of cube files with "// &
    1209             :                                        "the total density (electrons+atomic core). Note that "// &
    1210             :                                        "the value of the total density is positive where the "// &
    1211             :                                        "electron density dominates and negative where the core is. "// &
    1212             :                                        "When GPW is enabled this will simply print the combined density "// &
    1213             :                                        "of the valence electrons and charge-balanced core. In GAPW the "// &
    1214             :                                        "electronic density (hard+soft plus a correction term) is printed "// &
    1215             :                                        "together with the charge-balanced core density to produce a complete "// &
    1216             :                                        "representation of the total density.", &
    1217        8408 :                                        print_level=high_print_level, filename="")
    1218             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    1219             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1220             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1221             :                           " 1 number valid for all components.", &
    1222        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    1223        8408 :       CALL section_add_keyword(print_key, keyword)
    1224        8408 :       CALL keyword_release(keyword)
    1225             : 
    1226             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1227             :                           description="append the cube files when they already exist", &
    1228        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1229        8408 :       CALL section_add_keyword(print_key, keyword)
    1230        8408 :       CALL keyword_release(keyword)
    1231             : 
    1232        8408 :       CALL section_add_subsection(section, print_key)
    1233        8408 :       CALL section_release(print_key)
    1234             : 
    1235             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "v_hartree_cube", &
    1236             :                                        description="Controls the printing of a cube file with eletrostatic"// &
    1237             :                                        " potential generated by the total density (electrons+ions). It is"// &
    1238             :                                        " valid only for QS with GPW formalism."// &
    1239             :                                        " Note that by convention the potential has opposite sign than the expected physical one.", &
    1240        8408 :                                        print_level=high_print_level, filename="")
    1241             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    1242             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1243             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1244             :                           " 1 number valid for all components.", &
    1245        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    1246        8408 :       CALL section_add_keyword(print_key, keyword)
    1247        8408 :       CALL keyword_release(keyword)
    1248             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1249             :                           description="append the cube files when they already exist", &
    1250        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1251        8408 :       CALL section_add_keyword(print_key, keyword)
    1252        8408 :       CALL keyword_release(keyword)
    1253             : 
    1254        8408 :       CALL section_add_subsection(section, print_key)
    1255        8408 :       CALL section_release(print_key)
    1256             : 
    1257             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "external_potential_cube", &
    1258             :                                        description="Controls the printing of a cube file with external"// &
    1259             :                                        " potential from the DFT%EXTERNAL_POTENTIAL section only.", &
    1260        8408 :                                        print_level=high_print_level, filename="")
    1261             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    1262             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1263             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1264             :                           " 1 number valid for all components.", &
    1265        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    1266        8408 :       CALL section_add_keyword(print_key, keyword)
    1267        8408 :       CALL keyword_release(keyword)
    1268             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1269             :                           description="append the cube files when they already exist", &
    1270        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1271        8408 :       CALL section_add_keyword(print_key, keyword)
    1272        8408 :       CALL keyword_release(keyword)
    1273             : 
    1274        8408 :       CALL section_add_subsection(section, print_key)
    1275        8408 :       CALL section_release(print_key)
    1276             : 
    1277             :       ! Output of BQB volumetric files
    1278             :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="E_DENSITY_BQB", &
    1279             :                                        description="Controls the output of the electron density to the losslessly"// &
    1280             :                                        " compressed BQB file format, see [Brehm2018]"// &
    1281             :                                        " (via LibBQB see <https://brehm-research.de/bqb>)."// &
    1282             :                                        " Currently does not work with changing cell vector (NpT ensemble).", &
    1283             :                                        print_level=debug_print_level + 1, filename="", &
    1284       16816 :                                        citations=(/Brehm2018/))
    1285             : 
    1286             :       CALL keyword_create(keyword, __LOCATION__, name="SKIP_FIRST", &
    1287             :                           description="Skips the first step of a MD run (avoids duplicate step if restarted).", &
    1288        8408 :                           usage="SKIP_FIRST T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1289        8408 :       CALL section_add_keyword(print_key, keyword)
    1290        8408 :       CALL keyword_release(keyword)
    1291             : 
    1292             :       CALL keyword_create(keyword, __LOCATION__, name="STORE_STEP_NUMBER", &
    1293             :                           description="Stores the step number and simulation time in the comment line of each BQB"// &
    1294             :                           " frame. Switch it off for binary compatibility with original CP2k CUBE files.", &
    1295        8408 :                           usage="STORE_STEP_NUMBER F", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1296        8408 :       CALL section_add_keyword(print_key, keyword)
    1297        8408 :       CALL keyword_release(keyword)
    1298             : 
    1299             :       CALL keyword_create(keyword, __LOCATION__, name="CHECK", &
    1300             :                           description="Performs an on-the-fly decompression of each compressed BQB frame to check"// &
    1301             :                           " whether the volumetric data exactly matches, and aborts the run if not so.", &
    1302        8408 :                           usage="CHECK T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1303        8408 :       CALL section_add_keyword(print_key, keyword)
    1304        8408 :       CALL keyword_release(keyword)
    1305             : 
    1306             :       CALL keyword_create(keyword, __LOCATION__, name="OVERWRITE", &
    1307             :                           description="Specify this keyword to overwrite the output BQB file if"// &
    1308             :                           " it already exists. By default, the data is appended to an existing file.", &
    1309        8408 :                           usage="OVERWRITE T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1310        8408 :       CALL section_add_keyword(print_key, keyword)
    1311        8408 :       CALL keyword_release(keyword)
    1312             : 
    1313             :       CALL keyword_create(keyword, __LOCATION__, name="HISTORY", &
    1314             :                           description="Controls how many previous steps are taken into account for extrapolation in"// &
    1315             :                           " compression. Use a value of 1 to compress the frames independently.", &
    1316        8408 :                           usage="HISTORY 10", n_var=1, default_i_val=10, type_of_var=integer_t)
    1317        8408 :       CALL section_add_keyword(print_key, keyword)
    1318        8408 :       CALL keyword_release(keyword)
    1319             : 
    1320             :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETER_KEY", &
    1321             :                           description="Allows to supply previously optimized compression parameters via a"// &
    1322             :                           " parameter key (alphanumeric character sequence starting with 'at')."// &
    1323             :                           " Just leave away the 'at' sign here, because CP2k will otherwise"// &
    1324             :                           " assume it is a variable name in the input", &
    1325        8408 :                           usage="PARAMETER_KEY <KEY>", n_var=1, default_c_val="", type_of_var=char_t)
    1326        8408 :       CALL section_add_keyword(print_key, keyword)
    1327        8408 :       CALL keyword_release(keyword)
    1328             : 
    1329             :       CALL keyword_create(keyword, __LOCATION__, name="OPTIMIZE", &
    1330             :                           description="Controls the time spent to optimize the parameters for compression efficiency.", &
    1331             :                           usage="OPTIMIZE {OFF,QUICK,NORMAL,PATIENT,EXHAUSTIVE}", repeats=.FALSE., n_var=1, &
    1332             :                           default_i_val=bqb_opt_quick, &
    1333             :                           enum_c_vals=s2a("OFF", "QUICK", "NORMAL", "PATIENT", "EXHAUSTIVE"), &
    1334             :                           enum_desc=s2a("No optimization (use defaults)", "Quick optimization", &
    1335             :                                         "Standard optimization", "Precise optimization", "Exhaustive optimization"), &
    1336        8408 :                           enum_i_vals=(/bqb_opt_off, bqb_opt_quick, bqb_opt_normal, bqb_opt_patient, bqb_opt_exhaustive/))
    1337        8408 :       CALL section_add_keyword(print_key, keyword)
    1338        8408 :       CALL keyword_release(keyword)
    1339             : 
    1340        8408 :       CALL section_add_subsection(section, print_key)
    1341        8408 :       CALL section_release(print_key)
    1342             : 
    1343             :       ! Voronoi Integration via LibVori
    1344        8408 :       CALL create_print_voronoi_section(print_key)
    1345        8408 :       CALL section_add_subsection(section, print_key)
    1346        8408 :       CALL section_release(print_key)
    1347             : 
    1348             :       ! cube files for data generated by the implicit (generalized) Poisson solver
    1349        8408 :       CALL create_implicit_psolver_section(subsection)
    1350        8408 :       CALL section_add_subsection(section, subsection)
    1351        8408 :       CALL section_release(subsection)
    1352             : 
    1353             :       ! ZMP adding the print section for  the v_xc cube
    1354             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "v_xc_cube", &
    1355             :                                        description="Controls the printing of a cube file with xc"// &
    1356             :                                        " potential generated by the ZMP method (for the moment). It is"// &
    1357             :                                        " valid only for QS with GPW formalism .", &
    1358        8408 :                                        print_level=high_print_level, filename="")
    1359             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    1360             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1361             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1362             :                           " 1 number valid for all components.", &
    1363        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    1364        8408 :       CALL section_add_keyword(print_key, keyword)
    1365        8408 :       CALL keyword_release(keyword)
    1366             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1367             :                           description="append the cube files when they already exist", &
    1368        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1369        8408 :       CALL section_add_keyword(print_key, keyword)
    1370        8408 :       CALL keyword_release(keyword)
    1371             : 
    1372        8408 :       CALL section_add_subsection(section, print_key)
    1373        8408 :       CALL section_release(print_key)
    1374             : 
    1375             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "efield_cube", &
    1376             :                                        description="Controls the printing of cube files with electric"// &
    1377             :                                        " field generated by the total density (electrons+ions). It is"// &
    1378             :                                        " valid only for QS with GPW formalism.", &
    1379        8408 :                                        print_level=high_print_level, filename="")
    1380             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    1381             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1382             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1383             :                           " 1 number valid for all components.", &
    1384        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    1385        8408 :       CALL section_add_keyword(print_key, keyword)
    1386        8408 :       CALL keyword_release(keyword)
    1387             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1388             :                           description="append the cube files when they already exist", &
    1389        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1390        8408 :       CALL section_add_keyword(print_key, keyword)
    1391        8408 :       CALL keyword_release(keyword)
    1392             : 
    1393        8408 :       CALL section_add_subsection(section, print_key)
    1394        8408 :       CALL section_release(print_key)
    1395             : 
    1396             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ELF_CUBE", &
    1397             :                                        description="Controls printing of cube files with"// &
    1398             :                                        " the electron localization function (ELF). Note that"// &
    1399             :                                        " the value of ELF is defined between 0 and 1: Pauli kinetic energy density normalized"// &
    1400             :                                        " by the kinetic energy density of a uniform el. gas of same density.", &
    1401        8408 :                                        print_level=high_print_level, filename="")
    1402             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    1403             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1404             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1405             :                           " 1 number valid for all components.", &
    1406        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    1407        8408 :       CALL section_add_keyword(print_key, keyword)
    1408        8408 :       CALL keyword_release(keyword)
    1409             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1410             :                           description="append the cube files when they already exist", &
    1411        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1412        8408 :       CALL section_add_keyword(print_key, keyword)
    1413        8408 :       CALL keyword_release(keyword)
    1414             : 
    1415             :       CALL keyword_create(keyword, __LOCATION__, name="density_cutoff", &
    1416             :                           description=" ", &
    1417             :                           usage="density_cutoff 0.0001", &
    1418             :                           repeats=.FALSE., &
    1419             :                           n_var=1, &
    1420             :                           type_of_var=real_t, &
    1421        8408 :                           default_r_val=1.0e-10_dp)
    1422        8408 :       CALL section_add_keyword(print_key, keyword)
    1423        8408 :       CALL keyword_release(keyword)
    1424             : 
    1425        8408 :       CALL section_add_subsection(section, print_key)
    1426        8408 :       CALL section_release(print_key)
    1427             : 
    1428             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "LOCAL_ENERGY_CUBE", &
    1429             :                                        description="Controls the printing of cube files with the local"// &
    1430             :                                        " energy. It is valid only for QS with GPW/GAPW formalism."// &
    1431             :                                        " Meta and hybrid functionals are not possible.", &
    1432        8408 :                                        print_level=debug_print_level, filename="")
    1433             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    1434             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1435             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1436             :                           " 1 number valid for all components.", &
    1437        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    1438        8408 :       CALL section_add_keyword(print_key, keyword)
    1439        8408 :       CALL keyword_release(keyword)
    1440             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1441             :                           description="append the cube files when they already exist", &
    1442        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1443        8408 :       CALL section_add_keyword(print_key, keyword)
    1444        8408 :       CALL keyword_release(keyword)
    1445             : 
    1446        8408 :       CALL section_add_subsection(section, print_key)
    1447        8408 :       CALL section_release(print_key)
    1448             : 
    1449             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "LOCAL_STRESS_CUBE", &
    1450             :                                        description="Controls the printing of cube files with the local"// &
    1451             :                                        " stress. It is valid only for QS with GPW/GAPW formalism."// &
    1452             :                                        " Meta and hybrid functionals are not possible.", &
    1453        8408 :                                        print_level=debug_print_level, filename="")
    1454             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    1455             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1456             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1457             :                           " 1 number valid for all components.", &
    1458        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    1459        8408 :       CALL section_add_keyword(print_key, keyword)
    1460        8408 :       CALL keyword_release(keyword)
    1461             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1462             :                           description="append the cube files when they already exist", &
    1463        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1464        8408 :       CALL section_add_keyword(print_key, keyword)
    1465        8408 :       CALL keyword_release(keyword)
    1466             : 
    1467        8408 :       CALL section_add_subsection(section, print_key)
    1468        8408 :       CALL section_release(print_key)
    1469             : 
    1470        8408 :       CALL create_dos_section(print_key)
    1471        8408 :       CALL section_add_subsection(section, print_key)
    1472        8408 :       CALL section_release(print_key)
    1473             : 
    1474        8408 :       CALL create_pdos_section(print_key)
    1475        8408 :       CALL section_add_subsection(section, print_key)
    1476        8408 :       CALL section_release(print_key)
    1477             : 
    1478        8408 :       CALL create_wannier_section(print_key)
    1479        8408 :       CALL section_add_subsection(section, print_key)
    1480        8408 :       CALL section_release(print_key)
    1481             : 
    1482             :       !Printing of Moments
    1483        8408 :       CALL create_dipoles_section(print_key, "MOMENTS", high_print_level)
    1484             :       CALL keyword_create( &
    1485             :          keyword, __LOCATION__, &
    1486             :          name="MAX_MOMENT", &
    1487             :          description="Maximum moment to be calculated. Values higher than 1 not implemented under periodic boundaries.", &
    1488             :          usage="MAX_MOMENT {integer}", &
    1489             :          repeats=.FALSE., &
    1490             :          n_var=1, &
    1491             :          type_of_var=integer_t, &
    1492        8408 :          default_i_val=1)
    1493        8408 :       CALL section_add_keyword(print_key, keyword)
    1494        8408 :       CALL keyword_release(keyword)
    1495             :       CALL keyword_create(keyword, __LOCATION__, &
    1496             :                           name="MAGNETIC", &
    1497             :                           description="Calculate also magnetic moments, only implemented without periodic boundaries", &
    1498             :                           usage="MAGNETIC yes", &
    1499             :                           repeats=.FALSE., &
    1500             :                           n_var=1, &
    1501             :                           default_l_val=.FALSE., &
    1502        8408 :                           lone_keyword_l_val=.TRUE.)
    1503        8408 :       CALL section_add_keyword(print_key, keyword)
    1504        8408 :       CALL keyword_release(keyword)
    1505             :       CALL keyword_create(keyword, __LOCATION__, &
    1506             :                           name="VEL_REPRS", &
    1507             :                           description="Calculate expectation values of the el. multipole moments in their velocity "// &
    1508             :                           "representation during RTP. Implemented up to el. quadrupole moment.", &
    1509             :                           usage="VEL_REPS yes", &
    1510             :                           repeats=.FALSE., &
    1511             :                           n_var=1, &
    1512             :                           default_l_val=.FALSE., &
    1513        8408 :                           lone_keyword_l_val=.TRUE.)
    1514        8408 :       CALL section_add_keyword(print_key, keyword)
    1515        8408 :       CALL keyword_release(keyword)
    1516             :       CALL keyword_create(keyword, __LOCATION__, &
    1517             :                           name="COM_NL", &
    1518             :                           description="Include non local commutator for velocity representations. "// &
    1519             :                           "Necessary for origin independent results.", &
    1520             :                           usage="COM_NL yes", &
    1521             :                           repeats=.FALSE., &
    1522             :                           n_var=1, &
    1523             :                           default_l_val=.FALSE., &
    1524        8408 :                           lone_keyword_l_val=.TRUE.)
    1525        8408 :       CALL section_add_keyword(print_key, keyword)
    1526        8408 :       CALL keyword_release(keyword)
    1527             :       CALL keyword_create(keyword, __LOCATION__, &
    1528             :                           name="SECOND_REFERENCE_POINT", &
    1529             :                           description="Use second reference point", &
    1530             :                           usage="SECOND_REFERENCE_POINT .TRUE.", &
    1531             :                           repeats=.FALSE., &
    1532             :                           n_var=1, &
    1533             :                           default_l_val=.FALSE., &
    1534        8408 :                           lone_keyword_l_val=.TRUE.)
    1535        8408 :       CALL section_add_keyword(print_key, keyword)
    1536        8408 :       CALL keyword_release(keyword)
    1537             :       CALL keyword_create(keyword, __LOCATION__, name="REFERENCE_2", &
    1538             :                           variants=s2a("REF_2"), &
    1539             :                           description="Define a second reference point for the calculation of the electrostatic moment.", &
    1540             :                           usage="REFERENCE_2 COM", &
    1541             :                           enum_c_vals=s2a("COM", "COAC", "USER_DEFINED", "ZERO"), &
    1542             :                           enum_desc=s2a("Use Center of Mass", &
    1543             :                                         "Use Center of Atomic Charges", &
    1544             :                                         "Use User Defined Point (Keyword:REF_POINT)", &
    1545             :                                         "Use Origin of Coordinate System"), &
    1546             :                           enum_i_vals=(/use_mom_ref_com, &
    1547             :                                         use_mom_ref_coac, &
    1548             :                                         use_mom_ref_user, &
    1549             :                                         use_mom_ref_zero/), &
    1550        8408 :                           default_i_val=use_mom_ref_zero)
    1551        8408 :       CALL section_add_keyword(print_key, keyword)
    1552        8408 :       CALL keyword_release(keyword)
    1553             :       CALL keyword_create(keyword, __LOCATION__, name="REFERENCE_POINT_2", &
    1554             :                           variants=s2a("REF_POINT_2"), &
    1555             :                           description="Fixed second reference point for the calculations of the electrostatic moment.", &
    1556             :                           usage="REFERENCE_POINT_2 x y z", &
    1557             :                           repeats=.FALSE., &
    1558             :                           n_var=3, default_r_vals=(/0._dp, 0._dp, 0._dp/), &
    1559             :                           type_of_var=real_t, &
    1560        8408 :                           unit_str='bohr')
    1561        8408 :       CALL section_add_keyword(print_key, keyword)
    1562        8408 :       CALL keyword_release(keyword)
    1563        8408 :       CALL section_add_subsection(section, print_key)
    1564        8408 :       CALL section_release(print_key)
    1565             : 
    1566             :       ! Mulliken population analysis
    1567             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MULLIKEN", &
    1568             :                                        description="Controls the printing of the Mulliken (spin) population analysis", &
    1569             :                                        print_level=medium_print_level, filename="__STD_OUT__", &
    1570        8408 :                                        common_iter_levels=1)
    1571             :       CALL keyword_create( &
    1572             :          keyword, __LOCATION__, &
    1573             :          name="PRINT_GOP", &
    1574             :          description="Print the gross orbital populations (GOP) in addition to the gross atomic populations (GAP) "// &
    1575             :          "and net charges", &
    1576             :          usage="PRINT_GOP yes", &
    1577             :          repeats=.FALSE., &
    1578             :          n_var=1, &
    1579             :          default_l_val=.FALSE., &
    1580        8408 :          lone_keyword_l_val=.TRUE.)
    1581        8408 :       CALL section_add_keyword(print_key, keyword)
    1582        8408 :       CALL keyword_release(keyword)
    1583             :       CALL keyword_create( &
    1584             :          keyword, __LOCATION__, &
    1585             :          name="PRINT_ALL", &
    1586             :          description="Print all information including the full net AO and overlap population matrix", &
    1587             :          usage="PRINT_ALL yes", &
    1588             :          repeats=.FALSE., &
    1589             :          n_var=1, &
    1590             :          default_l_val=.FALSE., &
    1591        8408 :          lone_keyword_l_val=.TRUE.)
    1592        8408 :       CALL section_add_keyword(print_key, keyword)
    1593        8408 :       CALL keyword_release(keyword)
    1594        8408 :       CALL section_add_subsection(section, print_key)
    1595        8408 :       CALL section_release(print_key)
    1596             : 
    1597             :       ! Lowdin population analysis (fairly expensive to compute, so only at high)
    1598             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "LOWDIN", &
    1599             :                                        description="Controls the printing of the Lowdin (spin) population analysis", &
    1600             :                                        print_level=high_print_level, filename="__STD_OUT__", &
    1601        8408 :                                        common_iter_levels=1)
    1602             :       CALL keyword_create( &
    1603             :          keyword, __LOCATION__, &
    1604             :          name="PRINT_GOP", &
    1605             :          description="Print the orbital populations in addition to the atomic populations and net charges", &
    1606             :          usage="PRINT_GOP yes", &
    1607             :          repeats=.FALSE., &
    1608             :          n_var=1, &
    1609             :          default_l_val=.FALSE., &
    1610        8408 :          lone_keyword_l_val=.TRUE.)
    1611        8408 :       CALL section_add_keyword(print_key, keyword)
    1612        8408 :       CALL keyword_release(keyword)
    1613             :       CALL keyword_create( &
    1614             :          keyword, __LOCATION__, &
    1615             :          name="PRINT_ALL", &
    1616             :          description="Print all information including the full symmetrically orthogonalised density matrix", &
    1617             :          usage="PRINT_ALL yes", &
    1618             :          repeats=.FALSE., &
    1619             :          n_var=1, &
    1620             :          default_l_val=.FALSE., &
    1621        8408 :          lone_keyword_l_val=.TRUE.)
    1622        8408 :       CALL section_add_keyword(print_key, keyword)
    1623        8408 :       CALL keyword_release(keyword)
    1624        8408 :       CALL section_add_subsection(section, print_key)
    1625        8408 :       CALL section_release(print_key)
    1626             : 
    1627             :       ! Hirshfeld population analysis
    1628             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "HIRSHFELD", &
    1629             :                                        description="Controls the printing of the Hirshfeld (spin) population analysis", &
    1630             :                                        print_level=medium_print_level, filename="__STD_OUT__", &
    1631        8408 :                                        common_iter_levels=1)
    1632             :       CALL keyword_create(keyword, __LOCATION__, name="SELF_CONSISTENT", &
    1633             :                           description="Calculate charges from the Hirscheld-I (self_consistent) method."// &
    1634             :                           " This scales only the full shape function, not the added charge as in the original scheme.", &
    1635             :                           usage="SELF_CONSISTENT yes", repeats=.FALSE., n_var=1, &
    1636        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1637        8408 :       CALL section_add_keyword(print_key, keyword)
    1638        8408 :       CALL keyword_release(keyword)
    1639             :       CALL keyword_create(keyword, __LOCATION__, name="SHAPE_FUNCTION", &
    1640             :                           description="Type of shape function used for Hirshfeld partitioning.", &
    1641             :                           usage="SHAPE_FUNCTION {Gaussian,Density}", repeats=.FALSE., n_var=1, &
    1642             :                           default_i_val=shape_function_gaussian, &
    1643             :                           enum_c_vals=s2a("GAUSSIAN", "DENSITY"), &
    1644             :                           enum_desc=s2a("Single Gaussian with Colvalent radius", &
    1645             :                                         "Atomic density expanded in multiple Gaussians"), &
    1646        8408 :                           enum_i_vals=(/shape_function_gaussian, shape_function_density/))
    1647        8408 :       CALL section_add_keyword(print_key, keyword)
    1648        8408 :       CALL keyword_release(keyword)
    1649             :       CALL keyword_create(keyword, __LOCATION__, name="REFERENCE_CHARGE", &
    1650             :                           description="Charge of atomic partitioning function for Hirshfeld method.", &
    1651             :                           usage="REFERENCE_CHARGE {Atomic,Mulliken}", repeats=.FALSE., n_var=1, &
    1652             :                           default_i_val=ref_charge_atomic, &
    1653             :                           enum_c_vals=s2a("ATOMIC", "MULLIKEN"), &
    1654             :                           enum_desc=s2a("Use atomic core charges", "Calculate Mulliken charges"), &
    1655        8408 :                           enum_i_vals=(/ref_charge_atomic, ref_charge_mulliken/))
    1656        8408 :       CALL section_add_keyword(print_key, keyword)
    1657        8408 :       CALL keyword_release(keyword)
    1658             :       CALL keyword_create(keyword, __LOCATION__, name="USER_RADIUS", &
    1659             :                           description="Use user defined radii to generate Gaussians."// &
    1660             :                           " These radii are defined by the keyword ATOMIC_RADII", &
    1661             :                           usage="USER_RADIUS yes", repeats=.FALSE., n_var=1, &
    1662        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1663        8408 :       CALL section_add_keyword(print_key, keyword)
    1664        8408 :       CALL keyword_release(keyword)
    1665             :       CALL keyword_create(keyword, __LOCATION__, name="ATOMIC_RADII", &
    1666             :                           description="Defines custom radii to setup the spherical Gaussians.", &
    1667             :                           usage="ATOMIC_RADII {real} {real} {real}", repeats=.FALSE., &
    1668             :                           unit_str="angstrom", &
    1669        8408 :                           type_of_var=real_t, n_var=-1)
    1670        8408 :       CALL section_add_keyword(print_key, keyword)
    1671        8408 :       CALL keyword_release(keyword)
    1672        8408 :       CALL section_add_subsection(section, print_key)
    1673        8408 :       CALL section_release(print_key)
    1674             : 
    1675             :       ! MAO (modified atomic orbital) analysis
    1676             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MAO_ANALYSIS", &
    1677             :                                        description="Controls the printing of the MAO (modified atomic orbital) analysis", &
    1678             :                                        print_level=debug_print_level, filename="__STD_OUT__", &
    1679             :                                        common_iter_levels=1, &
    1680       25224 :                                        citations=(/Heinzmann1976, Ehrhardt1985/))
    1681             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER", &
    1682             :                           description="Threshold for matrix elements in MAO determination.", &
    1683             :                           usage="EPS_FILTER reps", repeats=.FALSE., n_var=1, &
    1684        8408 :                           default_r_val=1.e-8_dp, type_of_var=real_t)
    1685        8408 :       CALL section_add_keyword(print_key, keyword)
    1686        8408 :       CALL keyword_release(keyword)
    1687             :       CALL keyword_create(keyword, __LOCATION__, name="REFERENCE_BASIS", &
    1688             :                           description="Basis set used to construct MAO's.", &
    1689             :                           usage="REFERENCE_BASIS {ORBITAL,PRIMITIVE,EXTERNAL}", repeats=.FALSE., n_var=1, &
    1690             :                           default_i_val=mao_basis_orb, &
    1691             :                           enum_c_vals=s2a("ORBITAL", "PRIMITIVE", "EXTERNAL"), &
    1692             :                           enum_desc=s2a("Use standard orbital basis set", "Construct basis from primitives of the orbital basis", &
    1693             :                                         "Read external basis (MAO)"), &
    1694        8408 :                           enum_i_vals=(/mao_basis_orb, mao_basis_prim, mao_basis_ext/))
    1695        8408 :       CALL section_add_keyword(print_key, keyword)
    1696        8408 :       CALL keyword_release(keyword)
    1697             :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_BASIS", &
    1698             :                           description="Print out MAO reference basis.", &
    1699             :                           usage="PRINT_BASIS {logical}", repeats=.FALSE., n_var=1, &
    1700        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE., type_of_var=logical_t)
    1701        8408 :       CALL section_add_keyword(print_key, keyword)
    1702        8408 :       CALL keyword_release(keyword)
    1703             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_GRAD", &
    1704             :                           description="Threshold for gradient in MAO optimization.", &
    1705             :                           usage="EPS_GRAD reps", repeats=.FALSE., n_var=1, &
    1706        8408 :                           default_r_val=1.e-4_dp, type_of_var=real_t)
    1707        8408 :       CALL section_add_keyword(print_key, keyword)
    1708        8408 :       CALL keyword_release(keyword)
    1709             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FUNCTION", &
    1710             :                           description="Threshold for electron defect in MAO optimization.", &
    1711             :                           usage="EPS_FUNCTION feps", repeats=.FALSE., n_var=1, &
    1712        8408 :                           default_r_val=1.e-3_dp, type_of_var=real_t)
    1713        8408 :       CALL section_add_keyword(print_key, keyword)
    1714        8408 :       CALL keyword_release(keyword)
    1715             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
    1716             :                           description="Maximum allowed iterations for MAO optimization.", &
    1717             :                           usage="MAX_ITER iter", repeats=.FALSE., n_var=1, &
    1718        8408 :                           default_i_val=0, type_of_var=integer_t)
    1719        8408 :       CALL section_add_keyword(print_key, keyword)
    1720        8408 :       CALL keyword_release(keyword)
    1721             :       CALL keyword_create(keyword, __LOCATION__, name="NEGLECT_ABC", &
    1722             :                           description="Neglect 3 atom terms in MAO analysis.", &
    1723             :                           usage="NEGLECT_ABC {logical}", repeats=.FALSE., n_var=1, &
    1724        8408 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE., type_of_var=logical_t)
    1725        8408 :       CALL section_add_keyword(print_key, keyword)
    1726        8408 :       CALL keyword_release(keyword)
    1727             :       CALL keyword_create(keyword, __LOCATION__, name="AB_THRESHOLD", &
    1728             :                           description="Threshold for printing of AB shared electron numbers.", &
    1729             :                           usage="AB_THRESHOLD thr", repeats=.FALSE., n_var=1, &
    1730        8408 :                           default_r_val=1.e-2_dp, type_of_var=real_t)
    1731        8408 :       CALL section_add_keyword(print_key, keyword)
    1732        8408 :       CALL keyword_release(keyword)
    1733             :       CALL keyword_create(keyword, __LOCATION__, name="ABC_THRESHOLD", &
    1734             :                           description="Threshold for printing of ABC shared electron numbers.", &
    1735             :                           usage="ABC_THRESHOLD thr", repeats=.FALSE., n_var=1, &
    1736        8408 :                           default_r_val=1.e-5_dp, type_of_var=real_t)
    1737        8408 :       CALL section_add_keyword(print_key, keyword)
    1738        8408 :       CALL keyword_release(keyword)
    1739             :       CALL keyword_create(keyword, __LOCATION__, name="ANALYZE_UNASSIGNED_CHARGE", &
    1740             :                           description="Calculate atomic contributions to the unassigned charge.", &
    1741             :                           usage="ANALYZE_UNASSIGNED_CHARGE {logical}", repeats=.FALSE., n_var=1, &
    1742        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE., type_of_var=logical_t)
    1743        8408 :       CALL section_add_keyword(print_key, keyword)
    1744        8408 :       CALL keyword_release(keyword)
    1745        8408 :       CALL section_add_subsection(section, print_key)
    1746        8408 :       CALL section_release(print_key)
    1747             : 
    1748             :       !Minimal localized basis analysis
    1749             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MINBAS_ANALYSIS", &
    1750             :                                        description="Controls the printing of the minimal localized basis analysis", &
    1751             :                                        print_level=debug_print_level, filename="__STD_OUT__", &
    1752             :                                        common_iter_levels=1, &
    1753       16816 :                                        citations=(/Lu2004/))
    1754             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER", &
    1755             :                           description="Threshold for matrix elements in basis determination.", &
    1756             :                           usage="EPS_FILTER reps", repeats=.FALSE., n_var=1, &
    1757        8408 :                           default_r_val=1.e-8_dp, type_of_var=real_t)
    1758        8408 :       CALL section_add_keyword(print_key, keyword)
    1759        8408 :       CALL keyword_release(keyword)
    1760             :       CALL keyword_create(keyword, __LOCATION__, name="FULL_ORTHOGONALIZATION", &
    1761             :                           description="Orthogonalize the localized minimal basis.", &
    1762             :                           usage="FULL_ORTHOGONALIZATION {logical}", repeats=.FALSE., n_var=1, &
    1763        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE., type_of_var=logical_t)
    1764        8408 :       CALL section_add_keyword(print_key, keyword)
    1765        8408 :       CALL keyword_release(keyword)
    1766             :       CALL keyword_create(keyword, __LOCATION__, name="BOND_ORDER", &
    1767             :                           description="Calculate Mayer Bond Orders.", &
    1768             :                           usage="BOND_ORDER {logical}", repeats=.FALSE., n_var=1, &
    1769        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE., type_of_var=logical_t)
    1770        8408 :       CALL section_add_keyword(print_key, keyword)
    1771        8408 :       CALL keyword_release(keyword)
    1772             : 
    1773        8408 :       NULLIFY (sub_print_key)
    1774             :       CALL cp_print_key_section_create(sub_print_key, __LOCATION__, "MINBAS_CUBE", &
    1775             :                                        description="Write the minimal basis on Cube files.", &
    1776        8408 :                                        print_level=debug_print_level + 1, add_last=add_last_numeric, filename="MINBAS")
    1777             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    1778             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1779             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1780             :                           " 1 number valid for all components.", &
    1781        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    1782        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1783        8408 :       CALL keyword_release(keyword)
    1784             :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_LIST", &
    1785             :                           description="Indexes of the atoms minimal basis to be printed as cube files "// &
    1786             :                           "This keyword can be repeated several times "// &
    1787             :                           "(useful if you have to specify many indexes).", &
    1788             :                           usage="CUBES_LIST 1 2", &
    1789        8408 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    1790        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1791        8408 :       CALL keyword_release(keyword)
    1792        8408 :       CALL section_add_subsection(print_key, sub_print_key)
    1793        8408 :       CALL section_release(sub_print_key)
    1794             : 
    1795        8408 :       NULLIFY (sub_print_key)
    1796             :       CALL cp_print_key_section_create(sub_print_key, __LOCATION__, "MINBAS_MOLDEN", &
    1797             :                                        description="Write the minimal basis in Molden file format, for visualisation.", &
    1798        8408 :                                        print_level=debug_print_level + 1, add_last=add_last_numeric, filename="MINBAS")
    1799             :       CALL keyword_create(keyword, __LOCATION__, name="NDIGITS", &
    1800             :                           description="Specifies the number of significant digits retained. 3 is OK for visualization.", &
    1801             :                           usage="NDIGITS {int}", &
    1802        8408 :                           default_i_val=3)
    1803        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1804        8408 :       CALL keyword_release(keyword)
    1805             :       CALL keyword_create(keyword, __LOCATION__, name="GTO_KIND", &
    1806             :                           description="Representation of Gaussian-type orbitals", &
    1807             :                           default_i_val=gto_spherical, &
    1808             :                           enum_c_vals=s2a("CARTESIAN", "SPHERICAL"), &
    1809             :                           enum_desc=s2a( &
    1810             :                           "Cartesian Gaussian orbitals. Use with caution", &
    1811             :                           "Spherical Gaussian orbitals. Incompatible with VMD"), &
    1812        8408 :                           enum_i_vals=(/gto_cartesian, gto_spherical/))
    1813        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1814        8408 :       CALL keyword_release(keyword)
    1815        8408 :       CALL section_add_subsection(print_key, sub_print_key)
    1816        8408 :       CALL section_release(sub_print_key)
    1817             : 
    1818        8408 :       CALL section_add_subsection(section, print_key)
    1819        8408 :       CALL section_release(print_key)
    1820             : 
    1821             :       !Energy Decomposition Analysis
    1822             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ENERGY_DECOMPOSITION_ANALYSIS", &
    1823             :                                        description="Controls energy decomposition analysis", &
    1824             :                                        print_level=debug_print_level, filename="__STD_OUT__", &
    1825             :                                        common_iter_levels=1, &
    1826       16816 :                                        citations=(/Eriksen2020/))
    1827             :       CALL keyword_create(keyword, __LOCATION__, name="REFERENCE_ORB_CANONICAL", &
    1828             :                           description="Use reference orbitals in canonical form.", &
    1829             :                           usage="REFERENCE_ORB_CANONICAL {logical}", repeats=.FALSE., n_var=1, &
    1830        8408 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE., type_of_var=logical_t)
    1831        8408 :       CALL section_add_keyword(print_key, keyword)
    1832        8408 :       CALL keyword_release(keyword)
    1833             :       CALL keyword_create(keyword, __LOCATION__, name="SKIP_LOCALIZATION", &
    1834             :                           description="Don't localize the MOs.", &
    1835             :                           usage="SKIP_LOCALIZATION {logical}", repeats=.FALSE., n_var=1, &
    1836        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE., type_of_var=logical_t)
    1837        8408 :       CALL section_add_keyword(print_key, keyword)
    1838        8408 :       CALL keyword_release(keyword)
    1839             :       CALL keyword_create(keyword, __LOCATION__, name="DETAILED_ENERGY", &
    1840             :                           description="Calculate detailed atomic decomposition energies.", &
    1841             :                           usage="DETAILED_ENERGY {logical}", repeats=.FALSE., n_var=1, &
    1842        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE., type_of_var=logical_t)
    1843        8408 :       CALL section_add_keyword(print_key, keyword)
    1844        8408 :       CALL keyword_release(keyword)
    1845             :       CALL keyword_create(keyword, __LOCATION__, name="EWALD_ALPHA_PARAMETER", &
    1846             :                           description="Calculate Energy Decomposition for a specific alpha value. "// &
    1847             :                           "alpha = 1/(2*rc**2), see GTH pseudopotentials.", &
    1848             :                           usage="EWALD_ALPHA_PARAMETER alpha", repeats=.FALSE., n_var=1, &
    1849        8408 :                           default_r_val=0.0_dp, type_of_var=real_t)
    1850        8408 :       CALL section_add_keyword(print_key, keyword)
    1851        8408 :       CALL keyword_release(keyword)
    1852             : 
    1853        8408 :       CALL section_add_subsection(section, print_key)
    1854        8408 :       CALL section_release(print_key)
    1855             : 
    1856             :       ! IAO (Intrinsic atomic orbital) analysis
    1857             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "IAO_ANALYSIS", &
    1858             :                                        description="Controls the printing of the IAO (intrinsic atomic orbital) analysis", &
    1859             :                                        print_level=debug_print_level, filename="__STD_OUT__", &
    1860             :                                        common_iter_levels=1, &
    1861       16816 :                                        citations=(/Knizia2013/))
    1862             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_SVD", &
    1863             :                           description="Threshold for matrix inversion eigenvalues.", &
    1864             :                           usage="EPS_SVD reps", repeats=.FALSE., n_var=1, &
    1865        8408 :                           default_r_val=0.0_dp, type_of_var=real_t)
    1866        8408 :       CALL section_add_keyword(print_key, keyword)
    1867        8408 :       CALL keyword_release(keyword)
    1868             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_OCC", &
    1869             :                           description="Threshold in occupation for vectors included.", &
    1870             :                           usage="EPS_OCC reps", repeats=.FALSE., n_var=1, &
    1871        8408 :                           default_r_val=0.0_dp, type_of_var=real_t)
    1872        8408 :       CALL section_add_keyword(print_key, keyword)
    1873        8408 :       CALL keyword_release(keyword)
    1874             :       CALL keyword_create(keyword, __LOCATION__, name="ATOMIC_CHARGES", &
    1875             :                           description="Calculate atomic charges from IAO.", &
    1876             :                           usage="ATOMIC_CHARGES {logical}", repeats=.FALSE., n_var=1, &
    1877        8408 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE., type_of_var=logical_t)
    1878        8408 :       CALL section_add_keyword(print_key, keyword)
    1879        8408 :       CALL keyword_release(keyword)
    1880             :       ! IAO_MOLDEN
    1881        8408 :       NULLIFY (sub_print_key)
    1882             :       CALL cp_print_key_section_create(sub_print_key, __LOCATION__, "IAO_MOLDEN", &
    1883             :                                        description="Write the IAO basis in Molden file format, for visualisation.", &
    1884        8408 :                                        print_level=debug_print_level + 1, add_last=add_last_numeric, filename="IAOBAS")
    1885             :       CALL keyword_create(keyword, __LOCATION__, name="NDIGITS", &
    1886             :                           description="Specifies the number of significant digits retained. 3 is OK for visualization.", &
    1887             :                           usage="NDIGITS {int}", &
    1888        8408 :                           default_i_val=3)
    1889        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1890        8408 :       CALL keyword_release(keyword)
    1891             :       CALL keyword_create(keyword, __LOCATION__, name="GTO_KIND", &
    1892             :                           description="Representation of Gaussian-type orbitals", &
    1893             :                           default_i_val=gto_spherical, &
    1894             :                           enum_c_vals=s2a("CARTESIAN", "SPHERICAL"), &
    1895             :                           enum_desc=s2a( &
    1896             :                           "Cartesian Gaussian orbitals. Use with caution", &
    1897             :                           "Spherical Gaussian orbitals. Incompatible with VMD"), &
    1898        8408 :                           enum_i_vals=(/gto_cartesian, gto_spherical/))
    1899        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1900        8408 :       CALL keyword_release(keyword)
    1901        8408 :       CALL section_add_subsection(print_key, sub_print_key)
    1902        8408 :       CALL section_release(sub_print_key)
    1903             :       ! IAO_CUBES
    1904        8408 :       NULLIFY (sub_print_key)
    1905             :       CALL cp_print_key_section_create(sub_print_key, __LOCATION__, "IAO_CUBES", &
    1906             :                                        description="Controls the printing of the IAO basis "// &
    1907             :                                        "as *.cube files.", &
    1908             :                                        print_level=high_print_level, common_iter_levels=1, &
    1909        8408 :                                        add_last=add_last_numeric, filename="")
    1910             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    1911             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1912             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1913             :                           " 1 number valid for all components.", &
    1914        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    1915        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1916        8408 :       CALL keyword_release(keyword)
    1917             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1918             :                           description="append the cube files when they already exist", &
    1919        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1920        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1921        8408 :       CALL keyword_release(keyword)
    1922             :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_LIST", &
    1923             :                           description="Indices of the atoms to be included in basis CUBE file printing. ", &
    1924             :                           usage="ATOM_LIST {integer}  {integer} ..  {integer} ", &
    1925        8408 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    1926        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1927        8408 :       CALL keyword_release(keyword)
    1928        8408 :       CALL section_add_subsection(print_key, sub_print_key)
    1929        8408 :       CALL section_release(sub_print_key)
    1930             :       ! One Center Expansion of IAO
    1931        8408 :       NULLIFY (sub_print_key)
    1932             :       CALL cp_print_key_section_create(sub_print_key, __LOCATION__, "ONE_CENTER_EXPANSION", &
    1933             :                                        description="Calculates single center expansion of IAOs ", &
    1934             :                                        print_level=high_print_level, common_iter_levels=1, &
    1935        8408 :                                        add_last=add_last_numeric, filename="")
    1936             :       CALL keyword_create(keyword, __LOCATION__, name="LMAX", &
    1937             :                           description="Maximum l quantum number used in the expansion.", &
    1938        8408 :                           usage="LMAX 2", n_var=1, default_i_val=3, type_of_var=integer_t)
    1939        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1940        8408 :       CALL keyword_release(keyword)
    1941             :       CALL keyword_create(keyword, __LOCATION__, name="NBAS", &
    1942             :                           description="Max number of basis functions used in the expansion."// &
    1943             :                           " Default is determined by the orbital basis set.", &
    1944        8408 :                           usage="NBAS 10", n_var=1, default_i_val=-1, type_of_var=integer_t)
    1945        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1946        8408 :       CALL keyword_release(keyword)
    1947             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    1948             :                           description="Append the OCE basis files when it already exists", &
    1949        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1950        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1951        8408 :       CALL keyword_release(keyword)
    1952        8408 :       CALL section_add_subsection(print_key, sub_print_key)
    1953        8408 :       CALL section_release(sub_print_key)
    1954             :       ! Intrinsic Bond orbitals
    1955        8408 :       NULLIFY (sub_print_key)
    1956             :       CALL cp_print_key_section_create(sub_print_key, __LOCATION__, "BOND_ORBITALS", &
    1957             :                                        description="Calculate intrinsic bond orbitals using "// &
    1958             :                                        "localized MOs in IAO basis.", &
    1959             :                                        print_level=high_print_level, common_iter_levels=1, &
    1960        8408 :                                        add_last=add_last_numeric, filename="")
    1961             : 
    1962             :       CALL keyword_create(keyword, __LOCATION__, name="LOCALIZATION_OPERATOR", &
    1963             :                           description="Operator to be optimized for orbital localization", &
    1964             :                           enum_c_vals=s2a("PIPEK_MEZEY", "PIPEK_MEZEY_4", "L1NORM"), &
    1965             :                           enum_i_vals=(/do_iaoloc_pm2, do_iaoloc_pm4, do_iaoloc_l1/), &
    1966             :                           enum_desc=s2a("Use Pipek-Mezey operator (order 2)", &
    1967             :                                         "Use Pipek-Mezey operator (order 4)", &
    1968             :                                         "Use L1 norm"), &
    1969        8408 :                           default_i_val=do_iaoloc_pm2)
    1970        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1971        8408 :       CALL keyword_release(keyword)
    1972             :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_LOCALIZATION_FUNCTION", &
    1973             :                           description="Function for energy localization: f(e_i), e_i orbital energy", &
    1974             :                           enum_c_vals=s2a("NONE", "ENERGY", "OCCUPATION"), &
    1975             :                           enum_i_vals=(/do_iaoloc_enone, do_iaoloc_energy, do_iaoloc_occ/), &
    1976             :                           enum_desc=s2a("Don't use energy localization.", &
    1977             :                                         "Use orbital energies for localization.", &
    1978             :                                         "Use occupation numbers for localization."), &
    1979        8408 :                           default_i_val=do_iaoloc_enone)
    1980        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1981        8408 :       CALL keyword_release(keyword)
    1982             :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_LOCALIZATION_WEIGHT", &
    1983             :                           description="Weight given to energy localization, using f(e_i) function", &
    1984             :                           usage="ENERGY_LOCALIZATION_WEIGHT 0.1", n_var=1, &
    1985        8408 :                           default_r_val=0.0_dp, type_of_var=real_t)
    1986        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    1987        8408 :       CALL keyword_release(keyword)
    1988             : 
    1989             :       ! CHARGE CENTER AND SPREAD
    1990        8408 :       NULLIFY (subsection)
    1991             :       CALL cp_print_key_section_create(subsection, __LOCATION__, "CHARGE_CENTER", &
    1992             :                                        description="Calculation and printing of centers and spreads "// &
    1993             :                                        "of localized orbitals.", &
    1994             :                                        print_level=high_print_level, common_iter_levels=1, &
    1995        8408 :                                        add_last=add_last_numeric, filename="")
    1996             :       CALL keyword_create(keyword, __LOCATION__, name="POSITION_OPERATOR_BERRY", &
    1997             :                           description="Use Berry phase position operator.", &
    1998             :                           usage="POSITION_OPERATOR_BERRY T", n_var=1, &
    1999        8408 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    2000        8408 :       CALL section_add_keyword(subsection, keyword)
    2001        8408 :       CALL keyword_release(keyword)
    2002        8408 :       CALL section_add_subsection(sub_print_key, subsection)
    2003        8408 :       CALL section_release(subsection)
    2004             :       ! IBO_MOLDEN
    2005        8408 :       NULLIFY (subsection)
    2006             :       CALL cp_print_key_section_create(subsection, __LOCATION__, "IBO_MOLDEN", &
    2007             :                                        description="Write the IBO orbitals in Molden file format, for visualisation.", &
    2008        8408 :                                        print_level=debug_print_level + 1, add_last=add_last_numeric, filename="IBOBAS")
    2009             :       CALL keyword_create(keyword, __LOCATION__, name="NDIGITS", &
    2010             :                           description="Specifies the number of significant digits retained. 3 is OK for visualization.", &
    2011             :                           usage="NDIGITS {int}", &
    2012        8408 :                           default_i_val=3)
    2013        8408 :       CALL section_add_keyword(subsection, keyword)
    2014        8408 :       CALL keyword_release(keyword)
    2015             :       CALL keyword_create(keyword, __LOCATION__, name="GTO_KIND", &
    2016             :                           description="Representation of Gaussian-type orbitals", &
    2017             :                           default_i_val=gto_spherical, &
    2018             :                           enum_c_vals=s2a("CARTESIAN", "SPHERICAL"), &
    2019             :                           enum_desc=s2a( &
    2020             :                           "Cartesian Gaussian orbitals. Use with caution", &
    2021             :                           "Spherical Gaussian orbitals. Incompatible with VMD"), &
    2022        8408 :                           enum_i_vals=(/gto_cartesian, gto_spherical/))
    2023        8408 :       CALL section_add_keyword(subsection, keyword)
    2024        8408 :       CALL keyword_release(keyword)
    2025        8408 :       CALL section_add_subsection(sub_print_key, subsection)
    2026        8408 :       CALL section_release(subsection)
    2027             :       ! IAO_CUBES
    2028        8408 :       NULLIFY (subsection)
    2029             :       CALL cp_print_key_section_create(subsection, __LOCATION__, "IBO_CUBES", &
    2030             :                                        description="Controls the printing of the IBO orbitals "// &
    2031             :                                        "as *.cube files.", &
    2032             :                                        print_level=high_print_level, common_iter_levels=1, &
    2033        8408 :                                        add_last=add_last_numeric, filename="")
    2034             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    2035             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    2036             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    2037             :                           " 1 number valid for all components.", &
    2038        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    2039        8408 :       CALL section_add_keyword(subsection, keyword)
    2040        8408 :       CALL keyword_release(keyword)
    2041             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    2042             :                           description="append the cube files when they already exist", &
    2043        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2044        8408 :       CALL section_add_keyword(subsection, keyword)
    2045        8408 :       CALL keyword_release(keyword)
    2046             :       CALL keyword_create(keyword, __LOCATION__, name="STATE_LIST", &
    2047             :                           description="Indices of the orbitals to be included in IBO CUBE file printing. ", &
    2048             :                           usage="STATE_LIST {integer}  {integer} ..  {integer} ", &
    2049        8408 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    2050        8408 :       CALL section_add_keyword(subsection, keyword)
    2051        8408 :       CALL keyword_release(keyword)
    2052        8408 :       CALL section_add_subsection(sub_print_key, subsection)
    2053        8408 :       CALL section_release(subsection)
    2054        8408 :       CALL section_add_subsection(print_key, sub_print_key)
    2055        8408 :       CALL section_release(sub_print_key)
    2056             : 
    2057        8408 :       CALL section_add_subsection(section, print_key)
    2058        8408 :       CALL section_release(print_key)
    2059             :       ! END OF IAO_ANALYSIS SECTION
    2060             : 
    2061             :       !DOS from density matrix
    2062             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ENERGY_WINDOWS", &
    2063             :                                        description="Controls the printing of the DOS from the density matrix. "// &
    2064             :                                        "This allows the calculation of the DOS even in density matrix based "// &
    2065             :                                        "REAL_TIME_PROPAGATION and LS_SCF. "// &
    2066             :                                        "However, it requires a cubically scaling diagonalization of the Hamiltonian. "// &
    2067             :                                        "Hartree-Fock NYI, values will be wrong. "// &
    2068             :                                        "Careful, the orbitals in rtp/emd are not actually eigenstates of the Hamiltonian. "// &
    2069             :                                        "Assumes absence of spin polarization (so far).", &
    2070             :                                        print_level=high_print_level, common_iter_levels=3, &
    2071             :                                        each_iter_names=s2a("MD"), each_iter_values=(/100/), &
    2072        8408 :                                        add_last=add_last_numeric, filename="energy-windows")
    2073             :       CALL keyword_create(keyword, __LOCATION__, name="N_WINDOWS", &
    2074             :                           description="The number of energy windows.", &
    2075             :                           usage="N_WINDOWS 200", &
    2076        8408 :                           default_i_val=100)
    2077        8408 :       CALL section_add_keyword(print_key, keyword)
    2078        8408 :       CALL keyword_release(keyword)
    2079             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER", &
    2080             :                           description="Filtering threshold for sparse matrix operations.", &
    2081             :                           usage="EPS_FILTER 1.0E-6", &
    2082        8408 :                           default_r_val=1.0E-14_dp)
    2083        8408 :       CALL section_add_keyword(print_key, keyword)
    2084        8408 :       CALL keyword_release(keyword)
    2085             :       CALL keyword_create(keyword, __LOCATION__, name="RESTRICT_RANGE", &
    2086             :                           description="Restricts the energy windows to states close to the fermi level", &
    2087             :                           usage="RESTRICT_RANGE .TRUE.", &
    2088        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2089        8408 :       CALL section_add_keyword(print_key, keyword)
    2090        8408 :       CALL keyword_release(keyword)
    2091             :       CALL keyword_create(keyword, __LOCATION__, name="RANGE", &
    2092             :                           description="If the RESTRICT_RANGE keyword is set, then all energy widnows will"// &
    2093             :                           " be placed in an interval from from the fermi level minus to the fermi level plus this keyword", &
    2094             :                           usage="RANGE 1", &
    2095        8408 :                           default_r_val=1.0_dp)
    2096        8408 :       CALL section_add_keyword(print_key, keyword)
    2097        8408 :       CALL keyword_release(keyword)
    2098             :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_CUBES", &
    2099             :                           description="Print the energy windows to cube files", &
    2100             :                           usage="DENSITY_PROPAGATION .TRUE.", &
    2101        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2102        8408 :       CALL section_add_keyword(print_key, keyword)
    2103        8408 :       CALL keyword_release(keyword)
    2104             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    2105             :                           description="The stride (X,Y,Z) used to write the energy windows cube files (if enabled) "// &
    2106             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    2107             :                           " 1 number valid for all components.", &
    2108        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    2109        8408 :       CALL section_add_keyword(print_key, keyword)
    2110        8408 :       CALL keyword_release(keyword)
    2111        8408 :       CALL section_add_subsection(section, print_key)
    2112        8408 :       CALL section_release(print_key)
    2113             : 
    2114             :       ! Hamiltonian in CSR format
    2115             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "KS_CSR_WRITE", &
    2116             :                                        description="Write the KS matrix in CSR format into a file.", &
    2117        8408 :                                        print_level=debug_print_level, filename="")
    2118             :       CALL keyword_create(keyword, __LOCATION__, name="Threshold", &
    2119             :                           description="Threshold on the absolute value of the elements to be printed out. "// &
    2120             :                           "In CP2K all the elements in a (atomic) matrix block are considered non-zero, "// &
    2121             :                           "if the block contains at least one non-zero element.", &
    2122             :                           usage="THRESHOLD {real}", &
    2123             :                           repeats=.FALSE., &
    2124        8408 :                           default_r_val=0.0_dp)
    2125        8408 :       CALL section_add_keyword(print_key, keyword)
    2126        8408 :       CALL keyword_release(keyword)
    2127             :       CALL keyword_create(keyword, __LOCATION__, name="Upper_triangular", &
    2128             :                           description="Print only the upper triangular part of the matrix. ", &
    2129             :                           usage="UPPER_TRIANGULAR {logical}", &
    2130             :                           repeats=.FALSE., &
    2131             :                           default_l_val=.FALSE., &
    2132        8408 :                           lone_keyword_l_val=.TRUE.)
    2133        8408 :       CALL section_add_keyword(print_key, keyword)
    2134        8408 :       CALL keyword_release(keyword)
    2135             :       CALL keyword_create(keyword, __LOCATION__, name="Binary", &
    2136             :                           description="Whether or not to generate the file in a binary format. ", &
    2137             :                           usage="BINARY {logical}", &
    2138             :                           repeats=.FALSE., &
    2139             :                           default_l_val=.FALSE., &
    2140        8408 :                           lone_keyword_l_val=.TRUE.)
    2141        8408 :       CALL section_add_keyword(print_key, keyword)
    2142        8408 :       CALL keyword_release(keyword)
    2143             :       CALL keyword_create(keyword, __LOCATION__, name="Real_space", &
    2144             :                           description="Print the KS matrix in real-space instead of k-space.. ", &
    2145             :                           usage="REAL_SPACE {logical}", &
    2146             :                           repeats=.FALSE., &
    2147             :                           default_l_val=.FALSE., &
    2148        8408 :                           lone_keyword_l_val=.TRUE.)
    2149        8408 :       CALL section_add_keyword(print_key, keyword)
    2150        8408 :       CALL keyword_release(keyword)
    2151        8408 :       CALL section_add_subsection(section, print_key)
    2152        8408 :       CALL section_release(print_key)
    2153             : 
    2154             :       ! Overlap in CSR format
    2155             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "S_CSR_WRITE", &
    2156             :                                        description="Write the overlap matrix in CSR format into a file.", &
    2157        8408 :                                        print_level=debug_print_level, filename="")
    2158             :       CALL keyword_create(keyword, __LOCATION__, name="Threshold", &
    2159             :                           description="Threshold on the absolute value of the elements to be printed out. "// &
    2160             :                           "In CP2K all the elements in a (atomic) matrix block are considered non-zero, "// &
    2161             :                           "if the block contains at least one non-zero element.", &
    2162             :                           usage="THRESHOLD {real}", &
    2163             :                           repeats=.FALSE., &
    2164        8408 :                           default_r_val=0.0_dp)
    2165        8408 :       CALL section_add_keyword(print_key, keyword)
    2166        8408 :       CALL keyword_release(keyword)
    2167             :       CALL keyword_create(keyword, __LOCATION__, name="Upper_triangular", &
    2168             :                           description="Print only the upper triangular part of the matrix. ", &
    2169             :                           usage="UPPER_TRIANGULAR {logical}", &
    2170             :                           repeats=.FALSE., &
    2171             :                           default_l_val=.FALSE., &
    2172        8408 :                           lone_keyword_l_val=.TRUE.)
    2173        8408 :       CALL section_add_keyword(print_key, keyword)
    2174        8408 :       CALL keyword_release(keyword)
    2175             :       CALL keyword_create(keyword, __LOCATION__, name="Binary", &
    2176             :                           description="Whether or not to generate the file in a binary format. ", &
    2177             :                           usage="BINARY {logical}", &
    2178             :                           repeats=.FALSE., &
    2179             :                           default_l_val=.FALSE., &
    2180        8408 :                           lone_keyword_l_val=.TRUE.)
    2181        8408 :       CALL section_add_keyword(print_key, keyword)
    2182        8408 :       CALL keyword_release(keyword)
    2183             :       CALL keyword_create(keyword, __LOCATION__, name="Real_space", &
    2184             :                           description="Print the overlap matrix in real-space instead of k-space.. ", &
    2185             :                           usage="REAL_SPACE {logical}", &
    2186             :                           repeats=.FALSE., &
    2187             :                           default_l_val=.FALSE., &
    2188        8408 :                           lone_keyword_l_val=.TRUE.)
    2189        8408 :       CALL section_add_keyword(print_key, keyword)
    2190        8408 :       CALL keyword_release(keyword)
    2191        8408 :       CALL section_add_subsection(section, print_key)
    2192        8408 :       CALL section_release(print_key)
    2193             : 
    2194             :       ! interaction adjacency matrix
    2195             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ADJMAT_WRITE", &
    2196             :                                        description="Writes an (upper-triangular) adjacency matrix indicating the "// &
    2197             :                                        "interaction between atoms (according to overlapping basis functions). The "// &
    2198             :                                        "columns are: iatom, jatom, ikind, jkind; where iatom and jatom are the atom "// &
    2199             :                                        "indices (based on the coordinate file), ikind and jkind are the atomic kinds "// &
    2200             :                                        "(indeces as shown in the ATOMIC KIND INFORMATION section of a CP2K output). ", &
    2201        8408 :                                        print_level=debug_print_level, filename="")
    2202        8408 :       CALL section_add_subsection(section, print_key)
    2203        8408 :       CALL section_release(print_key)
    2204             : 
    2205             :       ! Xray diffraction
    2206             :       CALL cp_print_key_section_create( &
    2207             :          print_key, __LOCATION__, name="XRAY_DIFFRACTION_SPECTRUM", &
    2208             :          description="Calculate and print the coherent X-ray "// &
    2209             :          "diffraction spectrum", &
    2210             :          print_level=debug_print_level, &
    2211             :          filename="", &
    2212       25224 :          citations=(/Krack2000, Krack2002/))
    2213             :       CALL keyword_create( &
    2214             :          keyword, __LOCATION__, &
    2215             :          name="Q_MAX", &
    2216             :          variants=(/"Q_MAXIMUM"/), &
    2217             :          description="Maximum Q value calculated for the spectrum", &
    2218             :          usage="Q_MAX {real}", &
    2219             :          repeats=.FALSE., &
    2220             :          n_var=1, &
    2221             :          type_of_var=real_t, &
    2222             :          default_r_val=cp_unit_to_cp2k(value=20.0_dp, &
    2223             :                                        unit_str="angstrom^-1"), &
    2224       16816 :          unit_str="angstrom^-1")
    2225        8408 :       CALL section_add_keyword(print_key, keyword)
    2226        8408 :       CALL keyword_release(keyword)
    2227        8408 :       CALL section_add_subsection(section, print_key)
    2228        8408 :       CALL section_release(print_key)
    2229             : 
    2230             :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="ELECTRIC_FIELD_GRADIENT", &
    2231             :                                        description="Calculate and print the electric field gradients "// &
    2232             :                                        "at atomic positions", &
    2233             :                                        print_level=debug_print_level, &
    2234        8408 :                                        filename="__STD_OUT__")
    2235             : 
    2236             :       CALL keyword_create(keyword, __LOCATION__, &
    2237             :                           name="INTERPOLATION", &
    2238             :                           description="Use interpolation method from real space grid", &
    2239             :                           usage="INTERPOLATION {logical}", &
    2240             :                           repeats=.FALSE., &
    2241             :                           n_var=1, &
    2242        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2243        8408 :       CALL section_add_keyword(print_key, keyword)
    2244        8408 :       CALL keyword_release(keyword)
    2245             : 
    2246             :       CALL keyword_create(keyword, __LOCATION__, &
    2247             :                           name="GSPACE_SMOOTHING", &
    2248             :                           description="Use a G-space smoothing function", &
    2249             :                           usage="GSPACE_SMOOTHING cutoff {real}, width {real}", &
    2250             :                           repeats=.FALSE., &
    2251             :                           n_var=2, default_r_vals=(/-1._dp, -1._dp/), &
    2252        8408 :                           type_of_var=real_t)
    2253        8408 :       CALL section_add_keyword(print_key, keyword)
    2254        8408 :       CALL keyword_release(keyword)
    2255             : 
    2256             :       CALL keyword_create(keyword, __LOCATION__, &
    2257             :                           name="DEBUG", &
    2258             :                           description="Print additional debug output", &
    2259             :                           usage="DEBUG {logical}", &
    2260             :                           repeats=.FALSE., &
    2261             :                           n_var=1, &
    2262        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2263        8408 :       CALL section_add_keyword(print_key, keyword)
    2264        8408 :       CALL keyword_release(keyword)
    2265             : 
    2266        8408 :       CALL create_gspace_interp_section(subsection)
    2267        8408 :       CALL section_add_subsection(print_key, subsection)
    2268        8408 :       CALL section_release(subsection)
    2269             : 
    2270        8408 :       CALL section_add_subsection(section, print_key)
    2271        8408 :       CALL section_release(print_key)
    2272             : 
    2273             :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="BASIS_MOLOPT_QUANTITIES", &
    2274             :                                        description="Print the two quantities needed in the basis molopt generation:"// &
    2275             :                                        " total energy and condition number of the overlap matrix (S matrix)", &
    2276             :                                        print_level=debug_print_level, &
    2277        8408 :                                        filename="__STD_OUT__")
    2278        8408 :       CALL section_add_subsection(section, print_key)
    2279        8408 :       CALL section_release(print_key)
    2280             : 
    2281             :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="HYPERFINE_COUPLING_TENSOR", &
    2282             :                                        description="Calculate and print the EPR hyperfine coupling tensor"// &
    2283             :                                        " at atomic positions", &
    2284             :                                        print_level=debug_print_level, &
    2285        8408 :                                        filename="__STD_OUT__")
    2286             : 
    2287             :       CALL keyword_create(keyword, __LOCATION__, &
    2288             :                           name="INTERACTION_RADIUS", &
    2289             :                           description="Radius of interaction for EPR hyperfine tensor calculation", &
    2290             :                           usage="INTERACTION_RADIUS radius {real}", &
    2291             :                           repeats=.FALSE., &
    2292             :                           n_var=1, default_r_val=10._dp, &
    2293        8408 :                           type_of_var=real_t)
    2294        8408 :       CALL section_add_keyword(print_key, keyword)
    2295        8408 :       CALL keyword_release(keyword)
    2296             : 
    2297        8408 :       CALL section_add_subsection(section, print_key)
    2298        8408 :       CALL section_release(print_key)
    2299             : 
    2300             :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="OPTIMIZE_LRI_BASIS", &
    2301             :                                        description="Optimize the exponents of the LRI basis set", &
    2302             :                                        print_level=low_print_level, &
    2303        8408 :                                        filename="OPTIMIZED_LRI_BASIS")
    2304        8408 :       CALL section_add_subsection(section, print_key)
    2305        8408 :       CALL section_release(print_key)
    2306             : 
    2307             :       CALL cp_print_key_section_create( &
    2308             :          print_key, __LOCATION__, name="PLUS_U", &
    2309             :          description="Controls the printing for the DFT+U methods", &
    2310             :          print_level=high_print_level, &
    2311             :          filename="__STD_OUT__", &
    2312             :          each_iter_names=s2a("QS_SCF"), &
    2313             :          each_iter_values=(/0/), &
    2314       25224 :          citations=(/Dudarev1997, Dudarev1998/))
    2315        8408 :       CALL section_add_subsection(section, print_key)
    2316        8408 :       CALL section_release(print_key)
    2317             : 
    2318             :       CALL cp_print_key_section_create( &
    2319             :          print_key, __LOCATION__, name="CHARGEMOL", &
    2320             :          description="Write .wfx input file for Chargemol", &
    2321             :          print_level=debug_print_level + 1, &
    2322             :          filename="CHARGEMOL", &
    2323        8408 :          add_last=add_last_numeric)
    2324             :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    2325             :                           description="Specifies the maximum number of backup copies.", &
    2326             :                           usage="BACKUP_COPIES {int}", &
    2327        8408 :                           default_i_val=1)
    2328        8408 :       CALL section_add_keyword(print_key, keyword)
    2329        8408 :       CALL keyword_release(keyword)
    2330             :       CALL keyword_create(keyword, __LOCATION__, name="PERIODIC", &
    2331             :                           description="Write information about cell periodicity.", &
    2332             :                           usage="PERIODIC {LOGICAL}", &
    2333        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2334        8408 :       CALL section_add_keyword(print_key, keyword)
    2335        8408 :       CALL keyword_release(keyword)
    2336        8408 :       CALL section_add_subsection(section, print_key)
    2337        8408 :       CALL section_release(print_key)
    2338             : 
    2339             :       CALL cp_print_key_section_create( &
    2340             :          print_key, __LOCATION__, name="SCCS", &
    2341             :          description="Controls the printing for the SCCS models", &
    2342             :          print_level=high_print_level, &
    2343             :          filename="__STD_OUT__", &
    2344             :          each_iter_names=s2a("QS_SCF"), &
    2345             :          each_iter_values=(/0/), &
    2346       33632 :          citations=(/Fattebert2002, Andreussi2012, Yin2017/))
    2347             : 
    2348        8408 :       NULLIFY (sub_print_key)
    2349             : 
    2350             :       CALL cp_print_key_section_create( &
    2351             :          sub_print_key, __LOCATION__, name="DENSITY_GRADIENT", &
    2352             :          description="Controls the printing of the cube files with "// &
    2353             :          "the norm of the density gradient |&nabla;&rho;| "// &
    2354             :          "used by the SCCS model.", &
    2355             :          print_level=debug_print_level, &
    2356             :          filename="", &
    2357             :          each_iter_names=s2a("QS_SCF"), &
    2358        8408 :          each_iter_values=(/0/))
    2359             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    2360             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    2361             :                           "(larger values result in smaller cube files). You can provide 3 "// &
    2362             :                           "numbers (for X,Y,Z) or 1 number valid for all components.", &
    2363             :                           n_var=-1, &
    2364             :                           default_i_vals=(/2, 2, 2/), &
    2365             :                           type_of_var=integer_t, &
    2366        8408 :                           repeats=.FALSE.)
    2367        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    2368        8408 :       CALL keyword_release(keyword)
    2369             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    2370             :                           description="Append the cube files when they already exist", &
    2371             :                           default_l_val=.FALSE., &
    2372             :                           lone_keyword_l_val=.TRUE., &
    2373        8408 :                           repeats=.FALSE.)
    2374        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    2375        8408 :       CALL keyword_release(keyword)
    2376        8408 :       CALL section_add_subsection(print_key, sub_print_key)
    2377        8408 :       CALL section_release(sub_print_key)
    2378             : 
    2379             :       CALL cp_print_key_section_create( &
    2380             :          sub_print_key, __LOCATION__, name="DIELECTRIC_FUNCTION", &
    2381             :          description="Controls the printing of the cube files with "// &
    2382             :          "the dielectric function used by the SCCS model. "// &
    2383             :          "This function determines the cavity formed by a solute in "// &
    2384             :          "a solvent and thus it can be used for the visualisaton of the cavity.", &
    2385             :          print_level=debug_print_level, &
    2386             :          filename="", &
    2387             :          each_iter_names=s2a("QS_SCF"), &
    2388             :          each_iter_values=(/0/), &
    2389       33632 :          citations=(/Fattebert2002, Andreussi2012, Yin2017/))
    2390             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    2391             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    2392             :                           "(larger values result in smaller cube files). You can provide 3 "// &
    2393             :                           "numbers (for X,Y,Z) or 1 number valid for all components.", &
    2394             :                           n_var=-1, &
    2395             :                           default_i_vals=(/2, 2, 2/), &
    2396             :                           type_of_var=integer_t, &
    2397        8408 :                           repeats=.FALSE.)
    2398        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    2399        8408 :       CALL keyword_release(keyword)
    2400             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    2401             :                           description="Append the cube files when they already exist", &
    2402             :                           default_l_val=.FALSE., &
    2403             :                           lone_keyword_l_val=.TRUE., &
    2404        8408 :                           repeats=.FALSE.)
    2405        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    2406        8408 :       CALL keyword_release(keyword)
    2407        8408 :       CALL section_add_subsection(print_key, sub_print_key)
    2408        8408 :       CALL section_release(sub_print_key)
    2409             : 
    2410             :       CALL cp_print_key_section_create( &
    2411             :          sub_print_key, __LOCATION__, name="TOTAL_CHARGE_DENSITY", &
    2412             :          description="Controls the printing of the cube files with the "// &
    2413             :          "total charge density $\rho^\text{tot}$ used by the SCCS model.", &
    2414             :          print_level=debug_print_level, &
    2415             :          filename="", &
    2416             :          each_iter_names=s2a("QS_SCF"), &
    2417             :          each_iter_values=(/0/), &
    2418       33632 :          citations=(/Fattebert2002, Andreussi2012, Yin2017/))
    2419             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    2420             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    2421             :                           "(larger values result in smaller cube files). You can provide 3 "// &
    2422             :                           "numbers (for X,Y,Z) or 1 number valid for all components.", &
    2423             :                           n_var=-1, &
    2424             :                           default_i_vals=(/2, 2, 2/), &
    2425             :                           type_of_var=integer_t, &
    2426        8408 :                           repeats=.FALSE.)
    2427        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    2428        8408 :       CALL keyword_release(keyword)
    2429             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    2430             :                           description="Append the cube files when they already exist", &
    2431             :                           default_l_val=.FALSE., &
    2432             :                           lone_keyword_l_val=.TRUE., &
    2433        8408 :                           repeats=.FALSE.)
    2434        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    2435        8408 :       CALL keyword_release(keyword)
    2436        8408 :       CALL section_add_subsection(print_key, sub_print_key)
    2437        8408 :       CALL section_release(sub_print_key)
    2438             : 
    2439             :       CALL cp_print_key_section_create( &
    2440             :          sub_print_key, __LOCATION__, name="POLARISATION_CHARGE_DENSITY", &
    2441             :          description="Controls the printing of the cube files with the "// &
    2442             :          "polarisation charge density $\rho^\text{pol}$ used by the SCCS model with the "// &
    2443             :          "total charge density $\rho^\text{tot} = \rho^\text{sol} + \rho^\text{pol}", &
    2444             :          print_level=debug_print_level, &
    2445             :          filename="", &
    2446             :          each_iter_names=s2a("QS_SCF"), &
    2447             :          each_iter_values=(/0/), &
    2448       33632 :          citations=(/Fattebert2002, Andreussi2012, Yin2017/))
    2449             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    2450             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    2451             :                           "(larger values result in smaller cube files). You can provide 3 "// &
    2452             :                           "numbers (for X,Y,Z) or 1 number valid for all components.", &
    2453             :                           n_var=-1, &
    2454             :                           default_i_vals=(/2, 2, 2/), &
    2455             :                           type_of_var=integer_t, &
    2456        8408 :                           repeats=.FALSE.)
    2457        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    2458        8408 :       CALL keyword_release(keyword)
    2459             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    2460             :                           description="Append the cube files when they already exist", &
    2461             :                           default_l_val=.FALSE., &
    2462             :                           lone_keyword_l_val=.TRUE., &
    2463        8408 :                           repeats=.FALSE.)
    2464        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    2465        8408 :       CALL keyword_release(keyword)
    2466        8408 :       CALL section_add_subsection(print_key, sub_print_key)
    2467        8408 :       CALL section_release(sub_print_key)
    2468             : 
    2469             :       CALL cp_print_key_section_create( &
    2470             :          sub_print_key, __LOCATION__, name="POLARISATION_POTENTIAL", &
    2471             :          description="Controls the printing of the cube files with the "// &
    2472             :          "polarisation potential $\phi^\text{pol}$ used by the SCCS model with the "// &
    2473             :          "total potential $\phi^\text{tot} = \phi^\text{sol} + \phi^\text{pol}$", &
    2474             :          print_level=debug_print_level, &
    2475             :          filename="", &
    2476             :          each_iter_names=s2a("QS_SCF"), &
    2477             :          each_iter_values=(/0/), &
    2478       33632 :          citations=(/Fattebert2002, Andreussi2012, Yin2017/))
    2479             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    2480             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    2481             :                           "(larger values result in smaller cube files). You can provide 3 "// &
    2482             :                           "numbers (for X,Y,Z) or 1 number valid for all components.", &
    2483             :                           n_var=-1, &
    2484             :                           default_i_vals=(/2, 2, 2/), &
    2485             :                           type_of_var=integer_t, &
    2486        8408 :                           repeats=.FALSE.)
    2487        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    2488        8408 :       CALL keyword_release(keyword)
    2489             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    2490             :                           description="Append the cube files when they already exist", &
    2491             :                           default_l_val=.FALSE., &
    2492             :                           lone_keyword_l_val=.TRUE., &
    2493        8408 :                           repeats=.FALSE.)
    2494        8408 :       CALL section_add_keyword(sub_print_key, keyword)
    2495        8408 :       CALL keyword_release(keyword)
    2496        8408 :       CALL section_add_subsection(print_key, sub_print_key)
    2497        8408 :       CALL section_release(sub_print_key)
    2498             : 
    2499        8408 :       CALL section_add_subsection(section, print_key)
    2500        8408 :       CALL section_release(print_key)
    2501             : 
    2502        8408 :    END SUBROUTINE create_print_dft_section
    2503             : 
    2504             : ! **************************************************************************************************
    2505             : !> \brief ...
    2506             : !> \param section ...
    2507             : !> \author JGH
    2508             : ! **************************************************************************************************
    2509        8408 :    SUBROUTINE create_bandstructure_section(section)
    2510             :       TYPE(section_type), POINTER                        :: section
    2511             : 
    2512             :       TYPE(keyword_type), POINTER                        :: keyword
    2513             :       TYPE(section_type), POINTER                        :: subsection
    2514             : 
    2515        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    2516             :       CALL section_create(section, __LOCATION__, name="BAND_STRUCTURE", &
    2517             :                           description="Specifies the k-points used in band structure calculation.", &
    2518        8408 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
    2519             : 
    2520        8408 :       NULLIFY (keyword)
    2521             :       CALL keyword_create(keyword, __LOCATION__, name="FILE_NAME", &
    2522             :                           description="File name used for band structure", &
    2523             :                           usage="FILE_NAME <filename>", default_c_val="", &
    2524        8408 :                           type_of_var=char_t, n_var=1)
    2525        8408 :       CALL section_add_keyword(section, keyword)
    2526        8408 :       CALL keyword_release(keyword)
    2527             : 
    2528             :       CALL keyword_create(keyword, __LOCATION__, name="ADDED_MOS", &
    2529             :                           variants=(/"ADDED_BANDS"/), &
    2530             :                           description="Number of MOs/Bands added to the Band Structure calculation.", &
    2531       16816 :                           default_i_val=0)
    2532        8408 :       CALL section_add_keyword(section, keyword)
    2533        8408 :       CALL keyword_release(keyword)
    2534             : 
    2535        8408 :       NULLIFY (subsection)
    2536        8408 :       CALL create_kpoint_set_section(subsection)
    2537        8408 :       CALL section_add_subsection(section, subsection)
    2538        8408 :       CALL section_release(subsection)
    2539             : 
    2540        8408 :    END SUBROUTINE create_bandstructure_section
    2541             : 
    2542             : ! **************************************************************************************************
    2543             : !> \brief creates the input section for dealing with homo lumos, including dumping cubes
    2544             : !> \param print_key ...
    2545             : ! **************************************************************************************************
    2546        8408 :    SUBROUTINE create_mo_cubes_section(print_key)
    2547             :       TYPE(section_type), POINTER                        :: print_key
    2548             : 
    2549             :       TYPE(keyword_type), POINTER                        :: keyword
    2550             : 
    2551        8408 :       NULLIFY (keyword)
    2552             : 
    2553             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MO_CUBES", &
    2554             :                                        description="Controls the printing of the molecular orbitals (MOs) as cube files."// &
    2555             :                                        " It can be used during a Real Time calculation to print the MOs."// &
    2556             :                                        " In this case, the density corresponding to the time dependent MO is printed"// &
    2557             :                                        " instead of the wave-function.", &
    2558        8408 :                                        print_level=high_print_level, filename="")
    2559             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    2560             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    2561             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    2562             :                           " 1 number valid for all components.", &
    2563        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    2564        8408 :       CALL section_add_keyword(print_key, keyword)
    2565        8408 :       CALL keyword_release(keyword)
    2566             : 
    2567             :       CALL keyword_create(keyword, __LOCATION__, name="write_cube", &
    2568             :                           description="If the MO cube file should be written. If false, the eigenvalues are still computed."// &
    2569             :                           " Can also be useful in combination with STM calculations", &
    2570        8408 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    2571        8408 :       CALL section_add_keyword(print_key, keyword)
    2572        8408 :       CALL keyword_release(keyword)
    2573             : 
    2574             :       CALL keyword_create(keyword, __LOCATION__, name="nlumo", &
    2575             :                           description="If the printkey is activated controls the number of lumos"// &
    2576             :                           " that are printed and dumped as a cube (-1=all)", &
    2577        8408 :                           default_i_val=0)
    2578        8408 :       CALL section_add_keyword(print_key, keyword)
    2579        8408 :       CALL keyword_release(keyword)
    2580             :       CALL keyword_create( &
    2581             :          keyword, __LOCATION__, name="nhomo", &
    2582             :          description="If the printkey is activated controls the number of homos that dumped as a cube (-1=all),"// &
    2583             :          " eigenvalues are always all dumped", &
    2584        8408 :          default_i_val=1)
    2585        8408 :       CALL section_add_keyword(print_key, keyword)
    2586        8408 :       CALL keyword_release(keyword)
    2587             : 
    2588             :       CALL keyword_create( &
    2589             :          keyword, __LOCATION__, name="homo_list", &
    2590             :          description="If the printkey is activated controls the index of homos dumped as a cube,"// &
    2591             :          " eigenvalues are always all dumped. It overrides nhomo.", &
    2592             :          usage="HOMO_LIST {integer}  {integer} ..  {integer} ", type_of_var=integer_t, &
    2593        8408 :          n_var=-1, repeats=.TRUE.)
    2594        8408 :       CALL section_add_keyword(print_key, keyword)
    2595        8408 :       CALL keyword_release(keyword)
    2596             : 
    2597             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    2598             :                           description="append the cube files when they already exist", &
    2599        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2600        8408 :       CALL section_add_keyword(print_key, keyword)
    2601        8408 :       CALL keyword_release(keyword)
    2602             : 
    2603        8408 :    END SUBROUTINE create_mo_cubes_section
    2604             : 
    2605             : ! **************************************************************************************************
    2606             : !> \brief ...
    2607             : !> \param print_key ...
    2608             : ! **************************************************************************************************
    2609        8408 :    SUBROUTINE create_dos_section(print_key)
    2610             : 
    2611             :       TYPE(section_type), POINTER                        :: print_key
    2612             : 
    2613             :       TYPE(keyword_type), POINTER                        :: keyword
    2614             : 
    2615        8408 :       NULLIFY (keyword)
    2616             : 
    2617             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "DOS", &
    2618             :                                        description="Print Density of States (DOS) (only available states from SCF)", &
    2619        8408 :                                        print_level=debug_print_level, common_iter_levels=1, filename="")
    2620             : 
    2621             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    2622             :                           description="Append the DOS obtained at different iterations to the output file. "// &
    2623             :                           "By default the file is overwritten", &
    2624             :                           usage="APPEND", default_l_val=.FALSE., &
    2625        8408 :                           lone_keyword_l_val=.TRUE.)
    2626        8408 :       CALL section_add_keyword(print_key, keyword)
    2627        8408 :       CALL keyword_release(keyword)
    2628             : 
    2629             :       CALL keyword_create(keyword, __LOCATION__, name="DELTA_E", &
    2630             :                           description="Histogramm energy spacing.", &
    2631        8408 :                           usage="DELTA_E 0.0005", type_of_var=real_t, default_r_val=0.001_dp)
    2632        8408 :       CALL section_add_keyword(print_key, keyword)
    2633        8408 :       CALL keyword_release(keyword)
    2634             : 
    2635             :       CALL keyword_create(keyword, __LOCATION__, name="NDIGITS", &
    2636             :                           description="Specify the number of digits used to print density and occupation", &
    2637        8408 :                           default_i_val=4)
    2638        8408 :       CALL section_add_keyword(print_key, keyword)
    2639        8408 :       CALL keyword_release(keyword)
    2640             : 
    2641        8408 :    END SUBROUTINE create_dos_section
    2642             : 
    2643             : ! **************************************************************************************************
    2644             : !> \brief ...
    2645             : !> \param print_key ...
    2646             : ! **************************************************************************************************
    2647       25224 :    SUBROUTINE create_pdos_section(print_key)
    2648             : 
    2649             :       TYPE(section_type), POINTER                        :: print_key
    2650             : 
    2651             :       TYPE(keyword_type), POINTER                        :: keyword
    2652             :       TYPE(section_type), POINTER                        :: subsection
    2653             : 
    2654       25224 :       NULLIFY (subsection)
    2655       25224 :       NULLIFY (keyword)
    2656             : 
    2657             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PDOS", &
    2658             :                                        description="Print out the DOS projected per kind and per angular momentum  ", &
    2659       25224 :                                        print_level=debug_print_level, common_iter_levels=1, filename="")
    2660             :       CALL keyword_create(keyword, __LOCATION__, name="COMPONENTS", &
    2661             :                           description="Print out pdos distinguishing all angular momentum components.", &
    2662             :                           usage="COMPONENTS", default_l_val=.FALSE., &
    2663       25224 :                           lone_keyword_l_val=.TRUE.)
    2664       25224 :       CALL section_add_keyword(print_key, keyword)
    2665       25224 :       CALL keyword_release(keyword)
    2666             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    2667             :                           description="Append the pdos obtained at different iterations to the pdos  output file. "// &
    2668             :                           "By default the file is overwritten", &
    2669             :                           usage="APPEND", default_l_val=.FALSE., &
    2670       25224 :                           lone_keyword_l_val=.TRUE.)
    2671       25224 :       CALL section_add_keyword(print_key, keyword)
    2672       25224 :       CALL keyword_release(keyword)
    2673             :       CALL keyword_create( &
    2674             :          keyword, __LOCATION__, name="NLUMO", &
    2675             :          description="Number of virtual orbitals to be added to the MO set (-1=all)."//newline// &
    2676             :          "CAUTION: Setting this value to be higher than the number of states present may cause a Cholesky error.", &
    2677       25224 :          usage="NLUMO integer", default_i_val=0)
    2678       25224 :       CALL section_add_keyword(print_key, keyword)
    2679       25224 :       CALL keyword_release(keyword)
    2680             :       CALL keyword_create(keyword, __LOCATION__, name="OUT_EACH_MO", &
    2681             :                           description="Output on the status of the calculation every OUT_EACH_MO states. If -1 no output", &
    2682       25224 :                           usage="OUT_EACH_MO integer", default_i_val=-1)
    2683       25224 :       CALL section_add_keyword(print_key, keyword)
    2684       25224 :       CALL keyword_release(keyword)
    2685             : 
    2686             :       CALL section_create(subsection, __LOCATION__, name="LDOS", &
    2687             :                           description="Controls the printing of local PDOS, projected on subsets"// &
    2688             :                           " of atoms given through lists", &
    2689       25224 :                           n_keywords=4, n_subsections=0, repeats=.TRUE.)
    2690             :       CALL keyword_create(keyword, __LOCATION__, name="COMPONENTS", &
    2691             :                           description="Print out pdos distinguishing all angular momentum components.", &
    2692             :                           usage="COMPONENTS", default_l_val=.FALSE., &
    2693       25224 :                           lone_keyword_l_val=.TRUE.)
    2694       25224 :       CALL section_add_keyword(subsection, keyword)
    2695       25224 :       CALL keyword_release(keyword)
    2696             : 
    2697             :       CALL keyword_create(keyword, __LOCATION__, name="LIST", &
    2698             :                           description="Specifies a list of indexes of atoms where to project the DOS  ", &
    2699             :                           usage="LIST {integer}  {integer} ..  {integer} ", type_of_var=integer_t, &
    2700       25224 :                           n_var=-1, repeats=.TRUE.)
    2701       25224 :       CALL section_add_keyword(subsection, keyword)
    2702       25224 :       CALL keyword_release(keyword)
    2703             : 
    2704       25224 :       CALL section_add_subsection(print_key, subsection)
    2705       25224 :       CALL section_release(subsection)
    2706             : 
    2707             :       CALL section_create(subsection, __LOCATION__, name="R_LDOS", &
    2708             :                           description="Controls the printing of local PDOS, projected on 3D volume in real space,"// &
    2709             :                           " the volume is defined in terms of position with respect to atoms in the lists", &
    2710       25224 :                           n_keywords=4, n_subsections=0, repeats=.TRUE.)
    2711             : 
    2712             :       CALL keyword_create(keyword, __LOCATION__, name="LIST", &
    2713             :                           description="Specifies a list of indexes of atoms used to define the real space volume  ", &
    2714             :                           usage="LIST {integer}  {integer} ..  {integer} ", type_of_var=integer_t, &
    2715       25224 :                           n_var=-1, repeats=.TRUE.)
    2716       25224 :       CALL section_add_keyword(subsection, keyword)
    2717       25224 :       CALL keyword_release(keyword)
    2718             : 
    2719             :       CALL keyword_create(keyword, __LOCATION__, name="XRANGE", &
    2720             :                           description="range of positions in Cartesian direction x: all grid points within "// &
    2721             :                           "this range from at least one atom of the list are considered", &
    2722       25224 :                           usage="XRANGE -10.0 10.0", unit_str="angstrom", n_var=2, type_of_var=real_t)
    2723       25224 :       CALL section_add_keyword(subsection, keyword)
    2724       25224 :       CALL keyword_release(keyword)
    2725             :       CALL keyword_create(keyword, __LOCATION__, name="YRANGE", &
    2726             :                           description="range of positions in Cartesian direction y: all grid points within "// &
    2727             :                           "this range from at least one atom of the list are considered", &
    2728       25224 :                           usage="YRANGE -10.0 10.0", unit_str="angstrom", n_var=2, type_of_var=real_t)
    2729       25224 :       CALL section_add_keyword(subsection, keyword)
    2730       25224 :       CALL keyword_release(keyword)
    2731             :       CALL keyword_create(keyword, __LOCATION__, name="ZRANGE", &
    2732             :                           description="range of positions in Cartesian direction z: all grid points within "// &
    2733             :                           "this range from at least one atom of the list are considered", &
    2734       25224 :                           usage="ZRANGE -10.0 10.0", unit_str="angstrom", n_var=2, type_of_var=real_t)
    2735       25224 :       CALL section_add_keyword(subsection, keyword)
    2736       25224 :       CALL keyword_release(keyword)
    2737             : 
    2738             :       CALL keyword_create(keyword, __LOCATION__, name="ERANGE", &
    2739             :                           description="only project states with the eigenvalues in the given interval. "// &
    2740             :                           "Default is all states.", &
    2741       25224 :                           usage="ERANGE -1.0 1.0", unit_str="hartree", n_var=2, type_of_var=real_t)
    2742       25224 :       CALL section_add_keyword(subsection, keyword)
    2743       25224 :       CALL keyword_release(keyword)
    2744             : 
    2745       25224 :       CALL section_add_subsection(print_key, subsection)
    2746       25224 :       CALL section_release(subsection)
    2747             : 
    2748       25224 :    END SUBROUTINE create_pdos_section
    2749             : 
    2750             : ! **************************************************************************************************
    2751             : !> \brief ...
    2752             : !> \param print_key ...
    2753             : ! **************************************************************************************************
    2754        8408 :    SUBROUTINE create_wannier_section(print_key)
    2755             : 
    2756             :       TYPE(section_type), POINTER                        :: print_key
    2757             : 
    2758             :       TYPE(keyword_type), POINTER                        :: keyword
    2759             : 
    2760        8408 :       NULLIFY (keyword)
    2761             : 
    2762             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "WANNIER90", &
    2763             :                                        description="Interface to Wannier90 code. (EXPERIMENTAL)", &
    2764        8408 :                                        print_level=debug_print_level, common_iter_levels=1, filename="")
    2765             : 
    2766             :       CALL keyword_create(keyword, __LOCATION__, name="SEED_NAME", &
    2767             :                           description="The seedname for the Wannier90 calculation (body of filenames).", &
    2768             :                           usage="SEED_NAME  filename", default_c_val="wannier90", &
    2769        8408 :                           n_var=1, type_of_var=char_t)
    2770        8408 :       CALL section_add_keyword(print_key, keyword)
    2771        8408 :       CALL keyword_release(keyword)
    2772             : 
    2773             :       CALL keyword_create(keyword, __LOCATION__, name="MP_GRID", &
    2774             :                           description="The dimensions of the Monkhorst-Pack k-point grid. ", &
    2775        8408 :                           usage="MP_GRID 6 6 6", n_var=-1, default_i_vals=(/10, 10, 10/), type_of_var=integer_t)
    2776        8408 :       CALL section_add_keyword(print_key, keyword)
    2777        8408 :       CALL keyword_release(keyword)
    2778             : 
    2779             :       CALL keyword_create(keyword, __LOCATION__, name="ADDED_MOS", &
    2780             :                           variants=(/"ADDED_BANDS"/), &
    2781             :                           description="Number of MOs/Bands added to the Band Structure calculation.", &
    2782       16816 :                           default_i_val=0)
    2783        8408 :       CALL section_add_keyword(print_key, keyword)
    2784        8408 :       CALL keyword_release(keyword)
    2785             : 
    2786             :       CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_BANDS", &
    2787             :                           description="List of Bands excluded in the Wannier calculation.", &
    2788             :                           usage="EXCLUDE_BANDS b1 b2 ...", n_var=-1, repeats=.TRUE., &
    2789        8408 :                           type_of_var=integer_t)
    2790        8408 :       CALL section_add_keyword(print_key, keyword)
    2791        8408 :       CALL keyword_release(keyword)
    2792             : 
    2793             :       CALL keyword_create(keyword, __LOCATION__, name="WANNIER_FUNCTIONS", &
    2794             :                           description="Number of Wannier functions to be calculated. ", &
    2795             :                           usage="WANNIER_FUNCTIONS 6", n_var=1, default_i_val=0, &
    2796        8408 :                           repeats=.TRUE., type_of_var=integer_t)
    2797        8408 :       CALL section_add_keyword(print_key, keyword)
    2798        8408 :       CALL keyword_release(keyword)
    2799             : 
    2800        8408 :    END SUBROUTINE create_wannier_section
    2801             : 
    2802             : ! **************************************************************************************************
    2803             : !> \brief ...
    2804             : !> \param print_key ...
    2805             : ! **************************************************************************************************
    2806        8408 :    SUBROUTINE create_stm_section(print_key)
    2807             :       TYPE(section_type), POINTER                        :: print_key
    2808             : 
    2809             :       TYPE(keyword_type), POINTER                        :: keyword
    2810             : 
    2811        8408 :       NULLIFY (keyword)
    2812             : 
    2813             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "STM", &
    2814             :                                        description="Controls the printing of cubes for the generation of STM images.", &
    2815        8408 :                                        print_level=debug_print_level, filename="")
    2816             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    2817             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    2818             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    2819             :                           " 1 number valid for all components.", &
    2820        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    2821        8408 :       CALL section_add_keyword(print_key, keyword)
    2822        8408 :       CALL keyword_release(keyword)
    2823             : 
    2824             :       CALL keyword_create(keyword, __LOCATION__, name="nlumo", &
    2825             :                           description="If the printkey is activated controls the number of additional lumos"// &
    2826             :                           " that are computed to be able to reproduce STM images obtained"// &
    2827             :                           "  from positive bias (imaging unoccupied states)", &
    2828        8408 :                           default_i_val=0)
    2829        8408 :       CALL section_add_keyword(print_key, keyword)
    2830        8408 :       CALL keyword_release(keyword)
    2831             : 
    2832             :       CALL keyword_create(keyword, __LOCATION__, name="BIAS", &
    2833             :                           description="Bias energy for scanning tunneling microscopy (STM) image generation. "// &
    2834             :                           "Orbital densities are summed according to the bias energy. "// &
    2835             :                           "For negative values, states in the range ]EF+bias,EF] are summed, "// &
    2836             :                           "While positive values sum states in the range [EF,EF+bias[. "// &
    2837             :                           "If positive biases are used, sufficiently many unoccupied stated "// &
    2838             :                           "(see ADDED_MOS and NLUMO ) should be computed.", &
    2839        8408 :                           n_var=-1, type_of_var=real_t, default_r_vals=(/0.0_dp/), unit_str='eV')
    2840        8408 :       CALL section_add_keyword(print_key, keyword)
    2841        8408 :       CALL keyword_release(keyword)
    2842             : 
    2843             :       CALL keyword_create(keyword, __LOCATION__, name="TH_TORB", &
    2844             :                           description="Tip orbital symmetry in Tersoff-Hamann approximation to compute STM images", &
    2845             :                           repeats=.TRUE., &
    2846             :                           default_i_val=orb_s, &
    2847             :                           usage="TH_TORB s dz2", &
    2848             :                           enum_c_vals=s2a("S", "PX", "PY", "PZ", "DXY", "DYZ", "DZX", "DX2", "DY2", "DZ2"), &
    2849             :                           enum_i_vals=(/orb_s, orb_px, orb_py, orb_pz, orb_dxy, orb_dyz, orb_dzx, orb_dx2, orb_dy2, orb_dz2/), &
    2850             :                           enum_desc=s2a("s orbital", "px orbital", "py orbital", "pz orbital", &
    2851        8408 :                                         "dxy orbital", "dyz orbital", "dzx orbital", "x^2 orbital", "y^2 orbital", "z^2 orbital"))
    2852        8408 :       CALL section_add_keyword(print_key, keyword)
    2853        8408 :       CALL keyword_release(keyword)
    2854             : 
    2855             :       CALL keyword_create(keyword, __LOCATION__, name="REF_ENERGY", &
    2856             :                           description="By default the reference energy is the Fermi energy. In order to compare"// &
    2857             :                           " with STS experiments, where specific energy ranges are addressed, here"// &
    2858             :                           "  one can set a different reference energy."// &
    2859             :                           " The energy range is anyway controlled by the BIAS", &
    2860        8408 :                           type_of_var=real_t, default_r_val=0.0_dp, unit_str='eV')
    2861        8408 :       CALL section_add_keyword(print_key, keyword)
    2862        8408 :       CALL keyword_release(keyword)
    2863             : 
    2864             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    2865             :                           description="append the cube files when they already exist", &
    2866        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2867        8408 :       CALL section_add_keyword(print_key, keyword)
    2868        8408 :       CALL keyword_release(keyword)
    2869             : 
    2870        8408 :    END SUBROUTINE create_stm_section
    2871             : 
    2872             : ! **************************************************************************************************
    2873             : !> \brief ...
    2874             : !> \param section ...
    2875             : ! **************************************************************************************************
    2876        8408 :    SUBROUTINE create_wfn_mix_section(section)
    2877             : 
    2878             :       TYPE(section_type), POINTER                        :: section
    2879             : 
    2880             :       TYPE(keyword_type), POINTER                        :: keyword
    2881             :       TYPE(section_type), POINTER                        :: subsection
    2882             : 
    2883        8408 :       NULLIFY (subsection)
    2884        8408 :       NULLIFY (keyword)
    2885             : 
    2886        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    2887             : 
    2888             :       CALL section_create(section, __LOCATION__, name="WFN_MIX", &
    2889             :                           description="A section that allows manipulation of the MO coeffs, "// &
    2890             :                           "e.g. for changing a ground state into an excited state. "// &
    2891             :                           "Starting from a copy of the original MOs, changes can be made "// &
    2892             :                           "by adding linear combinations of HOMO/LUMO of the original MOs to the result MOs. "// &
    2893             :                           "This method is called after an SCF optimization or before an RTP run if "// &
    2894             :                           "INITIAL_WFN=RESTART_WFN. Note that if called after an SCF optimization, a restart file "// &
    2895             :                           "with the mixed MOs is saved. This is not the case for an RTP with "// &
    2896             :                           "INITIAL_WFN=RESTART_WFN.", &
    2897        8408 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    2898             : 
    2899             :       CALL keyword_create(keyword, __LOCATION__, name="OVERWRITE_MOS", &
    2900             :                         description="If set to True, the active molecular orbitals in memory will be replaced by the mixed wfn "// &
    2901             :                         "at the end of the wfn mixing procedure. For instance, you can then use this new set of MOs to perform "// &
    2902             :                           "RTP or EMD directly. Not that in the case of an RTP run with INITIAL_WFN=RESTART_WFN, this keyword "// &
    2903             :                           "is not used: the mixed wfn is used to start the time-dependent run. "// &
    2904             :                           "Default value is False.", &
    2905        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2906        8408 :       CALL section_add_keyword(section, keyword)
    2907        8408 :       CALL keyword_release(keyword)
    2908             : 
    2909             :       CALL section_create(subsection, __LOCATION__, name="UPDATE", &
    2910             :                           description="update a result MO with with a linear combination of of original MOs."// &
    2911             :                           " This section can be repeated to build arbitrary linear combinations using repeatedly y=a*y+b*x.", &
    2912        8408 :                           n_keywords=1, n_subsections=0, repeats=.TRUE.)
    2913             : 
    2914             :       CALL keyword_create(keyword, __LOCATION__, name="RESULT_MO_INDEX", &
    2915             :                           description="Index of the MO (y) to be modified. Counting down in energy: "// &
    2916             :                           "set to 1 for the HOMO, to 3 for the HOMO-3.", &
    2917        8408 :                           usage="RESULT_MO_INDEX 1", type_of_var=integer_t, default_i_val=0)
    2918        8408 :       CALL section_add_keyword(subsection, keyword)
    2919        8408 :       CALL keyword_release(keyword)
    2920             : 
    2921             :       CALL keyword_create(keyword, __LOCATION__, name="RESULT_MARKED_STATE", &
    2922             :                           description="Specifies the MO according to "// &
    2923             :                           "the marks set in MOLECULAR_STATES. The value corresponds to the repetition "// &
    2924             :                           "of MARK_STATES in MOLECULAR_STATES", &
    2925        8408 :                           usage="ORIG_MARKED_STATE 1", type_of_var=integer_t, default_i_val=0)
    2926        8408 :       CALL section_add_keyword(subsection, keyword)
    2927        8408 :       CALL keyword_release(keyword)
    2928             : 
    2929             :       CALL keyword_create(keyword, __LOCATION__, name="RESULT_SPIN_INDEX", &
    2930             :                           description="Spin of the MO (y) to be modified.", &
    2931             :                           enum_c_vals=s2a("Alpha", "Beta"), &
    2932             :                           enum_i_vals=(/1, 2/), & ! direct index in array
    2933             :                           default_i_val=1, &
    2934        8408 :                           enum_desc=s2a("Majority spin", "Minority spin"))
    2935        8408 :       CALL section_add_keyword(subsection, keyword)
    2936        8408 :       CALL keyword_release(keyword)
    2937             : 
    2938             :       CALL keyword_create(keyword, __LOCATION__, name="RESULT_SCALE", &
    2939             :                           description="Scaling factor of the result variable (a).", &
    2940        8408 :                           usage="RESULT_SCALE 0.0", type_of_var=real_t)
    2941        8408 :       CALL section_add_keyword(subsection, keyword)
    2942        8408 :       CALL keyword_release(keyword)
    2943             : 
    2944             :       CALL keyword_create(keyword, __LOCATION__, name="ORIG_MO_INDEX", &
    2945             :                           description="Index of the original MO (x). "// &
    2946             :                           "If ORIG_TYPE is OCCUPIED, it counts down in energy: set to 1 to point to "// &
    2947             :                           "the HOMO and to 3 for the HOMO-3. "// &
    2948             :                           "If ORIG_TYPE is VIRTUAL, it counts up in energy: set to 1 to point to "// &
    2949             :                           "the LUMO and to 3 for the LUMO+3. "// &
    2950             :                           "If ORIG_TYPE is EXTERNAL, it counts down in energy for the external "// &
    2951             :                           "set of MOs: set to 1 to point to the HOMO and to 3 for the HOMO-3. "// &
    2952             :                           "Do not set to zero or negative values.", &
    2953        8408 :                           usage="ORIG_MO_INDEX 1", type_of_var=integer_t, default_i_val=0)
    2954        8408 :       CALL section_add_keyword(subsection, keyword)
    2955        8408 :       CALL keyword_release(keyword)
    2956             : 
    2957             :       CALL keyword_create(keyword, __LOCATION__, name="ORIG_MARKED_STATE", &
    2958             :                           description="Specifies the MO according to "// &
    2959             :                           "the marks set in MOLECULAR_STATES. The value corresponds to the repetition "// &
    2960             :                           "of MARK_STATES in MOLECULAR_STATES", &
    2961        8408 :                           usage="ORIG_MARKED_STATE 1", type_of_var=integer_t, default_i_val=0)
    2962        8408 :       CALL section_add_keyword(subsection, keyword)
    2963        8408 :       CALL keyword_release(keyword)
    2964             : 
    2965             :       CALL keyword_create(keyword, __LOCATION__, name="ORIG_SPIN_INDEX", &
    2966             :                           description="Spin of the MO (x) to be modified.", &
    2967             :                           enum_c_vals=s2a("Alpha", "Beta"), &
    2968             :                           enum_i_vals=(/1, 2/), & ! direct index in array
    2969             :                           default_i_val=1, &
    2970        8408 :                           enum_desc=s2a("Majority spin", "Minority spin"))
    2971        8408 :       CALL section_add_keyword(subsection, keyword)
    2972        8408 :       CALL keyword_release(keyword)
    2973             : 
    2974             :       CALL keyword_create(keyword, __LOCATION__, name="ORIG_SCALE", &
    2975             :                           description="Scaling factor of the result variable (b).", &
    2976        8408 :                           usage="ORIG_SCALE 0.0", type_of_var=real_t)
    2977        8408 :       CALL section_add_keyword(subsection, keyword)
    2978        8408 :       CALL keyword_release(keyword)
    2979             : 
    2980             :       CALL keyword_create(keyword, __LOCATION__, name="ORIG_TYPE", &
    2981             :                           description="Type of the orgine MO. Note that using VIRTUAL along with an RTP run with "// &
    2982             :                           "INITIAL_WFN=RESTART_WFN will probably crash since no virtual state "// &
    2983             :                           "will be available.", &
    2984             :                           enum_c_vals=s2a("OCCUPIED", "VIRTUAL", 'EXTERNAL'), &
    2985             :                           usage="ORIG_TYPE OCCUPIED", &
    2986             :                           default_i_val=wfn_mix_orig_occ, &
    2987             :                           enum_desc=s2a("The original MO is in the MOs matrix itself.", &
    2988             :                                         "The original MO is not in the MOs matrix but in the 'unoccupied' one. "// &
    2989             :                                         "The SCF cycle shall provide it.", &
    2990             :                                         "The orginal MO is from an external .wfn file. Use the keyword "// &
    2991             :                                         "ORIG_EXT_FILE_NAME to define its name."), &
    2992        8408 :                           enum_i_vals=(/wfn_mix_orig_occ, wfn_mix_orig_virtual, wfn_mix_orig_external/))
    2993        8408 :       CALL section_add_keyword(subsection, keyword)
    2994        8408 :       CALL keyword_release(keyword)
    2995             : 
    2996             :       CALL keyword_create(keyword, __LOCATION__, name="ORIG_EXT_FILE_NAME", &
    2997             :                           description="Name of the wavefunction file to read the original MO from. "// &
    2998             :                           "For instance, a restart wfn file from SCF calculation or an excited state from XAS_TDP calculation. "// &
    2999             :                           "If no file is specified, the run will crash. "// &
    3000             :                           "Currently, a RTP restart file (.rtpwfn) cannot be used as reference. "// &
    3001             :                           "Currently, this file SHALL have the basis set, number of MO and the same number of spin as the one "// &
    3002             :                           "from the SCF cycle.", &
    3003             :                           usage="ORIG_EXT_FILE_NAME <FILENAME>", &
    3004        8408 :                           default_lc_val="EMPTY")
    3005        8408 :       CALL section_add_keyword(subsection, keyword)
    3006        8408 :       CALL keyword_release(keyword)
    3007             : 
    3008        8408 :       CALL section_add_subsection(section, subsection)
    3009        8408 :       CALL section_release(subsection)
    3010             : 
    3011        8408 :    END SUBROUTINE create_wfn_mix_section
    3012             : 
    3013             : ! **************************************************************************************************
    3014             : !> \brief creates the input section for the qs part
    3015             : !> \param section the section to create
    3016             : !> \author teo
    3017             : ! **************************************************************************************************
    3018        8408 :    SUBROUTINE create_qs_section(section)
    3019             :       TYPE(section_type), POINTER                        :: section
    3020             : 
    3021             :       TYPE(keyword_type), POINTER                        :: keyword
    3022             :       TYPE(section_type), POINTER                        :: subsection
    3023             : 
    3024        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    3025             :       CALL section_create(section, __LOCATION__, name="qs", &
    3026             :                           description="parameters needed to set up the Quickstep framework", &
    3027        8408 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    3028             : 
    3029        8408 :       NULLIFY (keyword, subsection)
    3030             : 
    3031             :       ! Reals
    3032             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_DEFAULT", &
    3033             :                           description="Try setting all EPS_xxx to values leading to an energy correct up to EPS_DEFAULT", &
    3034        8408 :                           usage="EPS_DEFAULT real", default_r_val=1.0E-10_dp)
    3035        8408 :       CALL section_add_keyword(section, keyword)
    3036        8408 :       CALL keyword_release(keyword)
    3037             : 
    3038             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_CORE_CHARGE", &
    3039             :                           description="Precision for mapping the core charges.Overrides EPS_DEFAULT/100.0 value", &
    3040        8408 :                           usage="EPS_CORE_CHARGE real", type_of_var=real_t)
    3041        8408 :       CALL section_add_keyword(section, keyword)
    3042        8408 :       CALL keyword_release(keyword)
    3043             : 
    3044             :       CALL keyword_create( &
    3045             :          keyword, __LOCATION__, name="EPS_GVG_RSPACE", &
    3046             :          variants=(/"EPS_GVG"/), &
    3047             :          description="Sets precision of the realspace KS matrix element integration. Overrides SQRT(EPS_DEFAULT) value", &
    3048       16816 :          usage="EPS_GVG_RSPACE real", type_of_var=real_t)
    3049        8408 :       CALL section_add_keyword(section, keyword)
    3050        8408 :       CALL keyword_release(keyword)
    3051             : 
    3052             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_PGF_ORB", &
    3053             :                           description="Sets precision of the overlap matrix elements. Overrides SQRT(EPS_DEFAULT) value", &
    3054        8408 :                           usage="EPS_PGF_ORB real", type_of_var=real_t)
    3055        8408 :       CALL section_add_keyword(section, keyword)
    3056        8408 :       CALL keyword_release(keyword)
    3057             : 
    3058             :       CALL keyword_create( &
    3059             :          keyword, __LOCATION__, name="EPS_KG_ORB", &
    3060             :          description="Sets precision used in coloring the subsets for the Kim-Gordon method. Overrides SQRT(EPS_DEFAULT) value", &
    3061             :          usage="EPS_KG_ORB 1.0E-8", &
    3062        8408 :          type_of_var=real_t)
    3063        8408 :       CALL section_add_keyword(section, keyword)
    3064        8408 :       CALL keyword_release(keyword)
    3065             : 
    3066             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_PPL", &
    3067             :                           description="Adjusts the precision for the local part of the pseudo potential. ", &
    3068        8408 :                           usage="EPS_PPL real", type_of_var=real_t, default_r_val=1.0E-2_dp)
    3069        8408 :       CALL section_add_keyword(section, keyword)
    3070        8408 :       CALL keyword_release(keyword)
    3071             : 
    3072             :       CALL keyword_create( &
    3073             :          keyword, __LOCATION__, name="EPS_PPNL", &
    3074             :          description="Sets precision of the non-local part of the pseudo potential. Overrides sqrt(EPS_DEFAULT) value", &
    3075        8408 :          usage="EPS_PPNL real", type_of_var=real_t)
    3076        8408 :       CALL section_add_keyword(section, keyword)
    3077        8408 :       CALL keyword_release(keyword)
    3078             : 
    3079             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_CPC", &
    3080             :                           description="Sets precision of the GAPW projection. Overrides EPS_DEFAULT value", &
    3081        8408 :                           usage="EPS_CPC real", type_of_var=real_t)
    3082        8408 :       CALL section_add_keyword(section, keyword)
    3083        8408 :       CALL keyword_release(keyword)
    3084             : 
    3085             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_RHO", &
    3086             :                           description="Sets precision of the density mapping on the grids.Overrides EPS_DEFAULT value", &
    3087        8408 :                           usage="EPS_RHO real", type_of_var=real_t)
    3088        8408 :       CALL section_add_keyword(section, keyword)
    3089        8408 :       CALL keyword_release(keyword)
    3090             : 
    3091             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_RHO_RSPACE", &
    3092             :                           description="Sets precision of the density mapping in rspace.Overrides EPS_DEFAULT value."// &
    3093             :                           " Overrides EPS_RHO value", &
    3094        8408 :                           usage="EPS_RHO_RSPACE real", type_of_var=real_t)
    3095        8408 :       CALL section_add_keyword(section, keyword)
    3096        8408 :       CALL keyword_release(keyword)
    3097             : 
    3098             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_RHO_GSPACE", &
    3099             :                           description="Sets precision of the density mapping in gspace.Overrides EPS_DEFAULT value."// &
    3100             :                           " Overrides EPS_RHO value", &
    3101        8408 :                           usage="EPS_RHO_GSPACE real", type_of_var=real_t)
    3102        8408 :       CALL section_add_keyword(section, keyword)
    3103        8408 :       CALL keyword_release(keyword)
    3104             : 
    3105             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER_MATRIX", &
    3106             :                           description="Sets the threshold for filtering matrix elements.", &
    3107        8408 :                           usage="EPS_FILTER_MATRIX 1.0E-6", type_of_var=real_t, default_r_val=0.0E0_dp)
    3108        8408 :       CALL section_add_keyword(section, keyword)
    3109        8408 :       CALL keyword_release(keyword)
    3110             : 
    3111             :       CALL keyword_create(keyword, __LOCATION__, name="EPSFIT", &
    3112             :                           variants=(/"EPS_FIT"/), &
    3113             :                           description="GAPW: precision to give the extension of a hard gaussian ", &
    3114       16816 :                           usage="EPSFIT real", default_r_val=1.0E-4_dp)
    3115        8408 :       CALL section_add_keyword(section, keyword)
    3116        8408 :       CALL keyword_release(keyword)
    3117             : 
    3118             :       CALL keyword_create(keyword, __LOCATION__, name="EPSISO", &
    3119             :                           variants=(/"EPS_ISO"/), &
    3120             :                           description="GAPW: precision to determine an isolated projector", &
    3121       16816 :                           usage="EPSISO real", default_r_val=1.0E-12_dp)
    3122        8408 :       CALL section_add_keyword(section, keyword)
    3123        8408 :       CALL keyword_release(keyword)
    3124             : 
    3125             :       CALL keyword_create(keyword, __LOCATION__, name="EPSSVD", &
    3126             :                           variants=(/"EPS_SVD"/), &
    3127             :                           description="GAPW: tolerance used in the singular value decomposition of the projector matrix", &
    3128       16816 :                           usage="EPS_SVD real", default_r_val=1.0E-8_dp)
    3129        8408 :       CALL section_add_keyword(section, keyword)
    3130        8408 :       CALL keyword_release(keyword)
    3131             : 
    3132             :       CALL keyword_create(keyword, __LOCATION__, name="EPSRHO0", &
    3133             :                           variants=s2a("EPSVRHO0", "EPS_VRHO0"), &
    3134             :                           description="GAPW : precision to determine the range of V(rho0-rho0soft)", &
    3135        8408 :                           usage="EPSRHO0 real", default_r_val=1.0E-6_dp)
    3136        8408 :       CALL section_add_keyword(section, keyword)
    3137        8408 :       CALL keyword_release(keyword)
    3138             : 
    3139             :       CALL keyword_create(keyword, __LOCATION__, name="ALPHA0_HARD", &
    3140             :                           variants=s2a("ALPHA0_H", "ALPHA0"), &
    3141             :                           description="GAPW: Exponent for hard compensation charge", &
    3142        8408 :                           usage="ALPHA0_HARD real", default_r_val=0.0_dp)
    3143        8408 :       CALL section_add_keyword(section, keyword)
    3144        8408 :       CALL keyword_release(keyword)
    3145             : 
    3146             :       CALL keyword_create( &
    3147             :          keyword, __LOCATION__, name="FORCE_PAW", &
    3148             :          description="Use the GAPW scheme also for atoms with soft basis sets, i.e. "// &
    3149             :          "the local densities are computed even if hard and soft should be equal. "// &
    3150             :          "If this keyword is not set to true, those atoms with soft basis sets are treated by a GPW scheme, i.e. "// &
    3151             :          "the corresponding density contribution goes on the global grid and is expanded in PW. "// &
    3152             :          "This option nullifies the effect of the GPW_TYPE in the atomic KIND", &
    3153             :          usage="FORCE_PAW", &
    3154        8408 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    3155        8408 :       CALL section_add_keyword(section, keyword)
    3156        8408 :       CALL keyword_release(keyword)
    3157             : 
    3158             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_RAD_LOCAL", &
    3159             :                           description="GAPW : maximum radius of gaussian functions"// &
    3160             :                           " included in the generation of projectors", &
    3161        8408 :                           usage="MAX_RAD_LOCAL real", default_r_val=25.0_dp)
    3162        8408 :       CALL section_add_keyword(section, keyword)
    3163        8408 :       CALL keyword_release(keyword)
    3164             : 
    3165             :       CALL keyword_create(keyword, __LOCATION__, name="GAPW_1C_BASIS", &
    3166             :                           description="Specifies how to construct the GAPW one center basis set. "// &
    3167             :                           "Default is to use the primitives from the orbital basis.", &
    3168             :                           usage="GAPW_1C_BASIS MEDIUM", &
    3169             :                           enum_c_vals=s2a("ORB", "EXT_SMALL", "EXT_MEDIUM", "EXT_LARGE", "EXT_VERY_LARGE"), &
    3170             :                           enum_desc=s2a("Use orbital basis set.", &
    3171             :                                         "Extension using Small number of primitive Gaussians.", &
    3172             :                                         "Extension using Medium number of primitive Gaussians.", &
    3173             :                                         "Extension using Large number of primitive Gaussians.", &
    3174             :                                         "Extension using Very Large number of primitive Gaussians."), &
    3175             :                           enum_i_vals=(/gapw_1c_orb, gapw_1c_small, gapw_1c_medium, &
    3176             :                                         gapw_1c_large, gapw_1c_very_large/), &
    3177        8408 :                           default_i_val=gapw_1c_orb)
    3178        8408 :       CALL section_add_keyword(section, keyword)
    3179        8408 :       CALL keyword_release(keyword)
    3180             : 
    3181             :       CALL keyword_create(keyword, __LOCATION__, name="MIN_PAIR_LIST_RADIUS", &
    3182             :                           description="Set the minimum value [Bohr] for the overlap pair list radius."// &
    3183             :                           " Default is 0.0 Bohr, negative values are changed to the cell size."// &
    3184             :                           " This allows to control the sparsity of the KS matrix for HFX calculations.", &
    3185        8408 :                           usage="MIN_PAIR_LIST_RADIUS real", default_r_val=0.0_dp)
    3186        8408 :       CALL section_add_keyword(section, keyword)
    3187        8408 :       CALL keyword_release(keyword)
    3188             : 
    3189             :       ! Logicals
    3190             :       CALL keyword_create(keyword, __LOCATION__, name="LS_SCF", &
    3191             :                           description="Perform a linear scaling SCF", &
    3192             :                           usage="LS_SCF", lone_keyword_l_val=.TRUE., &
    3193        8408 :                           default_l_val=.FALSE.)
    3194        8408 :       CALL section_add_keyword(section, keyword)
    3195        8408 :       CALL keyword_release(keyword)
    3196             : 
    3197             :       CALL keyword_create(keyword, __LOCATION__, name="ALMO_SCF", &
    3198             :                           description="Perform ALMO SCF", &
    3199             :                           usage="ALMO_SCF", lone_keyword_l_val=.TRUE., &
    3200        8408 :                           default_l_val=.FALSE.)
    3201        8408 :       CALL section_add_keyword(section, keyword)
    3202        8408 :       CALL keyword_release(keyword)
    3203             : 
    3204             :       CALL keyword_create(keyword, __LOCATION__, name="TRANSPORT", &
    3205             :                           description="Perform transport calculations (coupling CP2K and OMEN)", &
    3206             :                           usage="TRANSPORT", lone_keyword_l_val=.TRUE., &
    3207        8408 :                           default_l_val=.FALSE.)
    3208        8408 :       CALL section_add_keyword(section, keyword)
    3209        8408 :       CALL keyword_release(keyword)
    3210             : 
    3211             :       CALL keyword_create(keyword, __LOCATION__, name="KG_METHOD", &
    3212             :                           description="Use a Kim-Gordon-like scheme.", &
    3213             :                           usage="KG_METHOD", lone_keyword_l_val=.TRUE., &
    3214       33632 :                           default_l_val=.FALSE., citations=(/Iannuzzi2006, Brelaz1979, Andermatt2016/))
    3215        8408 :       CALL section_add_keyword(section, keyword)
    3216        8408 :       CALL keyword_release(keyword)
    3217             : 
    3218             :       CALL keyword_create(keyword, __LOCATION__, name="REF_EMBED_SUBSYS", &
    3219             :                           description="A total, reference, system in DFT embedding. ", &
    3220             :                           usage="REF_EMBED_SUBSYS FALSE", &
    3221        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    3222        8408 :       CALL section_add_keyword(section, keyword)
    3223        8408 :       CALL keyword_release(keyword)
    3224             : 
    3225             :       CALL keyword_create(keyword, __LOCATION__, name="CLUSTER_EMBED_SUBSYS", &
    3226             :                           description="A cluster treated with DFT in DFT embedding. ", &
    3227             :                           usage="CLUSTER_EMBED_SUBSYS FALSE", &
    3228        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    3229        8408 :       CALL section_add_keyword(section, keyword)
    3230        8408 :       CALL keyword_release(keyword)
    3231             : 
    3232             :       CALL keyword_create(keyword, __LOCATION__, name="HIGH_LEVEL_EMBED_SUBSYS", &
    3233             :                           description="A cluster treated with a high-level method in DFT embedding. ", &
    3234             :                           usage="HIGH_LEVEL_EMBED_SUBSYS FALSE", &
    3235        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    3236        8408 :       CALL section_add_keyword(section, keyword)
    3237        8408 :       CALL keyword_release(keyword)
    3238             : 
    3239             :       CALL keyword_create(keyword, __LOCATION__, name="DFET_EMBEDDED", &
    3240             :                           description="Calculation with DFT-embedding potential. ", &
    3241             :                           usage="DFET_EMBEDDED FALSE", &
    3242        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    3243        8408 :       CALL section_add_keyword(section, keyword)
    3244        8408 :       CALL keyword_release(keyword)
    3245             : 
    3246             :       CALL keyword_create(keyword, __LOCATION__, name="DMFET_EMBEDDED", &
    3247             :                           description="Calculation with DM embedding potential. ", &
    3248             :                           usage="DMFET_EMBEDDED FALSE", &
    3249        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    3250        8408 :       CALL section_add_keyword(section, keyword)
    3251        8408 :       CALL keyword_release(keyword)
    3252             : 
    3253             :       ! Integers
    3254             :       CALL keyword_create(keyword, __LOCATION__, name="STO_NG", &
    3255             :                           description="Order of Gaussian type expansion of Slater orbital basis sets.", &
    3256        8408 :                           usage="STO_NG", default_i_val=6)
    3257        8408 :       CALL section_add_keyword(section, keyword)
    3258        8408 :       CALL keyword_release(keyword)
    3259             : 
    3260             :       CALL keyword_create(keyword, __LOCATION__, name="LMAXN1", &
    3261             :                           variants=(/"LMAXRHO1"/), &
    3262             :                           description="GAPW : max L number for expansion of the atomic densities in spherical gaussians", &
    3263             :                           usage="LMAXN1 integer", &
    3264       16816 :                           default_i_val=-1)
    3265        8408 :       CALL section_add_keyword(section, keyword)
    3266        8408 :       CALL keyword_release(keyword)
    3267             : 
    3268             :       CALL keyword_create(keyword, __LOCATION__, name="LMAXN0", &
    3269             :                           variants=(/"LMAXRHO0"/), &
    3270             :                           description="GAPW : max L number for the expansion compensation densities in spherical gaussians", &
    3271             :                           usage="LMAXN0 integer", &
    3272       16816 :                           default_i_val=2)
    3273        8408 :       CALL section_add_keyword(section, keyword)
    3274        8408 :       CALL keyword_release(keyword)
    3275             : 
    3276             :       CALL keyword_create(keyword, __LOCATION__, name="LADDN0", &
    3277             :                           description="GAPW : integer added to the max L of the basis set, used to determine the "// &
    3278             :                           "maximum value of L for the compensation charge density.", &
    3279             :                           usage="LADDN0 integer", &
    3280        8408 :                           default_i_val=99)
    3281        8408 :       CALL section_add_keyword(section, keyword)
    3282        8408 :       CALL keyword_release(keyword)
    3283             : 
    3284             :       ! Characters
    3285             :       CALL keyword_create(keyword, __LOCATION__, name="QUADRATURE", &
    3286             :                           description="GAPW: algorithm to construct the atomic radial grids", &
    3287             :                           usage="QUADRATURE GC_SIMPLE", &
    3288             :                           enum_c_vals=s2a("GC_SIMPLE", "GC_TRANSFORMED", "GC_LOG"), &
    3289             :                           enum_i_vals=(/do_gapw_gcs, do_gapw_gct, do_gapw_log/), &
    3290             :                           enum_desc=s2a("Gauss-Chebyshev quadrature", &
    3291             :                                         "Transformed Gauss-Chebyshev quadrature", &
    3292             :                                         "Logarithmic transformed Gauss-Chebyshev quadrature"), &
    3293        8408 :                           default_i_val=do_gapw_log)
    3294        8408 :       CALL section_add_keyword(section, keyword)
    3295        8408 :       CALL keyword_release(keyword)
    3296             : 
    3297             :       CALL keyword_create(keyword, __LOCATION__, name="PW_GRID", &
    3298             :                           description="What kind of PW_GRID should be employed", &
    3299             :                           usage="PW_GRID NS-FULLSPACE", &
    3300             :                           enum_c_vals=s2a("SPHERICAL", "NS-FULLSPACE", "NS-HALFSPACE"), &
    3301             :                           enum_desc=s2a("- not tested", " tested", " - not tested"), &
    3302             :                           enum_i_vals=(/do_pwgrid_spherical, do_pwgrid_ns_fullspace, do_pwgrid_ns_halfspace/), &
    3303        8408 :                           default_i_val=do_pwgrid_ns_fullspace)
    3304        8408 :       CALL section_add_keyword(section, keyword)
    3305        8408 :       CALL keyword_release(keyword)
    3306             : 
    3307             :       CALL keyword_create(keyword, __LOCATION__, name="PW_GRID_LAYOUT", &
    3308             :                           description="Force a particular real-space layout for the plane waves grids. "// &
    3309             :                           "Numbers &le; 0 mean that this dimension is free, incorrect layouts will be ignored. "// &
    3310             :                           "The default (/-1,-1/) causes CP2K to select a good value, "// &
    3311             :                           "i.e. plane distributed for large grids, more general distribution for small grids.", &
    3312             :                           usage="PW_GRID_LAYOUT 4 16", &
    3313             :                           repeats=.FALSE., n_var=2, &
    3314        8408 :                           default_i_vals=(/-1, -1/))
    3315        8408 :       CALL section_add_keyword(section, keyword)
    3316        8408 :       CALL keyword_release(keyword)
    3317             : 
    3318             :       CALL keyword_create(keyword, __LOCATION__, name="PW_GRID_BLOCKED", &
    3319             :                           description="Can be used to set the distribution in g-space for the pw grids and their FFT.", &
    3320             :                           usage="PW_GRID_BLOCKED FREE", &
    3321             :                           enum_c_vals=s2a("FREE", "TRUE", "FALSE"), &
    3322             :                           enum_desc=s2a("CP2K will select an appropriate value", "blocked", "not blocked"), &
    3323             :                           enum_i_vals=(/do_pw_grid_blocked_free, do_pw_grid_blocked_true, do_pw_grid_blocked_false/), &
    3324        8408 :                           default_i_val=do_pw_grid_blocked_free)
    3325        8408 :       CALL section_add_keyword(section, keyword)
    3326        8408 :       CALL keyword_release(keyword)
    3327             : 
    3328             :       CALL keyword_create( &
    3329             :          keyword, __LOCATION__, name="EXTRAPOLATION", &
    3330             :          variants=s2a("INTERPOLATION", "WF_INTERPOLATION"), &
    3331             :          description="Extrapolation strategy for the wavefunction during e.g. MD. "// &
    3332             :          "Not all options are available for all simulation methods. "// &
    3333             :          "PS and ASPC are recommended, see also EXTRAPOLATION_ORDER.", &
    3334             :          citations=(/Kolafa2004, VandeVondele2005a, Kuhne2007/), &
    3335             :          usage="EXTRAPOLATION PS", &
    3336             :          enum_c_vals=s2a("USE_GUESS", "USE_PREV_P", "USE_PREV_RHO_R", "LINEAR_WF", &
    3337             :                          "LINEAR_P", "LINEAR_PS", "USE_PREV_WF", "PS", "FROZEN", "ASPC"), &
    3338             :          enum_desc=s2a( &
    3339             :          "Use the method specified with SCF_GUESS, i.e. no extrapolation", &
    3340             :          "Use the previous density matrix", &
    3341             :          "Use the previous density in real space", &
    3342             :          "Linear extrapolation of the wavefunction (not available for K-points)", &
    3343             :          "Linear extrapolation of the density matrix", &
    3344             :          "Linear extrapolation of the density matrix times the overlap matrix (not available for K-points)", &
    3345             :          "Use the previous wavefunction (not available for K-points)", &
    3346             :          "Higher order extrapolation of the density matrix times the overlap matrix (not available for K-points)", &
    3347             :          "Frozen ...", &
    3348             :          "Always stable predictor corrector, similar to PS, but going for MD stability instead of initial guess accuracy. "// &
    3349             :          "(not available for K-points)"), &
    3350             :          enum_i_vals=(/ &
    3351             :          wfi_use_guess_method_nr, &
    3352             :          wfi_use_prev_p_method_nr, &
    3353             :          wfi_use_prev_rho_r_method_nr, &
    3354             :          wfi_linear_wf_method_nr, &
    3355             :          wfi_linear_p_method_nr, &
    3356             :          wfi_linear_ps_method_nr, &
    3357             :          wfi_use_prev_wf_method_nr, &
    3358             :          wfi_ps_method_nr, &
    3359             :          wfi_frozen_method_nr, &
    3360             :          wfi_aspc_nr/), &
    3361       33632 :          default_i_val=wfi_aspc_nr)
    3362        8408 :       CALL section_add_keyword(section, keyword)
    3363        8408 :       CALL keyword_release(keyword)
    3364             : 
    3365             :       CALL keyword_create(keyword, __LOCATION__, name="EXTRAPOLATION_ORDER", &
    3366             :                           description="Order for the PS or ASPC extrapolation (typically 2-4). "// &
    3367             :                           "Higher order might bring more accuracy, but comes, "// &
    3368             :                           "for large systems, also at some cost. "// &
    3369             :                           "In some cases, a high order extrapolation is not stable,"// &
    3370             :                           " and the order needs to be reduced.", &
    3371        8408 :                           usage="EXTRAPOLATION_ORDER {integer}", default_i_val=3)
    3372        8408 :       CALL section_add_keyword(section, keyword)
    3373        8408 :       CALL keyword_release(keyword)
    3374             : 
    3375             :       CALL keyword_create(keyword, __LOCATION__, name="METHOD", &
    3376             :                           description="Specifies the electronic structure method that should be employed", &
    3377             :                           usage="METHOD GAPW", &
    3378             :                           enum_c_vals=s2a("GAPW", "GAPW_XC", "GPW", "LRIGPW", "RIGPW", &
    3379             :                                     "MNDO", "MNDOD", "AM1", "PM3", "PM6", "PM6-FM", "PDG", "RM1", "PNNL", "DFTB", "xTB", "OFGPW"), &
    3380             :                           enum_desc=s2a("Gaussian and augmented plane waves method", &
    3381             :                                         "Gaussian and augmented plane waves method only for XC", &
    3382             :                                         "Gaussian and plane waves method", &
    3383             :                                         "Local resolution of identity method", &
    3384             :                                         "Resolution of identity method for HXC terms", &
    3385             :                                         "MNDO semiempirical", "MNDO-d semiempirical", "AM1 semiempirical", &
    3386             :                                         "PM3 semiempirical", "PM6 semiempirical", "PM6-FM semiempirical", "PDG semiempirical", &
    3387             :                                         "RM1 semiempirical", &
    3388             :                                         "PNNL semiempirical", &
    3389             :                                         "DFTB Density Functional based Tight-Binding", &
    3390             :                                         "GFN-xTB Extended Tight-Binding", &
    3391             :                                         "OFGPW Orbital-free GPW method"), &
    3392             :                           enum_i_vals=(/do_method_gapw, do_method_gapw_xc, do_method_gpw, do_method_lrigpw, do_method_rigpw, &
    3393             :                                         do_method_mndo, do_method_mndod, do_method_am1, do_method_pm3, &
    3394             :                                         do_method_pm6, do_method_pm6fm, do_method_pdg, do_method_rm1, &
    3395             :                                         do_method_pnnl, do_method_dftb, do_method_xtb, do_method_ofgpw/), &
    3396             :                           citations=(/Lippert1997, Lippert1999, Krack2000, VandeVondele2005a, &
    3397             :                                       VandeVondele2006, Dewar1977, Dewar1985, Rocha2006, Stewart1989, Thiel1992, &
    3398             :                                       Repasky2002, Stewart2007, VanVoorhis2015, Schenter2008/), &
    3399      126120 :                           default_i_val=do_method_gpw)
    3400        8408 :       CALL section_add_keyword(section, keyword)
    3401        8408 :       CALL keyword_release(keyword)
    3402             : 
    3403             :       CALL keyword_create(keyword, __LOCATION__, name="CORE_PPL", &
    3404             :                           description="Specifies the method used to calculate the local pseudopotential contribution.", &
    3405             :                           usage="CORE_PPL ANALYTIC", &
    3406             :                           enum_c_vals=s2a("ANALYTIC", "GRID"), &
    3407             :                           enum_desc=s2a("Analytic integration of integrals", &
    3408             :                                         "Numerical integration on real space grid. Lumped together with core charge"), &
    3409             :                           enum_i_vals=(/do_ppl_analytic, do_ppl_grid/), &
    3410        8408 :                           default_i_val=do_ppl_analytic)
    3411        8408 :       CALL section_add_keyword(section, keyword)
    3412        8408 :       CALL keyword_release(keyword)
    3413             : 
    3414             :       CALL keyword_create(keyword, __LOCATION__, name="EMBED_RESTART_FILE_NAME", &
    3415             :                           description="Root of the file name where to read the embedding "// &
    3416             :                           "potential guess.", &
    3417             :                           usage="EMBED_RESTART_FILE_NAME <FILENAME>", &
    3418        8408 :                           type_of_var=lchar_t)
    3419        8408 :       CALL section_add_keyword(section, keyword)
    3420        8408 :       CALL keyword_release(keyword)
    3421             : 
    3422             :       CALL keyword_create(keyword, __LOCATION__, name="EMBED_CUBE_FILE_NAME", &
    3423             :                           description="Root of the file name where to read the embedding "// &
    3424             :                           "potential (guess) as a cube.", &
    3425             :                           usage="EMBED_CUBE_FILE_NAME <FILENAME>", &
    3426        8408 :                           type_of_var=lchar_t)
    3427        8408 :       CALL section_add_keyword(section, keyword)
    3428        8408 :       CALL keyword_release(keyword)
    3429             : 
    3430             :       CALL keyword_create(keyword, __LOCATION__, name="EMBED_SPIN_CUBE_FILE_NAME", &
    3431             :                           description="Root of the file name where to read the spin part "// &
    3432             :                           "of the embedding potential (guess) as a cube.", &
    3433             :                           usage="EMBED_SPIN_CUBE_FILE_NAME <FILENAME>", &
    3434        8408 :                           type_of_var=lchar_t)
    3435        8408 :       CALL section_add_keyword(section, keyword)
    3436        8408 :       CALL keyword_release(keyword)
    3437             : 
    3438        8408 :       CALL create_distribution_section(subsection)
    3439        8408 :       CALL section_add_subsection(section, subsection)
    3440        8408 :       CALL section_release(subsection)
    3441             : 
    3442        8408 :       CALL create_dftb_control_section(subsection)
    3443        8408 :       CALL section_add_subsection(section, subsection)
    3444        8408 :       CALL section_release(subsection)
    3445             : 
    3446        8408 :       CALL create_xtb_control_section(subsection)
    3447        8408 :       CALL section_add_subsection(section, subsection)
    3448        8408 :       CALL section_release(subsection)
    3449             : 
    3450        8408 :       CALL create_se_control_section(subsection)
    3451        8408 :       CALL section_add_subsection(section, subsection)
    3452        8408 :       CALL section_release(subsection)
    3453             : 
    3454        8408 :       CALL create_mulliken_section(subsection)
    3455        8408 :       CALL section_add_subsection(section, subsection)
    3456        8408 :       CALL section_release(subsection)
    3457             : 
    3458        8408 :       CALL create_ddapc_restraint_section(subsection, "DDAPC_RESTRAINT")
    3459        8408 :       CALL section_add_subsection(section, subsection)
    3460        8408 :       CALL section_release(subsection)
    3461             : 
    3462        8408 :       CALL create_cdft_control_section(subsection)
    3463        8408 :       CALL section_add_subsection(section, subsection)
    3464        8408 :       CALL section_release(subsection)
    3465             : 
    3466        8408 :       CALL create_s2_restraint_section(subsection)
    3467        8408 :       CALL section_add_subsection(section, subsection)
    3468        8408 :       CALL section_release(subsection)
    3469             : 
    3470        8408 :       CALL create_lrigpw_section(subsection)
    3471        8408 :       CALL section_add_subsection(section, subsection)
    3472        8408 :       CALL section_release(subsection)
    3473             : 
    3474        8408 :       CALL create_optimize_lri_basis_section(subsection)
    3475        8408 :       CALL section_add_subsection(section, subsection)
    3476        8408 :       CALL section_release(subsection)
    3477             : 
    3478             :       ! Embedding subsections: DFET and DMFET
    3479        8408 :       CALL create_optimize_embed(subsection)
    3480        8408 :       CALL section_add_subsection(section, subsection)
    3481        8408 :       CALL section_release(subsection)
    3482             : 
    3483        8408 :       CALL create_optimize_dmfet(subsection)
    3484        8408 :       CALL section_add_subsection(section, subsection)
    3485        8408 :       CALL section_release(subsection)
    3486             : 
    3487        8408 :    END SUBROUTINE create_qs_section
    3488             : 
    3489             : ! **************************************************************************************************
    3490             : !> \brief ...
    3491             : !> \param section ...
    3492             : ! **************************************************************************************************
    3493        8408 :    SUBROUTINE create_admm_section(section)
    3494             :       TYPE(section_type), POINTER                        :: section
    3495             : 
    3496             :       TYPE(keyword_type), POINTER                        :: keyword
    3497             : 
    3498        8408 :       NULLIFY (keyword)
    3499        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    3500             :       CALL section_create(section, __LOCATION__, name="AUXILIARY_DENSITY_MATRIX_METHOD", &
    3501             :                           description="Parameters needed for the ADMM method.", &
    3502             :                           n_keywords=1, n_subsections=1, repeats=.FALSE., &
    3503       16816 :                           citations=(/Guidon2010/))
    3504             : 
    3505             :       CALL keyword_create( &
    3506             :          keyword, __LOCATION__, &
    3507             :          name="ADMM_TYPE", &
    3508             :          description="Type of ADMM (sort name) as refered in literature. "// &
    3509             :          "This sets values for METHOD, ADMM_PURIFICATION_METHOD, and EXCH_SCALING_MODEL", &
    3510             :          enum_c_vals=s2a("NONE", "ADMM1", "ADMM2", "ADMMS", "ADMMP", "ADMMQ"), &
    3511             :          enum_desc=s2a("No short name is used, use specific definitions (default)", &
    3512             :                        "ADMM1 method from Guidon2010", &
    3513             :                        "ADMM2 method from Guidon2010", &
    3514             :                        "ADMMS method from Merlot2014", &
    3515             :                        "ADMMP method from Merlot2014", &
    3516             :                        "ADMMQ method from Merlot2014"), &
    3517             :          enum_i_vals=(/no_admm_type, admm1_type, admm2_type, admms_type, admmp_type, admmq_type/), &
    3518             :          default_i_val=no_admm_type, &
    3519       25224 :          citations=(/Guidon2010, Merlot2014/))
    3520        8408 :       CALL section_add_keyword(section, keyword)
    3521        8408 :       CALL keyword_release(keyword)
    3522             : 
    3523             :       CALL keyword_create( &
    3524             :          keyword, __LOCATION__, &
    3525             :          name="ADMM_PURIFICATION_METHOD", &
    3526             :          description="Method that shall be used for wavefunction fitting. Use MO_DIAG for MD.", &
    3527             :          enum_c_vals=s2a("NONE", "CAUCHY", "CAUCHY_SUBSPACE", "MO_DIAG", "MO_NO_DIAG", "MCWEENY", "NONE_DM"), &
    3528             :          enum_i_vals=(/do_admm_purify_none, do_admm_purify_cauchy, do_admm_purify_cauchy_subspace, &
    3529             :                        do_admm_purify_mo_diag, do_admm_purify_mo_no_diag, &
    3530             :                        do_admm_purify_mcweeny, do_admm_purify_none_dm/), &
    3531             :          enum_desc=s2a("Do not apply any purification", &
    3532             :                        "Perform purification via general Cauchy representation", &
    3533             :                        "Perform purification via Cauchy representation in occupied subspace", &
    3534             :                        "Calculate MO derivatives via Cauchy representation by diagonalization", &
    3535             :                        "Calculate MO derivatives via Cauchy representation by inversion", &
    3536             :                        "Perform original McWeeny purification via matrix multiplications", &
    3537             :                        "Do not apply any purification, works directly with density matrix"), &
    3538        8408 :          default_i_val=do_admm_purify_mo_diag)
    3539        8408 :       CALL section_add_keyword(section, keyword)
    3540        8408 :       CALL keyword_release(keyword)
    3541             : 
    3542             :       CALL keyword_create( &
    3543             :          keyword, __LOCATION__, &
    3544             :          name="METHOD", &
    3545             :          description="Method that shall be used for wavefunction fitting. Use BASIS_PROJECTION for MD.", &
    3546             :          enum_c_vals=s2a("BASIS_PROJECTION", "BLOCKED_PROJECTION_PURIFY_FULL", "BLOCKED_PROJECTION", &
    3547             :                          "CHARGE_CONSTRAINED_PROJECTION"), &
    3548             :          enum_i_vals=(/do_admm_basis_projection, do_admm_blocking_purify_full, do_admm_blocked_projection, &
    3549             :                        do_admm_charge_constrained_projection/), &
    3550             :          enum_desc=s2a("Construct auxiliary density matrix from auxiliary basis.", &
    3551             :                        "Construct auxiliary density from a blocked Fock matrix,"// &
    3552             :                        " but use the original matrix for purification.", &
    3553             :                        "Construct auxiliary density from a blocked Fock matrix.", &
    3554             :                        "Construct auxiliary density from auxiliary basis enforcing charge constrain."), &
    3555        8408 :          default_i_val=do_admm_basis_projection)
    3556        8408 :       CALL section_add_keyword(section, keyword)
    3557        8408 :       CALL keyword_release(keyword)
    3558             : 
    3559             :       CALL keyword_create( &
    3560             :          keyword, __LOCATION__, &
    3561             :          name="EXCH_SCALING_MODEL", &
    3562             :          description="Scaling of the exchange correction calculated by the auxiliary density matrix.", &
    3563             :          enum_c_vals=s2a("NONE", "MERLOT"), &
    3564             :          enum_i_vals=(/do_admm_exch_scaling_none, do_admm_exch_scaling_merlot/), &
    3565             :          enum_desc=s2a("No scaling is enabled, refers to methods ADMM1, ADMM2 or ADMMQ.", &
    3566             :                        "Exchange scaling according to Merlot (2014)"), &
    3567        8408 :          default_i_val=do_admm_exch_scaling_none)
    3568        8408 :       CALL section_add_keyword(section, keyword)
    3569        8408 :       CALL keyword_release(keyword)
    3570             : 
    3571             :       CALL keyword_create( &
    3572             :          keyword, __LOCATION__, &
    3573             :          name="EXCH_CORRECTION_FUNC", &
    3574             :          description="Exchange functional which is used for the ADMM correction. "// &
    3575             :          "LibXC implementations require linking with LibXC", &
    3576             :          enum_c_vals=s2a("DEFAULT", "PBEX", "NONE", "OPTX", "BECKE88X", &
    3577             :                          "PBEX_LIBXC", "BECKE88X_LIBXC", "OPTX_LIBXC", "DEFAULT_LIBXC", "LDA_X_LIBXC"), &
    3578             :          enum_i_vals=(/do_admm_aux_exch_func_default, do_admm_aux_exch_func_pbex, &
    3579             :                        do_admm_aux_exch_func_none, do_admm_aux_exch_func_opt, do_admm_aux_exch_func_bee, &
    3580             :                        do_admm_aux_exch_func_pbex_libxc, do_admm_aux_exch_func_bee_libxc, &
    3581             :                        do_admm_aux_exch_func_opt_libxc, do_admm_aux_exch_func_default_libxc, &
    3582             :                        do_admm_aux_exch_func_sx_libxc/), &
    3583             :          enum_desc=s2a("Use PBE-based corrections according to the chosen interaction operator.", &
    3584             :                        "Use PBEX functional for exchange correction.", &
    3585             :                        "No correction: X(D)-x(d)-> 0.", &
    3586             :                        "Use OPTX functional for exchange correction.", &
    3587             :                        "Use Becke88X functional for exchange correction.", &
    3588             :                        "Use PBEX functional (LibXC implementation) for exchange correction.", &
    3589             :                        "Use Becke88X functional (LibXC implementation) for exchange correction.", &
    3590             :                        "Use OPTX functional (LibXC implementation) for exchange correction.", &
    3591             :                        "Use PBE-based corrections (LibXC where possible) to the chosen interaction operator.", &
    3592             :                        "Use Slater X functional (LibXC where possible) for exchange correction."), &
    3593        8408 :          default_i_val=do_admm_aux_exch_func_default)
    3594        8408 :       CALL section_add_keyword(section, keyword)
    3595        8408 :       CALL keyword_release(keyword)
    3596             : 
    3597             :       CALL keyword_create(keyword, __LOCATION__, name="optx_a1", &
    3598             :                           description="OPTX a1 coefficient", &
    3599        8408 :                           default_r_val=1.05151_dp)
    3600        8408 :       CALL section_add_keyword(section, keyword)
    3601        8408 :       CALL keyword_release(keyword)
    3602             :       CALL keyword_create(keyword, __LOCATION__, name="optx_a2", &
    3603             :                           description="OPTX a2 coefficient", &
    3604        8408 :                           default_r_val=1.43169_dp)
    3605        8408 :       CALL section_add_keyword(section, keyword)
    3606        8408 :       CALL keyword_release(keyword)
    3607             :       CALL keyword_create(keyword, __LOCATION__, name="optx_gamma", &
    3608             :                           description="OPTX gamma coefficient", &
    3609        8408 :                           default_r_val=0.006_dp)
    3610        8408 :       CALL section_add_keyword(section, keyword)
    3611        8408 :       CALL keyword_release(keyword)
    3612             : 
    3613             :       CALL keyword_create(keyword, __LOCATION__, name="BLOCK_LIST", &
    3614             :                           description="Specifies a list of atoms.", &
    3615             :                           usage="LIST {integer} {integer} .. {integer}", &
    3616        8408 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    3617        8408 :       CALL section_add_keyword(section, keyword)
    3618        8408 :       CALL keyword_release(keyword)
    3619             : 
    3620             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER", &
    3621             :                           description="Define accuracy of DBCSR operations", &
    3622        8408 :                           usage="EPS_FILTER", default_r_val=0.0_dp)
    3623        8408 :       CALL section_add_keyword(section, keyword)
    3624        8408 :       CALL keyword_release(keyword)
    3625             : 
    3626        8408 :    END SUBROUTINE create_admm_section
    3627             : 
    3628             : ! **************************************************************************************************
    3629             : !> \brief ...
    3630             : !> \param section ...
    3631             : ! **************************************************************************************************
    3632        8408 :    SUBROUTINE create_se_control_section(section)
    3633             :       TYPE(section_type), POINTER                        :: section
    3634             : 
    3635             :       TYPE(keyword_type), POINTER                        :: keyword
    3636             :       TYPE(section_type), POINTER                        :: subsection
    3637             : 
    3638        8408 :       NULLIFY (keyword)
    3639        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    3640             :       CALL section_create(section, __LOCATION__, name="SE", &
    3641             :                           description="Parameters needed to set up the Semi-empirical methods", &
    3642        8408 :                           n_keywords=8, n_subsections=0, repeats=.FALSE.)
    3643             : 
    3644             :       CALL keyword_create(keyword, __LOCATION__, name="ORTHOGONAL_BASIS", &
    3645             :                           description="Assume orthogonal basis set. This flag is overwritten by "// &
    3646             :                           "methods with fixed orthogonal/non-orthogonal basis set.", &
    3647        8408 :                           usage="ORTHOGONAL_BASIS", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    3648        8408 :       CALL section_add_keyword(section, keyword)
    3649        8408 :       CALL keyword_release(keyword)
    3650             : 
    3651             :       CALL keyword_create(keyword, __LOCATION__, name="STO_NG", &
    3652             :                           description="Provides the order of the Slater orbital expansion of Gaussian-Type Orbitals.", &
    3653        8408 :                           usage="STO_NG", default_i_val=6)
    3654        8408 :       CALL section_add_keyword(section, keyword)
    3655        8408 :       CALL keyword_release(keyword)
    3656             : 
    3657             :       CALL keyword_create(keyword, __LOCATION__, name="ANALYTICAL_GRADIENTS", &
    3658             :                           description="Nuclear Gradients are computed analytically or numerically", &
    3659        8408 :                           usage="ANALYTICAL_GRADIENTS", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    3660        8408 :       CALL section_add_keyword(section, keyword)
    3661        8408 :       CALL keyword_release(keyword)
    3662             : 
    3663             :       CALL keyword_create(keyword, __LOCATION__, name="DELTA", &
    3664             :                           description="Step size in finite difference force calculation", &
    3665        8408 :                           usage="DELTA {real} ", default_r_val=1.e-6_dp)
    3666        8408 :       CALL section_add_keyword(section, keyword)
    3667        8408 :       CALL keyword_release(keyword)
    3668             : 
    3669             :       CALL keyword_create(keyword, __LOCATION__, name="INTEGRAL_SCREENING", &
    3670             :                           description="Specifies the functional form for the ", &
    3671             :                           usage="INTEGRAL_SCREENING (KDSO|KDSO-D|SLATER)", &
    3672             :                           enum_c_vals=s2a("KDSO", "KDSO-D", "SLATER"), &
    3673             :                           enum_i_vals=(/do_se_IS_kdso, do_se_IS_kdso_d, do_se_IS_slater/), &
    3674             :                           enum_desc=s2a("Uses the standard NDDO Klopman-Dewar-Sabelli-Ohno equation "// &
    3675             :                                         "for the screening of the Coulomb interactions.", &
    3676             :                                         "Uses a modified Klopman-Dewar-Sabelli-Ohno equation, dumping the screening "// &
    3677             :                                         "parameter for the Coulomb interactions.", &
    3678             :                                         "Uses an exponential Slater-type function for modelling the Coulomb interactions."), &
    3679        8408 :                           default_i_val=do_se_IS_kdso)
    3680        8408 :       CALL section_add_keyword(section, keyword)
    3681        8408 :       CALL keyword_release(keyword)
    3682             : 
    3683             :       CALL keyword_create(keyword, __LOCATION__, name="PERIODIC", &
    3684             :                           description="Specifies the type of treatment for the electrostatic long-range part "// &
    3685             :                           "in semi-empirical calculations.", &
    3686             :                           usage="PERIODIC (NONE|EWALD|EWALD_R3|EWALD_GKS)", &
    3687             :                           enum_c_vals=s2a("NONE", "EWALD", "EWALD_R3", "EWALD_GKS"), &
    3688             :                           enum_i_vals=(/do_se_lr_none, do_se_lr_ewald, do_se_lr_ewald_r3, do_se_lr_ewald_gks/), &
    3689             :                           enum_desc=s2a("The long-range part is not explicitly treaten. The interaction "// &
    3690             :                                         "depends uniquely on the Cutoffs used for the calculation.", &
    3691             :                                         "Enables the usage of Multipoles Ewald summation schemes. The short-range part "// &
    3692             :                                         "is tapered according the value of RC_COULOMB.", &
    3693             :                                         "Enables the usage of Multipoles Ewald summation schemes together with a long-range "// &
    3694             :                                         "treatment for the 1/R^3 term, deriving from the short-range component. This option "// &
    3695             :                                         "is active only for K-DSO integral screening type.", &
    3696             :                                         "Use Ewald directly in Coulomb integral evaluation, works only with Slater screening"), &
    3697        8408 :                           default_i_val=do_se_lr_none)
    3698        8408 :       CALL section_add_keyword(section, keyword)
    3699        8408 :       CALL keyword_release(keyword)
    3700             : 
    3701             :       CALL keyword_create(keyword, __LOCATION__, name="FORCE_KDSO-D_EXCHANGE", &
    3702             :                           description="This keywords forces the usage of the KDSO-D integral screening "// &
    3703             :                           "for the Exchange integrals (default is to apply the screening only to the "// &
    3704        8408 :                           "Coulomb integrals.", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    3705        8408 :       CALL section_add_keyword(section, keyword)
    3706        8408 :       CALL keyword_release(keyword)
    3707             : 
    3708             :       CALL keyword_create(keyword, __LOCATION__, name="DISPERSION", &
    3709             :                           description="Use dispersion correction", &
    3710             :                           lone_keyword_l_val=.TRUE., &
    3711        8408 :                           usage="DISPERSION", default_l_val=.FALSE.)
    3712        8408 :       CALL section_add_keyword(section, keyword)
    3713        8408 :       CALL keyword_release(keyword)
    3714             : 
    3715             :       CALL keyword_create(keyword, __LOCATION__, name="DISPERSION_PARAMETER_FILE", &
    3716             :                           description="Specify file that contains the atomic dispersion parameters", &
    3717             :                           usage="DISPERSION_PARAMETER_FILE filename", &
    3718        8408 :                           n_var=1, type_of_var=char_t, default_c_val="")
    3719        8408 :       CALL section_add_keyword(section, keyword)
    3720        8408 :       CALL keyword_release(keyword)
    3721             : 
    3722             :       CALL keyword_create(keyword, __LOCATION__, name="DISPERSION_RADIUS", &
    3723             :                           description="Define radius of dispersion interaction", &
    3724        8408 :                           usage="DISPERSION_RADIUS", default_r_val=15._dp)
    3725        8408 :       CALL section_add_keyword(section, keyword)
    3726        8408 :       CALL keyword_release(keyword)
    3727             : 
    3728             :       CALL keyword_create(keyword, __LOCATION__, name="COORDINATION_CUTOFF", &
    3729             :                           description="Define cutoff for coordination number calculation", &
    3730        8408 :                           usage="COORDINATION_CUTOFF", default_r_val=1.e-6_dp)
    3731        8408 :       CALL section_add_keyword(section, keyword)
    3732        8408 :       CALL keyword_release(keyword)
    3733             : 
    3734             :       CALL keyword_create(keyword, __LOCATION__, name="D3_SCALING", &
    3735             :                           description="Scaling parameters (s6,sr6,s8) for the D3 dispersion method,", &
    3736        8408 :                           usage="D3_SCALING 1.0 1.0 1.0", n_var=3, default_r_vals=(/0.0_dp, 0.0_dp, 0.0_dp/))
    3737        8408 :       CALL section_add_keyword(section, keyword)
    3738        8408 :       CALL keyword_release(keyword)
    3739             : 
    3740        8408 :       NULLIFY (subsection)
    3741        8408 :       CALL create_coulomb_section(subsection)
    3742        8408 :       CALL section_add_subsection(section, subsection)
    3743        8408 :       CALL section_release(subsection)
    3744             : 
    3745        8408 :       CALL create_exchange_section(subsection)
    3746        8408 :       CALL section_add_subsection(section, subsection)
    3747        8408 :       CALL section_release(subsection)
    3748             : 
    3749        8408 :       CALL create_screening_section(subsection)
    3750        8408 :       CALL section_add_subsection(section, subsection)
    3751        8408 :       CALL section_release(subsection)
    3752             : 
    3753        8408 :       CALL create_lr_corr_section(subsection)
    3754        8408 :       CALL section_add_subsection(section, subsection)
    3755        8408 :       CALL section_release(subsection)
    3756             : 
    3757        8408 :       CALL create_neighbor_lists_section(subsection)
    3758        8408 :       CALL section_add_subsection(section, subsection)
    3759        8408 :       CALL section_release(subsection)
    3760             : 
    3761        8408 :       CALL create_se_memory_section(subsection)
    3762        8408 :       CALL section_add_subsection(section, subsection)
    3763        8408 :       CALL section_release(subsection)
    3764             : 
    3765        8408 :       CALL create_se_print_section(subsection)
    3766        8408 :       CALL section_add_subsection(section, subsection)
    3767        8408 :       CALL section_release(subsection)
    3768             : 
    3769        8408 :       CALL create_se_ga_section(subsection)
    3770        8408 :       CALL section_add_subsection(section, subsection)
    3771        8408 :       CALL section_release(subsection)
    3772             : 
    3773        8408 :    END SUBROUTINE create_se_control_section
    3774             : 
    3775             : ! **************************************************************************************************
    3776             : !> \brief Create the COULOMB se section
    3777             : !> \param section the section to create
    3778             : !> \date  03.2009
    3779             : !> \author Teodoro Laino [tlaino]
    3780             : ! **************************************************************************************************
    3781        8408 :    SUBROUTINE create_lr_corr_section(section)
    3782             :       TYPE(section_type), POINTER                        :: section
    3783             : 
    3784             :       TYPE(keyword_type), POINTER                        :: keyword
    3785             : 
    3786        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    3787             :       CALL section_create(section, __LOCATION__, name="LR_CORRECTION", &
    3788             :                           description="Setup parameters for the evaluation of the long-range correction term in SE "// &
    3789        8408 :                           "calculations.", n_keywords=0, n_subsections=1, repeats=.FALSE.)
    3790        8408 :       NULLIFY (keyword)
    3791             : 
    3792             :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF", &
    3793             :                           description="Atomic Cutoff Radius Cutoff for the evaluation of the long-ranbe correction integrals. ", &
    3794             :                           usage="CUTOFF {real} ", unit_str="angstrom", &
    3795        8408 :                           default_r_val=cp_unit_to_cp2k(value=6.0_dp, unit_str="angstrom"))
    3796        8408 :       CALL section_add_keyword(section, keyword)
    3797        8408 :       CALL keyword_release(keyword)
    3798             : 
    3799             :       CALL keyword_create(keyword, __LOCATION__, name="RC_TAPER", &
    3800             :                           description="Atomic Cutoff Radius Cutoff for Tapering the long-range correction integrals. "// &
    3801             :                           "If not specified it assumes the same value specified for the CUTOFF.", &
    3802        8408 :                           usage="RC_TAPER {real} ", unit_str="angstrom", type_of_var=real_t)
    3803        8408 :       CALL section_add_keyword(section, keyword)
    3804        8408 :       CALL keyword_release(keyword)
    3805             : 
    3806             :       CALL keyword_create(keyword, __LOCATION__, name="RC_RANGE", &
    3807             :                           description="Range of cutoff switch function (tapering): 0.5*(1-TANH((r-r0)/RC_RANGE)), "// &
    3808             :                           "where r0=2.0*RC_TAPER-20.0*RC_RANGE.", &
    3809        8408 :                           usage="RC_RANGE {real} ", unit_str="angstrom", default_r_val=0.0_dp)
    3810        8408 :       CALL section_add_keyword(section, keyword)
    3811        8408 :       CALL keyword_release(keyword)
    3812             : 
    3813        8408 :    END SUBROUTINE create_lr_corr_section
    3814             : 
    3815             : ! **************************************************************************************************
    3816             : !> \brief Create the COULOMB se section
    3817             : !> \param section the section to create
    3818             : !> \date  03.2009
    3819             : !> \author Teodoro Laino [tlaino]
    3820             : ! **************************************************************************************************
    3821        8408 :    SUBROUTINE create_coulomb_section(section)
    3822             :       TYPE(section_type), POINTER                        :: section
    3823             : 
    3824             :       TYPE(keyword_type), POINTER                        :: keyword
    3825             : 
    3826        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    3827             :       CALL section_create(section, __LOCATION__, name="COULOMB", &
    3828             :                           description="Setup parameters for the evaluation of the COULOMB term in SE "// &
    3829        8408 :                           "calculations.", n_keywords=0, n_subsections=1, repeats=.FALSE.)
    3830        8408 :       NULLIFY (keyword)
    3831             : 
    3832             :       CALL keyword_create( &
    3833             :          keyword, __LOCATION__, name="CUTOFF", &
    3834             :          description="Atomic Cutoff Radius Cutoff for the evaluation of the  Coulomb integrals. "// &
    3835             :          "For non-periodic calculation the default value is exactly the full cell dimension, in order "// &
    3836             :          "to evaluate all pair interactions. Instead, for periodic calculations the default numerical value is used.", &
    3837             :          usage="CUTOFF {real} ", unit_str="angstrom", &
    3838        8408 :          default_r_val=cp_unit_to_cp2k(value=12.0_dp, unit_str="angstrom"))
    3839        8408 :       CALL section_add_keyword(section, keyword)
    3840        8408 :       CALL keyword_release(keyword)
    3841             : 
    3842             :       CALL keyword_create(keyword, __LOCATION__, name="RC_TAPER", &
    3843             :                           description="Atomic Cutoff Radius Cutoff for Tapering Coulomb integrals. "// &
    3844             :                           "If not specified it assumes the same value specified for the CUTOFF.", &
    3845        8408 :                           usage="RC_TAPER {real} ", unit_str="angstrom", type_of_var=real_t)
    3846        8408 :       CALL section_add_keyword(section, keyword)
    3847        8408 :       CALL keyword_release(keyword)
    3848             : 
    3849             :       CALL keyword_create(keyword, __LOCATION__, name="RC_RANGE", &
    3850             :                           description="Range of cutoff switch function (tapering): 0.5*(1-TANH((r-r0)/RC_RANGE)), "// &
    3851             :                           "where r0=2.0*RC_TAPER-20.0*RC_RANGE.", &
    3852        8408 :                           usage="RC_RANGE {real} ", unit_str="angstrom", default_r_val=0.0_dp)
    3853        8408 :       CALL section_add_keyword(section, keyword)
    3854        8408 :       CALL keyword_release(keyword)
    3855             : 
    3856        8408 :    END SUBROUTINE create_coulomb_section
    3857             : 
    3858             : ! **************************************************************************************************
    3859             : !> \brief Create the EXCHANGE se section
    3860             : !> \param section the section to create
    3861             : !> \date  03.2009
    3862             : !> \author Teodoro Laino [tlaino]
    3863             : ! **************************************************************************************************
    3864        8408 :    SUBROUTINE create_exchange_section(section)
    3865             :       TYPE(section_type), POINTER                        :: section
    3866             : 
    3867             :       TYPE(keyword_type), POINTER                        :: keyword
    3868             : 
    3869        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    3870             :       CALL section_create(section, __LOCATION__, name="EXCHANGE", &
    3871             :                           description="Setup parameters for the evaluation of the EXCHANGE and "// &
    3872             :                           "core Hamiltonian terms in SE calculations.", n_keywords=0, n_subsections=1, &
    3873        8408 :                           repeats=.FALSE.)
    3874        8408 :       NULLIFY (keyword)
    3875             : 
    3876             :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF", &
    3877             :                           description="Atomic Cutoff Radius Cutoff for the evaluation of the Exchange integrals. "// &
    3878             :                           "For non-periodic calculation the default value is exactly the full cell dimension, in order "// &
    3879             :                           "to evaluate all pair interactions. Instead, for periodic calculations the default is the "// &
    3880             :                           "minimum value between 1/4 of the cell dimension and the value specified in input (either"// &
    3881             :                           " explicitly defined or the default numerical value).", &
    3882             :                           usage="CUTOFF {real} ", unit_str="angstrom", &
    3883        8408 :                           default_r_val=cp_unit_to_cp2k(value=12.0_dp, unit_str="angstrom"))
    3884        8408 :       CALL section_add_keyword(section, keyword)
    3885        8408 :       CALL keyword_release(keyword)
    3886             : 
    3887             :       CALL keyword_create(keyword, __LOCATION__, name="RC_TAPER", &
    3888             :                           description="Atomic Cutoff Radius Cutoff for Tapering Exchange integrals. "// &
    3889             :                           "If not specified it assumes the same value specified for the CUTOFF.", &
    3890        8408 :                           usage="RC_TAPER {real} ", unit_str="angstrom", type_of_var=real_t)
    3891        8408 :       CALL section_add_keyword(section, keyword)
    3892        8408 :       CALL keyword_release(keyword)
    3893             : 
    3894             :       CALL keyword_create(keyword, __LOCATION__, name="RC_RANGE", &
    3895             :                           description="Range of cutoff switch function (tapering): 0.5*(1-TANH((r-r0)/RC_RANGE)), "// &
    3896             :                           "where r0=2.0*RC_TAPER-20.0*RC_RANGE.", &
    3897        8408 :                           usage="RC_RANGE {real} ", unit_str="angstrom", default_r_val=0.0_dp)
    3898        8408 :       CALL section_add_keyword(section, keyword)
    3899        8408 :       CALL keyword_release(keyword)
    3900             : 
    3901        8408 :    END SUBROUTINE create_exchange_section
    3902             : 
    3903             : ! **************************************************************************************************
    3904             : !> \brief Create the SCREENING se section
    3905             : !> \param section the section to create
    3906             : !> \date  03.2009
    3907             : !> \author Teodoro Laino [tlaino]
    3908             : ! **************************************************************************************************
    3909        8408 :    SUBROUTINE create_screening_section(section)
    3910             :       TYPE(section_type), POINTER                        :: section
    3911             : 
    3912             :       TYPE(keyword_type), POINTER                        :: keyword
    3913             : 
    3914        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    3915             :       CALL section_create(section, __LOCATION__, name="SCREENING", &
    3916             :                           description="Setup parameters for the tapering of the Coulomb/Exchange Screening in "// &
    3917        8408 :                           "KDSO-D integral scheme,", n_keywords=0, n_subsections=1, repeats=.FALSE.)
    3918        8408 :       NULLIFY (keyword)
    3919             : 
    3920             :       CALL keyword_create(keyword, __LOCATION__, name="RC_TAPER", &
    3921             :                           description="Atomic Cutoff Radius Cutoff for Tapering the screening term. ", &
    3922             :                           usage="RC_TAPER {real} ", unit_str="angstrom", &
    3923        8408 :                           default_r_val=cp_unit_to_cp2k(value=12.0_dp, unit_str="angstrom"))
    3924        8408 :       CALL section_add_keyword(section, keyword)
    3925        8408 :       CALL keyword_release(keyword)
    3926             : 
    3927             :       CALL keyword_create(keyword, __LOCATION__, name="RC_RANGE", &
    3928             :                           description="Range of cutoff switch function (tapering): 0.5*(1-TANH((r-r0)/RC_RANGE)), "// &
    3929             :                           "where r0=2*RC_TAPER-20*RC_RANGE.", &
    3930        8408 :                           usage="RC_RANGE {real} ", unit_str="angstrom", default_r_val=0.0_dp)
    3931        8408 :       CALL section_add_keyword(section, keyword)
    3932        8408 :       CALL keyword_release(keyword)
    3933             : 
    3934        8408 :    END SUBROUTINE create_screening_section
    3935             : 
    3936             : ! **************************************************************************************************
    3937             : !> \brief Create the print se section
    3938             : !> \param section the section to create
    3939             : !> \author teo
    3940             : ! **************************************************************************************************
    3941        8408 :    SUBROUTINE create_se_print_section(section)
    3942             :       TYPE(section_type), POINTER                        :: section
    3943             : 
    3944             :       TYPE(section_type), POINTER                        :: print_key
    3945             : 
    3946        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    3947             :       CALL section_create(section, __LOCATION__, name="print", &
    3948             :                           description="Section of possible print options in SE code.", &
    3949        8408 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    3950             : 
    3951        8408 :       NULLIFY (print_key)
    3952             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "NEIGHBOR_LISTS", &
    3953             :                                        description="Activates the printing of the neighbor lists used"// &
    3954             :                                        " for the periodic SE calculations.", &
    3955        8408 :                                        print_level=high_print_level, filename="", unit_str="angstrom")
    3956        8408 :       CALL section_add_subsection(section, print_key)
    3957        8408 :       CALL section_release(print_key)
    3958             : 
    3959             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "SUBCELL", &
    3960             :                                        description="Activates the printing of the subcells used for the "// &
    3961             :                                        "generation of neighbor lists for periodic SE.", &
    3962        8408 :                                        print_level=high_print_level, filename="__STD_OUT__")
    3963        8408 :       CALL section_add_subsection(section, print_key)
    3964        8408 :       CALL section_release(print_key)
    3965             : 
    3966             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "EWALD_INFO", &
    3967             :                                        description="Activates the printing of the information for "// &
    3968             :                                        "Ewald multipole summation in periodic SE.", &
    3969        8408 :                                        print_level=high_print_level, filename="__STD_OUT__")
    3970        8408 :       CALL section_add_subsection(section, print_key)
    3971        8408 :       CALL section_release(print_key)
    3972             : 
    3973        8408 :    END SUBROUTINE create_se_print_section
    3974             : 
    3975             : ! **************************************************************************************************
    3976             : !> \brief creates the input section for use with the GA part of the code
    3977             : !> \param section the section to create
    3978             : !> \author Teodoro Laino [tlaino] - University of Zurich - 05.2008
    3979             : ! **************************************************************************************************
    3980        8408 :    SUBROUTINE create_se_ga_section(section)
    3981             :       TYPE(section_type), POINTER                        :: section
    3982             : 
    3983             :       TYPE(keyword_type), POINTER                        :: keyword
    3984             : 
    3985        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    3986             :       CALL section_create(section, __LOCATION__, name="GA", &
    3987             :                           description="Sets up memory parameters for the storage of the integrals", &
    3988        8408 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    3989        8408 :       NULLIFY (keyword)
    3990             : 
    3991             :       CALL keyword_create( &
    3992             :          keyword, __LOCATION__, &
    3993             :          name="NCELLS", &
    3994             :          description="Defines the number of linked cells for the neighbor list. "// &
    3995             :          "Default value is number of processors", &
    3996             :          usage="NCELLS 10", &
    3997        8408 :          default_i_val=0)
    3998        8408 :       CALL section_add_keyword(section, keyword)
    3999        8408 :       CALL keyword_release(keyword)
    4000        8408 :    END SUBROUTINE create_se_ga_section
    4001             : 
    4002             : ! **************************************************************************************************
    4003             : !> \brief creates the input section for the se-memory part integral storage
    4004             : !> \param section the section to create
    4005             : !> \author Teodoro Laino [tlaino] - University of Zurich - 05.2008
    4006             : ! **************************************************************************************************
    4007        8408 :    SUBROUTINE create_se_memory_section(section)
    4008             :       TYPE(section_type), POINTER                        :: section
    4009             : 
    4010             :       TYPE(keyword_type), POINTER                        :: keyword
    4011             : 
    4012        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    4013             :       CALL section_create(section, __LOCATION__, name="MEMORY", &
    4014             :                           description="Sets up memory parameters for the storage of the integrals", &
    4015        8408 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    4016        8408 :       NULLIFY (keyword)
    4017             :       CALL keyword_create( &
    4018             :          keyword, __LOCATION__, &
    4019             :          name="EPS_STORAGE", &
    4020             :          description="Storage threshold for compression is EPS_STORAGE", &
    4021             :          usage="EPS_STORAGE 1.0E-10", &
    4022        8408 :          default_r_val=1.0E-10_dp)
    4023        8408 :       CALL section_add_keyword(section, keyword)
    4024        8408 :       CALL keyword_release(keyword)
    4025             : 
    4026             :       CALL keyword_create( &
    4027             :          keyword, __LOCATION__, &
    4028             :          name="MAX_MEMORY", &
    4029             :          description="Defines the maximum amount of memory [MB] used to store precomputed "// &
    4030             :          "(possibly compressed) two-electron two-center integrals", &
    4031             :          usage="MAX_MEMORY 256", &
    4032        8408 :          default_i_val=50)
    4033        8408 :       CALL section_add_keyword(section, keyword)
    4034        8408 :       CALL keyword_release(keyword)
    4035             : 
    4036             :       CALL keyword_create(keyword, __LOCATION__, name="COMPRESS", &
    4037             :                           description="Enables the compression of the integrals in memory.", &
    4038             :                           usage="COMPRESS <LOGICAL>", &
    4039        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4040        8408 :       CALL section_add_keyword(section, keyword)
    4041        8408 :       CALL keyword_release(keyword)
    4042             : 
    4043        8408 :    END SUBROUTINE create_se_memory_section
    4044             : 
    4045             : ! **************************************************************************************************
    4046             : !> \brief ...
    4047             : !> \param section ...
    4048             : ! **************************************************************************************************
    4049        8408 :    SUBROUTINE create_mulliken_section(section)
    4050             :       TYPE(section_type), POINTER                        :: section
    4051             : 
    4052             :       TYPE(keyword_type), POINTER                        :: keyword
    4053             : 
    4054        8408 :       NULLIFY (keyword)
    4055        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    4056             :       CALL section_create(section, __LOCATION__, name="MULLIKEN_RESTRAINT", &
    4057             :                           description="Use mulliken charges in a restraint (check code for details)", &
    4058        8408 :                           n_keywords=7, n_subsections=0, repeats=.FALSE.)
    4059             : 
    4060             :       CALL keyword_create(keyword, __LOCATION__, name="STRENGTH", &
    4061             :                           description="force constant of the restraint", &
    4062        8408 :                           usage="STRENGTH {real} ", default_r_val=0.1_dp)
    4063        8408 :       CALL section_add_keyword(section, keyword)
    4064        8408 :       CALL keyword_release(keyword)
    4065             : 
    4066             :       CALL keyword_create(keyword, __LOCATION__, name="TARGET", &
    4067             :                           description="target value of the restraint", &
    4068        8408 :                           usage="TARGET {real} ", default_r_val=1._dp)
    4069        8408 :       CALL section_add_keyword(section, keyword)
    4070        8408 :       CALL keyword_release(keyword)
    4071             : 
    4072             :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
    4073             :                           description="Specifies the list of atoms that is summed in the restraint", &
    4074             :                           usage="ATOMS {integer} {integer} .. {integer}", &
    4075        8408 :                           n_var=-1, type_of_var=integer_t)
    4076        8408 :       CALL section_add_keyword(section, keyword)
    4077        8408 :       CALL keyword_release(keyword)
    4078             : 
    4079        8408 :    END SUBROUTINE create_mulliken_section
    4080             : 
    4081             : ! **************************************************************************************************
    4082             : !> \brief ...
    4083             : !> \param section ...
    4084             : ! **************************************************************************************************
    4085        8408 :    SUBROUTINE create_density_fitting_section(section)
    4086             :       TYPE(section_type), POINTER                        :: section
    4087             : 
    4088             :       TYPE(keyword_type), POINTER                        :: keyword
    4089             :       TYPE(section_type), POINTER                        :: print_key
    4090             : 
    4091        8408 :       NULLIFY (keyword, print_key)
    4092        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    4093             :       CALL section_create(section, __LOCATION__, name="DENSITY_FITTING", &
    4094             :                           description="Setup parameters for density fitting (Bloechl charges or density derived "// &
    4095             :                           "atomic point charges (DDAPC) charges)", &
    4096             :                           n_keywords=7, n_subsections=0, repeats=.FALSE., &
    4097       16816 :                           citations=(/Blochl1995/))
    4098             : 
    4099             :       CALL keyword_create(keyword, __LOCATION__, name="NUM_GAUSS", &
    4100             :                           description="Specifies the numbers of gaussian used to fit the QM density for each atomic site.", &
    4101             :                           usage="NUM_GAUSS {integer}", &
    4102        8408 :                           n_var=1, type_of_var=integer_t, default_i_val=3)
    4103        8408 :       CALL section_add_keyword(section, keyword)
    4104        8408 :       CALL keyword_release(keyword)
    4105             : 
    4106             :       CALL keyword_create(keyword, __LOCATION__, name="PFACTOR", &
    4107             :                           description="Specifies the progression factor for the gaussian exponent for each atomic site.", &
    4108             :                           usage="PFACTOR {real}", &
    4109        8408 :                           n_var=1, type_of_var=real_t, default_r_val=1.5_dp)
    4110        8408 :       CALL section_add_keyword(section, keyword)
    4111        8408 :       CALL keyword_release(keyword)
    4112             : 
    4113             :       CALL keyword_create(keyword, __LOCATION__, name="MIN_RADIUS", &
    4114             :                           description="Specifies the smallest radius of the gaussian used in the fit. All other radius are"// &
    4115             :                           " obtained with the progression factor.", &
    4116             :                           usage="MIN_RADIUS {real}", &
    4117        8408 :                           unit_str="angstrom", n_var=1, type_of_var=real_t, default_r_val=0.5_dp)
    4118        8408 :       CALL section_add_keyword(section, keyword)
    4119        8408 :       CALL keyword_release(keyword)
    4120             : 
    4121             :       CALL keyword_create(keyword, __LOCATION__, name="RADII", &
    4122             :                           description="Specifies all the radius of the gaussian used in the fit for each atomic site. The use"// &
    4123             :                           " of this keyword disables all other keywords of this section.", &
    4124             :                           usage="RADII {real} {real} .. {real}", &
    4125        8408 :                           unit_str="angstrom", n_var=-1, type_of_var=real_t)
    4126        8408 :       CALL section_add_keyword(section, keyword)
    4127        8408 :       CALL keyword_release(keyword)
    4128             : 
    4129             :       CALL keyword_create(keyword, __LOCATION__, name="GCUT", &
    4130             :                           description="Cutoff for charge fit in G-space.", &
    4131             :                           usage="GCUT {real}", &
    4132        8408 :                           n_var=1, type_of_var=real_t, default_r_val=SQRT(6.0_dp))
    4133        8408 :       CALL section_add_keyword(section, keyword)
    4134        8408 :       CALL keyword_release(keyword)
    4135             : 
    4136             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
    4137             :                                        description="Controls the printing of basic information during the run", &
    4138        8408 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    4139             : 
    4140             :       CALL keyword_create(keyword, __LOCATION__, name="CONDITION_NUMBER", &
    4141             :                           description="Prints information regarding the condition numbers of the A matrix (to be inverted)", &
    4142             :                           usage="ANALYTICAL_GTERM <LOGICAL>", &
    4143        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4144        8408 :       CALL section_add_keyword(print_key, keyword)
    4145        8408 :       CALL keyword_release(keyword)
    4146             : 
    4147        8408 :       CALL section_add_subsection(section, print_key)
    4148        8408 :       CALL section_release(print_key)
    4149             : 
    4150        8408 :    END SUBROUTINE create_density_fitting_section
    4151             : 
    4152             : ! **************************************************************************************************
    4153             : !> \brief ...
    4154             : !> \param section ...
    4155             : !> \param section_name ...
    4156             : ! **************************************************************************************************
    4157       25192 :    SUBROUTINE create_ddapc_restraint_section(section, section_name)
    4158             :       TYPE(section_type), POINTER                        :: section
    4159             :       CHARACTER(len=*), INTENT(in)                       :: section_name
    4160             : 
    4161             :       TYPE(keyword_type), POINTER                        :: keyword
    4162             :       TYPE(section_type), POINTER                        :: print_key
    4163             : 
    4164       25192 :       NULLIFY (keyword, print_key)
    4165           0 :       CPASSERT(.NOT. ASSOCIATED(section))
    4166             :       CALL section_create(section, __LOCATION__, name=TRIM(ADJUSTL(section_name)), &
    4167             :                           description="Use DDAPC charges in a restraint (check code for details)", &
    4168       25192 :                           n_keywords=7, n_subsections=0, repeats=.TRUE.)
    4169             : 
    4170             :       CALL keyword_create(keyword, __LOCATION__, name="TYPE_OF_DENSITY", &
    4171             :                           description="Specifies the type of density used for the fitting", &
    4172             :                           usage="TYPE_OF_DENSITY (FULL|SPIN)", &
    4173             :                           enum_c_vals=s2a("FULL", "SPIN"), &
    4174             :                           enum_i_vals=(/do_full_density, do_spin_density/), &
    4175             :                           enum_desc=s2a("Full density", "Spin density"), &
    4176       25192 :                           default_i_val=do_full_density)
    4177       25192 :       CALL section_add_keyword(section, keyword)
    4178       25192 :       CALL keyword_release(keyword)
    4179             : 
    4180             :       CALL keyword_create(keyword, __LOCATION__, name="STRENGTH", &
    4181             :                           description="force constant of the restraint", &
    4182       25192 :                           usage="STRENGTH {real} ", default_r_val=0.1_dp)
    4183       25192 :       CALL section_add_keyword(section, keyword)
    4184       25192 :       CALL keyword_release(keyword)
    4185             : 
    4186             :       CALL keyword_create(keyword, __LOCATION__, name="TARGET", &
    4187             :                           description="target value of the restraint", &
    4188       25192 :                           usage="TARGET {real} ", default_r_val=1._dp)
    4189       25192 :       CALL section_add_keyword(section, keyword)
    4190       25192 :       CALL keyword_release(keyword)
    4191             : 
    4192             :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
    4193             :                           description="Specifies the list of atoms that is summed in the restraint", &
    4194             :                           usage="ATOMS {integer} {integer} .. {integer}", &
    4195       25192 :                           n_var=-1, type_of_var=integer_t)
    4196       25192 :       CALL section_add_keyword(section, keyword)
    4197       25192 :       CALL keyword_release(keyword)
    4198             : 
    4199             :       CALL keyword_create(keyword, __LOCATION__, name="COEFF", &
    4200             :                           description="Defines the the coefficient of the atom in the atom list (default is one) ", &
    4201             :                           usage="COEFF 1.0 -1.0", &
    4202       25192 :                           type_of_var=real_t, n_var=-1)
    4203       25192 :       CALL section_add_keyword(section, keyword)
    4204       25192 :       CALL keyword_release(keyword)
    4205             : 
    4206             :       CALL keyword_create(keyword, __LOCATION__, name="FUNCTIONAL_FORM", &
    4207             :                           description="Specifies the functional form of the term added", &
    4208             :                           usage="FUNCTIONAL_FORM RESTRAINT", &
    4209             :                           enum_c_vals=s2a("RESTRAINT", "CONSTRAINT"), &
    4210             :                           enum_i_vals=(/do_ddapc_restraint, do_ddapc_constraint/), &
    4211             :                           enum_desc=s2a("Harmonic potential: s*(q-t)**2", "Constraint form: s*(q-t)"), &
    4212       25192 :                           default_i_val=do_ddapc_restraint)
    4213       25192 :       CALL section_add_keyword(section, keyword)
    4214       25192 :       CALL keyword_release(keyword)
    4215             : 
    4216             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
    4217             :                                        description="Controls the printing basic info about the method", &
    4218       25192 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    4219       25192 :       CALL section_add_subsection(section, print_key)
    4220       25192 :       CALL section_release(print_key)
    4221             : 
    4222       25192 :    END SUBROUTINE create_ddapc_restraint_section
    4223             : 
    4224             : ! **************************************************************************************************
    4225             : !> \brief Create input section to define CDFT constraint settings specific to Becke weight function.
    4226             : !> \param section the section to create
    4227             : ! **************************************************************************************************
    4228        8408 :    SUBROUTINE create_becke_constraint_section(section)
    4229             :       TYPE(section_type), POINTER                        :: section
    4230             : 
    4231             :       TYPE(keyword_type), POINTER                        :: keyword
    4232             : 
    4233        8408 :       NULLIFY (keyword)
    4234        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    4235             :       CALL section_create(section, __LOCATION__, name="BECKE_CONSTRAINT", &
    4236             :                           description="Define settings influencing the construction of the Becke weight function.", &
    4237       16816 :                           n_keywords=13, repeats=.FALSE., citations=(/Becke1988b/))
    4238             : 
    4239             :       CALL keyword_create(keyword, __LOCATION__, name="ADJUST_SIZE", &
    4240             :                           description="Adjust Becke cell boundaries with atomic"// &
    4241             :                           " radii to generate a heteronuclear cutoff profile. These"// &
    4242             :                           " radii are defined with the keyword ATOMIC_RADII.", &
    4243             :                           usage="ADJUST_SIZE", &
    4244        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4245        8408 :       CALL section_add_keyword(section, keyword)
    4246        8408 :       CALL keyword_release(keyword)
    4247             : 
    4248             :       CALL keyword_create(keyword, __LOCATION__, name="ATOMIC_RADII", &
    4249             :                           description="Defines atomic radii to generate a heteronuclear cutoff profile."// &
    4250             :                           " Give one value per element in the same order as they"// &
    4251             :                           " appear in the input coordinates.", &
    4252             :                           usage="ATOMIC_RADII {real} {real} {real}", repeats=.FALSE., &
    4253             :                           unit_str="angstrom", &
    4254        8408 :                           type_of_var=real_t, n_var=-1)
    4255        8408 :       CALL section_add_keyword(section, keyword)
    4256        8408 :       CALL keyword_release(keyword)
    4257             : 
    4258             :       CALL keyword_create(keyword, __LOCATION__, name="SHOULD_SKIP", &
    4259             :                           description="If grid point is farther than GLOBAL_CUTOFF from all constraint atoms, "// &
    4260             :                           "move directly to next grid point, thus saving computational resources.", &
    4261             :                           usage="SHOULD_SKIP", &
    4262        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4263        8408 :       CALL section_add_keyword(section, keyword)
    4264        8408 :       CALL keyword_release(keyword)
    4265             : 
    4266             :       CALL keyword_create(keyword, __LOCATION__, name="CAVITY_CONFINE", &
    4267             :                           description="Activates Gaussian cavity confinement. The constraint is evaluated only inside "// &
    4268             :                           "the cavity. The cavity is formed by summing spherical Gaussians centered on the constraint atoms.", &
    4269             :                           usage="CAVITY_CONFINE", &
    4270        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4271        8408 :       CALL section_add_keyword(section, keyword)
    4272        8408 :       CALL keyword_release(keyword)
    4273             : 
    4274             :       CALL keyword_create(keyword, __LOCATION__, name="CAVITY_SHAPE", &
    4275             :                           description="Specifies the type of Gaussian cavity used.", &
    4276             :                           usage="CAVITY_SHAPE (SINGLE|VDW|COVALENT|USER)", &
    4277             :                           enum_c_vals=s2a("DEFAULT", "SINGLE", "VDW", "COVALENT", "USER"), &
    4278             :                           enum_i_vals=(/radius_default, radius_single, radius_vdw, radius_covalent, radius_user/), &
    4279             :                           enum_desc=s2a("Use covalent radii (in angstrom) to construct Gaussians, but fixed"// &
    4280             :                                         " 1.0_dp radius for elements with a radius larger than this value.", &
    4281             :                                         "Single Gaussian for all atom types with radius given by CAVITY_RADIUS.", &
    4282             :                                         "Use van der Waals radii to construct Gaussians.", &
    4283             :                                         "Use covalent radii to construct Gaussians.", &
    4284             :                                         "Use user defined radii (keyword ATOMIC_RADII) to construct Gaussians."), &
    4285        8408 :                           default_i_val=radius_default)
    4286        8408 :       CALL section_add_keyword(section, keyword)
    4287        8408 :       CALL keyword_release(keyword)
    4288             : 
    4289             :       CALL keyword_create(keyword, __LOCATION__, name="CAVITY_USE_BOHR", &
    4290             :                           description="Convert the cavity radius from angstrom to bohr. This results in a larger"// &
    4291             :                           " confinement cavity than without unit conversion.", &
    4292             :                           usage="CAVITY_USE_BOHR TRUE", &
    4293        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4294        8408 :       CALL section_add_keyword(section, keyword)
    4295        8408 :       CALL keyword_release(keyword)
    4296             : 
    4297             :       CALL keyword_create(keyword, __LOCATION__, name="CAVITY_PRINT", &
    4298             :                           description="Print cavity in Gaussian cube file format. Currently, printing options"// &
    4299             :                           " are hardcoded.", &
    4300             :                           usage="CAVITY_PRINT", &
    4301        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4302        8408 :       CALL section_add_keyword(section, keyword)
    4303        8408 :       CALL keyword_release(keyword)
    4304             : 
    4305             :       CALL keyword_create(keyword, __LOCATION__, name="CAVITY_RADIUS", &
    4306             :                           description="Radius parameter controlling the creation of Gaussian cavity confinement.", &
    4307             :                           usage="CAVITY_RADIUS <REAL>", &
    4308             :                           unit_str="angstrom", &
    4309             :                           default_r_val=cp_unit_to_cp2k(3.0_dp, "angstrom"), &
    4310        8408 :                           type_of_var=real_t, n_var=1)
    4311        8408 :       CALL section_add_keyword(section, keyword)
    4312        8408 :       CALL keyword_release(keyword)
    4313             : 
    4314             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_CAVITY", &
    4315             :                           description="Density threshold for cavity creation. Grid points where the Gaussian"// &
    4316             :                           " density falls below the threshold are ignored.", &
    4317        8408 :                           usage="EPS_CAVITY {real} ", default_r_val=1.0e-6_dp)
    4318        8408 :       CALL section_add_keyword(section, keyword)
    4319        8408 :       CALL keyword_release(keyword)
    4320             : 
    4321             :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_TYPE", &
    4322             :                           description="Specifies the type of cutoff used when building the Becke weight function.", &
    4323             :                           usage="CUTOFF_TYPE (GLOBAL|ELEMENT)", &
    4324             :                           enum_c_vals=s2a("GLOBAL", "ELEMENT"), &
    4325             :                           enum_i_vals=(/becke_cutoff_global, becke_cutoff_element/), &
    4326             :                           enum_desc=s2a("Use a single value for all elements. Read from GLOBAL_CUTOFF.", &
    4327             :                                         "Use a different value for all elements. Values read from ELEMENT_CUTOFF."), &
    4328        8408 :                           default_i_val=becke_cutoff_global)
    4329        8408 :       CALL section_add_keyword(section, keyword)
    4330        8408 :       CALL keyword_release(keyword)
    4331             : 
    4332             :       CALL keyword_create(keyword, __LOCATION__, name="GLOBAL_CUTOFF", &
    4333             :                           description="Parameter used to select which atoms contribute to the"// &
    4334             :                           " weight function at each real space grid point.", &
    4335             :                           usage="GLOBAL_CUTOFF <REAL>", &
    4336             :                           unit_str="angstrom", &
    4337             :                           default_r_val=cp_unit_to_cp2k(3.1750632515_dp, "angstrom"), &
    4338        8408 :                           type_of_var=real_t, n_var=1)
    4339        8408 :       CALL section_add_keyword(section, keyword)
    4340        8408 :       CALL keyword_release(keyword)
    4341             : 
    4342             :       CALL keyword_create(keyword, __LOCATION__, name="ELEMENT_CUTOFF", &
    4343             :                           description="Defines element specific cutoffs to decide which atoms contribute to the"// &
    4344             :                           " weight function at each real space grid point. Give one value per element in the same"// &
    4345             :                           " order as they appear in the coordinates.", &
    4346             :                           usage="ELEMENT_CUTOFF {real} {real} {real}", repeats=.FALSE., &
    4347             :                           unit_str="angstrom", &
    4348        8408 :                           type_of_var=real_t, n_var=-1)
    4349        8408 :       CALL section_add_keyword(section, keyword)
    4350        8408 :       CALL keyword_release(keyword)
    4351             : 
    4352             :       CALL keyword_create(keyword, __LOCATION__, name="IN_MEMORY", &
    4353             :                           description="Precompute gradients due to Becke constraint during"// &
    4354             :                           " initial formation of constraint and store them in memory. Useful"// &
    4355             :                           " in combination with confinement, memory intensive otherwise. Does"// &
    4356             :                           " nothing if forces are not calculated.", &
    4357             :                           usage="IN_MEMORY", &
    4358        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4359        8408 :       CALL section_add_keyword(section, keyword)
    4360        8408 :       CALL keyword_release(keyword)
    4361             : 
    4362        8408 :    END SUBROUTINE create_becke_constraint_section
    4363             : 
    4364             : ! **************************************************************************************************
    4365             : !> \brief Creates the input section for defining CDFT constraints.
    4366             : !> \param section the section to create
    4367             : ! **************************************************************************************************
    4368        8408 :    SUBROUTINE create_cdft_control_section(section)
    4369             :       TYPE(section_type), POINTER                        :: section
    4370             : 
    4371             :       TYPE(keyword_type), POINTER                        :: keyword
    4372             :       TYPE(section_type), POINTER                        :: group_section, print_key, subsection
    4373             : 
    4374        8408 :       NULLIFY (keyword, subsection, group_section, print_key)
    4375             : 
    4376        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    4377             :       CALL section_create(section, __LOCATION__, name="CDFT", &
    4378             :                           description="Parameters needed to set up a constrained DFT calculation."// &
    4379             :                           " Each repetition of the ATOM_GROUP section defines a new constraint."// &
    4380             :                           " The constraint(s) is (are) converged in a separate external SCF loop with settings"// &
    4381             :                           " read from the OUTER_SCF section. Supported constraints: Becke and Gaussian"// &
    4382             :                           " Hirshfeld (partial).", n_keywords=8, n_subsections=2, &
    4383       25224 :                           repeats=.FALSE., citations=(/Holmberg2017, Holmberg2018/))
    4384             : 
    4385        8408 :       NULLIFY (subsection, keyword)
    4386        8408 :       CALL create_outer_scf_section(subsection)
    4387        8408 :       CALL section_add_subsection(section, subsection)
    4388        8408 :       CALL section_release(subsection)
    4389             : 
    4390        8408 :       CALL create_becke_constraint_section(subsection)
    4391        8408 :       CALL section_add_subsection(section, subsection)
    4392        8408 :       CALL section_release(subsection)
    4393             : 
    4394        8408 :       CALL create_hirshfeld_constraint_section(subsection)
    4395        8408 :       CALL section_add_subsection(section, subsection)
    4396        8408 :       CALL section_release(subsection)
    4397             : 
    4398             :       CALL keyword_create(keyword, __LOCATION__, name="TYPE_OF_CONSTRAINT", &
    4399             :                           description="Specifies the type of constraint used.", &
    4400             :                           usage="TYPE_OF_CONSTRAINT (NONE|HIRSHFELD|BECKE)", &
    4401             :                           enum_c_vals=s2a("NONE", "HIRSHFELD", "BECKE"), &
    4402             :                           enum_i_vals=(/outer_scf_none, outer_scf_hirshfeld_constraint, &
    4403             :                                         outer_scf_becke_constraint/), &
    4404             :                           enum_desc=s2a("No constraint (disables section).", &
    4405             :                                         "Gaussian Hirshfeld constraint. Partial implementation: no forces. "// &
    4406             :                                         "Requires corresponding section. Not as extensively tested.", &
    4407             :                                         "Becke constraint. Requires corresponding section."), &
    4408             :                           citations=(/Becke1988b/), &
    4409       16816 :                           default_i_val=outer_scf_none)
    4410        8408 :       CALL section_add_keyword(section, keyword)
    4411        8408 :       CALL keyword_release(keyword)
    4412             : 
    4413             :       CALL keyword_create(keyword, __LOCATION__, name="STRENGTH", &
    4414             :                           description="Constraint force constants (Lagrange multipliers). "// &
    4415             :                           "Give one value per constraint group.", &
    4416             :                           type_of_var=real_t, n_var=-1, &
    4417        8408 :                           default_r_val=0.0_dp)
    4418        8408 :       CALL section_add_keyword(section, keyword)
    4419        8408 :       CALL keyword_release(keyword)
    4420             : 
    4421             :       CALL keyword_create(keyword, __LOCATION__, name="TARGET", &
    4422             :                           description="Constraint target values. Give one value per constraint group. "// &
    4423             :                           "The target value is the desired number of valence electrons, spin moment, or the number of "// &
    4424             :                           "alpha or beta electrons on the atoms that define the constraint, suitably multiplied by "// &
    4425             :                           "atomic coefficients in case a relative constraint between two sets of atoms is employed. "// &
    4426             :                           "Note that core charges are not subtracted from the target value.", &
    4427             :                           usage="TARGET {real}", repeats=.FALSE., &
    4428             :                           type_of_var=real_t, n_var=-1, &
    4429        8408 :                           default_r_val=0.0_dp)
    4430        8408 :       CALL section_add_keyword(section, keyword)
    4431        8408 :       CALL keyword_release(keyword)
    4432             : 
    4433             :       CALL keyword_create(keyword, __LOCATION__, name="ATOMIC_CHARGES", &
    4434             :                           description="Calculate atomic CDFT charges with selected weight function"// &
    4435             :                           " (Z = Z_core - Z_CDFT). With fragment based constraints, charges are"// &
    4436             :                           " relative to the fragment reference state i.e. Z = Z_CDFT -"// &
    4437             :                           " Z_frag_reference. Note: if the number of atoms is greater than the"// &
    4438             :                           " default pw_pool max cache, calculation of atomic CDFT charges"// &
    4439             :                           " will prompt harmless warnings during deallocation of atomic grids.", &
    4440             :                           usage="ATOMIC_CHARGES", &
    4441        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4442        8408 :       CALL section_add_keyword(section, keyword)
    4443        8408 :       CALL keyword_release(keyword)
    4444             : 
    4445             :       CALL keyword_create(keyword, __LOCATION__, name="FRAGMENT_A_FILE_NAME", variants=(/"FRAGMENT_A_FILE"/), &
    4446             :                           description="Name of the reference total electron density cube file for fragment A."// &
    4447             :                           " May include a path. The reference electron density needs to be outputted"// &
    4448             :                           " on the same grid as the full system (same cutoff and cell, output stride 1).", &
    4449             :                           usage="FRAGMENT_A_FILE_NAME <FILENAME>", &
    4450       16816 :                           default_lc_val="fragment_a.cube")
    4451        8408 :       CALL section_add_keyword(section, keyword)
    4452        8408 :       CALL keyword_release(keyword)
    4453             : 
    4454             :       CALL keyword_create(keyword, __LOCATION__, name="FRAGMENT_B_FILE_NAME", variants=(/"FRAGMENT_B_FILE"/), &
    4455             :                           description="Name of the reference total electron density cube file for fragment B."// &
    4456             :                           " May include a path. The reference electron density needs to be outputted"// &
    4457             :                           " on the same grid as the full system (same cutoff and cell, output stride 1).", &
    4458             :                           usage="FRAGMENT_B_FILE_NAME <FILENAME>", &
    4459       16816 :                           default_lc_val="fragment_b.cube")
    4460        8408 :       CALL section_add_keyword(section, keyword)
    4461        8408 :       CALL keyword_release(keyword)
    4462             : 
    4463             :       CALL keyword_create(keyword, __LOCATION__, name="FRAGMENT_A_SPIN_FILE", &
    4464             :                           variants=(/"FRAGMENT_A_SPIN_FILE_NAME"/), &
    4465             :                           description="Name of the reference spin density cube file for fragment A."// &
    4466             :                           " May include a path. The reference spin density needs to be outputted"// &
    4467             :                           " on the same grid as the full system (same cutoff and cell, output stride 1).", &
    4468             :                           usage="FRAGMENT_A_FILE_NAME <FILENAME>", &
    4469       16816 :                           default_lc_val="fragment_a_spin.cube")
    4470        8408 :       CALL section_add_keyword(section, keyword)
    4471        8408 :       CALL keyword_release(keyword)
    4472             : 
    4473             :       CALL keyword_create(keyword, __LOCATION__, name="FRAGMENT_B_SPIN_FILE", &
    4474             :                           variants=(/"FRAGMENT_B_SPIN_FILE_NAME"/), &
    4475             :                           description="Name of the reference spin density cube file for fragment B."// &
    4476             :                           " May include a path. The reference spin density needs to be outputted"// &
    4477             :                           " on the same grid as the full system (same cutoff and cell, output stride 1).", &
    4478             :                           usage="FRAGMENT_B_FILE_NAME <FILENAME>", &
    4479       16816 :                           default_lc_val="fragment_b_spin.cube")
    4480        8408 :       CALL section_add_keyword(section, keyword)
    4481        8408 :       CALL keyword_release(keyword)
    4482             : 
    4483             :       CALL keyword_create(keyword, __LOCATION__, name="FLIP_FRAGMENT_A", &
    4484             :                           description="Logical which determines if the reference spin difference density "// &
    4485             :                           "(rho_alpha-rho_beta) for fragment A should be flipped. With default (off) "// &
    4486             :                           "value, the fragment is constrained to have more alpha than beta electrons "// &
    4487             :                           "if the isolated fragment has unpaired electrons. Useful in conjunction with "// &
    4488             :                           "FLIP_FRAGMENT_B.", &
    4489             :                           usage="FLIP_FRAGMENT_A", &
    4490        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4491        8408 :       CALL section_add_keyword(section, keyword)
    4492        8408 :       CALL keyword_release(keyword)
    4493             : 
    4494             :       CALL keyword_create(keyword, __LOCATION__, name="FLIP_FRAGMENT_B", &
    4495             :                           description="Logical which determines if the reference spin difference density "// &
    4496             :                           "(rho_alpha-rho_beta) for fragment B should be flipped. With default (off) "// &
    4497             :                           "value, the fragment is constrained to have more alpha than beta electrons "// &
    4498             :                           "if the isolated fragment has unpaired electrons. Useful in conjunction with "// &
    4499             :                           "FLIP_FRAGMENT_A.", &
    4500             :                           usage="FLIP_FRAGMENT_B", &
    4501        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4502        8408 :       CALL section_add_keyword(section, keyword)
    4503        8408 :       CALL keyword_release(keyword)
    4504             : 
    4505             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
    4506             :                                        description="Controls the printing of basic info about the method.", &
    4507        8408 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    4508             : 
    4509             :       CALL section_create(subsection, __LOCATION__, name="WEIGHT_FUNCTION", &
    4510             :                           description="Controls the printing of cube files with "// &
    4511             :                           "the CDFT weight function(s). Intended for single-point testing. "// &
    4512             :                           "In multistep simulations, generated cube files are overwritten each step.", &
    4513        8408 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    4514             : 
    4515             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    4516             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    4517             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    4518             :                           " 1 number valid for all components.", &
    4519        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    4520        8408 :       CALL section_add_keyword(subsection, keyword)
    4521        8408 :       CALL keyword_release(keyword)
    4522             : 
    4523        8408 :       CALL section_add_subsection(print_key, subsection)
    4524        8408 :       CALL section_release(subsection)
    4525             : 
    4526        8408 :       CALL section_add_subsection(section, print_key)
    4527        8408 :       CALL section_release(print_key)
    4528             : 
    4529             :       CALL section_create(group_section, __LOCATION__, name="ATOM_GROUP", &
    4530             :                           description="Define a group of atoms for use in a CDFT constraint. Each repetition of "// &
    4531             :                           "this section creates a new constraint.", &
    4532        8408 :                           n_keywords=4, n_subsections=0, repeats=.TRUE.)
    4533             : 
    4534             :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
    4535             :                           description="Specifies the list of atoms that are included in the constraint group.", &
    4536             :                           usage="ATOMS {integer} {integer} .. {integer}", &
    4537        8408 :                           n_var=-1, type_of_var=integer_t)
    4538        8408 :       CALL section_add_keyword(group_section, keyword)
    4539        8408 :       CALL keyword_release(keyword)
    4540             : 
    4541             :       CALL keyword_create(keyword, __LOCATION__, name="COEFF", &
    4542             :                           description="Defines coefficients for the atoms in the list of atoms. Accepts values +/-1.0.", &
    4543             :                           usage="COEFF 1.0 -1.0", repeats=.TRUE., &
    4544        8408 :                           type_of_var=real_t, n_var=-1)
    4545        8408 :       CALL section_add_keyword(group_section, keyword)
    4546        8408 :       CALL keyword_release(keyword)
    4547             : 
    4548             :       CALL keyword_create(keyword, __LOCATION__, name="CONSTRAINT_TYPE ", &
    4549             :                           description="Determines what type of constraint to apply. ", &
    4550             :                           usage="CONSTRAINT_TYPE (CHARGE|MAGNETIZATION|ALPHA|BETA)", &
    4551             :                           enum_c_vals=s2a("CHARGE", "MAGNETIZATION", "ALPHA", "BETA"), &
    4552             :                           enum_i_vals=(/cdft_charge_constraint, cdft_magnetization_constraint, &
    4553             :                                         cdft_alpha_constraint, cdft_beta_constraint/), &
    4554             :                           enum_desc=s2a("Total charge density constraint (rho_alpha + rho_beta).", &
    4555             :                                         "Magnetization density constraint (rho_alpha - rho_beta).", &
    4556             :                                         "Alpha spin density constraint.", &
    4557             :                                         "Beta spin density constraint."), &
    4558        8408 :                           default_i_val=cdft_charge_constraint)
    4559        8408 :       CALL section_add_keyword(group_section, keyword)
    4560        8408 :       CALL keyword_release(keyword)
    4561             : 
    4562             :       CALL keyword_create(keyword, __LOCATION__, name="FRAGMENT_CONSTRAINT", &
    4563             :                           description="Use a fragment based constraint. "// &
    4564             :                           "Takes as input the electron densities of two isolated fragments in the "// &
    4565             :                           "same geometry that they have in the full system. "// &
    4566             :                           "The isolated fragment densities are read from cube files defined in FRAGMENT_{A,B}_FILE. "// &
    4567             :                           "For magnetization density constraints, additional files containing the spin difference "// &
    4568             :                           "densities must be defined with the keywords FRAGMENT_{A,B}_SPIN_FILE. "// &
    4569             :                           "With this keyword active, the target value of the constraint is calculated from the "// &
    4570             :                           "the superposition of the isolated fragment densities. Supports only static calculations.", &
    4571             :                           usage="FRAGMENT_CONSTRAINT", &
    4572        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4573        8408 :       CALL section_add_keyword(group_section, keyword)
    4574        8408 :       CALL keyword_release(keyword)
    4575             : 
    4576        8408 :       CALL section_add_subsection(section, group_section)
    4577        8408 :       CALL section_release(group_section)
    4578             : 
    4579             :       CALL section_create(group_section, __LOCATION__, name="DUMMY_ATOMS", &
    4580             :                           description="Define an extra group of atoms for which only atomic CDFT charges "// &
    4581             :                           "should be computed. The section cannot contain any constraint "// &
    4582             :                           "atoms that were included in section ATOM_GROUP.", &
    4583        8408 :                           n_keywords=1, n_subsections=0, repeats=.TRUE.)
    4584             : 
    4585             :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
    4586             :                           description="Specifies the list of atoms that are included in the DUMMY_ATOMS group.", &
    4587             :                           usage="ATOMS {integer} {integer} .. {integer}", &
    4588        8408 :                           n_var=-1, type_of_var=integer_t)
    4589        8408 :       CALL section_add_keyword(group_section, keyword)
    4590        8408 :       CALL keyword_release(keyword)
    4591             : 
    4592        8408 :       CALL section_add_subsection(section, group_section)
    4593        8408 :       CALL section_release(group_section)
    4594             : 
    4595             :       CALL keyword_create(keyword, __LOCATION__, name="REUSE_PRECOND", &
    4596             :                           description="Reuse a previously built OT preconditioner between subsequent CDFT SCF iterations "// &
    4597             :                           "if the inner OT SCF loop converged in PRECOND_FREQ steps or less. Intended mainly for MD "// &
    4598             :                           "simulations with the FULL_ALL preconditioner to speed up the final iterations of the CDFT SCF loop.", &
    4599             :                           usage="REUSE_PRECOND yes", repeats=.FALSE., n_var=1, &
    4600        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4601        8408 :       CALL section_add_keyword(section, keyword)
    4602        8408 :       CALL keyword_release(keyword)
    4603             : 
    4604             :       CALL keyword_create(keyword, __LOCATION__, name="PRECOND_FREQ", &
    4605             :                           description="See REUSE_PRECOND.", &
    4606        8408 :                           usage="PRECOND_FREQ {int}", default_i_val=0)
    4607        8408 :       CALL section_add_keyword(section, keyword)
    4608        8408 :       CALL keyword_release(keyword)
    4609             : 
    4610             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_REUSE", &
    4611             :                           description="Determines how many times a previously built preconditioner can be reused.", &
    4612        8408 :                           usage="MAX_REUSE {int}", default_i_val=0)
    4613        8408 :       CALL section_add_keyword(section, keyword)
    4614        8408 :       CALL keyword_release(keyword)
    4615             : 
    4616             :       CALL keyword_create(keyword, __LOCATION__, name="PURGE_HISTORY", &
    4617             :                           description="Purge wavefunction and constraint history to improve SCF convergence during MD."// &
    4618             :                           " Counts how often the convergence of the first CDFT SCF iteration takes 2 or more outer SCF"// &
    4619             :                           " iterations and purges the history if the counter exceeds PURGE_FREQ, and PURGE_OFFSET"// &
    4620             :                           " MD steps have passed since the last purge."// &
    4621             :                           " The counter is zeroed after each purge.", &
    4622             :                           usage="PURGE_HISTORY yes", repeats=.FALSE., n_var=1, &
    4623        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4624        8408 :       CALL section_add_keyword(section, keyword)
    4625        8408 :       CALL keyword_release(keyword)
    4626             : 
    4627             :       CALL keyword_create(keyword, __LOCATION__, name="PURGE_FREQ", &
    4628             :                           description="See PURGE_HISTORY.", &
    4629        8408 :                           usage="PURGE_FREQ {int} ", default_i_val=1)
    4630        8408 :       CALL section_add_keyword(section, keyword)
    4631        8408 :       CALL keyword_release(keyword)
    4632             : 
    4633             :       CALL keyword_create(keyword, __LOCATION__, name="PURGE_OFFSET", &
    4634             :                           description="See PURGE_HISTORY.", &
    4635        8408 :                           usage="PURGE_OFFSET {int} ", default_i_val=1)
    4636        8408 :       CALL section_add_keyword(section, keyword)
    4637        8408 :       CALL keyword_release(keyword)
    4638             : 
    4639             :       CALL keyword_create(keyword, __LOCATION__, name="COUNTER", &
    4640             :                           description="A counter to track the total number of energy evaluations. Needed by"// &
    4641             :                           " some optimizers to print information. Useful mainly for restarts.", &
    4642        8408 :                           usage="COUNTER {int} ", default_i_val=0)
    4643        8408 :       CALL section_add_keyword(section, keyword)
    4644        8408 :       CALL keyword_release(keyword)
    4645             : 
    4646             :       CALL keyword_create(keyword, __LOCATION__, name="IN_MEMORY", &
    4647             :                           description="Precompute gradients due to constraint during"// &
    4648             :                           " initial formation of constraint and store them in memory. Does"// &
    4649             :                           " nothing if forces are not calculated.", &
    4650             :                           usage="IN_MEMORY", &
    4651        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4652        8408 :       CALL section_add_keyword(section, keyword)
    4653        8408 :       CALL keyword_release(keyword)
    4654             : 
    4655        8408 :    END SUBROUTINE create_cdft_control_section
    4656             : 
    4657             : ! **************************************************************************************************
    4658             : !> \brief Creates the input section for defining Gaussian Hirshfeld CDFT constraints.
    4659             : !> \param section the section to create
    4660             : ! **************************************************************************************************
    4661        8408 :    SUBROUTINE create_hirshfeld_constraint_section(section)
    4662             :       TYPE(section_type), POINTER                        :: section
    4663             : 
    4664             :       TYPE(keyword_type), POINTER                        :: keyword
    4665             : 
    4666        8408 :       NULLIFY (keyword)
    4667             : 
    4668        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    4669             :       CALL section_create(section, __LOCATION__, name="HIRSHFELD_CONSTRAINT", &
    4670             :                           description="Parameters for CDFT with a Gaussian Hirshfeld constraint.", &
    4671        8408 :                           n_keywords=11, n_subsections=0, repeats=.FALSE.)
    4672             : 
    4673             :       CALL keyword_create(keyword, __LOCATION__, name="SHAPE_FUNCTION", &
    4674             :                           description="Type of shape function used for Hirshfeld partitioning.", &
    4675             :                           usage="SHAPE_FUNCTION {Gaussian,Density}", repeats=.FALSE., n_var=1, &
    4676             :                           default_i_val=shape_function_gaussian, &
    4677             :                           enum_c_vals=s2a("GAUSSIAN", "DENSITY"), &
    4678             :                           enum_desc=s2a("One Gaussian per atom with radius determined by the keyword GAUSSIAN_SHAPE.", &
    4679             :                                         "Atomic density expanded in terms of multiple Gaussians."), &
    4680        8408 :                           enum_i_vals=(/shape_function_gaussian, shape_function_density/))
    4681        8408 :       CALL section_add_keyword(section, keyword)
    4682        8408 :       CALL keyword_release(keyword)
    4683             : 
    4684             :       CALL keyword_create(keyword, __LOCATION__, name="GAUSSIAN_SHAPE", &
    4685             :                           description="Specifies the type of Gaussian used for SHAPE_FUNCTION GAUSSIAN.", &
    4686             :                           usage="GAUSSIAN_SHAPE (SINGLE|VDW|COVALENT|USER)", &
    4687             :                           enum_c_vals=s2a("DEFAULT", "SINGLE", "VDW", "COVALENT", "USER"), &
    4688             :                           enum_i_vals=(/radius_default, radius_single, radius_vdw, radius_covalent, radius_user/), &
    4689             :                           enum_desc=s2a("Use covalent radii (in angstrom) to construct Gaussians, but fixed"// &
    4690             :                                         " 1.0_dp radius for elements with a radius larger than this value.", &
    4691             :                                         "Single Gaussian for all atom types with radius given by GAUSSIAN_RADIUS.", &
    4692             :                                         "Use van der Waals radii to construct Gaussians.", &
    4693             :                                         "Use covalent radii to construct Gaussians.", &
    4694             :                                         "Use user defined radii (keyword ATOMIC_RADII) to construct Gaussians."), &
    4695        8408 :                           default_i_val=radius_default)
    4696        8408 :       CALL section_add_keyword(section, keyword)
    4697        8408 :       CALL keyword_release(keyword)
    4698             : 
    4699             :       CALL keyword_create(keyword, __LOCATION__, name="GAUSSIAN_RADIUS", &
    4700             :                           description="Radius parameter controlling the creation of Gaussians.", &
    4701             :                           usage="GAUSSIAN_RADIUS <REAL>", &
    4702             :                           unit_str="angstrom", &
    4703             :                           default_r_val=cp_unit_to_cp2k(3.0_dp, "angstrom"), &
    4704        8408 :                           type_of_var=real_t, n_var=1)
    4705        8408 :       CALL section_add_keyword(section, keyword)
    4706        8408 :       CALL keyword_release(keyword)
    4707             : 
    4708             :       CALL keyword_create(keyword, __LOCATION__, name="ATOMIC_RADII", &
    4709             :                           description="Defines custom radii to setup the spherical Gaussians. "// &
    4710             :                           "Give one value per element in the same order as they "// &
    4711             :                           "appear in the input coordinates.", &
    4712             :                           usage="ATOMIC_RADII {real} {real} {real}", repeats=.FALSE., &
    4713             :                           unit_str="angstrom", &
    4714        8408 :                           type_of_var=real_t, n_var=-1)
    4715        8408 :       CALL section_add_keyword(section, keyword)
    4716        8408 :       CALL keyword_release(keyword)
    4717             : 
    4718             :       CALL keyword_create(keyword, __LOCATION__, name="USE_BOHR", &
    4719             :                           description="Convert the Gaussian radius from angstrom to bohr. This results in a larger "// &
    4720             :                           "Gaussian than without unit conversion.", &
    4721             :                           usage="CAVITY_USE_BOHR TRUE", &
    4722        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4723        8408 :       CALL section_add_keyword(section, keyword)
    4724        8408 :       CALL keyword_release(keyword)
    4725             : 
    4726             :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_DENSITY", &
    4727             :                           description="Logical to control printing of Hirshfeld densities to .cube file.", &
    4728             :                           usage="PRINT_DENSITY TRUE", &
    4729        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4730        8408 :       CALL section_add_keyword(section, keyword)
    4731        8408 :       CALL keyword_release(keyword)
    4732             : 
    4733             :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS_MEMORY", &
    4734             :                           description="Number of atomic gradients to store in memory.", &
    4735             :                           usage="ATOMS_MEMORY", &
    4736             :                           n_var=1, type_of_var=integer_t, &
    4737        8408 :                           default_i_val=80)
    4738        8408 :       CALL section_add_keyword(section, keyword)
    4739        8408 :       CALL keyword_release(keyword)
    4740             : 
    4741             :       CALL keyword_create(keyword, __LOCATION__, name="USE_ATOMIC_CUTOFF", &
    4742             :                           description="Logical to control use of ATOMIC_CUTOFF.", &
    4743             :                           usage="USE_ATOMIC_CUTOFF TRUE", &
    4744        8408 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    4745        8408 :       CALL section_add_keyword(section, keyword)
    4746        8408 :       CALL keyword_release(keyword)
    4747             : 
    4748             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_CUTOFF", &
    4749             :                           description="Numerical cutoff for calculation of weight function.", &
    4750        8408 :                           usage="EPS_CUTOFF {real} ", default_r_val=1.0e-12_dp)
    4751        8408 :       CALL section_add_keyword(section, keyword)
    4752        8408 :       CALL keyword_release(keyword)
    4753             : 
    4754             :       CALL keyword_create(keyword, __LOCATION__, name="ATOMIC_CUTOFF", &
    4755             :                           description="Numerical cutoff for calculation of Hirshfeld densities.", &
    4756        8408 :                           usage="ATOMIC_CUTOFF {real} ", default_r_val=1.0e-12_dp)
    4757        8408 :       CALL section_add_keyword(section, keyword)
    4758        8408 :       CALL keyword_release(keyword)
    4759             : 
    4760        8408 :    END SUBROUTINE create_hirshfeld_constraint_section
    4761             : 
    4762             : ! **************************************************************************************************
    4763             : !> \brief ...
    4764             : !> \param section ...
    4765             : ! **************************************************************************************************
    4766        8408 :    SUBROUTINE create_s2_restraint_section(section)
    4767             :       TYPE(section_type), POINTER                        :: section
    4768             : 
    4769             :       TYPE(keyword_type), POINTER                        :: keyword
    4770             : 
    4771        8408 :       NULLIFY (keyword)
    4772        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    4773             : 
    4774             :       CALL section_create(section, __LOCATION__, name="S2_RESTRAINT", &
    4775             :                           description="Use S2 in a re/constraint (OT only)", &
    4776        8408 :                           n_keywords=7, n_subsections=0, repeats=.FALSE.)
    4777             : 
    4778             :       CALL keyword_create(keyword, __LOCATION__, name="STRENGTH", &
    4779             :                           description="force constant of the restraint", &
    4780        8408 :                           usage="STRENGTH {real} ", default_r_val=0.1_dp)
    4781        8408 :       CALL section_add_keyword(section, keyword)
    4782        8408 :       CALL keyword_release(keyword)
    4783             : 
    4784             :       CALL keyword_create(keyword, __LOCATION__, name="TARGET", &
    4785             :                           description="target value of the restraint", &
    4786        8408 :                           usage="TARGET {real} ", default_r_val=1._dp)
    4787        8408 :       CALL section_add_keyword(section, keyword)
    4788        8408 :       CALL keyword_release(keyword)
    4789             : 
    4790             :       CALL keyword_create(keyword, __LOCATION__, name="FUNCTIONAL_FORM", &
    4791             :                           description="Specifies the functional form of the term added", &
    4792             :                           usage="FUNCTIONAL_FORM RESTRAINT", &
    4793             :                           enum_c_vals=s2a("RESTRAINT", "CONSTRAINT"), &
    4794             :                           enum_i_vals=(/do_s2_restraint, do_s2_constraint/), &
    4795             :                           enum_desc=s2a("Harmonic potential: s*(q-t)**2", "Constraint form: s*(q-t)"), &
    4796        8408 :                           default_i_val=do_s2_restraint)
    4797        8408 :       CALL section_add_keyword(section, keyword)
    4798        8408 :       CALL keyword_release(keyword)
    4799             : 
    4800        8408 :    END SUBROUTINE create_s2_restraint_section
    4801             : 
    4802             : ! **************************************************************************************************
    4803             : !> \brief creates the input section for the tddfpt part
    4804             : !> \param section the section to create
    4805             : !> \author teo
    4806             : ! **************************************************************************************************
    4807        8408 :    SUBROUTINE create_tddfpt_section(section)
    4808             :       TYPE(section_type), POINTER                        :: section
    4809             : 
    4810             :       TYPE(keyword_type), POINTER                        :: keyword
    4811             :       TYPE(section_type), POINTER                        :: subsection
    4812             : 
    4813        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    4814             :       CALL section_create(section, __LOCATION__, name="tddfpt", &
    4815             :                           description="Old TDDFPT code. Use new version in CP2K_INPUT / FORCE_EVAL / PROPERTIES / TDDFPT", &
    4816             :                           n_keywords=5, n_subsections=1, repeats=.FALSE., &
    4817       16816 :                           citations=(/Iannuzzi2005/))
    4818             : 
    4819        8408 :       NULLIFY (subsection, keyword)
    4820             : 
    4821             :       ! Integer
    4822             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_KV", &
    4823             :                           variants=s2a("MAX_VECTORS"), &
    4824             :                           description=" maximal number of Krylov space vectors", &
    4825             :                           usage="MAX_KV someInteger>0", &
    4826             :                           n_var=1, type_of_var=integer_t, &
    4827        8408 :                           default_i_val=60)
    4828        8408 :       CALL section_add_keyword(section, keyword)
    4829        8408 :       CALL keyword_release(keyword)
    4830             : 
    4831             :       CALL keyword_create(keyword, __LOCATION__, name="RESTARTS", &
    4832             :                           variants=s2a("N_RESTARTS"), &
    4833             :                           description=" maximal number subspace search restarts", &
    4834             :                           usage="RESTARTS someInteger>0", &
    4835             :                           n_var=1, type_of_var=integer_t, &
    4836        8408 :                           default_i_val=5)
    4837        8408 :       CALL section_add_keyword(section, keyword)
    4838        8408 :       CALL keyword_release(keyword)
    4839             : 
    4840             :       CALL keyword_create(keyword, __LOCATION__, name="NEV", &
    4841             :                           variants=s2a("N_EV", "EV"), &
    4842             :                           description=" number of excitations to calculate", &
    4843             :                           usage="NEV someInteger>0", &
    4844             :                           n_var=1, type_of_var=integer_t, &
    4845        8408 :                           default_i_val=1)
    4846        8408 :       CALL section_add_keyword(section, keyword)
    4847        8408 :       CALL keyword_release(keyword)
    4848             : 
    4849             :       CALL keyword_create(keyword, __LOCATION__, name="NLUMO", &
    4850             :                           description=" number of additional unoccupied orbitals ", &
    4851             :                           usage="NLUMO 10", &
    4852             :                           n_var=1, type_of_var=integer_t, &
    4853        8408 :                           default_i_val=5)
    4854        8408 :       CALL section_add_keyword(section, keyword)
    4855        8408 :       CALL keyword_release(keyword)
    4856             : 
    4857             :       CALL keyword_create(keyword, __LOCATION__, name="NREORTHO", &
    4858             :                           variants=s2a("N_REORTHO", "REORTHO", "REORTHOGONALITAZIONS"), &
    4859             :                           description=" number of reorthogonalization steps", &
    4860             :                           usage="NREORTHO someInteger>0", &
    4861             :                           n_var=1, type_of_var=integer_t, &
    4862        8408 :                           default_i_val=2)
    4863        8408 :       CALL section_add_keyword(section, keyword)
    4864        8408 :       CALL keyword_release(keyword)
    4865             : 
    4866             :       ! Logical
    4867             :       CALL keyword_create(keyword, __LOCATION__, name="KERNEL", &
    4868             :                           variants=s2a("DO_KERNEL"), &
    4869             :                           description="compute the kernel (debug purpose only)", &
    4870             :                           usage="KERNEL logical_value", &
    4871        8408 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    4872        8408 :       CALL section_add_keyword(section, keyword)
    4873        8408 :       CALL keyword_release(keyword)
    4874             : 
    4875             :       CALL keyword_create(keyword, __LOCATION__, name="LSD_SINGLETS", &
    4876             :                           description="compute singlets using lsd vxc kernel", &
    4877             :                           usage="LSD_SINGLETS logical_value", &
    4878        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    4879        8408 :       CALL section_add_keyword(section, keyword)
    4880        8408 :       CALL keyword_release(keyword)
    4881             : 
    4882             :       CALL keyword_create(keyword, __LOCATION__, name="INVERT_S", &
    4883             :                           variants=s2a("INVERT_OVERLAP"), &
    4884             :                           description="use the inverse of the overlap matrix", &
    4885             :                           usage="INVERT_S logical_value", &
    4886        8408 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    4887        8408 :       CALL section_add_keyword(section, keyword)
    4888        8408 :       CALL keyword_release(keyword)
    4889             : 
    4890             :       CALL keyword_create(keyword, __LOCATION__, name="PRECONDITIONER", &
    4891             :                           variants=s2a("PRECOND"), &
    4892             :                           description="use the preconditioner (only for Davidson)", &
    4893             :                           usage="PRECONDITIONER logical_value", &
    4894        8408 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    4895        8408 :       CALL section_add_keyword(section, keyword)
    4896        8408 :       CALL keyword_release(keyword)
    4897             : 
    4898             :       ! Character
    4899             :       CALL keyword_create(keyword, __LOCATION__, name="RES_ETYPE", &
    4900             :                           variants=s2a("RESTRICTED_EXCITATIONS_TYPE", "RES_E_TYPE"), &
    4901             :                           description="(singlets/triplets) for restricted calculation", &
    4902             :                           usage="RES_ETYPE T", &
    4903             :                           enum_c_vals=s2a("S", "SINGLET", "SINGLETS", "T", "TRIPLET", "TRIPLETS"), &
    4904             :                           enum_i_vals=(/tddfpt_singlet, tddfpt_singlet, tddfpt_singlet, &
    4905             :                                         tddfpt_triplet, tddfpt_triplet, tddfpt_triplet/), &
    4906        8408 :                           default_i_val=tddfpt_singlet)
    4907        8408 :       CALL section_add_keyword(section, keyword)
    4908        8408 :       CALL keyword_release(keyword)
    4909             : 
    4910             :       CALL keyword_create(keyword, __LOCATION__, name="DIAG_METHOD", &
    4911             :                           variants=s2a("DIAGONALIZATION_METHOD", "METHOD"), &
    4912             :                           description="Diagonalization method used in tddfpt", &
    4913             :                           usage="DIAG_METHOD DAVIDSON", &
    4914             :                           enum_c_vals=s2a("DAVIDSON", "LANCZOS"), &
    4915             :                           enum_i_vals=(/tddfpt_davidson, tddfpt_lanczos/), &
    4916        8408 :                           default_i_val=tddfpt_davidson)
    4917        8408 :       CALL section_add_keyword(section, keyword)
    4918        8408 :       CALL keyword_release(keyword)
    4919             : 
    4920             :       CALL keyword_create(keyword, __LOCATION__, name="OE_CORR", &
    4921             :                           variants=s2a("ORBITAL_EIGENVALUES_CORRECTION"), &
    4922             :                           description="Which type of orbital eigenvalue correction to use "// &
    4923             :                           "(to yield better HOMO-LUMO energies)", &
    4924             :                           usage="OE_CORR SAOP", &
    4925             :                           enum_c_vals=s2a("NONE", "LB", "LB_ALPHA", "LB94", "GLLB", "GLB", "SAOP", "SIC"), &
    4926             :                           enum_i_vals=(/oe_none, oe_lb, oe_lb, oe_lb, oe_gllb, oe_gllb, oe_saop, oe_sic/), &
    4927        8408 :                           default_i_val=oe_none)
    4928        8408 :       CALL section_add_keyword(section, keyword)
    4929        8408 :       CALL keyword_release(keyword)
    4930             : 
    4931             :       ! Real
    4932             :       CALL keyword_create(keyword, __LOCATION__, name="CONVERGENCE", &
    4933             :                           variants=s2a("CONV"), &
    4934             :                           description="The convergence of the eigenvalues", &
    4935             :                           usage="CONVERGENCE 1.0E-6 ", &
    4936             :                           n_var=1, type_of_var=real_t, &
    4937        8408 :                           default_r_val=1.0e-5_dp)
    4938        8408 :       CALL section_add_keyword(section, keyword)
    4939        8408 :       CALL keyword_release(keyword)
    4940             : 
    4941        8408 :       CALL create_xc_section(subsection)
    4942        8408 :       CALL section_add_subsection(section, subsection)
    4943        8408 :       CALL section_release(subsection)
    4944             : 
    4945        8408 :       CALL create_sic_section(subsection)
    4946        8408 :       CALL section_add_subsection(section, subsection)
    4947        8408 :       CALL section_release(subsection)
    4948             : 
    4949        8408 :    END SUBROUTINE create_tddfpt_section
    4950             : 
    4951             : ! **************************************************************************************************
    4952             : !> \brief creates the input section for the relativistic part
    4953             : !> \param section the section to create
    4954             : !> \author jens
    4955             : ! **************************************************************************************************
    4956        8408 :    SUBROUTINE create_relativistic_section(section)
    4957             :       TYPE(section_type), POINTER                        :: section
    4958             : 
    4959             :       TYPE(keyword_type), POINTER                        :: keyword
    4960             : 
    4961        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    4962             :       CALL section_create(section, __LOCATION__, name="relativistic", &
    4963             :                           description="parameters needed and setup for relativistic calculations", &
    4964        8408 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
    4965             : 
    4966        8408 :       NULLIFY (keyword)
    4967             : 
    4968             :       CALL keyword_create(keyword, __LOCATION__, name="method", &
    4969             :                           description="type of relativistic correction used", &
    4970             :                           usage="method (NONE|DKH|ZORA)", default_i_val=rel_none, &
    4971             :                           enum_c_vals=s2a("NONE", "DKH", "ZORA"), &
    4972             :                           enum_i_vals=(/rel_none, rel_dkh, rel_zora/), &
    4973             :                           enum_desc=s2a("Use no relativistic correction", &
    4974             :                                         "Use Douglas-Kroll-Hess method", &
    4975        8408 :                                         "Use ZORA method"))
    4976        8408 :       CALL section_add_keyword(section, keyword)
    4977        8408 :       CALL keyword_release(keyword)
    4978             : 
    4979             :       CALL keyword_create(keyword, __LOCATION__, name="DKH_order", &
    4980             :                           description="The order of the DKH transformation ", &
    4981        8408 :                           usage="DKH_order 2", default_i_val=2)
    4982        8408 :       CALL section_add_keyword(section, keyword)
    4983        8408 :       CALL keyword_release(keyword)
    4984             : 
    4985             :       CALL keyword_create(keyword, __LOCATION__, name="ZORA_type", &
    4986             :                           description="Type of ZORA method to be used", &
    4987             :                           usage="ZORA_type scMP", default_i_val=rel_zora_full, &
    4988             :                           enum_c_vals=s2a("FULL", "MP", "scMP"), &
    4989             :                           enum_desc=s2a("Full ZORA method (not implemented)", &
    4990             :                                         "ZORA with atomic model potential", &
    4991             :                                         "Scaled ZORA with atomic model potential"), &
    4992        8408 :                           enum_i_vals=(/rel_zora_full, rel_zora_mp, rel_sczora_mp/))
    4993        8408 :       CALL section_add_keyword(section, keyword)
    4994        8408 :       CALL keyword_release(keyword)
    4995             : 
    4996             :       CALL keyword_create(keyword, __LOCATION__, name="transformation", &
    4997             :                           description="Type of DKH transformation", &
    4998             :                           usage="transformation (FULL|MOLECULE|ATOM)", default_i_val=rel_trans_atom, &
    4999             :                           enum_c_vals=s2a("FULL", "MOLECULE", "ATOM"), &
    5000             :                           enum_i_vals=(/rel_trans_full, rel_trans_molecule, rel_trans_atom/), &
    5001             :                           enum_desc=s2a("Use full matrix transformation", &
    5002             :                                         "Use transformation blocked by molecule", &
    5003        8408 :                                         "Use atomic blocks"))
    5004        8408 :       CALL section_add_keyword(section, keyword)
    5005        8408 :       CALL keyword_release(keyword)
    5006             : 
    5007             :       CALL keyword_create(keyword, __LOCATION__, name="z_cutoff", &
    5008             :                           description="The minimal atomic number considered for atom transformation", &
    5009        8408 :                           usage="z_cutoff 50", default_i_val=1)
    5010        8408 :       CALL section_add_keyword(section, keyword)
    5011        8408 :       CALL keyword_release(keyword)
    5012             : 
    5013             :       CALL keyword_create(keyword, __LOCATION__, name="potential", &
    5014             :                           description="External potential used in DKH transformation, full 1/r or erfc(r)/r", &
    5015             :                           usage="POTENTIAL {FULL,ERFC}", default_i_val=rel_pot_erfc, &
    5016             :                           enum_c_vals=s2a("FULL", "ERFC"), &
    5017        8408 :                           enum_i_vals=(/rel_pot_full, rel_pot_erfc/))
    5018        8408 :       CALL section_add_keyword(section, keyword)
    5019        8408 :       CALL keyword_release(keyword)
    5020             : 
    5021        8408 :    END SUBROUTINE create_relativistic_section
    5022             : 
    5023             : ! **************************************************************************************************
    5024             : !> \brief creates the structure of the section with the DFT SCF parameters
    5025             : !> \param section will contain the SCF section
    5026             : !> \author fawzi
    5027             : ! **************************************************************************************************
    5028       19592 :    SUBROUTINE create_scf_section(section)
    5029             :       TYPE(section_type), POINTER                        :: section
    5030             : 
    5031             :       TYPE(keyword_type), POINTER                        :: keyword
    5032             :       TYPE(section_type), POINTER                        :: print_key, subsection
    5033             : 
    5034       19592 :       NULLIFY (print_key)
    5035             : 
    5036       19592 :       CPASSERT(.NOT. ASSOCIATED(section))
    5037             :       CALL section_create(section, __LOCATION__, name="scf", &
    5038             :                           description="Parameters needed to perform an SCF run.", &
    5039       19592 :                           n_keywords=18, n_subsections=7, repeats=.FALSE.)
    5040             : 
    5041       19592 :       NULLIFY (subsection)
    5042             : 
    5043       19592 :       CALL create_ot_section(subsection)
    5044       19592 :       CALL section_add_subsection(section, subsection)
    5045       19592 :       CALL section_release(subsection)
    5046             : 
    5047       19592 :       CALL create_diagonalization_section(subsection)
    5048       19592 :       CALL section_add_subsection(section, subsection)
    5049       19592 :       CALL section_release(subsection)
    5050             : 
    5051       19592 :       CALL create_outer_scf_section(subsection)
    5052       19592 :       CALL section_add_subsection(section, subsection)
    5053       19592 :       CALL section_release(subsection)
    5054             : 
    5055       19592 :       CALL create_smear_section(subsection)
    5056       19592 :       CALL section_add_subsection(section, subsection)
    5057       19592 :       CALL section_release(subsection)
    5058             : 
    5059       19592 :       CALL create_mixing_section(subsection)
    5060       19592 :       CALL section_add_subsection(section, subsection)
    5061       19592 :       CALL section_release(subsection)
    5062             : 
    5063       19592 :       CALL create_mom_section(subsection)
    5064       19592 :       CALL section_add_subsection(section, subsection)
    5065       19592 :       CALL section_release(subsection)
    5066             : 
    5067       19592 :       NULLIFY (keyword)
    5068             : 
    5069             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER_LUMO", &
    5070             :                           variants=(/"MAX_ITER_LUMOS"/), &
    5071             :                           description="Maximum number of iterations for the calculation of the LUMO energies "// &
    5072             :                           "with the OT eigensolver.", &
    5073       39184 :                           usage="MAX_ITER_LUMO 100", default_i_val=299)
    5074       19592 :       CALL section_add_keyword(section, keyword)
    5075       19592 :       CALL keyword_release(keyword)
    5076             : 
    5077             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_LUMO", &
    5078             :                           variants=(/"EPS_LUMOS"/), &
    5079             :                           description="Target accuracy for the calculation of the LUMO energies with the OT eigensolver.", &
    5080       39184 :                           usage="EPS_LUMO 1.0E-6", default_r_val=1.0E-5_dp)
    5081       19592 :       CALL section_add_keyword(section, keyword)
    5082       19592 :       CALL keyword_release(keyword)
    5083             : 
    5084             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_SCF", &
    5085             :                           description="Maximum number of SCF iteration to be performed for one optimization", &
    5086       19592 :                           usage="MAX_SCF 200", default_i_val=50)
    5087       19592 :       CALL section_add_keyword(section, keyword)
    5088       19592 :       CALL keyword_release(keyword)
    5089             : 
    5090             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_SCF_HISTORY", variants=(/"MAX_SCF_HIST"/), &
    5091             :                           description="Maximum number of SCF iterations after the history pipeline is filled", &
    5092       39184 :                           usage="MAX_SCF_HISTORY 1", default_i_val=0, lone_keyword_i_val=1)
    5093       19592 :       CALL section_add_keyword(section, keyword)
    5094       19592 :       CALL keyword_release(keyword)
    5095             : 
    5096             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_DIIS", &
    5097             :                           variants=(/"MAX_DIIS_BUFFER_SIZE"/), &
    5098             :                           description="Maximum number of DIIS vectors to be used", &
    5099       39184 :                           usage="MAX_DIIS 3", default_i_val=4)
    5100       19592 :       CALL section_add_keyword(section, keyword)
    5101       19592 :       CALL keyword_release(keyword)
    5102             : 
    5103             :       CALL keyword_create(keyword, __LOCATION__, name="LEVEL_SHIFT", &
    5104             :                           variants=(/"LSHIFT"/), &
    5105             :                           description="Use level shifting to improve convergence", &
    5106             :                           unit_str="au_e", &
    5107             :                           usage="LEVEL_SHIFT 0.1", &
    5108       39184 :                           default_r_val=0.0_dp)
    5109       19592 :       CALL section_add_keyword(section, keyword)
    5110       19592 :       CALL keyword_release(keyword)
    5111             : 
    5112             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_SCF", &
    5113             :                           description="Target accuracy for the SCF convergence.", &
    5114       19592 :                           usage="EPS_SCF 1.e-6", default_r_val=1.e-5_dp)
    5115       19592 :       CALL section_add_keyword(section, keyword)
    5116       19592 :       CALL keyword_release(keyword)
    5117             : 
    5118             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_SCF_HISTORY", variants=(/"EPS_SCF_HIST"/), &
    5119             :                           description="Target accuracy for the SCF convergence after the history pipeline is filled.", &
    5120       39184 :                           usage="EPS_SCF_HISTORY 1.e-5", default_r_val=0.0_dp, lone_keyword_r_val=1.0e-5_dp)
    5121       19592 :       CALL section_add_keyword(section, keyword)
    5122       19592 :       CALL keyword_release(keyword)
    5123             : 
    5124             :       CALL keyword_create(keyword, __LOCATION__, name="CHOLESKY", &
    5125             :                           description="If the cholesky method should be used for computing "// &
    5126             :                           "the inverse of S, and in this case calling which Lapack routines", &
    5127             :                           usage="CHOLESKY REDUCE", default_i_val=cholesky_restore, &
    5128             :                           enum_c_vals=s2a("OFF", "REDUCE", "RESTORE", "INVERSE", "INVERSE_DBCSR"), &
    5129             :                           enum_desc=s2a("The cholesky algorithm is not used", "Reduce is called", &
    5130             :                                         "Reduce is replaced by two restore", &
    5131             :                                         "Restore uses operator multiply by inverse of the triangular matrix", &
    5132             :                                         "Like inverse, but matrix stored as dbcsr, sparce matrix algebra used when possible"), &
    5133       19592 :                           enum_i_vals=(/cholesky_off, cholesky_reduce, cholesky_restore, cholesky_inverse, cholesky_dbcsr/))
    5134       19592 :       CALL section_add_keyword(section, keyword)
    5135       19592 :       CALL keyword_release(keyword)
    5136             : 
    5137             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_EIGVAL", &
    5138             :                           description="Throw away linear combinations of basis functions with a small eigenvalue in S", &
    5139       19592 :                           usage="EPS_EIGVAL 1.0", default_r_val=1.0e-5_dp)
    5140       19592 :       CALL section_add_keyword(section, keyword)
    5141       19592 :       CALL keyword_release(keyword)
    5142             : 
    5143             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_DIIS", &
    5144             :                           description="Threshold on the convergence to start using DIAG/DIIS", &
    5145       19592 :                           usage="EPS_DIIS 5.0e-2", default_r_val=0.1_dp)
    5146       19592 :       CALL section_add_keyword(section, keyword)
    5147       19592 :       CALL keyword_release(keyword)
    5148             : 
    5149             :       CALL keyword_create( &
    5150             :          keyword, __LOCATION__, name="SCF_GUESS", &
    5151             :          description="Change the initial guess for the wavefunction.", &
    5152             :          usage="SCF_GUESS RESTART", default_i_val=atomic_guess, &
    5153             :          enum_c_vals=s2a("ATOMIC", "RESTART", "RANDOM", "CORE", &
    5154             :                          "HISTORY_RESTART", "MOPAC", "SPARSE", "NONE"), &
    5155             :          enum_desc=s2a("Generate an atomic density using the atomic code", &
    5156             :                        "Use the RESTART file as an initial guess (and ATOMIC if not present).", &
    5157             :                        "Use random wavefunction coefficients.", &
    5158             :                        "Diagonalize the core hamiltonian for an initial guess.", &
    5159             :                        "Extrapolated from previous RESTART files.", &
    5160             :                        "Use same guess as MOPAC for semi-empirical methods or a simple diagonal density matrix for other methods", &
    5161             :                        "Generate a sparse wavefunction using the atomic code (for OT based methods)", &
    5162             :                        "Skip initial guess (only for NON-SCC DFTB)."), &
    5163             :          enum_i_vals=(/atomic_guess, restart_guess, random_guess, core_guess, &
    5164       19592 :                        history_guess, mopac_guess, sparse_guess, no_guess/))
    5165       19592 :       CALL section_add_keyword(section, keyword)
    5166       19592 :       CALL keyword_release(keyword)
    5167             : 
    5168             :       CALL keyword_create(keyword, __LOCATION__, name="NROW_BLOCK", &
    5169             :                           description="sets the number of rows in a scalapack block", &
    5170       19592 :                           usage="NROW_BLOCK 31", default_i_val=32)
    5171       19592 :       CALL section_add_keyword(section, keyword)
    5172       19592 :       CALL keyword_release(keyword)
    5173             : 
    5174             :       CALL keyword_create(keyword, __LOCATION__, name="NCOL_BLOCK", &
    5175             :                           description="Sets the number of columns in a scalapack block", &
    5176       19592 :                           usage="NCOL_BLOCK 31", default_i_val=32)
    5177       19592 :       CALL section_add_keyword(section, keyword)
    5178       19592 :       CALL keyword_release(keyword)
    5179             : 
    5180             :       CALL keyword_create(keyword, __LOCATION__, name="ADDED_MOS", &
    5181             :                           description="Number of additional MOS added for each spin. Use -1 to add all available. "// &
    5182             :                           "alpha/beta spin can be specified independently (if spin-polarized calculation requested).", &
    5183       19592 :                           usage="ADDED_MOS", default_i_val=0, n_var=-1)
    5184       19592 :       CALL section_add_keyword(section, keyword)
    5185       19592 :       CALL keyword_release(keyword)
    5186             : 
    5187             :       CALL keyword_create(keyword, __LOCATION__, &
    5188             :                           name="ROKS_SCHEME", &
    5189             :                           description="Selects the ROKS scheme when ROKS is applied.", &
    5190             :                           usage="ROKS_SCHEME HIGH-SPIN", &
    5191             :                           repeats=.FALSE., &
    5192             :                           n_var=1, &
    5193             :                           enum_c_vals=s2a("GENERAL", "HIGH-SPIN"), &
    5194             :                           enum_i_vals=(/general_roks, high_spin_roks/), &
    5195       19592 :                           default_i_val=high_spin_roks)
    5196       19592 :       CALL section_add_keyword(section, keyword)
    5197       19592 :       CALL keyword_release(keyword)
    5198             : 
    5199             :       CALL keyword_create(keyword, __LOCATION__, &
    5200             :                           name="ROKS_F", &
    5201             :                           variants=(/"F_ROKS"/), &
    5202             :                           description="Allows to define the parameter f for the "// &
    5203             :                           "general ROKS scheme.", &
    5204             :                           usage="ROKS_PARAMETER 1/2", &
    5205             :                           repeats=.FALSE., &
    5206             :                           n_var=1, &
    5207             :                           type_of_var=real_t, &
    5208       39184 :                           default_r_val=0.5_dp)
    5209       19592 :       CALL section_add_keyword(section, keyword)
    5210       19592 :       CALL keyword_release(keyword)
    5211             : 
    5212             :       CALL keyword_create(keyword, __LOCATION__, &
    5213             :                           name="ROKS_PARAMETERS", &
    5214             :                           variants=(/"ROKS_PARAMETER"/), &
    5215             :                           description="Allows to define all parameters for the high-spin "// &
    5216             :                           "ROKS scheme explicitly. "// &
    5217             :                           "The full set of 6 parameters has to be specified "// &
    5218             :                           "in the order acc, bcc, aoo, boo, avv, bvv", &
    5219             :                           usage="ROKS_PARAMETERS 1/2 1/2 1/2 1/2 1/2 1/2", &
    5220             :                           repeats=.FALSE., &
    5221             :                           n_var=6, &
    5222             :                           type_of_var=real_t, &
    5223       39184 :                           default_r_vals=(/-0.5_dp, 1.5_dp, 0.5_dp, 0.5_dp, 1.5_dp, -0.5_dp/))
    5224       19592 :       CALL section_add_keyword(section, keyword)
    5225       19592 :       CALL keyword_release(keyword)
    5226             : 
    5227             :       CALL keyword_create(keyword, __LOCATION__, name="IGNORE_CONVERGENCE_FAILURE", &
    5228             :                           description="If true, only a warning is issued if an SCF "// &
    5229             :                           "iteration has not converged. By default, a run is aborted "// &
    5230             :                           "if the required convergence criteria have not been achieved.", &
    5231             :                           usage="IGNORE_CONVERGENCE_FAILURE logical_value", &
    5232             :                           default_l_val=.FALSE., &
    5233       19592 :                           lone_keyword_l_val=.TRUE.)
    5234       19592 :       CALL section_add_keyword(section, keyword)
    5235       19592 :       CALL keyword_release(keyword)
    5236             : 
    5237             :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    5238       19592 :                           description="Printing of information during the SCF.", repeats=.FALSE.)
    5239             : 
    5240             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
    5241             :                                        description="Controls the dumping of the MO restart file during SCF. "// &
    5242             :                                        "By default keeps a short history of three restarts. "// &
    5243             :                                        "See also RESTART_HISTORY", &
    5244             :                                        print_level=low_print_level, common_iter_levels=3, &
    5245             :                                        each_iter_names=s2a("QS_SCF"), each_iter_values=(/20/), &
    5246       19592 :                                        add_last=add_last_numeric, filename="RESTART")
    5247             :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    5248             :                           description="Specifies the maximum number of backup copies.", &
    5249             :                           usage="BACKUP_COPIES {int}", &
    5250       19592 :                           default_i_val=1)
    5251       19592 :       CALL section_add_keyword(print_key, keyword)
    5252       19592 :       CALL keyword_release(keyword)
    5253       19592 :       CALL section_add_subsection(subsection, print_key)
    5254       19592 :       CALL section_release(print_key)
    5255             : 
    5256             :       CALL cp_print_key_section_create( &
    5257             :          print_key, __LOCATION__, "RESTART_HISTORY", &
    5258             :          description="Dumps unique MO restart files during the run keeping all of them.", &
    5259             :          print_level=low_print_level, common_iter_levels=0, &
    5260             :          each_iter_names=s2a("__ROOT__", "MD", "GEO_OPT", "ROT_OPT", "NEB", "METADYNAMICS", "QS_SCF"), &
    5261             :          each_iter_values=(/500, 500, 500, 500, 500, 500, 500/), &
    5262       19592 :          filename="RESTART")
    5263             :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    5264             :                           description="Specifies the maximum number of backup copies.", &
    5265             :                           usage="BACKUP_COPIES {int}", &
    5266       19592 :                           default_i_val=1)
    5267       19592 :       CALL section_add_keyword(print_key, keyword)
    5268       19592 :       CALL keyword_release(keyword)
    5269       19592 :       CALL section_add_subsection(subsection, print_key)
    5270       19592 :       CALL section_release(print_key)
    5271             : 
    5272             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "iteration_info", &
    5273             :                                        description="Controls the printing of basic iteration information during the SCF.", &
    5274       19592 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    5275             :       CALL keyword_create(keyword, __LOCATION__, name="time_cumul", &
    5276             :                           description="If the printkey is activated switches the printing of timings"// &
    5277             :                           " to cumulative (over the SCF).", &
    5278       19592 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    5279       19592 :       CALL section_add_keyword(print_key, keyword)
    5280       19592 :       CALL keyword_release(keyword)
    5281       19592 :       CALL section_add_subsection(subsection, print_key)
    5282       19592 :       CALL section_release(print_key)
    5283             : 
    5284             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
    5285             :                                        description="Controls the printing of basic information during the SCF.", &
    5286       19592 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    5287       19592 :       CALL section_add_subsection(subsection, print_key)
    5288       19592 :       CALL section_release(print_key)
    5289             : 
    5290             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MO_ORTHONORMALITY", &
    5291             :                                        description="Controls the printing relative to the orthonormality of MOs (CT S C).", &
    5292       19592 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    5293       19592 :       CALL section_add_subsection(subsection, print_key)
    5294       19592 :       CALL section_release(print_key)
    5295             : 
    5296             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MO_MAGNITUDE", &
    5297             :                                        description="Prints the min/max eigenvalues of the overlap of the MOs without S (CT C).", &
    5298       19592 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    5299       19592 :       CALL section_add_subsection(subsection, print_key)
    5300       19592 :       CALL section_release(print_key)
    5301             : 
    5302             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "detailed_energy", &
    5303             :                                        description="Controls the printing of detailed energy information.", &
    5304       19592 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    5305       19592 :       CALL section_add_subsection(subsection, print_key)
    5306       19592 :       CALL section_release(print_key)
    5307             : 
    5308             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "diis_info", &
    5309             :                                        description="Controls the printing of DIIS information.", &
    5310       19592 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    5311       19592 :       CALL section_add_subsection(subsection, print_key)
    5312       19592 :       CALL section_release(print_key)
    5313             : 
    5314             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "total_densities", &
    5315             :                                        description="Controls the printing of total densities.", &
    5316       19592 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    5317       19592 :       CALL section_add_subsection(subsection, print_key)
    5318       19592 :       CALL section_release(print_key)
    5319             : 
    5320             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "Lanczos", &
    5321             :                                        description="Controls the printing of information on Lanczos refinement iterations.", &
    5322       19592 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    5323       19592 :       CALL section_add_subsection(subsection, print_key)
    5324       19592 :       CALL section_release(print_key)
    5325             : 
    5326             :       CALL cp_print_key_section_create( &
    5327             :          print_key, __LOCATION__, "DIAG_SUB_SCF", &
    5328             :          description="Controls the printing of information on subspace diagonalization internal loop. ", &
    5329       19592 :          print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    5330       19592 :       CALL section_add_subsection(subsection, print_key)
    5331       19592 :       CALL section_release(print_key)
    5332             : 
    5333             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "Davidson", &
    5334             :                                        description="Controls the printing of information on Davidson iterations.", &
    5335       19592 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    5336       19592 :       CALL section_add_subsection(subsection, print_key)
    5337       19592 :       CALL section_release(print_key)
    5338             : 
    5339             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FILTER_MATRIX", &
    5340             :                                        description="Controls the printing of information on Filter Matrix method.", &
    5341       19592 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    5342       19592 :       CALL section_add_subsection(subsection, print_key)
    5343       19592 :       CALL section_release(print_key)
    5344             : 
    5345             :       CALL keyword_create(keyword, __LOCATION__, name="DM_RESTART_WRITE", &
    5346             :                           description="Write the density matrix into a binary file at the end of the SCF.", &
    5347       19592 :                           usage="DM_RESTART_WRITE", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    5348       19592 :       CALL section_add_keyword(subsection, keyword)
    5349       19592 :       CALL keyword_release(keyword)
    5350             : 
    5351       19592 :       CALL section_add_subsection(section, subsection)
    5352       19592 :       CALL section_release(subsection)
    5353             : 
    5354       19592 :    END SUBROUTINE create_scf_section
    5355             : 
    5356             : ! **************************************************************************************************
    5357             : !> \brief creates the KG section
    5358             : !> \param section ...
    5359             : !> \author Martin Haeufel [2012.07]
    5360             : ! **************************************************************************************************
    5361        8408 :    SUBROUTINE create_kg_section(section)
    5362             :       TYPE(section_type), POINTER                        :: section
    5363             : 
    5364             :       TYPE(keyword_type), POINTER                        :: keyword
    5365             :       TYPE(section_type), POINTER                        :: print_key, subsection
    5366             : 
    5367        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    5368             :       CALL section_create(section, __LOCATION__, name="KG_METHOD", &
    5369             :                           description="Specifies the parameters for a Kim-Gordon-like partitioning"// &
    5370             :                           " into molecular subunits", &
    5371             :                           n_keywords=0, n_subsections=1, repeats=.FALSE., &
    5372       33632 :                           citations=(/Iannuzzi2006, Brelaz1979, Andermatt2016/))
    5373             : 
    5374        8408 :       NULLIFY (keyword, subsection, print_key)
    5375             : 
    5376             :       ! add a XC section
    5377        8408 :       CALL create_xc_section(subsection)
    5378        8408 :       CALL section_add_subsection(section, subsection)
    5379        8408 :       CALL section_release(subsection)
    5380             : 
    5381             :       ! add LRI section
    5382        8408 :       CALL create_lrigpw_section(subsection)
    5383        8408 :       CALL section_add_subsection(section, subsection)
    5384        8408 :       CALL section_release(subsection)
    5385             : 
    5386             :       CALL keyword_create(keyword, __LOCATION__, name="COLORING_METHOD", &
    5387             :                           description="Which algorithm to use for coloring.", &
    5388             :                           usage="COLORING_METHOD GREEDY", &
    5389             :                           default_i_val=kg_color_dsatur, &
    5390             :                           enum_c_vals=s2a("DSATUR", "GREEDY"), &
    5391             :                           enum_desc=s2a("Maximum degree of saturation, relatively accurate", &
    5392             :                                         "Greedy, fast coloring, less accurate"), &
    5393        8408 :                           enum_i_vals=(/kg_color_dsatur, kg_color_greedy/))
    5394        8408 :       CALL section_add_keyword(section, keyword)
    5395        8408 :       CALL keyword_release(keyword)
    5396             : 
    5397             :       CALL keyword_create(keyword, __LOCATION__, name="TNADD_METHOD", &
    5398             :                           description="Algorithm to use for the calculation of the nonadditive kinetic energy.", &
    5399             :                           usage="TNADD_METHOD ATOMIC", &
    5400             :                           default_i_val=kg_tnadd_embed, &
    5401             :                           enum_c_vals=s2a("EMBEDDING", "RI_EMBEDDING", "ATOMIC", "NONE"), &
    5402             :                           enum_desc=s2a("Use full embedding potential (see Iannuzzi et al)", &
    5403             :                                         "Use full embedding potential with RI density fitting", &
    5404             :                                         "Use sum of atomic model potentials", &
    5405             :                                         "Do not use kinetic energy embedding"), &
    5406        8408 :                           enum_i_vals=(/kg_tnadd_embed, kg_tnadd_embed_ri, kg_tnadd_atomic, kg_tnadd_none/))
    5407        8408 :       CALL section_add_keyword(section, keyword)
    5408        8408 :       CALL keyword_release(keyword)
    5409             : 
    5410             :       CALL keyword_create(keyword, __LOCATION__, name="INTEGRATION_GRID", &
    5411             :                           description="Grid [small,medium,large,huge]to be used for the TNADD integration.", &
    5412             :                           usage="INTEGRATION_GRID MEDIUM", &
    5413        8408 :                           default_c_val="MEDIUM")
    5414        8408 :       CALL section_add_keyword(section, keyword)
    5415        8408 :       CALL keyword_release(keyword)
    5416             : 
    5417             :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    5418             :                           description="Print section", &
    5419        8408 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    5420             : 
    5421             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "NEIGHBOR_LISTS", &
    5422             :                                        description="Controls the printing of the neighbor lists.", &
    5423        8408 :                                        print_level=low_print_level, filename="__STD_OUT__", unit_str="angstrom")
    5424             : 
    5425             :       CALL keyword_create(keyword, __LOCATION__, &
    5426             :                           name="SAB_ORB_FULL", &
    5427             :                           description="Activates the printing of the full orbital "// &
    5428             :                           "orbital neighbor lists.", &
    5429             :                           default_l_val=.FALSE., &
    5430        8408 :                           lone_keyword_l_val=.TRUE.)
    5431        8408 :       CALL section_add_keyword(print_key, keyword)
    5432        8408 :       CALL keyword_release(keyword)
    5433             : 
    5434             :       CALL keyword_create(keyword, __LOCATION__, &
    5435             :                           name="SAB_ORB_MOLECULAR", &
    5436             :                           description="Activates the printing of the orbital "// &
    5437             :                           "orbital neighbor lists for molecular subsets.", &
    5438             :                           default_l_val=.FALSE., &
    5439        8408 :                           lone_keyword_l_val=.TRUE.)
    5440        8408 :       CALL section_add_keyword(print_key, keyword)
    5441        8408 :       CALL keyword_release(keyword)
    5442             : 
    5443             :       CALL keyword_create(keyword, __LOCATION__, &
    5444             :                           name="SAC_KIN", &
    5445             :                           description="Activates the printing of the orbital "// &
    5446             :                           "atomic potential neighbor list.", &
    5447             :                           default_l_val=.FALSE., &
    5448        8408 :                           lone_keyword_l_val=.TRUE.)
    5449        8408 :       CALL section_add_keyword(print_key, keyword)
    5450        8408 :       CALL keyword_release(keyword)
    5451             : 
    5452        8408 :       CALL section_add_subsection(subsection, print_key)
    5453        8408 :       CALL section_release(print_key)
    5454             : 
    5455        8408 :       CALL section_add_subsection(section, subsection)
    5456        8408 :       CALL section_release(subsection)
    5457             : 
    5458        8408 :    END SUBROUTINE create_kg_section
    5459             : 
    5460             : ! **************************************************************************************************
    5461             : !> \brief creates the structure of the section with SCF parameters
    5462             : !>      controlling an other loop
    5463             : !> \param section will contain the SCF section
    5464             : !> \author Joost VandeVondele [2006.03]
    5465             : ! **************************************************************************************************
    5466       28000 :    SUBROUTINE create_outer_scf_section(section)
    5467             :       TYPE(section_type), POINTER                        :: section
    5468             : 
    5469             :       TYPE(keyword_type), POINTER                        :: keyword
    5470             :       TYPE(section_type), POINTER                        :: subsection
    5471             : 
    5472       28000 :       CPASSERT(.NOT. ASSOCIATED(section))
    5473             :       CALL section_create(section, __LOCATION__, name="OUTER_SCF", &
    5474             :                           description="parameters controlling the outer SCF loop", &
    5475       28000 :                           n_keywords=13, n_subsections=1, repeats=.FALSE.)
    5476             : 
    5477       28000 :       NULLIFY (keyword)
    5478             : 
    5479             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    5480             :                           description="controls the activation of the outer SCF loop", &
    5481       28000 :                           usage="&OUTER_SCF ON", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    5482       28000 :       CALL section_add_keyword(section, keyword)
    5483       28000 :       CALL keyword_release(keyword)
    5484             : 
    5485             :       ! add CDFT_OPT section
    5486       28000 :       NULLIFY (subsection)
    5487       28000 :       CALL create_cdft_opt_section(subsection)
    5488       28000 :       CALL section_add_subsection(section, subsection)
    5489       28000 :       CALL section_release(subsection)
    5490             : 
    5491             :       CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
    5492             :                           description="Specifies which kind of outer SCF should be employed", &
    5493             :                           usage="TYPE DDAPC_CONSTRAINT ", &
    5494             :                           default_i_val=outer_scf_none, &
    5495             :                           enum_c_vals=s2a("DDAPC_CONSTRAINT", "S2_CONSTRAINT", &
    5496             :                                           "BASIS_CENTER_OPT", "CDFT_CONSTRAINT", "NONE"), &
    5497             :                           enum_desc=s2a("Enforce a constraint on the DDAPC, requires the corresponding section", &
    5498             :                                         "Enforce a constraint on the S2, requires the corresponding section", &
    5499             :                                         "Optimize positions of basis functions, if atom types FLOATING_BASIS_CENTER "// &
    5500             :                                         "are defined", &
    5501             :                                         "Enforce a constraint on a generic CDFT weight population. "// &
    5502             :                                         "Requires the corresponding section QS&CDFT"// &
    5503             :                                         " which determines the type of weight used.", &
    5504             :                                         "Do nothing in the outer loop, useful for resetting the inner loop,"), &
    5505             :                           enum_i_vals=(/outer_scf_ddapc_constraint, outer_scf_s2_constraint, &
    5506       28000 :                                         outer_scf_basis_center_opt, outer_scf_cdft_constraint, outer_scf_none/))
    5507       28000 :       CALL section_add_keyword(section, keyword)
    5508       28000 :       CALL keyword_release(keyword)
    5509             : 
    5510             :       CALL keyword_create(keyword, __LOCATION__, name="OPTIMIZER", &
    5511             :                           description="Method used to bring the outer loop to a stationary point", &
    5512             :                           usage="OPTIMIZER SD", &
    5513             :                           default_i_val=outer_scf_optimizer_none, &
    5514             :                           enum_c_vals=s2a("SD", "DIIS", "NONE", "BISECT", "BROYDEN", "NEWTON", "SECANT", "NEWTON_LS"), &
    5515             :                           enum_desc=s2a("Takes steps in the direction of the gradient, multiplied by step_size", &
    5516             :                                         "Uses a Direct Inversion in the Iterative Subspace method", &
    5517             :                                         "Do nothing, useful only with the none type", &
    5518             :                                         "Bisection of the gradient, useful for difficult one dimensional cases", &
    5519             :                                         "Broyden's method. Variant defined in BROYDEN_TYPE.", &
    5520             :                                         "Newton's method. Only compatible with CDFT constraints.", &
    5521             :                                         "Secant method. Only for one dimensional cases. See Broyden for "// &
    5522             :                                         "multidimensional cases.", &
    5523             :                                         "Newton's method with backtracking line search to find the optimal step size. "// &
    5524             :                                         "Only compatible with CDFT constraints. Starts from the regular Newton solution "// &
    5525             :                                         "and successively reduces the step size until the L2 norm of the CDFT gradient "// &
    5526             :                                         "decreases or MAX_LS steps is reached. Potentially very expensive because "// &
    5527             :                                         "each iteration performs a full SCF calculation."), &
    5528             :                           enum_i_vals=(/outer_scf_optimizer_sd, outer_scf_optimizer_diis, outer_scf_optimizer_none, &
    5529             :                                         outer_scf_optimizer_bisect, outer_scf_optimizer_broyden, &
    5530             :                                         outer_scf_optimizer_newton, outer_scf_optimizer_secant, &
    5531       28000 :                                         outer_scf_optimizer_newton_ls/))
    5532       28000 :       CALL section_add_keyword(section, keyword)
    5533       28000 :       CALL keyword_release(keyword)
    5534             : 
    5535             :       CALL keyword_create(keyword, __LOCATION__, name="BISECT_TRUST_COUNT", &
    5536             :                           description="Maximum number of times the same point will be used in bisection,"// &
    5537             :                           " a small number guards against the effect of wrongly converged states.", &
    5538       28000 :                           usage="BISECT_TRUST_COUNT 5", default_i_val=10)
    5539       28000 :       CALL section_add_keyword(section, keyword)
    5540       28000 :       CALL keyword_release(keyword)
    5541             : 
    5542             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_SCF", &
    5543             :                           description="The target gradient of the outer SCF variables. "// &
    5544             :                           "Notice that the EPS_SCF of the inner loop also determines "// &
    5545             :                           "the value that can be reached in the outer loop, "// &
    5546             :                           "typically EPS_SCF of the outer loop must be smaller "// &
    5547             :                           "than or equal to EPS_SCF of the inner loop.", &
    5548       28000 :                           usage="EPS_SCF 1.0E-6 ", default_r_val=1.0E-5_dp)
    5549       28000 :       CALL section_add_keyword(section, keyword)
    5550       28000 :       CALL keyword_release(keyword)
    5551             : 
    5552             :       CALL keyword_create(keyword, __LOCATION__, name="DIIS_BUFFER_LENGTH", &
    5553             :                           description="Maximum number of DIIS vectors used ", &
    5554       28000 :                           usage="DIIS_BUFFER_LENGTH 5", default_i_val=3)
    5555       28000 :       CALL section_add_keyword(section, keyword)
    5556       28000 :       CALL keyword_release(keyword)
    5557             : 
    5558             :       CALL keyword_create(keyword, __LOCATION__, name="EXTRAPOLATION_ORDER", &
    5559             :                           description="Number of past states used in the extrapolation of the variables during e.g. MD", &
    5560       28000 :                           usage="EXTRAPOLATION_ORDER 5", default_i_val=3)
    5561       28000 :       CALL section_add_keyword(section, keyword)
    5562       28000 :       CALL keyword_release(keyword)
    5563             : 
    5564             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_SCF", &
    5565             :                           description="The maximum number of outer loops ", &
    5566       28000 :                           usage="MAX_SCF 20", default_i_val=50)
    5567       28000 :       CALL section_add_keyword(section, keyword)
    5568       28000 :       CALL keyword_release(keyword)
    5569             : 
    5570             :       CALL keyword_create(keyword, __LOCATION__, name="STEP_SIZE", &
    5571             :                           description="The initial step_size used in the optimizer (currently steepest descent). "// &
    5572             :                           "Note that in cases where a sadle point is sought for (constrained DFT),"// &
    5573             :                           " this can be negative. For Newton and Broyden optimizers, use a value less/higher than "// &
    5574             :                           "the default 1.0 (in absolute value, the sign is not significant) to active an under/overrelaxed "// &
    5575             :                           "optimizer.", &
    5576       28000 :                           usage="STEP_SIZE -1.0", default_r_val=0.5_dp)
    5577       28000 :       CALL section_add_keyword(section, keyword)
    5578       28000 :       CALL keyword_release(keyword)
    5579             : 
    5580       28000 :    END SUBROUTINE create_outer_scf_section
    5581             : 
    5582             : ! **************************************************************************************************
    5583             : !> \brief Create the BSSE section for counterpoise correction
    5584             : !> \param section the section to create
    5585             : !> \author teo
    5586             : ! **************************************************************************************************
    5587        8392 :    SUBROUTINE create_bsse_section(section)
    5588             :       TYPE(section_type), POINTER                        :: section
    5589             : 
    5590             :       TYPE(keyword_type), POINTER                        :: keyword
    5591             :       TYPE(section_type), POINTER                        :: subsection
    5592             : 
    5593        8392 :       CPASSERT(.NOT. ASSOCIATED(section))
    5594             :       CALL section_create(section, __LOCATION__, name="BSSE", &
    5595             :                           description="This section is used to set up the BSSE calculation. "// &
    5596             :                           "It also requires that for each atomic kind X a kind X_ghost is present, "// &
    5597             :                           "with the GHOST keyword specified, in addition to the other required fields.", &
    5598        8392 :                           n_keywords=3, n_subsections=1, repeats=.FALSE.)
    5599             : 
    5600        8392 :       NULLIFY (keyword, subsection)
    5601             :       ! FRAGMENT SECTION
    5602             :       CALL section_create(subsection, __LOCATION__, name="FRAGMENT", &
    5603             :                           description="Specify the atom number belonging to this fragment.", &
    5604        8392 :                           n_keywords=2, n_subsections=0, repeats=.TRUE.)
    5605             : 
    5606             :       CALL keyword_create(keyword, __LOCATION__, name="LIST", &
    5607             :                           description="Specifies a list of atoms.", &
    5608             :                           usage="LIST {integer} {integer} .. {integer}", &
    5609        8392 :                           repeats=.TRUE., n_var=-1, type_of_var=integer_t)
    5610        8392 :       CALL section_add_keyword(subsection, keyword)
    5611        8392 :       CALL keyword_release(keyword)
    5612             : 
    5613        8392 :       CALL section_add_subsection(section, subsection)
    5614        8392 :       CALL section_release(subsection)
    5615             : 
    5616             :       ! CONFIGURATION SECTION
    5617             :       CALL section_create(subsection, __LOCATION__, name="CONFIGURATION", &
    5618             :                           description="Specify additional parameters for the combinatorial configurations. "// &
    5619             :                           "Use this section to manually specify charge and multiplicity of the fragments "// &
    5620             :                           "and their combinations.", &
    5621        8392 :                           n_keywords=2, n_subsections=0, repeats=.TRUE.)
    5622             : 
    5623             :       CALL keyword_create(keyword, __LOCATION__, name="GLB_CONF", &
    5624             :                           description="Specifies the global configuration using 1 or 0 for each fragment. "// &
    5625             :                           "1 specifies the respective fragment as used, 0 as unused.", &
    5626             :                           usage="GLB_CONF {integer} {integer} .. {integer}", &
    5627        8392 :                           n_var=-1, type_of_var=integer_t)
    5628        8392 :       CALL section_add_keyword(subsection, keyword)
    5629        8392 :       CALL keyword_release(keyword)
    5630             : 
    5631             :       CALL keyword_create(keyword, __LOCATION__, name="SUB_CONF", &
    5632             :                           description="Specifies the subconfiguration using 1 or 0 belonging to the global configuration. "// &
    5633             :                           "1 specifies the respective fragment as real, 0 as ghost.", &
    5634             :                           usage="SUB_CONF {integer} {integer} .. {integer}", &
    5635        8392 :                           n_var=-1, type_of_var=integer_t)
    5636        8392 :       CALL section_add_keyword(subsection, keyword)
    5637        8392 :       CALL keyword_release(keyword)
    5638             : 
    5639             :       CALL keyword_create(keyword, __LOCATION__, &
    5640             :                           name="MULTIPLICITY", &
    5641             :                           variants=(/"MULTIP"/), &
    5642             :                           description="Specify for each fragment the multiplicity. Two times the total spin plus one. "// &
    5643             :                           "Specify 3 for a triplet, 4 for a quartet,and so on. Default is 1 (singlet) for an "// &
    5644             :                           "even number and 2 (doublet) for an odd number of electrons.", &
    5645             :                           usage="MULTIPLICITY 3", &
    5646       16784 :                           default_i_val=0) ! this default value is just a flag to get the above
    5647        8392 :       CALL section_add_keyword(subsection, keyword)
    5648        8392 :       CALL keyword_release(keyword)
    5649             : 
    5650             :       CALL keyword_create(keyword, __LOCATION__, name="CHARGE", &
    5651             :                           description="The total charge for each fragment.", &
    5652             :                           usage="CHARGE -1", &
    5653        8392 :                           default_i_val=0)
    5654        8392 :       CALL section_add_keyword(subsection, keyword)
    5655        8392 :       CALL keyword_release(keyword)
    5656        8392 :       CALL section_add_subsection(section, subsection)
    5657        8392 :       CALL section_release(subsection)
    5658             : 
    5659             :       CALL section_create(subsection, __LOCATION__, name="FRAGMENT_ENERGIES", &
    5660             :                           description="This section contains the energies of the fragments already"// &
    5661             :                           " computed. It is useful as a summary and specifically for restarting BSSE runs.", &
    5662        8392 :                           n_keywords=2, n_subsections=0, repeats=.TRUE.)
    5663             :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    5664             :                           description="The energy computed for each fragment", repeats=.TRUE., &
    5665        8392 :                           usage="{REAL}", type_of_var=real_t)
    5666        8392 :       CALL section_add_keyword(subsection, keyword)
    5667        8392 :       CALL keyword_release(keyword)
    5668        8392 :       CALL section_add_subsection(section, subsection)
    5669        8392 :       CALL section_release(subsection)
    5670             : 
    5671        8392 :       CALL create_print_bsse_section(subsection)
    5672        8392 :       CALL section_add_subsection(section, subsection)
    5673        8392 :       CALL section_release(subsection)
    5674             : 
    5675        8392 :    END SUBROUTINE create_bsse_section
    5676             : 
    5677             : ! **************************************************************************************************
    5678             : !> \brief Create the print bsse section
    5679             : !> \param section the section to create
    5680             : !> \author teo
    5681             : ! **************************************************************************************************
    5682        8392 :    SUBROUTINE create_print_bsse_section(section)
    5683             :       TYPE(section_type), POINTER                        :: section
    5684             : 
    5685             :       TYPE(section_type), POINTER                        :: print_key
    5686             : 
    5687        8392 :       CPASSERT(.NOT. ASSOCIATED(section))
    5688             :       CALL section_create(section, __LOCATION__, name="print", &
    5689             :                           description="Section of possible print options in BSSE code.", &
    5690        8392 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    5691             : 
    5692        8392 :       NULLIFY (print_key)
    5693             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
    5694             :                                        description="Controls the printing of information regarding the run.", &
    5695        8392 :                                        print_level=low_print_level, filename="__STD_OUT__")
    5696        8392 :       CALL section_add_subsection(section, print_key)
    5697        8392 :       CALL section_release(print_key)
    5698             : 
    5699             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
    5700             :                                        description="Controls the dumping of the restart file during BSSE runs. "// &
    5701             :                                        "By default the restart is updated after each configuration calculation is "// &
    5702             :                                        "completed.", &
    5703             :                                        print_level=silent_print_level, common_iter_levels=0, &
    5704        8392 :                                        add_last=add_last_numeric, filename="")
    5705        8392 :       CALL section_add_subsection(section, print_key)
    5706        8392 :       CALL section_release(print_key)
    5707             : 
    5708        8392 :    END SUBROUTINE create_print_bsse_section
    5709             : 
    5710             : ! **************************************************************************************************
    5711             : !> \brief creates the interpolation section for the periodic QM/MM
    5712             : !> \param section ...
    5713             : !> \author tlaino
    5714             : ! **************************************************************************************************
    5715        8408 :    SUBROUTINE create_gspace_interp_section(section)
    5716             :       TYPE(section_type), POINTER                        :: section
    5717             : 
    5718             :       TYPE(keyword_type), POINTER                        :: keyword
    5719             :       TYPE(section_type), POINTER                        :: print_key
    5720             : 
    5721        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    5722             :       CALL section_create(section, __LOCATION__, name="interpolator", &
    5723             :                           description="controls the interpolation for the G-space term", &
    5724        8408 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
    5725             : 
    5726        8408 :       NULLIFY (keyword, print_key)
    5727             : 
    5728             :       CALL keyword_create(keyword, __LOCATION__, name="aint_precond", &
    5729             :                           description="the approximate inverse to use to get the starting point"// &
    5730             :                           " for the linear solver of the spline3 methods", &
    5731             :                           usage="kind spline3", &
    5732             :                           default_i_val=precond_spl3_aint, &
    5733             :                           enum_c_vals=s2a("copy", "spl3_nopbc_aint1", "spl3_nopbc_precond1", &
    5734             :                                           "spl3_nopbc_aint2", "spl3_nopbc_precond2", "spl3_nopbc_precond3"), &
    5735             :                           enum_i_vals=(/no_precond, precond_spl3_aint, precond_spl3_1, &
    5736        8408 :                                         precond_spl3_aint2, precond_spl3_2, precond_spl3_3/))
    5737        8408 :       CALL section_add_keyword(section, keyword)
    5738        8408 :       CALL keyword_release(keyword)
    5739             : 
    5740             :       CALL keyword_create(keyword, __LOCATION__, name="precond", &
    5741             :                           description="The preconditioner used"// &
    5742             :                           " for the linear solver of the spline3 methods", &
    5743             :                           usage="kind spline3", &
    5744             :                           default_i_val=precond_spl3_3, &
    5745             :                           enum_c_vals=s2a("copy", "spl3_nopbc_aint1", "spl3_nopbc_precond1", &
    5746             :                                           "spl3_nopbc_aint2", "spl3_nopbc_precond2", "spl3_nopbc_precond3"), &
    5747             :                           enum_i_vals=(/no_precond, precond_spl3_aint, precond_spl3_1, &
    5748        8408 :                                         precond_spl3_aint2, precond_spl3_2, precond_spl3_3/))
    5749        8408 :       CALL section_add_keyword(section, keyword)
    5750        8408 :       CALL keyword_release(keyword)
    5751             : 
    5752             :       CALL keyword_create(keyword, __LOCATION__, name="eps_x", &
    5753             :                           description="accuracy on the solution for spline3 the interpolators", &
    5754        8408 :                           usage="eps_x 1.e-15", default_r_val=1.e-10_dp)
    5755        8408 :       CALL section_add_keyword(section, keyword)
    5756        8408 :       CALL keyword_release(keyword)
    5757             : 
    5758             :       CALL keyword_create(keyword, __LOCATION__, name="eps_r", &
    5759             :                           description="accuracy on the residual for spline3 the interpolators", &
    5760        8408 :                           usage="eps_r 1.e-15", default_r_val=1.e-10_dp)
    5761        8408 :       CALL section_add_keyword(section, keyword)
    5762        8408 :       CALL keyword_release(keyword)
    5763             : 
    5764             :       CALL keyword_create(keyword, __LOCATION__, name="max_iter", &
    5765             :                           variants=(/'maxiter'/), &
    5766             :                           description="the maximum number of iterations", &
    5767       16816 :                           usage="max_iter 200", default_i_val=100)
    5768        8408 :       CALL section_add_keyword(section, keyword)
    5769        8408 :       CALL keyword_release(keyword)
    5770             : 
    5771        8408 :       NULLIFY (print_key)
    5772             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "conv_info", &
    5773             :                                        description="if convergence information about the linear solver"// &
    5774             :                                        " of the spline methods should be printed", &
    5775             :                                        print_level=medium_print_level, each_iter_names=s2a("SPLINE_FIND_COEFFS"), &
    5776             :                                        each_iter_values=(/10/), filename="__STD_OUT__", &
    5777        8408 :                                        add_last=add_last_numeric)
    5778        8408 :       CALL section_add_subsection(section, print_key)
    5779        8408 :       CALL section_release(print_key)
    5780             : 
    5781        8408 :    END SUBROUTINE create_gspace_interp_section
    5782             : 
    5783             : ! **************************************************************************************************
    5784             : !> \brief input section for optional parameters for LRIGPW
    5785             : !>        LRI: local resolution of identity
    5786             : !> \param section the section to create
    5787             : !> \author Dorothea Golze [02.2015]
    5788             : ! **************************************************************************************************
    5789       25208 :    SUBROUTINE create_lrigpw_section(section)
    5790             :       TYPE(section_type), POINTER                        :: section
    5791             : 
    5792             :       TYPE(keyword_type), POINTER                        :: keyword
    5793             : 
    5794       25208 :       CPASSERT(.NOT. ASSOCIATED(section))
    5795             :       CALL section_create(section, __LOCATION__, name="LRIGPW", &
    5796             :                           description="This section specifies optional parameters for LRIGPW.", &
    5797       50416 :                           n_keywords=3, n_subsections=0, repeats=.FALSE., citations=(/Golze2017b/))
    5798             : 
    5799       25208 :       NULLIFY (keyword)
    5800             : 
    5801             :       CALL keyword_create(keyword, __LOCATION__, name="LRI_OVERLAP_MATRIX", &
    5802             :                           description="Specifies whether to calculate the inverse or the "// &
    5803             :                           "pseudoinverse of the overlap matrix of the auxiliary "// &
    5804             :                           "basis set. Calculating the pseudoinverse is necessary "// &
    5805             :                           "for very large auxiliary basis sets, but more expensive. "// &
    5806             :                           "Using the pseudoinverse, consistent forces are not "// &
    5807             :                           "guaranteed yet.", &
    5808             :                           usage="LRI_OVERLAP_MATRIX INVERSE", &
    5809             :                           enum_c_vals=s2a("INVERSE", "PSEUDO_INVERSE_SVD", "PSEUDO_INVERSE_DIAG", &
    5810             :                                           "AUTOSELECT"), &
    5811             :                           enum_desc=s2a("Calculate inverse of the overlap matrix.", &
    5812             :                                         "Calculate the pseuodinverse of the overlap matrix "// &
    5813             :                                         "using singular value decomposition.", &
    5814             :                                         "Calculate the pseudoinverse of the overlap matrix "// &
    5815             :                                         "by prior diagonalization.", &
    5816             :                                         "Choose automatically for each pair whether to "// &
    5817             :                                         "calculate the inverse or pseudoinverse based on the "// &
    5818             :                                         "condition number of the overlap matrix for each pair. "// &
    5819             :                                         "Calculating the pseudoinverse is much more expensive."), &
    5820             :                           enum_i_vals=(/do_lri_inv, do_lri_pseudoinv_svd, &
    5821             :                                         do_lri_pseudoinv_diag, do_lri_inv_auto/), &
    5822       25208 :                           default_i_val=do_lri_inv)
    5823       25208 :       CALL section_add_keyword(section, keyword)
    5824       25208 :       CALL keyword_release(keyword)
    5825             : 
    5826             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_CONDITION_NUM", &
    5827             :                           description="If AUTOSELECT is chosen for LRI_OVERLAP_MATRIX, this "// &
    5828             :                           "keyword specifies that the pseudoinverse is calculated "// &
    5829             :                           "only if the LOG of the condition number of the lri "// &
    5830             :                           "overlap matrix is larger than the given value.", &
    5831       25208 :                           usage="MAX_CONDITION_NUM 20.0", default_r_val=20.0_dp)
    5832       25208 :       CALL section_add_keyword(section, keyword)
    5833       25208 :       CALL keyword_release(keyword)
    5834             : 
    5835             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_O3_INT", &
    5836             :                           description="Threshold for ABA and ABB integrals in LRI. "// &
    5837             :                           "This is used for screening in the KS and "// &
    5838             :                           "force calculations (tensor contractions).", &
    5839       25208 :                           usage="EPS_O3_INT 1.e-10", default_r_val=1.0e-14_dp)
    5840       25208 :       CALL section_add_keyword(section, keyword)
    5841       25208 :       CALL keyword_release(keyword)
    5842             : 
    5843             :       CALL keyword_create(keyword, __LOCATION__, name="DEBUG_LRI_INTEGRALS", &
    5844             :                           description="Debug the integrals needed for LRIGPW.", &
    5845             :                           usage="DEBUG_LRI_INTEGRALS TRUE", &
    5846       25208 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    5847       25208 :       CALL section_add_keyword(section, keyword)
    5848       25208 :       CALL keyword_release(keyword)
    5849             : 
    5850             :       CALL keyword_create(keyword, __LOCATION__, name="EXACT_1C_TERMS", &
    5851             :                           description="Don't use LRI for one center densities.", &
    5852             :                           usage="EXACT_1C_TERMS TRUE", &
    5853       25208 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    5854       25208 :       CALL section_add_keyword(section, keyword)
    5855       25208 :       CALL keyword_release(keyword)
    5856             : 
    5857             :       CALL keyword_create(keyword, __LOCATION__, name="PPL_RI", &
    5858             :                           description="Use LRI/RI for local pseudopotential.", &
    5859             :                           usage="PPL_RI TRUE", &
    5860       25208 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    5861       25208 :       CALL section_add_keyword(section, keyword)
    5862       25208 :       CALL keyword_release(keyword)
    5863             : 
    5864             :       CALL keyword_create(keyword, __LOCATION__, name="RI_STATISTIC", &
    5865             :                           description="Print statistical information on the RI calculation.", &
    5866             :                           usage="RI_STATISTIC TRUE", &
    5867       25208 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    5868       25208 :       CALL section_add_keyword(section, keyword)
    5869       25208 :       CALL keyword_release(keyword)
    5870             : 
    5871             :       CALL keyword_create(keyword, __LOCATION__, name="DISTANT_PAIR_APPROXIMATION", &
    5872             :                           description="Calculate distant pairs using an independent atom approximation.", &
    5873             :                           usage="DISTANT_PAIR_APPROXIMATION TRUE", &
    5874       25208 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    5875       25208 :       CALL section_add_keyword(section, keyword)
    5876       25208 :       CALL keyword_release(keyword)
    5877             : 
    5878             :       CALL keyword_create(keyword, __LOCATION__, name="DISTANT_PAIR_METHOD", &
    5879             :                           description="Method used to separate pair density for distant pairs. "// &
    5880             :                           "Options: EW (equal weights); AW (atomic weights); SW (set weights); "// &
    5881             :                           "LW (shell function weights)", &
    5882             :                           usage="DISTANT_PAIR_METHOD {method}", &
    5883       25208 :                           default_c_val="LW")
    5884       25208 :       CALL section_add_keyword(section, keyword)
    5885       25208 :       CALL keyword_release(keyword)
    5886             : 
    5887             :       CALL keyword_create(keyword, __LOCATION__, name="DISTANT_PAIR_RADII", &
    5888             :                           description="Inner and outer radii used in distant "// &
    5889             :                           "pair separation. Smooth interpolation between inner and outer "// &
    5890             :                           "radius is used.", &
    5891             :                           usage="DISTANT_PAIR_RADII r_inner {real} r_outer {real} ", &
    5892             :                           n_var=2, default_r_vals=(/8._dp, 12._dp/), unit_str='bohr', &
    5893       25208 :                           type_of_var=real_t)
    5894       25208 :       CALL section_add_keyword(section, keyword)
    5895       25208 :       CALL keyword_release(keyword)
    5896             : 
    5897             :       CALL keyword_create(keyword, __LOCATION__, name="SHG_LRI_INTEGRALS", &
    5898             :                           description="Uses the SHG (solid harmonic Gaussian) integral "// &
    5899             :                           "scheme instead of Obara-Saika", &
    5900             :                           usage="SHG_LRI_INTEGRALS TRUE", &
    5901             :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE., &
    5902       50416 :                           citations=(/Golze2017a/))
    5903       25208 :       CALL section_add_keyword(section, keyword)
    5904       25208 :       CALL keyword_release(keyword)
    5905             : 
    5906             :       CALL keyword_create(keyword, __LOCATION__, name="RI_SINV", &
    5907             :                           description="Approximation to be used for the inverse of the "// &
    5908             :                           "RI overlap matrix. INVF, INVS: exact inverse, apply directly "// &
    5909             :                           "for solver (F:full matrix, S:sparsematrix). AINV approximate inverse, use with PCG. "// &
    5910             :                           "NONE: no approximation used with CG solver.", &
    5911       25208 :                           usage="RI_SINV NONE", default_c_val="INVF")
    5912       25208 :       CALL section_add_keyword(section, keyword)
    5913       25208 :       CALL keyword_release(keyword)
    5914             : 
    5915       25208 :    END SUBROUTINE create_lrigpw_section
    5916             : 
    5917             : ! **************************************************************************************************
    5918             : !> \brief input section for optimization of the auxililary basis for LRIGPW
    5919             : !> \param section the section to create
    5920             : !> \author Dorothea Golze [05.2014]
    5921             : ! **************************************************************************************************
    5922        8408 :    SUBROUTINE create_optimize_lri_basis_section(section)
    5923             :       TYPE(section_type), POINTER                        :: section
    5924             : 
    5925             :       TYPE(keyword_type), POINTER                        :: keyword
    5926             :       TYPE(section_type), POINTER                        :: subsection
    5927             : 
    5928        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    5929             :       CALL section_create(section, __LOCATION__, name="OPTIMIZE_LRI_BASIS", &
    5930             :                           description="This section specifies the parameters for optimizing "// &
    5931             :                           "the lri auxiliary basis sets for LRIGPW. The Powell optimizer is used.", &
    5932        8408 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    5933             : 
    5934        8408 :       NULLIFY (keyword, subsection)
    5935             : 
    5936             :       CALL keyword_create(keyword, __LOCATION__, name="ACCURACY", &
    5937             :                           description="Target accuracy for the objective function (RHOEND)", &
    5938        8408 :                           usage="ACCURACY 5.0E-4", default_r_val=1.0E-5_dp)
    5939        8408 :       CALL section_add_keyword(section, keyword)
    5940        8408 :       CALL keyword_release(keyword)
    5941             : 
    5942             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_FUN", &
    5943             :                           description="Maximum number of function evaluations", &
    5944        8408 :                           usage="MAX_FUN 200", default_i_val=4000)
    5945        8408 :       CALL section_add_keyword(section, keyword)
    5946        8408 :       CALL keyword_release(keyword)
    5947             : 
    5948             :       CALL keyword_create(keyword, __LOCATION__, name="STEP_SIZE", &
    5949             :                           description="Initial step size for search algorithm (RHOBEG)", &
    5950        8408 :                           usage="STEP_SIZE 1.0E-1", default_r_val=5.0E-2_dp)
    5951        8408 :       CALL section_add_keyword(section, keyword)
    5952        8408 :       CALL keyword_release(keyword)
    5953             : 
    5954             :       CALL keyword_create(keyword, __LOCATION__, name="CONDITION_WEIGHT", &
    5955             :                           description="This keyword allows to give different weight "// &
    5956             :                           "factors to the condition number (LOG(cond) is used).", &
    5957        8408 :                           usage="CONDITION_WEIGHT 1.0E-4", default_r_val=1.0E-6_dp)
    5958        8408 :       CALL section_add_keyword(section, keyword)
    5959        8408 :       CALL keyword_release(keyword)
    5960             : 
    5961             :       CALL keyword_create(keyword, __LOCATION__, name="USE_CONDITION_NUMBER", &
    5962             :                           description="Determines whether condition number should be part "// &
    5963             :                           "of optimization or not", &
    5964             :                           usage="USE_CONDITION_NUMBER", &
    5965        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    5966        8408 :       CALL section_add_keyword(section, keyword)
    5967        8408 :       CALL keyword_release(keyword)
    5968             : 
    5969             :       CALL keyword_create(keyword, __LOCATION__, name="GEOMETRIC_SEQUENCE", &
    5970             :                           description="Exponents are assumed to be a geometric sequence. "// &
    5971             :                           "Only the minimal and maximal exponents of one set are optimized and "// &
    5972             :                           "the other exponents are obtained by geometric progression.", &
    5973             :                           usage="GEOMETRIC_SEQUENCE", &
    5974        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    5975        8408 :       CALL section_add_keyword(section, keyword)
    5976        8408 :       CALL keyword_release(keyword)
    5977             : 
    5978             :       CALL keyword_create(keyword, __LOCATION__, name="DEGREES_OF_FREEDOM", &
    5979             :                           description="Specifies the degrees of freedom in the basis "// &
    5980             :                           "optimization.", &
    5981             :                           usage="DEGREES_OF_FREEDOM ALL", &
    5982             :                           enum_c_vals=s2a("ALL", "COEFFICIENTS", "EXPONENTS"), &
    5983             :                           enum_desc=s2a("Set all parameters in the basis to be variable.", &
    5984             :                                         "Set all coefficients in the basis set to be variable.", &
    5985             :                                         "Set all exponents in the basis to be variable."), &
    5986             :                           enum_i_vals=(/do_lri_opt_all, do_lri_opt_coeff, do_lri_opt_exps/), &
    5987        8408 :                           default_i_val=do_lri_opt_exps)
    5988        8408 :       CALL section_add_keyword(section, keyword)
    5989        8408 :       CALL keyword_release(keyword)
    5990             : 
    5991        8408 :       CALL create_constrain_exponents_section(subsection)
    5992        8408 :       CALL section_add_subsection(section, subsection)
    5993        8408 :       CALL section_release(subsection)
    5994             : 
    5995        8408 :    END SUBROUTINE create_optimize_lri_basis_section
    5996             : 
    5997             : ! **************************************************************************************************
    5998             : !> \brief Input for DFT embedding
    5999             : !> \param section ...
    6000             : !> \author Vladimir Rybkin [08.2017]
    6001             : ! **************************************************************************************************
    6002        8408 :    SUBROUTINE create_optimize_embed(section)
    6003             :       TYPE(section_type), POINTER                        :: section
    6004             : 
    6005             :       TYPE(keyword_type), POINTER                        :: keyword
    6006             : 
    6007        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    6008             :       CALL section_create(section, __LOCATION__, name="OPT_EMBED", &
    6009             :                           description="This section specifies optional parameters for DFT embedding potential optimization.", &
    6010        8408 :                           n_keywords=19, n_subsections=4, repeats=.FALSE.)
    6011             : 
    6012        8408 :       NULLIFY (keyword)
    6013             : 
    6014             :       CALL keyword_create(keyword, __LOCATION__, name="REG_LAMBDA", &
    6015             :                           description="Parameter for Yang's regularization "// &
    6016             :                           "involving kinetic matrix.", &
    6017        8408 :                           usage="REG_LAMBDA 0.0001", default_r_val=0.0001_dp)
    6018        8408 :       CALL section_add_keyword(section, keyword)
    6019        8408 :       CALL keyword_release(keyword)
    6020             : 
    6021             :       CALL keyword_create(keyword, __LOCATION__, name="N_ITER", &
    6022             :                           description="Maximum number of iterations "// &
    6023             :                           "in the optimization procedure.", &
    6024        8408 :                           usage="N_ITER 75", default_i_val=50)
    6025        8408 :       CALL section_add_keyword(section, keyword)
    6026        8408 :       CALL keyword_release(keyword)
    6027             : 
    6028             :       CALL keyword_create(keyword, __LOCATION__, name="TRUST_RAD", &
    6029             :                           description="Maximum number of iterations "// &
    6030             :                           "in the optimization procedure.", &
    6031        8408 :                           usage="TRUST_RAD 0.5", default_r_val=0.5_dp)
    6032        8408 :       CALL section_add_keyword(section, keyword)
    6033        8408 :       CALL keyword_release(keyword)
    6034             : 
    6035             :       CALL keyword_create(keyword, __LOCATION__, name="DENS_CONV_MAX", &
    6036             :                           description="Convergence criterion for "// &
    6037             :                           "the maximum electron density difference.", &
    6038        8408 :                           usage="DENS_CONV_MAX 0.01", default_r_val=0.01_dp)
    6039        8408 :       CALL section_add_keyword(section, keyword)
    6040        8408 :       CALL keyword_release(keyword)
    6041             : 
    6042             :       CALL keyword_create(keyword, __LOCATION__, name="DENS_CONV_INT", &
    6043             :                           description="Convergence criterion for "// &
    6044             :                           "the integrated electron density difference.", &
    6045        8408 :                           usage="DENS_CONV_INT 0.1", default_r_val=0.1_dp)
    6046        8408 :       CALL section_add_keyword(section, keyword)
    6047        8408 :       CALL keyword_release(keyword)
    6048             : 
    6049             :       CALL keyword_create(keyword, __LOCATION__, name="SPIN_DENS_CONV_MAX", &
    6050             :                           description="Convergence criterion for "// &
    6051             :                           "the maximum electron density difference.", &
    6052        8408 :                           usage="DENS_CONV_MAX 0.01", default_r_val=0.01_dp)
    6053        8408 :       CALL section_add_keyword(section, keyword)
    6054        8408 :       CALL keyword_release(keyword)
    6055             : 
    6056             :       CALL keyword_create(keyword, __LOCATION__, name="SPIN_DENS_CONV_INT", &
    6057             :                           description="Convergence criterion for "// &
    6058             :                           "the integrated electron density difference.", &
    6059        8408 :                           usage="DENS_CONV_INT 0.1", default_r_val=0.1_dp)
    6060        8408 :       CALL section_add_keyword(section, keyword)
    6061        8408 :       CALL keyword_release(keyword)
    6062             : 
    6063             :       CALL keyword_create(keyword, __LOCATION__, name="OPTIMIZER", &
    6064             :                           description="Optimize embedding potential.", &
    6065             :                           usage="OPTIMIZER  LEVEL_SHIFT", &
    6066             :                           default_i_val=embed_steep_desc, &
    6067             :                           enum_c_vals=s2a("STEEPEST_DESCENT", "QUASI_NEWTON", "LEVEL_SHIFT"), &
    6068             :                           enum_desc=s2a("Steepest descent.", "Quasi-Newton.", "Level shift."), &
    6069        8408 :                           enum_i_vals=(/embed_steep_desc, embed_quasi_newton, embed_level_shift/))
    6070        8408 :       CALL section_add_keyword(section, keyword)
    6071        8408 :       CALL keyword_release(keyword)
    6072             : 
    6073             :       CALL keyword_create(keyword, __LOCATION__, name="GRID_OPT", &
    6074             :                           description="Optimize embedding potential on the grid. ", &
    6075             :                           usage="GRID_OPT .TRUE.", &
    6076        8408 :                           default_l_val=.TRUE.)
    6077        8408 :       CALL section_add_keyword(section, keyword)
    6078        8408 :       CALL keyword_release(keyword)
    6079             : 
    6080             :       CALL keyword_create(keyword, __LOCATION__, name="LEEUWEN-BAERENDS", &
    6081             :                           description="Van Leeuwen-Baerends iterative update. Alternative to Wu-Yang "// &
    6082             :                           "optimizer. Use only with ADD_CONTST_POT.", &
    6083             :                           usage="LEEUWEN-BAERENDS .TRUE.", &
    6084        8408 :                           default_l_val=.FALSE.)
    6085        8408 :       CALL section_add_keyword(section, keyword)
    6086        8408 :       CALL keyword_release(keyword)
    6087             : 
    6088             :       CALL keyword_create(keyword, __LOCATION__, name="FAB", &
    6089             :                           description="Finzel-Ayers-Bultinck iterative update. Generally, not reliable. ", &
    6090             :                           usage="FAB .TRUE.", &
    6091        8408 :                           default_l_val=.FALSE.)
    6092        8408 :       CALL section_add_keyword(section, keyword)
    6093        8408 :       CALL keyword_release(keyword)
    6094             : 
    6095             :       CALL keyword_create(keyword, __LOCATION__, name="VW_CUTOFF", &
    6096             :                           description="Cutoff for von Weizsacker potential in "// &
    6097             :                           "the FAB optimization procedure.", &
    6098        8408 :                           usage="VW_CUTOFF 0.01", default_r_val=0.01_dp)
    6099        8408 :       CALL section_add_keyword(section, keyword)
    6100        8408 :       CALL keyword_release(keyword)
    6101             : 
    6102             :       CALL keyword_create(keyword, __LOCATION__, name="VW_SMOOTH_CUT_RANGE", &
    6103             :                           description="Smooth cutoff range for von Weizsacker potential in "// &
    6104             :                           "the FAB optimization procedure.", &
    6105        8408 :                           usage="VW_CUTOFF 1.0", default_r_val=1.0_dp)
    6106        8408 :       CALL section_add_keyword(section, keyword)
    6107        8408 :       CALL keyword_release(keyword)
    6108             : 
    6109             :       CALL keyword_create(keyword, __LOCATION__, name="POT_GUESS", &
    6110             :                           description="Specifies the guess of the embedding  "// &
    6111             :                           "potential. For optimization in finite basis (not grid optimization) "// &
    6112             :                           "in is a constant part to be added to the one in finite basis. ", &
    6113             :                           usage="DEGREES_OF_FREEDOM ALL", &
    6114             :                           enum_c_vals=s2a("NONE", "DIFF", "Fermi_Amaldi", "RESP"), &
    6115             :                           enum_desc=s2a("Initial guess is zero grid.", &
    6116             :                                         "Initial density difference. A euristic but working approach.", &
    6117             :                                         "Fermi-Amaldi potential. More rigorous than DIFF, although less efficient.", &
    6118             :                                         "Coulomb interaction between the subsystem using RESP charges)"// &
    6119             :                                         " on the total system."), &
    6120             :                           enum_i_vals=(/embed_none, embed_diff, embed_fa, embed_resp/), &
    6121        8408 :                           default_i_val=embed_none)
    6122        8408 :       CALL section_add_keyword(section, keyword)
    6123        8408 :       CALL keyword_release(keyword)
    6124             : 
    6125             :       CALL keyword_create(keyword, __LOCATION__, name="CHARGE_DISTR_WIDTH", &
    6126             :                           description="Width of the Gaussian representing "// &
    6127             :                           "point charges. To be used with ADD_COULOMB_POT.", &
    6128        8408 :                           usage="CHARGE_DISTR_WIDTH 3.000", default_r_val=1.12490_dp)
    6129        8408 :       CALL section_add_keyword(section, keyword)
    6130        8408 :       CALL keyword_release(keyword)
    6131             : 
    6132             :       CALL keyword_create(keyword, __LOCATION__, name="READ_EMBED_POT", &
    6133             :                           description="Read the embedding potential  "// &
    6134             :                           "restart vector as a guess.", &
    6135        8408 :                           usage="READ_EMBED_POT .FALSE.", default_l_val=.FALSE.)
    6136        8408 :       CALL section_add_keyword(section, keyword)
    6137        8408 :       CALL keyword_release(keyword)
    6138             : 
    6139             :       CALL keyword_create(keyword, __LOCATION__, name="READ_EMBED_POT_CUBE", &
    6140             :                           description="Read the embedding potential  "// &
    6141             :                           "(restart) from the cube file.", &
    6142        8408 :                           usage="READ_EMBED_POT_CUBE .FALSE.", default_l_val=.FALSE.)
    6143        8408 :       CALL section_add_keyword(section, keyword)
    6144        8408 :       CALL keyword_release(keyword)
    6145             : 
    6146             :       CALL keyword_create(keyword, __LOCATION__, name="EMBED_RESTART_FILE_NAME", &
    6147             :                           description="Root of the file name where to read the embedding "// &
    6148             :                           "potential guess.", &
    6149             :                           usage="EMBED_RESTART_FILE_NAME <FILENAME>", &
    6150        8408 :                           type_of_var=lchar_t)
    6151        8408 :       CALL section_add_keyword(section, keyword)
    6152        8408 :       CALL keyword_release(keyword)
    6153             : 
    6154             :       CALL keyword_create(keyword, __LOCATION__, name="EMBED_CUBE_FILE_NAME", &
    6155             :                           description="Root of the file name where to read the embedding "// &
    6156             :                           "potential (guess) as a cube.", &
    6157             :                           usage="EMBED_CUBE_FILE_NAME <FILENAME>", &
    6158        8408 :                           type_of_var=lchar_t)
    6159        8408 :       CALL section_add_keyword(section, keyword)
    6160        8408 :       CALL keyword_release(keyword)
    6161             : 
    6162             :       CALL keyword_create(keyword, __LOCATION__, name="EMBED_SPIN_CUBE_FILE_NAME", &
    6163             :                           description="Root of the file name where to read the spin part "// &
    6164             :                           "of the embedding potential (guess) as a cube.", &
    6165             :                           usage="EMBED_SPIN_CUBE_FILE_NAME <FILENAME>", &
    6166        8408 :                           type_of_var=lchar_t)
    6167        8408 :       CALL section_add_keyword(section, keyword)
    6168        8408 :       CALL keyword_release(keyword)
    6169             : 
    6170        8408 :       CALL create_print_embed_diff(section)
    6171             : 
    6172        8408 :       CALL create_print_embed_pot_cube(section)
    6173             : 
    6174        8408 :       CALL create_print_embed_restart_vec(section)
    6175             : 
    6176        8408 :       CALL create_print_simple_grid(section)
    6177             : 
    6178        8408 :    END SUBROUTINE create_optimize_embed
    6179             : 
    6180             : ! **************************************************************************************************
    6181             : !> \brief Input for density matrix functional embedding, DMFET
    6182             : !> \param section ...
    6183             : !> \author Vladimir Rybkin [08.2018]
    6184             : ! **************************************************************************************************
    6185        8408 :    SUBROUTINE create_optimize_dmfet(section)
    6186             :       TYPE(section_type), POINTER                        :: section
    6187             : 
    6188             :       TYPE(keyword_type), POINTER                        :: keyword
    6189             : 
    6190        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    6191             :       CALL section_create(section, __LOCATION__, name="OPT_DMFET", &
    6192             :                           description="This section specifies optional parameters for DMFET matrix potential optimization.", &
    6193        8408 :                           n_keywords=8, n_subsections=4, repeats=.FALSE.)
    6194             : 
    6195        8408 :       NULLIFY (keyword)
    6196             : 
    6197             :       CALL keyword_create(keyword, __LOCATION__, name="N_ITER", &
    6198             :                           description="Maximum number of iterations "// &
    6199             :                           "in the optimization procedure.", &
    6200        8408 :                           usage="N_ITER 75", default_i_val=50)
    6201        8408 :       CALL section_add_keyword(section, keyword)
    6202        8408 :       CALL keyword_release(keyword)
    6203             : 
    6204             :       CALL keyword_create(keyword, __LOCATION__, name="TRUST_RAD", &
    6205             :                           description="Step length "// &
    6206             :                           "in the optimization procedure.", &
    6207        8408 :                           usage="TRUST_RAD 0.5", default_r_val=0.5_dp)
    6208        8408 :       CALL section_add_keyword(section, keyword)
    6209        8408 :       CALL keyword_release(keyword)
    6210             : 
    6211             :       CALL keyword_create(keyword, __LOCATION__, name="DM_CONV_MAX", &
    6212             :                           description="Convergence criterion for "// &
    6213             :                           "the maximum element of density matrix difference.", &
    6214        8408 :                           usage="DM_CONV_MAX 0.01", default_r_val=0.01_dp)
    6215        8408 :       CALL section_add_keyword(section, keyword)
    6216        8408 :       CALL keyword_release(keyword)
    6217             : 
    6218             :       CALL keyword_create(keyword, __LOCATION__, name="DM_CONV_INT", &
    6219             :                           description="Convergence criterion for "// &
    6220             :                           "the total density matrix difference.", &
    6221        8408 :                           usage="DM_CONV_INT 0.1", default_r_val=0.1_dp)
    6222        8408 :       CALL section_add_keyword(section, keyword)
    6223        8408 :       CALL keyword_release(keyword)
    6224             : 
    6225             :       CALL keyword_create(keyword, __LOCATION__, name="BETA_DM_CONV_MAX", &
    6226             :                           description="Convergence criterion for "// &
    6227             :                           "the maximum element of the beta-spin density "// &
    6228             :                           "matrix difference.", &
    6229        8408 :                           usage="DM_CONV_MAX 0.01", default_r_val=0.01_dp)
    6230        8408 :       CALL section_add_keyword(section, keyword)
    6231        8408 :       CALL keyword_release(keyword)
    6232             : 
    6233             :       CALL keyword_create(keyword, __LOCATION__, name="BETA_DM_CONV_INT", &
    6234             :                           description="Convergence criterion for "// &
    6235             :                           "the total beta-spin density matrix difference.", &
    6236        8408 :                           usage="DM_CONV_INT 0.1", default_r_val=0.1_dp)
    6237        8408 :       CALL section_add_keyword(section, keyword)
    6238        8408 :       CALL keyword_release(keyword)
    6239             : 
    6240             :       CALL keyword_create(keyword, __LOCATION__, name="READ_DMFET_POT", &
    6241             :                           description="Read the matrix embedding potential "// &
    6242             :                           "(restart) from the cube file.", &
    6243        8408 :                           usage="READ_DMFET_POT .FALSE.", default_l_val=.FALSE.)
    6244        8408 :       CALL section_add_keyword(section, keyword)
    6245        8408 :       CALL keyword_release(keyword)
    6246             : 
    6247             :       CALL keyword_create(keyword, __LOCATION__, name="DMFET_RESTART_FILE_NAME", &
    6248             :                           description="Root of the file name where to read the matrix "// &
    6249             :                           "potential guess.", &
    6250             :                           usage="DMFET_RESTART_FILE_NAME <FILENAME>", &
    6251        8408 :                           type_of_var=lchar_t)
    6252        8408 :       CALL section_add_keyword(section, keyword)
    6253        8408 :       CALL keyword_release(keyword)
    6254             : 
    6255        8408 :    END SUBROUTINE create_optimize_dmfet
    6256             : 
    6257             : ! **************************************************************************************************
    6258             : !> \brief ...
    6259             : !> \param section ...
    6260             : ! **************************************************************************************************
    6261        8408 :    SUBROUTINE create_print_embed_diff(section)
    6262             :       TYPE(section_type), POINTER                        :: section
    6263             : 
    6264             :       TYPE(keyword_type), POINTER                        :: keyword
    6265             :       TYPE(section_type), POINTER                        :: print_key
    6266             : 
    6267        8408 :       NULLIFY (print_key, keyword)
    6268             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "EMBED_DENS_DIFF", &
    6269             :                                        description="Controls the printing of cube files with "// &
    6270             :                                        "embedding densisty differences", &
    6271        8408 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
    6272             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    6273             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    6274             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    6275             :                           " 1 number valid for all components.", &
    6276        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    6277        8408 :       CALL section_add_keyword(print_key, keyword)
    6278        8408 :       CALL keyword_release(keyword)
    6279             : 
    6280        8408 :       CALL section_add_subsection(section, print_key)
    6281        8408 :       CALL section_release(print_key)
    6282             : 
    6283        8408 :    END SUBROUTINE create_print_embed_diff
    6284             : 
    6285             : ! **************************************************************************************************
    6286             : !> \brief ...
    6287             : !> \param section ...
    6288             : ! **************************************************************************************************
    6289        8408 :    SUBROUTINE create_print_embed_pot_cube(section)
    6290             :       TYPE(section_type), POINTER                        :: section
    6291             : 
    6292             :       TYPE(keyword_type), POINTER                        :: keyword
    6293             :       TYPE(section_type), POINTER                        :: print_key
    6294             : 
    6295        8408 :       NULLIFY (print_key, keyword)
    6296             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "EMBED_POT_CUBE", &
    6297             :                                        description="Controls the printing of cube files with "// &
    6298             :                                        "with embedding potential", &
    6299        8408 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
    6300             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    6301             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    6302             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    6303             :                           " 1 number valid for all components.", &
    6304        8408 :                           usage="STRIDE 1 1 1", n_var=-1, default_i_vals=(/1, 1, 1/), type_of_var=integer_t)
    6305        8408 :       CALL section_add_keyword(print_key, keyword)
    6306        8408 :       CALL keyword_release(keyword)
    6307             : 
    6308        8408 :       CALL section_add_subsection(section, print_key)
    6309        8408 :       CALL section_release(print_key)
    6310             : 
    6311        8408 :    END SUBROUTINE create_print_embed_pot_cube
    6312             : 
    6313             : ! **************************************************************************************************
    6314             : !> \brief ...
    6315             : !> \param section ...
    6316             : ! **************************************************************************************************
    6317        8408 :    SUBROUTINE create_print_embed_restart_vec(section)
    6318             :       TYPE(section_type), POINTER                        :: section
    6319             : 
    6320             :       TYPE(section_type), POINTER                        :: print_key
    6321             : 
    6322        8408 :       NULLIFY (print_key)
    6323             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "EMBED_POT_VECTOR", &
    6324             :                                        description="Controls the printing of cube files with "// &
    6325             :                                        "with embedding potential", &
    6326        8408 :                                        print_level=silent_print_level, add_last=add_last_numeric, filename="")
    6327        8408 :       CALL section_add_subsection(section, print_key)
    6328        8408 :       CALL section_release(print_key)
    6329             : 
    6330        8408 :    END SUBROUTINE create_print_embed_restart_vec
    6331             : 
    6332             : ! **************************************************************************************************
    6333             : !> \brief ...
    6334             : !> \param section ...
    6335             : ! **************************************************************************************************
    6336        8408 :    SUBROUTINE create_print_simple_grid(section)
    6337             :       TYPE(section_type), POINTER                        :: section
    6338             : 
    6339             :       TYPE(keyword_type), POINTER                        :: keyword
    6340             :       TYPE(section_type), POINTER                        :: print_key
    6341             : 
    6342        8408 :       NULLIFY (print_key, keyword)
    6343             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "WRITE_SIMPLE_GRID", &
    6344             :                                        description="Controls the printing of simple grid "// &
    6345             :                                        "files with embedding potential: X Y Z value", &
    6346        8408 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
    6347             : 
    6348             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    6349             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    6350             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    6351             :                           " 1 number valid for all components.", &
    6352        8408 :                           usage="STRIDE 1 1 1", n_var=-1, default_i_vals=(/1, 1, 1/), type_of_var=integer_t)
    6353        8408 :       CALL section_add_keyword(print_key, keyword)
    6354        8408 :       CALL keyword_release(keyword)
    6355             : 
    6356             :       CALL keyword_create(keyword, __LOCATION__, name="UNITS", &
    6357             :                           description="Units of the volumetric file: Angstrom or Bohr.", &
    6358             :                           usage="UNITS BOHR", &
    6359             :                           default_i_val=embed_grid_bohr, &
    6360             :                           enum_c_vals=s2a("BOHR", "ANGSTROM"), &
    6361             :                           enum_desc=s2a("Atomic units: Bohr", "Metric units: Angstrom."), &
    6362        8408 :                           enum_i_vals=(/embed_grid_bohr, embed_grid_angstrom/))
    6363        8408 :       CALL section_add_keyword(print_key, keyword)
    6364        8408 :       CALL keyword_release(keyword)
    6365             : 
    6366             :       CALL keyword_create(keyword, __LOCATION__, name="FOLD_COORD", &
    6367             :                           description="Activates printing folded coordinates corresponding "// &
    6368             :                           "to the simple grid. Used as input for external programs.", &
    6369             :                           usage="FOLD_COORD .TRUE.", n_var=1, type_of_var=logical_t, &
    6370        8408 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    6371        8408 :       CALL section_add_keyword(print_key, keyword)
    6372             : 
    6373        8408 :       CALL keyword_release(keyword)
    6374        8408 :       CALL section_add_subsection(section, print_key)
    6375        8408 :       CALL section_release(print_key)
    6376             : 
    6377        8408 :    END SUBROUTINE create_print_simple_grid
    6378             : 
    6379             : ! **************************************************************************************************
    6380             : !> \brief input section for optional parameters for RIGPW
    6381             : !> \param section the section to create
    6382             : !> \author JGH [06.2017]
    6383             : ! **************************************************************************************************
    6384           0 :    SUBROUTINE create_rigpw_section(section)
    6385             :       TYPE(section_type), POINTER                        :: section
    6386             : 
    6387           0 :       CPASSERT(.NOT. ASSOCIATED(section))
    6388             :       CALL section_create(section, __LOCATION__, name="RIGPW", &
    6389             :                           description="This section specifies optional parameters for RIGPW.", &
    6390           0 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    6391             : 
    6392             : !     CALL keyword_create(keyword, __LOCATION__, name="RI_OVERLAP_MATRIX", &
    6393             : !                         description="Specifies whether to calculate the inverse or the "// &
    6394             : !                         "pseudoinverse of the overlap matrix of the auxiliary "// &
    6395             : !                         "basis set. Calculating the pseudoinverse is necessary "// &
    6396             : !                         "for very large auxiliary basis sets, but more expensive. "// &
    6397             : !                         "Using the pseudoinverse, consistent forces are not "// &
    6398             : !                         "guaranteed yet.", &
    6399             : !                         usage="RI_OVERLAP_MATRIX INVERSE", &
    6400             : !                         enum_c_vals=s2a("INVERSE", "PSEUDO_INVERSE_SVD", "PSEUDO_INVERSE_DIAG", &
    6401             : !                                         "AUTOSELECT"), &
    6402             : !                         enum_desc=s2a("Calculate inverse of the overlap matrix.", &
    6403             : !                                       "Calculate the pseuodinverse of the overlap matrix "// &
    6404             : !                                       "using singular value decomposition.", &
    6405             : !                                       "Calculate the pseudoinverse of the overlap matrix "// &
    6406             : !                                       "by prior diagonalization.", &
    6407             : !                                       "Choose automatically for each pair whether to "// &
    6408             : !                                       "calculate the inverse or pseudoinverse based on the "// &
    6409             : !                                       "condition number of the overlap matrix for each pair. "// &
    6410             : !                                       "Calculating the pseudoinverse is much more expensive."), &
    6411             : !                         enum_i_vals=(/do_lri_inv, do_lri_pseudoinv_svd, &
    6412             : !                                       do_lri_pseudoinv_diag, do_lri_inv_auto/), &
    6413             : !                         default_i_val=do_lri_inv)
    6414             : !     CALL section_add_keyword(section, keyword)
    6415             : !     CALL keyword_release(keyword)
    6416             : 
    6417           0 :    END SUBROUTINE create_rigpw_section
    6418             : 
    6419             : ! **************************************************************************************************
    6420             : !> \brief input section for constraints for auxiliary basis set optimization
    6421             : !> \param section the section to create
    6422             : !> \author Dorothea Golze [11.2014]
    6423             : ! **************************************************************************************************
    6424        8408 :    SUBROUTINE create_constrain_exponents_section(section)
    6425             :       TYPE(section_type), POINTER                        :: section
    6426             : 
    6427             :       TYPE(keyword_type), POINTER                        :: keyword
    6428             : 
    6429             :       CALL section_create(section, __LOCATION__, name="CONSTRAIN_EXPONENTS", &
    6430             :                           description="specifies constraints for the exponents of the "// &
    6431             :                           "lri auxiliary basis sets in the optimization.", &
    6432        8408 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    6433             : 
    6434        8408 :       NULLIFY (keyword)
    6435             : 
    6436             :       CALL keyword_create(keyword, __LOCATION__, name="SCALE", &
    6437             :                           description="Defines the upper and lower boundaries as "// &
    6438             :                           "(1+scale)*exp and (1-scale)*exp. Fermi-like constraint "// &
    6439             :                           "function", &
    6440        8408 :                           usage="SCALE 0.3", default_r_val=0.3_dp)
    6441        8408 :       CALL section_add_keyword(section, keyword)
    6442        8408 :       CALL keyword_release(keyword)
    6443             : 
    6444             :       CALL keyword_create(keyword, __LOCATION__, name="FERMI_EXP", &
    6445             :                           description="Exponent in the fermi-like constraint function. ", &
    6446        8408 :                           usage="FERMI_EXP 2.63", default_r_val=2.63391_dp)
    6447        8408 :       CALL section_add_keyword(section, keyword)
    6448        8408 :       CALL keyword_release(keyword)
    6449             : 
    6450        8408 :    END SUBROUTINE create_constrain_exponents_section
    6451             : 
    6452             : ! **************************************************************************************************
    6453             : !> \brief creates the multigrid
    6454             : !> \param section             input section to create
    6455             : !> \param create_subsections  indicates whether or not subsections INTERPOLATOR and RS_GRID
    6456             : !>                            should be created
    6457             : !> \author fawzi
    6458             : ! **************************************************************************************************
    6459       16800 :    SUBROUTINE create_mgrid_section(section, create_subsections)
    6460             :       TYPE(section_type), POINTER                        :: section
    6461             :       LOGICAL, INTENT(in)                                :: create_subsections
    6462             : 
    6463             :       TYPE(keyword_type), POINTER                        :: keyword
    6464             :       TYPE(section_type), POINTER                        :: subsection
    6465             : 
    6466       16800 :       CPASSERT(.NOT. ASSOCIATED(section))
    6467             :       CALL section_create(section, __LOCATION__, name="mgrid", &
    6468             :                           description="multigrid information", &
    6469       16800 :                           n_keywords=5, n_subsections=1, repeats=.FALSE.)
    6470       16800 :       NULLIFY (keyword)
    6471             :       CALL keyword_create(keyword, __LOCATION__, name="NGRIDS", &
    6472             :                           description="The number of multigrids to use", &
    6473       16800 :                           usage="ngrids 1", default_i_val=4)
    6474       16800 :       CALL section_add_keyword(section, keyword)
    6475       16800 :       CALL keyword_release(keyword)
    6476             : 
    6477             :       CALL keyword_create(keyword, __LOCATION__, name="cutoff", &
    6478             :                           description="The cutoff of the finest grid level. Default value for "// &
    6479             :                           "SE or DFTB calculation is 1.0 [Ry].", &
    6480             :                           usage="cutoff 300", default_r_val=cp_unit_to_cp2k(value=280.0_dp, &
    6481       16800 :                                                                             unit_str="Ry"), n_var=1, unit_str="Ry")
    6482       16800 :       CALL section_add_keyword(section, keyword)
    6483       16800 :       CALL keyword_release(keyword)
    6484             : 
    6485             :       CALL keyword_create(keyword, __LOCATION__, name="progression_factor", &
    6486             :                           description="Factor used to find the cutoff of the multigrids that"// &
    6487             :                           " where not given explicitly", &
    6488       16800 :                           usage="progression_factor <integer>", default_r_val=3._dp)
    6489       16800 :       CALL section_add_keyword(section, keyword)
    6490       16800 :       CALL keyword_release(keyword)
    6491             : 
    6492             :       CALL keyword_create(keyword, __LOCATION__, name="commensurate", &
    6493             :                           description="If the grids should be commensurate. If true overrides "// &
    6494             :                           "the progression factor and the cutoffs of the sub grids", &
    6495             :                           usage="commensurate", default_l_val=.FALSE., &
    6496       16800 :                           lone_keyword_l_val=.TRUE.)
    6497       16800 :       CALL section_add_keyword(section, keyword)
    6498       16800 :       CALL keyword_release(keyword)
    6499             : 
    6500             :       CALL keyword_create(keyword, __LOCATION__, name="realspace", &
    6501             :                           description="If both rho and rho_gspace are needed ", &
    6502             :                           usage="realspace", default_l_val=.FALSE., &
    6503       16800 :                           lone_keyword_l_val=.TRUE.)
    6504       16800 :       CALL section_add_keyword(section, keyword)
    6505       16800 :       CALL keyword_release(keyword)
    6506             : 
    6507             :       CALL keyword_create(keyword, __LOCATION__, name="REL_CUTOFF", &
    6508             :                           variants=(/"RELATIVE_CUTOFF"/), &
    6509             :                           description="Determines the grid at which a Gaussian is mapped,"// &
    6510             :                           " giving the cutoff used for a gaussian with alpha=1."// &
    6511             :                           " A value 50+-10Ry might be required for highly accurate results,"// &
    6512             :                           " Or for simulations with a variable cell."// &
    6513             :                           " Versions prior to 2.3 used a default of 30Ry.", &
    6514             :                           usage="RELATIVE_CUTOFF real", default_r_val=20.0_dp, &
    6515       33600 :                           unit_str="Ry")
    6516       16800 :       CALL section_add_keyword(section, keyword)
    6517       16800 :       CALL keyword_release(keyword)
    6518             : 
    6519             :       CALL keyword_create(keyword, __LOCATION__, name="MULTIGRID_SET", &
    6520             :                           description="Activate a manual setting of the multigrids", &
    6521       16800 :                           usage="MULTIGRID_SET", default_l_val=.FALSE.)
    6522       16800 :       CALL section_add_keyword(section, keyword)
    6523       16800 :       CALL keyword_release(keyword)
    6524             : 
    6525             :       CALL keyword_create(keyword, __LOCATION__, &
    6526             :                           name="SKIP_LOAD_BALANCE_DISTRIBUTED", &
    6527             :                           description="Skips load balancing on distributed multigrids.  "// &
    6528             :                           "Memory usage is O(p) so may be used "// &
    6529             :                           "for all but the very largest runs.", &
    6530             :                           usage="SKIP_LOAD_BALANCE_DISTRIBUTED", &
    6531             :                           default_l_val=.FALSE., &
    6532       16800 :                           lone_keyword_l_val=.TRUE.)
    6533             : !    CALL keyword_create(keyword, __LOCATION__, name="SKIP_LOAD_BALANCE_DISTRIBUTED",&
    6534             : !         description="Skip load balancing on distributed multigrids, which might be memory intensive."//&
    6535             : !                     "If not explicitly specified, runs using more than 1024 MPI tasks will default to .TRUE.",&
    6536             : !         usage="SKIP_LOAD_BALANCE_DISTRIBUTED", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    6537             : 
    6538       16800 :       CALL section_add_keyword(section, keyword)
    6539       16800 :       CALL keyword_release(keyword)
    6540             : 
    6541             :       CALL keyword_create(keyword, __LOCATION__, name="MULTIGRID_CUTOFF", &
    6542             :                           variants=(/"CUTOFF_LIST"/), &
    6543             :                           description="List of cutoff values to set up multigrids manually", &
    6544             :                           usage="MULTIGRID_CUTOFF 200.0 100.0 ", &
    6545             :                           n_var=-1, &
    6546             :                           type_of_var=real_t, &
    6547       33600 :                           unit_str="Ry")
    6548       16800 :       CALL section_add_keyword(section, keyword)
    6549       16800 :       CALL keyword_release(keyword)
    6550             : 
    6551       16800 :       IF (create_subsections) THEN
    6552        8408 :          NULLIFY (subsection)
    6553        8408 :          CALL create_rsgrid_section(subsection)
    6554        8408 :          CALL section_add_subsection(section, subsection)
    6555        8408 :          CALL section_release(subsection)
    6556             : 
    6557        8408 :          NULLIFY (subsection)
    6558        8408 :          CALL create_interp_section(subsection)
    6559        8408 :          CALL section_add_subsection(section, subsection)
    6560        8408 :          CALL section_release(subsection)
    6561             :       END IF
    6562       16800 :    END SUBROUTINE create_mgrid_section
    6563             : 
    6564             : ! **************************************************************************************************
    6565             : !> \brief creates the interpolation section
    6566             : !> \param section ...
    6567             : !> \author tlaino
    6568             : ! **************************************************************************************************
    6569       67152 :    SUBROUTINE create_interp_section(section)
    6570             :       TYPE(section_type), POINTER                        :: section
    6571             : 
    6572             :       TYPE(keyword_type), POINTER                        :: keyword
    6573             :       TYPE(section_type), POINTER                        :: print_key
    6574             : 
    6575       67152 :       CPASSERT(.NOT. ASSOCIATED(section))
    6576             :       CALL section_create(section, __LOCATION__, name="interpolator", &
    6577             :                           description="kind of interpolation used between the multigrids", &
    6578       67152 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
    6579             : 
    6580       67152 :       NULLIFY (keyword, print_key)
    6581             : 
    6582             :       CALL keyword_create(keyword, __LOCATION__, name="kind", &
    6583             :                           description="the interpolator to use", &
    6584             :                           usage="kind spline3", &
    6585             :                           default_i_val=pw_interp, &
    6586             :                           enum_c_vals=s2a("pw", "spline3_nopbc", "spline3"), &
    6587             :                           enum_i_vals=(/pw_interp, &
    6588       67152 :                                         spline3_nopbc_interp, spline3_pbc_interp/))
    6589       67152 :       CALL section_add_keyword(section, keyword)
    6590       67152 :       CALL keyword_release(keyword)
    6591             : 
    6592             :       CALL keyword_create(keyword, __LOCATION__, name="safe_computation", &
    6593             :                           description="if a non unrolled calculation is to be performed in parallel", &
    6594             :                           usage="safe_computation OFF", &
    6595             :                           default_l_val=.FALSE., &
    6596       67152 :                           lone_keyword_l_val=.TRUE.)
    6597       67152 :       CALL section_add_keyword(section, keyword)
    6598       67152 :       CALL keyword_release(keyword)
    6599             : 
    6600             :       CALL keyword_create(keyword, __LOCATION__, name="aint_precond", &
    6601             :                           description="the approximate inverse to use to get the starting point"// &
    6602             :                           " for the linear solver of the spline3 methods", &
    6603             :                           usage="aint_precond copy", &
    6604             :                           default_i_val=precond_spl3_aint, &
    6605             :                           enum_c_vals=s2a("copy", "spl3_nopbc_aint1", "spl3_nopbc_aint2", &
    6606             :                                           "spl3_nopbc_precond1", "spl3_nopbc_precond2", "spl3_nopbc_precond3"), &
    6607             :                           enum_i_vals=(/no_precond, precond_spl3_aint, precond_spl3_aint2, &
    6608       67152 :                                         precond_spl3_1, precond_spl3_2, precond_spl3_3/))
    6609       67152 :       CALL section_add_keyword(section, keyword)
    6610       67152 :       CALL keyword_release(keyword)
    6611             : 
    6612             :       CALL keyword_create(keyword, __LOCATION__, name="precond", &
    6613             :                           description="The preconditioner used"// &
    6614             :                           " for the linear solver of the spline3 methods", &
    6615             :                           usage="PRECOND copy", &
    6616             :                           default_i_val=precond_spl3_3, &
    6617             :                           enum_c_vals=s2a("copy", "spl3_nopbc_aint1", "spl3_nopbc_aint2", &
    6618             :                                           "spl3_nopbc_precond1", "spl3_nopbc_precond2", "spl3_nopbc_precond3"), &
    6619             :                           enum_i_vals=(/no_precond, precond_spl3_aint, precond_spl3_aint2, &
    6620       67152 :                                         precond_spl3_1, precond_spl3_2, precond_spl3_3/))
    6621       67152 :       CALL section_add_keyword(section, keyword)
    6622       67152 :       CALL keyword_release(keyword)
    6623             : 
    6624             :       CALL keyword_create(keyword, __LOCATION__, name="eps_x", &
    6625             :                           description="accuracy on the solution for spline3 the interpolators", &
    6626       67152 :                           usage="eps_x 1.e-15", default_r_val=1.e-10_dp)
    6627       67152 :       CALL section_add_keyword(section, keyword)
    6628       67152 :       CALL keyword_release(keyword)
    6629             : 
    6630             :       CALL keyword_create(keyword, __LOCATION__, name="eps_r", &
    6631             :                           description="accuracy on the residual for spline3 the interpolators", &
    6632       67152 :                           usage="eps_r 1.e-15", default_r_val=1.e-10_dp)
    6633       67152 :       CALL section_add_keyword(section, keyword)
    6634       67152 :       CALL keyword_release(keyword)
    6635             : 
    6636             :       CALL keyword_create(keyword, __LOCATION__, name="max_iter", &
    6637             :                           variants=(/'maxiter'/), &
    6638             :                           description="the maximum number of iterations", &
    6639      134304 :                           usage="max_iter 200", default_i_val=100)
    6640       67152 :       CALL section_add_keyword(section, keyword)
    6641       67152 :       CALL keyword_release(keyword)
    6642             : 
    6643       67152 :       NULLIFY (print_key)
    6644             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "conv_info", &
    6645             :                                        description="if convergence information about the linear solver"// &
    6646             :                                        " of the spline methods should be printed", &
    6647             :                                        print_level=medium_print_level, each_iter_names=s2a("SPLINE_FIND_COEFFS"), &
    6648             :                                        each_iter_values=(/10/), filename="__STD_OUT__", &
    6649       67152 :                                        add_last=add_last_numeric)
    6650       67152 :       CALL section_add_subsection(section, print_key)
    6651       67152 :       CALL section_release(print_key)
    6652             : 
    6653       67152 :    END SUBROUTINE create_interp_section
    6654             : 
    6655             : ! **************************************************************************************************
    6656             : !> \brief creates the sic (self interaction correction) section
    6657             : !> \param section ...
    6658             : !> \author fawzi
    6659             : ! **************************************************************************************************
    6660       16816 :    SUBROUTINE create_sic_section(section)
    6661             :       TYPE(section_type), POINTER                        :: section
    6662             : 
    6663             :       TYPE(keyword_type), POINTER                        :: keyword
    6664             : 
    6665       16816 :       CPASSERT(.NOT. ASSOCIATED(section))
    6666             :       CALL section_create(section, __LOCATION__, name="sic", &
    6667             :                           description="parameters for the self interaction correction", &
    6668             :                           n_keywords=6, n_subsections=0, repeats=.FALSE., &
    6669       67264 :                           citations=(/VandeVondele2005b, Perdew1981, Avezac2005/))
    6670             : 
    6671       16816 :       NULLIFY (keyword)
    6672             : 
    6673             :       CALL keyword_create(keyword, __LOCATION__, name="SIC_SCALING_A", &
    6674             :                           description="Scaling of the coulomb term in sic [experimental]", &
    6675             :                           usage="SIC_SCALING_A 0.5", &
    6676             :                           citations=(/VandeVondele2005b/), &
    6677       33632 :                           default_r_val=1.0_dp)
    6678       16816 :       CALL section_add_keyword(section, keyword)
    6679       16816 :       CALL keyword_release(keyword)
    6680             : 
    6681             :       CALL keyword_create(keyword, __LOCATION__, name="SIC_SCALING_B", &
    6682             :                           description="Scaling of the xc term in sic [experimental]", &
    6683             :                           usage="SIC_SCALING_B 0.5", &
    6684             :                           citations=(/VandeVondele2005b/), &
    6685       33632 :                           default_r_val=1.0_dp)
    6686       16816 :       CALL section_add_keyword(section, keyword)
    6687       16816 :       CALL keyword_release(keyword)
    6688             : 
    6689             :       CALL keyword_create(keyword, __LOCATION__, name="SIC_METHOD", &
    6690             :                           description="Method used to remove the self interaction", &
    6691             :                           usage="SIC_METHOD MAURI_US", &
    6692             :                           default_i_val=sic_none, &
    6693             :                           enum_c_vals=s2a("NONE", "MAURI_US", "MAURI_SPZ", "AD", "EXPLICIT_ORBITALS"), &
    6694             :                           enum_i_vals=(/sic_none, sic_mauri_us, sic_mauri_spz, sic_ad, sic_eo/), &
    6695             :                           enum_desc=s2a("Do not apply a sic correction", &
    6696             :                                         "Employ a (scaled) correction proposed by Mauri and co-workers"// &
    6697             :                                         " on the spin density / doublet unpaired orbital", &
    6698             :                                         "Employ a (scaled) Perdew-Zunger expression"// &
    6699             :                                         " on the spin density / doublet unpaired orbital", &
    6700             :                                         "The average density correction", &
    6701             :                                         "(scaled) Perdew-Zunger correction explicitly on a set of orbitals."), &
    6702       67264 :                           citations=(/VandeVondele2005b, Perdew1981, Avezac2005/))
    6703       16816 :       CALL section_add_keyword(section, keyword)
    6704       16816 :       CALL keyword_release(keyword)
    6705             : 
    6706             :       CALL keyword_create(keyword, __LOCATION__, name="ORBITAL_SET", &
    6707             :                           description="Type of orbitals treated with the SIC", &
    6708             :                           usage="ORBITAL_SET ALL", &
    6709             :                           default_i_val=sic_list_unpaired, &
    6710             :                           enum_c_vals=s2a("UNPAIRED", "ALL"), &
    6711             :                           enum_desc=s2a("correction for the unpaired orbitals only, requires a restricted open shell calculation", &
    6712             :                                         "correction for all orbitals, requires a LSD or ROKS calculation"), &
    6713       16816 :                           enum_i_vals=(/sic_list_unpaired, sic_list_all/))
    6714       16816 :       CALL section_add_keyword(section, keyword)
    6715       16816 :       CALL keyword_release(keyword)
    6716             : 
    6717       16816 :    END SUBROUTINE create_sic_section
    6718             : 
    6719             : ! **************************************************************************************************
    6720             : !> \brief creates the low spin roks section
    6721             : !> \param section ...
    6722             : !> \author Joost VandeVondele
    6723             : ! **************************************************************************************************
    6724        8408 :    SUBROUTINE create_low_spin_roks_section(section)
    6725             :       TYPE(section_type), POINTER                        :: section
    6726             : 
    6727             :       TYPE(keyword_type), POINTER                        :: keyword
    6728             : 
    6729        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    6730             :       CALL section_create(section, __LOCATION__, name="LOW_SPIN_ROKS", &
    6731             :                           description="Specify the details of the low spin ROKS method. "// &
    6732             :                           "In particular, one can specify various terms added to the energy of the high spin roks configuration"// &
    6733             :                           " with a energy scaling factor, and a prescription of the spin state.", &
    6734        8408 :                           n_keywords=6, n_subsections=0, repeats=.FALSE.)
    6735             : 
    6736        8408 :       NULLIFY (keyword)
    6737             :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_SCALING", &
    6738             :                           description="The scaling factors for each term added to the total energy. "// &
    6739             :                           "This list should contain one number for each term added to the total energy.", &
    6740             :                           usage="ENERGY_SCALING 1.0 -1.0 ", &
    6741        8408 :                           n_var=-1, type_of_var=real_t, repeats=.FALSE.)
    6742        8408 :       CALL section_add_keyword(section, keyword)
    6743        8408 :       CALL keyword_release(keyword)
    6744             :       CALL keyword_create( &
    6745             :          keyword, __LOCATION__, name="SPIN_CONFIGURATION", &
    6746             :          description="For each singly occupied orbital, specify if this should be an alpha (=1) or a beta (=2) orbital. "// &
    6747             :          "This keyword should be repeated, each repetition corresponding to an additional term.", &
    6748             :          usage="SPIN_CONFIGURATION 1 2", &
    6749        8408 :          n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    6750        8408 :       CALL section_add_keyword(section, keyword)
    6751        8408 :       CALL keyword_release(keyword)
    6752             : 
    6753        8408 :    END SUBROUTINE create_low_spin_roks_section
    6754             : 
    6755             : ! **************************************************************************************************
    6756             : !> \brief makes the orbital transformation section
    6757             : !> \param section ...
    6758             : !> \par History
    6759             : !>      11.2004 created [Joost VandeVondele]
    6760             : ! **************************************************************************************************
    6761       39184 :    SUBROUTINE create_ot_section(section)
    6762             :       TYPE(section_type), POINTER                        :: section
    6763             : 
    6764             :       TYPE(keyword_type), POINTER                        :: keyword
    6765             : 
    6766       39184 :       CPASSERT(.NOT. ASSOCIATED(section))
    6767             :       CALL section_create(section, __LOCATION__, name="OT", &
    6768             :                           description="Sets the various options for the orbital transformation (OT) method. "// &
    6769             :                           "Default settings already provide an efficient, yet robust method. "// &
    6770             :                           "Most systems benefit from using the FULL_ALL preconditioner "// &
    6771             :                           "combined with a small value (0.001) of ENERGY_GAP. "// &
    6772             :                           "Well-behaved systems might benefit from using a DIIS minimizer. "//newline//newline// &
    6773             :                           "**Advantages:** "// &
    6774             :                           "It's fast, because no expensive diagonalisation is performed. "// &
    6775             :                           "If preconditioned correctly, method guaranteed to find minimum. "//newline//newline// &
    6776             :                           "**Disadvantages:** "// &
    6777             :                           "Sensitive to preconditioning. A good preconditioner can be expensive. "// &
    6778             :                           "No smearing, or advanced SCF mixing possible: POOR convergence for metallic systems.", &
    6779             :                           n_keywords=27, n_subsections=0, repeats=.FALSE., &
    6780      117552 :                           citations=(/VandeVondele2003, Weber2008/))
    6781             : 
    6782       39184 :       NULLIFY (keyword)
    6783             : 
    6784             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    6785             :                           description="controls the activation of the ot method", &
    6786             :                           usage="&OT T", &
    6787             :                           default_l_val=.FALSE., &
    6788       39184 :                           lone_keyword_l_val=.TRUE.)
    6789       39184 :       CALL section_add_keyword(section, keyword)
    6790       39184 :       CALL keyword_release(keyword)
    6791             : 
    6792             :       CALL keyword_create(keyword, __LOCATION__, name="ALGORITHM", &
    6793             :                           description="Algorithm to be used for OT", &
    6794             :                           usage="ALGORITHM STRICT", &
    6795             :                           default_i_val=ot_algo_taylor_or_diag, &
    6796             :                           enum_c_vals=s2a("STRICT", "IRAC"), &
    6797             :                           enum_desc=s2a("Strict orthogonality: Taylor or diagonalization based algorithm.", &
    6798             :                                         "Orbital Transformation based Iterative Refinement "// &
    6799             :                                         "of the Approximative Congruence transformation (OT/IR)."), &
    6800             :                           enum_i_vals=(/ot_algo_taylor_or_diag, ot_algo_irac/), &
    6801      156736 :                           citations=(/VandeVondele2003, VandeVondele2005a, Weber2008/))
    6802       39184 :       CALL section_add_keyword(section, keyword)
    6803       39184 :       CALL keyword_release(keyword)
    6804             : 
    6805             :       CALL keyword_create(keyword, __LOCATION__, name="IRAC_DEGREE", &
    6806             :                           description="The refinement polynomial degree (2, 3 or 4).", &
    6807             :                           usage="IRAC_DEGREE 4", &
    6808       39184 :                           default_i_val=4)
    6809       39184 :       CALL section_add_keyword(section, keyword)
    6810       39184 :       CALL keyword_release(keyword)
    6811             : 
    6812             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_IRAC", &
    6813             :                           description="Maximum allowed refinement iteration.", &
    6814             :                           usage="MAX_IRAC 5", &
    6815       39184 :                           default_i_val=50)
    6816       39184 :       CALL section_add_keyword(section, keyword)
    6817       39184 :       CALL keyword_release(keyword)
    6818             : 
    6819             :       CALL keyword_create(keyword, __LOCATION__, name="ORTHO_IRAC", &
    6820             :                           description="The orthogonality method.", &
    6821             :                           usage="ORTHO_IRAC POLY", &
    6822             :                           default_i_val=ot_chol_irac, &
    6823             :                           enum_c_vals=s2a("CHOL", "POLY", "LWDN"), &
    6824             :                           enum_desc=s2a("Cholesky.", "Polynomial.", "Loewdin."), &
    6825       39184 :                           enum_i_vals=(/ot_chol_irac, ot_poly_irac, ot_lwdn_irac/))
    6826       39184 :       CALL section_add_keyword(section, keyword)
    6827       39184 :       CALL keyword_release(keyword)
    6828             : 
    6829             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_IRAC_FILTER_MATRIX", &
    6830             :                           description="Sets the threshold for filtering the matrices.", &
    6831             :                           usage="EPS_IRAC_FILTER_MATRIX 1.0E-5", &
    6832       39184 :                           default_r_val=0.0_dp)
    6833       39184 :       CALL section_add_keyword(section, keyword)
    6834       39184 :       CALL keyword_release(keyword)
    6835             : 
    6836             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_IRAC", &
    6837             :                           description="Targeted accuracy during the refinement iteration.", &
    6838             :                           usage="EPS_IRAC 1.0E-5", &
    6839       39184 :                           default_r_val=1.0E-10_dp)
    6840       39184 :       CALL section_add_keyword(section, keyword)
    6841       39184 :       CALL keyword_release(keyword)
    6842             : 
    6843             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_IRAC_QUICK_EXIT", &
    6844             :                           description="Only one extra refinement iteration is "// &
    6845             :                           "done when the norm is below this value.", &
    6846             :                           usage="EPS_IRAC_QUICK_EXIT 1.0E-2", &
    6847       39184 :                           default_r_val=1.0E-5_dp)
    6848       39184 :       CALL section_add_keyword(section, keyword)
    6849       39184 :       CALL keyword_release(keyword)
    6850             : 
    6851             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_IRAC_SWITCH", &
    6852             :                           description="The algorithm switches to the polynomial "// &
    6853             :                           "refinement when the norm is below this value.", &
    6854             :                           usage="EPS_IRAC_SWITCH 1.0E-3", &
    6855       39184 :                           default_r_val=1.0E-2_dp)
    6856       39184 :       CALL section_add_keyword(section, keyword)
    6857       39184 :       CALL keyword_release(keyword)
    6858             : 
    6859             :       CALL keyword_create(keyword, __LOCATION__, name="ON_THE_FLY_LOC", &
    6860             :                           description="On the fly localization of the molecular orbitals. "// &
    6861             :                           "Can only be used with OT/IRAC.", &
    6862             :                           usage="ON_THE_FLY_LOC T", &
    6863       39184 :                           default_l_val=.FALSE.)
    6864       39184 :       CALL section_add_keyword(section, keyword)
    6865       39184 :       CALL keyword_release(keyword)
    6866             : 
    6867             :       CALL keyword_create( &
    6868             :          keyword, __LOCATION__, name="MINIMIZER", &
    6869             :          description="Minimizer to be used with the OT method", &
    6870             :          usage="MINIMIZER DIIS", &
    6871             :          default_i_val=ot_mini_cg, &
    6872             :          enum_c_vals=s2a("SD", "CG", "DIIS", "BROYDEN"), &
    6873             :          enum_desc=s2a("Steepest descent: not recommended", "Conjugate Gradients: most reliable, use for difficult systems."// &
    6874             :                        " The total energy should decrease at every OT CG step if the line search is appropriate.", &
    6875             :                        "Direct inversion in the iterative subspace: less reliable than CG, but sometimes about 50% faster", &
    6876             :                        "Broyden mixing approximating the inverse Hessian"), &
    6877       39184 :          enum_i_vals=(/ot_mini_sd, ot_mini_cg, ot_mini_diis, ot_mini_broyden/))
    6878       39184 :       CALL section_add_keyword(section, keyword)
    6879       39184 :       CALL keyword_release(keyword)
    6880             : 
    6881             :       CALL keyword_create(keyword, __LOCATION__, name="SAFE_DIIS", &
    6882             :                           variants=(/"SAFER_DIIS"/), &
    6883             :                           description="Reject DIIS steps if they point away from the"// &
    6884             :                           " minimum, do SD in that case.", &
    6885       78368 :                           usage="SAFE_DIIS ON", default_l_val=.TRUE.)
    6886       39184 :       CALL section_add_keyword(section, keyword)
    6887       39184 :       CALL keyword_release(keyword)
    6888             : 
    6889             :       CALL keyword_create(keyword, __LOCATION__, name="N_HISTORY_VEC", &
    6890             :                           variants=s2a("NDIIS", "N_DIIS", "N_BROYDEN"), &
    6891             :                           description="Number of history vectors to be used with DIIS or BROYDEN", &
    6892             :                           usage="N_DIIS 4", &
    6893       39184 :                           default_i_val=7)
    6894       39184 :       CALL section_add_keyword(section, keyword)
    6895       39184 :       CALL keyword_release(keyword)
    6896             : 
    6897             :       CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_BETA", &
    6898             :                           description="Underrelaxation for the broyden mixer", &
    6899             :                           usage="BROYDEN_BETA 0.9", &
    6900       39184 :                           default_r_val=0.9_dp)
    6901       39184 :       CALL section_add_keyword(section, keyword)
    6902       39184 :       CALL keyword_release(keyword)
    6903             : 
    6904             :       CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_GAMMA", &
    6905             :                           description="Backtracking parameter", &
    6906             :                           usage="BROYDEN_GAMMA 0.5", &
    6907       39184 :                           default_r_val=0.5_dp)
    6908       39184 :       CALL section_add_keyword(section, keyword)
    6909       39184 :       CALL keyword_release(keyword)
    6910             : 
    6911             :       CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_SIGMA", &
    6912             :                           description="Curvature of energy functional.", &
    6913             :                           usage="BROYDEN_SIGMA 0.25", &
    6914       39184 :                           default_r_val=0.25_dp)
    6915       39184 :       CALL section_add_keyword(section, keyword)
    6916       39184 :       CALL keyword_release(keyword)
    6917             : 
    6918             :       CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_ETA", &
    6919             :                           description="Dampening of estimated energy curvature.", &
    6920             :                           usage="BROYDEN_ETA 0.7", &
    6921       39184 :                           default_r_val=0.7_dp)
    6922       39184 :       CALL section_add_keyword(section, keyword)
    6923       39184 :       CALL keyword_release(keyword)
    6924             : 
    6925             :       CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_OMEGA", &
    6926             :                           description="Growth limit of curvature.", &
    6927             :                           usage="BROYDEN_OMEGA 1.1", &
    6928       39184 :                           default_r_val=1.1_dp)
    6929       39184 :       CALL section_add_keyword(section, keyword)
    6930       39184 :       CALL keyword_release(keyword)
    6931             : 
    6932             :       CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_SIGMA_DECREASE", &
    6933             :                           description="Reduction of curvature on bad approximation.", &
    6934             :                           usage="BROYDEN_SIGMA_DECREASE 0.7", &
    6935       39184 :                           default_r_val=0.7_dp)
    6936       39184 :       CALL section_add_keyword(section, keyword)
    6937       39184 :       CALL keyword_release(keyword)
    6938             : 
    6939             :       CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_SIGMA_MIN", &
    6940             :                           description="Minimum adaptive curvature.", &
    6941             :                           usage="BROYDEN_SIGMA_MIN 0.05", &
    6942       39184 :                           default_r_val=0.05_dp)
    6943       39184 :       CALL section_add_keyword(section, keyword)
    6944       39184 :       CALL keyword_release(keyword)
    6945             : 
    6946             :       CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_FORGET_HISTORY", &
    6947             :                           description="Forget history on bad approximation", &
    6948             :                           usage="BROYDEN_FORGET_HISTORY OFF", default_l_val=.FALSE., &
    6949       39184 :                           lone_keyword_l_val=.TRUE.)
    6950       39184 :       CALL section_add_keyword(section, keyword)
    6951       39184 :       CALL keyword_release(keyword)
    6952             : 
    6953             :       CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_ADAPTIVE_SIGMA", &
    6954             :                           description="Enable adaptive curvature estimation", &
    6955             :                           usage="BROYDEN_ADAPTIVE_SIGMA ON", default_l_val=.TRUE., &
    6956       39184 :                           lone_keyword_l_val=.TRUE.)
    6957       39184 :       CALL section_add_keyword(section, keyword)
    6958       39184 :       CALL keyword_release(keyword)
    6959             : 
    6960             :       CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_ENABLE_FLIP", &
    6961             :                           description="Ensure positive definite update", &
    6962             :                           usage="BROYDEN_ENABLE_FLIP ON", default_l_val=.TRUE., &
    6963       39184 :                           lone_keyword_l_val=.TRUE.)
    6964       39184 :       CALL section_add_keyword(section, keyword)
    6965       39184 :       CALL keyword_release(keyword)
    6966             : 
    6967             :       CALL keyword_create(keyword, __LOCATION__, name="LINESEARCH", &
    6968             :                           variants=(/"LINE_SEARCH"/), &
    6969             :                           description="1D line search algorithm to be used with the OT minimizer,"// &
    6970             :                           " in increasing order of robustness and cost. MINIMIZER CG combined with"// &
    6971             :                           " LINESEARCH GOLD should always find an electronic minimum."// &
    6972             :                           " Whereas the 2PNT minimizer is almost always OK, 3PNT might be needed for systems"// &
    6973             :                           " in which successive OT CG steps do not decrease the total energy.", &
    6974             :                           usage="LINESEARCH GOLD", &
    6975             :                           default_i_val=ls_2pnt, &
    6976             :                           enum_c_vals=s2a("NONE", "2PNT", "3PNT", "GOLD"), &
    6977             :                           enum_desc=s2a("take fixed length steps", "extrapolate based on 2 points", &
    6978             :                                         "... or on 3 points", "perform 1D golden section search of the minimum (very expensive)"), &
    6979       78368 :                           enum_i_vals=(/ls_none, ls_2pnt, ls_3pnt, ls_gold/))
    6980       39184 :       CALL section_add_keyword(section, keyword)
    6981       39184 :       CALL keyword_release(keyword)
    6982             : 
    6983             :       CALL keyword_create( &
    6984             :          keyword, __LOCATION__, name="STEPSIZE", &
    6985             :          description="Initial stepsize used for the line search, sometimes this parameter can be reduced to stabilize DIIS"// &
    6986             :          " or to improve the CG behavior in the first few steps."// &
    6987             :          " The optimal value depends on the quality of the preconditioner."// &
    6988             :          " A negative values leaves the choice to CP2K depending on the preconditioner.", &
    6989             :          usage="STEPSIZE 0.4", &
    6990       39184 :          default_r_val=-1.0_dp)
    6991       39184 :       CALL section_add_keyword(section, keyword)
    6992       39184 :       CALL keyword_release(keyword)
    6993             : 
    6994             :       CALL keyword_create(keyword, __LOCATION__, name="GOLD_TARGET", &
    6995             :                           description="Target relative uncertainty in the location of the minimum for LINESEARCH GOLD", &
    6996             :                           usage="GOLD_TARGET 0.1", &
    6997       39184 :                           default_r_val=0.01_dp)
    6998       39184 :       CALL section_add_keyword(section, keyword)
    6999       39184 :       CALL keyword_release(keyword)
    7000             : 
    7001             :       CALL keyword_create( &
    7002             :          keyword, __LOCATION__, name="PRECONDITIONER", &
    7003             :          description="Type of preconditioner to be used with all minimization schemes. "// &
    7004             :          "They differ in effectiveness, cost of construction, cost of application. "// &
    7005             :          "Properly preconditioned minimization can be orders of magnitude faster than doing nothing.", &
    7006             :          usage="PRECONDITIONER FULL_ALL", &
    7007             :          default_i_val=ot_precond_full_kinetic, &
    7008             :          enum_c_vals=s2a("FULL_ALL", "FULL_SINGLE_INVERSE", "FULL_SINGLE", "FULL_KINETIC", "FULL_S_INVERSE", &
    7009             :                          "NONE"), &
    7010             :          enum_desc=s2a("Most effective state selective preconditioner based on diagonalization, "// &
    7011             :                        "requires the ENERGY_GAP parameter to be an underestimate of the HOMO-LUMO gap. "// &
    7012             :                        "This preconditioner is recommended for almost all systems, except very large systems where "// &
    7013             :                        "make_preconditioner would dominate the total computational cost.", &
    7014             :                        "Based on H-eS cholesky inversion, similar to FULL_SINGLE in preconditioning efficiency "// &
    7015             :                        "but cheaper to construct, "// &
    7016             :                        "might be somewhat less robust. Recommended for large systems.", &
    7017             :                        "Based on H-eS diagonalisation, not as good as FULL_ALL, but somewhat cheaper to apply. ", &
    7018             :                        "Cholesky inversion of S and T, fast construction, robust, and relatively good, "// &
    7019             :                        "use for very large systems.", &
    7020             :                        "Cholesky inversion of S, not as good as FULL_KINETIC, yet equally expensive.", &
    7021             :                        "skip preconditioning"), &
    7022             :          enum_i_vals=(/ot_precond_full_all, ot_precond_full_single_inverse, ot_precond_full_single, &
    7023             :                        ot_precond_full_kinetic, ot_precond_s_inverse, ot_precond_none/), &
    7024      156736 :          citations=(/VandeVondele2003, Weber2008, Schiffmann2015/))
    7025       39184 :       CALL section_add_keyword(section, keyword)
    7026       39184 :       CALL keyword_release(keyword)
    7027             : 
    7028             :       CALL keyword_create(keyword, __LOCATION__, name="CHOLESKY", &
    7029             :                           description="If FULL_ALL the cholesky decomposition of the S matrix is used. "// &
    7030             :                           "Options on the algorithm to be used.", &
    7031             :                           usage="CHOLESKY REDUCE", default_i_val=cholesky_reduce, &
    7032             :                           enum_c_vals=s2a("OFF", "REDUCE", "RESTORE", "INVERSE", "INVERSE_DBCSR"), &
    7033             :                           enum_desc=s2a("The cholesky algorithm is not used", "Reduce is called", &
    7034             :                                         "Reduce is replaced by two restore", &
    7035             :                                         "Restore uses operator multiply by inverse of the triangular matrix", &
    7036             :                                         "Like inverse, but matrix stored as dbcsr, sparce matrix algebra used when possible"), &
    7037       39184 :                           enum_i_vals=(/cholesky_off, cholesky_reduce, cholesky_restore, cholesky_inverse, cholesky_dbcsr/))
    7038       39184 :       CALL section_add_keyword(section, keyword)
    7039       39184 :       CALL keyword_release(keyword)
    7040             : 
    7041             :       CALL keyword_create( &
    7042             :          keyword, __LOCATION__, name="PRECOND_SOLVER", &
    7043             :          description="How the preconditioner is applied to the residual.", &
    7044             :          usage="PRECOND_SOLVER DIRECT", &
    7045             :          default_i_val=ot_precond_solver_default, &
    7046             :          enum_c_vals=s2a("DEFAULT", "DIRECT", "INVERSE_CHOLESKY", "INVERSE_UPDATE"), &
    7047             :          enum_desc=s2a("the default", "Cholesky decomposition followed by triangular solve "// &
    7048             :                        "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)", &
    7049             :                        "Cholesky decomposition followed by explicit inversion "// &
    7050             :                        "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)", &
    7051             :                        "Performs a Hotelling update of the inverse if a previous preconditioner is present. "// &
    7052             :                        "Mainly useful for GPU accelerated systems (works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)"), &
    7053             :          enum_i_vals=(/ot_precond_solver_default, &
    7054             :                        ot_precond_solver_direct, &
    7055             :                        ot_precond_solver_inv_chol, &
    7056       39184 :                        ot_precond_solver_update/))
    7057       39184 :       CALL section_add_keyword(section, keyword)
    7058       39184 :       CALL keyword_release(keyword)
    7059             : 
    7060             :       CALL keyword_create( &
    7061             :          keyword, __LOCATION__, name="ENERGY_GAP", &
    7062             :          description="Should be an estimate for the energy gap [a.u.] (HOMO-LUMO) and is used in preconditioning, "// &
    7063             :          "especially effective with the FULL_ALL preconditioner, in which case it should be an underestimate "// &
    7064             :          "of the gap (can be a small number, e.g. 0.002)."// &
    7065             :          " FULL_SINGLE_INVERSE takes it as lower bound (values below 0.05 can cause stability issues)."// &
    7066             :          " In general, higher values will tame the preconditioner in case of poor initial guesses."// &
    7067             :          " A negative value will leave the choice to CP2K depending on type of preconditioner.", &
    7068             :          usage="ENERGY_GAP 0.001", &
    7069       39184 :          default_r_val=-1.0_dp)
    7070       39184 :       CALL section_add_keyword(section, keyword)
    7071       39184 :       CALL keyword_release(keyword)
    7072             : 
    7073             :       CALL keyword_create( &
    7074             :          keyword, __LOCATION__, name="EPS_TAYLOR", &
    7075             :          variants=(/"EPSTAYLOR"/), &
    7076             :          description="Target accuracy of the taylor expansion for the matrix functions, should normally be kept as is.", &
    7077             :          usage="EPS_TAYLOR 1.0E-15", &
    7078       78368 :          default_r_val=1.0E-16_dp)
    7079       39184 :       CALL section_add_keyword(section, keyword)
    7080       39184 :       CALL keyword_release(keyword)
    7081             : 
    7082             :       CALL keyword_create( &
    7083             :          keyword, __LOCATION__, name="MAX_TAYLOR", &
    7084             :          description="Maximum order of the Taylor expansion before diagonalisation is preferred, for large parallel runs"// &
    7085             :          " a slightly higher order could sometimes result in a small speedup.", &
    7086             :          usage="MAX_TAYLOR 5", &
    7087       39184 :          default_i_val=4)
    7088       39184 :       CALL section_add_keyword(section, keyword)
    7089       39184 :       CALL keyword_release(keyword)
    7090             : 
    7091             :       CALL keyword_create(keyword, __LOCATION__, name="ROTATION", &
    7092             :                           description="Introduce additional variables so that rotations of the occupied"// &
    7093             :                           " subspace are allowed as well, only needed for cases where the energy is not invariant under"// &
    7094             :                           " a rotation of the occupied subspace such as non-singlet restricted calculations"// &
    7095             :                           " or fractional occupations.", &
    7096             :                           usage="ROTATION", lone_keyword_l_val=.TRUE., &
    7097       39184 :                           default_l_val=.FALSE.)
    7098       39184 :       CALL section_add_keyword(section, keyword)
    7099       39184 :       CALL keyword_release(keyword)
    7100             : 
    7101             :       CALL keyword_create(keyword, __LOCATION__, name="ENERGIES", &
    7102             :                           description="Optimize orbital energies for use in Fermi-Dirac smearing "// &
    7103             :                           "(requires ROTATION and FD smearing to be active).", &
    7104             :                           usage="ENERGIES", lone_keyword_l_val=.TRUE., &
    7105       39184 :                           default_l_val=.FALSE.)
    7106       39184 :       CALL section_add_keyword(section, keyword)
    7107       39184 :       CALL keyword_release(keyword)
    7108             : 
    7109             :       CALL keyword_create(keyword, __LOCATION__, name="OCCUPATION_PRECONDITIONER", &
    7110             :                           description="Preconditioner with the occupation numbers (FD smearing)", &
    7111             :                           usage="OCCUPATION_PRECONDITIONER", lone_keyword_l_val=.TRUE., &
    7112       39184 :                           default_l_val=.FALSE.)
    7113       39184 :       CALL section_add_keyword(section, keyword)
    7114       39184 :       CALL keyword_release(keyword)
    7115             : 
    7116             :       CALL keyword_create(keyword, __LOCATION__, name="NONDIAG_ENERGY", &
    7117             :                           description="Add a non-diagonal energy penalty (FD smearing)", &
    7118             :                           usage="NONDIAG_ENERGY", lone_keyword_l_val=.TRUE., &
    7119       39184 :                           default_l_val=.FALSE.)
    7120       39184 :       CALL section_add_keyword(section, keyword)
    7121       39184 :       CALL keyword_release(keyword)
    7122             : 
    7123             :       CALL keyword_create(keyword, __LOCATION__, name="NONDIAG_ENERGY_STRENGTH", &
    7124             :                           description="The prefactor for the non-diagonal energy penalty (FD smearing)", &
    7125       39184 :                           usage="NONDIAG_ENERGY_STRENGTH", default_r_val=1.0_dp)
    7126       39184 :       CALL section_add_keyword(section, keyword)
    7127       39184 :       CALL keyword_release(keyword)
    7128             : 
    7129       39184 :    END SUBROUTINE create_ot_section
    7130             : 
    7131             : ! **************************************************************************************************
    7132             : !> \brief creates the diagonalization section
    7133             : !> \param section ...
    7134             : !> \par History
    7135             : !>      10.2008 created [JGH]
    7136             : ! **************************************************************************************************
    7137       19592 :    SUBROUTINE create_diagonalization_section(section)
    7138             :       TYPE(section_type), POINTER                        :: section
    7139             : 
    7140             :       TYPE(keyword_type), POINTER                        :: keyword
    7141             :       TYPE(section_type), POINTER                        :: subsection
    7142             : 
    7143       19592 :       CPASSERT(.NOT. ASSOCIATED(section))
    7144             :       CALL section_create(section, __LOCATION__, name="DIAGONALIZATION", &
    7145             :                           description="Set up type and parameters for Kohn-Sham matrix diagonalization.", &
    7146       19592 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    7147             : 
    7148       19592 :       NULLIFY (keyword)
    7149             : 
    7150             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    7151             :                           description="controls the activation of the diagonalization method", &
    7152             :                           usage="&DIAGONALIZATION T", &
    7153             :                           default_l_val=.FALSE., &
    7154       19592 :                           lone_keyword_l_val=.TRUE.)
    7155       19592 :       CALL section_add_keyword(section, keyword)
    7156       19592 :       CALL keyword_release(keyword)
    7157             : 
    7158             :       CALL keyword_create(keyword, __LOCATION__, name="ALGORITHM", &
    7159             :                           description="Algorithm to be used for diagonalization", &
    7160             :                           usage="ALGORITHM STANDARD", &
    7161             :                           default_i_val=diag_standard, &
    7162             :                           enum_c_vals=s2a("STANDARD", "OT", "LANCZOS", "DAVIDSON", "FILTER_MATRIX"), &
    7163             :                           enum_desc=s2a("Standard diagonalization: LAPACK methods or Jacobi.", &
    7164             :                                         "Iterative diagonalization using OT method", &
    7165             :                                         "Block Krylov-space approach to self-consistent diagonalisation", &
    7166             :                                         "Preconditioned blocked Davidson", &
    7167             :                                         "Filter matrix diagonalization"), &
    7168             :                           enum_i_vals=(/diag_standard, diag_ot, diag_block_krylov, diag_block_davidson, &
    7169       19592 :                                         diag_filter_matrix/))
    7170       19592 :       CALL section_add_keyword(section, keyword)
    7171       19592 :       CALL keyword_release(keyword)
    7172             : 
    7173             :       CALL keyword_create(keyword, __LOCATION__, name="JACOBI_THRESHOLD", &
    7174             :                           description="Controls the accuracy of the pseudo-diagonalization method using Jacobi rotations", &
    7175             :                           usage="JACOBI_THRESHOLD 1.0E-6", &
    7176             :                           default_r_val=1.0E-7_dp, &
    7177       39184 :                           citations=(/Stewart1982/))
    7178       19592 :       CALL section_add_keyword(section, keyword)
    7179       19592 :       CALL keyword_release(keyword)
    7180             : 
    7181             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_JACOBI", &
    7182             :                           description="Below this threshold value for the SCF convergence the pseudo-diagonalization "// &
    7183             :                           "method using Jacobi rotations is activated. This method is much faster than a "// &
    7184             :                           "real diagonalization and it is even speeding up while achieving full convergence. "// &
    7185             :                           "However, it needs a pre-converged wavefunction obtained by at least one real "// &
    7186             :                           "diagonalization which is further optimized while keeping the original eigenvalue "// &
    7187             :                           "spectrum. The MO eigenvalues are NOT updated. The method might be useful to speed "// &
    7188             :                           "up calculations for large systems e.g. using a semi-empirical method.", &
    7189             :                           usage="EPS_JACOBI 1.0E-5", &
    7190             :                           default_r_val=0.0_dp, &
    7191       39184 :                           citations=(/Stewart1982/))
    7192       19592 :       CALL section_add_keyword(section, keyword)
    7193       19592 :       CALL keyword_release(keyword)
    7194             : 
    7195             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ADAPT", &
    7196             :                           description="Required accuracy in iterative diagonalization as compared to current SCF convergence", &
    7197             :                           usage="EPS_ADAPT 0.01", &
    7198       19592 :                           default_r_val=0._dp)
    7199       19592 :       CALL section_add_keyword(section, keyword)
    7200       19592 :       CALL keyword_release(keyword)
    7201             : 
    7202             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
    7203             :                           description="Maximum number of iterations in iterative diagonalization", &
    7204             :                           usage="MAX_ITER 20", &
    7205       19592 :                           default_i_val=2)
    7206       19592 :       CALL section_add_keyword(section, keyword)
    7207       19592 :       CALL keyword_release(keyword)
    7208             : 
    7209             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ITER", &
    7210             :                           description="Required accuracy in iterative diagonalization", &
    7211             :                           usage="EPS_ITER 1.e-8", &
    7212       19592 :                           default_r_val=1.e-8_dp)
    7213       19592 :       CALL section_add_keyword(section, keyword)
    7214       19592 :       CALL keyword_release(keyword)
    7215             : 
    7216       19592 :       NULLIFY (subsection)
    7217       19592 :       CALL create_ot_section(subsection)
    7218       19592 :       CALL section_add_subsection(section, subsection)
    7219       19592 :       CALL section_release(subsection)
    7220             : 
    7221       19592 :       NULLIFY (subsection)
    7222       19592 :       CALL create_krylov_section(subsection)
    7223       19592 :       CALL section_add_subsection(section, subsection)
    7224       19592 :       CALL section_release(subsection)
    7225             : 
    7226       19592 :       NULLIFY (subsection)
    7227       19592 :       CALL create_diag_subspace_section(subsection)
    7228       19592 :       CALL section_add_subsection(section, subsection)
    7229       19592 :       CALL section_release(subsection)
    7230             : 
    7231       19592 :       NULLIFY (subsection)
    7232       19592 :       CALL create_davidson_section(subsection)
    7233       19592 :       CALL section_add_subsection(section, subsection)
    7234       19592 :       CALL section_release(subsection)
    7235             : 
    7236       19592 :       NULLIFY (subsection)
    7237       19592 :       CALL create_filtermatrix_section(subsection)
    7238       19592 :       CALL section_add_subsection(section, subsection)
    7239       19592 :       CALL section_release(subsection)
    7240             : 
    7241       19592 :    END SUBROUTINE create_diagonalization_section
    7242             : 
    7243             : ! **************************************************************************************************
    7244             : !> \brief ...
    7245             : !> \param section ...
    7246             : ! **************************************************************************************************
    7247       19592 :    SUBROUTINE create_davidson_section(section)
    7248             :       TYPE(section_type), POINTER                        :: section
    7249             : 
    7250             :       TYPE(keyword_type), POINTER                        :: keyword
    7251             : 
    7252       19592 :       CPASSERT(.NOT. ASSOCIATED(section))
    7253             :       CALL section_create(section, __LOCATION__, name="DAVIDSON", &
    7254             :                           description=" ", &
    7255       19592 :                           n_keywords=2, n_subsections=0, repeats=.FALSE.)
    7256             : 
    7257       19592 :       NULLIFY (keyword)
    7258             : 
    7259             :       CALL keyword_create( &
    7260             :          keyword, __LOCATION__, name="PRECONDITIONER", &
    7261             :          description="Type of preconditioner to be used with all minimization schemes. ", &
    7262             :          usage="PRECONDITIONER FULL_ALL", &
    7263             :          default_i_val=ot_precond_full_all, &
    7264             :          enum_c_vals=s2a("FULL_ALL", "FULL_SINGLE_INVERSE", "NONE"), &
    7265             :          enum_desc=s2a("Most effective state selective preconditioner based on diagonalization ", &
    7266             :                        "Based on H-eS cholesky inversion, similar to FULL_SINGLE in preconditioning efficiency "// &
    7267             :                        "but cheaper to construct, might be somewhat less robust. Recommended for large systems.", &
    7268             :                        "skip preconditioning"), &
    7269             :          enum_i_vals=(/ot_precond_full_all, ot_precond_full_single_inverse, ot_precond_none/), &
    7270       39184 :          citations=(/VandeVondele2003/))
    7271       19592 :       CALL section_add_keyword(section, keyword)
    7272       19592 :       CALL keyword_release(keyword)
    7273             : 
    7274             :       CALL keyword_create(keyword, __LOCATION__, name="PRECOND_SOLVER", &
    7275             :                           description="How the preconditioner is applied to the residual.", &
    7276             :                           usage="PRECOND_SOLVER DIRECT", &
    7277             :                           default_i_val=ot_precond_solver_default, &
    7278             :                           enum_c_vals=s2a("DEFAULT", "DIRECT", "INVERSE_CHOLESKY"), &
    7279             :                           enum_desc=s2a("the default", "Cholesky decomposition followed by triangular solve "// &
    7280             :                                         "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)", &
    7281             :                                         "Cholesky decomposition followed by explicit inversion "// &
    7282             :                                         "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)"), &
    7283             :                           enum_i_vals=(/ot_precond_solver_default, &
    7284             :                                         ot_precond_solver_direct, &
    7285       19592 :                                         ot_precond_solver_inv_chol/))
    7286       19592 :       CALL section_add_keyword(section, keyword)
    7287       19592 :       CALL keyword_release(keyword)
    7288             : 
    7289             :       CALL keyword_create( &
    7290             :          keyword, __LOCATION__, name="ENERGY_GAP", &
    7291             :          description="Should be an estimate for the energy gap [a.u.] (HOMO-LUMO) and is used in preconditioning, "// &
    7292             :          "especially effective with the FULL_ALL preconditioner, in which case it should be an underestimate "// &
    7293             :          "of the gap (0.001 doing normally fine). For the other preconditioners, making this value larger (0.2)"// &
    7294             :          " will tame the preconditioner in case of poor initial guesses.", &
    7295             :          usage="ENERGY_GAP 0.001", &
    7296       19592 :          default_r_val=0.2_dp)
    7297       19592 :       CALL section_add_keyword(section, keyword)
    7298       19592 :       CALL keyword_release(keyword)
    7299             : 
    7300             :       CALL keyword_create(keyword, __LOCATION__, name="NEW_PREC_EACH", &
    7301             :                           description="Number of SCF iterations after which a new Preconditioner is computed", &
    7302       19592 :                           usage="NEW_PREC_EACH 10", default_i_val=20)
    7303       19592 :       CALL section_add_keyword(section, keyword)
    7304       19592 :       CALL keyword_release(keyword)
    7305             : 
    7306             :       CALL keyword_create(keyword, __LOCATION__, name="FIRST_PREC", &
    7307             :                           description="First SCF iteration at which a Preconditioner is employed", &
    7308       19592 :                           usage="FIRST_PREC 1", default_i_val=1)
    7309       19592 :       CALL section_add_keyword(section, keyword)
    7310       19592 :       CALL keyword_release(keyword)
    7311             : 
    7312             :       CALL keyword_create(keyword, __LOCATION__, name="CONV_MOS_PERCENT", &
    7313             :                           description="Minimal percent of MOS that have to converge within the Davidson loop"// &
    7314             :                           " before the SCF iteration is completed and a new Hamiltonian is computed", &
    7315       19592 :                           usage="CONV_MOS_PERCENT 0.8", default_r_val=0.5_dp)
    7316       19592 :       CALL section_add_keyword(section, keyword)
    7317       19592 :       CALL keyword_release(keyword)
    7318             : 
    7319             :       CALL keyword_create(keyword, __LOCATION__, name="SPARSE_MOS", &
    7320             :                           description="Use MOS as sparse matrix and avoid as much as possible multiplications with full matrices", &
    7321             :                           usage="SPARSE_MOS", default_l_val=.TRUE., &
    7322       19592 :                           lone_keyword_l_val=.TRUE.)
    7323       19592 :       CALL section_add_keyword(section, keyword)
    7324       19592 :       CALL keyword_release(keyword)
    7325             : 
    7326       19592 :    END SUBROUTINE create_davidson_section
    7327             : 
    7328             : ! **************************************************************************************************
    7329             : !> \brief ...
    7330             : !> \param section ...
    7331             : ! **************************************************************************************************
    7332       19592 :    SUBROUTINE create_krylov_section(section)
    7333             :       TYPE(section_type), POINTER                        :: section
    7334             : 
    7335             :       TYPE(keyword_type), POINTER                        :: keyword
    7336             : 
    7337       19592 :       CPASSERT(.NOT. ASSOCIATED(section))
    7338             :       CALL section_create(section, __LOCATION__, name="KRYLOV", &
    7339             :                           description=" ", &
    7340       19592 :                           n_keywords=2, n_subsections=0, repeats=.FALSE.)
    7341             : 
    7342       19592 :       NULLIFY (keyword)
    7343             : 
    7344             :       CALL keyword_create(keyword, __LOCATION__, name="NKRYLOV", &
    7345             :                           description="Dimension of the Krylov space used for the Lanczos refinement", &
    7346             :                           usage="NKRYLOV 20", &
    7347       19592 :                           default_i_val=4)
    7348       19592 :       CALL section_add_keyword(section, keyword)
    7349       19592 :       CALL keyword_release(keyword)
    7350             : 
    7351             :       CALL keyword_create(keyword, __LOCATION__, name="NBLOCK", &
    7352             :                           description="Size of the block of vectors refined simultaneously by the Lanczos procedure", &
    7353             :                           usage="NBLOCK 1", &
    7354       19592 :                           default_i_val=32)
    7355       19592 :       CALL section_add_keyword(section, keyword)
    7356       19592 :       CALL keyword_release(keyword)
    7357             : 
    7358             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_KRYLOV", &
    7359             :                           description="Convergence criterion for the MOs", &
    7360             :                           usage="EPS_KRYLOV 0.00001", &
    7361       19592 :                           default_r_val=0.0000001_dp)
    7362       19592 :       CALL section_add_keyword(section, keyword)
    7363       19592 :       CALL keyword_release(keyword)
    7364             : 
    7365             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_STD_DIAG", &
    7366             :                           description="Level of convergence to be reached before starting the Lanczos procedure."// &
    7367             :                           " Above this threshold a standard diagonalization method is used."// &
    7368             :                           " If negative Lanczos is started at the first iteration", &
    7369             :                           usage="EPS_STD_DIAG 0.001", &
    7370       19592 :                           default_r_val=-1.0_dp)
    7371       19592 :       CALL section_add_keyword(section, keyword)
    7372       19592 :       CALL keyword_release(keyword)
    7373             : 
    7374             :       CALL keyword_create(keyword, __LOCATION__, name="CHECK_MOS_CONV", &
    7375             :                           description="This requires to check the convergence of MOS also when standard "// &
    7376             :                           "diagonalization steps are performed, if the block krylov approach is active.", &
    7377             :                           usage="CHECK_MOS_CONV T", &
    7378             :                           default_l_val=.FALSE., &
    7379       19592 :                           lone_keyword_l_val=.TRUE.)
    7380       19592 :       CALL section_add_keyword(section, keyword)
    7381       19592 :       CALL keyword_release(keyword)
    7382             : 
    7383       19592 :    END SUBROUTINE create_krylov_section
    7384             : 
    7385             : ! **************************************************************************************************
    7386             : !> \brief ...
    7387             : !> \param section ...
    7388             : ! **************************************************************************************************
    7389       19592 :    SUBROUTINE create_diag_subspace_section(section)
    7390             :       TYPE(section_type), POINTER                        :: section
    7391             : 
    7392             :       TYPE(keyword_type), POINTER                        :: keyword
    7393             :       TYPE(section_type), POINTER                        :: subsection
    7394             : 
    7395       19592 :       CPASSERT(.NOT. ASSOCIATED(section))
    7396             :       CALL section_create(section, __LOCATION__, name="DIAG_SUB_SCF", &
    7397             :                           description="Activation of self-consistenf subspace refinement by diagonalization "// &
    7398             :                           "of H by adjusting the occupation but keeping the MOS unchanged.", &
    7399       19592 :                           n_keywords=2, n_subsections=1, repeats=.FALSE.)
    7400             : 
    7401       19592 :       NULLIFY (keyword, subsection)
    7402             : 
    7403             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    7404             :                           description="controls the activation of inner SCF loop to refine occupations in MOS subspace", &
    7405             :                           usage="&DIAG_SUB_SCF T", &
    7406             :                           default_l_val=.FALSE., &
    7407       19592 :                           lone_keyword_l_val=.TRUE.)
    7408       19592 :       CALL section_add_keyword(section, keyword)
    7409       19592 :       CALL keyword_release(keyword)
    7410             : 
    7411             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
    7412             :                           description="Maximum number of iterations for the SCF inner loop", &
    7413             :                           usage="MAX_ITER 20", &
    7414       19592 :                           default_i_val=2)
    7415       19592 :       CALL section_add_keyword(section, keyword)
    7416       19592 :       CALL keyword_release(keyword)
    7417             : 
    7418             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ENE", &
    7419             :                           description="Required energy accuracy for convergence of subspace diagonalization", &
    7420             :                           usage="EPS_ENE 1.e-8", &
    7421       19592 :                           default_r_val=1.e-4_dp)
    7422       19592 :       CALL section_add_keyword(section, keyword)
    7423       19592 :       CALL keyword_release(keyword)
    7424             : 
    7425             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ADAPT_SCF", &
    7426             :                           description="Required density matrix accuracy as compared to current SCF convergence", &
    7427             :                           usage="EPS_ADAPT_SCF 1.e-1", &
    7428       19592 :                           default_r_val=1._dp)
    7429       19592 :       CALL section_add_keyword(section, keyword)
    7430       19592 :       CALL keyword_release(keyword)
    7431             : 
    7432             :       CALL keyword_create( &
    7433             :          keyword, __LOCATION__, name="EPS_SKIP_SUB_DIAG", &
    7434             :          description="Level of convergence to be reached before starting the internal loop of subspace rotations."// &
    7435             :          " Above this threshold only the outer diagonalization method is used."// &
    7436             :          " If negative the subspace rotation is started at the first iteration", &
    7437             :          usage="EPS_SKIP_SUB_DIAG 0.001", &
    7438       19592 :          default_r_val=-1.0_dp)
    7439       19592 :       CALL section_add_keyword(section, keyword)
    7440       19592 :       CALL keyword_release(keyword)
    7441             : 
    7442       19592 :       CALL create_mixing_section(subsection)
    7443       19592 :       CALL section_add_subsection(section, subsection)
    7444       19592 :       CALL section_release(subsection)
    7445       19592 :    END SUBROUTINE create_diag_subspace_section
    7446             : 
    7447             : ! **************************************************************************************************
    7448             : !> \brief makes the input section for core-level spectroscopy simulations
    7449             : !> \param section ...
    7450             : !> \par History
    7451             : !>      03.2005 created [MI]
    7452             : ! **************************************************************************************************
    7453        8408 :    SUBROUTINE create_xas_section(section)
    7454             :       TYPE(section_type), POINTER                        :: section
    7455             : 
    7456             :       TYPE(keyword_type), POINTER                        :: keyword
    7457             :       TYPE(section_type), POINTER                        :: print_key, subsection
    7458             : 
    7459        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    7460             :       CALL section_create(section, __LOCATION__, name="xas", &
    7461             :                           description="Sets the method of choice to calculate core-level excitation spectra. "// &
    7462             :                           "The occupied states from  which we calculate the "// &
    7463             :                           "excitation should be specified. "// &
    7464             :                           "Localization of the orbitals may be useful.", &
    7465             :                           n_keywords=10, n_subsections=1, repeats=.FALSE., &
    7466       16816 :                           citations=(/Iannuzzi2007/))
    7467             : 
    7468        8408 :       NULLIFY (keyword, subsection, print_key)
    7469             : 
    7470             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    7471             :                           description="controls the activation of core-level spectroscopy simulations", &
    7472             :                           usage="&XAS T", &
    7473             :                           default_l_val=.FALSE., &
    7474        8408 :                           lone_keyword_l_val=.TRUE.)
    7475        8408 :       CALL section_add_keyword(section, keyword)
    7476        8408 :       CALL keyword_release(keyword)
    7477             : 
    7478             :       CALL keyword_create(keyword, __LOCATION__, name="METHOD", &
    7479             :                           variants=(/"XAS_METHOD"/), &
    7480             :                           description="Method to be used to calculate core-level excitation spectra", &
    7481             :                           usage="METHOD TP_HH", &
    7482             :                           default_i_val=xas_none, &
    7483             :                           enum_c_vals=s2a("NONE", "TP_HH", "TP_FH", "TP_VAL", "TP_XHH", "TP_XFH", "DSCF", "TP_FLEX"), &
    7484             :                           enum_desc=s2a( &
    7485             :                           "No core electron spectroscopy", "Transition potential half-hole", &
    7486             :                           "Transition potential full-hole", "Hole in homo for X-ray emission only ", &
    7487             :                           "Transition potential excited half-hole", &
    7488             :                           "Transition potential excited full-hole ", &
    7489             :                           "DSCF calculations to compute the first (core)excited state", &
    7490             :                           "Transition potential with generalized core occupation and total number of electrons"), &
    7491             :                           enum_i_vals=(/xas_none, xas_tp_hh, xas_tp_fh, xes_tp_val, xas_tp_xhh, &
    7492       16816 :                                         xas_tp_xfh, xas_dscf, xas_tp_flex/))
    7493        8408 :       CALL section_add_keyword(section, keyword)
    7494        8408 :       CALL keyword_release(keyword)
    7495             : 
    7496             :       CALL keyword_create(keyword, __LOCATION__, name="XAS_CORE", &
    7497             :                           description="Occupation of the core state in XAS calculation by TP_FLEX.", &
    7498             :                           usage="XAS_CORE 0.5", &
    7499        8408 :                           default_r_val=0.5_dp)
    7500        8408 :       CALL section_add_keyword(section, keyword)
    7501        8408 :       CALL keyword_release(keyword)
    7502             : 
    7503             :       CALL keyword_create(keyword, __LOCATION__, name="XAS_TOT_EL", &
    7504             :                           description="Total number of electrons for spin channel alpha, in XAS calculation by TP_FLEX. "// &
    7505             :                           "If it is a negative value, the number of electrons is set to GS number of electrons "// &
    7506             :                           "minus the amount subtracted from the core state", &
    7507             :                           usage="XAS_TOT_EL 10", &
    7508        8408 :                           default_r_val=-1._dp)
    7509        8408 :       CALL section_add_keyword(section, keyword)
    7510        8408 :       CALL keyword_release(keyword)
    7511             : 
    7512             :       CALL keyword_create(keyword, __LOCATION__, name="XES_CORE", &
    7513             :                           description="Occupation of the core state in XES calculation by TP_VAL. "// &
    7514             :                           "The HOMO is emptied by the same amount.", &
    7515             :                           usage="XES_CORE 0.5", &
    7516        8408 :                           default_r_val=1._dp)
    7517        8408 :       CALL section_add_keyword(section, keyword)
    7518        8408 :       CALL keyword_release(keyword)
    7519             : 
    7520             :       CALL keyword_create(keyword, __LOCATION__, name="XES_EMPTY_HOMO", &
    7521             :                           description="Set the occupation of the HOMO in XES calculation by TP_VAL. "// &
    7522             :                           "The HOMO can be emptied or not, if the core is still full.", &
    7523             :                           usage="XES_EMPTY_HOMO", &
    7524             :                           default_l_val=.FALSE., &
    7525        8408 :                           lone_keyword_l_val=.TRUE.)
    7526        8408 :       CALL section_add_keyword(section, keyword)
    7527        8408 :       CALL keyword_release(keyword)
    7528             : 
    7529             :       CALL keyword_create(keyword, __LOCATION__, name="DIPOLE_FORM", &
    7530             :                           variants=(/"DIP_FORM"/), &
    7531             :                           description="Type of integral to get the oscillator strengths "// &
    7532             :                           "in the diipole approximation", &
    7533             :                           usage="DIPOLE_FORM string", &
    7534             :                           default_i_val=xas_dip_vel, &
    7535             :                           enum_c_vals=s2a("LENGTH", "VELOCITY"), &
    7536             :                           enum_desc=s2a("Length form &lang; i | e r | j &rang;", &
    7537             :                                         "Velocity form &lang; i | d/dr | j &rang;"), &
    7538       16816 :                           enum_i_vals=(/xas_dip_len, xas_dip_vel/))
    7539        8408 :       CALL section_add_keyword(section, keyword)
    7540        8408 :       CALL keyword_release(keyword)
    7541             : 
    7542             : !   replace the specialized keyword with standard scf section
    7543             : !    scf_env is added to xas_env
    7544             : 
    7545        8408 :       NULLIFY (subsection)
    7546        8408 :       CALL create_scf_section(subsection)
    7547        8408 :       CALL section_add_subsection(section, subsection)
    7548        8408 :       CALL section_release(subsection)
    7549             : 
    7550             :       CALL keyword_create(keyword, __LOCATION__, name="STATE_TYPE", &
    7551             :                           variants=(/"TYPE"/), &
    7552             :                           description="Type of the orbitals that are excited for the xas spectra calculation", &
    7553             :                           usage="STATE_TYPE 1S", &
    7554             :                           default_i_val=xas_1s_type, &
    7555             :                           enum_c_vals=s2a("1S", "2S", "2P", "3S", "3P", "3D", "4S", "4P", "4D", "4F"), &
    7556             :                           enum_desc=s2a("1s orbitals", "2s orbitals", "2p orbitals", "3s orbitals", "3p orbitals", &
    7557             :                                         "3d orbitals", "4s orbitals", "4p orbitals", "4d orbitals", "4f orbitals"), &
    7558             :                           enum_i_vals=(/xas_1s_type, xas_2s_type, xas_2p_type, xas_3s_type, xas_3p_type, xas_3d_type, &
    7559       16816 :                                         xas_4s_type, xas_4p_type, xas_4d_type, xas_4f_type/))
    7560        8408 :       CALL section_add_keyword(section, keyword)
    7561        8408 :       CALL keyword_release(keyword)
    7562             : 
    7563             :       CALL keyword_create(keyword, __LOCATION__, name="STATE_SEARCH", &
    7564             :                           description="# of states where to look for the one to be excited", &
    7565             :                           usage="STATE_SEARCH 1", &
    7566        8408 :                           default_i_val=-1)
    7567        8408 :       CALL section_add_keyword(section, keyword)
    7568        8408 :       CALL keyword_release(keyword)
    7569             : 
    7570             :       CALL keyword_create(keyword, __LOCATION__, name="SPIN_CHANNEL", &
    7571             :                           description="# Spin channel of the excited orbital", &
    7572             :                           usage="SPIN_CHANNEL 1", &
    7573        8408 :                           default_i_val=1)
    7574        8408 :       CALL section_add_keyword(section, keyword)
    7575        8408 :       CALL keyword_release(keyword)
    7576             : 
    7577             :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS_LIST", &
    7578             :                           variants=(/"AT_LIST"/), &
    7579             :                           description="Indexes of the atoms to be excited. "// &
    7580             :                           "This keyword can be repeated several times "// &
    7581             :                           "(useful if you have to specify many indexes).", &
    7582             :                           usage="ATOMS_LIST {integer}  {integer} ..  {integer} ", &
    7583       16816 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    7584        8408 :       CALL section_add_keyword(section, keyword)
    7585        8408 :       CALL keyword_release(keyword)
    7586             : 
    7587             :       CALL keyword_create(keyword, __LOCATION__, name="OVERLAP_THRESHOLD", &
    7588             :                           description="Threshold for including more than one initial core excited state "// &
    7589             :                           "per atom. The threshold is taken relative to the maximum overlap.", &
    7590        8408 :                           usage="OVERLAP_THRESHOLD 8.e-1", default_r_val=1.0_dp)
    7591        8408 :       CALL section_add_keyword(section, keyword)
    7592        8408 :       CALL keyword_release(keyword)
    7593             : 
    7594             :       CALL keyword_create(keyword, __LOCATION__, name="ORBITAL_LIST", &
    7595             :                           variants=(/"ORBITAL_LIST"/), &
    7596             :                           description="Indices of the localized orbitals to be excited. "// &
    7597             :                           "This keyword can be repeated several times "// &
    7598             :                           "(useful if you have to specify many indexes).", &
    7599             :                           usage="ORBITAL_LIST {integer}  {integer} ..  {integer} ", &
    7600       16816 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    7601        8408 :       CALL section_add_keyword(section, keyword)
    7602        8408 :       CALL keyword_release(keyword)
    7603             : 
    7604             :       CALL keyword_create(keyword, __LOCATION__, name="ADDED_MOS", &
    7605             :                           description="Number of additional MOS added spin up only", &
    7606        8408 :                           usage="ADDED_MOS {integer}", default_i_val=-1)
    7607        8408 :       CALL section_add_keyword(section, keyword)
    7608        8408 :       CALL keyword_release(keyword)
    7609             : 
    7610             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER_ADDED", &
    7611             :                           description="maximum number of iteration in calculation of added orbitals", &
    7612        8408 :                           usage="MAX_ITER_ADDED 100", default_i_val=2999)
    7613        8408 :       CALL section_add_keyword(section, keyword)
    7614        8408 :       CALL keyword_release(keyword)
    7615             : 
    7616             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ADDED", &
    7617             :                           description="target accuracy incalculation of the added orbitals", &
    7618        8408 :                           usage="EPS_ADDED 1.e-6", default_r_val=1.0e-5_dp)
    7619        8408 :       CALL section_add_keyword(section, keyword)
    7620        8408 :       CALL keyword_release(keyword)
    7621             : 
    7622             :       CALL keyword_create(keyword, __LOCATION__, name="NGAUSS", &
    7623             :                           description="Number of gto's for the expansion of the STO "// &
    7624             :                           "of the type given by STATE_TYPE", &
    7625        8408 :                           usage="NGAUSS {integer}", default_i_val=3)
    7626        8408 :       CALL section_add_keyword(section, keyword)
    7627        8408 :       CALL keyword_release(keyword)
    7628             : 
    7629             :       CALL keyword_create(keyword, __LOCATION__, name="RESTART", &
    7630             :                           description="Restart the excited state if the restart file exists", &
    7631             :                           usage="RESTART", &
    7632        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    7633        8408 :       CALL section_add_keyword(section, keyword)
    7634        8408 :       CALL keyword_release(keyword)
    7635             : 
    7636             :       CALL keyword_create(keyword, __LOCATION__, name="WFN_RESTART_FILE_NAME", &
    7637             :                           variants=(/"RESTART_FILE_NAME"/), &
    7638             :                           description="Root of the file names where to read the MOS from "// &
    7639             :                           "which to restart the calculation of the core level excited states", &
    7640             :                           usage="WFN_RESTART_FILE_NAME <FILENAME>", &
    7641       16816 :                           type_of_var=lchar_t)
    7642        8408 :       CALL section_add_keyword(section, keyword)
    7643        8408 :       CALL keyword_release(keyword)
    7644             : 
    7645        8408 :       CALL create_localize_section(subsection)
    7646        8408 :       CALL section_add_subsection(section, subsection)
    7647        8408 :       CALL section_release(subsection)
    7648             : 
    7649             :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    7650             :                           description="printing of information during the core-level spectroscopy simulation", &
    7651        8408 :                           repeats=.FALSE.)
    7652             : 
    7653             :       ! Add printing of wannier infos
    7654        8408 :       CALL print_wanniers(subsection)
    7655             : 
    7656             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "iteration_info", &
    7657             :                                        description="Controls the printing of basic iteration information during the XAS SCF.", &
    7658        8408 :                                        print_level=low_print_level, filename="__STD_OUT__")
    7659             :       CALL keyword_create(keyword, __LOCATION__, name="time_cumul", &
    7660             :                           description="If the printkey is activated switches the printing of timings"// &
    7661             :                           " to cumulative (over the SCF).", &
    7662        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    7663        8408 :       CALL section_add_keyword(print_key, keyword)
    7664        8408 :       CALL keyword_release(keyword)
    7665        8408 :       CALL section_add_subsection(subsection, print_key)
    7666        8408 :       CALL section_release(print_key)
    7667             : 
    7668             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
    7669             :                                        description="Controls the printing of basic iteration information in CLS", &
    7670        8408 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    7671        8408 :       CALL section_add_subsection(subsection, print_key)
    7672        8408 :       CALL section_release(print_key)
    7673             : 
    7674             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "XES_SPECTRUM", &
    7675             :                                        description="Controls the dumping of the CLS output files containing the emission spectra", &
    7676        8408 :                                        print_level=low_print_level, common_iter_levels=3, filename="")
    7677        8408 :       CALL section_add_subsection(subsection, print_key)
    7678        8408 :       CALL section_release(print_key)
    7679             : 
    7680             :       CALL cp_print_key_section_create( &
    7681             :          print_key, __LOCATION__, "XAS_SPECTRUM", &
    7682             :          description="Controls the dumping of the CLS output files containing the absorption spectra", &
    7683        8408 :          print_level=low_print_level, common_iter_levels=3, filename="")
    7684        8408 :       CALL section_add_subsection(subsection, print_key)
    7685        8408 :       CALL section_release(print_key)
    7686             : 
    7687        8408 :       CALL create_pdos_section(print_key)
    7688        8408 :       CALL section_add_subsection(subsection, print_key)
    7689        8408 :       CALL section_release(print_key)
    7690             : 
    7691             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
    7692             :                                        description="Controls the dumping of MO restart file during the SCF. "// &
    7693             :                                        "of a Core-Level-Spectroscopy calculation. For each new excited atom, "// &
    7694             :                                        "one different restart file is dumped. These restart files should be "// &
    7695             :                                        "employed only to restart the same type of CLS calculation, "// &
    7696             :                                        "i.e. with the same core potential.", &
    7697             :                                        print_level=low_print_level, common_iter_levels=3, each_iter_names=s2a("XAS_SCF"), &
    7698        8408 :                                        add_last=add_last_numeric, each_iter_values=(/3/), filename="")
    7699        8408 :       CALL section_add_subsection(subsection, print_key)
    7700        8408 :       CALL section_release(print_key)
    7701             : 
    7702             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FULL_RESTART", &
    7703             :                                        description="Controls the dumping of a standard MO restart file "// &
    7704             :                                        "where coefficients and occupation numbers are those of the TP scheme, "// &
    7705             :                                        "i.e. with emptied core state.", &
    7706             :                                        print_level=high_print_level, common_iter_levels=3, each_iter_names=s2a("XAS_SCF"), &
    7707        8408 :                                        add_last=add_last_numeric, each_iter_values=(/3/), filename="")
    7708        8408 :       CALL section_add_subsection(subsection, print_key)
    7709        8408 :       CALL section_release(print_key)
    7710             : 
    7711             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CLS_FUNCTION_CUBES", &
    7712             :                                        description="Controls the printing of the relaxed orbitals ", &
    7713        8408 :                                        print_level=high_print_level, common_iter_levels=3, add_last=add_last_numeric, filename="")
    7714             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    7715             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    7716             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    7717             :                           " 1 number valid for all components.", &
    7718        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    7719        8408 :       CALL section_add_keyword(print_key, keyword)
    7720        8408 :       CALL keyword_release(keyword)
    7721             : 
    7722             :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LU_BOUNDS", &
    7723             :                           variants=(/"CUBES_LU"/), &
    7724             :                           description="The lower and upper index of the states to be printed as cube", &
    7725             :                           usage="CUBES_LU_BOUNDS integer integer", &
    7726       16816 :                           n_var=2, default_i_vals=(/0, -2/), type_of_var=integer_t)
    7727        8408 :       CALL section_add_keyword(print_key, keyword)
    7728        8408 :       CALL keyword_release(keyword)
    7729             : 
    7730             :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LIST", &
    7731             :                           description="Indexes of the states to be printed as cube files "// &
    7732             :                           "This keyword can be repeated several times "// &
    7733             :                           "(useful if you have to specify many indexes).", &
    7734             :                           usage="CUBES_LIST 1 2", &
    7735        8408 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    7736        8408 :       CALL section_add_keyword(print_key, keyword)
    7737        8408 :       CALL keyword_release(keyword)
    7738             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    7739             :                           description="append the cube files when they already exist", &
    7740        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    7741        8408 :       CALL section_add_keyword(print_key, keyword)
    7742        8408 :       CALL keyword_release(keyword)
    7743             : 
    7744        8408 :       CALL section_add_subsection(subsection, print_key)
    7745        8408 :       CALL section_release(print_key)
    7746             : 
    7747        8408 :       CALL section_add_subsection(section, subsection)
    7748        8408 :       CALL section_release(subsection)
    7749             : 
    7750        8408 :    END SUBROUTINE create_xas_section
    7751             : 
    7752             : ! **************************************************************************************************
    7753             : !> \brief makes the input section for core-level spectroscopy simulations using
    7754             : !>        linear response TDDFT
    7755             : !> \param section ...
    7756             : !> \par History
    7757             : !>      11.2017 created [AB]
    7758             : ! **************************************************************************************************
    7759        8408 :    SUBROUTINE create_xas_tdp_section(section)
    7760             :       TYPE(section_type), POINTER                        :: section
    7761             : 
    7762             :       TYPE(keyword_type), POINTER                        :: keyword
    7763             :       TYPE(section_type), POINTER                        :: print_key, subsection, subsubsection, &
    7764             :                                                             subsubsubsection
    7765             : 
    7766        8408 :       NULLIFY (keyword, print_key, subsection, subsubsection, subsubsubsection)
    7767             : 
    7768        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    7769             :       CALL section_create(section, __LOCATION__, name="XAS_TDP", &
    7770             :                           description="XAS simulations using linear-response TDDFT. Excitation from "// &
    7771             :                           "specified core orbitals are considered one at a time. In case of high "// &
    7772             :                           "symmetry structures, donor core orbitals should be localized.", &
    7773        8408 :                           n_keywords=19, n_subsections=4, repeats=.FALSE.)
    7774             : 
    7775        8408 :       NULLIFY (keyword, subsection, print_key)
    7776             : 
    7777             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    7778             :                           description="controls the activation of XAS simulations with linear "// &
    7779             :                           "response TDDFT.", &
    7780             :                           usage="&TDP_XAS {logical}", &
    7781             :                           default_l_val=.FALSE., &
    7782        8408 :                           lone_keyword_l_val=.TRUE.)
    7783        8408 :       CALL section_add_keyword(section, keyword)
    7784        8408 :       CALL keyword_release(keyword)
    7785             : 
    7786             :       CALL keyword_create(keyword, __LOCATION__, name="CHECK_ONLY", &
    7787             :                           description="This keyword defines whether the full calculation should "// &
    7788             :                           "be done or not. If set to .TRUE., only the determination "// &
    7789             :                           "of donor MOs is conducted. This run option allows for "// &
    7790             :                           "cheap verification of the input parameters", &
    7791             :                           usage="CHECK_ONLY {logical}", &
    7792             :                           default_l_val=.FALSE., &
    7793             :                           lone_keyword_l_val=.TRUE., &
    7794        8408 :                           repeats=.FALSE.)
    7795        8408 :       CALL section_add_keyword(section, keyword)
    7796        8408 :       CALL keyword_release(keyword)
    7797             : 
    7798             :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_FROM_FILE", &
    7799             :                           variants=s2a("RESTART_FILENAME", "RST_FILENAME", "RESTART_FILE", "RST_FILE"), &
    7800             :                           description="By providing a RESTART file containing the linear-response "// &
    7801             :                           "orbitals and excitations energies from a previous calculation, "// &
    7802             :                           "all computations are skipped except for the corresponding "// &
    7803             :                           "PDOS and/or CUBE file printing as defined in the PRINT "// &
    7804             :                           "subsection. Basis sets and geometry need to be consistent.", &
    7805             :                           usage="RESTART_FROM_FILE <FILENAME>", &
    7806        8408 :                           type_of_var=char_t, n_var=-1)
    7807        8408 :       CALL section_add_keyword(section, keyword)
    7808        8408 :       CALL keyword_release(keyword)
    7809             : 
    7810             :       CALL keyword_create(keyword, __LOCATION__, name="EXCITATIONS", &
    7811             :                           variants=(/"EXCITATION"/), &
    7812             :                           description="Specify the type of excitation to consider. In case of a "// &
    7813             :                           "resctricted closed-shell ground state calculation, "// &
    7814             :                           "RCS_SINGLET or/and RCS_TRIPLET can be chosen. In case of a "// &
    7815             :                           "open-shell ground state calculation (either UKS or ROKS), "// &
    7816             :                           "standard spin conserving excitation (OS_SPIN_CONS) or/and "// &
    7817             :                           "spin-flip excitation (OS_SPIN_FLIP) can be chosen.", &
    7818             :                           usage="EXCITATIONS {string}", &
    7819             :                           repeats=.TRUE., &
    7820             :                           default_i_val=tddfpt_singlet, &
    7821             :                           enum_c_vals=s2a("RCS_SINGLET", "RCS_TRIPLET", "OS_SPIN_CONS", "OS_SPIN_FLIP"), &
    7822             :                           enum_desc=s2a("Singlet excitation on top of restricted closed-shell ground state", &
    7823             :                                         "Triplet excitation on top of restricted closed-shell ground state", &
    7824             :                                         "Spin-conserving excitations on top of open-shell ground state", &
    7825             :                                         "Spin-flip excitation on top of open-shell ground state"), &
    7826       16816 :                           enum_i_vals=(/tddfpt_singlet, tddfpt_triplet, tddfpt_spin_cons, tddfpt_spin_flip/))
    7827        8408 :       CALL section_add_keyword(section, keyword)
    7828        8408 :       CALL keyword_release(keyword)
    7829             : 
    7830             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_PGF_XAS", &
    7831             :                           variants=s2a("EPS_PGF", "EPS_PGF_XAS_TDP"), &
    7832             :                           description="The threshold used to determine the spacial extent of all "// &
    7833             :                           "primitive Gaussian functions used for the construction "// &
    7834             :                           "of neighbor lists in the XAS_TDP method. "// &
    7835             :                           "By default, takes the value of QS%EPS_PGF_ORB. Useful if "// &
    7836             :                           "the former value is tiny due to possible ground state HFX "// &
    7837             :                           "contributions.", &
    7838             :                           usage="EPS_PGS_XAS {real}", &
    7839        8408 :                           type_of_var=real_t)
    7840        8408 :       CALL section_add_keyword(section, keyword)
    7841        8408 :       CALL keyword_release(keyword)
    7842             : 
    7843             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER", &
    7844             :                           variants=s2a("EPS_FILTER_MATRIX"), &
    7845             :                           description="The threshold used for sparse matrix operations", &
    7846             :                           usage="EPS_FILTER {real}", &
    7847             :                           type_of_var=real_t, &
    7848        8408 :                           default_r_val=1.0E-10_dp)
    7849        8408 :       CALL section_add_keyword(section, keyword)
    7850        8408 :       CALL keyword_release(keyword)
    7851             : 
    7852             :       CALL keyword_create(keyword, __LOCATION__, name="DIPOLE_FORM", &
    7853             :                           variants=(/"DIP_FORM"/), &
    7854             :                           description="Type of integral to get the oscillator strengths "// &
    7855             :                           "in the dipole approximation", &
    7856             :                           usage="DIPOLE_FORM {string}", &
    7857             :                           default_i_val=xas_dip_vel, &
    7858             :                           enum_c_vals=s2a("LENGTH", "VELOCITY"), &
    7859             :                           enum_desc=s2a("Length form &lang; 0 | e r | n &rang;", &
    7860             :                                         "Velocity form &lang; 0 | d/dr | n &rang;"), &
    7861       16816 :                           enum_i_vals=(/xas_dip_len, xas_dip_vel/))
    7862        8408 :       CALL section_add_keyword(section, keyword)
    7863        8408 :       CALL keyword_release(keyword)
    7864             : 
    7865             :       CALL keyword_create(keyword, __LOCATION__, name="QUADRUPOLE", &
    7866             :                           variants=s2a("DO_QUADRUPOLE", "DO_QUAD", "QUAD"), &
    7867             :                           description="Compute the electric quadrupole contribution to the "// &
    7868             :                           "oscillator strenghts (in the length representation with "// &
    7869             :                           "the origin set on the relevant excited atom)", &
    7870             :                           usage="QUADRUPOLE {logical}", &
    7871             :                           default_l_val=.FALSE., &
    7872        8408 :                           lone_keyword_l_val=.TRUE.)
    7873        8408 :       CALL section_add_keyword(section, keyword)
    7874        8408 :       CALL keyword_release(keyword)
    7875             : 
    7876             :       CALL keyword_create(keyword, __LOCATION__, name="XYZ_DIPOLE", &
    7877             :                           variants=s2a("DIPOLE_XYZ"), &
    7878             :                           description="Whether the detailed contributions of the dipole oscillator "// &
    7879             :                           "strengths along the X,Y,Z directions should be printed.", &
    7880             :                           usage="XYZ_DIPOLE {logical}", &
    7881             :                           default_l_val=.FALSE., &
    7882        8408 :                           lone_keyword_l_val=.TRUE.)
    7883        8408 :       CALL section_add_keyword(section, keyword)
    7884        8408 :       CALL keyword_release(keyword)
    7885             : 
    7886             : !  the GW2X correction subsection
    7887             :       CALL section_create(subsection, __LOCATION__, name="GW2X", &
    7888             :                           description="Specifications for the GW2X calculation of core "// &
    7889             :                           "ionization potentials. Note that donor states need to be actively "// &
    7890             :                           "localized using the LOCALIZE keyword in DONOR_STATES. N_SEARCH "// &
    7891             :                           "should be kept to the minimum, such that only core states are localized.", &
    7892             :                           citations=(/Shigeta2001/), &
    7893             :                           n_keywords=8, &
    7894             :                           n_subsections=0, &
    7895       16816 :                           repeats=.FALSE.)
    7896             : 
    7897             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    7898             :                           description="Enables the GW2X correction of the core ionization potentials", &
    7899             :                           usage="&GW2X {logical}", &
    7900             :                           default_l_val=.FALSE., &
    7901        8408 :                           lone_keyword_l_val=.TRUE.)
    7902        8408 :       CALL section_add_keyword(subsection, keyword)
    7903        8408 :       CALL keyword_release(keyword)
    7904             : 
    7905             :       CALL keyword_create(keyword, __LOCATION__, name="XPS_ONLY", &
    7906             :                           description="If set to .TRUE., only run GW2X calculations for XPS "// &
    7907             :                           "spectroscopy and ignore all XAS calculations. It is still "// &
    7908             :                           "required to define the DONOR_STATES and KERNEL%EXACT_EXCHANGE "// &
    7909             :                           "subsections.", &
    7910             :                           default_l_val=.FALSE., &
    7911        8408 :                           lone_keyword_l_val=.TRUE.)
    7912        8408 :       CALL section_add_keyword(subsection, keyword)
    7913        8408 :       CALL keyword_release(keyword)
    7914             : 
    7915             :       CALL keyword_create(keyword, __LOCATION__, name="BATCH_SIZE", &
    7916             :                           description="MOs batch size for batched tensor contraction. Larger "// &
    7917             :                           "size is faster, but uses more memory. Default should be safe "// &
    7918             :                           "in most cases.", &
    7919        8408 :                           default_i_val=64)
    7920        8408 :       CALL section_add_keyword(subsection, keyword)
    7921        8408 :       CALL keyword_release(keyword)
    7922             : 
    7923             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_GW2X", &
    7924             :                           description="Convergence threshold for GW2X iterations (in eV)", &
    7925        8408 :                           default_r_val=1.E-2_dp)
    7926        8408 :       CALL section_add_keyword(subsection, keyword)
    7927        8408 :       CALL keyword_release(keyword)
    7928             : 
    7929             :       CALL keyword_create(keyword, __LOCATION__, name="C_OS", &
    7930             :                           description="Opposite-spin scling factor. SCS => 6/5, SOS => 1.3", &
    7931        8408 :                           default_r_val=1.0_dp)
    7932        8408 :       CALL section_add_keyword(subsection, keyword)
    7933        8408 :       CALL keyword_release(keyword)
    7934             : 
    7935             :       CALL keyword_create(keyword, __LOCATION__, name="C_SS", &
    7936             :                           description="Same-spin scling factor. SCS => 1/3, SOS => 0.0", &
    7937        8408 :                           default_r_val=1.0_dp)
    7938        8408 :       CALL section_add_keyword(subsection, keyword)
    7939        8408 :       CALL keyword_release(keyword)
    7940             : 
    7941             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_GW2X_ITER", &
    7942             :                           description="Maximum number of iterations for GW2X", &
    7943        8408 :                           default_i_val=10)
    7944        8408 :       CALL section_add_keyword(subsection, keyword)
    7945        8408 :       CALL keyword_release(keyword)
    7946             : 
    7947             :       CALL keyword_create(keyword, __LOCATION__, name="PSEUDO_CANONICAL", &
    7948             :                           variants=(/"PSEUDO_CANO"/), &
    7949             :                           description="Whether the pseudo-canonical version of GW2X should be used "// &
    7950             :                           "(versus only using the diagonal of the generalized Fock matrix)", &
    7951       16816 :                           default_l_val=.TRUE.)
    7952        8408 :       CALL section_add_keyword(subsection, keyword)
    7953        8408 :       CALL keyword_release(keyword)
    7954             : 
    7955        8408 :       CALL section_add_subsection(section, subsection)
    7956        8408 :       CALL section_release(subsection)
    7957             : 
    7958             : !  The donor state subsection
    7959             : 
    7960             :       CALL section_create(subsection, __LOCATION__, name="DONOR_STATES", &
    7961             :                           description="Specifications for the donor states from which core "// &
    7962             :                           "electrons are excited", &
    7963             :                           n_keywords=6, &
    7964             :                           n_subsections=0, &
    7965        8408 :                           repeats=.FALSE.)
    7966             : 
    7967             :       CALL keyword_create(keyword, __LOCATION__, name="DEFINE_EXCITED", &
    7968             :                           description="Whether the atoms to be excited should be defined by "// &
    7969             :                           "a list of atom indices or by a list of atom kinds.", &
    7970             :                           usage="DEFINE_EXCITED {string}", &
    7971             :                           default_i_val=xas_tdp_by_index, &
    7972             :                           enum_c_vals=s2a("BY_INDEX", "BY_KIND"), &
    7973             :                           enum_i_vals=(/xas_tdp_by_index, xas_tdp_by_kind/), &
    7974             :                           enum_desc=s2a("Excited atoms are defined by a list of indices", &
    7975        8408 :                                         "Excited atoms are defined by a list of atomic kinds"))
    7976        8408 :       CALL section_add_keyword(subsection, keyword)
    7977        8408 :       CALL keyword_release(keyword)
    7978             : 
    7979             :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_LIST", &
    7980             :                           variants=(/"AT_LIST"/), &
    7981             :                           description="Indices of the atoms to be excited. "// &
    7982             :                           "Keyword only taken into account if DEFINE_EXCITED = BY_INDEX", &
    7983             :                           usage="ATOM_LIST {integer}  {integer} ..  {integer} ", &
    7984       16816 :                           n_var=-1, type_of_var=integer_t, repeats=.FALSE.)
    7985        8408 :       CALL section_add_keyword(subsection, keyword)
    7986        8408 :       CALL keyword_release(keyword)
    7987             : 
    7988             :       CALL keyword_create(keyword, __LOCATION__, name="KIND_LIST", &
    7989             :                           description="Kind of atoms to be excited. "// &
    7990             :                           "All atoms of the specified kinds are considered. "// &
    7991             :                           "Keyword only taken into account if DEFINE_EXCITED = BY_KIND", &
    7992             :                           usage="KIND_LIST {string}  {string} ..  {string} ", &
    7993        8408 :                           n_var=-1, type_of_var=char_t, repeats=.FALSE.)
    7994        8408 :       CALL section_add_keyword(subsection, keyword)
    7995        8408 :       CALL keyword_release(keyword)
    7996             : 
    7997             :       CALL keyword_create(keyword, __LOCATION__, name="STATE_TYPES", &
    7998             :                           variants=(/"TYPES"/), &
    7999             :                           description="Types of orbitals that are excited, for each atom/kind, "// &
    8000             :                           "in order to do LR-TDDFT driven xas spectra calculation. "// &
    8001             :                           "This keyword MUST have the same number of entries as the relevant "// &
    8002             :                           "KIND_LIST or ATOM_LIST. The order of the specified state types must "// &
    8003             :                           "correspond to the order of the relevant kinds/indices. "// &
    8004             :                           "This keyword can be repeated, useful when multiple orbital types "// &
    8005             :                           "should be excited for specific kinds/atoms.", &
    8006             :                           n_var=-1, default_i_val=xas_not_excited, repeats=.TRUE., &
    8007             :                           usage="STATE_TYPES {string}  {string} .. {string}", &
    8008             :                           enum_c_vals=s2a("1S", "2S", "2P", "NE"), &
    8009             :                           enum_desc=s2a("1s orbital", "2s orbital", "2p orbitals", "not excited"), &
    8010       16816 :                           enum_i_vals=(/xas_1s_type, xas_2s_type, xas_2p_type, xas_not_excited/))
    8011        8408 :       CALL section_add_keyword(subsection, keyword)
    8012        8408 :       CALL keyword_release(keyword)
    8013             : 
    8014             :       CALL keyword_create(keyword, __LOCATION__, name="N_SEARCH", &
    8015             :                           description="Number of MOs (per spin) to search to find specified donor core "// &
    8016             :                           "orbitals, starting from the lowest in energy and upward. By default, "// &
    8017             :                           "all HOMOs are searched. If the LOCALIZE keyword is used, "// &
    8018             :                           "then all searched states are first localized.", &
    8019             :                           usage="N_SEARCH {integer}", &
    8020        8408 :                           default_i_val=-1)
    8021        8408 :       CALL section_add_keyword(subsection, keyword)
    8022        8408 :       CALL keyword_release(keyword)
    8023             : 
    8024             :       CALL keyword_create(keyword, __LOCATION__, name="LOCALIZE", &
    8025             :                           variants=s2a("LOC", "DO_LOC"), &
    8026             :                           description="Whether the N_SEARCH potential donor states should be "// &
    8027             :                           "actively localized. Necessary in case of excited atoms "// &
    8028             :                           "equivalent under symmetry or GW2X correction.", &
    8029             :                           usage="LOCALIZE {logical}", &
    8030             :                           default_l_val=.FALSE., &
    8031        8408 :                           lone_keyword_l_val=.TRUE.)
    8032        8408 :       CALL section_add_keyword(subsection, keyword)
    8033        8408 :       CALL keyword_release(keyword)
    8034             : 
    8035        8408 :       CALL section_add_subsection(section, subsection)
    8036        8408 :       CALL section_release(subsection)
    8037             : ! End of the donor states subsection
    8038             : 
    8039             : ! The OT solver subsection
    8040             :       CALL section_create(subsection, __LOCATION__, name="OT_SOLVER", &
    8041             :                           description="Specifications for the iterative OT solver. Note: only "// &
    8042             :                           "available within the Tamm-Dancoff approximation. Recommanded if excitations "// &
    8043             :                           "from multiple donor states take place.", &
    8044             :                           n_keywords=4, &
    8045             :                           n_subsections=0, &
    8046        8408 :                           repeats=.FALSE.)
    8047             : 
    8048             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    8049             :                           description="Enables the usage of the OT iterator solver", &
    8050             :                           usage="&OT_SOLVER {logical}", &
    8051             :                           default_l_val=.FALSE., &
    8052        8408 :                           lone_keyword_l_val=.TRUE.)
    8053        8408 :       CALL section_add_keyword(subsection, keyword)
    8054        8408 :       CALL keyword_release(keyword)
    8055             : 
    8056             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
    8057             :                           description="Maximum number of iterations allowed for the OT solver", &
    8058             :                           usage="MAX_ITER {integer}", &
    8059        8408 :                           default_i_val=50)
    8060        8408 :       CALL section_add_keyword(subsection, keyword)
    8061        8408 :       CALL keyword_release(keyword)
    8062             : 
    8063             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ITER", &
    8064             :                           description="Convergence threshold for the OT solver", &
    8065             :                           usage="EPS_ITER {double}", &
    8066        8408 :                           default_r_val=1.0E-4_dp)
    8067        8408 :       CALL section_add_keyword(subsection, keyword)
    8068        8408 :       CALL keyword_release(keyword)
    8069             : 
    8070             :       CALL keyword_create(keyword, __LOCATION__, name="MINIMIZER", &
    8071             :                           description="Minimizer to be used with the OT solver", &
    8072             :                           usage="MINIMIZER DIIS", &
    8073             :                           default_i_val=ot_mini_diis, &
    8074             :                           enum_c_vals=s2a("CG", "DIIS"), &
    8075             :                           enum_desc=s2a("Conjugated gradient: safer", &
    8076             :                                         "Direct inversion of the iterative subspace: faster"), &
    8077        8408 :                           enum_i_vals=(/ot_mini_cg, ot_mini_diis/))
    8078        8408 :       CALL section_add_keyword(subsection, keyword)
    8079        8408 :       CALL keyword_release(keyword)
    8080             : 
    8081        8408 :       CALL section_add_subsection(section, subsection)
    8082        8408 :       CALL section_release(subsection)
    8083             : ! End of the OT solver subsection
    8084             : 
    8085             :       CALL keyword_create(keyword, __LOCATION__, name="SPIN_ORBIT_COUPLING", &
    8086             :                           variants=(/"SOC"/), &
    8087             :                           description="Whether spin-orbit coupling should be added. "// &
    8088             :                           "Note: only applies for spin-restricted calculations with "// &
    8089             :                           "singlet and triplet excitations OR spin-unrestricted "// &
    8090             :                           "calculations with both spin-conserving and spin-flip.", &
    8091             :                           usage="SOC {logical}", &
    8092             :                           default_l_val=.FALSE., &
    8093       16816 :                           lone_keyword_l_val=.TRUE.)
    8094        8408 :       CALL section_add_keyword(section, keyword)
    8095        8408 :       CALL keyword_release(keyword)
    8096             : 
    8097             :       CALL keyword_create(keyword, __LOCATION__, name="TAMM_DANCOFF", &
    8098             :                           variants=(/"TDA"/), &
    8099             :                           description="Whether the Tamm-Dancoff approximation should be used.", &
    8100             :                           usage="TAMM_DANCOFF {logical}", &
    8101             :                           default_l_val=.TRUE., &
    8102       16816 :                           lone_keyword_l_val=.TRUE.)
    8103        8408 :       CALL section_add_keyword(section, keyword)
    8104        8408 :       CALL keyword_release(keyword)
    8105             : 
    8106             :       CALL keyword_create(keyword, __LOCATION__, name="GRID", &
    8107             :                           variants=(/"ATOMIC_GRID"/), &
    8108             :                           description="Specification of the atomic angular and radial grids for "// &
    8109             :                           "a given atomic kind. This keyword can/should be repeated "// &
    8110             :                           "for each excited kind. The default grid dimensions are "// &
    8111             :                           "those set for the GAPW ground state calculation. These "// &
    8112             :                           "grids are used for the xc-kernel integration. "// &
    8113             :                           "Usage: GRID < KIND > < LEBEDEV_GRID > < RADIAL_GRID >", &
    8114             :                           usage="GRID {string} {integer} {integer}", &
    8115       16816 :                           n_var=3, type_of_var=char_t, repeats=.TRUE.)
    8116        8408 :       CALL section_add_keyword(section, keyword)
    8117        8408 :       CALL keyword_release(keyword)
    8118             : 
    8119             :       CALL keyword_create(keyword, __LOCATION__, name="N_EXCITED", &
    8120             :                           variants=(/"N_ROOTS"/), &
    8121             :                           description="The number of excited states to compute per donor "// &
    8122             :                           "molecular orbital. (e.g. if 2p excitations, "// &
    8123             :                           "3*N_EXCITED excited states are considered). "// &
    8124             :                           "If N_EXCITED is set to -1, all excitations are considered", &
    8125             :                           usage="N_EXCITED {integer}", &
    8126       16816 :                           default_i_val=-1)
    8127        8408 :       CALL section_add_keyword(section, keyword)
    8128        8408 :       CALL keyword_release(keyword)
    8129             : 
    8130             :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_RANGE", &
    8131             :                           variants=s2a("E_RANGE"), &
    8132             :                           description="The energy range in eV for which excitations are considered. "// &
    8133             :                           "Only excitated states within the range of: first excitation "// &
    8134             :                           "energy + ENERGY_RANGE are kept. If ENERGY_RANGE "// &
    8135             :                           "and N_EXCITED are specified, the former has priority. "// &
    8136             :                           "Negative values are ignored and N_EXCITED takes over.", &
    8137             :                           usage="ENERGY_RANGE {real}", &
    8138        8408 :                           default_r_val=-1.0_dp)
    8139        8408 :       CALL section_add_keyword(section, keyword)
    8140        8408 :       CALL keyword_release(keyword)
    8141             : 
    8142             : !  The KERNEL subsection
    8143             :       CALL section_create(subsection, __LOCATION__, name="KERNEL", &
    8144             :                           description="Defines how the kernel is built in terms of functionals.", &
    8145             :                           n_keywords=1, &
    8146             :                           n_subsections=1, &
    8147        8408 :                           repeats=.FALSE.)
    8148             : 
    8149             :       CALL keyword_create(keyword, __LOCATION__, name="RI_REGION", &
    8150             :                           variants=(/"RI_RADIUS"/), &
    8151             :                           description="The region defined by a sphere of the given radius around "// &
    8152             :                           "the excited atom defining which RI_XAS basis elements are "// &
    8153             :                           "considered for the RI projection of the density. Each basis "// &
    8154             :                           "element which center is in this region is taken. The density "// &
    8155             :                           "for a given excited atom is expressed as : "// &
    8156             :                           "sum_ijkl P_ij (ijk) S_kl^-1 xi_l, where P_ij is the density "// &
    8157             :                           "matrix, i,j span the orbital basis and k,l the RI_XAS basis "// &
    8158             :                           "in the region. The larger the radius, the more basis "// &
    8159             :                           "functions to expand the density. However, it is assumed "// &
    8160             :                           "that it is a small number and the code does not scale well "// &
    8161             :                           "as the number of RI basis elements gets too large. "// &
    8162             :                           "Expressed in Angstrom. If the radius is set to 0.0, only "// &
    8163             :                           "the RI basis elements centered on the excited atom are used.", &
    8164             :                           usage="RI_REGION {real}", &
    8165       16816 :                           default_r_val=0.0_dp)
    8166        8408 :       CALL section_add_keyword(subsection, keyword)
    8167        8408 :       CALL keyword_release(keyword)
    8168             : 
    8169             : !  The XC_FUNCTIONAL subsubsection
    8170        8408 :       CALL create_xc_fun_section(subsubsection)
    8171        8408 :       CALL section_add_subsection(subsection, subsubsection)
    8172        8408 :       CALL section_release(subsubsection)
    8173             : 
    8174             : ! The EXACT_EXCHANGE subsubsection
    8175             :       CALL section_create(subsubsection, __LOCATION__, name="EXACT_EXCHANGE", &
    8176             :                           description="Whether exact-exchange should be added to the kernel and "// &
    8177             :                           "if so, with which fraction and operator.", &
    8178             :                           n_keywords=7, &
    8179             :                           n_subsections=1, &
    8180        8408 :                           repeats=.FALSE.)
    8181             : 
    8182             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    8183             :                           description="Enables the addition of exact exchange to the kernel.", &
    8184             :                           usage="&EXACT_EXCHANGE {logical}", &
    8185             :                           default_l_val=.FALSE., &
    8186        8408 :                           lone_keyword_l_val=.TRUE.)
    8187        8408 :       CALL section_add_keyword(subsubsection, keyword)
    8188        8408 :       CALL keyword_release(keyword)
    8189             : 
    8190             :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_TYPE", &
    8191             :                           variants=s2a("OP", "OPERATOR", "POTENTIAL"), &
    8192             :                           description="The type of operator used for exact exchange. The standard "// &
    8193             :                           "Coulomb operator cannot be used in periodic systems.", &
    8194             :                           usage="OPERATOR {string}", &
    8195             :                           repeats=.FALSE., &
    8196             :                           default_i_val=do_potential_coulomb, &
    8197             :                           enum_c_vals=s2a("COULOMB", "TRUNCATED", "SHORTRANGE"), &
    8198             :                           enum_desc=s2a("Standard Coulomb operator: 1/r", &
    8199             :                                         "Truncated Coulomb operator: 1/r if r < R_c, 0 otherwise ", &
    8200             :                                         "Short range: erfc(omega*r)/r"), &
    8201             :                           enum_i_vals=(/do_potential_coulomb, do_potential_truncated, &
    8202        8408 :                                         do_potential_short/))
    8203        8408 :       CALL section_add_keyword(subsubsection, keyword)
    8204        8408 :       CALL keyword_release(keyword)
    8205             : 
    8206             :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
    8207             :                           variants=s2a("R_C", "RC", "RANGE"), &
    8208             :                           description="The cutoff radius (in Angstrom) for the truncated Coulomb operator.", &
    8209             :                           usage="CUTOFF_RADIUS {double}", &
    8210             :                           default_r_val=0.0_dp, &
    8211        8408 :                           repeats=.FALSE.)
    8212        8408 :       CALL section_add_keyword(subsubsection, keyword)
    8213        8408 :       CALL keyword_release(keyword)
    8214             : 
    8215             :       CALL keyword_create(keyword, __LOCATION__, name="T_C_G_DATA", &
    8216             :                           description="Location of the file t_c_g.dat that contains the data for the "// &
    8217             :                           "evaluation of the truncated gamma function ", &
    8218             :                           usage="T_C_G_DATA {string}", &
    8219        8408 :                           default_c_val="t_c_g.dat")
    8220        8408 :       CALL section_add_keyword(subsubsection, keyword)
    8221        8408 :       CALL keyword_release(keyword)
    8222             : 
    8223             :       CALL keyword_create(keyword, __LOCATION__, name="OMEGA", &
    8224             :                           description="The range parameter for the short range operator (in 1/a0).", &
    8225             :                           usage="OMEGA {double}", &
    8226             :                           default_r_val=0.0_dp, &
    8227        8408 :                           repeats=.FALSE.)
    8228        8408 :       CALL section_add_keyword(subsubsection, keyword)
    8229        8408 :       CALL keyword_release(keyword)
    8230             : 
    8231             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_RANGE", &
    8232             :                           description="The threshold to determine the effective range of the short range "// &
    8233             :                           "operator: erfc(omega*eff_range)/eff_range = EPS_RANGE", &
    8234             :                           usage="EPS_RANGE = {double}", &
    8235             :                           default_r_val=1.0E-6_dp, &
    8236        8408 :                           repeats=.FALSE.)
    8237        8408 :       CALL section_add_keyword(subsubsection, keyword)
    8238        8408 :       CALL keyword_release(keyword)
    8239             : 
    8240             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_SCREENING", &
    8241             :                           variants=s2a("EPS_SCREEN"), &
    8242             :                           description="A threshold to determine which primitive 3-center integrals "// &
    8243             :                           "are kept for contraction, as the latter operation can be "// &
    8244             :                           "expensive (especially for large basis sets ). "// &
    8245             :                           "If |(ab|c)| < EPS_SCREENNING, it is discarded.", &
    8246             :                           default_r_val=1.0E-8_dp, &
    8247        8408 :                           repeats=.FALSE.)
    8248        8408 :       CALL section_add_keyword(subsubsection, keyword)
    8249        8408 :       CALL keyword_release(keyword)
    8250             : 
    8251             :       CALL keyword_create(keyword, __LOCATION__, name="SCALE", &
    8252             :                           variants=s2a("FRACTION"), &
    8253             :                           description="Scaling of the exact exchange contribution.", &
    8254        8408 :                           default_r_val=1.0_dp)
    8255        8408 :       CALL section_add_keyword(subsubsection, keyword)
    8256        8408 :       CALL keyword_release(keyword)
    8257             : 
    8258             :       !The RI metric subsection
    8259             :       CALL section_create(subsubsubsection, __LOCATION__, name="RI_METRIC", &
    8260             :                           description="This subsection allows for the definition of an exchange "// &
    8261             :                           "RI metric that is different from the main exchange potential. "// &
    8262             :                           "By default (i.e. if this subsection is ignored), the "// &
    8263             :                           "exchange kernel is computed in the V approximation: "// &
    8264             :                           "(ab|ij) = (ab|P) V^-1 (Q|ij), where V = (P|Q). With a RI "// &
    8265             :                           "metric, we have a 2 step RI involving the metric potential "// &
    8266             :                           "for the 3-center integrals: "// &
    8267             :                           "(ab|ij) = (ab!P) (P!Q)^-1 (Q|R) (R!S)^-1 (S!ij), where | "// &
    8268             :                           "stands for the exchange potential and ! for the metric "// &
    8269             :                           "potential. This allows for drastic screening of the "// &
    8270             :                           "3-center integrals by selecting shorter range metric.", &
    8271             :                           n_keywords=5, &
    8272             :                           n_subsections=0, &
    8273        8408 :                           repeats=.FALSE.)
    8274             : 
    8275             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    8276             :                           description="Enables the use of a RI metric.", &
    8277             :                           usage="&EXACT_EXCHANGE {logical}", &
    8278             :                           default_l_val=.FALSE., &
    8279        8408 :                           lone_keyword_l_val=.TRUE.)
    8280        8408 :       CALL section_add_keyword(subsubsubsection, keyword)
    8281        8408 :       CALL keyword_release(keyword)
    8282             : 
    8283             :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_TYPE", &
    8284             :                           variants=s2a("OP", "OPERATOR", "POTENTIAL"), &
    8285             :                           description="The type of operator used for the metric.", &
    8286             :                           usage="OPERATOR {string}", &
    8287             :                           repeats=.FALSE., &
    8288             :                           default_i_val=do_potential_id, &
    8289             :                           enum_c_vals=s2a("OVERLAP", "TRUNCATED", "SHORTRANGE"), &
    8290             :                           enum_desc=s2a("Overlap operator (=identity)", &
    8291             :                                         "Truncated Coulomb operator: 1/r if r < R_c, 0 otherwise ", &
    8292             :                                         "Short range: erfc(omega*r)/r"), &
    8293             :                           enum_i_vals=(/do_potential_id, do_potential_truncated, &
    8294        8408 :                                         do_potential_short/))
    8295        8408 :       CALL section_add_keyword(subsubsubsection, keyword)
    8296        8408 :       CALL keyword_release(keyword)
    8297             : 
    8298             :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
    8299             :                           variants=s2a("R_C", "RC", "RANGE"), &
    8300             :                           description="The cutoff radius (in Angstrom) for the truncated Coulomb operator.", &
    8301             :                           usage="CUTOFF_RADIUS {double}", &
    8302             :                           default_r_val=0.0_dp, &
    8303        8408 :                           repeats=.FALSE.)
    8304        8408 :       CALL section_add_keyword(subsubsubsection, keyword)
    8305        8408 :       CALL keyword_release(keyword)
    8306             : 
    8307             :       CALL keyword_create(keyword, __LOCATION__, name="T_C_G_DATA", &
    8308             :                           description="Location of the file t_c_g.dat that contains the data for the "// &
    8309             :                           "evaluation of the truncated gamma function ", &
    8310             :                           usage="T_C_G_DATA {string}", &
    8311        8408 :                           default_c_val="t_c_g.dat")
    8312        8408 :       CALL section_add_keyword(subsubsubsection, keyword)
    8313        8408 :       CALL keyword_release(keyword)
    8314             : 
    8315             :       CALL keyword_create(keyword, __LOCATION__, name="OMEGA", &
    8316             :                           description="The range parameter for the short range operator (in 1/a0).", &
    8317             :                           usage="OMEGA {double}", &
    8318             :                           default_r_val=0.0_dp, &
    8319        8408 :                           repeats=.FALSE.)
    8320        8408 :       CALL section_add_keyword(subsubsubsection, keyword)
    8321        8408 :       CALL keyword_release(keyword)
    8322             : 
    8323        8408 :       CALL section_add_subsection(subsubsection, subsubsubsection)
    8324        8408 :       CALL section_release(subsubsubsection)
    8325             : 
    8326        8408 :       CALL section_add_subsection(subsection, subsubsection)
    8327        8408 :       CALL section_release(subsubsection)
    8328             : 
    8329        8408 :       CALL section_add_subsection(section, subsection)
    8330        8408 :       CALL section_release(subsection)
    8331             : ! End of Kernel subsection
    8332             : 
    8333             :       CALL section_create(subsection, __LOCATION__, "PRINT", "Controls the printing of information during "// &
    8334        8408 :                           "XAS TDP calculations", repeats=.FALSE.)
    8335             : 
    8336             :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="SPECTRUM", &
    8337             :                                        description="Controles the dumping of the XAS TDP spectrum in output files", &
    8338        8408 :                                        print_level=low_print_level, filename="", common_iter_levels=3)
    8339        8408 :       CALL section_add_subsection(subsection, print_key)
    8340        8408 :       CALL section_release(print_key)
    8341             : 
    8342             :       CALL cp_print_key_section_create(print_key, __LOCATION__, name="RESTART_WFN", &
    8343             :                                        description="Controles the dumping of a MO restart file for a given "// &
    8344             :                                        "excited state index. Only for K-edge RKS calculations. "// &
    8345             :                                        "Can be repeated to get multiple *.wfn files at once.", &
    8346        8408 :                                        print_level=debug_print_level, filename="", common_iter_levels=1)
    8347             :       CALL keyword_create(keyword, __LOCATION__, name="EXCITED_STATE_INDEX", variants=(/"INDEX"/), &
    8348             :                           description="The index of the excited state that should be dumped", &
    8349       16816 :                           usage="INDEX {int}", default_i_val=1, repeats=.TRUE.)
    8350        8408 :       CALL section_add_keyword(print_key, keyword)
    8351        8408 :       CALL keyword_release(keyword)
    8352             : 
    8353        8408 :       CALL section_add_subsection(subsection, print_key)
    8354        8408 :       CALL section_release(print_key)
    8355             : 
    8356        8408 :       CALL create_pdos_section(print_key)
    8357        8408 :       CALL section_add_subsection(subsection, print_key)
    8358        8408 :       CALL section_release(print_key)
    8359             : 
    8360             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CUBES", &
    8361             :                                        description="Controls the printing of the linear-response orbitals "// &
    8362             :                                        "as *.cube files.", &
    8363             :                                        print_level=high_print_level, common_iter_levels=1, &
    8364        8408 :                                        add_last=add_last_numeric, filename="")
    8365             : 
    8366             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    8367             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    8368             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    8369             :                           " 1 number valid for all components.", &
    8370        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    8371        8408 :       CALL section_add_keyword(print_key, keyword)
    8372        8408 :       CALL keyword_release(keyword)
    8373             : 
    8374             :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LU_BOUNDS", &
    8375             :                           variants=(/"CUBES_LU"/), &
    8376             :                           description="The lower and upper index of the excited states to be printed as cube", &
    8377             :                           usage="CUBES_LU_BOUNDS integer integer", &
    8378       16816 :                           n_var=2, default_i_vals=(/1, 0/), type_of_var=integer_t)
    8379        8408 :       CALL section_add_keyword(print_key, keyword)
    8380        8408 :       CALL keyword_release(keyword)
    8381             : 
    8382             :       CALL keyword_create(keyword, __LOCATION__, name="CUBES_LIST", &
    8383             :                           description="Indexes of the excited states to be printed as cube files "// &
    8384             :                           "This keyword can be repeated several times "// &
    8385             :                           "(useful if you have to specify many indexes).", &
    8386             :                           usage="CUBES_LIST 1 2", &
    8387        8408 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    8388        8408 :       CALL section_add_keyword(print_key, keyword)
    8389        8408 :       CALL keyword_release(keyword)
    8390             : 
    8391             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    8392             :                           description="append the cube files when they already exist", &
    8393        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    8394        8408 :       CALL section_add_keyword(print_key, keyword)
    8395        8408 :       CALL keyword_release(keyword)
    8396             : 
    8397        8408 :       CALL section_add_subsection(subsection, print_key)
    8398        8408 :       CALL section_release(print_key)
    8399             : 
    8400             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
    8401             :                                        description="Controls the dumping of LR-orbitals coefficients "// &
    8402             :                                        "and corresponding excitation energies such that "// &
    8403             :                                        "the program can be restarted for PDOS or CUBE "// &
    8404             :                                        "printing without the heavy computing.", &
    8405        8408 :                                        print_level=high_print_level, filename="", common_iter_levels=3)
    8406        8408 :       CALL section_add_subsection(subsection, print_key)
    8407        8408 :       CALL section_release(print_key)
    8408             : 
    8409        8408 :       CALL section_add_subsection(section, subsection)
    8410        8408 :       CALL section_release(subsection)
    8411             : 
    8412        8408 :    END SUBROUTINE create_xas_tdp_section
    8413             : 
    8414             : ! **************************************************************************************************
    8415             : !> \brief      Create CP2K input section for the smearing of occupation numbers
    8416             : !> \param section ...
    8417             : !> \date       27.08.2008
    8418             : !> \author     Matthias Krack (MK)
    8419             : !> \version    1.0
    8420             : ! **************************************************************************************************
    8421       19592 :    SUBROUTINE create_smear_section(section)
    8422             : 
    8423             :       TYPE(section_type), POINTER                        :: section
    8424             : 
    8425             :       TYPE(keyword_type), POINTER                        :: keyword
    8426             : 
    8427       19592 :       CPASSERT(.NOT. ASSOCIATED(section))
    8428             : 
    8429             :       CALL section_create(section, __LOCATION__, &
    8430             :                           name="SMEAR", &
    8431             :                           description="Define the smearing of the MO occupation numbers", &
    8432             :                           n_keywords=6, &
    8433             :                           n_subsections=0, &
    8434       19592 :                           repeats=.FALSE.)
    8435             : 
    8436       19592 :       NULLIFY (keyword)
    8437             : 
    8438             :       CALL keyword_create(keyword, __LOCATION__, &
    8439             :                           name="_SECTION_PARAMETERS_", &
    8440             :                           description="Controls the activation of smearing", &
    8441             :                           usage="&SMEAR ON", &
    8442             :                           default_l_val=.FALSE., &
    8443       19592 :                           lone_keyword_l_val=.TRUE.)
    8444       19592 :       CALL section_add_keyword(section, keyword)
    8445       19592 :       CALL keyword_release(keyword)
    8446             : 
    8447             :       CALL keyword_create(keyword, __LOCATION__, &
    8448             :                           name="METHOD", &
    8449             :                           description="Smearing method to be applied", &
    8450             :                           usage="METHOD Fermi_Dirac", &
    8451             :                           default_i_val=smear_energy_window, &
    8452             :                           enum_c_vals=s2a("FERMI_DIRAC", "ENERGY_WINDOW", "LIST"), &
    8453             :                           enum_i_vals=(/smear_fermi_dirac, smear_energy_window, smear_list/), &
    8454             :                           enum_desc=s2a("Fermi-Dirac distribution defined by the keyword ELECTRONIC_TEMPERATURE", &
    8455             :                                         "Energy window defined by the keyword WINDOW_SIZE", &
    8456       19592 :                                         "Use a fixed list of occupations"))
    8457       19592 :       CALL section_add_keyword(section, keyword)
    8458       19592 :       CALL keyword_release(keyword)
    8459             : 
    8460             :       CALL keyword_create(keyword, __LOCATION__, &
    8461             :                           name="LIST", &
    8462             :                           description="A list of fractional occupations to use. Must match the number of states "// &
    8463             :                           "and sum up to the correct number of electrons", &
    8464             :                           repeats=.FALSE., &
    8465             :                           n_var=-1, &
    8466             :                           type_of_var=real_t, &
    8467       19592 :                           usage="LIST 2.0 0.6666 0.6666 0.66666 0.0 0.0")
    8468       19592 :       CALL section_add_keyword(section, keyword)
    8469       19592 :       CALL keyword_release(keyword)
    8470             : 
    8471             :       CALL keyword_create(keyword, __LOCATION__, &
    8472             :                           name="ELECTRONIC_TEMPERATURE", &
    8473             :                           variants=s2a("ELEC_TEMP", "TELEC"), &
    8474             :                           description="Electronic temperature in the case of Fermi-Dirac smearing", &
    8475             :                           repeats=.FALSE., &
    8476             :                           n_var=1, &
    8477             :                           type_of_var=real_t, &
    8478             :                           default_r_val=cp_unit_to_cp2k(value=300.0_dp, unit_str="K"), &
    8479             :                           unit_str="K", &
    8480       19592 :                           usage="ELECTRONIC_TEMPERATURE [K] 300")
    8481       19592 :       CALL section_add_keyword(section, keyword)
    8482       19592 :       CALL keyword_release(keyword)
    8483             : 
    8484             :       CALL keyword_create(keyword, __LOCATION__, &
    8485             :                           name="EPS_FERMI_DIRAC", &
    8486             :                           description="Accuracy checks on occupation numbers use this as a tolerance", &
    8487             :                           repeats=.FALSE., &
    8488             :                           n_var=1, &
    8489             :                           type_of_var=real_t, &
    8490             :                           default_r_val=1.0E-10_dp, &
    8491       19592 :                           usage="EPS_FERMI_DIRAC 1.0E-6")
    8492       19592 :       CALL section_add_keyword(section, keyword)
    8493       19592 :       CALL keyword_release(keyword)
    8494             : 
    8495             :       CALL keyword_create(keyword, __LOCATION__, &
    8496             :                           name="WINDOW_SIZE", &
    8497             :                           description="Size of the energy window centred at the Fermi level", &
    8498             :                           repeats=.FALSE., &
    8499             :                           n_var=1, &
    8500             :                           type_of_var=real_t, &
    8501             :                           default_r_val=0.0_dp, &
    8502             :                           unit_str="au_e", &
    8503       19592 :                           usage="WINDOW_SIZE [eV] 0.3")
    8504       19592 :       CALL section_add_keyword(section, keyword)
    8505       19592 :       CALL keyword_release(keyword)
    8506             : 
    8507             :       CALL keyword_create(keyword, __LOCATION__, name="FIXED_MAGNETIC_MOMENT", &
    8508             :                           description="Imposed difference between the numbers of electrons of spin up "// &
    8509             :                           "and spin down: m = n(up) - n(down). A negative value (default) allows "// &
    8510             :                           "for a change of the magnetic moment. -1 specifically keeps an integer "// &
    8511             :                           "number of spin up and spin down electrons.", &
    8512             :                           repeats=.FALSE., &
    8513             :                           n_var=1, &
    8514             :                           type_of_var=real_t, &
    8515             :                           default_r_val=-100.0_dp, &
    8516       19592 :                           usage="FIXED_MAGNETIC_MOMENT 1.5")
    8517       19592 :       CALL section_add_keyword(section, keyword)
    8518       19592 :       CALL keyword_release(keyword)
    8519             : 
    8520       19592 :    END SUBROUTINE create_smear_section
    8521             : 
    8522             : ! **************************************************************************************************
    8523             : !> \brief ...
    8524             : !> \param section ...
    8525             : ! **************************************************************************************************
    8526        8408 :    SUBROUTINE create_rtp_section(section)
    8527             :       TYPE(section_type), POINTER                        :: section
    8528             : 
    8529             :       TYPE(keyword_type), POINTER                        :: keyword
    8530             :       TYPE(section_type), POINTER                        :: print_key, print_section
    8531             : 
    8532        8408 :       NULLIFY (keyword)
    8533        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    8534             :       CALL section_create(section, __LOCATION__, name="REAL_TIME_PROPAGATION", &
    8535             :                           description="Parameters needed to set up the real time propagation"// &
    8536             :                           " for the electron dynamics. This currently works only in the NVE ensemble.", &
    8537             :                           n_keywords=4, n_subsections=4, repeats=.FALSE., &
    8538       25224 :                           citations=(/Kunert2003, Andermatt2016/))
    8539             : 
    8540             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
    8541             :                           description="Maximal number of iterations for the self consistent propagator loop.", &
    8542             :                           usage="MAX_ITER 10", &
    8543        8408 :                           default_i_val=10)
    8544        8408 :       CALL section_add_keyword(section, keyword)
    8545        8408 :       CALL keyword_release(keyword)
    8546             : 
    8547             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ITER", &
    8548             :                           description="Convergence criterion for the self consistent propagator loop.", &
    8549             :                           usage="EPS_ITER 1.0E-5", &
    8550        8408 :                           default_r_val=1.0E-7_dp)
    8551        8408 :       CALL section_add_keyword(section, keyword)
    8552        8408 :       CALL keyword_release(keyword)
    8553             : 
    8554             :       CALL keyword_create(keyword, __LOCATION__, name="ASPC_ORDER", &
    8555             :                           description="Speciefies how many steps will be used for extrapolation. "// &
    8556             :                           "One will be always used which is means X(t+dt)=X(t)", &
    8557             :                           usage="ASPC_ORDER 3", &
    8558        8408 :                           default_i_val=3)
    8559        8408 :       CALL section_add_keyword(section, keyword)
    8560        8408 :       CALL keyword_release(keyword)
    8561             : 
    8562             :       CALL keyword_create(keyword, __LOCATION__, name="MAT_EXP", &
    8563             :                           description="Which method should be used to calculate the exponential"// &
    8564             :                           " in the propagator. It is recommended to use BCH when employing density_propagation "// &
    8565             :                           "and ARNOLDI otherwise.", &
    8566             :                           usage="MAT_EXP TAYLOR", default_i_val=do_arnoldi, &
    8567             :                           enum_c_vals=s2a("TAYLOR", "PADE", "ARNOLDI", "BCH"), &
    8568             :                           enum_i_vals=(/do_taylor, do_pade, do_arnoldi, do_bch/), &
    8569             :                           enum_desc=s2a("exponential is evaluated using scaling and squaring in combination"// &
    8570             :                                         " with a taylor expansion of the exponential.", &
    8571             :                                         "uses scaling and squaring together with the pade approximation", &
    8572             :                                         "uses arnoldi subspace algorithm to compute exp(H)*MO directly, can't be used in "// &
    8573             :                                         "combination with Crank Nicholson or density propagation", &
    8574             :                                         "Uses a Baker-Campbell-Hausdorff expansion to propagate the density matrix,"// &
    8575        8408 :                                         " only works for density propagation"))
    8576        8408 :       CALL section_add_keyword(section, keyword)
    8577        8408 :       CALL keyword_release(keyword)
    8578             : 
    8579             :       CALL keyword_create(keyword, __LOCATION__, name="DENSITY_PROPAGATION", &
    8580             :                           description="The density matrix is propagated instead of the molecular orbitals. "// &
    8581             :                           "This can allow a linear scaling simulation. The density matrix is filtered with "// &
    8582             :                           "the threshold based on the EPS_FILTER keyword from the LS_SCF section", &
    8583             :                           usage="DENSITY_PROPAGATION .TRUE.", &
    8584        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    8585        8408 :       CALL section_add_keyword(section, keyword)
    8586        8408 :       CALL keyword_release(keyword)
    8587             : 
    8588             :       CALL keyword_create(keyword, __LOCATION__, name="SC_CHECK_START", &
    8589             :                           description="Speciefies how many iteration steps will be done without "// &
    8590             :                           "a check for self consistency. Can save some time in big calculations.", &
    8591             :                           usage="SC_CHECK_START 3", &
    8592        8408 :                           default_i_val=0)
    8593        8408 :       CALL section_add_keyword(section, keyword)
    8594        8408 :       CALL keyword_release(keyword)
    8595             : 
    8596             :       CALL keyword_create(keyword, __LOCATION__, name="EXP_ACCURACY", &
    8597             :                           description="Accuracy for the taylor and pade approximation. "// &
    8598             :                           "This is only an upper bound bound since the norm used for the guess "// &
    8599             :                           "is an upper bound for the needed one.", &
    8600             :                           usage="EXP_ACCURACY 1.0E-6", &
    8601        8408 :                           default_r_val=1.0E-9_dp)
    8602        8408 :       CALL section_add_keyword(section, keyword)
    8603        8408 :       CALL keyword_release(keyword)
    8604             : 
    8605             :       CALL keyword_create(keyword, __LOCATION__, name="PROPAGATOR", &
    8606             :                           description="Which propagator should be used for the orbitals", &
    8607             :                           usage="PROPAGATOR ETRS", default_i_val=do_etrs, &
    8608             :                           enum_c_vals=s2a("ETRS", "CN", "EM"), &
    8609             :                           enum_i_vals=(/do_etrs, do_cn, do_em/), &
    8610             :                           enum_desc=s2a("enforced time reversible symmetry", &
    8611             :                                         "Crank Nicholson propagator", &
    8612        8408 :                                         "Exponential midpoint propagator"))
    8613        8408 :       CALL section_add_keyword(section, keyword)
    8614        8408 :       CALL keyword_release(keyword)
    8615             : 
    8616             :       CALL keyword_create(keyword, __LOCATION__, name="INITIAL_WFN", &
    8617             :                           description="Controls the initial WFN used for propagation. "// &
    8618             :                           "Note that some energy contributions may not be "// &
    8619             :                           "initialized in the restart cases, for instance "// &
    8620             :                           "electronic entropy energy in the case of smearing.", &
    8621             :                           usage="INITIAL_WFN SCF_WFN", default_i_val=use_scf_wfn, &
    8622             :                           enum_c_vals=s2a("SCF_WFN", "RESTART_WFN", "RT_RESTART"), &
    8623             :                           enum_i_vals=(/use_scf_wfn, use_restart_wfn, use_rt_restart/), &
    8624             :                           enum_desc=s2a("An SCF run is performed to get the initial state.", &
    8625             :                                         "A wavefunction from a previous SCF is propagated. Especially useful,"// &
    8626             :                                         " if electronic constraints or restraints are used in the previous calculation, "// &
    8627             :                                         "since these do not work in the rtp scheme.", &
    8628        8408 :                                         "use the wavefunction of a real time propagation/ehrenfest run"))
    8629        8408 :       CALL section_add_keyword(section, keyword)
    8630        8408 :       CALL keyword_release(keyword)
    8631             : 
    8632             :       CALL keyword_create(keyword, __LOCATION__, name="APPLY_WFN_MIX_INIT_RESTART", &
    8633             :                           description="If set to True and in the case of INITIAL_WFN=RESTART_WFN, call the "// &
    8634             :                           "DFT%PRINT%WFN_MIX section to mix the read initial wfn. The starting wave-function of the "// &
    8635             :                           "RTP will be the mixed one. Setting this to True without a defined WFN_MIX section will "// &
    8636             :                           "not do anything as defining a WFN_MIX section without this keyword for RTP run with "// &
    8637             :                           "INITIAL_WFN=RESTART_WFN. Note that if INITIAL_WFN=SCF_WFN, this keyword is not needed to "// &
    8638             :                           "apply the mixing defined in the WFN_MIX section. Default is False.", &
    8639             :                           usage="APPLY_WFN_MIX_INIT_RESTART", &
    8640        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    8641        8408 :       CALL section_add_keyword(section, keyword)
    8642        8408 :       CALL keyword_release(keyword)
    8643             : 
    8644             :       CALL keyword_create(keyword, __LOCATION__, name="APPLY_DELTA_PULSE", &
    8645             :                           description="Applies a delta kick to the initial wfn (only RTP for now - the EMD"// &
    8646             :                           " case is not yet implemented). Only work for INITIAL_WFN=SCF_WFN", &
    8647             :                           usage="APPLY_DELTA_PULSE", &
    8648        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    8649        8408 :       CALL section_add_keyword(section, keyword)
    8650        8408 :       CALL keyword_release(keyword)
    8651             : 
    8652             :       CALL keyword_create(keyword, __LOCATION__, name="APPLY_DELTA_PULSE_MAG", &
    8653             :                           description="Applies a magnetic delta kick to the initial wfn (only RTP for now - the EMD"// &
    8654             :                           " case is not yet implemented). Only work for INITIAL_WFN=SCF_WFN", &
    8655             :                           usage="APPLY_DELTA_PULSE_MAG", &
    8656        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    8657        8408 :       CALL section_add_keyword(section, keyword)
    8658        8408 :       CALL keyword_release(keyword)
    8659             : 
    8660             :       CALL keyword_create(keyword, __LOCATION__, name="VELOCITY_GAUGE", &
    8661             :                           description="Perform propagation in the velocity gauge using the explicit vector potential"// &
    8662             :                           " only a constant vector potential as of now (corresonding to a delta-pulse)."// &
    8663             :                           " uses DELTA_PULSE_SCALE and DELTA_PULSE_DIRECTION to define the vector potential", &
    8664             :                           usage="VELOCITY_GAUGE T", &
    8665        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    8666        8408 :       CALL section_add_keyword(section, keyword)
    8667        8408 :       CALL keyword_release(keyword)
    8668             : 
    8669             :       CALL keyword_create(keyword, __LOCATION__, name="GAUGE_ORIG", &
    8670             :                           description="Define gauge origin for magnetic perturbation", &
    8671             :                           usage="GAUGE_ORIG COM", &
    8672             :                           enum_c_vals=s2a("COM", "COAC", "USER_DEFINED", "ZERO"), &
    8673             :                           enum_desc=s2a("Use Center of Mass", &
    8674             :                                         "Use Center of Atomic Charges", &
    8675             :                                         "Use User Defined Point (Keyword:REF_POINT)", &
    8676             :                                         "Use Origin of Coordinate System"), &
    8677             :                           enum_i_vals=(/use_mom_ref_com, &
    8678             :                                         use_mom_ref_coac, &
    8679             :                                         use_mom_ref_user, &
    8680             :                                         use_mom_ref_zero/), &
    8681        8408 :                           default_i_val=use_mom_ref_com)
    8682        8408 :       CALL section_add_keyword(section, keyword)
    8683        8408 :       CALL keyword_release(keyword)
    8684             : 
    8685             :       CALL keyword_create(keyword, __LOCATION__, name="GAUGE_ORIG_MANUAL", &
    8686             :                           description="Manually defined gauge origin for magnetic perturbation [in Bohr!]", &
    8687             :                           usage="GAUGE_ORIG_MANUAL x y z", &
    8688             :                           repeats=.FALSE., &
    8689             :                           n_var=3, default_r_vals=(/0._dp, 0._dp, 0._dp/), &
    8690             :                           type_of_var=real_t, &
    8691        8408 :                           unit_str='bohr')
    8692        8408 :       CALL section_add_keyword(section, keyword)
    8693        8408 :       CALL keyword_release(keyword)
    8694             : 
    8695             :       CALL keyword_create(keyword, __LOCATION__, name="VG_COM_NL", &
    8696             :                           description="apply gauge transformed non-local potential term"// &
    8697             :                           " only affects VELOCITY_GAUGE=.TRUE.", &
    8698             :                           usage="VG_COM_NL T", &
    8699        8408 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    8700        8408 :       CALL section_add_keyword(section, keyword)
    8701        8408 :       CALL keyword_release(keyword)
    8702             : 
    8703             :       CALL keyword_create(keyword, __LOCATION__, name="COM_NL", &
    8704             :                           description="Include non-local commutator for periodic delta pulse."// &
    8705             :                           " only affects PERIODIC=.TRUE.", &
    8706             :                           usage="COM_NL", &
    8707        8408 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    8708        8408 :       CALL section_add_keyword(section, keyword)
    8709        8408 :       CALL keyword_release(keyword)
    8710             : 
    8711             :       CALL keyword_create(keyword, __LOCATION__, name="LEN_REP", &
    8712             :                           description="Use length representation delta pulse (in conjunction with PERIODIC T)."// &
    8713             :                           " This corresponds to a 1st order perturbation in the length gauge."// &
    8714             :                           " Note that this is NOT compatible with a periodic calculation!"// &
    8715             :                           " Uses the reference point defined in DFT%PRINT%MOMENTS ", &
    8716             :                           usage="LEN_REP T", &
    8717        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    8718        8408 :       CALL section_add_keyword(section, keyword)
    8719        8408 :       CALL keyword_release(keyword)
    8720             : 
    8721             :       CALL keyword_create(keyword, __LOCATION__, name="PERIODIC", &
    8722             :                           description="Apply a delta-kick that is compatible with periodic boundary conditions"// &
    8723             :                           " for any value of DELTA_PULSE_SCALE. Uses perturbation theory for the preparation of"// &
    8724             :                           " the initial wfn with the velocity operator as perturbation."// &
    8725             :                           " If LEN_REP is .FALSE. this corresponds to a first order velocity gauge."// &
    8726             :                           " Note that the pulse is only applied when INITIAL_WFN is set to SCF_WFN,"// &
    8727             :                           " and not for restarts (RT_RESTART).", &
    8728             :                           usage="PERIODIC", &
    8729        8408 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    8730        8408 :       CALL section_add_keyword(section, keyword)
    8731        8408 :       CALL keyword_release(keyword)
    8732             : 
    8733             :       CALL keyword_create(keyword, __LOCATION__, name="DELTA_PULSE_DIRECTION", &
    8734             :                           description="Direction of the applied electric field. The k vector is given as"// &
    8735             :                           " 2*Pi*[i,j,k]*inv(h_mat), which for PERIODIC .FALSE. yields exp(ikr) periodic with"// &
    8736             :                           " the unit cell, only if DELTA_PULSE_SCALE is set to unity. For an orthorhombic cell"// &
    8737             :                           " [1,0,0] yields [2*Pi/L_x,0,0]. For small cells, this results in a very large kick.", &
    8738             :                           usage="DELTA_PULSE_DIRECTION 1 1 1", n_var=3, default_i_vals=(/1, 0, 0/), &
    8739        8408 :                           type_of_var=integer_t)
    8740        8408 :       CALL section_add_keyword(section, keyword)
    8741        8408 :       CALL keyword_release(keyword)
    8742             : 
    8743             :       CALL keyword_create(keyword, __LOCATION__, name="DELTA_PULSE_SCALE", &
    8744             :                           description="Scale the k vector, which for PERIODIC .FALSE. results in exp(ikr) no"// &
    8745             :                           " longer being periodic with the unit cell. The norm of k is the strength of the"// &
    8746             :                           " applied electric field in atomic units.", &
    8747        8408 :                           usage="DELTA_PULSE_SCALE 0.01 ", n_var=1, default_r_val=0.001_dp)
    8748        8408 :       CALL section_add_keyword(section, keyword)
    8749        8408 :       CALL keyword_release(keyword)
    8750             : 
    8751             :       CALL keyword_create(keyword, __LOCATION__, name="HFX_BALANCE_IN_CORE", &
    8752             :                           description="If HFX is used, this keyword forces a redistribution/recalculation"// &
    8753             :                           " of the integrals, balanced with respect to the in core steps.", &
    8754             :                           usage="HFX_BALANCE_IN_CORE", &
    8755        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    8756        8408 :       CALL section_add_keyword(section, keyword)
    8757        8408 :       CALL keyword_release(keyword)
    8758             : 
    8759             :       CALL keyword_create(keyword, __LOCATION__, name="MCWEENY_MAX_ITER", &
    8760             :                           description="Determines the maximum amount of McWeeny steps used after each converged"// &
    8761             :                           " step in density propagation", &
    8762        8408 :                           usage="MCWEENY_MAX_ITER 2", default_i_val=1)
    8763        8408 :       CALL section_add_keyword(section, keyword)
    8764        8408 :       CALL keyword_release(keyword)
    8765             : 
    8766             :       CALL keyword_create( &
    8767             :          keyword, __LOCATION__, name="ACCURACY_REFINEMENT", &
    8768             :          description="If using density propagation some parts should be calculated with a higher accuracy than the rest"// &
    8769             :          " to reduce numerical noise. This factor determines by how much the filtering threshold is"// &
    8770             :          " reduced for these calculations.", &
    8771        8408 :          usage="ACCURACY_REFINEMENT", default_i_val=100)
    8772        8408 :       CALL section_add_keyword(section, keyword)
    8773        8408 :       CALL keyword_release(keyword)
    8774             : 
    8775             :       CALL keyword_create(keyword, __LOCATION__, name="MCWEENY_EPS", &
    8776             :                           description="Threshold after which McWeeny is terminated", &
    8777             :                           usage="MCWEENY_EPS 0.00001", &
    8778        8408 :                           default_r_val=0.0_dp)
    8779        8408 :       CALL section_add_keyword(section, keyword)
    8780        8408 :       CALL keyword_release(keyword)
    8781             : 
    8782        8408 :       NULLIFY (print_section)
    8783             :       CALL section_create(print_section, __LOCATION__, name="PRINT", &
    8784             :                           description="Section of possible print options for an RTP runs", &
    8785        8408 :                           repeats=.FALSE.)
    8786             : 
    8787        8408 :       NULLIFY (print_key)
    8788             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
    8789             :                                        description="Controls the printing within real time propagation and Eherenfest dynamics", &
    8790        8408 :                                        print_level=low_print_level, filename="__STD_OUT__")
    8791        8408 :       CALL section_add_subsection(print_section, print_key)
    8792        8408 :       CALL section_release(print_key)
    8793             : 
    8794             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
    8795             :                                        description="Controls the dumping of the MO restart file during rtp. "// &
    8796             :                                        "By default keeps a short history of three restarts. "// &
    8797             :                                        "See also RESTART_HISTORY. In density propagation this controls the printing of P.", &
    8798             :                                        print_level=low_print_level, common_iter_levels=3, &
    8799             :                                        each_iter_names=s2a("MD"), each_iter_values=(/20/), &
    8800        8408 :                                        add_last=add_last_numeric, filename="RESTART")
    8801             :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    8802             :                           description="Specifies the maximum number of backup copies.", &
    8803             :                           usage="BACKUP_COPIES {int}", &
    8804        8408 :                           default_i_val=1)
    8805        8408 :       CALL section_add_keyword(print_key, keyword)
    8806        8408 :       CALL keyword_release(keyword)
    8807        8408 :       CALL section_add_subsection(print_section, print_key)
    8808        8408 :       CALL section_release(print_key)
    8809             : 
    8810             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART_HISTORY", &
    8811             :                                        description="Dumps unique MO restart files during the run keeping all of them. "// &
    8812             :                                        "In density propagation it dumps the density matrix instead", &
    8813             :                                        print_level=low_print_level, common_iter_levels=0, &
    8814             :                                        each_iter_names=s2a("MD"), &
    8815             :                                        each_iter_values=(/500/), &
    8816        8408 :                                        filename="RESTART")
    8817             :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    8818             :                           description="Specifies the maximum number of backup copies.", &
    8819             :                           usage="BACKUP_COPIES {int}", &
    8820        8408 :                           default_i_val=1)
    8821        8408 :       CALL section_add_keyword(print_key, keyword)
    8822        8408 :       CALL keyword_release(keyword)
    8823        8408 :       CALL section_add_subsection(print_section, print_key)
    8824        8408 :       CALL section_release(print_key)
    8825             : 
    8826             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FIELD", &
    8827             :                                        description="Print the time-dependent field applied during an EMD simulation in "// &
    8828             :                                        "atomic unit.", &
    8829             :                                        print_level=high_print_level, common_iter_levels=-1, &
    8830             :                                        each_iter_names=s2a("MD"), &
    8831             :                                        each_iter_values=(/1/), &
    8832        8408 :                                        filename="applied_field")
    8833        8408 :       CALL section_add_subsection(print_section, print_key)
    8834        8408 :       CALL section_release(print_key)
    8835             : 
    8836        8408 :       CALL create_projection_rtp_section(print_key)
    8837        8408 :       CALL section_add_subsection(print_section, print_key)
    8838        8408 :       CALL section_release(print_key)
    8839             : 
    8840             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CURRENT", &
    8841             :                                        description="Print the current during an EMD simulation to cube files.", &
    8842             :                                        print_level=high_print_level, common_iter_levels=0, &
    8843             :                                        each_iter_names=s2a("MD"), &
    8844             :                                        each_iter_values=(/20/), &
    8845        8408 :                                        filename="current")
    8846             :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    8847             :                           description="Specifies the maximum number of backup copies.", &
    8848             :                           usage="BACKUP_COPIES {int}", &
    8849        8408 :                           default_i_val=1)
    8850        8408 :       CALL section_add_keyword(print_key, keyword)
    8851        8408 :       CALL keyword_release(keyword)
    8852             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    8853             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    8854             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    8855             :                           " 1 number valid for all components.", &
    8856        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    8857        8408 :       CALL section_add_keyword(print_key, keyword)
    8858        8408 :       CALL keyword_release(keyword)
    8859             : 
    8860        8408 :       CALL section_add_subsection(print_section, print_key)
    8861        8408 :       CALL section_release(print_key)
    8862             : 
    8863             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "E_CONSTITUENTS", &
    8864             :                                        description="Print the energy constituents (relevant to RTP) which make up "// &
    8865             :                                        "the Total Energy", &
    8866             :                                        print_level=high_print_level, common_iter_levels=1, &
    8867             :                                        each_iter_names=s2a("MD"), &
    8868             :                                        each_iter_values=(/1/), &
    8869        8408 :                                        filename="rtp")
    8870        8408 :       CALL section_add_subsection(print_section, print_key)
    8871        8408 :       CALL section_release(print_key)
    8872             : 
    8873        8408 :       CALL section_add_subsection(section, print_section)
    8874        8408 :       CALL section_release(print_section)
    8875             : 
    8876        8408 :    END SUBROUTINE create_rtp_section
    8877             : 
    8878             : ! **************************************************************************************************
    8879             : !> \brief      Create CP2K input section for the SCCS model
    8880             : !> \param section ...
    8881             : !> \par History:
    8882             : !>      - Creation (10.10.2013,MK)
    8883             : !> \author     Matthias Krack (MK)
    8884             : !> \version    1.0
    8885             : ! **************************************************************************************************
    8886        8408 :    SUBROUTINE create_sccs_section(section)
    8887             : 
    8888             :       TYPE(section_type), POINTER                        :: section
    8889             : 
    8890             :       TYPE(keyword_type), POINTER                        :: keyword
    8891             :       TYPE(section_type), POINTER                        :: subsection
    8892             : 
    8893        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    8894             : 
    8895             :       CALL section_create(section, __LOCATION__, &
    8896             :                           name="SCCS", &
    8897             :                           description="Define the parameters for self-consistent continuum solvation (SCCS) model", &
    8898             :                           citations=(/Fattebert2002, Andreussi2012, Yin2017/), &
    8899             :                           n_keywords=8, &
    8900             :                           n_subsections=2, &
    8901       33632 :                           repeats=.FALSE.)
    8902             : 
    8903        8408 :       NULLIFY (keyword)
    8904             : 
    8905             :       CALL keyword_create(keyword, __LOCATION__, &
    8906             :                           name="_SECTION_PARAMETERS_", &
    8907             :                           description="Controls the activation of the SCCS section", &
    8908             :                           usage="&SCCS ON", &
    8909             :                           default_l_val=.FALSE., &
    8910        8408 :                           lone_keyword_l_val=.TRUE.)
    8911        8408 :       CALL section_add_keyword(section, keyword)
    8912        8408 :       CALL keyword_release(keyword)
    8913             : 
    8914             :       CALL keyword_create(keyword, __LOCATION__, &
    8915             :                           name="ALPHA", &
    8916             :                           description="Solvent specific tunable parameter for the calculation of "// &
    8917             :                           "the repulsion term $G^\text{rep} = \alpha S$ "// &
    8918             :                           "where $S$ is the (quantum) surface of the cavity", &
    8919             :                           repeats=.FALSE., &
    8920             :                           n_var=1, &
    8921             :                           type_of_var=real_t, &
    8922             :                           default_r_val=0.0_dp, &
    8923        8408 :                           unit_str="mN/m")
    8924        8408 :       CALL section_add_keyword(section, keyword)
    8925        8408 :       CALL keyword_release(keyword)
    8926             : 
    8927             :       CALL keyword_create(keyword, __LOCATION__, &
    8928             :                           name="BETA", &
    8929             :                           description="Solvent specific tunable parameter for the calculation of "// &
    8930             :                           "the dispersion term $G^\text{dis} = \beta V$ "// &
    8931             :                           "where $V$ is the (quantum) volume of the cavity", &
    8932             :                           repeats=.FALSE., &
    8933             :                           n_var=1, &
    8934             :                           type_of_var=real_t, &
    8935             :                           default_r_val=0.0_dp, &
    8936        8408 :                           unit_str="GPa")
    8937        8408 :       CALL section_add_keyword(section, keyword)
    8938        8408 :       CALL keyword_release(keyword)
    8939             : 
    8940             :       CALL keyword_create(keyword, __LOCATION__, &
    8941             :                           name="DELTA_RHO", &
    8942             :                           description="Numerical increment for the calculation of the (quantum) "// &
    8943             :                           "surface of the solute cavity", &
    8944             :                           repeats=.FALSE., &
    8945             :                           n_var=1, &
    8946             :                           type_of_var=real_t, &
    8947        8408 :                           default_r_val=2.0E-5_dp)
    8948        8408 :       CALL section_add_keyword(section, keyword)
    8949        8408 :       CALL keyword_release(keyword)
    8950             : 
    8951             :       CALL keyword_create(keyword, __LOCATION__, &
    8952             :                           name="DERIVATIVE_METHOD", &
    8953             :                           description="Method for the calculation of the numerical derivatives on the real-space grids", &
    8954             :                           usage="DERIVATIVE_METHOD cd5", &
    8955             :                           repeats=.FALSE., &
    8956             :                           n_var=1, &
    8957             :                           default_i_val=sccs_derivative_fft, &
    8958             :                           enum_c_vals=s2a("FFT", "CD3", "CD5", "CD7"), &
    8959             :                           enum_i_vals=(/sccs_derivative_fft, &
    8960             :                                         sccs_derivative_cd3, &
    8961             :                                         sccs_derivative_cd5, &
    8962             :                                         sccs_derivative_cd7/), &
    8963             :                           enum_desc=s2a("Fast Fourier transformation", &
    8964             :                                         "3-point stencil central differences", &
    8965             :                                         "5-point stencil central differences", &
    8966        8408 :                                         "7-point stencil central differences"))
    8967        8408 :       CALL section_add_keyword(section, keyword)
    8968        8408 :       CALL keyword_release(keyword)
    8969             : 
    8970             :       CALL keyword_create(keyword, __LOCATION__, &
    8971             :                           name="RELATIVE_PERMITTIVITY", &
    8972             :                           variants=s2a("DIELECTRIC_CONSTANT", "EPSILON_RELATIVE", "EPSILON_SOLVENT"), &
    8973             :                           description="Relative permittivity (dielectric constant) of the solvent (medium)", &
    8974             :                           repeats=.FALSE., &
    8975             :                           n_var=1, &
    8976             :                           type_of_var=real_t, &
    8977             :                           default_r_val=80.0_dp, &
    8978        8408 :                           usage="RELATIVE_PERMITTIVITY 78.36")
    8979        8408 :       CALL section_add_keyword(section, keyword)
    8980        8408 :       CALL keyword_release(keyword)
    8981             : 
    8982             :       CALL keyword_create(keyword, __LOCATION__, &
    8983             :                           name="EPS_SCCS", &
    8984             :                           variants=s2a("EPS_ITER", "TAU_POL"), &
    8985             :                           description="Tolerance for the convergence of the polarisation density, "// &
    8986             :                           "i.e. requested accuracy for the SCCS iteration cycle", &
    8987             :                           repeats=.FALSE., &
    8988             :                           n_var=1, &
    8989             :                           type_of_var=real_t, &
    8990             :                           default_r_val=1.0E-6_dp, &
    8991        8408 :                           usage="EPS_ITER 1.0E-7")
    8992        8408 :       CALL section_add_keyword(section, keyword)
    8993        8408 :       CALL keyword_release(keyword)
    8994             : 
    8995             :       CALL keyword_create(keyword, __LOCATION__, &
    8996             :                           name="EPS_SCF", &
    8997             :                           description="The SCCS iteration cycle is activated only if the SCF iteration cycle "// &
    8998             :                           "is converged to this threshold value", &
    8999             :                           repeats=.FALSE., &
    9000             :                           n_var=1, &
    9001             :                           type_of_var=real_t, &
    9002             :                           default_r_val=0.5_dp, &
    9003        8408 :                           usage="EPS_SCF 1.0E-2")
    9004        8408 :       CALL section_add_keyword(section, keyword)
    9005        8408 :       CALL keyword_release(keyword)
    9006             : 
    9007             :       CALL keyword_create(keyword, __LOCATION__, &
    9008             :                           name="GAMMA", &
    9009             :                           variants=s2a("SURFACE_TENSION"), &
    9010             :                           description="Surface tension of the solvent used for the calculation of "// &
    9011             :                           "the cavitation term $G^\text{cav} = \gamma S$ "// &
    9012             :                           "where $S$ is the (quantum) surface of the cavity", &
    9013             :                           repeats=.FALSE., &
    9014             :                           n_var=1, &
    9015             :                           type_of_var=real_t, &
    9016             :                           default_r_val=0.0_dp, &
    9017        8408 :                           unit_str="mN/m")
    9018        8408 :       CALL section_add_keyword(section, keyword)
    9019        8408 :       CALL keyword_release(keyword)
    9020             : 
    9021             :       CALL keyword_create(keyword, __LOCATION__, &
    9022             :                           name="MAX_ITER", &
    9023             :                           description="Maximum number of SCCS iteration steps performed to converge "// &
    9024             :                           "within the given tolerance", &
    9025             :                           repeats=.FALSE., &
    9026             :                           n_var=1, &
    9027             :                           type_of_var=integer_t, &
    9028             :                           default_i_val=100, &
    9029        8408 :                           usage="MAX_ITER 50")
    9030        8408 :       CALL section_add_keyword(section, keyword)
    9031        8408 :       CALL keyword_release(keyword)
    9032             : 
    9033             :       CALL keyword_create(keyword, __LOCATION__, &
    9034             :                           name="METHOD", &
    9035             :                           description="Method used for the smoothing of the dielectric function", &
    9036             :                           usage="METHOD Fattebert-Gygi", &
    9037             :                           default_i_val=sccs_andreussi, &
    9038             :                           enum_c_vals=s2a("ANDREUSSI", "FATTEBERT-GYGI"), &
    9039             :                           enum_i_vals=(/sccs_andreussi, sccs_fattebert_gygi/), &
    9040             :                           enum_desc=s2a("Smoothing function proposed by Andreussi et al.", &
    9041        8408 :                                         "Smoothing function proposed by Fattebert and Gygi"))
    9042        8408 :       CALL section_add_keyword(section, keyword)
    9043        8408 :       CALL keyword_release(keyword)
    9044             : 
    9045             :       CALL keyword_create(keyword, __LOCATION__, &
    9046             :                           name="MIXING", &
    9047             :                           variants=(/"ETA"/), &
    9048             :                           description="Mixing parameter (Hartree damping) employed during the iteration procedure", &
    9049             :                           repeats=.FALSE., &
    9050             :                           n_var=1, &
    9051             :                           type_of_var=real_t, &
    9052             :                           default_r_val=0.6_dp, &
    9053       16816 :                           usage="MIXING 0.2")
    9054        8408 :       CALL section_add_keyword(section, keyword)
    9055        8408 :       CALL keyword_release(keyword)
    9056             : 
    9057        8408 :       NULLIFY (subsection)
    9058             : 
    9059             :       CALL section_create(subsection, __LOCATION__, &
    9060             :                           name="ANDREUSSI", &
    9061             :                           description="Define the parameters of the dielectric smoothing function proposed by "// &
    9062             :                           "Andreussi et al.", &
    9063             :                           citations=(/Andreussi2012/), &
    9064             :                           n_keywords=2, &
    9065             :                           n_subsections=0, &
    9066       16816 :                           repeats=.FALSE.)
    9067             : 
    9068             :       CALL keyword_create(keyword, __LOCATION__, &
    9069             :                           name="RHO_MAX", &
    9070             :                           description="Maximum density value used for the smoothing of the dielectric function", &
    9071             :                           repeats=.FALSE., &
    9072             :                           n_var=1, &
    9073             :                           type_of_var=real_t, &
    9074             :                           default_r_val=0.0035_dp, &
    9075        8408 :                           usage="RHO_MAX 0.01")
    9076        8408 :       CALL section_add_keyword(subsection, keyword)
    9077        8408 :       CALL keyword_release(keyword)
    9078             : 
    9079             :       CALL keyword_create(keyword, __LOCATION__, &
    9080             :                           name="RHO_MIN", &
    9081             :                           description="Minimum density value used for the smoothing of the dielectric function", &
    9082             :                           repeats=.FALSE., &
    9083             :                           n_var=1, &
    9084             :                           type_of_var=real_t, &
    9085             :                           default_r_val=0.0001_dp, &
    9086        8408 :                           usage="RHO_MIN 0.0003")
    9087        8408 :       CALL section_add_keyword(subsection, keyword)
    9088        8408 :       CALL keyword_release(keyword)
    9089             : 
    9090        8408 :       CALL section_add_subsection(section, subsection)
    9091        8408 :       CALL section_release(subsection)
    9092             : 
    9093             :       CALL section_create(subsection, __LOCATION__, &
    9094             :                           name="FATTEBERT-GYGI", &
    9095             :                           description="Define the parameters of the dielectric smoothing function proposed by "// &
    9096             :                           "Fattebert and Gygi", &
    9097             :                           citations=(/Fattebert2002/), &
    9098             :                           n_keywords=2, &
    9099             :                           n_subsections=0, &
    9100       16816 :                           repeats=.FALSE.)
    9101             : 
    9102             :       CALL keyword_create(keyword, __LOCATION__, &
    9103             :                           name="BETA", &
    9104             :                           description="Parameter &beta; changes the width of the interface solute-solvent", &
    9105             :                           repeats=.FALSE., &
    9106             :                           n_var=1, &
    9107             :                           type_of_var=real_t, &
    9108             :                           default_r_val=1.7_dp, &
    9109        8408 :                           usage="BETA 1.3")
    9110        8408 :       CALL section_add_keyword(subsection, keyword)
    9111        8408 :       CALL keyword_release(keyword)
    9112             : 
    9113             :       CALL keyword_create(keyword, __LOCATION__, &
    9114             :                           name="RHO_ZERO", &
    9115             :                           variants=(/"RHO0"/), &
    9116             :                           description="Parameter $\rho_0$ defines the critical density in the middle "// &
    9117             :                           "of the interface solute-solvent", &
    9118             :                           repeats=.FALSE., &
    9119             :                           n_var=1, &
    9120             :                           type_of_var=real_t, &
    9121             :                           default_r_val=0.0006_dp, &
    9122       16816 :                           usage="RHO_ZERO 0.0004")
    9123        8408 :       CALL section_add_keyword(subsection, keyword)
    9124        8408 :       CALL keyword_release(keyword)
    9125             : 
    9126        8408 :       CALL section_add_subsection(section, subsection)
    9127        8408 :       CALL section_release(subsection)
    9128             : 
    9129        8408 :    END SUBROUTINE create_sccs_section
    9130             : 
    9131             : ! **************************************************************************************************
    9132             : !> \brief      Create CP2K input section for the calculation of an active space Hamiltonian
    9133             : !> \param section ...
    9134             : !> \par History:
    9135             : !>      - Creation 06.04.2016
    9136             : !> \author     JHU
    9137             : ! **************************************************************************************************
    9138        8408 :    SUBROUTINE create_active_space_section(section)
    9139             : 
    9140             :       TYPE(section_type), POINTER                        :: section
    9141             : 
    9142             :       TYPE(keyword_type), POINTER                        :: keyword
    9143             :       TYPE(section_type), POINTER                        :: print_key, subsection
    9144             : 
    9145        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    9146             : 
    9147             :       CALL section_create(section, __LOCATION__, name="ACTIVE_SPACE", &
    9148             :                           description="Define parameters and method to calculate an electronic active space", &
    9149        8408 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    9150             : 
    9151        8408 :       NULLIFY (keyword, subsection, print_key)
    9152             : 
    9153             :       CALL keyword_create(keyword, __LOCATION__, &
    9154             :                           name="_SECTION_PARAMETERS_", &
    9155             :                           description="Controls the activation of the ACTIVE_SPACE section", &
    9156             :                           usage="&ACTIVE_SPACE ON", &
    9157             :                           default_l_val=.FALSE., &
    9158        8408 :                           lone_keyword_l_val=.TRUE.)
    9159        8408 :       CALL section_add_keyword(section, keyword)
    9160        8408 :       CALL keyword_release(keyword)
    9161             : 
    9162             :       CALL keyword_create(keyword, __LOCATION__, name="MODEL", &
    9163             :                           description="Model used to calculate active space interaction Hamiltonian.", &
    9164             :                           usage="MODEL HARTREE-FOCK", &
    9165             :                           default_i_val=hf_model, &
    9166             :                           enum_c_vals=s2a("HARTREE-FOCK", "RSDFT", "DMFT"), &
    9167             :                           enum_i_vals=(/hf_model, rsdft_model, dmft_model/), &
    9168             :                           enum_desc=s2a("Hartree-Fock model for interaction Hamiltonian", &
    9169             :                                         "Range-separated DFT model for interaction Hamiltonian", &
    9170        8408 :                                         "DMFT model Hamiltonian"))
    9171        8408 :       CALL section_add_keyword(section, keyword)
    9172        8408 :       CALL keyword_release(keyword)
    9173             : 
    9174             :       CALL keyword_create(keyword, __LOCATION__, name="ACTIVE_ELECTRONS", &
    9175             :                           description="The number of active electrons in the CAS space", &
    9176        8408 :                           usage="ACTIVE_ELECTRONS 4", n_var=1, default_i_val=-1, type_of_var=integer_t)
    9177        8408 :       CALL section_add_keyword(section, keyword)
    9178        8408 :       CALL keyword_release(keyword)
    9179             : 
    9180             :       CALL keyword_create(keyword, __LOCATION__, name="ACTIVE_ORBITALS", &
    9181             :                           description="The number of active orbitals defining the CAS space.", &
    9182        8408 :                           usage="ACTIVE_ORBITALS 2", n_var=1, default_i_val=-1, type_of_var=integer_t)
    9183        8408 :       CALL section_add_keyword(section, keyword)
    9184        8408 :       CALL keyword_release(keyword)
    9185             : 
    9186             :       CALL keyword_create(keyword, __LOCATION__, name="ACTIVE_ORBITAL_INDICES", &
    9187             :                           description="The indices of the active orbitals. Requires ORBITAL_SELECTION MANUAL!", &
    9188             :                           usage="ACTIVE_ORBITAL_INDICES 2 3 {...}", n_var=-1, default_i_vals=(/-1/), &
    9189        8408 :                           type_of_var=integer_t)
    9190        8408 :       CALL section_add_keyword(section, keyword)
    9191        8408 :       CALL keyword_release(keyword)
    9192             : 
    9193             :       CALL keyword_create(keyword, __LOCATION__, name="ISOLATED_SYSTEM", &
    9194             :                           description="System is treated without any periodic boundary conditions.", &
    9195        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    9196        8408 :       CALL section_add_keyword(section, keyword)
    9197        8408 :       CALL keyword_release(keyword)
    9198             : 
    9199             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FCIDUMP", &
    9200             :                                        description="Controls the writing of a file in FCIDUMP format.", &
    9201        8408 :                                        print_level=high_print_level, filename="")
    9202        8408 :       CALL section_add_subsection(section, print_key)
    9203        8408 :       CALL section_release(print_key)
    9204             : 
    9205             :       CALL keyword_create(keyword, __LOCATION__, name="ORBITAL_SELECTION", &
    9206             :                           description="Method used to select active space orbitals.", &
    9207             :                           usage="ORBITAL_SELECTION CANONICAL", &
    9208             :                           default_i_val=casci_canonical, &
    9209             :                           enum_c_vals=s2a("CANONICAL", "WANNIER_PROJECTION", "MAO", "MANUAL"), &
    9210             :                           enum_i_vals=(/casci_canonical, wannier_projection, mao_projection, manual_selection/), &
    9211             :                           enum_desc=s2a("Select orbitals using energy ordering of canoncial orbitals", &
    9212             :                                         "Select orbitals from projected Wannier functions", &
    9213             :                                         "Select orbitals from modified atomic orbitals", &
    9214        8408 :                                         "Select orbitals manually via ACTIVE_ORBITAL_INDICES"))
    9215             : 
    9216        8408 :       CALL section_add_keyword(section, keyword)
    9217        8408 :       CALL keyword_release(keyword)
    9218             : 
    9219             :       CALL keyword_create(keyword, __LOCATION__, name="SUBSPACE_ATOM", &
    9220             :                           description="Number of atom that defines the subspace to be projected on.", &
    9221             :                           usage="SUBSPACE_ATOM x", default_i_val=-1, &
    9222        8408 :                           type_of_var=integer_t)
    9223        8408 :       CALL section_add_keyword(section, keyword)
    9224        8408 :       CALL keyword_release(keyword)
    9225             : 
    9226             :       CALL keyword_create(keyword, __LOCATION__, name="SUBSPACE_SHELL", &
    9227             :                           description="Shell definition for subsapce.", &
    9228             :                           usage="SUBSPACE_SHELL 3d4s", default_c_val="X", &
    9229        8408 :                           type_of_var=char_t)
    9230        8408 :       CALL section_add_keyword(section, keyword)
    9231        8408 :       CALL keyword_release(keyword)
    9232             : 
    9233             :       CALL keyword_create(keyword, __LOCATION__, name="SCF_EMBEDDING", &
    9234             :                           description="Whether to turn on the self-consistent embedding scheme", &
    9235        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.FALSE.)
    9236        8408 :       CALL section_add_keyword(section, keyword)
    9237        8408 :       CALL keyword_release(keyword)
    9238             : 
    9239             :       CALL keyword_create(keyword, __LOCATION__, name="QCSCHEMA", &
    9240             :                           description="Name of the QCSchema file, may include a path", &
    9241             :                           usage="QCSCHEMA <FILENAME>", &
    9242             :                           type_of_var=lchar_t, repeats=.FALSE., &
    9243        8408 :                           default_lc_val="")
    9244        8408 :       CALL section_add_keyword(section, keyword)
    9245        8408 :       CALL keyword_release(keyword)
    9246             : 
    9247             :       CALL keyword_create(keyword, __LOCATION__, name="AS_SOLVER", &
    9248             :                           description="The external active space solver for the embedding approach", &
    9249             :                           usage="AS_SOLVER QISKIT", &
    9250             :                           default_i_val=no_solver, &
    9251             :                           enum_c_vals=s2a("NONE", "QISKIT"), &
    9252             :                           enum_i_vals=(/no_solver, qiskit_solver/), &
    9253             :                           enum_desc=s2a("NO solver, used to produce FCIDUMP/QCSchema files", &
    9254        8408 :                                         "QISKIT active space solver"))
    9255        8408 :       CALL section_add_keyword(section, keyword)
    9256        8408 :       CALL keyword_release(keyword)
    9257             : 
    9258             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ITER", &
    9259             :                           description="Energy convergence threshold of the DFT embedding scheme.", &
    9260             :                           usage="EPS_ITER 1.0E-6 ", type_of_var=real_t, &
    9261        8408 :                           default_r_val=1.0E-6_dp)
    9262        8408 :       CALL section_add_keyword(section, keyword)
    9263        8408 :       CALL keyword_release(keyword)
    9264             : 
    9265             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
    9266             :                           description="Max number of iterations for the DFT embedding scheme.", &
    9267             :                           usage="MAX_ITER 50", type_of_var=integer_t, &
    9268        8408 :                           default_i_val=50)
    9269        8408 :       CALL section_add_keyword(section, keyword)
    9270        8408 :       CALL keyword_release(keyword)
    9271             : 
    9272        8408 :       CALL create_print_orb_section(subsection)
    9273        8408 :       CALL section_add_subsection(section, subsection)
    9274        8408 :       CALL section_release(subsection)
    9275             : 
    9276        8408 :       CALL create_eri_section(subsection)
    9277        8408 :       CALL section_add_subsection(section, subsection)
    9278        8408 :       CALL section_release(subsection)
    9279             : 
    9280        8408 :       CALL create_eri_gpw(subsection)
    9281        8408 :       CALL section_add_subsection(section, subsection)
    9282        8408 :       CALL section_release(subsection)
    9283             : 
    9284        8408 :       CALL create_localize_section(subsection)
    9285        8408 :       CALL section_add_subsection(section, subsection)
    9286        8408 :       CALL section_release(subsection)
    9287             : 
    9288        8408 :       CALL create_socket_section(subsection)
    9289        8408 :       CALL section_add_subsection(section, subsection)
    9290        8408 :       CALL section_release(subsection)
    9291             : 
    9292        8408 :    END SUBROUTINE create_active_space_section
    9293             : 
    9294             : ! **************************************************************************************************
    9295             : !> \brief ...
    9296             : !> \param section ...
    9297             : ! **************************************************************************************************
    9298        8408 :    SUBROUTINE create_socket_section(section)
    9299             :       TYPE(section_type), POINTER                        :: section
    9300             : 
    9301             :       TYPE(keyword_type), POINTER                        :: keyword
    9302             : 
    9303        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    9304             :       CALL section_create(section, __LOCATION__, name="SOCKET", &
    9305             :                           description="Parameters to set up the socket communicating to the external active space solver.", &
    9306        8408 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
    9307             : 
    9308        8408 :       NULLIFY (keyword)
    9309             :       CALL keyword_create(keyword, __LOCATION__, name="INET", &
    9310             :                           description="Use an INET socket rather than a UNIX socket.", &
    9311             :                           usage="INET <LOGICAL>", &
    9312        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    9313        8408 :       CALL section_add_keyword(section, keyword)
    9314        8408 :       CALL keyword_release(keyword)
    9315             : 
    9316             :       CALL keyword_create(keyword, __LOCATION__, name="PORT", &
    9317             :                           description="Port number for the socket client.", &
    9318             :                           usage="port <INTEGER>", &
    9319        8408 :                           default_i_val=12345)
    9320        8408 :       CALL section_add_keyword(section, keyword)
    9321        8408 :       CALL keyword_release(keyword)
    9322             : 
    9323             :       CALL keyword_create(keyword, __LOCATION__, name="HOST", &
    9324             :                           description="Host name for the socket client.", &
    9325             :                           usage="host <HOSTNAME>", &
    9326        8408 :                           default_c_val="embedding_socket")
    9327        8408 :       CALL section_add_keyword(section, keyword)
    9328        8408 :       CALL keyword_release(keyword)
    9329             : 
    9330        8408 :    END SUBROUTINE create_socket_section
    9331             : 
    9332             : ! **************************************************************************************************
    9333             : !> \brief ...
    9334             : !> \param section ...
    9335             : ! **************************************************************************************************
    9336        8408 :    SUBROUTINE create_print_orb_section(section)
    9337             :       TYPE(section_type), POINTER                        :: section
    9338             : 
    9339             :       TYPE(keyword_type), POINTER                        :: keyword
    9340             : 
    9341        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    9342             :       CALL section_create(section, __LOCATION__, name="PRINT_ORBITAL_CUBES", &
    9343             :                           description="Controls printing of active orbital cube files.", &
    9344        8408 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
    9345             : 
    9346        8408 :       NULLIFY (keyword)
    9347             :       CALL keyword_create(keyword, __LOCATION__, name="FILENAME", &
    9348             :                           description="Body of Filename for the cube files.", &
    9349             :                           usage="FILENAME {name}", default_c_val="ActiveOrbital", &
    9350        8408 :                           type_of_var=char_t)
    9351        8408 :       CALL section_add_keyword(section, keyword)
    9352        8408 :       CALL keyword_release(keyword)
    9353             : 
    9354             :       CALL keyword_create(keyword, __LOCATION__, name="ALIST", &
    9355             :                           description="List of alpha orbitals to be printed. -1 defaults to all values", &
    9356             :                           usage="ALIST {1 2 3 ...}", n_var=-1, default_i_vals=(/-1/), &
    9357        8408 :                           lone_keyword_i_val=-1, type_of_var=integer_t)
    9358        8408 :       CALL section_add_keyword(section, keyword)
    9359        8408 :       CALL keyword_release(keyword)
    9360             : 
    9361             :       CALL keyword_create(keyword, __LOCATION__, name="BLIST", &
    9362             :                           description="List of beta orbitals to be printed. -1 defaults to all values", &
    9363             :                           usage="ALIST {1 2 3 ...}", n_var=-1, default_i_vals=(/-1/), &
    9364        8408 :                           lone_keyword_i_val=-1, type_of_var=integer_t)
    9365        8408 :       CALL section_add_keyword(section, keyword)
    9366        8408 :       CALL keyword_release(keyword)
    9367             : 
    9368             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    9369             :                           description="The stride (X,Y,Z) used to write the cube file"// &
    9370             :                           " (larger values result in smaller cube files)."// &
    9371             :                           " You can provide 3 numbers (for X,Y,Z) or 1 number valid for all components", &
    9372             :                           usage="STRIDE {2 2 2}", n_var=-1, default_i_vals=(/2, 2, 2/), &
    9373        8408 :                           type_of_var=integer_t)
    9374        8408 :       CALL section_add_keyword(section, keyword)
    9375        8408 :       CALL keyword_release(keyword)
    9376             : 
    9377             :       CALL keyword_create(keyword, __LOCATION__, name="STOP_AFTER_CUBES", &
    9378             :                           description="Whether to stop the computation after printing the cubes.", &
    9379        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.FALSE.)
    9380        8408 :       CALL section_add_keyword(section, keyword)
    9381        8408 :       CALL keyword_release(keyword)
    9382             : 
    9383        8408 :    END SUBROUTINE create_print_orb_section
    9384             : 
    9385             : ! **************************************************************************************************
    9386             : !> \brief ...
    9387             : !> \param section ...
    9388             : ! **************************************************************************************************
    9389        8408 :    SUBROUTINE create_eri_section(section)
    9390             :       TYPE(section_type), POINTER                        :: section
    9391             : 
    9392             :       TYPE(keyword_type), POINTER                        :: keyword
    9393             : 
    9394        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    9395             :       CALL section_create(section, __LOCATION__, name="ERI", &
    9396             :                           description="Parameters for the electron repulsion integrals.", &
    9397        8408 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
    9398             : 
    9399        8408 :       NULLIFY (keyword)
    9400             :       CALL keyword_create(keyword, __LOCATION__, name="METHOD", &
    9401             :                           description="Method used in ERI calculation.", &
    9402             :                           usage="METHOD FULL_GPW", &
    9403             :                           enum_c_vals=s2a("FULL_GPW", "GPW_HALF_TRANSFORM"), &
    9404             :                           enum_i_vals=(/eri_method_full_gpw, eri_method_gpw_ht/), &
    9405             :                           enum_desc=s2a("Use the GPW approach with MOs", &
    9406             :                                         "Use the GPW approach for half-transformed MO ERIs"), &
    9407        8408 :                           default_i_val=eri_method_full_gpw)
    9408        8408 :       CALL section_add_keyword(section, keyword)
    9409        8408 :       CALL keyword_release(keyword)
    9410             : 
    9411             :       CALL keyword_create(keyword, __LOCATION__, name="OPERATOR", &
    9412             :                           description="Operator used in ERI calculation.", &
    9413             :                           usage="OPERATOR <1/R>", &
    9414             :                           enum_c_vals=s2a("<1/R>", "<EXP(-A*R)/R>", "<ERF(A*R)/R>", &
    9415             :                                           "<ERFC(A*R)/R>", "<EXP(-A*R2)/R>", "<H(A-R)/R>"), &
    9416             :                           enum_i_vals=(/eri_operator_coulomb, eri_operator_yukawa, &
    9417             :                                         eri_operator_erf, eri_operator_erfc, eri_operator_gaussian, eri_operator_trunc/), &
    9418             :                           enum_desc=s2a("Coulomb operator", &
    9419             :                                         "Yukawa potential operator", &
    9420             :                                         "Error function potential operator", &
    9421             :                                         "Complementary error function potential operator", &
    9422             :                                         "Gaussian potential operator", &
    9423             :                                         "Truncated Coulomb potential"), &
    9424        8408 :                           default_i_val=eri_operator_coulomb)
    9425        8408 :       CALL section_add_keyword(section, keyword)
    9426        8408 :       CALL keyword_release(keyword)
    9427             : 
    9428             :       CALL keyword_create(keyword, __LOCATION__, name="OPERATOR_PARAMETER", &
    9429             :                           description="Range parameter for ERI operator.", &
    9430             :                           usage="OPERATOR_PARAMETER 4.0", type_of_var=real_t, &
    9431        8408 :                           default_r_val=0.5_dp)
    9432        8408 :       CALL section_add_keyword(section, keyword)
    9433        8408 :       CALL keyword_release(keyword)
    9434             : 
    9435             :       CALL keyword_create(keyword, __LOCATION__, name="PERIODICITY", &
    9436             :                           description="Periodicity used for operators in ERI calclulation.", &
    9437             :                           usage="PERIODICITY {1 1 1}", n_var=-1, default_i_vals=(/1, 1, 1/), &
    9438        8408 :                           type_of_var=integer_t)
    9439        8408 :       CALL section_add_keyword(section, keyword)
    9440        8408 :       CALL keyword_release(keyword)
    9441             : 
    9442             :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
    9443             :                           description="Radius of operator interactions in non-periodic cases.", &
    9444             :                           usage="CUTOFF_RADIUS 20", type_of_var=real_t, &
    9445        8408 :                           default_r_val=-1.0_dp)
    9446        8408 :       CALL section_add_keyword(section, keyword)
    9447        8408 :       CALL keyword_release(keyword)
    9448             : 
    9449             :       CALL keyword_create( &
    9450             :          keyword, __LOCATION__, name="EPS_INTEGRAL", &
    9451             :          description="Accuracy of ERIs that will be stored.", &
    9452             :          usage="EPS_INTEGRAL 1.0E-10 ", type_of_var=real_t, &
    9453        8408 :          default_r_val=1.0E-12_dp)
    9454        8408 :       CALL section_add_keyword(section, keyword)
    9455        8408 :       CALL keyword_release(keyword)
    9456             : 
    9457        8408 :    END SUBROUTINE create_eri_section
    9458             : 
    9459             : ! **************************************************************************************************
    9460             : !> \brief ...
    9461             : !> \param section ...
    9462             : ! **************************************************************************************************
    9463        8408 :    SUBROUTINE create_eri_gpw(section)
    9464             :       TYPE(section_type), POINTER                        :: section
    9465             : 
    9466             :       TYPE(keyword_type), POINTER                        :: keyword
    9467             : 
    9468        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    9469             :       CALL section_create(section, __LOCATION__, name="ERI_GPW", &
    9470             :                           description="Parameters for the GPW approach to electron repulsion integrals.", &
    9471        8408 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
    9472             : 
    9473        8408 :       NULLIFY (keyword)
    9474             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_GRID", &
    9475             :                           description="Determines a threshold for the GPW based integration", &
    9476             :                           usage="EPS_GRID 1.0E-9 ", type_of_var=real_t, &
    9477        8408 :                           default_r_val=1.0E-8_dp)
    9478        8408 :       CALL section_add_keyword(section, keyword)
    9479        8408 :       CALL keyword_release(keyword)
    9480             : 
    9481             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER", &
    9482             :                           description="Determines a threshold for the sparse matrix multiplications if METHOD "// &
    9483             :                           "GPW_HALF_TRANSFORM is used", &
    9484             :                           usage="EPS_FILTER 1.0E-9 ", type_of_var=real_t, &
    9485        8408 :                           default_r_val=1.0E-9_dp)
    9486        8408 :       CALL section_add_keyword(section, keyword)
    9487        8408 :       CALL keyword_release(keyword)
    9488             : 
    9489             :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF", &
    9490             :                           description="The cutoff of the finest grid level in the GPW integration.", &
    9491             :                           usage="CUTOFF 300", type_of_var=real_t, &
    9492        8408 :                           default_r_val=300.0_dp)
    9493        8408 :       CALL section_add_keyword(section, keyword)
    9494        8408 :       CALL keyword_release(keyword)
    9495             : 
    9496             :       CALL keyword_create(keyword, __LOCATION__, name="REL_CUTOFF", &
    9497             :                           variants=(/"RELATIVE_CUTOFF"/), &
    9498             :                           description="Determines the grid at which a Gaussian is mapped.", &
    9499             :                           usage="REL_CUTOFF 50", type_of_var=real_t, &
    9500       16816 :                           default_r_val=50.0_dp)
    9501        8408 :       CALL section_add_keyword(section, keyword)
    9502        8408 :       CALL keyword_release(keyword)
    9503             : 
    9504             :       CALL keyword_create(keyword, __LOCATION__, name="STORE_WFN", &
    9505             :                           variants=(/"STORE_WAVEFUNCTION"/), &
    9506             :                           description="Store wavefunction in real space representation for integration.", &
    9507             :                           usage="STORE_WFN  T", type_of_var=logical_t, &
    9508       16816 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    9509        8408 :       CALL section_add_keyword(section, keyword)
    9510        8408 :       CALL keyword_release(keyword)
    9511             : 
    9512             :       CALL keyword_create(keyword, __LOCATION__, name="GROUP_SIZE", &
    9513             :                           description="Sets the size of a subgroup for ERI calculation, "// &
    9514             :                           "each of which with a full set of work grids, arrays or orbitals "// &
    9515             :                           "depending on the method of grids (work grids, arrays, orbitals). "// &
    9516             :                           "Small numbers reduce communication but increase the memory demands. "// &
    9517             :                           "A negative number indicates all processes (default).", &
    9518             :                           usage="GROUP_SIZE 2", type_of_var=integer_t, &
    9519        8408 :                           default_i_val=-1)
    9520        8408 :       CALL section_add_keyword(section, keyword)
    9521        8408 :       CALL keyword_release(keyword)
    9522             : 
    9523             :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_LEVEL", &
    9524             :                           variants=(/"IOLEVEL"/), &
    9525             :                           description="How much output is written by the individual groups.", &
    9526             :                           usage="PRINT_LEVEL HIGH", &
    9527             :                           default_i_val=silent_print_level, enum_c_vals= &
    9528             :                           s2a("SILENT", "LOW", "MEDIUM", "HIGH", "DEBUG"), &
    9529             :                           enum_desc=s2a("Almost no output", &
    9530             :                                         "Little output", "Quite some output", "Lots of output", &
    9531             :                                         "Everything is written out, useful for debugging purposes only"), &
    9532             :                           enum_i_vals=(/silent_print_level, low_print_level, medium_print_level, &
    9533       16816 :                                         high_print_level, debug_print_level/))
    9534        8408 :       CALL section_add_keyword(section, keyword)
    9535        8408 :       CALL keyword_release(keyword)
    9536             : 
    9537        8408 :    END SUBROUTINE create_eri_gpw
    9538             : 
    9539             : ! **************************************************************************************************
    9540             : !> \brief Creates the section for cube files related to the implicit Poisson solver.
    9541             : !> \param section the section to be created
    9542             : !> \par History
    9543             : !>      03.2016 refactored from create_print_dft_section [Hossein Bani-Hashemian]
    9544             : !> \author Mohammad Hossein Bani-Hashemian
    9545             : ! **************************************************************************************************
    9546        8408 :    SUBROUTINE create_implicit_psolver_section(section)
    9547             :       TYPE(section_type), POINTER                        :: section
    9548             : 
    9549             :       TYPE(keyword_type), POINTER                        :: keyword
    9550             :       TYPE(section_type), POINTER                        :: print_key
    9551             : 
    9552        8408 :       CPASSERT(.NOT. ASSOCIATED(section))
    9553             :       CALL section_create(section, __LOCATION__, name="IMPLICIT_PSOLVER", &
    9554             :                           description="Controls printing of cube files for data from the implicit "// &
    9555             :                           "(generalized) Poisson solver.", &
    9556             :                           citations=(/BaniHashemian2016/), &
    9557       16816 :                           n_keywords=0, n_subsections=3, repeats=.FALSE.)
    9558             : 
    9559        8408 :       NULLIFY (keyword, print_key)
    9560             : 
    9561             :       ! dielectric constant function
    9562             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "DIELECTRIC_CUBE", &
    9563             :                                        description="Controls the printing of a cube file with dielectric constant from "// &
    9564             :                                        "the implicit (generalized) Poisson solver.", &
    9565        8408 :                                        print_level=high_print_level, filename="")
    9566             : 
    9567             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    9568             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    9569             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    9570             :                           " 1 number valid for all components.", &
    9571        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    9572        8408 :       CALL section_add_keyword(print_key, keyword)
    9573        8408 :       CALL keyword_release(keyword)
    9574             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    9575             :                           description="append the cube files when they already exist", &
    9576        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    9577        8408 :       CALL section_add_keyword(print_key, keyword)
    9578        8408 :       CALL keyword_release(keyword)
    9579             : 
    9580        8408 :       CALL section_add_subsection(section, print_key)
    9581        8408 :       CALL section_release(print_key)
    9582             : 
    9583             :       ! dirichlet type constraints
    9584             :       CALL cp_print_key_section_create( &
    9585             :          print_key, __LOCATION__, "DIRICHLET_BC_CUBE", &
    9586             :          description="Controls the printing of cube files with unit step functions (constraints)"// &
    9587             :          " representing Dirichlet-type (boundary) regions defined in the implicit (generalized) Poisson"// &
    9588             :          " solver section. The regions remain unchanged throughout the calculations. If the Dirichlet"// &
    9589             :          " regions are relatively large and/or the number of partitions is quite high, in order to save memory,"// &
    9590             :          " generate the cube files in early steps and perform the rest of the calculations with this keyword"// &
    9591             :          " switched off.", &
    9592        8408 :          print_level=high_print_level, filename="")
    9593             : 
    9594             :       CALL keyword_create(keyword, __LOCATION__, name="TILE_CUBES", &
    9595             :                           description="Print tiles that tessellate the Dirichlet regions into cube files. If TRUE, "// &
    9596             :                           "generates cube files as many as the total number of tiles.", &
    9597             :                           usage="TILE_CUBES <logical>", &
    9598        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    9599        8408 :       CALL section_add_keyword(print_key, keyword)
    9600        8408 :       CALL keyword_release(keyword)
    9601             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    9602             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    9603             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    9604             :                           " 1 number valid for all components.", &
    9605        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    9606        8408 :       CALL section_add_keyword(print_key, keyword)
    9607        8408 :       CALL keyword_release(keyword)
    9608             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    9609             :                           description="append the cube files when they already exist", &
    9610        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    9611        8408 :       CALL section_add_keyword(print_key, keyword)
    9612        8408 :       CALL keyword_release(keyword)
    9613             : 
    9614        8408 :       CALL section_add_subsection(section, print_key)
    9615        8408 :       CALL section_release(print_key)
    9616             : 
    9617             :       ! charge introduced by Lagrange multipliers
    9618             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "DIRICHLET_CSTR_CHARGE_CUBE", &
    9619             :                                        description="Controls the printing of cube files with penalty charges induced to "// &
    9620             :                                        "Dirichlet regions by Lagrange multipliers (implicit Poisson solver).", &
    9621        8408 :                                        print_level=high_print_level, filename="")
    9622             : 
    9623             :       CALL keyword_create(keyword, __LOCATION__, name="stride", &
    9624             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    9625             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    9626             :                           " 1 number valid for all components.", &
    9627        8408 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    9628        8408 :       CALL section_add_keyword(print_key, keyword)
    9629        8408 :       CALL keyword_release(keyword)
    9630             :       CALL keyword_create(keyword, __LOCATION__, name="APPEND", &
    9631             :                           description="append the cube files when they already exist", &
    9632        8408 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    9633        8408 :       CALL section_add_keyword(print_key, keyword)
    9634        8408 :       CALL keyword_release(keyword)
    9635             : 
    9636        8408 :       CALL section_add_subsection(section, print_key)
    9637        8408 :       CALL section_release(print_key)
    9638             : 
    9639        8408 :    END SUBROUTINE create_implicit_psolver_section
    9640             : 
    9641             : ! **************************************************************************************************
    9642             : !> \brief creates the input section for parameters related to CDFT specific optimizers
    9643             : !> \param section the section to be created
    9644             : !> \par History
    9645             : !>      03.2018 separated from create_outer_scf_section [Nico Holmberg]
    9646             : !> \author Nico Holmberg
    9647             : ! **************************************************************************************************
    9648       28000 :    SUBROUTINE create_cdft_opt_section(section)
    9649             :       TYPE(section_type), POINTER                        :: section
    9650             : 
    9651             :       TYPE(keyword_type), POINTER                        :: keyword
    9652             : 
    9653       28000 :       CPASSERT(.NOT. ASSOCIATED(section))
    9654             :       CALL section_create(section, __LOCATION__, name="CDFT_OPT", &
    9655             :                           description="Parameters controlling optimization methods that are compatible "// &
    9656             :                           "only with CDFT based constraints (i.e. CDFT SCF is active). Specifically, "// &
    9657             :                           "the control parameters for the Broyden and Newton optimizers are defined in this "// &
    9658             :                           "section.", &
    9659       28000 :                           n_keywords=10, n_subsections=0, repeats=.FALSE.)
    9660             : 
    9661       28000 :       NULLIFY (keyword)
    9662             : 
    9663             :       CALL keyword_create(keyword, __LOCATION__, name="BROYDEN_TYPE", &
    9664             :                           description="Specifies the Broyden optimizer variant to use.", &
    9665             :                           usage="BROYDEN_TYPE BT1", &
    9666             :                           default_i_val=broyden_type_1, &
    9667             :                           enum_c_vals=s2a("BT1", "BT1_EXPLICIT", "BT2", "BT2_EXPLICIT", &
    9668             :                                           "BT1_LS", "BT1_EXPLICIT_LS", "BT2_LS", "BT2_EXPLICIT_LS"), &
    9669             :                           enum_desc=s2a("Broyden's first method, also known as the good method. The initial Jacobian"// &
    9670             :                                         " is built from MD history if available. Otherwise switches to SD for one"// &
    9671             :                                         " SCF iteration until a Jacobian can be built from the SCF history.", &
    9672             :                                         "Same as BT1, but computes the explicit Jacobian with finite differences. "// &
    9673             :                                         "Requires a CDFT SCF procedure to be active.", &
    9674             :                                         "Same as BT1, but uses Broyden's second method, also known as the bad method.", &
    9675             :                                         "Same as BT1_EXPLICIT, but using Broyden's second method.", &
    9676             :                                         "Same as BT1, but uses backtracking line search for optimizing the step size "// &
    9677             :                                         "(see optimizer NEWTON_LS).", &
    9678             :                                         "Same as BT1_EXPLICIT, but uses backtracking line search for optimizing the step size.", &
    9679             :                                         "Same as BT2, but uses backtracking line search for optimizing the step size.", &
    9680             :                                         "Same as BT2_EXPLICIT, but uses backtracking line search for optimizing the step size."), &
    9681             :                           enum_i_vals=(/broyden_type_1, broyden_type_1_explicit, broyden_type_2, &
    9682             :                                         broyden_type_2_explicit, broyden_type_1_ls, broyden_type_1_explicit_ls, &
    9683       28000 :                                         broyden_type_2_ls, broyden_type_2_explicit_ls/))
    9684       28000 :       CALL section_add_keyword(section, keyword)
    9685       28000 :       CALL keyword_release(keyword)
    9686             : 
    9687             :       CALL keyword_create(keyword, __LOCATION__, name="JACOBIAN_TYPE", &
    9688             :                           description="Finite difference method used to calculate the inverse Jacobian "// &
    9689             :                           "needed by some optimizers. Compatible only with CDFT constraints.", &
    9690             :                           usage="JACOBIAN_TYPE FD1", &
    9691             :                           default_i_val=jacobian_fd1, &
    9692             :                           enum_c_vals=s2a("FD1", "FD1_BACKWARD", "FD2", "FD2_BACKWARD", "FD1_CENTRAL"), &
    9693             :                           enum_desc=s2a("First order forward difference (one extra energy evaluation per constraint).", &
    9694             :                                         "First order backward difference (one extra energy evaluation per constraint).", &
    9695             :                                         "Second order forward difference (two extra energy evaluations per constraint).", &
    9696             :                                         "Second order backward difference (two extra energy evaluations per constraint).", &
    9697             :                                         "First order central difference (two extra energy evaluations per constraint)."), &
    9698             :                           enum_i_vals=(/jacobian_fd1, jacobian_fd1_backward, jacobian_fd2, &
    9699       28000 :                                         jacobian_fd2_backward, jacobian_fd1_central/))
    9700       28000 :       CALL section_add_keyword(section, keyword)
    9701       28000 :       CALL keyword_release(keyword)
    9702             : 
    9703             :       CALL keyword_create(keyword, __LOCATION__, name="JACOBIAN_STEP", &
    9704             :                           description="Step size to use in the calculation of the inverse Jacobian with finite differences. "// &
    9705             :                           "Expects one value for all constraints, or one value per constraint.", &
    9706       28000 :                           usage="JACOBIAN_STEP 5.0E-3 ", n_var=-1, default_r_val=5.0E-3_dp)
    9707       28000 :       CALL section_add_keyword(section, keyword)
    9708       28000 :       CALL keyword_release(keyword)
    9709             : 
    9710             :       CALL keyword_create(keyword, __LOCATION__, name="JACOBIAN_FREQ", &
    9711             :                           description="Defines parameters that control how often the explicit Jacobian is built,"// &
    9712             :                           " which is needed by some optimizers. Expects two values. The first value"// &
    9713             :                           " determines how many consecutive CDFT SCF iterations should skip a rebuild,"// &
    9714             :                           " whereas the latter how many MD steps. The values can be zero (meaning never"// &
    9715             :                           " rebuild) or positive. Both values cannot be zero.", &
    9716             :                           usage="JACOBIAN_FREQ 1 1", n_var=2, &
    9717       28000 :                           default_i_vals=(/1, 1/), type_of_var=integer_t)
    9718       28000 :       CALL section_add_keyword(section, keyword)
    9719       28000 :       CALL keyword_release(keyword)
    9720             : 
    9721             :       CALL keyword_create(keyword, __LOCATION__, name="JACOBIAN_RESTART", &
    9722             :                           description="Restart the inverse Jacobian using the vector defined with keyword JACOBIAN_VECTOR.", &
    9723             :                           usage="JACOBIAN_RESTART TRUE", &
    9724       28000 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    9725       28000 :       CALL section_add_keyword(section, keyword)
    9726       28000 :       CALL keyword_release(keyword)
    9727             : 
    9728             :       CALL keyword_create(keyword, __LOCATION__, name="JACOBIAN_VECTOR", &
    9729             :                           description="Defines the inverse Jacobian matrix. Useful for restarting calculations. "// &
    9730             :                           "Expects n^2 values where n is the total number of constraints. "// &
    9731             :                           "The matrix should be given in row major order.", &
    9732       28000 :                           usage="JACOBIAN_VECTOR 1.0 0.0", n_var=-1, type_of_var=real_t)
    9733       28000 :       CALL section_add_keyword(section, keyword)
    9734       28000 :       CALL keyword_release(keyword)
    9735             : 
    9736             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_LS", &
    9737             :                           description="The maximum number of backtracking line search steps to perform.", &
    9738       28000 :                           usage="MAX_LS 5", default_i_val=5)
    9739       28000 :       CALL section_add_keyword(section, keyword)
    9740       28000 :       CALL keyword_release(keyword)
    9741             : 
    9742             :       CALL keyword_create(keyword, __LOCATION__, name="FACTOR_LS", &
    9743             :                           description="Control parameter for backtracking line search. The step size is reduced by "// &
    9744             :                           "this factor on every line search iteration. Value must be between 0 and 1 (exclusive).", &
    9745       28000 :                           usage="FACTOR_LS 0.5", default_r_val=0.5_dp)
    9746       28000 :       CALL section_add_keyword(section, keyword)
    9747       28000 :       CALL keyword_release(keyword)
    9748             : 
    9749             :       CALL keyword_create(keyword, __LOCATION__, name="CONTINUE_LS", &
    9750             :                           description="Continue backtracking line search until MAX_LS steps are reached or the "// &
    9751             :                           "norm of the CDFT gradient no longer decreases. Default (false) behavior exits the "// &
    9752             :                           "line search procedure on the first step that the gradient decreases.", &
    9753             :                           usage="CONTINUE_LS TRUE", &
    9754       28000 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    9755       28000 :       CALL section_add_keyword(section, keyword)
    9756       28000 :       CALL keyword_release(keyword)
    9757             : 
    9758       28000 :    END SUBROUTINE create_cdft_opt_section
    9759             : 
    9760             : END MODULE input_cp2k_dft

Generated by: LCOV version 1.15