LCOV - code coverage report
Current view: top level - src/motion - thermal_region_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:dc34ec9) Lines: 13 14 92.9 %
Date: 2023-03-24 20:09:49 Functions: 2 4 50.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------------------------!
       2             : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3             : !   Copyright 2000-2023 CP2K developers group <https://cp2k.org>                                   !
       4             : !                                                                                                  !
       5             : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6             : !--------------------------------------------------------------------------------------------------!
       7             : 
       8             : ! **************************************************************************************************
       9             : !> \brief Thermal regions type: to initialize and control the temperature of
      10             : !>        different regions
      11             : !> \par History
      12             : !>   - Added support for langevin regions (2014/01/08, LT)
      13             : !> \author MI
      14             : ! **************************************************************************************************
      15             : MODULE thermal_region_types
      16             : 
      17             :    USE input_section_types,             ONLY: section_vals_type
      18             :    USE kinds,                           ONLY: dp
      19             : #include "../base/base_uses.f90"
      20             : 
      21             :    IMPLICIT NONE
      22             : 
      23             :    PRIVATE
      24             :    PUBLIC :: thermal_regions_type, &
      25             :              thermal_region_type, &
      26             :              allocate_thermal_regions, &
      27             :              release_thermal_regions
      28             : 
      29             :    TYPE thermal_regions_type
      30             :       INTEGER :: nregions
      31             :       LOGICAL :: force_rescaling
      32             :       REAL(KIND=dp) :: temp_reg0
      33             :       LOGICAL, DIMENSION(:), POINTER                   :: do_langevin
      34             :       TYPE(section_vals_type), POINTER                 :: section
      35             :       TYPE(thermal_region_type), DIMENSION(:), POINTER :: thermal_region
      36             :    END TYPE thermal_regions_type
      37             : 
      38             :    TYPE thermal_region_type
      39             :       INTEGER :: region_index, npart
      40             :       INTEGER, DIMENSION(:), POINTER :: part_index
      41             :       REAL(KIND=dp) :: ekin, noisy_gamma_region, temperature, temp_expected, temp_tol
      42             :    END TYPE thermal_region_type
      43             : 
      44             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'thermal_region_types'
      45             : CONTAINS
      46             : 
      47             : ! **************************************************************************************************
      48             : !> \brief allocate thermal_regions
      49             : !> \param thermal_regions ...
      50             : !> \author
      51             : ! **************************************************************************************************
      52        1729 :    SUBROUTINE allocate_thermal_regions(thermal_regions)
      53             :       TYPE(thermal_regions_type), INTENT(OUT)            :: thermal_regions
      54             : 
      55        1729 :       thermal_regions%nregions = 0
      56        1729 :       NULLIFY (thermal_regions%thermal_region)
      57        1729 :       NULLIFY (thermal_regions%do_langevin)
      58             : 
      59        1729 :    END SUBROUTINE allocate_thermal_regions
      60             : 
      61             : ! **************************************************************************************************
      62             : !> \brief release thermal_regions
      63             : !> \param thermal_regions ...
      64             : !> \author
      65             : ! **************************************************************************************************
      66        1729 :    SUBROUTINE release_thermal_regions(thermal_regions)
      67             : 
      68             :       TYPE(thermal_regions_type), INTENT(INOUT)          :: thermal_regions
      69             : 
      70             :       INTEGER                                            :: ireg
      71             : 
      72        1729 :       IF (ASSOCIATED(thermal_regions%thermal_region)) THEN
      73          34 :          DO ireg = 1, SIZE(thermal_regions%thermal_region)
      74          34 :             DEALLOCATE (thermal_regions%thermal_region(ireg)%part_index)
      75             :          END DO
      76          14 :          DEALLOCATE (thermal_regions%thermal_region)
      77             :       END IF
      78        1729 :       IF (ASSOCIATED(thermal_regions%do_langevin)) THEN
      79          12 :          DEALLOCATE (thermal_regions%do_langevin)
      80             :       END IF
      81             : 
      82        1729 :    END SUBROUTINE release_thermal_regions
      83             : 
      84           0 : END MODULE thermal_region_types

Generated by: LCOV version 1.15