LCOV - code coverage report
Current view: top level - src - qs_dftb_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:4dc10b3) Lines: 33 34 97.1 %
Date: 2024-11-21 06:45:46 Functions: 3 5 60.0 %

          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 DFTB parameter types.
      10             : !> \author JGH (24.02.2007)
      11             : ! **************************************************************************************************
      12             : MODULE qs_dftb_types
      13             : 
      14             :    USE kinds,                           ONLY: default_string_length,&
      15             :                                               dp
      16             : #include "./base/base_uses.f90"
      17             : 
      18             :    IMPLICIT NONE
      19             : 
      20             :    PRIVATE
      21             : 
      22             : ! *** Global parameters ***
      23             : 
      24             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_dftb_types'
      25             : 
      26             : ! **************************************************************************************************
      27             :    TYPE qs_dftb_atom_type
      28             :       ! PRIVATE
      29             :       CHARACTER(LEN=default_string_length)   :: typ = ""
      30             :       CHARACTER(LEN=default_string_length)   :: name = ""
      31             :       LOGICAL                                :: defined = .FALSE.
      32             :       INTEGER                                :: z = -1 !atomic number
      33             :       REAL(KIND=dp)                          :: zeff = -1.0_dp !effective core charge
      34             :       INTEGER                                :: natorb = -1 !number of orbitals
      35             :       INTEGER                                :: lmax = -1 !max angular momentum
      36             :       REAL(KIND=dp), DIMENSION(0:3)          :: skself = -1.0_dp !orbital energy
      37             :       REAL(KIND=dp), DIMENSION(0:3)          :: occupation = -1.0_dp !free atom occupation
      38             :       REAL(KIND=dp), DIMENSION(0:3)          :: eta = -1.0_dp !orbital hardness
      39             :       REAL(KIND=dp)                          :: energy = -1.0_dp !free atom energy
      40             :       REAL(KIND=dp)                          :: cutoff = -1.0_dp !cutoff radius for f matrix
      41             :       REAL(KIND=dp)                          :: xi = -1.0_dp, di = -1.0_dp !London parameter
      42             :       REAL(KIND=dp)                          :: rcdisp = -1.0_dp !cutoff radius for vdW
      43             :       REAL(KIND=dp)                          :: dudq = -1.0_dp !DFTB3 hardness derivative
      44             :    END TYPE qs_dftb_atom_type
      45             : 
      46             : ! **************************************************************************************************
      47             :    TYPE qs_dftb_pairpot_type
      48             :       REAL(KIND=dp)                          :: dgrd = -1.0_dp ! grid spacing
      49             :       INTEGER                                :: ngrd = -1 ! number of grid points
      50             :       INTEGER                                :: ngrdcut = -1 ! grid cutoff
      51             :       INTEGER                                :: llm = -1 ! number of interactions (l,l,m)
      52             :       INTEGER                                :: n_urpoly = -1 ! order of polynomial
      53             :       REAL(KIND=dp)                          :: urep_cut = -1.0_dp ! cutoff for repulsive pot.
      54             :       REAL(KIND=dp), DIMENSION(10)           :: urep = -1.0_dp ! coefficients for repulsive
      55             :       ! potential in polynomial form
      56             :       INTEGER                                :: spdim = -1 ! number of points for
      57             :       ! spline representation
      58             :       REAL(KIND=dp)                          :: s_cut = -1.0_dp ! left-hand cutoff
      59             :       REAL(KIND=dp), DIMENSION(3)            :: srep = -1.0_dp ! coefficients for extrapolation
      60             :       REAL(KIND=dp), DIMENSION(:, :), POINTER :: spxr => NULL() ! spline points
      61             :       REAL(KIND=dp), DIMENSION(:, :), POINTER :: scoeff => NULL() ! spline coefficients
      62             :       REAL(KIND=dp), DIMENSION(2)            :: surr = -1.0_dp ! coefficients for last point
      63             :       REAL(KIND=dp), DIMENSION(:, :), POINTER :: fmat => NULL() ! Slater-Koster table (Hamiltonian)
      64             :       REAL(KIND=dp), DIMENSION(:, :), POINTER :: smat => NULL() ! Slater-Koster table (overlap)
      65             :       ! van der Waals parameter
      66             :       REAL(KIND=dp)                          :: xij = -1.0_dp, dij = -1.0_dp ! standard LJ parameters
      67             :       REAL(KIND=dp)                          :: x0ij = -1.0_dp ! Evdw(x0) = 0
      68             :       REAL(KIND=dp)                          :: a = -1.0_dp, b = -1.0_dp, c = -1.0_dp ! Short range polynomial coeffs
      69             :    END TYPE qs_dftb_pairpot_type
      70             : 
      71             : ! *** Public data types ***
      72             : 
      73             :    PUBLIC :: qs_dftb_atom_type, qs_dftb_pairpot_type, &
      74             :              qs_dftb_pairpot_init, qs_dftb_pairpot_create, qs_dftb_pairpot_release
      75             : 
      76             : CONTAINS
      77             : 
      78             : ! **************************************************************************************************
      79             : !> \brief ...
      80             : !> \param pairpot ...
      81             : ! **************************************************************************************************
      82         222 :    SUBROUTINE qs_dftb_pairpot_init(pairpot)
      83             :       TYPE(qs_dftb_pairpot_type), DIMENSION(:, :), &
      84             :          POINTER                                         :: pairpot
      85             : 
      86             :       INTEGER                                            :: i, j
      87             : 
      88         222 :       IF (ASSOCIATED(pairpot)) THEN
      89         702 :          DO i = 1, SIZE(pairpot, 1)
      90        1814 :             DO j = 1, SIZE(pairpot, 2)
      91        1112 :                NULLIFY (pairpot(i, j)%spxr, pairpot(i, j)%scoeff, &
      92        1592 :                         pairpot(i, j)%smat, pairpot(i, j)%fmat)
      93             :             END DO
      94             :          END DO
      95             :       END IF
      96             : 
      97         222 :    END SUBROUTINE qs_dftb_pairpot_init
      98             : 
      99             : ! **************************************************************************************************
     100             : !> \brief ...
     101             : !> \param pairpot ...
     102             : !> \param ngrd ...
     103             : !> \param llm ...
     104             : !> \param spdim ...
     105             : ! **************************************************************************************************
     106        1112 :    SUBROUTINE qs_dftb_pairpot_create(pairpot, ngrd, llm, spdim)
     107             :       TYPE(qs_dftb_pairpot_type)                         :: pairpot
     108             :       INTEGER, INTENT(IN)                                :: ngrd, llm, spdim
     109             : 
     110        1112 :       pairpot%ngrd = ngrd
     111        1112 :       pairpot%spdim = spdim
     112        1112 :       pairpot%llm = llm
     113             : 
     114        1112 :       IF (spdim > 0) THEN
     115        2634 :          ALLOCATE (pairpot%spxr(spdim, 2))
     116             : 
     117        2634 :          ALLOCATE (pairpot%scoeff(spdim, 4))
     118             :       END IF
     119             : 
     120        4448 :       ALLOCATE (pairpot%fmat(ngrd, llm))
     121             : 
     122        4448 :       ALLOCATE (pairpot%smat(ngrd, llm))
     123             : 
     124        1112 :    END SUBROUTINE qs_dftb_pairpot_create
     125             : 
     126             : ! **************************************************************************************************
     127             : !> \brief ...
     128             : !> \param pairpot ...
     129             : ! **************************************************************************************************
     130         222 :    SUBROUTINE qs_dftb_pairpot_release(pairpot)
     131             :       TYPE(qs_dftb_pairpot_type), DIMENSION(:, :), &
     132             :          POINTER                                         :: pairpot
     133             : 
     134             :       INTEGER                                            :: i, j, n1, n2
     135             : 
     136         222 :       IF (ASSOCIATED(pairpot)) THEN
     137         222 :          n1 = SIZE(pairpot, 1)
     138         222 :          n2 = SIZE(pairpot, 2)
     139         702 :          DO i = 1, n1
     140        1814 :             DO j = 1, n2
     141        1112 :                IF (ASSOCIATED(pairpot(i, j)%spxr)) THEN
     142         878 :                   DEALLOCATE (pairpot(i, j)%spxr)
     143             :                END IF
     144        1112 :                IF (ASSOCIATED(pairpot(i, j)%scoeff)) THEN
     145         878 :                   DEALLOCATE (pairpot(i, j)%scoeff)
     146             :                END IF
     147        1112 :                IF (ASSOCIATED(pairpot(i, j)%smat)) THEN
     148        1112 :                   DEALLOCATE (pairpot(i, j)%smat)
     149             :                END IF
     150        1592 :                IF (ASSOCIATED(pairpot(i, j)%fmat)) THEN
     151        1112 :                   DEALLOCATE (pairpot(i, j)%fmat)
     152             :                END IF
     153             :             END DO
     154             :          END DO
     155         222 :          DEALLOCATE (pairpot)
     156             :       END IF
     157             : 
     158         222 :    END SUBROUTINE qs_dftb_pairpot_release
     159             : 
     160           0 : END MODULE qs_dftb_types
     161             : 

Generated by: LCOV version 1.15