types_xcpot.F90 3.28 KB
Newer Older
1 2 3 4 5 6
!--------------------------------------------------------------------------------
! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------

7 8 9
MODULE m_types_xcpot
  IMPLICIT NONE
  PRIVATE
10
  PUBLIC :: t_xcpot,t_gradients
11
       
12 13
  TYPE,ABSTRACT :: t_xcpot
     REAL :: gmaxxc
14 15
   CONTAINS
     PROCEDURE        :: is_gga=>xcpot_is_gga
16
     PROCEDURE        :: is_hybrid=>xcpot_is_hybrid
17
     PROCEDURE        :: get_exchange_weight=>xcpot_get_exchange_weight
18 19 20 21
     PROCEDURE        :: get_vxc=>xcpot_get_vxc
     PROCEDURE        :: get_exc=>xcpot_get_exc
     PROCEDURE        :: broadcast=>xcpot_broadcast
     PROCEDURE,NOPASS :: alloc_gradients=>xcpot_alloc_gradients
22 23
  END TYPE t_xcpot

24 25 26 27 28 29 30 31 32 33 34 35 36
  TYPE t_gradients
     !Naming convention:
     !t,u,d as last letter for total,up,down
     !agr for absolute value of gradient
     !g2r for laplacien of gradient
     !+??
     REAL,ALLOCATABLE :: agrt(:),agru(:),agrd(:) 
     REAL,ALLOCATABLE :: g2ru(:),g2rd(:),gggrt(:)
     REAL,ALLOCATABLE :: gggru(:),gzgr(:),g2rt(:)
     REAL,ALLOCATABLE :: gggrd(:),grgru(:),grgrd(:)
     !These are the contracted Gradients used in libxc
     REAL,ALLOCATABLE :: sigma(:,:)
  END TYPE t_gradients
37

38
CONTAINS
39
  
40
  LOGICAL FUNCTION xcpot_is_gga(xcpot)
41 42
    IMPLICIT NONE
    CLASS(t_xcpot),INTENT(IN):: xcpot
43
    xcpot_is_gga=.false.
44 45
  END FUNCTION xcpot_is_gga

46
  LOGICAL FUNCTION xcpot_is_hybrid(xcpot)
47 48
    IMPLICIT NONE
    CLASS(t_xcpot),INTENT(IN):: xcpot
49
    xcpot_is_hybrid=.FALSE.
50
  END FUNCTION xcpot_is_hybrid
51
  
52 53 54 55 56 57 58
  FUNCTION xcpot_get_exchange_weight(xcpot) RESULT(a_ex)
    USE m_judft
    IMPLICIT NONE
    CLASS(t_xcpot),INTENT(IN):: xcpot
    REAL:: a_ex
    a_ex=-1
  END FUNCTION xcpot_get_exchange_weight
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98

  SUBROUTINE xcpot_get_vxc(xcpot,jspins,rh,vxc,vx,grad)
    CLASS(t_xcpot),INTENT(IN) :: xcpot
    INTEGER, INTENT (IN)     :: jspins
    !--> charge density
    REAL,INTENT (IN)         :: rh(:,:)
    !---> xc potential
    REAL, INTENT (OUT)       :: vxc (:,:),vx(:,:)
    TYPE(t_gradients),OPTIONAL,INTENT(IN)::grad
  END SUBROUTINE xcpot_get_vxc

  
  SUBROUTINE xcpot_get_exc(xcpot,jspins,rh,exc,grad)
    CLASS(t_xcpot),INTENT(IN) :: xcpot
    INTEGER, INTENT (IN)     :: jspins
    !--> charge density
    REAL,INTENT (IN)         :: rh(:,:)
    !---> xc energy density
    REAL, INTENT (OUT)       :: exc (:)
    TYPE(t_gradients),OPTIONAL,INTENT(IN)::grad
  END SUBROUTINE xcpot_get_exc

  SUBROUTINE xcpot_alloc_gradients(ngrid,jspins,grad)
    INTEGER, INTENT (IN)         :: jspins,ngrid
    TYPE(t_gradients),INTENT(OUT):: grad

    !For the in-build xc-pots
    ALLOCATE(grad%agrt(ngrid),grad%agru(ngrid),grad%agrd(ngrid))
    ALLOCATE(grad%g2ru(ngrid),grad%g2rd(ngrid),grad%gggrt(ngrid))
    ALLOCATE(grad%gggru(ngrid),grad%gzgr(ngrid),grad%g2rt(ngrid))
    ALLOCATE(grad%gggrd(ngrid),grad%grgru(ngrid),grad%grgrd(ngrid))
  END SUBROUTINE xcpot_alloc_gradients

  SUBROUTINE xcpot_broadcast(xcpot,mpi)
    USE m_types_mpi
    IMPLICIT NONE
    CLASS(t_xcpot),INTENT(INOUT) :: xcpot
    TYPE(t_mpi),INTENT(IN)       :: mpi
  END SUBROUTINE xcpot_broadcast
  
99
END MODULE m_types_xcpot