LCOV - code coverage report
Current view: top level - src - qs_density_mixing_types.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:c24029e) Lines: 92.4 % 302 279
Test Date: 2026-07-04 06:36:57 Functions: 50.0 % 6 3

            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 module that contains the definitions of the scf types
      10              : !> \par History
      11              : !>      02.2003 created [fawzi]
      12              : !> \author fawzi
      13              : ! **************************************************************************************************
      14              : MODULE qs_density_mixing_types
      15              : #if defined(__TBLITE)
      16              :    USE tblite_scf, ONLY: mixer_type
      17              : #endif
      18              :    USE ao_util, ONLY: exp_radius
      19              :    USE input_constants, ONLY: broy_mix, &
      20              :                               direct_p_mix, &
      21              :                               gaussian, &
      22              :                               kerker_mix, &
      23              :                               modified_broy_mix, &
      24              :                               multisec_mix, &
      25              :                               new_pulay_mix, &
      26              :                               no_mix, &
      27              :                               pulay_mix
      28              :    USE input_keyword_types, ONLY: keyword_create, &
      29              :                                   keyword_release, &
      30              :                                   keyword_type
      31              :    USE input_section_types, ONLY: section_add_keyword, &
      32              :                                   section_create, &
      33              :                                   section_type, &
      34              :                                   section_vals_type, &
      35              :                                   section_vals_val_get
      36              :    USE input_val_types, ONLY: real_t
      37              :    USE kinds, ONLY: default_string_length, &
      38              :                     dp
      39              :    USE qs_rho_atom_types, ONLY: rho_atom_coeff
      40              :    USE string_utilities, ONLY: s2a
      41              : #include "./base/base_uses.f90"
      42              : 
      43              :    IMPLICIT NONE
      44              :    PRIVATE
      45              : 
      46              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      47              : 
      48              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_density_mixing_types'
      49              : 
      50              :    INTEGER, PARAMETER, PUBLIC :: no_mixing_nr = 0, direct_mixing_nr = 1, &
      51              :                                  gspace_mixing_nr = 2, pulay_mixing_nr = 3, &
      52              :                                  broyden_mixing_nr = 4, &
      53              :                                  modified_broyden_mixing_nr = 5, &
      54              :                                  multisecant_mixing_nr = 6, &
      55              :                                  new_pulay_mixing_nr = 7
      56              :    PUBLIC :: cp_1d_z_p_type, mixing_storage_create, mixing_storage_type, mixing_storage_release, create_mixing_section
      57              : 
      58              :    TYPE cp_1d_z_p_type
      59              :       COMPLEX(dp), DIMENSION(:), POINTER :: cc => NULL()
      60              :    END TYPE cp_1d_z_p_type
      61              : 
      62              :    TYPE mixing_storage_type
      63              :    INTEGER                                           :: ig_max = -1, ncall = -1, ncall_p(2) = -1, nbuffer = -1, n_simple_mix = -1, &
      64              :                                                            nskip_mixing = -1, p_metric_method = -1
      65              :       INTEGER, POINTER, DIMENSION(:)                    :: ig_global_index => NULL()
      66              :       LOGICAL                                           :: gmix_p = .FALSE.
      67              :       LOGICAL, POINTER, DIMENSION(:)                    :: paw => NULL()
      68              :       CHARACTER(len=15)                                 :: iter_method = ""
      69              :       REAL(KIND=dp)                                     :: alpha = -1.0_dp, bconst = -1.0_dp, beta = -1.0_dp, broy_w0 = -1.0_dp, &
      70              :                                                            max_g2 = -1.0_dp, max_gvec_exp = -1.0_dp, pulay_alpha = -1.0_dp, &
      71              :                                                            pulay_beta = -1.0_dp, r_step = -1.0_dp, reg_par = -1.0_dp, &
      72              :                                                            sigma_max = -1.0_dp, wc = -1.0_dp, wmax = -1.0_dp, qm = -1.0_dp, &
      73              :                                                            qk = -1.0_dp, qkappa = -1.0_dp
      74              :       ! Spin-channel-specific mixing parameters (for nspin==2, ispin=2 is the magnetization channel)
      75              :       REAL(KIND=dp)                                     :: alpha_mag = -1.0_dp, beta_mag = -1.0_dp
      76              :       REAL(KIND=dp), DIMENSION(:), POINTER              :: p_metric => NULL()
      77              :       REAL(KIND=dp), DIMENSION(:), POINTER              :: kerker_factor => NULL()
      78              :       REAL(KIND=dp), DIMENSION(:), POINTER              :: kerker_factor_mag => NULL()
      79              :       REAL(KIND=dp), DIMENSION(:), POINTER              :: special_metric => NULL()
      80              :       REAL(KIND=dp), DIMENSION(:, :), POINTER           :: weight => NULL()
      81              :       REAL(KIND=dp), DIMENSION(:, :), POINTER           :: norm_res_buffer => NULL()
      82              :       REAL(KIND=dp), DIMENSION(:, :, :), POINTER        :: fmat => NULL(), gmat => NULL(), pulay_matrix => NULL(), smat => NULL()
      83              :       !
      84              :       INTEGER                                           :: nat_local = -1, max_shell = -1
      85              :       INTEGER                                           :: tb_scc_mixer_memory = 0, tb_scc_mixer_natom = 0, &
      86              :                                                            tb_scc_mixer_ns = 0, tb_scc_mixer_step = 0
      87              :       REAL(KIND=dp)                                     :: tb_scc_mixer_error = 0.0_dp
      88              :       REAL(KIND=dp), DIMENSION(:, :, :), POINTER        :: acharge => NULL()
      89              :       REAL(KIND=dp), DIMENSION(:, :, :), POINTER        :: dacharge => NULL()
      90              :       REAL(KIND=dp), DIMENSION(:, :, :), POINTER        :: dfbroy => NULL()
      91              :       REAL(KIND=dp), DIMENSION(:, :, :), POINTER        :: ubroy => NULL()
      92              :       REAL(KIND=dp), DIMENSION(:, :), POINTER           :: abroy => NULL()
      93              :       REAL(KIND=dp), DIMENSION(:), POINTER              :: wbroy => NULL()
      94              :       INTEGER, DIMENSION(:), POINTER                    :: atlist => NULL()
      95              :       !
      96              :       TYPE(cp_1d_z_p_type), DIMENSION(:), POINTER       :: last_res => NULL(), rhoin => NULL(), rhoin_old => NULL()
      97              :       TYPE(cp_1d_z_p_type), DIMENSION(:, :), POINTER    :: delta_res => NULL(), u_vec => NULL(), z_vec => NULL()
      98              :       TYPE(cp_1d_z_p_type), DIMENSION(:, :), POINTER    :: drho_buffer => NULL(), rhoin_buffer => NULL(), res_buffer => NULL()
      99              :       !
     100              :       TYPE(rho_atom_coeff), DIMENSION(:, :), POINTER    :: cpc_h_lastres => NULL(), cpc_s_lastres => NULL()
     101              :       TYPE(rho_atom_coeff), DIMENSION(:, :), POINTER    :: cpc_h_in => NULL(), cpc_s_in => NULL()
     102              :       TYPE(rho_atom_coeff), DIMENSION(:, :), POINTER    :: cpc_h_old => NULL(), cpc_s_old => NULL()
     103              :       TYPE(rho_atom_coeff), DIMENSION(:, :, :), POINTER :: cpc_h_in_buffer => NULL(), cpc_s_in_buffer => NULL()
     104              :       TYPE(rho_atom_coeff), DIMENSION(:, :, :), POINTER :: cpc_h_res_buffer => NULL(), cpc_s_res_buffer => NULL()
     105              :       TYPE(rho_atom_coeff), DIMENSION(:, :, :), POINTER :: dcpc_h_in => NULL(), dcpc_s_in => NULL()
     106              : #if defined(__TBLITE)
     107              :       CLASS(mixer_type), ALLOCATABLE                    :: tb_scc_mixer
     108              : #endif
     109              :    END TYPE mixing_storage_type
     110              : 
     111              : CONTAINS
     112              : 
     113              : ! **************************************************************************************************
     114              : !> \brief creates a mixing_storage
     115              : !> \param mixing_store ...
     116              : !> \param mixing_section ...
     117              : !> \param mixing_method ...
     118              : !> \param ecut ...
     119              : !> \par History
     120              : !>      05.2009 created [MI]
     121              : !> \author [MI]
     122              : ! **************************************************************************************************
     123        31500 :    SUBROUTINE mixing_storage_create(mixing_store, mixing_section, mixing_method, ecut)
     124              :       TYPE(mixing_storage_type), INTENT(OUT)             :: mixing_store
     125              :       TYPE(section_vals_type), POINTER                   :: mixing_section
     126              :       INTEGER, INTENT(IN)                                :: mixing_method
     127              :       REAL(dp), INTENT(IN)                               :: ecut
     128              : 
     129              :       REAL(dp)                                           :: alpha, eps, gcut
     130              : 
     131         7875 :       mixing_store%nbuffer = 0
     132         7875 :       mixing_store%n_simple_mix = 0
     133         7875 :       mixing_store%ncall = 0
     134        23625 :       mixing_store%ncall_p = 0
     135         7875 :       mixing_store%alpha = 1.0_dp
     136         7875 :       mixing_store%pulay_beta = 1.0_dp
     137         7875 :       mixing_store%beta = 1.0_dp
     138         7875 :       mixing_store%alpha_mag = -1.0_dp
     139         7875 :       mixing_store%beta_mag = -1.0_dp
     140         7875 :       mixing_store%iter_method = "NoMix"
     141         7875 :       mixing_store%max_g2 = 2._dp*ecut
     142         7875 :       mixing_store%gmix_p = .FALSE.
     143         7875 :       mixing_store%tb_scc_mixer_error = 0.0_dp
     144              :       mixing_store%tb_scc_mixer_memory = 0
     145              :       mixing_store%tb_scc_mixer_natom = 0
     146              :       mixing_store%tb_scc_mixer_ns = 0
     147              :       mixing_store%tb_scc_mixer_step = 0
     148              : 
     149         7875 :       NULLIFY (mixing_store%p_metric)
     150         7875 :       NULLIFY (mixing_store%kerker_factor)
     151         7875 :       NULLIFY (mixing_store%kerker_factor_mag)
     152         7875 :       NULLIFY (mixing_store%special_metric)
     153         7875 :       NULLIFY (mixing_store%pulay_matrix)
     154         7875 :       NULLIFY (mixing_store%weight)
     155         7875 :       NULLIFY (mixing_store%fmat)
     156         7875 :       NULLIFY (mixing_store%gmat)
     157         7875 :       NULLIFY (mixing_store%smat)
     158         7875 :       NULLIFY (mixing_store%acharge)
     159         7875 :       NULLIFY (mixing_store%dacharge)
     160         7875 :       NULLIFY (mixing_store%dfbroy)
     161         7875 :       NULLIFY (mixing_store%ubroy)
     162         7875 :       NULLIFY (mixing_store%abroy)
     163         7875 :       NULLIFY (mixing_store%wbroy)
     164         7875 :       NULLIFY (mixing_store%atlist)
     165         7875 :       NULLIFY (mixing_store%last_res)
     166         7875 :       NULLIFY (mixing_store%rhoin)
     167         7875 :       NULLIFY (mixing_store%rhoin_old)
     168         7875 :       NULLIFY (mixing_store%delta_res)
     169         7875 :       NULLIFY (mixing_store%u_vec)
     170         7875 :       NULLIFY (mixing_store%z_vec)
     171         7875 :       NULLIFY (mixing_store%drho_buffer)
     172         7875 :       NULLIFY (mixing_store%rhoin_buffer)
     173         7875 :       NULLIFY (mixing_store%res_buffer)
     174         7875 :       NULLIFY (mixing_store%norm_res_buffer)
     175         7875 :       NULLIFY (mixing_store%ig_global_index)
     176         7875 :       NULLIFY (mixing_store%paw)
     177         7875 :       NULLIFY (mixing_store%cpc_h_in)
     178         7875 :       NULLIFY (mixing_store%cpc_s_in)
     179         7875 :       NULLIFY (mixing_store%cpc_h_old)
     180         7875 :       NULLIFY (mixing_store%cpc_s_old)
     181         7875 :       NULLIFY (mixing_store%dcpc_h_in)
     182         7875 :       NULLIFY (mixing_store%dcpc_s_in)
     183         7875 :       NULLIFY (mixing_store%cpc_h_lastres)
     184         7875 :       NULLIFY (mixing_store%cpc_s_lastres)
     185         7875 :       NULLIFY (mixing_store%cpc_h_in_buffer)
     186         7875 :       NULLIFY (mixing_store%cpc_s_in_buffer)
     187         7875 :       NULLIFY (mixing_store%cpc_h_res_buffer)
     188         7875 :       NULLIFY (mixing_store%cpc_s_res_buffer)
     189              : 
     190         7875 :       CALL section_vals_val_get(mixing_section, "ALPHA", r_val=mixing_store%alpha)
     191         7875 :       CALL section_vals_val_get(mixing_section, "BETA", r_val=mixing_store%beta)
     192         7875 :       CALL section_vals_val_get(mixing_section, "ALPHA_MAG", r_val=mixing_store%alpha_mag)
     193         7875 :       CALL section_vals_val_get(mixing_section, "BETA_MAG", r_val=mixing_store%beta_mag)
     194              :       ! Fall back to charge-channel values if magnetization parameters are not set
     195         7875 :       IF (mixing_store%alpha_mag < 0.0_dp) mixing_store%alpha_mag = mixing_store%alpha
     196         7875 :       IF (mixing_store%beta_mag < 0.0_dp) mixing_store%beta_mag = mixing_store%beta
     197         7875 :       CALL section_vals_val_get(mixing_section, "N_SIMPLE_MIX", i_val=mixing_store%n_simple_mix)
     198         7875 :       CALL section_vals_val_get(mixing_section, "NBUFFER", i_val=mixing_store%nbuffer)
     199         7875 :       CALL section_vals_val_get(mixing_section, "NSKIP", i_val=mixing_store%nskip_mixing)
     200         7875 :       CALL section_vals_val_get(mixing_section, "MAX_GVEC_EXP", r_val=mixing_store%max_gvec_exp)
     201         7875 :       CALL section_vals_val_get(mixing_section, "GMIX_P", l_val=mixing_store%gmix_p)
     202              : 
     203         7875 :       IF (mixing_store%max_gvec_exp > 0._dp) THEN
     204            0 :          alpha = 0.25_dp/mixing_store%max_gvec_exp
     205            0 :          eps = 1.e-4_dp
     206            0 :          gcut = exp_radius(3, alpha, eps, 1.0_dp)
     207            0 :          mixing_store%max_g2 = gcut*gcut
     208              :       END IF
     209              : 
     210         7887 :       SELECT CASE (mixing_method)
     211              :       CASE (gspace_mixing_nr)
     212           12 :          mixing_store%nbuffer = 1
     213              :       CASE (pulay_mixing_nr)
     214           36 :          CALL section_vals_val_get(mixing_section, "PULAY_ALPHA", r_val=mixing_store%pulay_alpha)
     215           36 :          CALL section_vals_val_get(mixing_section, "PULAY_BETA", r_val=mixing_store%pulay_beta)
     216              :       CASE (broyden_mixing_nr)
     217          742 :          CALL section_vals_val_get(mixing_section, "BROY_W0", r_val=mixing_store%broy_w0)
     218          742 :          mixing_store%bconst = 20.0_dp
     219              :       CASE (modified_broyden_mixing_nr)
     220            4 :          CALL section_vals_val_get(mixing_section, "BROY_W0", r_val=mixing_store%broy_w0)
     221            4 :          CALL section_vals_val_get(mixing_section, "BROY_WREF", r_val=mixing_store%wc)
     222            4 :          CALL section_vals_val_get(mixing_section, "BROY_WMAX", r_val=mixing_store%wmax)
     223            4 :          mixing_store%bconst = 20.0_dp
     224              :       CASE (multisecant_mixing_nr)
     225            0 :          CALL section_vals_val_get(mixing_section, "REGULARIZATION", r_val=mixing_store%reg_par)
     226            0 :          CALL section_vals_val_get(mixing_section, "MAX_STEP", r_val=mixing_store%sigma_max)
     227            0 :          CALL section_vals_val_get(mixing_section, "R_FACTOR", r_val=mixing_store%r_step)
     228              :       CASE (new_pulay_mixing_nr)
     229            4 :          CALL section_vals_val_get(mixing_section, "PULAY_ALPHA", r_val=mixing_store%pulay_alpha)
     230            4 :          CALL section_vals_val_get(mixing_section, "PULAY_BETA", r_val=mixing_store%pulay_beta)
     231            4 :          CALL section_vals_val_get(mixing_section, "QM", r_val=mixing_store%qm)
     232            4 :          CALL section_vals_val_get(mixing_section, "QK", r_val=mixing_store%qk)
     233         7879 :          CALL section_vals_val_get(mixing_section, "QKAPPA", r_val=mixing_store%qkappa)
     234              :       END SELECT
     235              : 
     236         7875 :    END SUBROUTINE mixing_storage_create
     237              : 
     238              : ! **************************************************************************************************
     239              : !> \brief releases a mixing_storage
     240              : !> \param mixing_store ...
     241              : !> \par History
     242              : !>      05.2009 created [MI]
     243              : !> \author [MI]
     244              : ! **************************************************************************************************
     245         7875 :    SUBROUTINE mixing_storage_release(mixing_store)
     246              :       TYPE(mixing_storage_type), INTENT(INOUT)           :: mixing_store
     247              : 
     248              :       INTEGER                                            :: i, j, k
     249              : 
     250         7875 :       IF (ASSOCIATED(mixing_store%kerker_factor)) THEN
     251          374 :          DEALLOCATE (mixing_store%kerker_factor)
     252              :       END IF
     253              : 
     254         7875 :       IF (ASSOCIATED(mixing_store%kerker_factor_mag)) THEN
     255          374 :          DEALLOCATE (mixing_store%kerker_factor_mag)
     256              :       END IF
     257              : 
     258         7875 :       IF (ASSOCIATED(mixing_store%special_metric)) THEN
     259          374 :          DEALLOCATE (mixing_store%special_metric)
     260              :       END IF
     261              : 
     262         7875 :       IF (ASSOCIATED(mixing_store%pulay_matrix)) THEN
     263           38 :          DEALLOCATE (mixing_store%pulay_matrix)
     264              :       END IF
     265              : 
     266         7875 :       IF (ASSOCIATED(mixing_store%rhoin_buffer)) THEN
     267           84 :          DO i = 1, SIZE(mixing_store%rhoin_buffer, 2)
     268          362 :             DO j = 1, SIZE(mixing_store%rhoin_buffer, 1)
     269          324 :                DEALLOCATE (mixing_store%rhoin_buffer(j, i)%cc)
     270              :             END DO
     271              :          END DO
     272           38 :          DEALLOCATE (mixing_store%rhoin_buffer)
     273              :       END IF
     274              : 
     275         7875 :       IF (ASSOCIATED(mixing_store%paw)) THEN
     276           16 :          DEALLOCATE (mixing_store%paw)
     277              :       END IF
     278         7875 :       IF (ASSOCIATED(mixing_store%cpc_h_in)) THEN
     279           38 :          DO j = 1, SIZE(mixing_store%cpc_h_in, 2)
     280          214 :          DO k = 1, SIZE(mixing_store%cpc_h_in, 1)
     281          198 :             IF (ASSOCIATED(mixing_store%cpc_h_in(k, j)%r_coef)) THEN
     282          106 :                DEALLOCATE (mixing_store%cpc_h_in(k, j)%r_coef)
     283          106 :                DEALLOCATE (mixing_store%cpc_s_in(k, j)%r_coef)
     284              :             END IF
     285              :          END DO
     286              :          END DO
     287           16 :          DEALLOCATE (mixing_store%cpc_h_in)
     288           16 :          DEALLOCATE (mixing_store%cpc_s_in)
     289              :       END IF
     290         7875 :       IF (ASSOCIATED(mixing_store%cpc_h_old)) THEN
     291           30 :          DO j = 1, SIZE(mixing_store%cpc_h_old, 2)
     292          174 :          DO k = 1, SIZE(mixing_store%cpc_h_old, 1)
     293          162 :             IF (ASSOCIATED(mixing_store%cpc_h_old(k, j)%r_coef)) THEN
     294          102 :                DEALLOCATE (mixing_store%cpc_h_old(k, j)%r_coef)
     295          102 :                DEALLOCATE (mixing_store%cpc_s_old(k, j)%r_coef)
     296              :             END IF
     297              :          END DO
     298              :          END DO
     299           12 :          DEALLOCATE (mixing_store%cpc_h_old)
     300           12 :          DEALLOCATE (mixing_store%cpc_s_old)
     301              :       END IF
     302         7875 :       IF (ASSOCIATED(mixing_store%cpc_h_in_buffer)) THEN
     303            4 :          DO i = 1, SIZE(mixing_store%cpc_h_in_buffer, 3)
     304           20 :          DO j = 1, SIZE(mixing_store%cpc_h_in_buffer, 2)
     305           98 :          DO k = 1, SIZE(mixing_store%cpc_h_in_buffer, 1)
     306           96 :             IF (ASSOCIATED(mixing_store%cpc_h_in_buffer(k, j, i)%r_coef)) THEN
     307           10 :                DEALLOCATE (mixing_store%cpc_h_in_buffer(k, j, i)%r_coef)
     308           10 :                DEALLOCATE (mixing_store%cpc_s_in_buffer(k, j, i)%r_coef)
     309              :             END IF
     310              :          END DO
     311              :          END DO
     312              :          END DO
     313            2 :          DEALLOCATE (mixing_store%cpc_h_in_buffer)
     314            2 :          DEALLOCATE (mixing_store%cpc_s_in_buffer)
     315              :       END IF
     316         7875 :       IF (ASSOCIATED(mixing_store%cpc_h_res_buffer)) THEN
     317            4 :          DO i = 1, SIZE(mixing_store%cpc_h_res_buffer, 3)
     318           20 :          DO j = 1, SIZE(mixing_store%cpc_h_res_buffer, 2)
     319           98 :          DO k = 1, SIZE(mixing_store%cpc_h_res_buffer, 1)
     320           96 :             IF (ASSOCIATED(mixing_store%cpc_h_res_buffer(k, j, i)%r_coef)) THEN
     321           10 :                DEALLOCATE (mixing_store%cpc_h_res_buffer(k, j, i)%r_coef)
     322           10 :                DEALLOCATE (mixing_store%cpc_s_res_buffer(k, j, i)%r_coef)
     323              :             END IF
     324              :          END DO
     325              :          END DO
     326              :          END DO
     327            2 :          DEALLOCATE (mixing_store%cpc_h_res_buffer)
     328            2 :          DEALLOCATE (mixing_store%cpc_s_res_buffer)
     329              :       END IF
     330              : 
     331         7875 :       IF (ASSOCIATED(mixing_store%dcpc_h_in)) THEN
     332           30 :          DO i = 1, SIZE(mixing_store%dcpc_h_in, 3)
     333          174 :          DO j = 1, SIZE(mixing_store%dcpc_h_in, 2)
     334         1266 :          DO k = 1, SIZE(mixing_store%dcpc_h_in, 1)
     335         1248 :             IF (ASSOCIATED(mixing_store%dcpc_h_in(k, j, i)%r_coef)) THEN
     336          810 :                DEALLOCATE (mixing_store%dcpc_h_in(k, j, i)%r_coef)
     337          810 :                DEALLOCATE (mixing_store%dcpc_s_in(k, j, i)%r_coef)
     338              :             END IF
     339              :          END DO
     340              :          END DO
     341              :          END DO
     342           12 :          DEALLOCATE (mixing_store%dcpc_h_in)
     343           12 :          DEALLOCATE (mixing_store%dcpc_s_in)
     344              :       END IF
     345         7875 :       IF (ASSOCIATED(mixing_store%cpc_h_lastres)) THEN
     346           30 :          DO j = 1, SIZE(mixing_store%cpc_h_lastres, 2)
     347          174 :          DO k = 1, SIZE(mixing_store%cpc_h_lastres, 1)
     348          162 :             IF (ASSOCIATED(mixing_store%cpc_h_lastres(k, j)%r_coef)) THEN
     349          102 :                DEALLOCATE (mixing_store%cpc_h_lastres(k, j)%r_coef)
     350          102 :                DEALLOCATE (mixing_store%cpc_s_lastres(k, j)%r_coef)
     351              :             END IF
     352              :          END DO
     353              :          END DO
     354           12 :          DEALLOCATE (mixing_store%cpc_h_lastres)
     355           12 :          DEALLOCATE (mixing_store%cpc_s_lastres)
     356              :       END IF
     357              : 
     358         7875 :       IF (ASSOCIATED(mixing_store%res_buffer)) THEN
     359          782 :          DO i = 1, SIZE(mixing_store%res_buffer, 2)
     360         3816 :             DO j = 1, SIZE(mixing_store%res_buffer, 1)
     361         3454 :                DEALLOCATE (mixing_store%res_buffer(j, i)%cc)
     362              :             END DO
     363              :          END DO
     364          362 :          DEALLOCATE (mixing_store%res_buffer)
     365              :       END IF
     366              : 
     367         7875 :       IF (ASSOCIATED(mixing_store%norm_res_buffer)) THEN
     368            0 :          DEALLOCATE (mixing_store%norm_res_buffer)
     369              :       END IF
     370              : 
     371         7875 :       IF (ASSOCIATED(mixing_store%ig_global_index)) THEN
     372            0 :          DEALLOCATE (mixing_store%ig_global_index)
     373              :       END IF
     374              : 
     375         7875 :       IF (ASSOCIATED(mixing_store%drho_buffer)) THEN
     376          698 :          DO i = 1, SIZE(mixing_store%drho_buffer, 2)
     377         3454 :             DO j = 1, SIZE(mixing_store%drho_buffer, 1)
     378         3130 :                DEALLOCATE (mixing_store%drho_buffer(j, i)%cc)
     379              :             END DO
     380              :          END DO
     381          324 :          DEALLOCATE (mixing_store%drho_buffer)
     382              :       END IF
     383              : 
     384         7875 :       IF (ASSOCIATED(mixing_store%last_res)) THEN
     385          698 :          DO i = 1, SIZE(mixing_store%last_res)
     386          698 :             DEALLOCATE (mixing_store%last_res(i)%cc)
     387              :          END DO
     388          324 :          DEALLOCATE (mixing_store%last_res)
     389              :       END IF
     390              : 
     391         7875 :       IF (ASSOCIATED(mixing_store%rhoin)) THEN
     392          806 :          DO i = 1, SIZE(mixing_store%rhoin)
     393          806 :             DEALLOCATE (mixing_store%rhoin(i)%cc)
     394              :          END DO
     395          374 :          DEALLOCATE (mixing_store%rhoin)
     396              :       END IF
     397              : 
     398         7875 :       IF (ASSOCIATED(mixing_store%rhoin_old)) THEN
     399          698 :          DO i = 1, SIZE(mixing_store%rhoin_old)
     400          698 :             DEALLOCATE (mixing_store%rhoin_old(i)%cc)
     401              :          END DO
     402          324 :          DEALLOCATE (mixing_store%rhoin_old)
     403              :       END IF
     404              : 
     405         7875 :       IF (ASSOCIATED(mixing_store%p_metric)) THEN
     406          324 :          DEALLOCATE (mixing_store%p_metric)
     407              :       END IF
     408              : 
     409         7875 :       IF (ASSOCIATED(mixing_store%weight)) THEN
     410            2 :          DEALLOCATE (mixing_store%weight)
     411              :       END IF
     412              : 
     413         7875 :       IF (ASSOCIATED(mixing_store%fmat)) THEN
     414            0 :          DEALLOCATE (mixing_store%fmat)
     415              :       END IF
     416              : 
     417         7875 :       IF (ASSOCIATED(mixing_store%acharge)) THEN
     418           34 :          DEALLOCATE (mixing_store%acharge)
     419              :       END IF
     420         7875 :       IF (ASSOCIATED(mixing_store%dacharge)) THEN
     421           34 :          DEALLOCATE (mixing_store%dacharge)
     422              :       END IF
     423         7875 :       IF (ASSOCIATED(mixing_store%dfbroy)) THEN
     424           34 :          DEALLOCATE (mixing_store%dfbroy)
     425              :       END IF
     426         7875 :       IF (ASSOCIATED(mixing_store%ubroy)) THEN
     427           34 :          DEALLOCATE (mixing_store%ubroy)
     428              :       END IF
     429         7875 :       IF (ASSOCIATED(mixing_store%abroy)) THEN
     430           34 :          DEALLOCATE (mixing_store%abroy)
     431              :       END IF
     432         7875 :       IF (ASSOCIATED(mixing_store%wbroy)) THEN
     433           34 :          DEALLOCATE (mixing_store%wbroy)
     434              :       END IF
     435         7875 :       IF (ASSOCIATED(mixing_store%atlist)) THEN
     436           34 :          DEALLOCATE (mixing_store%atlist)
     437              :       END IF
     438              : #if defined(__TBLITE)
     439         7875 :       IF (ALLOCATED(mixing_store%tb_scc_mixer)) THEN
     440            4 :          DEALLOCATE (mixing_store%tb_scc_mixer)
     441              :       END IF
     442              : #endif
     443              : 
     444         7875 :       IF (ASSOCIATED(mixing_store%delta_res)) THEN
     445            0 :          DO i = 1, SIZE(mixing_store%delta_res, 2)
     446            0 :             DO j = 1, SIZE(mixing_store%delta_res, 1)
     447            0 :                DEALLOCATE (mixing_store%delta_res(j, i)%cc)
     448              :             END DO
     449              :          END DO
     450            0 :          DEALLOCATE (mixing_store%delta_res)
     451              :       END IF
     452              : 
     453         7875 :       IF (ASSOCIATED(mixing_store%u_vec)) THEN
     454            0 :          DO i = 1, SIZE(mixing_store%u_vec, 2)
     455            0 :             DO j = 1, SIZE(mixing_store%u_vec, 1)
     456            0 :                DEALLOCATE (mixing_store%u_vec(j, i)%cc)
     457              :             END DO
     458              :          END DO
     459            0 :          DEALLOCATE (mixing_store%u_vec)
     460              :       END IF
     461              : 
     462         7875 :       IF (ASSOCIATED(mixing_store%z_vec)) THEN
     463            0 :          DO i = 1, SIZE(mixing_store%z_vec, 2)
     464            0 :             DO j = 1, SIZE(mixing_store%z_vec, 1)
     465            0 :                DEALLOCATE (mixing_store%z_vec(j, i)%cc)
     466              :             END DO
     467              :          END DO
     468            0 :          DEALLOCATE (mixing_store%z_vec)
     469              :       END IF
     470              : 
     471         7875 :    END SUBROUTINE mixing_storage_release
     472              : 
     473              : ! **************************************************************************************************
     474              : !> \brief      Create CP2K input section for the mixing of the density matrix to
     475              : !>             be used only with diagonalization methods, i.e. not with OT
     476              : !> \param section ...
     477              : !> \param ls_scf ...
     478              : !> \date       20.02.2009
     479              : !> \par History
     480              : !>      02.2015 moved here from input_cp2k_dft.F, modified for use in LS SCF
     481              : !>              [Patrick Seewald]
     482              : !> \author     MI
     483              : !> \version    1.0
     484              : ! **************************************************************************************************
     485        80326 :    SUBROUTINE create_mixing_section(section, ls_scf)
     486              : 
     487              :       TYPE(section_type), POINTER                        :: section
     488              :       LOGICAL, INTENT(IN), OPTIONAL                      :: ls_scf
     489              : 
     490              :       CHARACTER(LEN=default_string_length)               :: section_name
     491              :       INTEGER                                            :: default_mix
     492              :       LOGICAL                                            :: ls
     493              :       TYPE(keyword_type), POINTER                        :: keyword
     494              : 
     495        80326 :       CPASSERT(.NOT. ASSOCIATED(section))
     496              : 
     497        80326 :       IF (PRESENT(ls_scf)) THEN
     498        20796 :          IF (ls_scf) THEN
     499              :             ls = .TRUE.
     500              :          ELSE
     501              :             ls = .FALSE.
     502              :          END IF
     503              :       ELSE
     504              :          ls = .FALSE.
     505              :       END IF
     506              : 
     507              :       IF (ls) THEN
     508        10406 :          section_name = "RHO_MIXING"
     509              :       ELSE
     510        69920 :          section_name = "MIXING"
     511              :       END IF
     512              : 
     513              :       CALL section_create(section, __LOCATION__, &
     514              :                           name=section_name, &
     515              :                           description="Define type and parameters for mixing "// &
     516              :                           "procedures to be applied to the density matrix. Normally, "// &
     517              :                           "only one type of mixing method should be accepted. The mixing "// &
     518              :                           "procedures activated by this section are only active for diagonalization "// &
     519              :                           "methods and linear scaling SCF, i.e. not with minimization methods based "// &
     520              :                           "on OT.", &
     521              :                           n_keywords=16, &
     522              :                           n_subsections=0, &
     523        80326 :                           repeats=.FALSE.)
     524              : 
     525        80326 :       NULLIFY (keyword)
     526              : 
     527              :       CALL keyword_create(keyword, __LOCATION__, &
     528              :                           name="_SECTION_PARAMETERS_", &
     529              :                           description="Controls the activation of the mixing procedure", &
     530              :                           usage="&MIXING ON", &
     531              :                           default_l_val=.TRUE., &
     532        80326 :                           lone_keyword_l_val=.TRUE.)
     533        80326 :       CALL section_add_keyword(section, keyword)
     534        80326 :       CALL keyword_release(keyword)
     535              : 
     536        80326 :       IF (.NOT. ls) THEN
     537        69920 :          default_mix = direct_p_mix
     538              :       ELSE
     539        10406 :          default_mix = broy_mix
     540              :       END IF
     541              : 
     542              :       CALL keyword_create(keyword, __LOCATION__, &
     543              :                           name="METHOD", &
     544              :                           description="Mixing method to be applied", &
     545              :                           repeats=.FALSE., &
     546              :                           usage="METHOD KERKER_MIXING", &
     547              :                           default_i_val=default_mix, &
     548              :                           enum_c_vals=s2a("NONE", &
     549              :                                           "DIRECT_P_MIXING", &
     550              :                                           "KERKER_MIXING", &
     551              :                                           "PULAY_MIXING", &
     552              :                                           "BROYDEN_MIXING", &
     553              :                                           "MODIFIED_BROYDEN_MIXING", &
     554              :                                           "MULTISECANT_MIXING", &
     555              :                                           "NEW_PULAY_MIXING"), &
     556              :                           enum_i_vals=[no_mix, direct_p_mix, kerker_mix, pulay_mix, broy_mix, &
     557              :                                        modified_broy_mix, &
     558              :                                        multisec_mix, new_pulay_mix], &
     559              :                           enum_desc=s2a("No mixing is applied", &
     560              :                                         "Direct mixing of new and old density matrices", &
     561              :                                         "Mixing of the potential in reciprocal space using the Kerker damping", &
     562              :                                         "Pulay mixing", &
     563              :                                         "Original CP2K Broyden mixing with a constant BROY_W0 regularization", &
     564              :                                         "Modified Broyden mixing with dynamic residual weights controlled by BROY_W0, "// &
     565              :                                         "BROY_WREF, and BROY_WMAX", &
     566              :                                         "Multisecant scheme for mixing", "New Pulay mixing using Sundararaman et al.'s "// &
     567              :                                         "metric and preconditioner, with improved convergence behavior and suitable for "// &
     568        80326 :                                         "grand canonical SCF"))
     569              : 
     570        80326 :       CALL section_add_keyword(section, keyword)
     571        80326 :       CALL keyword_release(keyword)
     572              : 
     573              :       CALL keyword_create(keyword, __LOCATION__, &
     574              :                           name="ALPHA", &
     575              :                           description="Fraction of new density to be included", &
     576              :                           repeats=.FALSE., &
     577              :                           n_var=1, &
     578              :                           type_of_var=real_t, &
     579              :                           default_r_val=0.4_dp, &
     580        80326 :                           usage="ALPHA 0.2")
     581        80326 :       CALL section_add_keyword(section, keyword)
     582        80326 :       CALL keyword_release(keyword)
     583              : 
     584              :       CALL keyword_create(keyword, __LOCATION__, &
     585              :                           name="ALPHA_MAG", &
     586              :                           description="Fraction of new magnetization density to be included "// &
     587              :                           "(for spin-polarized calculations, ispin=2 channel after rho_total/m transform). "// &
     588              :                           "A negative value (default) means: use the same value as ALPHA. "// &
     589              :                           "For magnetic transition-metal systems, a larger value (e.g. 0.8-1.6) "// &
     590              :                           "than ALPHA often improves convergence.", &
     591              :                           repeats=.FALSE., &
     592              :                           n_var=1, &
     593              :                           type_of_var=real_t, &
     594              :                           default_r_val=-1.0_dp, &
     595        80326 :                           usage="ALPHA_MAG 0.8")
     596        80326 :       CALL section_add_keyword(section, keyword)
     597        80326 :       CALL keyword_release(keyword)
     598              : 
     599              :       CALL keyword_create(keyword, __LOCATION__, &
     600              :                           name="BETA", &
     601              :                           description="Denominator parameter in Kerker damping "// &
     602              :                           "introduced to suppress charge sloshing: "// &
     603              :                           "rho_mix(g) = rho_in(g) + alpha*g^2/(g^2 + beta^2)*(rho_out(g)-rho_in(g))", &
     604              :                           repeats=.FALSE., &
     605              :                           n_var=1, &
     606              :                           type_of_var=real_t, &
     607              :                           default_r_val=0.5_dp, &
     608              :                           unit_str="bohr^-1", &
     609        80326 :                           usage="BETA 1.5")
     610        80326 :       CALL section_add_keyword(section, keyword)
     611        80326 :       CALL keyword_release(keyword)
     612              : 
     613              :       CALL keyword_create(keyword, __LOCATION__, &
     614              :                           name="BETA_MAG", &
     615              :                           description="Kerker damping parameter for the magnetization channel "// &
     616              :                           "(for spin-polarized calculations). A negative value (default) means: "// &
     617              :                           "use the same value as BETA. Set to 0.0 to disable Kerker screening "// &
     618              :                           "on the magnetization density, which avoids suppression of long-range "// &
     619              :                           "magnetic order formation in transition-metal systems.", &
     620              :                           repeats=.FALSE., &
     621              :                           n_var=1, &
     622              :                           type_of_var=real_t, &
     623              :                           default_r_val=-1.0_dp, &
     624              :                           unit_str="bohr^-1", &
     625        80326 :                           usage="BETA_MAG 0.0")
     626        80326 :       CALL section_add_keyword(section, keyword)
     627        80326 :       CALL keyword_release(keyword)
     628              : 
     629              :       CALL keyword_create(keyword, __LOCATION__, &
     630              :                           name="PULAY_ALPHA", &
     631              :                           description="Fraction of new density to be added to the Pulay expansion", &
     632              :                           repeats=.FALSE., &
     633              :                           n_var=1, &
     634              :                           type_of_var=real_t, &
     635              :                           default_r_val=0.0_dp, &
     636        80326 :                           usage="PULAY_ALPHA 0.2")
     637        80326 :       CALL section_add_keyword(section, keyword)
     638        80326 :       CALL keyword_release(keyword)
     639              : 
     640              :       CALL keyword_create(keyword, __LOCATION__, &
     641              :                           name="PULAY_BETA", &
     642              :                           description="Fraction of residual contribution to be added to Pulay expansion", &
     643              :                           repeats=.FALSE., &
     644              :                           n_var=1, &
     645              :                           type_of_var=real_t, &
     646              :                           default_r_val=1.0_dp, &
     647        80326 :                           usage="PULAY_BETA 0.2")
     648        80326 :       CALL section_add_keyword(section, keyword)
     649        80326 :       CALL keyword_release(keyword)
     650              : 
     651              :       CALL keyword_create(keyword, __LOCATION__, &
     652              :                           name="QM", &
     653              :                           description="The control parameter in the numerator of the Pulay metric "// &
     654              :                           "used in the new Pulay mixing, introduced to suppress charge sloshing: "// &
     655              :                           "Pulay metric: M(g) = (g^2 + qm^2 + qkapa^2)/(g^2 + qkapa^2)", &
     656              :                           repeats=.FALSE., &
     657              :                           n_var=1, &
     658              :                           type_of_var=real_t, &
     659              :                           default_r_val=0.75_dp, &
     660              :                           unit_str="bohr^-1", &
     661        80326 :                           usage="QM 0.75")
     662        80326 :       CALL section_add_keyword(section, keyword)
     663        80326 :       CALL keyword_release(keyword)
     664              : 
     665              :       CALL keyword_create(keyword, __LOCATION__, &
     666              :                           name="QK", &
     667              :                           description="The control parameter in the denominator of the Kerker preconditioner "// &
     668              :                           "used in the new Pulay mixing, introduced to suppress charge sloshing: "// &
     669              :                           "Kerker preconditioner: K(g) = alpha * (g^2 + qkapa^2)/(g^2 + qk^2 + qkapa^2)", &
     670              :                           repeats=.FALSE., &
     671              :                           n_var=1, &
     672              :                           type_of_var=real_t, &
     673              :                           default_r_val=3.0_dp, &
     674              :                           unit_str="bohr^-1", &
     675        80326 :                           usage="QK 3.0")
     676        80326 :       CALL section_add_keyword(section, keyword)
     677        80326 :       CALL keyword_release(keyword)
     678              : 
     679              :       CALL keyword_create(keyword, __LOCATION__, &
     680              :                           name="QKAPPA", &
     681              :                           description="The control parameter in the numerator and the denominator of "// &
     682              :                           "the Pulay metric and the Kerker preconditioner "// &
     683              :                           "used in the new Pulay mixing, introduced to ensure a finite and well-defined "// &
     684              :                           "Pulay metric at g=0 and a non-zero and well-defined Kerker preconditioner at g=0", &
     685              :                           repeats=.FALSE., &
     686              :                           n_var=1, &
     687              :                           type_of_var=real_t, &
     688              :                           default_r_val=0.25_dp, &
     689              :                           unit_str="bohr^-1", &
     690        80326 :                           usage="QKAPPA 0.25")
     691        80326 :       CALL section_add_keyword(section, keyword)
     692        80326 :       CALL keyword_release(keyword)
     693              : 
     694              :       CALL keyword_create(keyword, __LOCATION__, name="NMIXING", &
     695              :                           description="Minimal number of density mixing (should be greater than 0), "// &
     696              :                           "before starting DIIS", &
     697        80326 :                           usage="NMIXING 1", default_i_val=2)
     698        80326 :       CALL section_add_keyword(section, keyword)
     699        80326 :       CALL keyword_release(keyword)
     700              : 
     701              :       CALL keyword_create(keyword, __LOCATION__, name="NBUFFER", &
     702              :                           variants=s2a("NPULAY", "NBROYDEN", "NMULTISECANT"), &
     703              :                           description="Number of previous steps stored for the actual mixing scheme", &
     704        80326 :                           usage="NBUFFER 2", default_i_val=4)
     705        80326 :       CALL section_add_keyword(section, keyword)
     706        80326 :       CALL keyword_release(keyword)
     707              : 
     708              :       CALL keyword_create(keyword, __LOCATION__, &
     709              :                           name="BROY_W0", &
     710              :                           description="Regularization weight used in Broyden mixing. For the original "// &
     711              :                           "BROYDEN_MIXING method this is the constant diagonal regularization of the "// &
     712              :                           "small Broyden system. For MODIFIED_BROYDEN_MIXING it is the corresponding "// &
     713              :                           "diagonal regularization of the dynamically weighted Broyden system. "// &
     714              :                           "The default follows tblite.", &
     715              :                           repeats=.FALSE., &
     716              :                           n_var=1, &
     717              :                           type_of_var=real_t, &
     718              :                           default_r_val=0.01_dp, &
     719        80326 :                           usage="BROY_W0 0.03")
     720        80326 :       CALL section_add_keyword(section, keyword)
     721        80326 :       CALL keyword_release(keyword)
     722              : 
     723              :       CALL keyword_create(keyword, __LOCATION__, &
     724              :                           name="BROY_WREF", &
     725              :                           description="Reference factor for the dynamic residual weight. This keyword "// &
     726              :                           "is only used by MODIFIED_BROYDEN_MIXING; the original BROYDEN_MIXING path "// &
     727              :                           "is unchanged. The effective history weight is proportional to BROY_WREF "// &
     728              :                           "divided by the residual norm, clipped to the interval [1, BROY_WMAX]. "// &
     729              :                           "The default follows tblite.", &
     730              :                           repeats=.FALSE., &
     731              :                           n_var=1, &
     732              :                           type_of_var=real_t, &
     733              :                           default_r_val=0.01_dp, &
     734        80326 :                           usage="BROY_WREF 0.01")
     735        80326 :       CALL section_add_keyword(section, keyword)
     736        80326 :       CALL keyword_release(keyword)
     737              : 
     738              :       CALL keyword_create(keyword, __LOCATION__, &
     739              :                           name="BROY_WMAX", &
     740              :                           description="Upper bound for the dynamic residual weight. This keyword is "// &
     741              :                           "only used by MODIFIED_BROYDEN_MIXING; the original BROYDEN_MIXING path is "// &
     742              :                           "unchanged. The lower bound is fixed to 1.0. The default follows tblite.", &
     743              :                           repeats=.FALSE., &
     744              :                           n_var=1, &
     745              :                           type_of_var=real_t, &
     746              :                           default_r_val=100000.0_dp, &
     747        80326 :                           usage="BROY_WMAX 100000.0")
     748        80326 :       CALL section_add_keyword(section, keyword)
     749        80326 :       CALL keyword_release(keyword)
     750              : 
     751              :       CALL keyword_create(keyword, __LOCATION__, &
     752              :                           name="REGULARIZATION", &
     753              :                           description="Regularization parameter to stabilize "// &
     754              :                           "the inversion of the residual matrix {Yn^t Yn} in the "// &
     755              :                           "multisecant mixing scheme (noise)", &
     756              :                           repeats=.FALSE., &
     757              :                           n_var=1, &
     758              :                           type_of_var=real_t, &
     759              :                           default_r_val=0.00001_dp, &
     760        80326 :                           usage="REGULARIZATION 0.000001")
     761        80326 :       CALL section_add_keyword(section, keyword)
     762        80326 :       CALL keyword_release(keyword)
     763              : 
     764              :       CALL keyword_create(keyword, __LOCATION__, &
     765              :                           name="MAX_STEP", &
     766              :                           description="Upper bound for the magnitude of the "// &
     767              :                           "unpredicted step size in the update by the "// &
     768              :                           "multisecant mixing scheme", &
     769              :                           repeats=.FALSE., &
     770              :                           n_var=1, &
     771              :                           type_of_var=real_t, &
     772              :                           default_r_val=0.1_dp, &
     773        80326 :                           usage="MAX_STEP .2")
     774        80326 :       CALL section_add_keyword(section, keyword)
     775        80326 :       CALL keyword_release(keyword)
     776              : 
     777              :       CALL keyword_create(keyword, __LOCATION__, &
     778              :                           name="R_FACTOR", &
     779              :                           description="Control factor for the magnitude of the "// &
     780              :                           "unpredicted step size in the update by the "// &
     781              :                           "multisecant mixing scheme", &
     782              :                           repeats=.FALSE., &
     783              :                           n_var=1, &
     784              :                           type_of_var=real_t, &
     785              :                           default_r_val=0.05_dp, &
     786        80326 :                           usage="R_FACTOR .12")
     787        80326 :       CALL section_add_keyword(section, keyword)
     788        80326 :       CALL keyword_release(keyword)
     789              : 
     790              :       CALL keyword_create(keyword, __LOCATION__, name="NSKIP", &
     791              :                           variants=["NSKIP_MIXING"], &
     792              :                           description="Number of initial iteration for which the mixing is skipped", &
     793       160652 :                           usage="NSKIP 10", default_i_val=0)
     794        80326 :       CALL section_add_keyword(section, keyword)
     795        80326 :       CALL keyword_release(keyword)
     796              : 
     797              :       CALL keyword_create(keyword, __LOCATION__, name="N_SIMPLE_MIX", &
     798              :                           variants=["NSIMPLEMIX"], &
     799              :                           description="Number of kerker damping iterations before starting other mixing procedures", &
     800       160652 :                           usage="NSIMPLEMIX", default_i_val=0)
     801        80326 :       CALL section_add_keyword(section, keyword)
     802        80326 :       CALL keyword_release(keyword)
     803              : 
     804              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_GVEC_EXP", &
     805              :                           description="Restricts the G-space mixing to lower part of G-vector spectrum,"// &
     806              :                           " up to a G0, by assigning the exponent of the Gaussian that can be "// &
     807              :                           "represented by vectors smaller than G0 within a certain accuracy. ", &
     808              :                           repeats=.FALSE., &
     809              :                           n_var=1, &
     810              :                           type_of_var=real_t, &
     811              :                           default_r_val=-1._dp, &
     812        80326 :                           usage="MAX_GVEC_EXP 3.")
     813        80326 :       CALL section_add_keyword(section, keyword)
     814        80326 :       CALL keyword_release(keyword)
     815              : 
     816              :       CALL keyword_create(keyword, __LOCATION__, name="GMIX_P", &
     817              :                           description="Activate the mixing of the density matrix, using the same"// &
     818              :                           " mixing coefficient applied for the g-space mixing.", &
     819              :                           repeats=.FALSE., &
     820              :                           lone_keyword_l_val=.TRUE., &
     821              :                           default_l_val=.FALSE., &
     822        80326 :                           usage="GMIX_P")
     823        80326 :       CALL section_add_keyword(section, keyword)
     824        80326 :       CALL keyword_release(keyword)
     825              : 
     826        80326 :    END SUBROUTINE create_mixing_section
     827              : 
     828            0 : END MODULE qs_density_mixing_types
        

Generated by: LCOV version 2.0-1