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

          Line data    Source code
       1             : !--------------------------------------------------------------------------------
       2             : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
       3             : ! This file is part of FLEUR and available as free software under the conditions
       4             : ! of the MIT license as expressed in the LICENSE file in more detail.
       5             : !--------------------------------------------------------------------------------
       6             : 
       7             : MODULE m_add_vnonlocal
       8             :    USE m_judft
       9             : ! c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c
      10             : !     This module is the driver routine for the calculation of the Hartree    c
      11             : !     Fock exchange term by using the mixed basis set.                        c
      12             : !                                                                             c
      13             : !     hsfock                                                                  c
      14             : !         |                                                                   c
      15             : !         |- symm.F:                                                          c
      16             : !         |  calculates the irreducible representation                        c
      17             : !         |                                                                   c
      18             : !         |- wavefproducts.F:                 s      s*                       c
      19             : !         |  computes the repsentation of phi    phi       in the mixed basis c
      20             : !         |                                  n,k    n',k+q                    c
      21             : !         |                                                                   c
      22             : !         |- exchange.F:                                                      c
      23             : !         |  calculates valence-valence part of the exchange matrix (mat_ex), c
      24             : !         |                                                                   c
      25             : !         |- exchange_core.F                                                  c
      26             : !         |  calculate valence-core contribution                              c
      27             : !                                                                             c
      28             : !     variables:                                                              c
      29             : !         kpts%nkptf   :=   number of kpoints                                      c
      30             : !         kpts%nkpt   :=   number of irreducible kpoints                          c
      31             : !         nbands  :=   number of bands for which the exchange matrix (mat_ex) c
      32             : !                      in the space of the wavefunctions is calculated        c
      33             : !         te_hfex :=   hf exchange contribution to the total energy           c
      34             : !         mnobd   :=   maximum number of occupied bands                       c
      35             : !         parent  :=   parent(ikpt) points to the symmetry equivalent point   c
      36             : !                      under the little group of kpoint nk                    c
      37             : !         symop   :=   symop(ikpt) points to the symmetry operation, which    c
      38             : !                      maps parent(ikpt) on ikpt                              c
      39             : !                                                                             c
      40             : !                                                                             c
      41             : !                                               M.Betzinger (09/07)           c
      42             : ! c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c
      43             : CONTAINS
      44             : 
      45           0 :    SUBROUTINE add_vnonlocal(nk, lapw, atoms, hybrid, dimension, kpts, jsp, results, xcpot, noco, hmat)
      46             : 
      47             :       USE m_symm_hf, ONLY: symm_hf
      48             :       USE m_util, ONLY: intgrf, intgrf_init
      49             :       USE m_exchange_valence_hf
      50             :       USE m_exchange_core
      51             :       USE m_symmetrizeh
      52             :       USE m_wrapper
      53             :       USE m_hsefunctional, ONLY: exchange_vccvHSE, exchange_ccccHSE
      54             :       USE m_types
      55             :       USE m_io_hybrid
      56             : 
      57             :       IMPLICIT NONE
      58             : 
      59             :       TYPE(t_results), INTENT(INOUT) :: results
      60             :       CLASS(t_xcpot), INTENT(IN)    :: xcpot
      61             :       TYPE(t_dimension), INTENT(IN)    :: dimension
      62             :       TYPE(t_hybrid), INTENT(INOUT) :: hybrid
      63             :       TYPE(t_kpts), INTENT(IN)    :: kpts
      64             :       TYPE(t_lapw), INTENT(IN)    :: lapw
      65             :       TYPE(t_atoms), INTENT(IN)    :: atoms
      66             :       TYPE(t_noco), INTENT(IN)    :: noco
      67             :       TYPE(t_mat), INTENT(INOUT) :: hmat
      68             : 
      69             :       INTEGER, INTENT(IN)    :: jsp
      70             :       INTEGER, INTENT(IN)    :: nk
      71             : 
      72             :       ! local scalars
      73             :       INTEGER                 :: n, nn, iband, nbasfcn
      74             :       REAL                    :: a_ex
      75           0 :       TYPE(t_mat)             :: olap, tmp, v_x, z
      76           0 :       COMPLEX                 :: exch(dimension%neigd, dimension%neigd)
      77             : 
      78             :       ! initialize weighting factor for HF exchange part
      79           0 :       a_ex = xcpot%get_exchange_weight()
      80             : 
      81           0 :       nbasfcn = MERGE(lapw%nv(1) + lapw%nv(2) + 2*atoms%nlotot, lapw%nv(1) + atoms%nlotot, noco%l_noco)
      82           0 :       CALL v_x%init(hmat%l_real, nbasfcn, nbasfcn)
      83             : 
      84           0 :       CALL read_v_x(v_x, kpts%nkpt*(jsp - 1) + nk)
      85             :       ! add non-local x-potential to the hamiltonian hmat
      86           0 :       DO n = 1, v_x%matsize1
      87           0 :          DO nn = 1, n
      88           0 :             IF (hmat%l_real) THEN
      89           0 :                hmat%data_r(nn, n) = hmat%data_r(nn, n) - a_ex*v_x%data_r(nn, n)
      90             :             ELSE
      91           0 :                hmat%data_c(nn, n) = hmat%data_c(nn, n) - a_ex*v_x%data_c(nn, n)
      92             :             ENDIF
      93             :          END DO
      94             :       END DO
      95             :       ! calculate HF energy
      96           0 :       IF (hybrid%l_calhf) THEN
      97           0 :          WRITE (6, '(A)') new_line('n')//new_line('n')//' ###     '//'        diagonal HF exchange elements (eV)              ###'
      98             : 
      99           0 :          WRITE (6, '(A)') new_line('n')//'         k-point      '//'band          tail           pole       total(valence+core)'
     100             :       END IF
     101             : 
     102             :       ! read in lower triangle part of overlap matrix from direct acces file olap
     103           0 :       CALL olap%init(hmat%l_real, nbasfcn, nbasfcn)
     104           0 :       CALL read_olap(olap, kpts%nkpt*(jsp - 1) + nk)
     105           0 :       IF (.NOT. olap%l_real) olap%data_c = conjg(olap%data_c)
     106             : 
     107           0 :       CALL z%init(olap%l_real, nbasfcn, dimension%neigd)
     108             : 
     109           0 :       CALL read_z(z, kpts%nkpt*(jsp - 1) + nk)
     110             : 
     111             :       ! calculate exchange contribution of current k-point nk to total energy (te_hfex)
     112             :       ! in the case of a spin-unpolarized calculation the factor 2 is added in eigen.F90
     113           0 :       IF (.NOT. v_x%l_real) v_x%data_c = conjg(v_x%data_c)
     114           0 :       exch = 0
     115           0 :       z%matsize1 = MIN(z%matsize1, v_x%matsize2)
     116             : 
     117           0 :       CALL v_x%multiply(z, tmp)
     118             : 
     119           0 :       DO iband = 1, hybrid%nbands(nk)
     120           0 :          IF (z%l_real) THEN
     121           0 :             exch(iband, iband) = dot_product(z%data_r(:z%matsize1, iband), tmp%data_r(:, iband))
     122             :          ELSE
     123           0 :             exch(iband, iband) = dot_product(z%data_c(:z%matsize1, iband), tmp%data_c(:, iband))
     124             :          END IF
     125           0 :          IF (iband <= hybrid%nobd(nk)) THEN
     126           0 :             results%te_hfex%valence = results%te_hfex%valence - a_ex*results%w_iks(iband, nk, jsp)*exch(iband, iband)
     127             :          END IF
     128           0 :          IF (hybrid%l_calhf) THEN
     129             :             WRITE (6, '(      ''  ('',F5.3,'','',F5.3,'','',F5.3,'')'',I4,4X,3F15.5)') &
     130           0 :                kpts%bkf(:, nk), iband, (REAL(exch(iband, iband)) - hybrid%div_vv(iband, nk, jsp))*(-27.211608), &
     131           0 :                hybrid%div_vv(iband, nk, jsp)*(-27.211608), REAL(exch(iband, iband))*(-27.211608)
     132             :          END IF
     133             :       END DO
     134           0 :    END SUBROUTINE add_vnonlocal
     135             : 
     136             : END MODULE m_add_vnonlocal

Generated by: LCOV version 1.13