potl0.f90 1.36 KB
Newer Older
Matthias Redies's avatar
Matthias Redies committed
1
2
3
4
5
6
MODULE m_potl0
! ******************************************************************
! evaluate the xc-potential vxc for charge density and its
! gradients,dens,... only for nonmagnetic.
! ******************************************************************
CONTAINS
7
   SUBROUTINE potl0(xcpot,jspins,dx,rad,dens, &
Matthias Redies's avatar
Matthias Redies committed
8
9
10
11
12
13
14
15
                    vxc)

      USE m_grdchlh
      USE m_mkgl0
      USE m_types
      IMPLICIT NONE

      CLASS(t_xcpot),intent(in)::xcpot
16
      INTEGER, INTENT (IN) :: jspins
Matthias Redies's avatar
Matthias Redies committed
17
      REAL,    INTENT (IN) :: dx
18
19
      REAL,    INTENT (IN) :: rad(:),dens(:,:)
      REAL,    INTENT (OUT):: vxc(:,:)
Matthias Redies's avatar
Matthias Redies committed
20
21
22
23
24
25

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

      TYPE(t_gradients)::grad

26
      INTEGER i,ispin,msh
Matthias Redies's avatar
Matthias Redies committed
27
28
      REAL, ALLOCATABLE :: drr(:,:),ddrr(:,:)

29
      REAL              :: vx(size(rad),jspins)
Matthias Redies's avatar
Matthias Redies committed
30

31
32
      msh = size(rad)
      ALLOCATE ( drr(msh,jspins),ddrr(msh,jspins))
Matthias Redies's avatar
Matthias Redies committed
33
34
35
36
37
!
!-->  evaluate gradients of dens.
!
      CALL xcpot%alloc_gradients(msh,jspins,grad)
      DO ispin = 1, jspins
38
39
         CALL grdchlh(1,1,msh,dx,rad,dens(1:1,ispin),ndvgrd,&
                     drr(1:1,ispin),ddrr(1:1,ispin))
Matthias Redies's avatar
Matthias Redies committed
40
41
      ENDDO

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

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