LCOV - code coverage report
Current view: top level - hybrid - HF_init.F90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 0 38 0.0 %
Date: 2019-09-08 04:53:50 Functions: 0 1 0.0 %

          Line data    Source code
       1             : 
       2             : MODULE m_hf_init
       3             :    !
       4             :    !     preparations for HF and hybrid functional calculation
       5             :    !
       6             : CONTAINS
       7           0 :    SUBROUTINE hf_init(hybrid, kpts, atoms, input, DIMENSION, hybdat, l_real)
       8             :       USE m_types
       9             :       USE m_read_core
      10             :       USE m_util
      11             :       USE m_io_hybrid
      12             :       IMPLICIT NONE
      13             :       TYPE(t_hybrid), INTENT(INOUT)     :: hybrid
      14             :       TYPE(t_kpts), INTENT(IN)          :: kpts
      15             :       TYPE(t_atoms), INTENT(IN)         :: atoms
      16             :       TYPE(t_input), INTENT(IN)         :: input
      17             :       TYPE(t_dimension), INTENT(IN)     :: DIMENSION
      18             :       TYPE(t_hybdat), INTENT(OUT)       :: hybdat
      19             :       LOGICAL, INTENT(IN)               :: l_real
      20             : 
      21             :       INTEGER:: itype, ieq, l, m, i, nk, l1, l2, m1, m2, ok
      22             : 
      23             :       !initialize hybdat%gridf for radial integration
      24           0 :       CALL intgrf_init(atoms%ntype, atoms%jmtd, atoms%jri, atoms%dx, atoms%rmsh, hybdat%gridf)
      25             : 
      26             :       !Alloc variables
      27           0 :       ALLOCATE (hybdat%lmaxc(atoms%ntype))
      28           0 :       ALLOCATE (hybdat%bas1(atoms%jmtd, hybrid%maxindx, 0:atoms%lmaxd, atoms%ntype))
      29           0 :       ALLOCATE (hybdat%bas2(atoms%jmtd, hybrid%maxindx, 0:atoms%lmaxd, atoms%ntype))
      30           0 :       ALLOCATE (hybdat%bas1_MT(hybrid%maxindx, 0:atoms%lmaxd, atoms%ntype))
      31           0 :       ALLOCATE (hybdat%drbas1_MT(hybrid%maxindx, 0:atoms%lmaxd, atoms%ntype))
      32             : 
      33             :       !sym%tau = oneD%ods%tau
      34             : 
      35             :       ! preparations for core states
      36           0 :       CALL core_init(dimension, input, atoms, hybdat%lmaxcd, hybdat%maxindxc)
      37           0 :       ALLOCATE (hybdat%nindxc(0:hybdat%lmaxcd, atoms%ntype), stat=ok)
      38           0 :       IF (ok /= 0) STOP 'eigen_hf: failure allocation hybdat%nindxc'
      39           0 :       ALLOCATE (hybdat%core1(atoms%jmtd, hybdat%maxindxc, 0:hybdat%lmaxcd, atoms%ntype), stat=ok)
      40           0 :       IF (ok /= 0) STOP 'eigen_hf: failure allocation core1'
      41           0 :       ALLOCATE (hybdat%core2(atoms%jmtd, hybdat%maxindxc, 0:hybdat%lmaxcd, atoms%ntype), stat=ok)
      42           0 :       IF (ok /= 0) STOP 'eigen_hf: failure allocation core2'
      43           0 :       ALLOCATE (hybdat%eig_c(hybdat%maxindxc, 0:hybdat%lmaxcd, atoms%ntype), stat=ok)
      44           0 :       IF (ok /= 0) STOP 'eigen_hf: failure allocation hybdat%eig_c'
      45           0 :       hybdat%nindxc = 0; hybdat%core1 = 0; hybdat%core2 = 0; hybdat%eig_c = 0
      46             : 
      47             :       ! pre-calculate gaunt coefficients
      48             : 
      49           0 :       hybdat%maxfac = max(2*atoms%lmaxd + hybrid%maxlcutm1 + 1, 2*hybdat%lmaxcd + 2*atoms%lmaxd + 1)
      50           0 :       ALLOCATE (hybdat%fac(0:hybdat%maxfac), hybdat%sfac(0:hybdat%maxfac), stat=ok)
      51           0 :       IF (ok /= 0) STOP 'eigen_hf: failure allocation fac,hybdat%sfac'
      52           0 :       hybdat%fac(0) = 1
      53           0 :       hybdat%sfac(0) = 1
      54           0 :       DO i = 1, hybdat%maxfac
      55           0 :          hybdat%fac(i) = hybdat%fac(i - 1)*i            ! hybdat%fac(i)    = i!
      56           0 :          hybdat%sfac(i) = hybdat%sfac(i - 1)*sqrt(i*1.0) ! hybdat%sfac(i)   = sqrt(i!)
      57             :       END DO
      58             : 
      59           0 :       ALLOCATE (hybdat%gauntarr(2, 0:atoms%lmaxd, 0:atoms%lmaxd, 0:hybrid%maxlcutm1, -atoms%lmaxd:atoms%lmaxd, -hybrid%maxlcutm1:hybrid%maxlcutm1), stat=ok)
      60           0 :       IF (ok /= 0) STOP 'eigen: failure allocation hybdat%gauntarr'
      61           0 :       hybdat%gauntarr = 0
      62           0 :       DO l2 = 0, atoms%lmaxd
      63           0 :          DO l1 = 0, atoms%lmaxd
      64           0 :             DO l = abs(l1 - l2), min(l1 + l2, hybrid%maxlcutm1)
      65           0 :                DO m = -l, l
      66           0 :                   DO m1 = -l1, l1
      67           0 :                      m2 = m1 + m ! Gaunt condition -m1+m2-m = 0
      68           0 :                      IF (abs(m2) <= l2) hybdat%gauntarr(1, l1, l2, l, m1, m) = gaunt(l1, l2, l, m1, m2, m, hybdat%maxfac, hybdat%fac, hybdat%sfac)
      69           0 :                      m2 = m1 - m ! switch role of l2-index
      70           0 :                      IF (abs(m2) <= l2) hybdat%gauntarr(2, l1, l2, l, m1, m) = gaunt(l2, l1, l, m2, m1, m, hybdat%maxfac, hybdat%fac, hybdat%sfac)
      71             :                   END DO
      72             :                END DO
      73             :             END DO
      74             :          END DO
      75             :       END DO
      76             : 
      77             :       !skip_kpt = .false.
      78             : 
      79           0 :    END SUBROUTINE hf_init
      80             : END MODULE m_hf_init

Generated by: LCOV version 1.13