LCOV - code coverage report
Current view: top level - src - post_scf_bandstructure_methods.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:b1f098b) Lines: 27 27 100.0 %
Date: 2024-05-05 06:30:09 Functions: 3 3 100.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------------------------!
       2             : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3             : !   Copyright 2000-2024 CP2K developers group <https://cp2k.org>                                   !
       4             : !                                                                                                  !
       5             : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6             : !--------------------------------------------------------------------------------------------------!
       7             : 
       8             : MODULE post_scf_bandstructure_methods
       9             :    USE gw_methods,                      ONLY: gw
      10             :    USE input_section_types,             ONLY: section_vals_type
      11             :    USE post_scf_bandstructure_types,    ONLY: post_scf_bandstructure_type
      12             :    USE post_scf_bandstructure_utils,    ONLY: bandstructure_primitive_cell,&
      13             :                                               bandstructure_primitive_cell_spinor,&
      14             :                                               create_and_init_bs_env,&
      15             :                                               dos_pdos_ldos
      16             :    USE qs_environment_types,            ONLY: qs_environment_type
      17             :    USE qs_scf,                          ONLY: scf
      18             :    USE soc_pseudopotential_methods,     ONLY: H_KS_spinor,&
      19             :                                               V_SOC_xyz_from_pseudopotential
      20             : #include "./base/base_uses.f90"
      21             : 
      22             :    IMPLICIT NONE
      23             : 
      24             :    PRIVATE
      25             : 
      26             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'post_scf_bandstructure_methods'
      27             : 
      28             :    PUBLIC :: post_scf_bandstructure
      29             : 
      30             : CONTAINS
      31             : 
      32             : ! **************************************************************************************************
      33             : !> \brief Perform post-SCF band structure calculations from higher level methods
      34             : !> \param qs_env  Quickstep environment
      35             : !> \param post_scf_bandstructure_section ...
      36             : !> \par History
      37             : !>    * 07.2023 created [Jan Wilhelm]
      38             : ! **************************************************************************************************
      39          18 :    SUBROUTINE post_scf_bandstructure(qs_env, post_scf_bandstructure_section)
      40             :       TYPE(qs_environment_type), POINTER                 :: qs_env
      41             :       TYPE(section_vals_type), POINTER                   :: post_scf_bandstructure_section
      42             : 
      43             :       CHARACTER(LEN=*), PARAMETER :: routineN = 'post_scf_bandstructure'
      44             : 
      45             :       INTEGER                                            :: handle
      46             : 
      47          18 :       CALL timeset(routineN, handle)
      48             : 
      49             :       ! general setup of post SCF bandstructure calculation
      50          18 :       CALL create_and_init_bs_env(qs_env, qs_env%bs_env, post_scf_bandstructure_section)
      51             : 
      52             :       ! shifts of eigenvalues/bandstructure due to spin-orbit coupling from pseudopotentials
      53          18 :       IF (qs_env%bs_env%do_soc) THEN
      54          16 :          CALL soc(qs_env, qs_env%bs_env)
      55             :       END IF
      56             : 
      57             :       ! GW calculation for eigenvalues/bandstructure
      58          18 :       IF (qs_env%bs_env%do_gw) THEN
      59          18 :          CALL gw(qs_env, qs_env%bs_env, post_scf_bandstructure_section)
      60             :       END IF
      61             : 
      62             :       ! density of states (DOS) and projected DOS for DFT, DFT+SOC, G0W0, G0W0+SOC, also
      63             :       ! quantities from local DOS (LDOS) as local valence band maximum (VBM), local conduction
      64             :       ! band minimum (CBM), and local gap are calculated (local: as function of space r)
      65          18 :       CALL dos_pdos_ldos(qs_env, qs_env%bs_env)
      66             : 
      67             :       ! band structure of primitive unit cell for DFT, DFT+SOC, G0W0, G0W0+SOC
      68          18 :       IF (qs_env%bs_env%do_bs_primitive_cell) THEN
      69           6 :          CALL bandstructure_primitive_cell_all_methods(qs_env, qs_env%bs_env)
      70             :       END IF
      71             : 
      72          18 :       CALL timestop(handle)
      73             : 
      74          18 :    END SUBROUTINE post_scf_bandstructure
      75             : 
      76             : ! **************************************************************************************************
      77             : !> \brief ...
      78             : !> \param qs_env ...
      79             : !> \param bs_env ...
      80             : ! **************************************************************************************************
      81          16 :    SUBROUTINE soc(qs_env, bs_env)
      82             :       TYPE(qs_environment_type), POINTER                 :: qs_env
      83             :       TYPE(post_scf_bandstructure_type), POINTER         :: bs_env
      84             : 
      85             :       CHARACTER(LEN=*), PARAMETER                        :: routineN = 'soc'
      86             : 
      87             :       INTEGER                                            :: handle
      88             : 
      89          16 :       CALL timeset(routineN, handle)
      90             : 
      91             :       ! Compute V^SOC_µν^(α) = ħ/2 < ϕ_µ | sum_ℓ ΔV_ℓ^SO(r,r') L^(α) | ϕ_ν >, α = x, y, z, see
      92             :       ! Hartwigsen, Goedecker, Hutter, Eq.(18), (19) (doi.org/10.1103/PhysRevB.58.3641)
      93          16 :       CALL V_SOC_xyz_from_pseudopotential(qs_env, bs_env%mat_V_SOC_xyz)
      94             : 
      95             :       ! Spinor KS-matrix H_µν,σσ' = h^SCF_µν*δ_σσ' + sum_α V^SOC_µν^(α)*Pauli-matrix^(α)_σσ', see
      96             :       ! Hartwigsen, Goedecker, Hutter, Eq.(18) (doi.org/10.1103/PhysRevB.58.3641)
      97             :       CALL H_KS_spinor(bs_env%cfm_ks_spinor_ao_Gamma, bs_env%fm_ks_Gamma(1:2), bs_env%n_spin, &
      98             :                        bs_env%mat_V_SOC_xyz(:, 1), bs_env%cfm_s_spinor_Gamma, bs_env%fm_s_Gamma, &
      99          16 :                        bs_env%cfm_SOC_spinor_ao_Gamma)
     100             : 
     101          16 :       CALL timestop(handle)
     102             : 
     103          16 :    END SUBROUTINE soc
     104             : 
     105             : ! **************************************************************************************************
     106             : !> \brief ...
     107             : !> \param qs_env ...
     108             : !> \param bs_env ...
     109             : ! **************************************************************************************************
     110           6 :    SUBROUTINE bandstructure_primitive_cell_all_methods(qs_env, bs_env)
     111             : 
     112             :       TYPE(qs_environment_type), POINTER                 :: qs_env
     113             :       TYPE(post_scf_bandstructure_type), POINTER         :: bs_env
     114             : 
     115             :       CHARACTER(LEN=*), PARAMETER :: routineN = 'bandstructure_primitive_cell_all_methods'
     116             : 
     117             :       INTEGER                                            :: handle
     118             : 
     119           6 :       CALL timeset(routineN, handle)
     120             : 
     121             :       CALL bandstructure_primitive_cell(qs_env, bs_env, &
     122             :                                         bs_env%eigenval_prim_cell_scf, &
     123             :                                         "bandstructure_SCF.bs", &
     124           6 :                                         bs_env%fm_ks_Gamma(1))
     125           6 :       IF (bs_env%do_gw) THEN
     126             :          CALL bandstructure_primitive_cell(qs_env, bs_env, &
     127             :                                            bs_env%eigenval_prim_cell_G0W0, &
     128             :                                            "bandstructure_G0W0.bs", &
     129           6 :                                            bs_env%fm_h_G0W0_Gamma)
     130             :       END IF
     131             : 
     132           6 :       IF (bs_env%do_soc) THEN
     133             :          CALL bandstructure_primitive_cell_spinor(qs_env, bs_env, &
     134             :                                                   bs_env%eigenval_prim_cell_scf_soc, &
     135             :                                                   "bandstructure_SCF_SOC.bs", &
     136           6 :                                                   bs_env%cfm_ks_spinor_ao_Gamma)
     137             :       END IF
     138             : 
     139           6 :       CALL timestop(handle)
     140             : 
     141           6 :    END SUBROUTINE bandstructure_primitive_cell_all_methods
     142             : 
     143             : END MODULE post_scf_bandstructure_methods

Generated by: LCOV version 1.15