LCOV - code coverage report
Current view: top level - src - gw_ri_rs_large_cell_gamma.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:123285f) Lines: 0.0 % 13 0
Test Date: 2026-11-04 00:58:17 Functions: 0.0 % 1 0

            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 GW using the RI-RS approximation for large periodic cells at Gamma
      10              : !> \par History
      11              : !>      04.2026 created [Ritaj Tyagi]
      12              : ! **************************************************************************************************
      13              : MODULE gw_ri_rs_large_cell_Gamma
      14              :    USE cp_fm_types,                     ONLY: cp_fm_type
      15              :    USE gw_compute_V_and_W,              ONLY: get_W_MIC
      16              :    USE gw_ri_rs_chi_sigma_kernels,      ONLY: compute_Sigma_c,&
      17              :                                               compute_Sigma_x,&
      18              :                                               get_mat_chi_Gamma_tau
      19              :    USE gw_tensor_large_cell_Gamma,      ONLY: compute_QP_energies
      20              :    USE gw_utils,                        ONLY: de_init_bs_env
      21              :    USE kinds,                           ONLY: dp
      22              :    USE post_scf_bandstructure_types,    ONLY: post_scf_bandstructure_type
      23              :    USE qs_environment_types,            ONLY: qs_environment_type
      24              :    USE ri_rs_setup,                     ONLY: ensure_ri_rs_representation
      25              : #include "./base/base_uses.f90"
      26              : 
      27              :    IMPLICIT NONE
      28              : 
      29              :    PRIVATE
      30              : 
      31              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'gw_ri_rs_large_cell_Gamma'
      32              : 
      33              :    PUBLIC :: gw_calc_ri_rs_large_cell_Gamma
      34              : 
      35              : CONTAINS
      36              : 
      37              : ! **************************************************************************************************
      38              : !> \brief GW calculation using RI-RS formalism for large periodic cells at Gamma
      39              : !> \param qs_env ...
      40              : !> \param bs_env Band-structure environment containing GW parameters.
      41              : ! **************************************************************************************************
      42              : 
      43            0 :    SUBROUTINE gw_calc_ri_rs_large_cell_Gamma(qs_env, bs_env)
      44              : 
      45              :       TYPE(qs_environment_type), POINTER                 :: qs_env
      46              :       TYPE(post_scf_bandstructure_type), POINTER         :: bs_env
      47              : 
      48              :       CHARACTER(LEN=*), PARAMETER :: routineN = 'gw_calc_ri_rs_large_cell_Gamma'
      49              : 
      50              :       INTEGER                                            :: handle
      51            0 :       TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:)        :: fm_Sigma_x_Gamma, fm_W_time
      52            0 :       TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :, :)  :: fm_Sigma_c_Gamma_time
      53              : 
      54            0 :       CALL timeset(routineN, handle)
      55              : 
      56              :       ! Build the common grid, phi and Z representation with the system's boundary conditions.
      57            0 :       CALL ensure_ri_rs_representation(qs_env, bs_env)
      58              : 
      59              :        !!========================================================================
      60              :        !! 4. Compute Independent-Particle Polarizability (χ)
      61              :        !!    G^occ_µλ(i|τ|)  = sum_n^occ C_µn e^(-|(ϵ_n-ϵ_F)τ|) C_λn
      62              :        !!    G^vir_µλ(i|τ|)  = sum_n^vir C_µn e^(-|(ϵ_n-ϵ_F)τ|) C_λn
      63              :        !!    G^occ_ll'(i|τ|) = sum_µν ϕ_µ(r_l) G^occ_µν ϕ_ν(r_l')
      64              :        !!    G^vir_ll'(i|τ|) = sum_µν ϕ_µ(r_l) G^vir_µν ϕ_ν(r_l')
      65              :        !!    χ_ll'(iτ)       = G^occ_ll'(i|τ|) * G^vir_ll'(i|τ|)
      66              :        !!    χ_PQ(iτ)        = sum_ll' Z_lP χ_ll'(iτ) Z_l'Q
      67              :        !!========================================================================
      68            0 :       CALL get_mat_chi_Gamma_tau(bs_env, bs_env%mat_chi_Gamma_tau, cutoff=0.0_dp)
      69              : 
      70              :        !!========================================================================
      71              :        !! 5. Compute Screened Interaction (W^MIC)
      72              :        !!    χ_PQ(iτ) -> χ_PQ(iω) -> ε_PQ(iω) -> W_PQ(iω) -> W^MIC_PQ(iτ)
      73              :        !!========================================================================
      74            0 :       CALL get_W_MIC(bs_env, qs_env, bs_env%mat_chi_Gamma_tau, fm_W_time)
      75              : 
      76              :        !!========================================================================
      77              :        !! 6. Compute Exact Exchange Self-Energy (Σ^x)
      78              :        !!    D_µν          = sum_n^occ C_µn C_νn
      79              :        !!    D_ll'         = sum_µν ϕ_µ(r_l) D_µν ϕ_ν(r_l')
      80              :        !!    V^trunc_ll'   = sum_PQ Z_lP V^trunc_PQ Z_l'Q
      81              :        !!    Σ^x_ll'       = D_ll' * V^trunc_ll'
      82              :        !!    Σ^x_λσ(k=0)   = -sum_ll' ϕ_λ(r_l) Σ^x_ll' ϕ_σ(r_l')
      83              :        !!========================================================================
      84            0 :       CALL compute_Sigma_x(bs_env, qs_env, fm_Sigma_x_Gamma, cutoff=0.0_dp)
      85              : 
      86              :        !!========================================================================
      87              :        !! 7. Compute Correlation Self-Energy (Σ^c)
      88              :        !!    W^MIC_ll'(iτ) =  sum_PQ Z_lP W^MIC_PQ(iτ) Z_l'Q
      89              :        !!    Σ^c_ll'(iτ)   = -G^occ_ll'(i|τ|) * W^MIC_ll'(iτ), for τ < 0
      90              :        !!    Σ^c_ll'(iτ)   =  G^vir_ll'(i|τ|) * W^MIC_ll'(iτ), for τ > 0
      91              :        !!    Σ^c_λσ(iτ)    =  sum_ll' ϕ_λ(r_l) Σ^c_ll'(iτ) ϕ_σ(r_l')
      92              :        !!========================================================================
      93            0 :       CALL compute_Sigma_c(bs_env, fm_W_time, fm_Sigma_c_Gamma_time, cutoff=0.0_dp)
      94              : 
      95              :        !!========================================================================
      96              :        !! 8. Compute Quasiparticle Energies
      97              :        !!    Σ^c_λσ(iτ) -> Σ^c_nn(ϵ)
      98              :        !!    ϵ_nk^GW = ϵ_nk^DFT + Σ^c_nn(ϵ) + Σ^x_nn - v^xc_nn
      99              :        !!========================================================================
     100            0 :       CALL compute_QP_energies(bs_env, qs_env, fm_Sigma_x_Gamma, fm_Sigma_c_Gamma_time)
     101              : 
     102            0 :       CALL de_init_bs_env(qs_env, bs_env)
     103              : 
     104            0 :       CALL timestop(handle)
     105              : 
     106            0 :    END SUBROUTINE gw_calc_ri_rs_large_cell_Gamma
     107              : 
     108              : END MODULE gw_ri_rs_large_cell_Gamma
        

Generated by: LCOV version 2.0-1