potl0.f90 1.36 KB
Newer Older
Matthias Redies's avatar
Matthias Redies committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
MODULE m_potl0
! ******************************************************************
! evaluate the xc-potential vxc for charge density and its
! gradients,dens,... only for nonmagnetic.
! ******************************************************************
CONTAINS
   SUBROUTINE potl0(xcpot,mshd,jspd,jspins,msh,dx,rad,dens, &
                    vxc)

      USE m_grdchlh
      USE m_mkgl0
      USE m_types
      IMPLICIT NONE

      CLASS(t_xcpot),intent(in)::xcpot
      INTEGER, INTENT (IN) :: jspins,jspd,mshd,msh
      REAL,    INTENT (IN) :: dx
      REAL,    INTENT (IN) :: rad(msh),dens(mshd,jspd)
      REAL,    INTENT (OUT):: vxc(mshd,jspd)

!     .. previously untyped names ..
      INTEGER,PARAMETER :: ndvgrd=6

      TYPE(t_gradients)::grad

      INTEGER i,ispin
      REAL, ALLOCATABLE :: drr(:,:),ddrr(:,:)

      REAL              :: vx(mshd,jspd)

      ALLOCATE ( drr(mshd,jspd),ddrr(mshd,jspd))
!
!-->  evaluate gradients of dens.
!
      CALL xcpot%alloc_gradients(msh,jspins,grad)
      DO ispin = 1, jspins
         CALL grdchlh(1,1,msh,dx,rad,dens(1,ispin),ndvgrd,&
                     drr(1,ispin),ddrr(1,ispin))
      ENDDO

Matthias Redies's avatar
Matthias Redies committed
41
      CALL mkgl0(jspins,rad,dens,drr,ddrr,&
Matthias Redies's avatar
Matthias Redies committed
42 43 44 45
                 grad)
!
! --> calculate the potential.
!
46
      CALL xcpot%get_vxc(jspins, dens(:msh,:), vxc, vx, grad)
Matthias Redies's avatar
Matthias Redies committed
47 48 49 50

      DEALLOCATE ( drr,ddrr )
   END SUBROUTINE potl0
END MODULE m_potl0