excepbe.f 2.82 KB
Newer Older
1 2 3 4 5 6 7
      MODULE m_excepbe
c.....-----------------------------------------------------------------
c.....epbe(easy_pbe) exchange-correlation energy density  in hartree.
c     excepbe - easypbe
c.....------------------------------------------------------------------
      CONTAINS
      SUBROUTINE excepbe(
8
     >                   xcpot,jspins,mirm,irmx,
9 10 11 12 13
     >                   rh,agr,agru,agrd,
     +                   g2ru,g2rd,gggr,gggru,gggrd,
     <                   exc)

      USE m_easypbe
14
      USE m_types_xcpot_data
15 16 17

      IMPLICIT NONE

18
! .. Arguments ..
19
      TYPE(t_xcpot_data),INTENT(IN)::xcpot
20
      INTEGER, INTENT (IN) :: irmx,jspins,mirm
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
      REAL,    INTENT (IN) :: rh(mirm,jspins)
      REAL,    INTENT (IN) :: agr(mirm),agru(mirm),agrd(mirm)
      REAL,    INTENT (IN) :: g2ru(mirm),g2rd(mirm),gggr(mirm)
      REAL,    INTENT (IN) :: gggru(mirm),gggrd(mirm)
      REAL,    INTENT (OUT) :: exc(mirm)


      ! .. local variables ..
      INTEGER lcor,lpot,i
      REAL ro,rou,rod,xedl,cedl,xedg,cedg,xced
      REAL up,agrup,delgrup,uplap,dn,agrdn,delgrdn,dnlap,
     +     agrt,delgrt,
     +     exlsd,vxuplsd,vxdnlsd,eclsd,vcuplsd,vcdnlsd,
     +     expbe,vxuppbe,vxdnpbe,ecpbe,vcuppbe,vcdnpbe,
     +     vxupsr,vxdnsr

      REAL, PARAMETER :: sml = 1.e-14
      REAL, PARAMETER :: smlc = 2.01e-14

!$OMP parallel do default(private)
41
!$OMP& SHARED(xcpot,jspins,mirm,irmx)
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 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
!$OMP& SHARED(rh,agr,agru,agrd)
!$OMP& SHARED(g2ru,g2rd,gggr,gggru,gggrd)
!$OMP& SHARED(exc)
      DO i = 1,irmx

        IF (jspins == 1) THEN
          rou=rh(i,1)/2
          rou=max(rou,sml)
          rod=rou
        ELSE
          rou=rh(i,1)
          rod=rh(i,jspins)
          rou=max(rou,sml)
          rod=max(rod,sml)
        ENDIF

        ro=rou+rod

c.....
c       xedl,xedg: exchange energy density (local,grad.exp.) in ry.
c       cedl,cedg: exchange energy density (local,grad.expnd.) in ry.
c.....
          xedl = 0.0e0
          cedl = 0.0e0
          xedg = 0.0e0
          cedg = 0.0e0

        IF (ro > smlc) THEN

          lcor=1
          lpot=1
          up=rou
          agrup=agru(i)
          delgrup=gggru(i)
          uplap=g2ru(i)
          dn=rod
          agrdn=agrd(i)
          delgrdn=gggrd(i)
          dnlap=g2rd(i)
          agrt=agr(i)
          delgrt=gggr(i)

84
          CALL easypbe (xcpot,
85 86 87 88 89 90 91 92 93 94 95 96 97
     &           up,agrup,delgrup,uplap,dn,agrdn,delgrdn,dnlap,
     1           agrt,delgrt,lcor,lpot,
     1           exlsd,vxuplsd,vxdnlsd,eclsd,vcuplsd,vcdnlsd,
     1           expbe,vxuppbe,vxdnpbe,ecpbe,vcuppbe,vcdnpbe,
     1           vxupsr,vxdnsr)

          xedl=exlsd
          cedl=eclsd
          xedg=expbe-exlsd
          cedg=ecpbe-eclsd

        ENDIF ! ro > smlc

98
        xced = (xedl+cedl+xedg+cedg)
99 100 101 102 103 104 105

        exc(i) = xced*2  ! in ry

      ENDDO
!$OMP end parallel do
      END SUBROUTINE excepbe
      END MODULE m_excepbe