LCOV - code coverage report
Current view: top level - src/subsys - damping_dipole_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:20fe009) Lines: 20 21 95.2 %
Date: 2022-07-05 19:56:53 Functions: 3 6 50.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------------------------!
       2             : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3             : !   Copyright 2000-2022 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
      36             :       REAL(KIND=dp)                           :: bij, cij
      37             :    END TYPE damping_info_type
      38             : ! **************************************************************************************************
      39             :    TYPE damping_type
      40             :       INTEGER :: itype
      41             :       INTEGER :: order
      42             :       REAL(KIND=dp) :: bij, cij
      43             :    END TYPE damping_type
      44             : 
      45             :    TYPE damping_p_type
      46             :       TYPE(damping_type), DIMENSION(:), POINTER :: damp
      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             :       INTEGER                                            :: i
      72             : 
      73          10 :       CPASSERT(.NOT. ASSOCIATED(damping))
      74          10 :       ALLOCATE (damping)
      75          30 :       ALLOCATE (damping%damp(nkinds))
      76          32 :       DO i = 1, nkinds
      77          32 :          CALL init_damping(damping%damp(i))
      78             :       END DO
      79             : 
      80          10 :    END SUBROUTINE damping_p_create
      81             : ! **************************************************************************************************
      82             : !> \brief Release Data-structure that contains damping information
      83             : !> \param damping ...
      84             : !> \author Rodolphe Vuilleumier [RV]
      85             : ! **************************************************************************************************
      86       29579 :    SUBROUTINE damping_p_release(damping)
      87             :       TYPE(damping_p_type), POINTER                      :: damping
      88             : 
      89       29579 :       IF (ASSOCIATED(damping)) THEN
      90          10 :          IF (ASSOCIATED(damping%damp)) THEN
      91          10 :             DEALLOCATE (damping%damp)
      92             :          END IF
      93          10 :          DEALLOCATE (damping)
      94             :       END IF
      95       29579 :       NULLIFY (damping)
      96             : 
      97       29579 :    END SUBROUTINE damping_p_release
      98             : 
      99             : ! **************************************************************************************************
     100             : !> \brief ...
     101             : !> \param damping ...
     102             : ! **************************************************************************************************
     103          22 :    SUBROUTINE init_damping(damping)
     104             :       TYPE(damping_type), INTENT(INOUT)                  :: damping
     105             : 
     106          22 :       damping%itype = no_damping
     107          22 :       damping%order = 1
     108          22 :       damping%bij = HUGE(0.0_dp)
     109          22 :       damping%cij = 0.0_dp
     110             : 
     111          22 :    END SUBROUTINE init_damping
     112             : 
     113             : ! **************************************************************************************************
     114           0 : END MODULE damping_dipole_types

Generated by: LCOV version 1.15