LCOV - code coverage report
Current view: top level - src - mixed_energy_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:2fce0f8) Lines: 13 15 86.7 %
Date: 2024-12-21 06:28:57 Functions: 3 5 60.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             : !> \author fschiff
      10             : !> \date   11.06
      11             : ! **************************************************************************************************
      12             : MODULE mixed_energy_types
      13             : 
      14             :    USE kinds,                           ONLY: dp
      15             : #include "./base/base_uses.f90"
      16             : 
      17             :    IMPLICIT NONE
      18             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'mixed_energy_types'
      19             :    PRIVATE
      20             : 
      21             : ! **************************************************************************************************
      22             :    TYPE mixed_energy_type
      23             :       REAL(kind=dp) :: pot = 0.0_dp
      24             :       REAL(kind=dp) :: kin = 0.0_dp
      25             :    END TYPE mixed_energy_type
      26             : 
      27             : ! **************************************************************************************************
      28             :    TYPE mixed_force_type
      29             :       REAL(KIND=dp), DIMENSION(:, :), POINTER         :: forces => NULL()
      30             :    END TYPE mixed_force_type
      31             : 
      32             : ! Public data types
      33             :    PUBLIC :: mixed_energy_type, &
      34             :              mixed_force_type
      35             : 
      36             : ! Public subroutines
      37             :    PUBLIC :: allocate_mixed_energy, &
      38             :              deallocate_mixed_energy
      39             : 
      40             : CONTAINS
      41             : 
      42             : ! **************************************************************************************************
      43             : !> \brief   Allocate and/or initialise a mixed energy data structure.
      44             : !> \param mixed_energy ...
      45             : !> \date    11.06
      46             : !> \author  fschiff
      47             : !> \version 1.0
      48             : ! **************************************************************************************************
      49         130 :    SUBROUTINE allocate_mixed_energy(mixed_energy)
      50             :       TYPE(mixed_energy_type), POINTER                   :: mixed_energy
      51             : 
      52         130 :       IF (.NOT. ASSOCIATED(mixed_energy)) THEN
      53         130 :          ALLOCATE (mixed_energy)
      54             :       END IF
      55         130 :       CALL init_mixed_energy(mixed_energy)
      56         130 :    END SUBROUTINE allocate_mixed_energy
      57             : 
      58             : ! **************************************************************************************************
      59             : !> \brief   Deallocate a mixed energy data structure.
      60             : !> \param mixed_energy ...
      61             : !> \date    11.06
      62             : !> \author  fschiff
      63             : !> \version 1.0
      64             : ! **************************************************************************************************
      65         130 :    SUBROUTINE deallocate_mixed_energy(mixed_energy)
      66             :       TYPE(mixed_energy_type), POINTER                   :: mixed_energy
      67             : 
      68         130 :       IF (ASSOCIATED(mixed_energy)) THEN
      69         130 :          DEALLOCATE (mixed_energy)
      70             :       END IF
      71         130 :    END SUBROUTINE deallocate_mixed_energy
      72             : 
      73             : ! **************************************************************************************************
      74             : !> \brief ...
      75             : !> \param mixed_energy ...
      76             : ! **************************************************************************************************
      77         130 :    SUBROUTINE init_mixed_energy(mixed_energy)
      78             :       TYPE(mixed_energy_type), POINTER                   :: mixed_energy
      79             : 
      80         130 :       IF (ASSOCIATED(mixed_energy)) THEN
      81         130 :          mixed_energy%pot = 0.0_dp
      82             :       ELSE
      83             :          CALL cp_abort(__LOCATION__, &
      84             :                        "The mixed_energy pointer is not associated "// &
      85           0 :                        "and cannot be initialised")
      86             :       END IF
      87         130 :    END SUBROUTINE init_mixed_energy
      88             : 
      89           0 : END MODULE mixed_energy_types

Generated by: LCOV version 1.15