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 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 = 0 31 : LOGICAL :: force_rescaling = .FALSE. 32 : REAL(KIND=dp) :: temp_reg0 = 0.0_dp 33 : LOGICAL, DIMENSION(:), POINTER :: do_langevin => NULL() 34 : TYPE(section_vals_type), POINTER :: section => NULL() 35 : TYPE(thermal_region_type), DIMENSION(:), POINTER :: thermal_region => NULL() 36 : END TYPE thermal_regions_type 37 : 38 : TYPE thermal_region_type 39 : INTEGER :: region_index = 0, npart = 0 40 : INTEGER, DIMENSION(:), POINTER :: part_index => NULL() 41 : REAL(KIND=dp) :: ekin = 0.0_dp, noisy_gamma_region = 0.0_dp, temperature = 0.0_dp, temp_expected = 0.0_dp, temp_tol = 0.0_dp 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 1786 : SUBROUTINE allocate_thermal_regions(thermal_regions) 53 : TYPE(thermal_regions_type), INTENT(OUT) :: thermal_regions 54 : 55 : MARK_USED(thermal_regions) 56 1786 : END SUBROUTINE allocate_thermal_regions 57 : 58 : ! ************************************************************************************************** 59 : !> \brief release thermal_regions 60 : !> \param thermal_regions ... 61 : !> \author 62 : ! ************************************************************************************************** 63 1786 : SUBROUTINE release_thermal_regions(thermal_regions) 64 : 65 : TYPE(thermal_regions_type), INTENT(INOUT) :: thermal_regions 66 : 67 : INTEGER :: ireg 68 : 69 1786 : IF (ASSOCIATED(thermal_regions%thermal_region)) THEN 70 34 : DO ireg = 1, SIZE(thermal_regions%thermal_region) 71 34 : DEALLOCATE (thermal_regions%thermal_region(ireg)%part_index) 72 : END DO 73 14 : DEALLOCATE (thermal_regions%thermal_region) 74 : END IF 75 1786 : IF (ASSOCIATED(thermal_regions%do_langevin)) THEN 76 12 : DEALLOCATE (thermal_regions%do_langevin) 77 : END IF 78 : 79 1786 : END SUBROUTINE release_thermal_regions 80 : 81 0 : END MODULE thermal_region_types