LCOV - code coverage report
Current view: top level - src - semi_empirical_mpole_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:2fce0f8) Lines: 51 52 98.1 %
Date: 2024-12-21 06:28:57 Functions: 6 9 66.7 %

          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 Definition of the semi empirical multipole integral expansions types
      10             : !> \author Teodoro Laino [tlaino] - 08.2008 Zurich University
      11             : ! **************************************************************************************************
      12             : MODULE semi_empirical_mpole_types
      13             : 
      14             :    USE kinds,                           ONLY: dp
      15             : #include "./base/base_uses.f90"
      16             : 
      17             :    IMPLICIT NONE
      18             : 
      19             :    PRIVATE
      20             : 
      21             : ! *** Global parameters ***
      22             : 
      23             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'semi_empirical_mpole_types'
      24             : 
      25             : ! **************************************************************************************************
      26             : !> \brief Semi-empirical integral multipole expansion type
      27             : !> \author Teodoro Laino [tlaino] - 08.2008 Zurich University
      28             : ! **************************************************************************************************
      29             :    TYPE semi_empirical_mpole_type
      30             :       LOGICAL, DIMENSION(3)                    :: task = .FALSE.
      31             :       INTEGER                                  :: indi = -1, indj = -1
      32             :       REAL(KIND=dp)                            :: c = -1.0_dp
      33             :       REAL(KIND=dp), DIMENSION(3)              :: d = -1.0_dp
      34             :       REAL(KIND=dp), DIMENSION(3, 3)            :: qc = -1.0_dp ! quadrupole cartesian
      35             :       REAL(KIND=dp), DIMENSION(5)              :: qs = -1.0_dp ! quadrupole spherical
      36             :       ! alternative definition used in GKS integral routines
      37             :       REAL(KIND=dp)                            :: cs = -1.0_dp
      38             :       REAL(KIND=dp), DIMENSION(3)              :: ds = -1.0_dp
      39             :       REAL(KIND=dp), DIMENSION(3, 3)            :: qq = -1.0_dp ! quadrupole cartesian
      40             :    END TYPE semi_empirical_mpole_type
      41             : 
      42             : ! **************************************************************************************************
      43             : !> \brief Semi-empirical integral multipole expansion type - pointer type
      44             : !> \author Teodoro Laino [tlaino] - 08.2008 Zurich University
      45             : ! **************************************************************************************************
      46             :    TYPE semi_empirical_mpole_p_type
      47             :       TYPE(semi_empirical_mpole_type), POINTER :: mpole => NULL()
      48             :    END TYPE semi_empirical_mpole_p_type
      49             : 
      50             : ! **************************************************************************************************
      51             : !> \brief Global Multipolar NDDO information type
      52             : !> \author Teodoro Laino [tlaino] - 08.2008 Zurich University
      53             : ! **************************************************************************************************
      54             :    TYPE nddo_mpole_type
      55             :       REAL(KIND=dp), DIMENSION(:), POINTER     :: charge => NULL(), efield0 => NULL()
      56             :       REAL(KIND=dp), DIMENSION(:, :), POINTER   :: dipole => NULL(), efield1 => NULL(), efield2 => NULL()
      57             :       REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: quadrupole => NULL()
      58             :    END TYPE nddo_mpole_type
      59             : 
      60             :    PUBLIC :: semi_empirical_mpole_type, &
      61             :              semi_empirical_mpole_p_type, &
      62             :              semi_empirical_mpole_p_create, &
      63             :              semi_empirical_mpole_p_release, &
      64             :              nddo_mpole_type, &
      65             :              nddo_mpole_create, &
      66             :              nddo_mpole_release
      67             : 
      68             : CONTAINS
      69             : 
      70             : ! **************************************************************************************************
      71             : !> \brief Allocate semi-empirical mpole type
      72             : !> \param mpole ...
      73             : !> \param ndim ...
      74             : !> \author Teodoro Laino [tlaino] - 08.2008 Zurich University
      75             : ! **************************************************************************************************
      76        2240 :    SUBROUTINE semi_empirical_mpole_p_create(mpole, ndim)
      77             :       TYPE(semi_empirical_mpole_p_type), DIMENSION(:), &
      78             :          POINTER                                         :: mpole
      79             :       INTEGER, INTENT(IN)                                :: ndim
      80             : 
      81             :       INTEGER                                            :: i
      82             : 
      83        2240 :       CPASSERT(.NOT. ASSOCIATED(mpole))
      84       50738 :       ALLOCATE (mpole(ndim))
      85       46258 :       DO i = 1, ndim
      86       44018 :          NULLIFY (mpole(i)%mpole)
      87       46258 :          CALL semi_empirical_mpole_create(mpole(i)%mpole)
      88             :       END DO
      89             : 
      90        2240 :    END SUBROUTINE semi_empirical_mpole_p_create
      91             : 
      92             : ! **************************************************************************************************
      93             : !> \brief Deallocate the semi-empirical mpole type
      94             : !> \param mpole ...
      95             : !> \author Teodoro Laino [tlaino] - 08.2008 Zurich University
      96             : ! **************************************************************************************************
      97        3964 :    SUBROUTINE semi_empirical_mpole_p_release(mpole)
      98             :       TYPE(semi_empirical_mpole_p_type), DIMENSION(:), &
      99             :          POINTER                                         :: mpole
     100             : 
     101             :       INTEGER                                            :: i
     102             : 
     103        3964 :       IF (ASSOCIATED(mpole)) THEN
     104       46258 :          DO i = 1, SIZE(mpole)
     105       46258 :             CALL semi_empirical_mpole_release(mpole(i)%mpole)
     106             :          END DO
     107        2240 :          DEALLOCATE (mpole)
     108             :       END IF
     109             : 
     110        3964 :    END SUBROUTINE semi_empirical_mpole_p_release
     111             : 
     112             : ! **************************************************************************************************
     113             : !> \brief Allocate semi-empirical mpole type
     114             : !> \param mpole ...
     115             : !> \author Teodoro Laino [tlaino] - 08.2008 Zurich University
     116             : ! **************************************************************************************************
     117       44018 :    SUBROUTINE semi_empirical_mpole_create(mpole)
     118             :       TYPE(semi_empirical_mpole_type), POINTER           :: mpole
     119             : 
     120       44018 :       CPASSERT(.NOT. ASSOCIATED(mpole))
     121     1980810 :       ALLOCATE (mpole)
     122      176072 :       mpole%task = .FALSE.
     123       44018 :       mpole%indi = 0
     124       44018 :       mpole%indj = 0
     125       44018 :       mpole%c = HUGE(0.0_dp)
     126      176072 :       mpole%d = HUGE(0.0_dp)
     127      572234 :       mpole%qc = HUGE(0.0_dp)
     128      264108 :       mpole%qs = HUGE(0.0_dp)
     129       44018 :       mpole%cs = HUGE(0.0_dp)
     130      176072 :       mpole%ds = HUGE(0.0_dp)
     131      572234 :       mpole%qq = HUGE(0.0_dp)
     132       44018 :    END SUBROUTINE semi_empirical_mpole_create
     133             : 
     134             : ! **************************************************************************************************
     135             : !> \brief Deallocate the semi-empirical mpole type
     136             : !> \param mpole ...
     137             : !> \author Teodoro Laino [tlaino] - 08.2008 Zurich University
     138             : ! **************************************************************************************************
     139       44018 :    SUBROUTINE semi_empirical_mpole_release(mpole)
     140             :       TYPE(semi_empirical_mpole_type), POINTER           :: mpole
     141             : 
     142       44018 :       IF (ASSOCIATED(mpole)) THEN
     143       44018 :          DEALLOCATE (mpole)
     144             :       END IF
     145             : 
     146       44018 :    END SUBROUTINE semi_empirical_mpole_release
     147             : 
     148             : ! **************************************************************************************************
     149             : !> \brief Allocate NDDO multipole type
     150             : !> \param nddo_mpole ...
     151             : !> \author Teodoro Laino [tlaino] - 08.2008 Zurich University
     152             : ! **************************************************************************************************
     153          32 :    SUBROUTINE nddo_mpole_create(nddo_mpole)
     154             :       TYPE(nddo_mpole_type), POINTER                     :: nddo_mpole
     155             : 
     156          32 :       CPASSERT(.NOT. ASSOCIATED(nddo_mpole))
     157          32 :       ALLOCATE (nddo_mpole)
     158             :       NULLIFY (nddo_mpole%charge)
     159             :       NULLIFY (nddo_mpole%dipole)
     160             :       NULLIFY (nddo_mpole%quadrupole)
     161             :       NULLIFY (nddo_mpole%efield0)
     162             :       NULLIFY (nddo_mpole%efield1)
     163             :       NULLIFY (nddo_mpole%efield2)
     164          32 :    END SUBROUTINE nddo_mpole_create
     165             : 
     166             : ! **************************************************************************************************
     167             : !> \brief Deallocate NDDO multipole type
     168             : !> \param nddo_mpole ...
     169             : !> \author Teodoro Laino [tlaino] - 08.2008 Zurich University
     170             : ! **************************************************************************************************
     171          64 :    SUBROUTINE nddo_mpole_release(nddo_mpole)
     172             :       TYPE(nddo_mpole_type), POINTER                     :: nddo_mpole
     173             : 
     174          64 :       IF (ASSOCIATED(nddo_mpole)) THEN
     175          32 :          IF (ASSOCIATED(nddo_mpole%charge)) THEN
     176          32 :             DEALLOCATE (nddo_mpole%charge)
     177             :          END IF
     178          32 :          IF (ASSOCIATED(nddo_mpole%dipole)) THEN
     179          32 :             DEALLOCATE (nddo_mpole%dipole)
     180             :          END IF
     181          32 :          IF (ASSOCIATED(nddo_mpole%quadrupole)) THEN
     182          32 :             DEALLOCATE (nddo_mpole%quadrupole)
     183             :          END IF
     184          32 :          IF (ASSOCIATED(nddo_mpole%efield0)) THEN
     185          32 :             DEALLOCATE (nddo_mpole%efield0)
     186             :          END IF
     187          32 :          IF (ASSOCIATED(nddo_mpole%efield1)) THEN
     188          32 :             DEALLOCATE (nddo_mpole%efield1)
     189             :          END IF
     190          32 :          IF (ASSOCIATED(nddo_mpole%efield2)) THEN
     191          32 :             DEALLOCATE (nddo_mpole%efield2)
     192             :          END IF
     193          32 :          DEALLOCATE (nddo_mpole)
     194             :       END IF
     195             : 
     196          64 :    END SUBROUTINE nddo_mpole_release
     197             : 
     198           0 : END MODULE semi_empirical_mpole_types

Generated by: LCOV version 1.15