LCOV - code coverage report
Current view: top level - src - smeagol_emtoptions.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:b4bd748) Lines: 0 164 0.0 %
Date: 2025-03-09 07:56:22 Functions: 0 4 0.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------------------------!
       2             : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3             : !   Copyright 2000-2025 CP2K developers group <https://cp2k.org>                                   !
       4             : !                                                                                                  !
       5             : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6             : !--------------------------------------------------------------------------------------------------!
       7             : 
       8             : ! **************************************************************************************************
       9             : !> \brief CP2K+SMEAGOL interface.
      10             : !> \author Sergey Chulkov
      11             : !> \author Christian Ahart
      12             : !> \author Clotilde Cucinotta
      13             : ! **************************************************************************************************
      14             : MODULE smeagol_emtoptions
      15             :    #:include 'input_cp2k_smeagol.fypp'
      16             :    USE cell_types, ONLY: cell_type, &
      17             :                          scaled_to_real
      18             :    USE cp_dbcsr_api, ONLY: dbcsr_get_info, &
      19             :                            dbcsr_type
      20             : #if defined(__SMEAGOL)
      21             :    USE global_meshvar, ONLY: smeagolglobal_orbital_BS => orbital_BS
      22             : #endif
      23             :    USE input_constants, ONLY: smeagol_gridmethod_adaptive, &
      24             :                               smeagol_gridmethod_traditional, &
      25             :                               smeagol_integraltype_gauss_chebyshev, &
      26             :                               smeagol_integraltype_gauss_legendre
      27             :    USE kinds, ONLY: default_string_length, &
      28             :                     dp
      29             : #if defined(__SMEAGOL)
      30             :    USE mbfield, ONLY: smeagolglobal_ZeemanBx => ZeemanBx, &
      31             :                       smeagolglobal_ZeemanBy => ZeemanBy, &
      32             :                       smeagolglobal_ZeemanBz => ZeemanBz
      33             : #endif
      34             :    USE message_passing, ONLY: mp_para_env_type
      35             : #if defined(__SMEAGOL)
      36             :    USE mselfenergies, ONLY: SetOptionsSelfEnergies
      37             :    USE negfcoop, ONLY: coopinfo
      38             :    USE negfmod, ONLY: &
      39             : #:for name1, keyword1, val1 in reademtr_negfmod_llist
      40             :       smeagolglobal_${name1}$ => ${name1}$, &
      41             : #:endfor
      42             : #:for name1, keyword1, val1 in reademtr_negfmod_ilist
      43             :       smeagolglobal_${name1}$ => ${name1}$, &
      44             : #:endfor
      45             : #:for name1, keyword1, val1 in reademtr_negfmod_rlist
      46             :       smeagolglobal_${name1}$ => ${name1}$, &
      47             : #:endfor
      48             : #:for name1, keyword1, val1, unit1 in reademtr_negfmod_rydberg_plist
      49             :       smeagolglobal_${name1}$ => ${name1}$, &
      50             : #:endfor
      51             : #:for name1, keyword1, val1, unit1 in reademtr_negfmod_plist
      52             :       smeagolglobal_${name1}$ => ${name1}$, &
      53             : #:endfor
      54             : #:for name1, keyword1, val1 in readoptsnegf_negfmod_llist
      55             :       smeagolglobal_${name1}$ => ${name1}$, &
      56             : #:endfor
      57             : #:for name1, keyword1, val1 in readoptsnegf_negfmod_ilist
      58             :       smeagolglobal_${name1}$ => ${name1}$, &
      59             : #:endfor
      60             : #:for name1, keyword1, val1 in readoptsnegf_negfmod_rlist
      61             :       smeagolglobal_${name1}$ => ${name1}$, &
      62             : #:endfor
      63             : #:for name1, keyword1, val1, unit1 in readoptsnegf_negfmod_explicit_plist
      64             :       smeagolglobal_${name1}$ => ${name1}$, &
      65             : #:endfor
      66             : #:for name1, keyword1, val1 in emtoptions_negfmod_llist
      67             :       smeagolglobal_${name1}$ => ${name1}$, &
      68             : #:endfor
      69             : #:for name1, keyword1, val1 in emtoptions_negfmod_ilist
      70             :       smeagolglobal_${name1}$ => ${name1}$, &
      71             : #:endfor
      72             : #:for name1, keyword1, val1 in emtoptions_negfmod_explicit_ilist
      73             :       smeagolglobal_${name1}$ => ${name1}$, &
      74             : #:endfor
      75             : #:for name1, keyword1, val1 in emtoptions_negfmod_rlist
      76             :       smeagolglobal_${name1}$ => ${name1}$, &
      77             : #:endfor
      78             : #:for name1, keyword1, val1 in emtoptions_negfmod_explicit_rlist
      79             :       smeagolglobal_${name1}$ => ${name1}$, &
      80             : #:endfor
      81             : #:for name1, keyword1, val1, unit1 in emtoptions_negfmod_rydberg_plist
      82             :       smeagolglobal_${name1}$ => ${name1}$, &
      83             : #:endfor
      84             :       smeagolglobal_deltabss_bs => deltabss_bs, &
      85             :       smeagolglobal_gamma_negf => gamma_negf, &
      86             :       smeagolglobal_emforces => emforces, &
      87             :       smeagolglobal_emSTT => emSTT, &
      88             :       smeagolglobal_emSTTLin => emSTTLin, &
      89             :       smeagolglobal_gridmethod => gridmethod, &
      90             :       smeagolglobal_integraltype => integraltype, &
      91             :       smeagolglobal_ndivxy => ndivxy, &
      92             :       smeagolglobal_ndivxyNL => ndivxyNL, &
      93             :       smeagolglobal_negf_base_comm => negf_base_comm, &
      94             :       smeagolglobal_nebss_bs => nebss_bs, &
      95             :       smeagolglobal_nprocs_hs => nprocs_hs
      96             :    USE sigma, ONLY: &
      97             : #:for name1, keyword1, val1 in emtoptions_sigma_ilist
      98             :       smeagolglobal_${name1}$ => ${name1}$
      99             :       #:endfor
     100             : #endif
     101             :       USE smeagol_control_types, ONLY: smeagol_control_type
     102             :       USE string_utilities, ONLY: integer_to_string
     103             : #include "./base/base_uses.f90"
     104             : 
     105             :       IMPLICIT NONE
     106             :       PRIVATE
     107             : 
     108             :       CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'smeagol_emtoptions'
     109             : 
     110             :       PUBLIC :: reademtr, ReadOptionsNEGF_DFT, emtrans_options, emtrans_deallocate_global_arrays
     111             : 
     112             :    CONTAINS
     113             : 
     114           0 :       SUBROUTINE reademtr(smeagol_control, natoms, gamma_negf)
     115             :          TYPE(smeagol_control_type), POINTER                :: smeagol_control
     116             :          INTEGER, INTENT(in)                                :: natoms
     117             :          LOGICAL, INTENT(in)                                :: gamma_negf
     118             : 
     119             :          CHARACTER(LEN=*), PARAMETER :: routineN = 'reademtr'
     120             : 
     121             :          INTEGER                                            :: handle
     122             : 
     123           0 :          CALL timeset(routineN, handle)
     124             : 
     125             : #if defined(__SMEAGOL)
     126           0 :          CPASSERT(ASSOCIATED(smeagol_control%aux))
     127             : 
     128           0 :          smeagolglobal_gamma_negf = gamma_negf
     129             : 
     130           0 :          IF (smeagol_control%aux%AtmRVCte <= 0) smeagol_control%aux%AtmRVCte = natoms
     131             : 
     132             :          #:for name1, keyword1, val1 in reademtr_negfmod_llist
     133           0 :             smeagolglobal_${name1}$ = smeagol_control%aux%${name1}$
     134             :          #:endfor
     135             : 
     136             :          #:for name1, keyword1, val1 in reademtr_negfmod_ilist
     137           0 :             smeagolglobal_${name1}$ = smeagol_control%aux%${name1}$
     138             :          #:endfor
     139             : 
     140             :          #:for name1, keyword1, val1 in reademtr_negfmod_rlist
     141           0 :             smeagolglobal_${name1}$ = smeagol_control%aux%${name1}$
     142             :          #:endfor
     143             : 
     144             :          #:for name1, keyword1, val1, unit1 in reademtr_negfmod_rydberg_plist
     145           0 :             smeagolglobal_${name1}$ = smeagol_control%to_smeagol_energy_units*smeagol_control%aux%${name1}$
     146             :          #:endfor
     147             :          #:for name1, keyword1, val1, unit1 in reademtr_negfmod_plist
     148           0 :             smeagolglobal_${name1}$ = smeagol_control%aux%${name1}$
     149             :          #:endfor
     150             : 
     151           0 :          coopinfo%ccoop = smeagol_control%aux%COOPCalculate
     152           0 :          coopinfo%nbond = smeagol_control%aux%COOPNumberOfBonds
     153             : #else
     154             :          CALL cp_abort(__LOCATION__, &
     155             :                        "CP2K was compiled with no SMEAGOL support.")
     156             :          MARK_USED(smeagol_control)
     157             :          MARK_USED(natoms)
     158             :          MARK_USED(gamma_negf)
     159             : #endif
     160             : 
     161           0 :          CALL timestop(handle)
     162           0 :       END SUBROUTINE reademtr
     163             : 
     164           0 :       SUBROUTINE ReadOptionsNEGF_DFT(smeagol_control, ucell, torqueflag, torquelin)
     165             :          TYPE(smeagol_control_type), POINTER                :: smeagol_control
     166             :          TYPE(cell_type), POINTER                           :: ucell
     167             :          LOGICAL, INTENT(in)                                :: torqueflag, torquelin
     168             : 
     169             :          CHARACTER(LEN=*), PARAMETER :: routineN = 'ReadOptionsNEGF_DFT'
     170             : 
     171             :          INTEGER                                            :: handle
     172             :          REAL(kind=dp), DIMENSION(3)                        :: coord_real, coord_scaled
     173             : 
     174           0 :          CALL timeset(routineN, handle)
     175             : 
     176             : #if defined(__SMEAGOL)
     177           0 :          CPASSERT(ASSOCIATED(smeagol_control%aux))
     178             : 
     179           0 :          smeagolglobal_emSTT = torqueflag
     180           0 :          smeagolglobal_emSTTLin = torquelin
     181             : 
     182             :          ! In case of the original SIESTA+SMEAGOL, 'TimeReversal' keyword is enabled by default, therefore 'EM.TimeReversal' is also enabled.
     183             :          ! In case of this CP2K+SMEAGOL interface, the default value of 'timereversal' variable is .FALSE.
     184           0 :          IF (smeagol_control%aux%timereversal) THEN
     185             :             CALL cp_warn(__LOCATION__, &
     186           0 :                          "The SMEAGOL keyword 'EM.TimeReversal' is not supported yet.")
     187             :          END IF
     188             : 
     189             :          #:for name1, keyword1, val1 in readoptsnegf_negfmod_llist
     190           0 :             smeagolglobal_${name1}$ = smeagol_control%aux%${name1}$
     191             :          #:endfor
     192             : 
     193             :          #:for name1, keyword1, val1 in readoptsnegf_negfmod_ilist
     194           0 :             smeagolglobal_${name1}$ = smeagol_control%aux%${name1}$
     195             :          #:endfor
     196             : 
     197             :          #:for name1, keyword1, val1 in readoptsnegf_negfmod_rlist
     198           0 :             smeagolglobal_${name1}$ = smeagol_control%aux%${name1}$
     199             :          #:endfor
     200             : 
     201             :          ! readoptsnegf_negfmod_plist
     202           0 :          IF (.NOT. smeagol_control%aux%isexplicit_RGlxmin) smeagol_control%aux%RGlxmin = 0.0_dp
     203           0 :          IF (.NOT. smeagol_control%aux%isexplicit_RGlymin) smeagol_control%aux%RGlymin = 0.0_dp
     204           0 :          IF (.NOT. smeagol_control%aux%isexplicit_RGlzmin) smeagol_control%aux%RGlzmin = 0.0_dp
     205           0 :          IF (.NOT. smeagol_control%aux%isexplicit_RGlxmax) THEN
     206           0 :             coord_scaled(:) = (/1.0_dp, 0.0_dp, 0.0_dp/)
     207           0 :             CALL scaled_to_real(coord_real, coord_scaled, ucell)
     208           0 :             smeagol_control%aux%RGlxmax = coord_real(1)
     209             :          END IF
     210           0 :          IF (.NOT. smeagol_control%aux%isexplicit_RGlymax) THEN
     211           0 :             coord_scaled(:) = (/0.0_dp, 1.0_dp, 0.0_dp/)
     212           0 :             CALL scaled_to_real(coord_real, coord_scaled, ucell)
     213           0 :             smeagol_control%aux%RGlymax = coord_real(2)
     214             :          END IF
     215           0 :          IF (.NOT. smeagol_control%aux%isexplicit_RGlzmax) THEN
     216           0 :             coord_scaled(:) = (/0.0_dp, 0.0_dp, 1.0_dp/)
     217           0 :             CALL scaled_to_real(coord_real, coord_scaled, ucell)
     218           0 :             smeagol_control%aux%RGlzmax = coord_real(3)
     219             :          END IF
     220             :          #:for name1, keyword1, val1, unit1 in readoptsnegf_negfmod_explicit_plist
     221           0 :             smeagolglobal_${name1}$ = smeagol_control%aux%${name1}$
     222             :          #:endfor
     223             : 
     224             :          ! options to add a Zeeman term to the Hamiltonian
     225             :          #:for name1, keyword1, val1, unit1 in readoptsnegf_bfield_rydberg_plist
     226           0 :             smeagolglobal_${name1}$ = smeagol_control%to_smeagol_energy_units*smeagol_control%aux%${name1}$
     227             :          #:endfor
     228             : #else
     229             :          CALL cp_abort(__LOCATION__, &
     230             :                        "CP2K was compiled with no SMEAGOL support.")
     231             :          MARK_USED(smeagol_control)
     232             :          MARK_USED(ucell)
     233             :          MARK_USED(torqueflag)
     234             :          MARK_USED(torquelin)
     235             :          ! local variables
     236             :          MARK_USED(coord_real)
     237             :          MARK_USED(coord_scaled)
     238             : #endif
     239             : 
     240           0 :          CALL timestop(handle)
     241           0 :       END SUBROUTINE ReadOptionsNEGF_DFT
     242             : 
     243           0 :       SUBROUTINE emtrans_options(smeagol_control, matrix_s, para_env, iter, istep, inicoor, iv, delta, nk)
     244             :          TYPE(smeagol_control_type), POINTER                :: smeagol_control
     245             :          TYPE(dbcsr_type), INTENT(in), POINTER              :: matrix_s
     246             :          TYPE(mp_para_env_type), POINTER                    :: para_env
     247             :          INTEGER, INTENT(in)                                :: iter, istep, inicoor, iv
     248             :          REAL(kind=dp), INTENT(in)                          :: delta
     249             :          INTEGER, INTENT(in)                                :: nk
     250             : 
     251             :          CHARACTER(LEN=*), PARAMETER :: routineN = 'emtrans_options'
     252             : 
     253             :          CHARACTER(len=default_string_length)               :: actual_val_str, expected_val_str
     254             :          INTEGER                                            :: GetRhoSingleLeadDefault, handle, i, iatom, n1, nblkcols_total, &
     255             :                                                                NParallelK, NParallelKbuf
     256           0 :          INTEGER, DIMENSION(:), POINTER                     :: col_blk_offset, col_blk_size
     257             : 
     258           0 :          CALL timeset(routineN, handle)
     259             : 
     260             : #if defined(__SMEAGOL)
     261           0 :          CPASSERT(ASSOCIATED(smeagol_control%aux))
     262             : 
     263             :          CALL dbcsr_get_info(matrix=matrix_s, nblkcols_total=nblkcols_total, &
     264           0 :                              col_blk_size=col_blk_size, col_blk_offset=col_blk_offset)
     265             :          ! number of atomic orbitals.
     266             :          ! The name n1 is meaningless, but it is used in the original SIESTA's version of emtrans_options() subroutine
     267           0 :          n1 = SUM(col_blk_size(1:nblkcols_total))
     268             : 
     269           0 :          IF ((iter == 1) .AND. (istep == inicoor) .AND. (iv == 0)) THEN
     270             : 
     271           0 :             IF (smeagol_control%aux%gridmethod == smeagol_gridmethod_traditional) THEN
     272           0 :                smeagolglobal_gridmethod = 'Traditional'
     273           0 :             ELSE IF (smeagol_control%aux%gridmethod == smeagol_gridmethod_adaptive) THEN
     274           0 :                smeagolglobal_gridmethod = 'Adaptivegrid'
     275             :             ELSE
     276           0 :                smeagolglobal_gridmethod = 'UNKNOWN'
     277             :             END IF
     278             : 
     279           0 :             IF (smeagol_control%aux%integraltype == smeagol_integraltype_gauss_legendre) THEN
     280           0 :                smeagolglobal_integraltype = 'gauss-legendre'
     281           0 :             ELSE IF (smeagol_control%aux%integraltype == smeagol_integraltype_gauss_chebyshev) THEN
     282           0 :                smeagolglobal_integraltype = 'gauss-chebyshev'
     283             :             ELSE
     284           0 :                smeagolglobal_integraltype = 'UNKNOWN'
     285             :             END IF
     286             : 
     287           0 :             smeagolglobal_negf_base_comm = para_env%get_handle()
     288             : 
     289           0 :             IF (MOD(smeagol_control%aux%ndivisions, 2) == 0) THEN
     290             :                CALL cp_abort(__LOCATION__, &
     291           0 :                              "AM.NumberDivisions value must be odd.")
     292             :             END IF
     293             : 
     294             :             ! It seems that 'sigmatodisk' parameter is specific to the SIESTA interface.
     295             :             ! Consider setting smeagol_control%aux%sigmatodisk = .FALSE. and remove smeagol_control%aux%storesigma input keyword.
     296           0 :             IF (smeagol_control%aux%storesigma == 2) THEN
     297           0 :                smeagol_control%aux%sigmatodisk = .TRUE.
     298           0 :             ELSE IF (smeagol_control%aux%storesigma == 1) THEN
     299           0 :                smeagol_control%aux%sigmatodisk = .FALSE.
     300             :             END IF
     301             : 
     302             :             ! Bound states
     303             :             !     options:
     304             :             !       bs_add    : true => bound states are added
     305             :             !                   false=> normal smeagol
     306             :             !       bs_method : 0    => calculate bound states with effective Hamiltonian
     307             :             !                   1    => calculate bound states by adding a small
     308             :             !                           imaginary part to the selfenergies
     309           0 :             IF (smeagol_control%aux%bs_nmid == 0) smeagol_control%aux%bs_nmid = n1/2
     310             : 
     311             :             ! SC: Bad practice: real number comparison
     312           0 :             IF (smeagol_control%aux%SigmaWideBand /= 0.0_dp) smeagol_control%aux%m_svdtolzi = 0.0_dp
     313             : 
     314           0 :             IF (smeagol_control%aux%leadspdos) smeagol_control%aux%leadsdos = .TRUE.
     315           0 :             IF (smeagol_control%aux%curr_distKEne) smeagol_control%aux%curr_distK = .TRUE.
     316           0 :             IF (smeagol_control%aux%curr_distK) smeagol_control%aux%curr_dist = .TRUE.
     317             : 
     318           0 :             IF (smeagolglobal_emSTT .AND. smeagolglobal_emSTTLin .OR. smeagol_control%aux%curr_dist) THEN
     319           0 :                smeagol_control%aux%emldos2 = .TRUE.
     320           0 :                IF (smeagol_control%aux%curr_dist) THEN
     321             :                   GetRhoSingleLeadDefault = 3
     322             :                ELSE
     323           0 :                   GetRhoSingleLeadDefault = -3
     324             :                END IF
     325             :             ELSE
     326             :                GetRhoSingleLeadDefault = 0
     327             :             END IF
     328             : 
     329             :             ! current-induced forces
     330             :             ! The value of 'smeagol_control%emforces' is set in qs_energies().
     331             :             ! Calculation of forces is enabled automatically for certain run_types (energy_force, geo_opt, md) and disabled otherwise.
     332           0 :             IF (smeagol_control%aux%curr_dist) THEN
     333           0 :                smeagol_control%emforces = .TRUE.
     334             :             END IF
     335             : 
     336           0 :             IF (.NOT. smeagol_control%aux%isexplicit_nprocs_hs) smeagol_control%aux%nprocs_hs = smeagol_control%aux%nprocs_inverse
     337           0 :             smeagolglobal_nprocs_hs = smeagol_control%aux%nprocs_hs
     338           0 :            IF (.NOT. smeagol_control%aux%isexplicit_GetRhoSingleLead) smeagol_control%aux%GetRhoSingleLead = GetRhoSingleLeadDefault
     339             : 
     340           0 :             IF (smeagol_control%aux%MinChannelIndex < 1) smeagol_control%aux%MinChannelIndex = 1
     341           0 :             IF (smeagol_control%aux%MaxChannelIndex < 1) &
     342           0 :                smeagol_control%aux%MaxChannelIndex = smeagol_control%aux%MinChannelIndex + 4
     343             : 
     344           0 :             IF (smeagolglobal_emSTT .AND. smeagolglobal_emSTTLin .AND. smeagol_control%aux%GetRhoSingleLead /= -3) THEN
     345             :                CALL cp_warn(__LOCATION__, &
     346             :                             "EM.LDOSLeadsProjection should be set to -3. "// &
     347             :                             "If SpinTorque and STLinResp are T, otherwise the output "// &
     348           0 :                             "results for the spin transfer torque are incorrect.")
     349             :             END IF
     350             : 
     351             :             ! NParallelK
     352           0 :             NParallelK = smeagol_control%aux%NParallelK
     353           0 :             IF (MOD(para_env%num_pe, NParallelK) /= 0) then
     354             :                CALL cp_warn(__LOCATION__, &
     355             :                             "EM.ParallelOverKNum must be a divisor of the total number of "// &
     356           0 :                             "MPI processes used in a run; resetting the value of NParallelK.")
     357           0 :                NParallelKbuf = NParallelK
     358           0 :                DO NParallelK = NParallelKbuf, 1, -1
     359           0 :                   IF (MOD(para_env%num_pe, NParallelK) == 0) EXIT
     360             :                END DO
     361             :             END IF
     362             : 
     363           0 :             IF (NParallelK > para_env%num_pe) THEN
     364             :                CALL cp_warn(__LOCATION__, &
     365             :                             "EM.ParallelOverKNum can not be larger than the total number of "// &
     366           0 :                             "MPI processes used in a run; resetting the value of NParallelK.")
     367           0 :                NParallelK = -1
     368             :             END IF
     369             : 
     370           0 :             IF (NParallelK > nk) THEN
     371             :                CALL cp_warn(__LOCATION__, &
     372             :                             "EM.ParallelOverKNum can not be larger than the total number of "// &
     373           0 :                             "k-points used in a run; resetting the value of NParallelK.")
     374             :                NParallelK = -1
     375             :             END IF
     376             : 
     377           0 :             IF (NParallelK == -1) THEN
     378           0 :                DO NParallelK = nk, 1, -1
     379           0 :                   IF (MOD(para_env%num_pe, NParallelK) == 0) EXIT
     380             :                END DO
     381             :             END IF
     382             : 
     383           0 :             smeagol_control%aux%NParallelK = NParallelK
     384             : 
     385           0 :             IF (smeagol_control%aux%empdosk) smeagol_control%aux%empdos = .TRUE.
     386           0 :             IF (smeagol_control%aux%emldos2) smeagol_control%aux%emdos = .TRUE.
     387           0 :             IF (smeagol_control%aux%TransmissionChannels) smeagol_control%aux%emdos = .TRUE.
     388           0 :             IF (smeagol_control%aux%TransmissionMatrix) smeagol_control%aux%emdos = .TRUE.
     389           0 :             IF (smeagol_control%aux%curr_dist) smeagol_control%aux%emdos = .TRUE.
     390           0 :             IF (smeagol_control%aux%empdos) smeagol_control%aux%emdos = .TRUE.
     391           0 :             IF (smeagol_control%aux%m_skipsvd < 2.0_dp) smeagol_control%aux%m_skipsvd = 10.0_dp
     392             : 
     393           0 :             IF (smeagol_control%aux%CallImpuritySolver) smeagol_control%aux%ComputeImpurityGfMatsubara = .TRUE.
     394             : 
     395             :             #:for name1, keyword1, val1 in emtoptions_negfmod_llist
     396           0 :                smeagolglobal_${name1}$ = smeagol_control%aux%${name1}$
     397             :             #:endfor
     398           0 :             smeagolglobal_emforces = smeagol_control%emforces
     399             : 
     400             :             ! emtoptions_local_ilist, emtoptions_local_explicit_ilist
     401           0 :             IF (.NOT. smeagol_control%aux%isexplicit_Sigma_NxLeft) smeagol_control%aux%Sigma_NxLeft = smeagol_control%aux%Sigma_Nx
     402           0 :             IF (.NOT. smeagol_control%aux%isexplicit_Sigma_NyLeft) smeagol_control%aux%Sigma_NyLeft = smeagol_control%aux%Sigma_Ny
     403           0 :             IF (.NOT. smeagol_control%aux%isexplicit_Sigma_NxRight) smeagol_control%aux%Sigma_NxRight = smeagol_control%aux%Sigma_Nx
     404           0 :             IF (.NOT. smeagol_control%aux%isexplicit_Sigma_NyRight) smeagol_control%aux%Sigma_NyRight = smeagol_control%aux%Sigma_Ny
     405             : 
     406           0 :             smeagolglobal_ndivxy(1) = smeagol_control%aux%Sigma_Nx
     407           0 :             smeagolglobal_ndivxy(2) = smeagol_control%aux%Sigma_Ny
     408           0 :             smeagolglobal_ndivxyNL(1, 1) = smeagol_control%aux%Sigma_NxLeft
     409           0 :             smeagolglobal_ndivxyNL(1, 2) = smeagol_control%aux%Sigma_NyLeft
     410           0 :             smeagolglobal_ndivxyNL(2, 1) = smeagol_control%aux%Sigma_NxRight
     411           0 :             smeagolglobal_ndivxyNL(2, 2) = smeagol_control%aux%Sigma_NyRight
     412             : 
     413           0 :             CALL SetOptionsSelfEnergies(smeagolglobal_ndivxyNL, 2)
     414             : 
     415             :             #:for name1, keyword1, val1 in emtoptions_negfmod_ilist
     416           0 :                smeagolglobal_${name1}$ = smeagol_control%aux%${name1}$
     417             :             #:endfor
     418             : 
     419             :             #:for name1, keyword1, val1 in emtoptions_negfmod_explicit_ilist
     420           0 :                smeagolglobal_${name1}$ = smeagol_control%aux%${name1}$
     421             :             #:endfor
     422             : 
     423             :             #:for name1, keyword1, val1 in emtoptions_sigma_ilist
     424           0 :                smeagolglobal_${name1}$ = smeagol_control%aux%${name1}$
     425             :             #:endfor
     426             : 
     427             :             #:for name1, keyword1, val1 in emtoptions_negfmod_rlist
     428           0 :                smeagolglobal_${name1}$ = smeagol_control%aux%${name1}$
     429             :             #:endfor
     430             : 
     431             :             ! +++ bound states
     432           0 :             IF (.NOT. smeagol_control%aux%isexplicit_deltamin) smeagol_control%aux%deltamin = delta
     433             : 
     434             :             #:for name1, keyword1, val1 in emtoptions_negfmod_explicit_rlist
     435           0 :                smeagolglobal_${name1}$ = smeagol_control%aux%${name1}$
     436             :             #:endfor
     437             : 
     438             :             #:for name1, keyword1, val1 in emtoptions_negfmod_rydberg_plist
     439           0 :                smeagolglobal_${name1}$ = smeagol_control%to_smeagol_energy_units*smeagol_control%aux%${name1}$
     440             :             #:endfor
     441             : 
     442             :             ! At present read_options_ImpuritySolver() is a dummy libsmeagol.a subroutine,
     443             :             ! so we do not call it
     444             :             !IF (smeagol_control%ComputeImpurityGfMatsubara) THEN
     445             :             !   CALL read_options_ImpuritySolver(CallImpuritySolver,n1)
     446             :             !END IF
     447             :          END IF
     448             : 
     449             :          ! *** bound states (re-implemented ReadSpeciesBS() and ReadBSSubSystemBoundaries() subroutines)
     450             : 
     451             :          ! bound- state-related global allocatable arrays
     452           0 :          ALLOCATE (smeagolglobal_deltabss_bs(smeagol_control%aux%nbss))
     453           0 :          ALLOCATE (smeagolglobal_nebss_bs(smeagol_control%aux%nbss, 2))
     454           0 :          ALLOCATE (smeagolglobal_orbital_BS(n1))
     455             : 
     456             :          ! BS.SubSystemsDelta
     457           0 :          IF (ALLOCATED(smeagol_control%aux%deltabss_bs)) THEN
     458           0 :             smeagolglobal_deltabss_bs(:) = smeagol_control%aux%deltabss_bs(:)
     459             :          ELSE
     460           0 :             smeagolglobal_deltabss_bs(:) = smeagol_control%aux%deltamin
     461             :          END IF
     462             : 
     463             :          ! BS.SubSystemsBoundaries
     464           0 :          IF (ALLOCATED(smeagol_control%aux%nebss_bs)) THEN
     465           0 :             IF (MAXVAL(smeagol_control%aux%nebss_bs) > n1) THEN
     466           0 :                CALL integer_to_string(MAXVAL(smeagol_control%aux%nebss_bs), actual_val_str)
     467           0 :                CALL integer_to_string(n1, expected_val_str)
     468             :                CALL cp_abort(__LOCATION__, &
     469             :                              "The largest index in BS.SubSystemsBoundaries section ("//TRIM(actual_val_str)// &
     470           0 :                              ") exceeds the number of atomic orbitals ("//TRIM(expected_val_str)//").")
     471             :             END IF
     472           0 :             smeagolglobal_nebss_bs(:, :) = smeagol_control%aux%nebss_bs(:, :)
     473             :          ELSE
     474           0 :             smeagolglobal_nebss_bs(1, 1) = 1
     475           0 :             smeagolglobal_nebss_bs(1, 2) = n1/smeagol_control%aux%nbss
     476           0 :             DO i = 2, smeagol_control%aux%nbss
     477           0 :                smeagolglobal_nebss_bs(i, 1) = smeagolglobal_nebss_bs(i - 1, 2) + 1
     478           0 :                smeagolglobal_nebss_bs(i, 2) = i*n1/smeagol_control%aux%nbss
     479             :             END DO
     480           0 :             smeagolglobal_nebss_bs(smeagol_control%aux%nbss, 2) = n1
     481             :          END IF
     482             : 
     483             :          ! AM.AtomListBS
     484           0 :          IF (ALLOCATED(smeagol_control%aux%atomlist_bs)) THEN
     485           0 :             IF (MAXVAL(smeagol_control%aux%atomlist_bs) > nblkcols_total) THEN
     486           0 :                CALL integer_to_string(MAXVAL(smeagol_control%aux%atomlist_bs), actual_val_str)
     487           0 :                CALL integer_to_string(nblkcols_total, expected_val_str)
     488             :                CALL cp_abort(__LOCATION__, &
     489             :                              "The largest atomic index in AM.AtomListBS keyword ("//TRIM(actual_val_str)// &
     490           0 :                              ") exceeds the number of atoms ("//TRIM(expected_val_str)//") in the extended molecule.")
     491             :             END IF
     492             : 
     493           0 :             smeagolglobal_orbital_BS(:) = .FALSE.
     494           0 :             DO i = 1, SIZE(smeagol_control%aux%atomlist_bs)
     495           0 :                iatom = smeagol_control%aux%atomlist_bs(i)
     496           0 :                smeagolglobal_orbital_BS(col_blk_offset(iatom):col_blk_offset(iatom) + col_blk_size(iatom) - 1) = .TRUE.
     497             :             END DO
     498             :          ELSE
     499           0 :             smeagolglobal_orbital_BS(:) = .TRUE.
     500             :          END IF
     501             : #else
     502             :          CALL cp_abort(__LOCATION__, &
     503             :                        "CP2K was compiled with no SMEAGOL support.")
     504             :          MARK_USED(smeagol_control)
     505             :          MARK_USED(matrix_s)
     506             :          MARK_USED(para_env)
     507             :          MARK_USED(iter)
     508             :          MARK_USED(istep)
     509             :          MARK_USED(inicoor)
     510             :          MARK_USED(iv)
     511             :          MARK_USED(delta)
     512             :          MARK_USED(nk)
     513             :          ! local variables
     514             :          MARK_USED(actual_val_str)
     515             :          MARK_USED(col_blk_offset)
     516             :          MARK_USED(col_blk_size)
     517             :          MARK_USED(expected_val_str)
     518             :          MARK_USED(GetRhoSingleLeadDefault)
     519             :          MARK_USED(i)
     520             :          MARK_USED(iatom)
     521             :          MARK_USED(n1)
     522             :          MARK_USED(nblkcols_total)
     523             :          MARK_USED(NParallelK)
     524             :          MARK_USED(NParallelKbuf)
     525             : #endif
     526             : 
     527           0 :          CALL timestop(handle)
     528           0 :       END SUBROUTINE emtrans_options
     529             : 
     530           0 :       SUBROUTINE emtrans_deallocate_global_arrays()
     531             : 
     532             : #if defined(__SMEAGOL)
     533           0 :          IF (ALLOCATED(smeagolglobal_deltabss_bs)) DEALLOCATE (smeagolglobal_deltabss_bs)
     534           0 :          IF (ALLOCATED(smeagolglobal_nebss_bs)) DEALLOCATE (smeagolglobal_nebss_bs)
     535           0 :          IF (ALLOCATED(smeagolglobal_orbital_BS)) DEALLOCATE (smeagolglobal_orbital_BS)
     536             : #endif
     537             : 
     538           0 :       END SUBROUTINE emtrans_deallocate_global_arrays
     539             : 
     540             :    END MODULE smeagol_emtoptions
     541             : 

Generated by: LCOV version 1.15