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

Generated by: LCOV version 2.0-1