LCOV - code coverage report
Current view: top level - src - scf_control_types.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:06f838d) Lines: 94.8 % 325 308
Test Date: 2026-06-05 07:04:50 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              :    END TYPE gce_type
     157              : 
     158              : CONTAINS
     159              : 
     160              : ! **************************************************************************************************
     161              : !> \brief allocates and initializes an scf control object with the default values
     162              : !> \param scf_control the object to initialize
     163              : !> \par History
     164              : !>      09.2002 created [fawzi]
     165              : !>      - Default ROKS parameters added (05.04.06,MK)
     166              : !> \author Fawzi Mohamed
     167              : ! **************************************************************************************************
     168         8472 :    SUBROUTINE scf_c_create(scf_control)
     169              : 
     170              :       TYPE(scf_control_type), INTENT(INOUT)              :: scf_control
     171              : 
     172              :       CHARACTER(LEN=*), PARAMETER                        :: routineN = 'scf_c_create'
     173              : 
     174              :       INTEGER                                            :: handle
     175              : 
     176         8472 :       CALL timeset(routineN, handle)
     177              : 
     178              :       ! Load the default values
     179              : 
     180         8472 :       IF (scf_control%non_selfconsistent) THEN
     181          776 :          scf_control%density_guess = no_guess
     182              :       ELSE
     183         7696 :          scf_control%density_guess = atomic_guess
     184              :       END IF
     185         8472 :       scf_control%eps_eigval = 1.0E-5_dp
     186         8472 :       scf_control%eps_scf = 1.0E-5_dp
     187         8472 :       scf_control%eps_scf_hist = 0.0_dp
     188         8472 :       scf_control%eps_lumos = 1.0E-5_dp
     189         8472 :       scf_control%max_iter_lumos = 2999
     190         8472 :       scf_control%eps_diis = 0.1_dp
     191         8472 :       scf_control%level_shift = 0.0_dp
     192         8472 :       scf_control%max_diis = 4
     193         8472 :       scf_control%max_scf = 50
     194         8472 :       scf_control%nmixing = 2
     195         8472 :       scf_control%use_cholesky = .TRUE.
     196         8472 :       scf_control%use_diag = .TRUE.
     197         8472 :       scf_control%do_diag_sub = .FALSE.
     198         8472 :       scf_control%use_ot = .FALSE.
     199         8472 :       scf_control%ignore_convergence_failure = .FALSE.
     200         8472 :       scf_control%force_scf_calculation = .FALSE.
     201         8472 :       scf_control%do_outer_scf_reortho = .TRUE.
     202              :       scf_control%max_diis = 4
     203              :       scf_control%eps_diis = 0.1_dp
     204        25416 :       scf_control%added_mos(:) = 0
     205         8472 :       scf_control%max_scf_hist = 0
     206              : 
     207              :       !Mixing
     208         8472 :       IF (scf_control%non_selfconsistent) THEN
     209          776 :          scf_control%mixing_method = no_mix
     210              :       ELSE
     211         7696 :          scf_control%mixing_method = direct_p_mix
     212              :       END IF
     213              : 
     214              :       ! Diagonalization
     215         8472 :       scf_control%diagonalization%method = 0
     216         8472 :       scf_control%diagonalization%eps_jacobi = 0.0_dp
     217         8472 :       scf_control%diagonalization%jacobi_threshold = 1.0E-7_dp
     218         8472 :       scf_control%diagonalization%max_iter = 0
     219         8472 :       scf_control%diagonalization%eps_iter = 0.0_dp
     220         8472 :       scf_control%diagonalization%eps_adapt = 0.0_dp
     221         8472 :       scf_control%diagonalization%nkrylov = 0
     222         8472 :       scf_control%diagonalization%nblock_krylov = 0
     223         8472 :       CALL qs_ot_settings_init(scf_control%diagonalization%ot_settings)
     224              : 
     225         8472 :       scf_control%diagonalization%mom = .FALSE.
     226         8472 :       scf_control%diagonalization%mom_didguess = .FALSE.
     227         8472 :       scf_control%diagonalization%mom_proj_formula = 0
     228         8472 :       NULLIFY (scf_control%diagonalization%mom_deoccA)
     229         8472 :       NULLIFY (scf_control%diagonalization%mom_deoccB)
     230         8472 :       NULLIFY (scf_control%diagonalization%mom_occA)
     231         8472 :       NULLIFY (scf_control%diagonalization%mom_occB)
     232         8472 :       scf_control%diagonalization%mom_start = 0
     233              : 
     234              :       ! ROKS
     235              : 
     236         8472 :       scf_control%roks_scheme = high_spin_roks
     237         8472 :       scf_control%roks_f = 0.5_dp
     238              : 
     239              :       ! Initialize the diagonal blocks with the default ROKS parameters
     240              :       ! 0 = v)irtual, 1 = o)pen shell, 2 = c)losed shell
     241              : 
     242         8472 :       scf_control%roks_parameter(0, 0, 1) = 1.5_dp ! avv
     243         8472 :       scf_control%roks_parameter(0, 0, 2) = -0.5_dp ! bvv
     244         8472 :       scf_control%roks_parameter(1, 1, 1) = 0.5_dp ! aoo
     245         8472 :       scf_control%roks_parameter(1, 1, 2) = 0.5_dp ! boo
     246         8472 :       scf_control%roks_parameter(2, 2, 1) = -0.5_dp ! acc
     247         8472 :       scf_control%roks_parameter(2, 2, 2) = 1.5_dp ! bcc
     248              : 
     249              :       ! Initialize off-diagonal blocks (fixed)
     250              : 
     251         8472 :       scf_control%roks_parameter(0, 1, 1) = 1.0_dp ! avo
     252         8472 :       scf_control%roks_parameter(0, 1, 2) = 0.0_dp ! bvo
     253         8472 :       scf_control%roks_parameter(0, 2, 1) = 0.5_dp ! avc
     254         8472 :       scf_control%roks_parameter(0, 2, 2) = 0.5_dp ! bvc
     255         8472 :       scf_control%roks_parameter(1, 2, 1) = 0.0_dp ! aoc
     256         8472 :       scf_control%roks_parameter(1, 2, 2) = 1.0_dp ! boc
     257              : 
     258              :       ! Symmetry enforces
     259              : 
     260         8472 :       scf_control%roks_parameter(1, 0, 1) = scf_control%roks_parameter(0, 1, 1) ! aov
     261         8472 :       scf_control%roks_parameter(1, 0, 2) = scf_control%roks_parameter(0, 1, 2) ! bov
     262         8472 :       scf_control%roks_parameter(2, 0, 1) = scf_control%roks_parameter(0, 2, 1) ! acv
     263         8472 :       scf_control%roks_parameter(2, 0, 2) = scf_control%roks_parameter(0, 2, 2) ! bcv
     264         8472 :       scf_control%roks_parameter(2, 1, 1) = scf_control%roks_parameter(1, 2, 1) ! aco
     265         8472 :       scf_control%roks_parameter(2, 1, 2) = scf_control%roks_parameter(1, 2, 2) ! bco
     266              : 
     267              :       ! Outer SCF default settings
     268              : 
     269         8472 :       scf_control%outer_scf%have_scf = .FALSE.
     270         8472 :       scf_control%outer_scf%max_scf = 0
     271         8472 :       scf_control%outer_scf%eps_scf = 0.0_dp
     272         8472 :       scf_control%outer_scf%step_size = 0.0_dp
     273         8472 :       scf_control%outer_scf%type = -1
     274         8472 :       scf_control%outer_scf%optimizer = -1
     275         8472 :       scf_control%outer_scf%diis_buffer_length = -1
     276         8472 :       NULLIFY (scf_control%outer_scf%cdft_opt_control)
     277              : 
     278              :       ! Smearing of the MO occupations
     279              : 
     280         8472 :       NULLIFY (scf_control%smear)
     281              : 
     282         8472 :       CALL timestop(handle)
     283              : 
     284         8472 :    END SUBROUTINE scf_c_create
     285              : 
     286              : ! **************************************************************************************************
     287              : !> \brief releases the given scf_control (see cp2k/doc/ReferenceCounting.html)
     288              : !> \param scf_control the object to free
     289              : !> \par History
     290              : !>      09.2002 created [fawzi]
     291              : !> \author Fawzi Mohamed
     292              : !> \note
     293              : !>      at the moment does nothing
     294              : ! **************************************************************************************************
     295         8472 :    SUBROUTINE scf_c_release(scf_control)
     296              : 
     297              :       TYPE(scf_control_type), INTENT(INOUT)              :: scf_control
     298              : 
     299         8472 :       IF (ASSOCIATED(scf_control%smear%list)) THEN
     300            2 :          DEALLOCATE (scf_control%smear%list)
     301              :       END IF
     302         8472 :       DEALLOCATE (scf_control%smear)
     303              : 
     304         8472 :       IF (ASSOCIATED(scf_control%outer_scf%cdft_opt_control)) &
     305           70 :          CALL cdft_opt_type_release(scf_control%outer_scf%cdft_opt_control)
     306              : 
     307         8472 :       IF (ASSOCIATED(scf_control%gce)) THEN
     308         8472 :          DEALLOCATE (scf_control%gce)
     309              :       END IF
     310              : 
     311              :       ! Maximum overlap method orbital indices lists
     312              :       ! mom_deoccA, mom_deoccB, mom_occA, mom_occB
     313              :       ! points to memory allocated by input file parser,
     314              :       ! so they do not have to be deallocated
     315              : 
     316         8472 :    END SUBROUTINE scf_c_release
     317              : 
     318              : ! **************************************************************************************************
     319              : !> \brief reads the parameters of the scf section into the given scf_control
     320              : !> \param scf_control the object that wil contain the values read
     321              : !> \param inp_section ...
     322              : !> \par History
     323              : !>      05.2001 created [Matthias]
     324              : !>      09.2002 creaded separated scf_control type [fawzi]
     325              : !> \author Matthias Krack
     326              : ! **************************************************************************************************
     327        33888 :    SUBROUTINE scf_c_read_parameters(scf_control, inp_section)
     328              : 
     329              :       TYPE(scf_control_type), INTENT(INOUT)              :: scf_control
     330              :       TYPE(section_vals_type), POINTER                   :: inp_section
     331              : 
     332              :       CHARACTER(LEN=*), PARAMETER :: routineN = 'scf_c_read_parameters'
     333              : 
     334              :       INTEGER                                            :: cholesky_flag, handle, ialgo
     335         8472 :       INTEGER, DIMENSION(:), POINTER                     :: added_mos
     336              :       LOGICAL                                            :: do_mixing, explicit
     337         8472 :       REAL(KIND=dp), DIMENSION(:), POINTER               :: roks_parameter
     338              :       TYPE(section_vals_type), POINTER                   :: gce_section, mixing_section, &
     339              :                                                             outer_scf_section, scf_section, &
     340              :                                                             smear_section
     341              : 
     342         8472 :       CALL timeset(routineN, handle)
     343              : 
     344         8472 :       scf_section => section_vals_get_subs_vals(inp_section, "SCF")
     345              :       CALL section_vals_val_get(scf_section, "DIAGONALIZATION%_SECTION_PARAMETERS_", &
     346         8472 :                                 l_val=scf_control%use_diag)
     347         8472 :       IF (scf_control%use_diag) THEN
     348              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%DIAG_SUB_SCF%_SECTION_PARAMETERS_", &
     349          364 :                                    l_val=scf_control%do_diag_sub)
     350              :       END IF
     351         8472 :       CALL section_vals_val_get(scf_section, "OT%_SECTION_PARAMETERS_", l_val=scf_control%use_ot)
     352         8472 :       IF (scf_control%use_diag .AND. scf_control%use_ot) THEN
     353              :          ! don't allow both options to be true
     354            0 :          CPABORT("Don't activate OT and Diagonaliztion together")
     355         8472 :       ELSEIF (.NOT. (scf_control%use_diag .OR. scf_control%use_ot)) THEN
     356              :          ! set default to diagonalization
     357         5860 :          scf_control%use_diag = .TRUE.
     358              :       END IF
     359         8472 :       CALL section_vals_val_get(scf_section, "OT%ALGORITHM", i_val=ialgo)
     360         8472 :       scf_control%do_outer_scf_reortho = ialgo == ot_algo_taylor_or_diag
     361         8472 :       CALL section_vals_val_get(scf_section, "SCF_GUESS", i_val=scf_control%density_guess)
     362         8472 :       CALL section_vals_val_get(scf_section, "eps_eigval", r_val=scf_control%eps_eigval)
     363         8472 :       CALL section_vals_val_get(scf_section, "cholesky", i_val=cholesky_flag)
     364         8472 :       IF (scf_control%use_ot) THEN
     365              :          ! eps_diis default is 0 for OT
     366         2248 :          scf_control%eps_diis = 0.0_dp
     367         2248 :          CALL section_vals_val_get(scf_section, "EPS_DIIS", explicit=explicit)
     368         2248 :          IF (explicit) THEN
     369            6 :             CALL section_vals_val_get(scf_section, "EPS_DIIS", r_val=scf_control%eps_diis)
     370              :          END IF
     371              :       ELSE
     372         6224 :          CALL section_vals_val_get(scf_section, "EPS_DIIS", r_val=scf_control%eps_diis)
     373              :       END IF
     374         8472 :       IF (cholesky_flag > 0) THEN
     375         8304 :          scf_control%use_cholesky = .TRUE.
     376              :       END IF
     377         8472 :       CALL section_vals_val_get(scf_section, "IGNORE_CONVERGENCE_FAILURE", l_val=scf_control%ignore_convergence_failure)
     378         8472 :       CALL section_vals_val_get(scf_section, "FORCE_SCF_CALCULATION", l_val=scf_control%force_scf_calculation)
     379         8472 :       CALL section_vals_val_get(scf_section, "eps_scf", r_val=scf_control%eps_scf)
     380         8472 :       CALL section_vals_val_get(scf_section, "level_shift", r_val=scf_control%level_shift)
     381         8472 :       CALL section_vals_val_get(scf_section, "max_diis", i_val=scf_control%max_diis)
     382         8472 :       CALL section_vals_val_get(scf_section, "max_scf", i_val=scf_control%max_scf)
     383              : 
     384              :       ! Diagonaliztion section
     385         8472 :       IF (scf_control%use_diag) THEN
     386              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%ALGORITHM", &
     387         6224 :                                    i_val=scf_control%diagonalization%method)
     388              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%EPS_JACOBI", &
     389         6224 :                                    r_val=scf_control%diagonalization%eps_jacobi)
     390              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%JACOBI_THRESHOLD", &
     391         6224 :                                    r_val=scf_control%diagonalization%jacobi_threshold)
     392              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%MAX_ITER", &
     393         6224 :                                    i_val=scf_control%diagonalization%max_iter)
     394              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%EPS_ITER", &
     395         6224 :                                    r_val=scf_control%diagonalization%eps_iter)
     396              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%EPS_ADAPT", &
     397         6224 :                                    r_val=scf_control%diagonalization%eps_adapt)
     398              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%KRYLOV%NKRYLOV", &
     399         6224 :                                    i_val=scf_control%diagonalization%nkrylov)
     400              :          CALL section_vals_val_get(scf_section, "DIAGONALIZATION%KRYLOV%NBLOCK", &
     401         6224 :                                    i_val=scf_control%diagonalization%nblock_krylov)
     402         6224 :          IF (scf_control%diagonalization%method == diag_ot) THEN
     403              :             ! read OT section
     404            8 :             CALL ot_diag_read_input(scf_control%diagonalization%ot_settings, scf_section)
     405              :          END IF
     406              :          ! read maximum overlap method's parameters
     407              :          CALL section_vals_val_get(scf_section, "MOM%_SECTION_PARAMETERS_", &
     408         6224 :                                    l_val=scf_control%diagonalization%MOM)
     409         6224 :          IF (scf_control%diagonalization%mom) THEN
     410              :             CALL section_vals_val_get(scf_section, "MOM%MOM_TYPE", &
     411           20 :                                       i_val=scf_control%diagonalization%mom_type)
     412              : 
     413              :             CALL section_vals_val_get(scf_section, "MOM%START_ITER", &
     414           20 :                                       i_val=scf_control%diagonalization%mom_start)
     415              : 
     416              :             CALL section_vals_val_get(scf_section, "MOM%DEOCC_ALPHA", &
     417           20 :                                       i_vals=scf_control%diagonalization%mom_deoccA)
     418              : 
     419              :             CALL section_vals_val_get(scf_section, "MOM%DEOCC_BETA", &
     420           20 :                                       i_vals=scf_control%diagonalization%mom_deoccB)
     421              : 
     422              :             CALL section_vals_val_get(scf_section, "MOM%OCC_ALPHA", &
     423           20 :                                       i_vals=scf_control%diagonalization%mom_occA)
     424              : 
     425              :             CALL section_vals_val_get(scf_section, "MOM%OCC_BETA", &
     426           20 :                                       i_vals=scf_control%diagonalization%mom_occB)
     427              : 
     428              :             CALL section_vals_val_get(scf_section, "MOM%PROJ_FORMULA", &
     429           20 :                                       i_val=scf_control%diagonalization%mom_proj_formula)
     430              :          END IF
     431              :       END IF
     432              : 
     433              :       ! Read ROKS parameters
     434         8472 :       CALL section_vals_val_get(scf_section, "ROKS_SCHEME", i_val=scf_control%roks_scheme)
     435              : 
     436         8472 :       SELECT CASE (scf_control%roks_scheme)
     437              :       CASE (general_roks)
     438              :          ! Read parameters for the general ROKS scheme
     439            0 :          CALL section_vals_val_get(scf_section, "ROKS_F", r_val=scf_control%roks_f)
     440              :       CASE (high_spin_roks)
     441              :          ! Read high-spin ROKS parameters for the diagonal block
     442              :          ! 0 = v)irtual, 1 = o)pen shell, 2 = c)losed shell
     443         8472 :          NULLIFY (roks_parameter)
     444         8472 :          CALL section_vals_val_get(scf_section, "ROKS_PARAMETERS", r_vals=roks_parameter)
     445        16944 :          IF (ASSOCIATED(roks_parameter)) THEN
     446         8472 :             scf_control%roks_parameter(2, 2, 1) = roks_parameter(1) ! acc
     447         8472 :             scf_control%roks_parameter(2, 2, 2) = roks_parameter(2) ! bcc
     448         8472 :             scf_control%roks_parameter(1, 1, 1) = roks_parameter(3) ! aoo
     449         8472 :             scf_control%roks_parameter(1, 1, 2) = roks_parameter(4) ! boo
     450         8472 :             scf_control%roks_parameter(0, 0, 1) = roks_parameter(5) ! avv
     451         8472 :             scf_control%roks_parameter(0, 0, 2) = roks_parameter(6) ! bvv
     452              :          END IF
     453              :       END SELECT
     454              : 
     455              :       ! should be moved to printkey
     456         8472 :       CALL section_vals_val_get(scf_section, "eps_lumo", r_val=scf_control%eps_lumos)
     457         8472 :       CALL section_vals_val_get(scf_section, "max_iter_lumo", i_val=scf_control%max_iter_lumos)
     458              : 
     459              :       ! Extra MOs, e.g. for smearing
     460         8472 :       CALL section_vals_val_get(scf_section, "added_mos", i_vals=added_mos)
     461         8472 :       CPASSERT(ASSOCIATED(added_mos))
     462         8472 :       IF (SIZE(added_mos) > 0) THEN
     463         8472 :          scf_control%added_mos(1) = added_mos(1)
     464         8472 :          IF (SIZE(added_mos) > 1) THEN
     465          994 :             scf_control%added_mos(2) = added_mos(2)
     466              :          END IF
     467              :       END IF
     468              : 
     469         8472 :       CALL section_vals_val_get(scf_section, "max_scf_history", i_val=scf_control%max_scf_hist)
     470         8472 :       CALL section_vals_val_get(scf_section, "eps_scf_history", r_val=scf_control%eps_scf_hist)
     471              : 
     472         8472 :       IF (scf_control%level_shift /= 0.0_dp) scf_control%use_cholesky = .FALSE.
     473              : 
     474              :       ! Outer SCF subsection
     475         8472 :       outer_scf_section => section_vals_get_subs_vals(scf_section, "OUTER_SCF")
     476         8472 :       CALL outer_scf_read_parameters(scf_control%outer_scf, outer_scf_section)
     477              : 
     478         8472 :       smear_section => section_vals_get_subs_vals(scf_section, "SMEAR")
     479         8472 :       CALL init_smear(scf_control%smear)
     480         8472 :       CALL read_smear_section(scf_control%smear, smear_section)
     481              : 
     482              :       do_mixing = .FALSE.
     483         8472 :       mixing_section => section_vals_get_subs_vals(scf_section, "MIXING")
     484              :       CALL section_vals_val_get(mixing_section, "_SECTION_PARAMETERS_", &
     485         8472 :                                 l_val=do_mixing)
     486         8472 :       IF (do_mixing) THEN
     487              :          CALL section_vals_val_get(mixing_section, "METHOD", &
     488         8472 :                                    i_val=scf_control%mixing_method)
     489         8472 :          CALL section_vals_val_get(mixing_section, "NMIXING", i_val=scf_control%nmixing)
     490              :       END IF ! do mixing
     491              : 
     492         8472 :       gce_section => section_vals_get_subs_vals(scf_section, "GCE")
     493         8472 :       CALL init_gce(scf_control%gce)
     494         8472 :       CALL read_gce_section(scf_control%gce, gce_section)
     495              : 
     496         8472 :       CALL timestop(handle)
     497              : 
     498         8472 :    END SUBROUTINE scf_c_read_parameters
     499              : 
     500              : ! **************************************************************************************************
     501              : !> \brief ...
     502              : !> \param smear ...
     503              : ! **************************************************************************************************
     504         8472 :    SUBROUTINE init_smear(smear)
     505              :       TYPE(smear_type), POINTER                          :: smear
     506              : 
     507         8472 :       CPASSERT(.NOT. ASSOCIATED(smear))
     508         8472 :       ALLOCATE (smear)
     509              :       smear%do_smear = .FALSE.
     510         8472 :       smear%method = smear_energy_window
     511         8472 :       smear%electronic_temperature = 0.0_dp
     512         8472 :       smear%eps_fermi_dirac = 1.0E-5_dp
     513         8472 :       smear%fixed_mag_mom = -100.0_dp
     514         8472 :       smear%window_size = 0.0_dp
     515         8472 :       smear%smearing_width = 0.0_dp
     516              :       NULLIFY (smear%list)
     517         8472 :    END SUBROUTINE init_smear
     518              : 
     519              : ! **************************************************************************************************
     520              : !> \brief ...
     521              : !> \param smear ...
     522              : !> \param smear_section ...
     523              : ! **************************************************************************************************
     524         8472 :    SUBROUTINE read_smear_section(smear, smear_section)
     525              :       TYPE(smear_type), POINTER                          :: smear
     526              :       TYPE(section_vals_type), POINTER                   :: smear_section
     527              : 
     528         8472 :       REAL(KIND=dp), DIMENSION(:), POINTER               :: r_vals
     529              : 
     530         8472 :       NULLIFY (r_vals)
     531              : 
     532              :       CALL section_vals_val_get(smear_section, "_SECTION_PARAMETERS_", &
     533         8472 :                                 l_val=smear%do_smear)
     534         8472 :       IF (smear%do_smear) THEN
     535              :          CALL section_vals_val_get(smear_section, "METHOD", &
     536          978 :                                    i_val=smear%method)
     537              :          CALL section_vals_val_get(smear_section, "ELECTRONIC_TEMPERATURE", &
     538          978 :                                    r_val=smear%electronic_temperature)
     539              :          CALL section_vals_val_get(smear_section, "EPS_FERMI_DIRAC", &
     540          978 :                                    r_val=smear%eps_fermi_dirac)
     541              :          CALL section_vals_val_get(smear_section, "WINDOW_SIZE", &
     542          978 :                                    r_val=smear%window_size)
     543              :          IF (smear%method == smear_gaussian .OR. &
     544          978 :              smear%method == smear_mp .OR. &
     545              :              smear%method == smear_mv) THEN
     546              :             CALL section_vals_val_get(smear_section, "SIGMA", &
     547           70 :                                       r_val=smear%smearing_width)
     548              :          END IF
     549          978 :          IF (smear%method == smear_list) THEN
     550              :             CALL section_vals_val_get(smear_section, "LIST", &
     551            2 :                                       r_vals=r_vals)
     552            2 :             CPASSERT(ASSOCIATED(r_vals))
     553            6 :             ALLOCATE (smear%list(SIZE(r_vals)))
     554           28 :             smear%list = r_vals
     555              :          END IF
     556              :          CALL section_vals_val_get(smear_section, "FIXED_MAGNETIC_MOMENT", &
     557          978 :                                    r_val=smear%fixed_mag_mom)
     558              :       END IF ! do smear
     559         8472 :    END SUBROUTINE read_smear_section
     560              : 
     561              : ! **************************************************************************************************
     562              : !> \brief ...
     563              : !> \param gce ...
     564              : ! **************************************************************************************************
     565         8472 :    SUBROUTINE init_gce(gce)
     566              :       TYPE(gce_type), POINTER                            :: gce
     567              : 
     568         8472 :       CPASSERT(.NOT. ASSOCIATED(gce))
     569         8472 :       ALLOCATE (gce)
     570              :       gce%do_gce = .FALSE.
     571              :       gce%target_workfunction = 0.16_dp
     572              :       gce%prev_workfunction = -1001.0_dp
     573              :       gce%ref_esp = 0.0_dp
     574              :       gce%mixing_coef = 0.3_dp
     575         8472 :    END SUBROUTINE init_gce
     576              : 
     577              : ! **************************************************************************************************
     578              : !> \brief ...
     579              : !> \param gce ...
     580              : !> \param gce_section ...
     581              : ! **************************************************************************************************
     582         8472 :    SUBROUTINE read_gce_section(gce, gce_section)
     583              :       TYPE(gce_type), POINTER                            :: gce
     584              :       TYPE(section_vals_type), POINTER                   :: gce_section
     585              : 
     586              :       CALL section_vals_val_get(gce_section, "_SECTION_PARAMETERS_", &
     587         8472 :                                 l_val=gce%do_gce)
     588         8472 :       IF (gce%do_gce) THEN
     589              :          CALL section_vals_val_get(gce_section, "TARGET_WORKFUNCTION", &
     590            0 :                                    r_val=gce%target_workfunction)
     591              :          CALL section_vals_val_get(gce_section, "MIXING_COEF", &
     592            0 :                                    r_val=gce%mixing_coef)
     593              :       END IF ! do gce
     594         8472 :    END SUBROUTINE read_gce_section
     595              : 
     596              : ! **************************************************************************************************
     597              : !> \brief writes out the scf parameters
     598              : !> \param scf_control the object you want to print
     599              : !> \param dft_section ...
     600              : !> \par History
     601              : !>      05.2001 created [Matthias]
     602              : !>      09.2002 created separated scf_control type [fawzi]
     603              : !> \author Matthias Krack
     604              : ! **************************************************************************************************
     605         7970 :    SUBROUTINE scf_c_write_parameters(scf_control, dft_section)
     606              : 
     607              :       TYPE(scf_control_type), INTENT(IN)                 :: scf_control
     608              :       TYPE(section_vals_type), POINTER                   :: dft_section
     609              : 
     610              :       CHARACTER(LEN=*), PARAMETER :: routineN = 'scf_c_write_parameters'
     611              : 
     612              :       INTEGER                                            :: handle, output_unit, roks_scheme
     613              :       LOGICAL                                            :: roks
     614              :       REAL(KIND=dp)                                      :: elec_temp
     615              :       TYPE(cp_logger_type), POINTER                      :: logger
     616              :       TYPE(enumeration_type), POINTER                    :: enum
     617              :       TYPE(keyword_type), POINTER                        :: keyword
     618              :       TYPE(section_type), POINTER                        :: section
     619              :       TYPE(section_vals_type), POINTER                   :: scf_section
     620              : 
     621         7970 :       CALL timeset(routineN, handle)
     622              : 
     623         7970 :       NULLIFY (logger)
     624         7970 :       logger => cp_get_default_logger()
     625              : 
     626         7970 :       NULLIFY (scf_section)
     627         7970 :       NULLIFY (section)
     628              : 
     629         7970 :       scf_section => section_vals_get_subs_vals(dft_section, "SCF")
     630              :       output_unit = cp_print_key_unit_nr(logger, scf_section, "PRINT%PROGRAM_RUN_INFO", &
     631         7970 :                                          extension=".scfLog")
     632              : 
     633         7970 :       IF (output_unit > 0) THEN
     634              : 
     635         4004 :          IF (scf_control%max_scf > 0) THEN
     636              : 
     637         3683 :             CALL create_scf_section(section)
     638              : 
     639         3683 :             keyword => section_get_keyword(section, "SCF_GUESS")
     640         3683 :             CALL keyword_get(keyword, enum=enum)
     641              : 
     642         3683 :             IF (.NOT. scf_control%non_selfconsistent .OR. scf_control%force_scf_calculation) THEN
     643              :                WRITE (UNIT=output_unit, &
     644              :                       FMT="(/,/,T2,A,T25,A,T51,A30,/,T25,56('-'),3(/,T25,A,T76,I5),/, "// &
     645              :                       "T25,56('-'),4(/,T25,A,T72,ES9.2),/,T25,56('-'), "// &
     646              :                       "1(/,T25,A,T71,F10.6))") &
     647         3300 :                   "SCF PARAMETERS", &
     648         3300 :                   "Density guess:     ", ADJUSTR(TRIM(enum_i2c(enum, scf_control%density_guess))), &
     649         3300 :                   "max_scf:           ", scf_control%max_scf, &
     650         3300 :                   "max_scf_history:   ", scf_control%max_scf_hist, &
     651         3300 :                   "max_diis:          ", scf_control%max_diis, &
     652         3300 :                   "eps_scf:           ", scf_control%eps_scf, &
     653         3300 :                   "eps_scf_history:   ", scf_control%eps_scf_hist, &
     654         3300 :                   "eps_diis:          ", scf_control%eps_diis, &
     655         3300 :                   "eps_eigval:        ", scf_control%eps_eigval, &
     656         6600 :                   "level_shift [a.u.]:", scf_control%level_shift
     657              :             END IF
     658              : 
     659        11049 :             IF (SUM(ABS(scf_control%added_mos)) > 0) THEN
     660              :                WRITE (UNIT=output_unit, FMT="(T25,A,T71,2I5)") &
     661          709 :                   "added MOs          ", scf_control%added_mos
     662              :             END IF
     663              : 
     664         3683 :             IF (scf_control%diagonalization%mom) THEN
     665              :                ! TODO extend the output with further parameters
     666           10 :                WRITE (UNIT=output_unit, FMT="(T25,A)") "MOM enabled"
     667              :             END IF
     668              : 
     669         3683 :             IF (scf_control%mixing_method > 0 .AND. .NOT. scf_control%use_ot .AND. &
     670              :                 .NOT. scf_control%non_selfconsistent) THEN
     671         2155 :                keyword => section_get_keyword(section, "MIXING%METHOD")
     672         2155 :                CALL keyword_get(keyword, enum=enum)
     673              :                WRITE (UNIT=output_unit, FMT="(T25,A,/,T25,A,T51,A30)") &
     674         2155 :                   REPEAT("-", 56), &
     675         4310 :                   "Mixing method:      ", ADJUSTR(TRIM(enum_i2c(enum, scf_control%mixing_method)))
     676         2155 :                IF (scf_control%mixing_method > 1) THEN
     677          183 :                   WRITE (UNIT=output_unit, FMT="(T47,A34)") "charge density mixing in g-space"
     678              :                END IF
     679              :             END IF
     680         3683 :             IF (scf_control%smear%do_smear) THEN
     681          531 :                keyword => section_get_keyword(section, "SMEAR%METHOD")
     682          531 :                CALL keyword_get(keyword, enum=enum)
     683              :                WRITE (UNIT=output_unit, FMT="(T25,A,/,T25,A,T51,A30)") &
     684          531 :                   REPEAT("-", 56), &
     685         1062 :                   "Smear method:      ", ADJUSTR(TRIM(enum_i2c(enum, scf_control%smear%method)))
     686         1021 :                SELECT CASE (scf_control%smear%method)
     687              :                CASE (smear_fermi_dirac)
     688              :                   elec_temp = cp_unit_from_cp2k(scf_control%smear%electronic_temperature, &
     689          490 :                                                 "K")
     690              :                   WRITE (UNIT=output_unit, FMT="(T25,A,T61,F20.1)") &
     691          490 :                      "Electronic temperature [K]:", elec_temp
     692              :                   WRITE (UNIT=output_unit, FMT="(T25,A,T71,ES10.2)") &
     693          490 :                      "Electronic temperature [a.u.]:", scf_control%smear%electronic_temperature, &
     694          980 :                      "Accuracy threshold:", scf_control%smear%eps_fermi_dirac
     695          490 :                   IF (scf_control%smear%fixed_mag_mom > 0.0_dp) WRITE (UNIT=output_unit, FMT="(T25,A,T61,F20.1)") &
     696           89 :                      "Fixed magnetic moment set to:", scf_control%smear%fixed_mag_mom
     697              :                CASE (smear_gaussian, smear_mp, smear_mv)
     698              :                   WRITE (UNIT=output_unit, FMT="(T25,A,T71,ES10.2)") &
     699           34 :                      "Smearing width (sigma) [a.u.]:", scf_control%smear%smearing_width, &
     700           68 :                      "Accuracy threshold:", scf_control%smear%eps_fermi_dirac
     701           34 :                   IF (scf_control%smear%fixed_mag_mom > 0.0_dp) &
     702              :                      WRITE (UNIT=output_unit, FMT="(T25,A,T61,F20.1)") &
     703            0 :                      "Fixed magnetic moment set to:", scf_control%smear%fixed_mag_mom
     704              :                CASE (smear_energy_window)
     705              :                   WRITE (UNIT=output_unit, FMT="(T25,A,T71,F10.6)") &
     706          531 :                      "Smear window [a.u.]:       ", scf_control%smear%window_size
     707              :                END SELECT
     708              :             END IF
     709              : 
     710         3683 :             IF (scf_control%gce%do_gce) THEN
     711              :                WRITE (UNIT=output_unit, FMT="(T25,A,/,T25,A,T61,F20.1)") &
     712            0 :                   REPEAT("-", 56), &
     713            0 :                   "Target workfunction [eV]:", scf_control%gce%target_workfunction
     714            0 :                WRITE (UNIT=output_unit, FMT="(T25,A,T61,F20.1)") "Mixing coefficient:", scf_control%gce%mixing_coef
     715            0 :                WRITE (UNIT=output_unit, FMT="(T25,A)") "Grand canonical SCF is activated."
     716              :             END IF
     717              : 
     718         3683 :             CALL section_vals_val_get(dft_section, "ROKS", l_val=roks)
     719         3683 :             IF (roks .AND. (.NOT. scf_control%use_ot)) THEN
     720              :                CALL section_vals_val_get(scf_section, "ROKS_SCHEME", &
     721           22 :                                          i_val=roks_scheme)
     722           22 :                keyword => section_get_keyword(section, "ROKS_SCHEME")
     723           22 :                CALL keyword_get(keyword, enum=enum)
     724              :                WRITE (UNIT=output_unit, FMT="(T25,A,/,T25,A,T51,A30)") &
     725           22 :                   REPEAT("-", 56), &
     726           44 :                   "ROKS scheme:", ADJUSTR(TRIM(enum_i2c(enum, roks_scheme)))
     727            0 :                SELECT CASE (roks_scheme)
     728              :                CASE (general_roks)
     729              :                   WRITE (UNIT=output_unit, FMT="(T25,A,T71,F10.6)") &
     730            0 :                      "ROKS parameter f:", scf_control%roks_f
     731              :                CASE (high_spin_roks)
     732              :                   WRITE (UNIT=output_unit, &
     733              :                          FMT="(T25,A,6(/,T25,A,T71,F10.6))") &
     734           22 :                      "ROKS parameters: a)lpha, b)eta; c)losed, o)pen, v)irtual", &
     735           22 :                      "acc", scf_control%roks_parameter(2, 2, 1), &
     736           22 :                      "bcc", scf_control%roks_parameter(2, 2, 2), &
     737           22 :                      "aoo", scf_control%roks_parameter(1, 1, 1), &
     738           22 :                      "boo", scf_control%roks_parameter(1, 1, 2), &
     739           22 :                      "avv", scf_control%roks_parameter(0, 0, 1), &
     740           44 :                      "bvv", scf_control%roks_parameter(0, 0, 2)
     741              :                END SELECT
     742              :             END IF
     743         3683 :             CALL section_release(section)
     744              : 
     745         3683 :             IF (scf_control%outer_scf%have_scf) THEN
     746          757 :                WRITE (output_unit, "(T25,56('-'),/,T25,A)") "Outer loop SCF in use "
     747         1509 :                SELECT CASE (scf_control%outer_scf%type)
     748              :                CASE (outer_scf_none)
     749          752 :                   WRITE (output_unit, '(T25,A)') "No variables optimised in outer loop"
     750              :                CASE (outer_scf_ddapc_constraint)
     751            5 :                   WRITE (output_unit, '(T25,A)') "DDAPC constraint enforced"
     752              :                CASE (outer_scf_s2_constraint)
     753            0 :                   WRITE (output_unit, '(T25,A)') "S2 constraint enforced"
     754              :                CASE (outer_scf_basis_center_opt)
     755            0 :                   WRITE (output_unit, '(T25,A)') "Floating basis function optimization enforced"
     756              :                CASE (outer_scf_cdft_constraint)
     757            0 :                   CPABORT("CDFT constraints must be defined in QS&CDFT")
     758              :                CASE DEFAULT
     759          757 :                   CPABORT("")
     760              :                END SELECT
     761          757 :                WRITE (output_unit, '(T25,A,T72,ES9.2)') "eps_scf", scf_control%outer_scf%eps_scf
     762          757 :                WRITE (output_unit, '(T25,A,T72,I9)') "max_scf", scf_control%outer_scf%max_scf
     763         1509 :                SELECT CASE (scf_control%outer_scf%optimizer)
     764              :                CASE (outer_scf_optimizer_none)
     765          752 :                   WRITE (output_unit, '(T25,A)') "No outer loop optimization"
     766              :                CASE (outer_scf_optimizer_sd)
     767            2 :                   WRITE (output_unit, '(T25,A)') "Steepest descent optimization"
     768              :                CASE (outer_scf_optimizer_bisect)
     769            1 :                   WRITE (output_unit, '(T25,A)') "Gradient bisection"
     770            1 :                   WRITE (output_unit, '(T25,A,T72,I9)') "bisect_trust_count", scf_control%outer_scf%bisect_trust_count
     771              :                CASE (outer_scf_optimizer_diis)
     772            2 :                   WRITE (output_unit, '(T25,A)') "DIIS optimization"
     773            2 :                   WRITE (output_unit, '(T25,A,T72,I9)') "DIIS buffer length", &
     774            4 :                      scf_control%outer_scf%diis_buffer_length
     775              :                CASE (outer_scf_optimizer_broyden, outer_scf_optimizer_newton, &
     776              :                      outer_scf_optimizer_newton_ls)
     777            0 :                   CPABORT("Selected optimizer only compatible with CDFT")
     778              :                CASE (outer_scf_optimizer_secant)
     779            0 :                   WRITE (output_unit, '(T25,A)') "Optimization with the secant method"
     780              :                CASE DEFAULT
     781          757 :                   CPABORT("")
     782              :                END SELECT
     783          757 :                WRITE (output_unit, '(T25,A,T72,ES9.2)') "step_size", scf_control%outer_scf%step_size
     784              :             ELSE
     785         2926 :                WRITE (output_unit, "(T25,56('-'),/,T25,A)") "No outer SCF"
     786              :             END IF
     787              : 
     788              :          END IF ! max_scf > 0
     789              : 
     790              :       END IF ! output_unit > 0
     791              : 
     792              :       CALL cp_print_key_finished_output(output_unit, logger, scf_section, &
     793         7970 :                                         "PRINT%PROGRAM_RUN_INFO")
     794              : 
     795         7970 :       CALL timestop(handle)
     796              : 
     797         7970 :    END SUBROUTINE scf_c_write_parameters
     798              : 
     799              : ! **************************************************************************************************
     800              : 
     801              : ! **************************************************************************************************
     802              : !> \brief ...
     803              : !> \param settings ...
     804              : !> \param scf_section ...
     805              : ! **************************************************************************************************
     806           16 :    SUBROUTINE ot_diag_read_input(settings, scf_section)
     807              :       TYPE(qs_ot_settings_type)                          :: settings
     808              :       TYPE(section_vals_type), POINTER                   :: scf_section
     809              : 
     810              :       CHARACTER(len=*), PARAMETER :: routineN = 'ot_diag_read_input'
     811              : 
     812              :       INTEGER                                            :: handle, output_unit
     813              :       LOGICAL                                            :: explicit
     814              :       TYPE(cp_logger_type), POINTER                      :: logger
     815              :       TYPE(section_vals_type), POINTER                   :: ot_section
     816              : 
     817            8 :       CALL timeset(routineN, handle)
     818              : 
     819            8 :       logger => cp_get_default_logger()
     820              :       output_unit = cp_print_key_unit_nr(logger, scf_section, "PRINT%PROGRAM_RUN_INFO", &
     821            8 :                                          extension=".log")
     822              : 
     823              :       ! decide default settings
     824            8 :       CALL qs_ot_settings_init(settings)
     825              : 
     826              :       ! use ot input new style
     827            8 :       ot_section => section_vals_get_subs_vals(scf_section, "DIAGONALIZATION%OT")
     828            8 :       CALL section_vals_get(ot_section, explicit=explicit)
     829              : 
     830            8 :       CALL ot_readwrite_input(settings, ot_section, output_unit)
     831              : 
     832              :       CALL cp_print_key_finished_output(output_unit, logger, scf_section, &
     833            8 :                                         "PRINT%PROGRAM_RUN_INFO")
     834              : 
     835            8 :       CALL timestop(handle)
     836              : 
     837            8 :    END SUBROUTINE ot_diag_read_input
     838              : 
     839              : ! **************************************************************************************************
     840              : 
     841            0 : END MODULE scf_control_types
        

Generated by: LCOV version 2.0-1