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 Rodolphe Vuilleumier (29.12.2009) 10 : ! ************************************************************************************************** 11 : MODULE damping_dipole_types 12 : 13 : USE kinds, ONLY: default_string_length,& 14 : dp 15 : #include "../base/base_uses.f90" 16 : 17 : IMPLICIT NONE 18 : 19 : PRIVATE 20 : 21 : ! *** Global parameters (only in this module) 22 : 23 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'damping_dipole_types' 24 : 25 : ! *** Global public parameters 26 : 27 : INTEGER, PUBLIC, PARAMETER :: no_damping = -1, & 28 : tang_toennies = 1 29 : 30 : ! *** Define the damping types *** 31 : ! ************************************************************************************************** 32 : TYPE damping_info_type 33 : CHARACTER(LEN=default_string_length) :: atm_name1 = "", atm_name2 = "" 34 : CHARACTER(LEN=default_string_length) :: dtype = "" 35 : INTEGER :: order = -1 36 : REAL(KIND=dp) :: bij = 0.0_dp, cij = 0.0_dp 37 : END TYPE damping_info_type 38 : ! ************************************************************************************************** 39 : TYPE damping_type 40 : INTEGER :: itype = no_damping 41 : INTEGER :: order = 1 42 : REAL(KIND=dp) :: bij = HUGE(0.0_dp), cij = 0.0_dp 43 : END TYPE damping_type 44 : 45 : TYPE damping_p_type 46 : TYPE(damping_type), DIMENSION(:), POINTER :: damp => NULL() 47 : END TYPE 48 : 49 : ! ************************************************************************************************** 50 : 51 : ! *** Public data types *** 52 : 53 : PUBLIC :: damping_info_type, damping_type 54 : 55 : ! *** Public subroutines *** 56 : 57 : PUBLIC :: damping_p_type, damping_p_create, damping_p_release 58 : 59 : CONTAINS 60 : 61 : ! ************************************************************************************************** 62 : !> \brief Creates Data-structure that contains damping information 63 : !> \param damping ... 64 : !> \param nkinds ... 65 : !> \author Rodolphe Vuilleumier 66 : ! ************************************************************************************************** 67 10 : SUBROUTINE damping_p_create(damping, nkinds) 68 : TYPE(damping_p_type), POINTER :: damping 69 : INTEGER, INTENT(IN) :: nkinds 70 : 71 10 : CPASSERT(.NOT. ASSOCIATED(damping)) 72 10 : ALLOCATE (damping) 73 52 : ALLOCATE (damping%damp(nkinds)) 74 : 75 10 : END SUBROUTINE damping_p_create 76 : ! ************************************************************************************************** 77 : !> \brief Release Data-structure that contains damping information 78 : !> \param damping ... 79 : !> \author Rodolphe Vuilleumier [RV] 80 : ! ************************************************************************************************** 81 31691 : SUBROUTINE damping_p_release(damping) 82 : TYPE(damping_p_type), POINTER :: damping 83 : 84 31691 : IF (ASSOCIATED(damping)) THEN 85 10 : IF (ASSOCIATED(damping%damp)) THEN 86 10 : DEALLOCATE (damping%damp) 87 : END IF 88 10 : DEALLOCATE (damping) 89 : END IF 90 31691 : NULLIFY (damping) 91 : 92 31691 : END SUBROUTINE damping_p_release 93 : 94 : ! ************************************************************************************************** 95 0 : END MODULE damping_dipole_types