potl0.f90 1.37 KB
Newer Older
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
41
42
43
44
45
46
47
48
49
50
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

      CALL mkgl0(mshd,msh,jspd,jspins,rad,dens,drr,ddrr,&
                 grad)
!
! --> calculate the potential.
!
      call xcpot%get_vxc(jspins, dens, vxc, vx, grad)

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