LCOV - code coverage report
Current view: top level - src - fist_energy_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:b8e0b09) Lines: 21 24 87.5 %
Date: 2024-08-31 06:31:37 Functions: 3 4 75.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             : !>      JGH (11.08.2002) exchange and correlation energy now in exc
      11             : !> \author MK (13.06.2002)
      12             : ! **************************************************************************************************
      13             : MODULE fist_energy_types
      14             : 
      15             :    USE kinds,                           ONLY: dp
      16             : #include "./base/base_uses.f90"
      17             : 
      18             :    IMPLICIT NONE
      19             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'fist_energy_types'
      20             : 
      21             :    PRIVATE
      22             : 
      23             : ! **************************************************************************************************
      24             :    TYPE fist_energy_type
      25             :       REAL(kind=dp) :: kin = 0.0_dp, pot = 0.0_dp, e_gspace = 0.0_dp, e_self = 0.0_dp, &
      26             :                        e_neut = 0.0_dp, e_bonded = 0.0_dp, e_induction = 0.0_dp
      27             :       REAL(kind=dp) :: kin_shell = 0.0_dp, harm_shell = 0.0_dp
      28             :    END TYPE fist_energy_type
      29             : 
      30             : ! *** Public data types ***
      31             : 
      32             :    PUBLIC :: fist_energy_type
      33             : 
      34             : ! *** Public subroutines ***
      35             : 
      36             :    PUBLIC :: allocate_fist_energy, &
      37             :              deallocate_fist_energy
      38             : 
      39             : CONTAINS
      40             : 
      41             : ! **************************************************************************************************
      42             : !> \brief   Allocate and/or initialise a Fist energy data structure.
      43             : !> \param fist_energy ...
      44             : !> \date    13.06.2002
      45             : !> \author  MK
      46             : !> \version 1.0
      47             : ! **************************************************************************************************
      48        2639 :    SUBROUTINE allocate_fist_energy(fist_energy)
      49             :       TYPE(fist_energy_type), POINTER                    :: fist_energy
      50             : 
      51        2639 :       IF (.NOT. ASSOCIATED(fist_energy)) THEN
      52        2639 :          ALLOCATE (fist_energy)
      53             :       END IF
      54             : 
      55        2639 :       CALL init_fist_energy(fist_energy)
      56             : 
      57        2639 :    END SUBROUTINE allocate_fist_energy
      58             : 
      59             : ! **************************************************************************************************
      60             : !> \brief   Deallocate a Fist energy data structure.
      61             : !> \param fist_energy ...
      62             : !> \date    13.06.2002
      63             : !> \author  MK
      64             : !> \version 1.0
      65             : ! **************************************************************************************************
      66        2639 :    SUBROUTINE deallocate_fist_energy(fist_energy)
      67             :       TYPE(fist_energy_type), POINTER                    :: fist_energy
      68             : 
      69        2639 :       IF (ASSOCIATED(fist_energy)) THEN
      70        2639 :          DEALLOCATE (fist_energy)
      71             :       ELSE
      72             :          CALL cp_abort(__LOCATION__, &
      73             :                        "The fist_energy pointer is not associated "// &
      74           0 :                        "and cannot be deallocated.")
      75             :       END IF
      76             : 
      77        2639 :    END SUBROUTINE deallocate_fist_energy
      78             : 
      79             : ! **************************************************************************************************
      80             : !> \brief   Initialise a Fist energy data structure.
      81             : !> \param fist_energy ...
      82             : !> \date    13.06.2002
      83             : !> \author  MK
      84             : !> \version 1.0
      85             : ! **************************************************************************************************
      86        2639 :    SUBROUTINE init_fist_energy(fist_energy)
      87             :       TYPE(fist_energy_type), POINTER                    :: fist_energy
      88             : 
      89        2639 :       IF (ASSOCIATED(fist_energy)) THEN
      90        2639 :          fist_energy%kin = 0.0_dp
      91        2639 :          fist_energy%pot = 0.0_dp
      92        2639 :          fist_energy%e_gspace = 0.0_dp
      93        2639 :          fist_energy%e_self = 0.0_dp
      94        2639 :          fist_energy%e_neut = 0.0_dp
      95        2639 :          fist_energy%e_bonded = 0.0_dp
      96        2639 :          fist_energy%e_induction = 0.0_dp
      97        2639 :          fist_energy%kin_shell = 0.0_dp
      98        2639 :          fist_energy%harm_shell = 0.0_dp
      99             :       ELSE
     100             :          CALL cp_abort(__LOCATION__, &
     101             :                        "The fist_energy pointer is not associated "// &
     102           0 :                        "and cannot be initialised.")
     103             :       END IF
     104             : 
     105        2639 :    END SUBROUTINE init_fist_energy
     106             : 
     107           0 : END MODULE fist_energy_types

Generated by: LCOV version 1.15