LCOV - code coverage report
Current view: top level - src/motion - md_ener_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:2fce0f8) Lines: 52 53 98.1 %
Date: 2024-12-21 06:28:57 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             : !> \brief Split md_ener module from md_environment_type
      10             : !>  \author Teodoro Laino [tlaino] - 03.2008 - University of Zurich
      11             : ! **************************************************************************************************
      12             : MODULE md_ener_types
      13             : 
      14             :    USE kinds,                           ONLY: dp
      15             : #include "../base/base_uses.f90"
      16             : 
      17             :    IMPLICIT NONE
      18             : 
      19             :    PRIVATE
      20             : 
      21             : ! **************************************************************************************************
      22             :    TYPE md_ener_type
      23             :       INTEGER       :: nfree = 0, nfree_shell = 0
      24             :       REAL(KIND=dp) :: constant = 0.0_dp
      25             :       REAL(KIND=dp) :: delta_cons = 0.0_dp, delta_epot = 0.0_dp
      26             :       REAL(KIND=dp) :: epot = 0.0_dp
      27             :       REAL(KIND=dp) :: ekin = 0.0_dp, ekin_qm = 0.0_dp
      28             :       REAL(KIND=dp) :: temp_part = 0.0_dp, temp_qm = 0.0_dp
      29             :       REAL(KIND=dp) :: temp_baro = 0.0_dp
      30             :       REAL(KIND=dp) :: ekin_coefs = 0.0_dp
      31             :       REAL(KIND=dp) :: temp_coefs = 0.0_dp
      32             :       REAL(KIND=dp) :: ekin_shell = 0.0_dp, temp_shell = 0.0_dp
      33             :       REAL(KIND=dp) :: thermostat_part_kin = 0.0_dp, thermostat_part_pot = 0.0_dp
      34             :       REAL(KIND=dp) :: thermostat_fast_kin = 0.0_dp, thermostat_fast_pot = 0.0_dp
      35             :       REAL(KIND=dp) :: thermostat_slow_kin = 0.0_dp, thermostat_slow_pot = 0.0_dp
      36             :       REAL(KIND=dp) :: thermostat_baro_kin = 0.0_dp, thermostat_baro_pot = 0.0_dp
      37             :       REAL(KIND=dp) :: thermostat_coef_kin = 0.0_dp, thermostat_coef_pot = 0.0_dp
      38             :       REAL(KIND=dp) :: thermostat_shell_kin = 0.0_dp, thermostat_shell_pot = 0.0_dp
      39             :       REAL(KIND=dp) :: baro_kin = 0.0_dp, baro_pot = 0.0_dp
      40             :       REAL(KIND=dp) :: vcom(3) = 0.0_dp, total_mass = 0.0_dp
      41             :       REAL(KIND=dp), DIMENSION(:), POINTER :: ekin_kind => NULL()
      42             :       REAL(KIND=dp), DIMENSION(:), POINTER :: temp_kind => NULL()
      43             :       INTEGER, DIMENSION(:), POINTER       :: nfree_kind => NULL()
      44             :       REAL(KIND=dp), DIMENSION(:), POINTER :: ekin_shell_kind => NULL()
      45             :       REAL(KIND=dp), DIMENSION(:), POINTER :: temp_shell_kind => NULL()
      46             :       INTEGER, DIMENSION(:), POINTER       :: nfree_shell_kind => NULL()
      47             :    END TYPE md_ener_type
      48             : 
      49             : ! *** Public subroutines and data types ***
      50             :    PUBLIC :: create_md_ener, release_md_ener, md_ener_type, zero_md_ener
      51             : 
      52             : ! *** Global parameters ***
      53             : 
      54             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'md_ener_types'
      55             : 
      56             : CONTAINS
      57             : 
      58             : ! **************************************************************************************************
      59             : !> \brief retains the given md_ener structure
      60             : !> \param md_ener ...
      61             : !> \par History
      62             : !>      10.2007 created [MI]
      63             : !> \author MI
      64             : ! **************************************************************************************************
      65        7144 :    SUBROUTINE create_md_ener(md_ener)
      66             :       TYPE(md_ener_type), INTENT(OUT)                    :: md_ener
      67             : 
      68             :       MARK_USED(md_ener)
      69             : 
      70        1786 :    END SUBROUTINE create_md_ener
      71             : 
      72             : ! **************************************************************************************************
      73             : !> \brief releases the given md_ener structure
      74             : !> \param md_ener ...
      75             : !> \par History
      76             : !>      10.2007 created [MI]
      77             : !> \author MI
      78             : ! **************************************************************************************************
      79        1786 :    SUBROUTINE release_md_ener(md_ener)
      80             :       TYPE(md_ener_type), INTENT(INOUT)                  :: md_ener
      81             : 
      82        1786 :       IF (ASSOCIATED(md_ener%temp_kind)) THEN
      83          36 :          DEALLOCATE (md_ener%temp_kind)
      84             :       END IF
      85        1786 :       IF (ASSOCIATED(md_ener%ekin_kind)) THEN
      86          36 :          DEALLOCATE (md_ener%ekin_kind)
      87             :       END IF
      88        1786 :       IF (ASSOCIATED(md_ener%nfree_kind)) THEN
      89          36 :          DEALLOCATE (md_ener%nfree_kind)
      90             :       END IF
      91        1786 :       IF (ASSOCIATED(md_ener%temp_shell_kind)) THEN
      92          18 :          DEALLOCATE (md_ener%temp_shell_kind)
      93             :       END IF
      94        1786 :       IF (ASSOCIATED(md_ener%ekin_shell_kind)) THEN
      95          18 :          DEALLOCATE (md_ener%ekin_shell_kind)
      96             :       END IF
      97        1786 :       IF (ASSOCIATED(md_ener%nfree_shell_kind)) THEN
      98          18 :          DEALLOCATE (md_ener%nfree_shell_kind)
      99             :       END IF
     100             : 
     101        1786 :    END SUBROUTINE release_md_ener
     102             : 
     103             : ! **************************************************************************************************
     104             : !> \brief initialize to zero energies and temperatures
     105             : !> \param md_ener ...
     106             : !> \param tkind ...
     107             : !> \param tshell ...
     108             : !> \par History
     109             : !>      10.2007 created [MI]
     110             : !> \author MI
     111             : ! **************************************************************************************************
     112       45075 :    SUBROUTINE zero_md_ener(md_ener, tkind, tshell)
     113             :       TYPE(md_ener_type), INTENT(INOUT)                  :: md_ener
     114             :       LOGICAL, INTENT(IN)                                :: tkind, tshell
     115             : 
     116       45075 :       md_ener%ekin = 0.0_dp
     117       45075 :       md_ener%temp_part = 0.0_dp
     118       45075 :       md_ener%temp_baro = 0.0_dp
     119       45075 :       md_ener%ekin_coefs = 0.0_dp
     120       45075 :       md_ener%temp_coefs = 0.0_dp
     121       45075 :       md_ener%ekin_qm = 0.0_dp
     122       45075 :       md_ener%temp_qm = 0.0_dp
     123       45075 :       md_ener%ekin_shell = 0.0_dp
     124       45075 :       md_ener%temp_shell = 0.0_dp
     125       45075 :       md_ener%constant = 0.0_dp
     126       45075 :       md_ener%delta_cons = 0.0_dp
     127       45075 :       md_ener%delta_epot = 0.0_dp
     128       45075 :       md_ener%thermostat_part_kin = 0.0_dp
     129       45075 :       md_ener%thermostat_part_pot = 0.0_dp
     130       45075 :       md_ener%thermostat_fast_kin = 0.0_dp
     131       45075 :       md_ener%thermostat_fast_pot = 0.0_dp
     132       45075 :       md_ener%thermostat_slow_kin = 0.0_dp
     133       45075 :       md_ener%thermostat_slow_pot = 0.0_dp
     134       45075 :       md_ener%thermostat_coef_kin = 0.0_dp
     135       45075 :       md_ener%thermostat_coef_pot = 0.0_dp
     136       45075 :       md_ener%thermostat_baro_kin = 0.0_dp
     137       45075 :       md_ener%thermostat_baro_pot = 0.0_dp
     138       45075 :       md_ener%thermostat_shell_kin = 0.0_dp
     139       45075 :       md_ener%thermostat_shell_pot = 0.0_dp
     140       45075 :       md_ener%baro_kin = 0.0_dp
     141       45075 :       md_ener%baro_pot = 0.0_dp
     142       45075 :       IF (tkind) THEN
     143        2824 :          md_ener%temp_kind = 0.0_dp
     144        2824 :          md_ener%ekin_kind = 0.0_dp
     145             : 
     146         938 :          IF (tshell) THEN
     147        1188 :             md_ener%temp_shell_kind = 0.0_dp
     148        1188 :             md_ener%ekin_shell_kind = 0.0_dp
     149             :          END IF
     150             :       END IF
     151      180300 :       md_ener%vcom(:) = 0.0_dp
     152       45075 :       md_ener%total_mass = 0.0_dp
     153       45075 :    END SUBROUTINE zero_md_ener
     154             : 
     155           0 : END MODULE md_ener_types

Generated by: LCOV version 1.15