LCOV - code coverage report
Current view: top level - src - qs_ks_qmmm_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:4dc10b3) Lines: 11 12 91.7 %
Date: 2024-11-21 06:45:46 Functions: 1 2 50.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             : ! **************************************************************************************************
       9             : !> \par History
      10             : !>      05.2004 [tlaino]
      11             : !> \author Teodoro Laino
      12             : ! **************************************************************************************************
      13             : MODULE qs_ks_qmmm_types
      14             :    USE cp_dbcsr_api,                    ONLY: dbcsr_p_type
      15             :    USE cp_dbcsr_operations,             ONLY: dbcsr_deallocate_matrix_set
      16             :    USE cube_utils,                      ONLY: cube_info_type,&
      17             :                                               destroy_cube_info
      18             :    USE kinds,                           ONLY: dp
      19             :    USE pw_env_types,                    ONLY: pw_env_get,&
      20             :                                               pw_env_release,&
      21             :                                               pw_env_type
      22             :    USE pw_pool_types,                   ONLY: pw_pool_type
      23             :    USE pw_types,                        ONLY: pw_r3d_rs_type
      24             : #include "./base/base_uses.f90"
      25             : 
      26             :    IMPLICIT NONE
      27             :    PRIVATE
      28             : 
      29             :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      30             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_ks_qmmm_types'
      31             : 
      32             :    PUBLIC :: qs_ks_qmmm_env_type
      33             :    PUBLIC :: qs_ks_qmmm_release
      34             : 
      35             : ! **************************************************************************************************
      36             : !> \brief calculation environment to calculate the ks_qmmm matrix,
      37             : !>      holds the QM/MM potential and all the needed variables to
      38             : !>      compute the QM/MM electrostatic 1-electron ks matrix
      39             : !>      assumes that the core hamiltonian and energy are up to date.
      40             : !>      v_metal_rspace is the potential at the metal sites within the image
      41             : !>      charge approach
      42             : !> \par History
      43             : !>      05.2004 created [tlaino]
      44             : !>      01.2012 added v_metal_rspace [dgolze]
      45             : !> \author Teodoro Laino
      46             : ! **************************************************************************************************
      47             :    TYPE qs_ks_qmmm_env_type
      48             :       INTEGER :: n_evals = -1
      49             :       REAL(KIND=dp)                               :: pc_ener = -1.0_dp
      50             :       TYPE(pw_env_type), POINTER                  :: pw_env => NULL()
      51             :       TYPE(pw_r3d_rs_type)                             :: v_qmmm_rspace = pw_r3d_rs_type()
      52             :       TYPE(pw_r3d_rs_type), POINTER                             :: v_metal_rspace => NULL()
      53             :       TYPE(cube_info_type), DIMENSION(:), POINTER  :: cube_info => NULL()
      54             :       TYPE(dbcsr_p_type), DIMENSION(:), &
      55             :          POINTER                                :: matrix_h => NULL()
      56             :    END TYPE qs_ks_qmmm_env_type
      57             : 
      58             : CONTAINS
      59             : 
      60             : ! **************************************************************************************************
      61             : !> \brief releases the ks_qmmm_env (see doc/ReferenceCounting.html)
      62             : !> \param ks_qmmm_env the ks_qmmm_env to be released
      63             : !> \par History
      64             : !>      05.2004 created [tlaino]
      65             : !> \author Teodoro Laino
      66             : ! **************************************************************************************************
      67         378 :    SUBROUTINE qs_ks_qmmm_release(ks_qmmm_env)
      68             :       TYPE(qs_ks_qmmm_env_type), INTENT(INOUT)           :: ks_qmmm_env
      69             : 
      70             :       INTEGER                                            :: i
      71             :       TYPE(pw_pool_type), POINTER                        :: pool
      72             : 
      73         378 :       CALL pw_env_get(ks_qmmm_env%pw_env, auxbas_pw_pool=pool)
      74         378 :       CALL pool%give_back_pw(ks_qmmm_env%v_qmmm_rspace)
      75         378 :       CALL pw_env_release(ks_qmmm_env%pw_env)
      76         378 :       IF (ASSOCIATED(ks_qmmm_env%cube_info)) THEN
      77        1196 :          DO i = 1, SIZE(ks_qmmm_env%cube_info)
      78        1196 :             CALL destroy_cube_info(ks_qmmm_env%cube_info(i))
      79             :          END DO
      80         236 :          DEALLOCATE (ks_qmmm_env%cube_info)
      81             :       END IF
      82         378 :       IF (ASSOCIATED(ks_qmmm_env%matrix_h)) THEN
      83         126 :          CALL dbcsr_deallocate_matrix_set(ks_qmmm_env%matrix_h)
      84             :       END IF
      85             : 
      86         378 :    END SUBROUTINE qs_ks_qmmm_release
      87             : 
      88           0 : END MODULE qs_ks_qmmm_types

Generated by: LCOV version 1.15