LCOV - code coverage report
Current view: top level - src - scf_control_types.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:71c3ab0) Lines: 96.6 % 325 314
Test Date: 2026-07-25 06:35:44 Functions: 69.2 % 13 9

            Line data    Source code
       1              : !--------------------------------------------------------------------------------------------------!
       2              : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3              : !   Copyright 2000-2026 CP2K developers group <https://cp2k.org>                                   !
       4              : !                                                                                                  !
       5              : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6              : !--------------------------------------------------------------------------------------------------!
       7              : 
       8              : ! **************************************************************************************************
       9              : !> \brief parameters that control an scf iteration
      10              : !> \note
      11              : !>       not in cp_control_types, to separate operator related parameters from
      12              : !>       method related parameters (as suggested by Matthias)
      13              : !> \par History
      14              : !>      09.2002 created [fawzi]
      15              : !> \author Fawzi Mohamed
      16              : ! **************************************************************************************************
      17              : MODULE scf_control_types
      18              : 
      19              :    USE cp_log_handling,                 ONLY: cp_get_default_logger,&
      20              :                                               cp_logger_type
      21              :    USE cp_output_handling,              ONLY: cp_print_key_finished_output,&
      22              :                                               cp_print_key_unit_nr
      23              :    USE cp_units,                        ONLY: cp_unit_from_cp2k
      24              :    USE input_constants,                 ONLY: &
      25              :         atomic_guess, diag_ot, direct_p_mix, general_roks, high_spin_roks, no_guess, no_mix, &
      26              :         ot_algo_taylor_or_diag, outer_scf_basis_center_opt, outer_scf_cdft_constraint, &
      27              :         outer_scf_ddapc_constraint, outer_scf_none, outer_scf_optimizer_bisect, &
      28              :         outer_scf_optimizer_broyden, outer_scf_optimizer_diis, outer_scf_optimizer_newton, &
      29              :         outer_scf_optimizer_newton_ls, outer_scf_optimizer_none, outer_scf_optimizer_sd, &
      30              :         outer_scf_optimizer_secant, outer_scf_s2_constraint, smear_energy_window, &
      31              :         smear_fermi_dirac, smear_gaussian, smear_list, smear_mp, smear_mv
      32              :    USE input_cp2k_scf,                  ONLY: create_scf_section
      33              :    USE input_enumeration_types,         ONLY: enum_i2c,&
      34              :                                               enumeration_type
      35              :    USE input_keyword_types,             ONLY: keyword_get,&
      36              :                                               keyword_type
      37              :    USE input_section_types,             ONLY: section_get_keyword,&
      38              :                                               section_release,&
      39              :                                               section_type,&
      40              :                                               section_vals_get,&
      41              :                                               section_vals_get_subs_vals,&
      42              :                                               section_vals_type,&
      43              :                                               section_vals_val_get
      44              :    USE kinds,                           ONLY: dp
      45              :    USE outer_scf_control_types,         ONLY: outer_scf_control_type,&
      46              :                                               outer_scf_read_parameters
      47              :    USE qs_cdft_opt_types,               ONLY: cdft_opt_type_release
      48              :    USE qs_ot_types,                     ONLY: ot_readwrite_input,&
      49              :                                               qs_ot_settings_init,&
      50              :                                               qs_ot_settings_type
      51              : #include "./base/base_uses.f90"
      52              : 
      53              :    IMPLICIT NONE
      54              : 
      55              :    PRIVATE
      56              : 
      57              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'scf_control_types'
      58              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      59              : 
      60              :    ! Public data types
      61              : 
      62              :    PUBLIC :: scf_control_type, &
      63              :              smear_type, &
      64              :              gce_type
      65              : 
      66              :    ! Public subroutines
      67              : 
      68              :    PUBLIC :: scf_c_create, &
      69              :              scf_c_read_parameters, &
      70              :              scf_c_release, &
      71              :              scf_c_write_parameters
      72              : 
      73              : ! **************************************************************************************************
      74              : !> \brief contains the parameters needed by a scf run
      75              : !> \param density_guess how to choose the initial density
      76              : !>        (CORE,RANDOM,RESTART,ATOMIC,FROZEN)
      77              : !> \param eps_eigval wanted error on the eigenvalues
      78              : !> \param eps_scf whanted error on the whole scf
      79              : !> \param level_shift amount of level shift
      80              : !> \param p_mix how to mix the new and old densities in non diss iterations
      81              : !> \param eps_lumos error on the lumos calculated at the end of the scf
      82              : !> \param max_iter_lumus maxumum number of iterations used to calculate
      83              : !>        the lumos at the end of the scf
      84              : !> \param max_scf max scf iterations
      85              : !> \param added_mos additional number of MOs that might be used in the SCF
      86              : !> \param step_size the optimizer step size
      87              : !> \param cdft_opt_control settings for optimizers that work only together with CDFT constraints
      88              : !> \par History
      89              : !>      09.2002 created [fawzi]
      90              : !> \author Fawzi Mohamed
      91              : ! **************************************************************************************************
      92              :    TYPE smear_type
      93              :       LOGICAL                               :: do_smear = .FALSE.
      94              :       LOGICAL                               :: common_mu = .FALSE.
      95              :       INTEGER                               :: method = -1
      96              :       REAL(KIND=dp)                         :: electronic_temperature = -1.0_dp, &
      97              :                                                fixed_mag_mom = -1.0_dp, &
      98              :                                                eps_fermi_dirac = -1.0_dp, &
      99              :                                                window_size = -1.0_dp, &
     100              :                                                smearing_width = -1.0_dp
     101              :       REAL(KIND=dp), DIMENSION(:), POINTER  :: list => NULL()
     102              :    END TYPE smear_type
     103              : 
     104              :    TYPE diagonalization_type
     105              :       INTEGER                               :: method = -1
     106              :       REAL(KIND=dp)                         :: eps_jacobi = -1.0_dp
     107              :       REAL(KIND=dp)                         :: jacobi_threshold = -1.0_dp
     108              :       INTEGER                               :: max_iter = -1, nkrylov = -1, nblock_krylov = -1
     109              :       ! Maximum Overlap Method
     110              :       LOGICAL                               :: mom = .FALSE., mom_didguess = .FALSE.
     111              :       INTEGER                               :: mom_proj_formula = -1
     112              :       ! indices of de-occupied and newly occupied alpha / beta molecular orbitals
     113              :       INTEGER, DIMENSION(:), POINTER        :: mom_deoccA => NULL(), mom_deoccB => NULL(), &
     114              :                                                mom_occA => NULL(), mom_occB => NULL()
     115              :       ! determines on SCF which iteration MOM will be switched on;
     116              :       ! since MOs from the previous iteration should be available, it might be at least
     117              :       !  1 when wave-function has been read from restart file, or
     118              :       !  2 when the atomic guess method has been used
     119              :       INTEGER                               :: mom_start = -1
     120              :       INTEGER                               :: mom_type = -1
     121              :       REAL(KIND=dp)                         :: eps_iter = -1.0_dp
     122              :       REAL(KIND=dp)                         :: eps_adapt = -1.0_dp
     123              :       TYPE(qs_ot_settings_type)             :: ot_settings = qs_ot_settings_type()
     124              :    END TYPE diagonalization_type
     125              : 
     126              :    TYPE scf_control_type
     127              :       TYPE(outer_scf_control_type)          :: outer_scf = outer_scf_control_type()
     128              :       TYPE(smear_type), POINTER             :: smear => NULL()
     129              :       TYPE(diagonalization_type)            :: diagonalization = diagonalization_type()
     130              :       TYPE(gce_type), POINTER               :: gce => NULL()
     131              :       INTEGER                               :: density_guess = -1, mixing_method = -1
     132              :       REAL(KIND=dp)                         :: eps_eigval = -1.0_dp, eps_scf = -1.0_dp, eps_scf_hist = -1.0_dp, &
     133              :                                                level_shift = -1.0_dp, &
     134              :                                                eps_lumos = -1.0_dp, eps_diis = -1.0_dp
     135              :       INTEGER                               :: max_iter_lumos = -1, max_diis = -1, nmixing = -1
     136              :       INTEGER                               :: max_scf = -1, max_scf_hist = -1, &
     137              :                                                maxl = -1, nkind = -1
     138              :       LOGICAL                               :: do_diag_sub = .FALSE., &
     139              :                                                use_cholesky = .FALSE., use_ot = .FALSE., &
     140              :                                                use_diag = .FALSE., do_outer_scf_reortho = .FALSE., &
     141              :                                                ignore_convergence_failure = .FALSE.
     142              :       LOGICAL                               :: force_scf_calculation = .FALSE.
     143              :       LOGICAL                               :: non_selfconsistent = .FALSE.
     144              :       INTEGER, DIMENSION(2)                 :: added_mos = -1
     145              :       INTEGER                               :: roks_scheme = -1
     146              :       REAL(KIND=dp)                         :: roks_f = -1.0_dp
     147              :       REAL(KIND=dp), DIMENSION(0:2, 0:2, 1:2) :: roks_parameter = -1.0_dp
     148              :    END TYPE scf_control_type
     149              : 
     150              :    TYPE gce_type
     151              :       LOGICAL                               :: do_gce = .FALSE.
     152              :       REAL(KIND=dp)                         :: target_workfunction = 0.16_dp, &
     153              :                                                ref_esp = 0.0_dp, &
     154              :                                                mixing_coef = 0.3_dp, &
     155              :                                                prev_workfunction = -1001.0_dp, &
     156              :                                                nelec = 0.0_dp
     157              :    END TYPE gce_type
     158              : 
     159              : CONTAINS
     160              : 
     161              : ! **************************************************************************************************
     162              : !> \brief allocates and initializes an scf control object with the default values
     163              : !> \param scf_control the object to initialize
     164              : !> \par History
     165              : !>      09.2002 created [fawzi]
     166              : !>      - Default ROKS parameters added (05.04.06,MK)
     167              : !> \author Fawzi Mohamed
     168              : ! **************************************************************************************************
     169         8706 :    SUBROUTINE scf_c_create(scf_control)
     170              : 
     171              :       TYPE(scf_control_type), INTENT(INOUT)              :: scf_control
     172              : 
     173              :       CHARACTER(LEN=*), PARAMETER                        :: routineN = 'scf_c_create'
     174              : 
     175              :       INTEGER                                            :: handle
     176              : 
     177         8706 :       CALL timeset(routineN, handle)
     178              : 
     179              :       ! Load the default values
     180              : 
     181         8706 :       IF (scf_control%non_selfconsistent) THEN
     182          776 :          scf_control%density_guess = no_guess
     183              :       ELSE
     184         7930 :          scf_control%density_guess = atomic_guess
     185              :       END IF
     186         8706 :       scf_control%eps_eigval = 1.0E-5_dp
     187         8706 :       scf_control%eps_scf = 1.0E-5_dp
     188         8706 :       scf_control%eps_scf_hist = 0.0_dp
     189         8706 :       scf_control%eps_lumos = 1.0E-5_dp
     190         8706 :       scf_control%max_iter_lumos = 2999
     191         8706 :       scf_control%eps_diis = 0.1_dp
     192         8706 :       scf_control%level_shift = 0.0_dp
     193         8706 :       scf_control%max_diis = 4
     194         8706 :       scf_control%max_scf = 50
     195         8706 :       scf_control%nmixing = 2
     196         8706 :       scf_control%use_cholesky = .TRUE.
     197         8706 :       scf_control%use_diag = .TRUE.
     198         8706 :       scf_control%do_diag_sub = .FALSE.
     199         8706 :       scf_control%use_ot = .FALSE.
     200         8706 :       scf_control%ignore_convergence_failure = .FALSE.
     201         8706 :       scf_control%force_scf_calculation = .FALSE.
     202         8706 :       scf_control%do_outer_scf_reortho = .TRUE.
     203              :       scf_control%max_diis = 4
     204              :       scf_control%eps_diis = 0.1_dp
     205        26118 :       scf_control%added_mos(:) = 0
     206         8706 :       scf_control%max_scf_hist = 0
     207              : 
     208              :       !Mixing
     209         8706 :       IF (scf_control%non_selfconsistent) THEN
     210          776 :          scf_control%mixing_method = no_mix
     211              :       ELSE
     212         7930 :          scf_control%mixing_method = direct_p_mix
     213              :       END IF
     214              : 
     215              :       ! Diagonalization
     216         8706 :       scf_control%diagonalization%method = 0
     217         8706 :       scf_control%diagonalization%eps_jacobi = 0.0_dp
     218         8706 :       scf_control%diagonalization%jacobi_threshold = 1.0E-7_dp
     219         8706 :       scf_control%diagonalization%max_iter = 0
     220         8706 :       scf_control%diagonalization%eps_iter = 0.0_dp
     221         8706 :       scf_control%diagonalization%eps_adapt = 0.0_dp
     222         8706 :       scf_control%diagonalization%nkrylov = 0
     223         8706 :       scf_control%diagonalization%nblock_krylov = 0
     224         8706 :       CALL qs_ot_settings_init(scf_control%diagonalization%ot_settings)
     225              : 
     226         8706 :       scf_control%diagonalization%mom = .FALSE.
     227         8706 :       scf_control%diagonalization%mom_didguess = .FALSE.
     228         8706 :       scf_control%diagonalization%mom_proj_formula = 0
     229         8706 :       NULLIFY (scf_control%diagonalization%mom_deoccA)
     230         8706 :       NULLIFY (scf_control%diagonalization%mom_deoccB)
     231         8706 :       NULLIFY (scf_control%diagonalization%mom_occA)
     232         8706 :       NULLIFY (scf_control%diagonalization%mom_occB)
     233         8706 :       scf_control%diagonalization%mom_start = 0
     234              : 
     235              :       ! ROKS
     236              : 
     237         8706 :       scf_control%roks_scheme = high_spin_roks
     238         8706 :       scf_control%roks_f = 0.5_dp
     239              : 
     240              :       ! Initialize the diagonal blocks with the default ROKS parameters
     241              :       ! 0 = v)irtual, 1 = o)pen shell, 2 = c)losed shell
     242              : 
     243         8706 :       scf_control%roks_parameter(0, 0, 1) = 1.5_dp ! avv
     244         8706 :       scf_control%roks_parameter(0, 0, 2) = -0.5_dp ! bvv
     245         8706 :       scf_control%roks_parameter(1, 1, 1) = 0.5_dp ! aoo
     246         8706 :       scf_control%roks_parameter(1, 1, 2) = 0.5_dp ! boo
     247         8706 :       scf_control%roks_parameter(2, 2, 1) = -0.5_dp ! acc
     248         8706 :       scf_control%roks_parameter(2, 2, 2) = 1.5_dp ! bcc
     249              : 
     250              :       ! Initialize off-diagonal blocks (fixed)
     251              : 
     252         8706 :       scf_control%roks_parameter(0, 1, 1) = 1.0_dp ! avo
     253         8706 :       scf_control%roks_parameter(0, 1, 2) = 0.0_dp ! bvo
     254         8706 :       scf_control%roks_parameter(0, 2, 1) = 0.5_dp ! avc
     255         8706 :       scf_control%roks_parameter(0, 2, 2) = 0.5_dp ! bvc
     256         8706 :       scf_control%roks_parameter(1, 2, 1) = 0.0_dp ! aoc
     257         8706 :       scf_control%roks_parameter(1, 2, 2) = 1.0_dp ! boc
     258              : 
     259              :       ! Symmetry enforces
     260              : 
     261         8706 :       scf_control%roks_parameter(1, 0, 1) = scf_control%roks_parameter(0, 1, 1) ! aov
     262         8706 :       scf_control%roks_parameter(1, 0, 2) = scf_control%roks_parameter(0, 1, 2) ! bov
     263         8706 :       scf_control%roks_parameter(2, 0, 1) = scf_control%roks_parameter(0, 2, 1) ! acv
     264         8706 :       scf_control%roks_parameter(2, 0, 2) = scf_control%roks_parameter(0, 2, 2) ! bcv
     265         8706 :       scf_control%roks_parameter(2, 1, 1) = scf_control%roks_parameter(1, 2, 1) ! aco
     266         8706 :       scf_control%roks_parameter(2, 1, 2) = scf_control%roks_parameter(1, 2, 2) ! bco
     267              : 
     268              :       ! Outer SCF default settings
     269              : 
     270         8706 :       scf_control%outer_scf%have_scf = .FALSE.
     271         8706 :       scf_control%outer_scf%max_scf = 0
     272         8706 :       scf_control%outer_scf%eps_scf = 0.0_dp
     273         8706 :       scf_control%outer_scf%step_size = 0.0_dp
     274         8706 :       scf_control%outer_scf%type = -1
     275         8706 :       scf_control%outer_scf%optimizer = -1
     276         8706 :       scf_control%outer_scf%diis_buffer_length = -1
     277         8706 :       NULLIFY (scf_control%outer_scf%cdft_opt_control)
     278              : 
     279              :       ! Smearing of the MO occupations
     280              : 
     281         8706 :       NULLIFY (scf_control%smear)
     282              : 
     283         8706 :       CALL timestop(handle)
     284              : 
     285         8706 :    END SUBROUTINE scf_c_create
     286              : 
     287              : ! **************************************************************************************************
     288              : !> \brief releases the given scf_control (see cp2k/doc/ReferenceCounting.html)
     289              : !> \param scf_control the object to free
     290              : !> \par History
     291              : !>      09.2002 created [fawzi]
     292              : !> \author Fawzi Mohamed
     293              : !> \note
     294              : !>      at the moment does nothing
     295              : ! **************************************************************************************************
     296         8706 :    SUBROUTINE scf_c_release(scf_control)
     297              : 
     298              :       TYPE(scf_control_type), INTENT(INOUT)              :: scf_control
     299              : 
     300         8706 :       IF (ASSOCIATED(scf_control%smear%list)) THEN
     301            2 :          DEALLOCATE (scf_control%smear%list)
     302              :       END IF
     303         8706 :       DEALLOCATE (scf_control%smear)
     304              : 
     305         8706 :       IF (ASSOCIATED(scf_control%outer_scf%cdft_opt_control)) THEN
     306           70 :          CALL cdft_opt_type_release(scf_control%outer_scf%cdft_opt_control)
     307              :       END IF
     308              : 
     309         8706 :       IF (ASSOCIATED(scf_control%gce)) THEN
     310         8706 :          DEALLOCATE (scf_control%gce)
     311              :       END IF
     312              : 
     313              :       ! Maximum overlap method orbital indices lists
     314              :       ! mom_deoccA, mom_deoccB, mom_occA, mom_occB
     315              :       ! points to memory allocated by input file parser,
     316              :       ! so they do not have to be deallocated
     317              : 
     318         8706 :    END SUBROUTINE scf_c_release
     319              : 
     320              : ! **************************************************************************************************
     321              : !> \brief reads the parameters of the scf section into the given scf_control
     322              : !> \param scf_control the object that wil contain the values read
     323              : !> \param inp_section ...
     324              : !> \par History
     325              : !>      05.2001 created [Matthias]
     326              : !>      09.2002 creaded separated scf_control type [fawzi]
     327              : !> \author Matthias Krack
     328              : ! **************************************************************************************************
     329        34824 :    SUBROUTINE scf_c_read_parameters(scf_control, inp_section)
     330              : 
     331              :       TYPE(scf_control_type), INTENT(INOUT)              :: scf_control
     332              :       TYPE(section_vals_type), POINTER                   :: inp_section
     333              : 
     334              :       CHARACTER(LEN=*), PARAMETER :: routineN = 'scf_c_read_parameters'
     335              : 
     336              :       INTEGER                                            :: cholesky_flag, handle, ialgo
     337         8706 :       INTEGER, DIMENSION(:), POINTER                     :: added_mos
     338              :       LOGICAL                                            :: do_mixing, explicit
     339         8706 :       REAL(KIND=dp), DIMENSION(:), POINTER               :: roks_parameter
     340              :       TYPE(section_vals_type), POINTER                   :: gce_section, mixing_section, &
     341              :                                                             outer_scf_section, scf_section, &
     342              :                                                             smear_section
     343              : 
     344         8706 :       CALL timeset(routineN, handle)
     345              : 
     346         8706 :       scf_section => section_vals_get_subs_vals(inp_section, "SCF")
     347              :       CALL section_vals_val_get(scf_section, "DIAGONALIZATION%_SECTION_PARAMETERS_", &
     348         8706 :                                 l_val=scf_control%use_diag)
     349         8706 :       IF (scf_control%use_diag) THEN
     350              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%DIAG_SUB_SCF%_SECTION_PARAMETERS_", &
     351          434 :                                    l_val=scf_control%do_diag_sub)
     352              :       END IF
     353         8706 :       CALL section_vals_val_get(scf_section, "OT%_SECTION_PARAMETERS_", l_val=scf_control%use_ot)
     354         8706 :       IF (scf_control%use_diag .AND. scf_control%use_ot) THEN
     355              :          ! don't allow both options to be true
     356            0 :          CPABORT("Don't activate OT and Diagonaliztion together")
     357         8706 :       ELSE IF (.NOT. (scf_control%use_diag .OR. scf_control%use_ot)) THEN
     358              :          ! set default to diagonalization
     359         5962 :          scf_control%use_diag = .TRUE.
     360              :       END IF
     361         8706 :       CALL section_vals_val_get(scf_section, "OT%ALGORITHM", i_val=ialgo)
     362         8706 :       scf_control%do_outer_scf_reortho = ialgo == ot_algo_taylor_or_diag
     363         8706 :       CALL section_vals_val_get(scf_section, "SCF_GUESS", i_val=scf_control%density_guess)
     364         8706 :       CALL section_vals_val_get(scf_section, "eps_eigval", r_val=scf_control%eps_eigval)
     365         8706 :       CALL section_vals_val_get(scf_section, "cholesky", i_val=cholesky_flag)
     366         8706 :       IF (scf_control%use_ot) THEN
     367              :          ! eps_diis default is 0 for OT
     368         2310 :          scf_control%eps_diis = 0.0_dp
     369         2310 :          CALL section_vals_val_get(scf_section, "EPS_DIIS", explicit=explicit)
     370         2310 :          IF (explicit) THEN
     371            6 :             CALL section_vals_val_get(scf_section, "EPS_DIIS", r_val=scf_control%eps_diis)
     372              :          END IF
     373              :       ELSE
     374         6396 :          CALL section_vals_val_get(scf_section, "EPS_DIIS", r_val=scf_control%eps_diis)
     375              :       END IF
     376         8706 :       IF (cholesky_flag > 0) THEN
     377         8538 :          scf_control%use_cholesky = .TRUE.
     378              :       END IF
     379         8706 :       CALL section_vals_val_get(scf_section, "IGNORE_CONVERGENCE_FAILURE", l_val=scf_control%ignore_convergence_failure)
     380         8706 :       CALL section_vals_val_get(scf_section, "FORCE_SCF_CALCULATION", l_val=scf_control%force_scf_calculation)
     381         8706 :       CALL section_vals_val_get(scf_section, "eps_scf", r_val=scf_control%eps_scf)
     382         8706 :       CALL section_vals_val_get(scf_section, "level_shift", r_val=scf_control%level_shift)
     383         8706 :       CALL section_vals_val_get(scf_section, "max_diis", i_val=scf_control%max_diis)
     384         8706 :       CALL section_vals_val_get(scf_section, "max_scf", i_val=scf_control%max_scf)
     385              : 
     386              :       ! Diagonaliztion section
     387         8706 :       IF (scf_control%use_diag) THEN
     388              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%ALGORITHM", &
     389         6396 :                                    i_val=scf_control%diagonalization%method)
     390              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%EPS_JACOBI", &
     391         6396 :                                    r_val=scf_control%diagonalization%eps_jacobi)
     392              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%JACOBI_THRESHOLD", &
     393         6396 :                                    r_val=scf_control%diagonalization%jacobi_threshold)
     394              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%MAX_ITER", &
     395         6396 :                                    i_val=scf_control%diagonalization%max_iter)
     396              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%EPS_ITER", &
     397         6396 :                                    r_val=scf_control%diagonalization%eps_iter)
     398              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%EPS_ADAPT", &
     399         6396 :                                    r_val=scf_control%diagonalization%eps_adapt)
     400              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%KRYLOV%NKRYLOV", &
     401         6396 :                                    i_val=scf_control%diagonalization%nkrylov)
     402              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%KRYLOV%NBLOCK", &
     403         6396 :                                    i_val=scf_control%diagonalization%nblock_krylov)
     404         6396 :          IF (scf_control%diagonalization%method == diag_ot) THEN
     405              :             ! read OT section
     406            8 :             CALL ot_diag_read_input(scf_control%diagonalization%ot_settings, scf_section)
     407              :          END IF
     408              :          ! read maximum overlap method's parameters
     409              :          CALL section_vals_val_get(scf_section, "MOM%_SECTION_PARAMETERS_", &
     410         6396 :                                    l_val=scf_control%diagonalization%MOM)
     411         6396 :          IF (scf_control%diagonalization%mom) THEN
     412              :             CALL section_vals_val_get(scf_section, "MOM%MOM_TYPE", &
     413           20 :                                       i_val=scf_control%diagonalization%mom_type)
     414              : 
     415              :             CALL section_vals_val_get(scf_section, "MOM%START_ITER", &
     416           20 :                                       i_val=scf_control%diagonalization%mom_start)
     417              : 
     418              :             CALL section_vals_val_get(scf_section, "MOM%DEOCC_ALPHA", &
     419           20 :                                       i_vals=scf_control%diagonalization%mom_deoccA)
     420              : 
     421              :             CALL section_vals_val_get(scf_section, "MOM%DEOCC_BETA", &
     422           20 :                                       i_vals=scf_control%diagonalization%mom_deoccB)
     423              : 
     424              :             CALL section_vals_val_get(scf_section, "MOM%OCC_ALPHA", &
     425           20 :                                       i_vals=scf_control%diagonalization%mom_occA)
     426              : 
     427              :             CALL section_vals_val_get(scf_section, "MOM%OCC_BETA", &
     428           20 :                                       i_vals=scf_control%diagonalization%mom_occB)
     429              : 
     430              :             CALL section_vals_val_get(scf_section, "MOM%PROJ_FORMULA", &
     431           20 :                                       i_val=scf_control%diagonalization%mom_proj_formula)
     432              :          END IF
     433              :       END IF
     434              : 
     435              :       ! Read ROKS parameters
     436         8706 :       CALL section_vals_val_get(scf_section, "ROKS_SCHEME", i_val=scf_control%roks_scheme)
     437              : 
     438         8706 :       SELECT CASE (scf_control%roks_scheme)
     439              :       CASE (general_roks)
     440              :          ! Read parameters for the general ROKS scheme
     441            0 :          CALL section_vals_val_get(scf_section, "ROKS_F", r_val=scf_control%roks_f)
     442              :       CASE (high_spin_roks)
     443              :          ! Read high-spin ROKS parameters for the diagonal block
     444              :          ! 0 = v)irtual, 1 = o)pen shell, 2 = c)losed shell
     445         8706 :          NULLIFY (roks_parameter)
     446         8706 :          CALL section_vals_val_get(scf_section, "ROKS_PARAMETERS", r_vals=roks_parameter)
     447        17412 :          IF (ASSOCIATED(roks_parameter)) THEN
     448         8706 :             scf_control%roks_parameter(2, 2, 1) = roks_parameter(1) ! acc
     449         8706 :             scf_control%roks_parameter(2, 2, 2) = roks_parameter(2) ! bcc
     450         8706 :             scf_control%roks_parameter(1, 1, 1) = roks_parameter(3) ! aoo
     451         8706 :             scf_control%roks_parameter(1, 1, 2) = roks_parameter(4) ! boo
     452         8706 :             scf_control%roks_parameter(0, 0, 1) = roks_parameter(5) ! avv
     453         8706 :             scf_control%roks_parameter(0, 0, 2) = roks_parameter(6) ! bvv
     454              :          END IF
     455              :       END SELECT
     456              : 
     457              :       ! should be moved to printkey
     458         8706 :       CALL section_vals_val_get(scf_section, "eps_lumo", r_val=scf_control%eps_lumos)
     459         8706 :       CALL section_vals_val_get(scf_section, "max_iter_lumo", i_val=scf_control%max_iter_lumos)
     460              : 
     461              :       ! Extra MOs, e.g. for smearing
     462         8706 :       CALL section_vals_val_get(scf_section, "added_mos", i_vals=added_mos)
     463         8706 :       CPASSERT(ASSOCIATED(added_mos))
     464         8706 :       IF (SIZE(added_mos) > 0) THEN
     465         8706 :          scf_control%added_mos(1) = added_mos(1)
     466         8706 :          IF (SIZE(added_mos) > 1) THEN
     467         1014 :             scf_control%added_mos(2) = added_mos(2)
     468              :          END IF
     469              :       END IF
     470              : 
     471         8706 :       CALL section_vals_val_get(scf_section, "max_scf_history", i_val=scf_control%max_scf_hist)
     472         8706 :       CALL section_vals_val_get(scf_section, "eps_scf_history", r_val=scf_control%eps_scf_hist)
     473              : 
     474         8706 :       IF (scf_control%level_shift /= 0.0_dp) scf_control%use_cholesky = .FALSE.
     475              : 
     476              :       ! Outer SCF subsection
     477         8706 :       outer_scf_section => section_vals_get_subs_vals(scf_section, "OUTER_SCF")
     478         8706 :       CALL outer_scf_read_parameters(scf_control%outer_scf, outer_scf_section)
     479              : 
     480         8706 :       smear_section => section_vals_get_subs_vals(scf_section, "SMEAR")
     481         8706 :       CALL init_smear(scf_control%smear)
     482         8706 :       CALL read_smear_section(scf_control%smear, smear_section)
     483              : 
     484              :       do_mixing = .FALSE.
     485         8706 :       mixing_section => section_vals_get_subs_vals(scf_section, "MIXING")
     486              :       CALL section_vals_val_get(mixing_section, "_SECTION_PARAMETERS_", &
     487         8706 :                                 l_val=do_mixing)
     488         8706 :       IF (do_mixing) THEN
     489              :          CALL section_vals_val_get(mixing_section, "METHOD", &
     490         8706 :                                    i_val=scf_control%mixing_method)
     491         8706 :          CALL section_vals_val_get(mixing_section, "NMIXING", i_val=scf_control%nmixing)
     492              :       END IF ! do mixing
     493              : 
     494         8706 :       gce_section => section_vals_get_subs_vals(scf_section, "GCE")
     495         8706 :       CALL init_gce(scf_control%gce)
     496         8706 :       CALL read_gce_section(scf_control%gce, gce_section)
     497              : 
     498         8706 :       CALL timestop(handle)
     499              : 
     500         8706 :    END SUBROUTINE scf_c_read_parameters
     501              : 
     502              : ! **************************************************************************************************
     503              : !> \brief ...
     504              : !> \param smear ...
     505              : ! **************************************************************************************************
     506         8706 :    SUBROUTINE init_smear(smear)
     507              :       TYPE(smear_type), POINTER                          :: smear
     508              : 
     509         8706 :       CPASSERT(.NOT. ASSOCIATED(smear))
     510         8706 :       ALLOCATE (smear)
     511              :       smear%do_smear = .FALSE.
     512         8706 :       smear%method = smear_energy_window
     513         8706 :       smear%electronic_temperature = 0.0_dp
     514         8706 :       smear%eps_fermi_dirac = 1.0E-5_dp
     515         8706 :       smear%fixed_mag_mom = -100.0_dp
     516         8706 :       smear%window_size = 0.0_dp
     517         8706 :       smear%smearing_width = 0.0_dp
     518              :       NULLIFY (smear%list)
     519         8706 :    END SUBROUTINE init_smear
     520              : 
     521              : ! **************************************************************************************************
     522              : !> \brief ...
     523              : !> \param smear ...
     524              : !> \param smear_section ...
     525              : ! **************************************************************************************************
     526         8706 :    SUBROUTINE read_smear_section(smear, smear_section)
     527              :       TYPE(smear_type), POINTER                          :: smear
     528              :       TYPE(section_vals_type), POINTER                   :: smear_section
     529              : 
     530         8706 :       REAL(KIND=dp), DIMENSION(:), POINTER               :: r_vals
     531              : 
     532         8706 :       NULLIFY (r_vals)
     533              : 
     534              :       CALL section_vals_val_get(smear_section, "_SECTION_PARAMETERS_", &
     535         8706 :                                 l_val=smear%do_smear)
     536         8706 :       IF (smear%do_smear) THEN
     537              :          CALL section_vals_val_get(smear_section, "METHOD", &
     538         1002 :                                    i_val=smear%method)
     539              :          CALL section_vals_val_get(smear_section, "ELECTRONIC_TEMPERATURE", &
     540         1002 :                                    r_val=smear%electronic_temperature)
     541              :          CALL section_vals_val_get(smear_section, "EPS_FERMI_DIRAC", &
     542         1002 :                                    r_val=smear%eps_fermi_dirac)
     543              :          CALL section_vals_val_get(smear_section, "WINDOW_SIZE", &
     544         1002 :                                    r_val=smear%window_size)
     545              :          IF (smear%method == smear_gaussian .OR. &
     546         1002 :              smear%method == smear_mp .OR. &
     547              :              smear%method == smear_mv) THEN
     548              :             CALL section_vals_val_get(smear_section, "SIGMA", &
     549           70 :                                       r_val=smear%smearing_width)
     550              :          END IF
     551         1002 :          IF (smear%method == smear_list) THEN
     552              :             CALL section_vals_val_get(smear_section, "LIST", &
     553            2 :                                       r_vals=r_vals)
     554            2 :             CPASSERT(ASSOCIATED(r_vals))
     555            6 :             ALLOCATE (smear%list(SIZE(r_vals)))
     556           28 :             smear%list = r_vals
     557              :          END IF
     558              :          CALL section_vals_val_get(smear_section, "FIXED_MAGNETIC_MOMENT", &
     559         1002 :                                    r_val=smear%fixed_mag_mom)
     560              :       END IF ! do smear
     561         8706 :    END SUBROUTINE read_smear_section
     562              : 
     563              : ! **************************************************************************************************
     564              : !> \brief ...
     565              : !> \param gce ...
     566              : ! **************************************************************************************************
     567         8706 :    SUBROUTINE init_gce(gce)
     568              :       TYPE(gce_type), POINTER                            :: gce
     569              : 
     570         8706 :       CPASSERT(.NOT. ASSOCIATED(gce))
     571         8706 :       ALLOCATE (gce)
     572              :       gce%do_gce = .FALSE.
     573              :       gce%target_workfunction = 0.16_dp
     574              :       gce%prev_workfunction = -1001.0_dp
     575              :       gce%ref_esp = 0.0_dp
     576              :       gce%mixing_coef = 0.3_dp
     577         8706 :    END SUBROUTINE init_gce
     578              : 
     579              : ! **************************************************************************************************
     580              : !> \brief ...
     581              : !> \param gce ...
     582              : !> \param gce_section ...
     583              : ! **************************************************************************************************
     584         8706 :    SUBROUTINE read_gce_section(gce, gce_section)
     585              :       TYPE(gce_type), POINTER                            :: gce
     586              :       TYPE(section_vals_type), POINTER                   :: gce_section
     587              : 
     588              :       CALL section_vals_val_get(gce_section, "_SECTION_PARAMETERS_", &
     589         8706 :                                 l_val=gce%do_gce)
     590         8706 :       IF (gce%do_gce) THEN
     591              :          CALL section_vals_val_get(gce_section, "TARGET_WORKFUNCTION", &
     592            2 :                                    r_val=gce%target_workfunction)
     593              :          CALL section_vals_val_get(gce_section, "MIXING_COEF", &
     594            2 :                                    r_val=gce%mixing_coef)
     595              :       END IF ! do gce
     596         8706 :    END SUBROUTINE read_gce_section
     597              : 
     598              : ! **************************************************************************************************
     599              : !> \brief writes out the scf parameters
     600              : !> \param scf_control the object you want to print
     601              : !> \param dft_section ...
     602              : !> \par History
     603              : !>      05.2001 created [Matthias]
     604              : !>      09.2002 created separated scf_control type [fawzi]
     605              : !> \author Matthias Krack
     606              : ! **************************************************************************************************
     607         8198 :    SUBROUTINE scf_c_write_parameters(scf_control, dft_section)
     608              : 
     609              :       TYPE(scf_control_type), INTENT(IN)                 :: scf_control
     610              :       TYPE(section_vals_type), POINTER                   :: dft_section
     611              : 
     612              :       CHARACTER(LEN=*), PARAMETER :: routineN = 'scf_c_write_parameters'
     613              : 
     614              :       INTEGER                                            :: handle, output_unit, roks_scheme
     615              :       LOGICAL                                            :: roks
     616              :       REAL(KIND=dp)                                      :: elec_temp
     617              :       TYPE(cp_logger_type), POINTER                      :: logger
     618              :       TYPE(enumeration_type), POINTER                    :: enum
     619              :       TYPE(keyword_type), POINTER                        :: keyword
     620              :       TYPE(section_type), POINTER                        :: section
     621              :       TYPE(section_vals_type), POINTER                   :: scf_section
     622              : 
     623         8198 :       CALL timeset(routineN, handle)
     624              : 
     625         8198 :       NULLIFY (logger)
     626         8198 :       logger => cp_get_default_logger()
     627              : 
     628         8198 :       NULLIFY (scf_section)
     629         8198 :       NULLIFY (section)
     630              : 
     631         8198 :       scf_section => section_vals_get_subs_vals(dft_section, "SCF")
     632              :       output_unit = cp_print_key_unit_nr(logger, scf_section, "PRINT%PROGRAM_RUN_INFO", &
     633         8198 :                                          extension=".scfLog")
     634              : 
     635         8198 :       IF (output_unit > 0) THEN
     636              : 
     637         4113 :          IF (scf_control%max_scf > 0) THEN
     638              : 
     639         3792 :             CALL create_scf_section(section)
     640              : 
     641         3792 :             keyword => section_get_keyword(section, "SCF_GUESS")
     642         3792 :             CALL keyword_get(keyword, enum=enum)
     643              : 
     644         3792 :             IF (.NOT. scf_control%non_selfconsistent .OR. scf_control%force_scf_calculation) THEN
     645              :                WRITE (UNIT=output_unit, &
     646              :                       FMT="(/,/,T2,A,T25,A,T51,A30,/,T25,56('-'),3(/,T25,A,T76,I5),/, "// &
     647              :                       "T25,56('-'),4(/,T25,A,T72,ES9.2),/,T25,56('-'), "// &
     648              :                       "1(/,T25,A,T71,F10.6))") &
     649         3409 :                   "SCF PARAMETERS", &
     650         3409 :                   "Density guess:     ", ADJUSTR(TRIM(enum_i2c(enum, scf_control%density_guess))), &
     651         3409 :                   "max_scf:           ", scf_control%max_scf, &
     652         3409 :                   "max_scf_history:   ", scf_control%max_scf_hist, &
     653         3409 :                   "max_diis:          ", scf_control%max_diis, &
     654         3409 :                   "eps_scf:           ", scf_control%eps_scf, &
     655         3409 :                   "eps_scf_history:   ", scf_control%eps_scf_hist, &
     656         3409 :                   "eps_diis:          ", scf_control%eps_diis, &
     657         3409 :                   "eps_eigval:        ", scf_control%eps_eigval, &
     658         6818 :                   "level_shift [a.u.]:", scf_control%level_shift
     659              :             END IF
     660              : 
     661        11376 :             IF (SUM(ABS(scf_control%added_mos)) > 0) THEN
     662              :                WRITE (UNIT=output_unit, FMT="(T25,A,T71,2I5)") &
     663          730 :                   "added MOs          ", scf_control%added_mos
     664              :             END IF
     665              : 
     666         3792 :             IF (scf_control%diagonalization%mom) THEN
     667              :                ! TODO extend the output with further parameters
     668           10 :                WRITE (UNIT=output_unit, FMT="(T25,A)") "MOM enabled"
     669              :             END IF
     670              : 
     671         3792 :             IF (scf_control%mixing_method > 0 .AND. .NOT. scf_control%use_ot .AND. &
     672              :                 .NOT. scf_control%non_selfconsistent) THEN
     673         2236 :                keyword => section_get_keyword(section, "MIXING%METHOD")
     674         2236 :                CALL keyword_get(keyword, enum=enum)
     675              :                WRITE (UNIT=output_unit, FMT="(T25,A,/,T25,A,T51,A30)") &
     676         2236 :                   REPEAT("-", 56), &
     677         4472 :                   "Mixing method:      ", ADJUSTR(TRIM(enum_i2c(enum, scf_control%mixing_method)))
     678         2236 :                IF (scf_control%mixing_method > 1) THEN
     679          193 :                   WRITE (UNIT=output_unit, FMT="(T47,A34)") "charge density mixing in g-space"
     680              :                END IF
     681              :             END IF
     682         3792 :             IF (scf_control%smear%do_smear) THEN
     683          552 :                keyword => section_get_keyword(section, "SMEAR%METHOD")
     684          552 :                CALL keyword_get(keyword, enum=enum)
     685              :                WRITE (UNIT=output_unit, FMT="(T25,A,/,T25,A,T51,A30)") &
     686          552 :                   REPEAT("-", 56), &
     687         1104 :                   "Smear method:      ", ADJUSTR(TRIM(enum_i2c(enum, scf_control%smear%method)))
     688         1063 :                SELECT CASE (scf_control%smear%method)
     689              :                CASE (smear_fermi_dirac)
     690              :                   elec_temp = cp_unit_from_cp2k(scf_control%smear%electronic_temperature, &
     691          511 :                                                 "K")
     692              :                   WRITE (UNIT=output_unit, FMT="(T25,A,T61,F20.1)") &
     693          511 :                      "Electronic temperature [K]:", elec_temp
     694              :                   WRITE (UNIT=output_unit, FMT="(T25,A,T71,ES10.2)") &
     695          511 :                      "Electronic temperature [a.u.]:", scf_control%smear%electronic_temperature, &
     696         1022 :                      "Accuracy threshold:", scf_control%smear%eps_fermi_dirac
     697          511 :                   IF (scf_control%smear%fixed_mag_mom > 0.0_dp) WRITE (UNIT=output_unit, FMT="(T25,A,T61,F20.1)") &
     698           89 :                      "Fixed magnetic moment set to:", scf_control%smear%fixed_mag_mom
     699              :                CASE (smear_gaussian, smear_mp, smear_mv)
     700              :                   WRITE (UNIT=output_unit, FMT="(T25,A,T71,ES10.2)") &
     701           34 :                      "Smearing width (sigma) [a.u.]:", scf_control%smear%smearing_width, &
     702           68 :                      "Accuracy threshold:", scf_control%smear%eps_fermi_dirac
     703           34 :                   IF (scf_control%smear%fixed_mag_mom > 0.0_dp) THEN
     704              :                      WRITE (UNIT=output_unit, FMT="(T25,A,T61,F20.1)") &
     705            0 :                         "Fixed magnetic moment set to:", scf_control%smear%fixed_mag_mom
     706              :                   END IF
     707              :                CASE (smear_energy_window)
     708              :                   WRITE (UNIT=output_unit, FMT="(T25,A,T71,F10.6)") &
     709          552 :                      "Smear window [a.u.]:       ", scf_control%smear%window_size
     710              :                END SELECT
     711              :             END IF
     712              : 
     713         3792 :             IF (scf_control%gce%do_gce) THEN
     714              :                WRITE (UNIT=output_unit, FMT="(T25,A,/,T25,A,T61,F20.1)") &
     715            1 :                   REPEAT("-", 56), &
     716            2 :                   "Target workfunction [eV]:", scf_control%gce%target_workfunction
     717            1 :                WRITE (UNIT=output_unit, FMT="(T25,A,T61,F20.1)") "Mixing coefficient:", scf_control%gce%mixing_coef
     718            1 :                WRITE (UNIT=output_unit, FMT="(T25,A)") "Grand canonical SCF is activated."
     719              :             END IF
     720              : 
     721         3792 :             CALL section_vals_val_get(dft_section, "ROKS", l_val=roks)
     722         3792 :             IF (roks .AND. (.NOT. scf_control%use_ot)) THEN
     723              :                CALL section_vals_val_get(scf_section, "ROKS_SCHEME", &
     724           22 :                                          i_val=roks_scheme)
     725           22 :                keyword => section_get_keyword(section, "ROKS_SCHEME")
     726           22 :                CALL keyword_get(keyword, enum=enum)
     727              :                WRITE (UNIT=output_unit, FMT="(T25,A,/,T25,A,T51,A30)") &
     728           22 :                   REPEAT("-", 56), &
     729           44 :                   "ROKS scheme:", ADJUSTR(TRIM(enum_i2c(enum, roks_scheme)))
     730            0 :                SELECT CASE (roks_scheme)
     731              :                CASE (general_roks)
     732              :                   WRITE (UNIT=output_unit, FMT="(T25,A,T71,F10.6)") &
     733            0 :                      "ROKS parameter f:", scf_control%roks_f
     734              :                CASE (high_spin_roks)
     735              :                   WRITE (UNIT=output_unit, &
     736              :                          FMT="(T25,A,6(/,T25,A,T71,F10.6))") &
     737           22 :                      "ROKS parameters: a)lpha, b)eta; c)losed, o)pen, v)irtual", &
     738           22 :                      "acc", scf_control%roks_parameter(2, 2, 1), &
     739           22 :                      "bcc", scf_control%roks_parameter(2, 2, 2), &
     740           22 :                      "aoo", scf_control%roks_parameter(1, 1, 1), &
     741           22 :                      "boo", scf_control%roks_parameter(1, 1, 2), &
     742           22 :                      "avv", scf_control%roks_parameter(0, 0, 1), &
     743           44 :                      "bvv", scf_control%roks_parameter(0, 0, 2)
     744              :                END SELECT
     745              :             END IF
     746         3792 :             CALL section_release(section)
     747              : 
     748         3792 :             IF (scf_control%outer_scf%have_scf) THEN
     749          784 :                WRITE (output_unit, "(T25,56('-'),/,T25,A)") "Outer loop SCF in use "
     750         1563 :                SELECT CASE (scf_control%outer_scf%type)
     751              :                CASE (outer_scf_none)
     752          779 :                   WRITE (output_unit, '(T25,A)') "No variables optimised in outer loop"
     753              :                CASE (outer_scf_ddapc_constraint)
     754            5 :                   WRITE (output_unit, '(T25,A)') "DDAPC constraint enforced"
     755              :                CASE (outer_scf_s2_constraint)
     756            0 :                   WRITE (output_unit, '(T25,A)') "S2 constraint enforced"
     757              :                CASE (outer_scf_basis_center_opt)
     758            0 :                   WRITE (output_unit, '(T25,A)') "Floating basis function optimization enforced"
     759              :                CASE (outer_scf_cdft_constraint)
     760            0 :                   CPABORT("CDFT constraints must be defined in QS&CDFT")
     761              :                CASE DEFAULT
     762          784 :                   CPABORT("Unknown outer SCF type")
     763              :                END SELECT
     764          784 :                WRITE (output_unit, '(T25,A,T72,ES9.2)') "eps_scf", scf_control%outer_scf%eps_scf
     765          784 :                WRITE (output_unit, '(T25,A,T72,I9)') "max_scf", scf_control%outer_scf%max_scf
     766         1563 :                SELECT CASE (scf_control%outer_scf%optimizer)
     767              :                CASE (outer_scf_optimizer_none)
     768          779 :                   WRITE (output_unit, '(T25,A)') "No outer loop optimization"
     769              :                CASE (outer_scf_optimizer_sd)
     770            2 :                   WRITE (output_unit, '(T25,A)') "Steepest descent optimization"
     771              :                CASE (outer_scf_optimizer_bisect)
     772            1 :                   WRITE (output_unit, '(T25,A)') "Gradient bisection"
     773            1 :                   WRITE (output_unit, '(T25,A,T72,I9)') "bisect_trust_count", scf_control%outer_scf%bisect_trust_count
     774              :                CASE (outer_scf_optimizer_diis)
     775            2 :                   WRITE (output_unit, '(T25,A)') "DIIS optimization"
     776            2 :                   WRITE (output_unit, '(T25,A,T72,I9)') "DIIS buffer length", &
     777            4 :                      scf_control%outer_scf%diis_buffer_length
     778              :                CASE (outer_scf_optimizer_broyden, outer_scf_optimizer_newton, &
     779              :                      outer_scf_optimizer_newton_ls)
     780            0 :                   CPABORT("Selected optimizer only compatible with CDFT")
     781              :                CASE (outer_scf_optimizer_secant)
     782            0 :                   WRITE (output_unit, '(T25,A)') "Optimization with the secant method"
     783              :                CASE DEFAULT
     784          784 :                   CPABORT("Unknown outer SCF optimizer")
     785              :                END SELECT
     786          784 :                WRITE (output_unit, '(T25,A,T72,ES9.2)') "step_size", scf_control%outer_scf%step_size
     787              :             ELSE
     788         3008 :                WRITE (output_unit, "(T25,56('-'),/,T25,A)") "No outer SCF"
     789              :             END IF
     790              : 
     791              :          END IF ! max_scf > 0
     792              : 
     793              :       END IF ! output_unit > 0
     794              : 
     795              :       CALL cp_print_key_finished_output(output_unit, logger, scf_section, &
     796         8198 :                                         "PRINT%PROGRAM_RUN_INFO")
     797              : 
     798         8198 :       CALL timestop(handle)
     799              : 
     800         8198 :    END SUBROUTINE scf_c_write_parameters
     801              : 
     802              : ! **************************************************************************************************
     803              : 
     804              : ! **************************************************************************************************
     805              : !> \brief ...
     806              : !> \param settings ...
     807              : !> \param scf_section ...
     808              : ! **************************************************************************************************
     809           16 :    SUBROUTINE ot_diag_read_input(settings, scf_section)
     810              :       TYPE(qs_ot_settings_type)                          :: settings
     811              :       TYPE(section_vals_type), POINTER                   :: scf_section
     812              : 
     813              :       CHARACTER(len=*), PARAMETER :: routineN = 'ot_diag_read_input'
     814              : 
     815              :       INTEGER                                            :: handle, output_unit
     816              :       LOGICAL                                            :: explicit
     817              :       TYPE(cp_logger_type), POINTER                      :: logger
     818              :       TYPE(section_vals_type), POINTER                   :: ot_section
     819              : 
     820            8 :       CALL timeset(routineN, handle)
     821              : 
     822            8 :       logger => cp_get_default_logger()
     823              :       output_unit = cp_print_key_unit_nr(logger, scf_section, "PRINT%PROGRAM_RUN_INFO", &
     824            8 :                                          extension=".log")
     825              : 
     826              :       ! decide default settings
     827            8 :       CALL qs_ot_settings_init(settings)
     828              : 
     829              :       ! use ot input new style
     830            8 :       ot_section => section_vals_get_subs_vals(scf_section, "DIAGONALIZATION%OT")
     831            8 :       CALL section_vals_get(ot_section, explicit=explicit)
     832              : 
     833            8 :       CALL ot_readwrite_input(settings, ot_section, output_unit)
     834              : 
     835              :       CALL cp_print_key_finished_output(output_unit, logger, scf_section, &
     836            8 :                                         "PRINT%PROGRAM_RUN_INFO")
     837              : 
     838            8 :       CALL timestop(handle)
     839              : 
     840            8 :    END SUBROUTINE ot_diag_read_input
     841              : 
     842              : ! **************************************************************************************************
     843              : 
     844            0 : END MODULE scf_control_types
        

Generated by: LCOV version 2.0-1