LCOV - code coverage report
Current view: top level - src - qs_kernel_types.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:24d69ee) Lines: 85.0 % 20 17
Test Date: 2026-09-03 07:32:15 Functions: 33.3 % 3 1

            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              : MODULE qs_kernel_types
       9              :    USE admm_types,                      ONLY: admm_env_release,&
      10              :                                               admm_type
      11              :    USE cp_control_types,                ONLY: admm_control_release,&
      12              :                                               admm_control_type
      13              :    USE hfx_types,                       ONLY: hfx_release,&
      14              :                                               hfx_type
      15              :    USE input_section_types,             ONLY: section_vals_type
      16              :    USE kinds,                           ONLY: dp
      17              :    USE lri_environment_types,           ONLY: lri_density_type,&
      18              :                                               lri_environment_type
      19              :    USE qs_rho_types,                    ONLY: qs_rho_release,&
      20              :                                               qs_rho_type
      21              :    USE qs_tddfpt2_stda_types,           ONLY: stda_env_type
      22              :    USE xc_derivative_set_types,         ONLY: xc_derivative_set_type,&
      23              :                                               xc_dset_release
      24              :    USE xc_rho_set_types,                ONLY: xc_rho_set_release,&
      25              :                                               xc_rho_set_type
      26              : #include "./base/base_uses.f90"
      27              : 
      28              :    IMPLICIT NONE
      29              : 
      30              :    PRIVATE
      31              : 
      32              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_kernel_types'
      33              : 
      34              :    LOGICAL, PARAMETER, PRIVATE          :: debug_this_module = .FALSE.
      35              :    ! number of first derivative components (3: d/dx, d/dy, d/dz)
      36              :    INTEGER, PARAMETER, PRIVATE          :: nderivs = 3
      37              :    INTEGER, PARAMETER, PRIVATE          :: maxspins = 2
      38              : 
      39              :    PUBLIC :: full_kernel_env_type, kernel_env_type
      40              :    PUBLIC :: release_kernel_env
      41              : 
      42              : ! **************************************************************************************************
      43              : !> \brief Collection of variables required to evaluate adiabatic TDDFPT kernel.
      44              : !> \par History
      45              : !>   * 12.2016 created [Sergey Chulkov]
      46              : ! **************************************************************************************************
      47              :    TYPE full_kernel_env_type
      48              :       ! ground state electron density
      49              :       TYPE(xc_rho_set_type), POINTER                     :: xc_rho_set => Null()
      50              :       TYPE(qs_rho_type), POINTER                         :: rho0_struct => Null()
      51              :       ! response density
      52              :       TYPE(xc_rho_set_type), POINTER                     :: xc_rho1_set => Null()
      53              :       !> first and second derivatives of exchange-correlation functional
      54              :       TYPE(xc_derivative_set_type)                       :: xc_deriv_set = xc_derivative_set_type()
      55              :       !> XC input section
      56              :       LOGICAL                                            :: do_exck = .FALSE.
      57              :       TYPE(section_vals_type), POINTER                   :: xc_section => Null()
      58              :       !> scaling coefficients in the linear combination:
      59              :       !> K = alpha * K_{\alpha,\alpha} + beta * K_{\alpha,\beta}
      60              :       REAL(kind=dp)                                      :: alpha = -1.0_dp, beta = -1.0_dp
      61              :       !> flags for finite differences/analytic XC kernels
      62              :       LOGICAL                                            :: deriv2_analytic = .FALSE.
      63              :       LOGICAL                                            :: deriv3_analytic = .FALSE.
      64              :       ! Local resolution of the identity for Coulomb
      65              :       TYPE(lri_environment_type), POINTER                :: lri_env => Null()
      66              :       TYPE(lri_density_type), POINTER                    :: lri_density => Null()
      67              :       ! Short range HFX integral environment
      68              :       TYPE(hfx_type), DIMENSION(:, :), POINTER           :: x_data => Null()
      69              :       TYPE(section_vals_type), POINTER                   :: hfxsr_section => Null()
      70              :       TYPE(admm_type), POINTER                           :: admm_env => Null()
      71              :       TYPE(admm_control_type), POINTER                   :: admm_control => NULL()
      72              :    END TYPE full_kernel_env_type
      73              : ! **************************************************************************************************
      74              : !> \brief Type to hold environments for the different kernels
      75              : !> \par History
      76              : !>   * 04.2019 created [JHU]
      77              : ! **************************************************************************************************
      78              :    TYPE kernel_env_type
      79              :       TYPE(full_kernel_env_type), POINTER                :: full_kernel => Null()
      80              :       TYPE(full_kernel_env_type), POINTER                :: admm_kernel => Null()
      81              :       TYPE(stda_env_type), POINTER                       :: stda_kernel => Null()
      82              :    END TYPE kernel_env_type
      83              : 
      84              : CONTAINS
      85              : 
      86              : ! **************************************************************************************************
      87              : !> \brief Release kernel environment.
      88              : !> \param kernel_env  kernel environment (destroyed on exit)
      89              : !> \par History
      90              : !>    * 02.2017 created [Sergey Chulkov]
      91              : ! **************************************************************************************************
      92         1036 :    SUBROUTINE release_kernel_env(kernel_env)
      93              :       TYPE(full_kernel_env_type), POINTER                :: kernel_env
      94              : 
      95         1036 :       IF (ASSOCIATED(kernel_env)) THEN
      96         1036 :          IF (ASSOCIATED(kernel_env%xc_rho1_set)) THEN
      97            0 :             CALL xc_rho_set_release(kernel_env%xc_rho1_set)
      98            0 :             DEALLOCATE (kernel_env%xc_rho1_set)
      99              :          END IF
     100         1036 :          IF (ASSOCIATED(kernel_env%rho0_struct)) THEN
     101         1036 :             CALL qs_rho_release(kernel_env%rho0_struct)
     102         1036 :             DEALLOCATE (kernel_env%rho0_struct)
     103              :          END IF
     104         1036 :          CALL xc_dset_release(kernel_env%xc_deriv_set)
     105         1036 :          IF (ASSOCIATED(kernel_env%xc_rho_set)) THEN
     106         1036 :             CALL xc_rho_set_release(kernel_env%xc_rho_set)
     107         1036 :             DEALLOCATE (kernel_env%xc_rho_set)
     108              :          END IF
     109         1036 :          IF (ASSOCIATED(kernel_env%x_data)) THEN
     110            4 :             CALL hfx_release(kernel_env%x_data)
     111              :          END IF
     112         1036 :          IF (ASSOCIATED(kernel_env%admm_env)) THEN
     113            4 :             CALL admm_env_release(kernel_env%admm_env)
     114              :          END IF
     115         1036 :          IF (ASSOCIATED(kernel_env%admm_control)) THEN
     116            4 :             CALL admm_control_release(kernel_env%admm_control)
     117              :          END IF
     118              :       END IF
     119              : 
     120         1036 :    END SUBROUTINE release_kernel_env
     121              : 
     122            0 : END MODULE qs_kernel_types
        

Generated by: LCOV version 2.0-1