LCOV - code coverage report
Current view: top level - src/aobasis - ai_coulomb_test.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:d1f8d1b) Lines: 50 50 100.0 %
Date: 2024-11-29 06:42:44 Functions: 1 1 100.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 Test of Electron Repulsion Routines (ERI)
      10             : !> \par History
      11             : !>      none
      12             : !> \author JGH (01.07.2009)
      13             : ! **************************************************************************************************
      14             : MODULE ai_coulomb_test
      15             : 
      16             :    USE ai_coulomb,                      ONLY: coulomb2
      17             :    USE kinds,                           ONLY: dp
      18             :    USE machine,                         ONLY: m_walltime
      19             :    USE orbital_pointers,                ONLY: deallocate_orbital_pointers,&
      20             :                                               init_orbital_pointers,&
      21             :                                               nco,&
      22             :                                               ncoset
      23             : #include "../base/base_uses.f90"
      24             : 
      25             :    IMPLICIT NONE
      26             : 
      27             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'ai_coulomb_test'
      28             : 
      29             :    REAL(KIND=dp), PARAMETER :: threshold = 1.0E-6_dp
      30             : 
      31             :    PRIVATE
      32             : 
      33             :    PUBLIC :: eri_test
      34             : ! **************************************************************************************************
      35             : 
      36             : CONTAINS
      37             : 
      38             : ! **************************************************************************************************
      39             : !> \brief ...
      40             : !> \param iw ...
      41             : ! **************************************************************************************************
      42           2 :    SUBROUTINE eri_test(iw)
      43             : 
      44             :       INTEGER, INTENT(IN)                                :: iw
      45             : 
      46             :       INTEGER, PARAMETER                                 :: lmax = 6
      47             : 
      48             :       CHARACTER(LEN=11), DIMENSION(0:lmax)               :: i2g
      49             :       CHARACTER(LEN=5), DIMENSION(0:lmax)                :: i2c
      50             :       CHARACTER(LEN=7), DIMENSION(0:lmax)                :: i2e
      51             :       CHARACTER(LEN=9), DIMENSION(0:lmax)                :: i2f
      52             :       INTEGER                                            :: i, ii, l, la_max, la_min, lc_max, &
      53             :                                                             lc_min, ll, n, npgfa, npgfb, npgfc, &
      54             :                                                             npgfd
      55             :       REAL(KIND=dp)                                      :: perf, rac2, t, tend, tstart
      56           2 :       REAL(KIND=dp), ALLOCATABLE, DIMENSION(:)           :: f
      57           2 :       REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :)        :: vac
      58           2 :       REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :, :)     :: v
      59             :       REAL(KIND=dp), DIMENSION(3)                        :: ra, rb, rc, rd
      60           2 :       REAL(KIND=dp), DIMENSION(:), POINTER               :: rpgf, zeta, zetb, zetc, zetd
      61             : 
      62           1 :       IF (iw > 0) WRITE (iw, '(/,A)') " Test of Electron Repulsion Integrals (ERI) "
      63             : 
      64           2 :       CALL init_orbital_pointers(lmax)
      65             : 
      66           2 :       i2c(0) = "(s|s)"
      67           2 :       i2c(1) = "(p|p)"
      68           2 :       i2c(2) = "(d|d)"
      69           2 :       i2c(3) = "(f|f)"
      70           2 :       i2c(4) = "(g|g)"
      71           2 :       i2c(5) = "(h|h)"
      72           2 :       i2c(6) = "(i|i)"
      73             : 
      74             :       i2g(0) = "[(ss)|(ss)]"
      75             :       i2g(1) = "[(pp)|(pp)]"
      76             :       i2g(2) = "[(dd)|(dd)]"
      77             :       i2g(3) = "[(ff)|(ff)]"
      78             :       i2g(4) = "[(gg)|(gg)]"
      79             :       i2g(5) = "[(hh)|(hh)]"
      80             :       i2g(6) = "[(ii)|(ii)]"
      81             : 
      82             :       i2f(0) = "[ss|(ss)]"
      83             :       i2f(1) = "[pp|(pp)]"
      84             :       i2f(2) = "[dd|(dd)]"
      85             :       i2f(3) = "[ff|(ff)]"
      86             :       i2f(4) = "[gg|(gg)]"
      87             :       i2f(5) = "[hh|(hh)]"
      88             :       i2f(6) = "[ii|(ii)]"
      89             : 
      90             :       i2e(0) = "(ss|ss)"
      91             :       i2e(1) = "(pp|pp)"
      92             :       i2e(2) = "(dd|dd)"
      93             :       i2e(3) = "(ff|ff)"
      94             :       i2e(4) = "(gg|gg)"
      95             :       i2e(5) = "(hh|hh)"
      96             :       i2e(6) = "(ii|ii)"
      97             : 
      98           2 :       npgfa = 4
      99           2 :       npgfb = 2
     100           2 :       npgfc = 4
     101           2 :       npgfd = 1
     102           2 :       n = MAX(npgfa, npgfb, npgfc, npgfd)
     103             : 
     104           2 :       ALLOCATE (zeta(npgfa), zetb(npgfb), zetc(npgfc), zetd(npgfd), rpgf(n))
     105             : 
     106          10 :       zeta(1:npgfa) = 0.5_dp
     107           6 :       zetb(1:npgfb) = 0.4_dp
     108          10 :       zetc(1:npgfc) = 0.3_dp
     109           4 :       zetd(1:npgfd) = 0.2_dp
     110             : 
     111           2 :       ra = (/0.0_dp, 0.0_dp, 0.0_dp/)
     112             :       rb = (/1.0_dp, 0.0_dp, 0.0_dp/)
     113           2 :       rc = (/0.0_dp, 0.3_dp, 0.3_dp/)
     114             :       rd = (/0.7_dp, 0.2_dp, 0.1_dp/)
     115             : 
     116           8 :       rac2 = SUM((ra - rc)**2)
     117          10 :       rpgf = 1.e10_dp
     118             : 
     119             :       ! Performance test of coulomb2 routine
     120           2 :       IF (iw > 0) THEN
     121             : 
     122           1 :          WRITE (iw, '(//,A,/)') " Test of 2-Electron-2-Center Integrals (coulomb2) "
     123           8 :          DO l = 0, lmax
     124           7 :             la_max = l
     125           7 :             la_min = l
     126           7 :             lc_max = l
     127           7 :             lc_min = l
     128           7 :             ll = ncoset(l)
     129          70 :             ALLOCATE (f(0:2*l + 2), v(npgfa*ll, npgfc*ll, 2*l + 1), vac(npgfa*ll, npgfc*ll))
     130      191791 :             vac = 0._dp
     131           7 :             ii = MAX(100/(l + 1)**2, 1)
     132           7 :             tstart = m_walltime()
     133         157 :             DO i = 1, ii
     134         157 :                CALL coulomb2(la_max, npgfa, zeta, rpgf, la_min, lc_max, npgfc, zetc, rpgf, lc_min, rc, rac2, vac, v, f)
     135             :             END DO
     136           7 :             tend = m_walltime()
     137           7 :             t = tend - tstart + threshold
     138           7 :             perf = REAL(ii*nco(l)**2, KIND=dp)*1.e-6_dp*REAL(npgfa*npgfc, KIND=dp)/t
     139           7 :             WRITE (iw, '(A,T40,A,T66,F15.3)') " Performance [Mintegrals/s] ", i2c(l), perf
     140           8 :             DEALLOCATE (f, v, vac)
     141             :          END DO
     142             : 
     143             :       END IF
     144             : 
     145           2 :       DEALLOCATE (zeta, zetb, zetc, zetd, rpgf)
     146             : 
     147           2 :       CALL deallocate_orbital_pointers()
     148             : 
     149           4 :    END SUBROUTINE eri_test
     150             : 
     151             : ! **************************************************************************************************
     152             : 
     153             : END MODULE ai_coulomb_test
     154             : 

Generated by: LCOV version 1.15