v_mmp.F90 7.89 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
10
11
12
13
14
15
16
17
MODULE m_vmmp
  !     ************************************************************
  !     This subroutine calculates the potential matrix v^{s}_{m,m'}
  !     for a given atom 'n' and l-quantum number 'l'. The l,u,j's for
  !     all atoms are stored in lda_u, the density matrix is ns_mmp,
  !     and the e-e- interaction potential is u(m1,m2,m3,m4,n).
  !     For details see Eq.(16) of Shick et al. PRB 60, 10765 (1999)
  !
  !     Additionally, the total energy contribution of LDA+U (Eq.24)
  !     is calculated (e_ldau).
  !     Part of the LDA+U package                   G.B., Oct. 2000
Daniel Wortmann's avatar
Daniel Wortmann committed
18
19
  !     
  !     Extension to multiple U per atom type  G.M. 2017
20
21
  !     ************************************************************
CONTAINS
22
  SUBROUTINE v_mmp(sym,atoms,jspins,ns_mmp,u,f0,f2, vs_mmp,results)
23
24

    USE m_types
Daniel Wortmann's avatar
Daniel Wortmann committed
25
    USE m_constants
26
    IMPLICIT NONE
27
    TYPE(t_sym),INTENT(IN)          :: sym
28
29
30
31
    TYPE(t_results),INTENT(INOUT)   :: results
    TYPE(t_atoms),INTENT(IN)        :: atoms
    !
    ! ..  Arguments ..
32
33
34
35
36
    INTEGER, INTENT(IN)    :: jspins 
    REAL,    INTENT(IN)    :: u(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,&
                                -lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,atoms%n_u)
    REAL,    INTENT(IN)    :: f0(atoms%n_u),f2(atoms%n_u)
    COMPLEX, INTENT(OUT)   :: vs_mmp(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,atoms%n_u,jspins)
37

38
    COMPLEX, INTENT(INOUT) :: ns_mmp(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,atoms%n_u,jspins)
39
40

    ! ..  Local Variables ..
Daniel Wortmann's avatar
Daniel Wortmann committed
41
    INTEGER ispin,jspin,l ,mp,p,q,itype,m,i_u
42
43
44
45
46
47
48
49
50
51
52
    REAL rho_tot,u_htr,j_htr,e_ee,ns_sum,spin_deg,e_dc,e_dcc
    REAL rho_sig(jspins),v_diag(jspins),eta(0:jspins)
    !
    ! Use around-mean-field limit (true) of atomic limit (false)
    !
    !
    ! Loop over atoms
    !
    spin_deg = 1.0 / (3 - jspins)
    results%e_ldau = 0.0

Daniel Wortmann's avatar
Daniel Wortmann committed
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
84
85
86
87
88
89
90
91
92
93
94
95
    DO i_u = 1, atoms%n_u
       iType = atoms%lda_u(i_u)%atomType
       l = atoms%lda_u(i_u)%l
       u_htr = atoms%lda_u(i_u)%u / hartree_to_ev_const
       j_htr = atoms%lda_u(i_u)%j / hartree_to_ev_const
       u_htr = f0(i_u)/hartree_to_ev_const
       IF (l.EQ.1) THEN
          j_htr = f2(i_u)/(5*hartree_to_ev_const)
       ELSE IF (l.EQ.2) THEN
          j_htr = 1.625*f2(i_u)/(14*hartree_to_ev_const)
       ELSE IF (l.EQ.3) THEN
          j_htr = (286.+195*451/675+250*1001/2025)*f2(i_u)/(6435*hartree_to_ev_const)
       END IF
       !
       ! calculate spin-density 'rho_sig' and total density 'rho_tot'
       !
       rho_tot = 0.0
       DO ispin = 1,jspins
          rho_sig(ispin) = 0.0
          DO m = -l,l
             rho_sig(ispin) = rho_sig(ispin) + REAL(ns_mmp(m,m,i_u,ispin))
          END DO
          rho_tot = rho_tot + rho_sig(ispin)
       END DO
       rho_sig(1) = rho_sig(1) * spin_deg  ! if jspins = 1, divide by 2
       IF (atoms%lda_u(i_u)%l_amf) THEN
          eta(1) = rho_sig(1) / (2*l + 1) 
          eta(jspins) = rho_sig(jspins) / (2*l + 1) 
          eta(0) = (eta(1) + eta(jspins) ) / 2
       ELSE
          eta(0) = 1.0
          eta(1) = 1.0
          eta(jspins) = 1.0
       END IF
       !
       !--------------------------------------------------------------------------------------------+
       !  s       --                                        s'                    1        s   1    |
       ! V     =  >  ( <m,p|V|m',q> - <m,p|V|q,m'> d     ) n     + d    ( -U (n - -) + J (n  - -) ) |
       !  m,m'    --                                s,s'    p,q     m,m'          2            2    |
       !        p,q,s'                                                                              |
       !--------------------------------------------------------------------------------------------+     
       ! initialise vs_mmp
       !
96
97
98
99
100
101
102
103
104
105
       !IF (sym%invs) THEN
       !   vs_mmp(:,:,i_u,:) = ns_mmp(:,:,i_u,:)
       !   DO ispin = 1,jspins
       !      DO m = -l,l
       !         DO mp = -l,l
       !            ns_mmp(m,mp,i_u,ispin) = vs_mmp(-m,-mp,i_u,ispin)
       !         END DO
       !      END DO
       !   END DO
       !END IF
Daniel Wortmann's avatar
Daniel Wortmann committed
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
       vs_mmp(:,:,i_u,:) = CMPLX(0.0,0.0)
       !
       ! outer spin loop - set up v_mmp
       !
       DO ispin = 1,jspins
          DO m = -l,l
             DO mp =-l,l 
                DO jspin = 1,jspins
                   IF (ispin.EQ.jspin) THEN
                      DO p = -l,l
                         DO q = -l,l
                            vs_mmp(m,mp,i_u,ispin) = vs_mmp(m,mp,i_u,ispin) +  &
                               ns_mmp(p, q,i_u,jspin) * ( u(m,p,mp,q,i_u) - u(m,p,q,mp,i_u) ) 
                         END DO
                      END DO
                   END IF
                   IF ((ispin.NE.jspin).OR.(jspins.EQ.1)) THEN
                      DO p = -l,l
                         DO q = -l,l
                            vs_mmp(m,mp,i_u,ispin) = vs_mmp(m,mp,i_u,ispin) +  &
                               u(m,p,mp,q,i_u) * ns_mmp(p, q,i_u,jspin) 
                         END DO
                      END DO
                   END IF
                END DO
131

Daniel Wortmann's avatar
Daniel Wortmann committed
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
             END DO ! m' loop
          END DO   ! m  loop
       END DO      ! outer spin loop
       !
       !  set diagonal terms and correct for non-spin-polarised case
       !
       DO ispin = 1,jspins
          v_diag(ispin) = - u_htr * ( rho_tot - 0.5*eta(0) ) + j_htr * ( rho_sig(ispin) - 0.5*eta(ispin) )
          DO m = -l,l
             DO mp = -l,l
                vs_mmp(m,mp,i_u,ispin) = vs_mmp(m,mp,i_u,ispin) * spin_deg
             END DO
             vs_mmp(m,m,i_u,ispin) = vs_mmp(m,m,i_u,ispin) + v_diag(ispin)
          END DO
       END DO
147

Daniel Wortmann's avatar
Daniel Wortmann committed
148
149
150
151
152
153
154
       !----------------------------------------------------------------------+
       !              s                                                       !
       !  ee      1  ---   s        s                     1        s  1       !
       ! E  (n) = -  >    n      ( V     + d     ( U (n - -) - J (n - -) ))   !
       !          2  ---   m,m'     m,m'    m,m'          2           2       !
       !             m,m'                                                     !
       !----------------------------------------------------------------------+
155

Daniel Wortmann's avatar
Daniel Wortmann committed
156
157
158
159
160
161
162
163
164
       e_ee = 0.0
       DO ispin = 1,jspins
          DO m = -l,l
             DO mp =-l,l
                e_ee=e_ee+REAL(vs_mmp(m,mp,i_u,ispin)*ns_mmp(m,mp,i_u,ispin))
             END DO
             e_ee = e_ee - v_diag(ispin) * REAL( ns_mmp(m,m,i_u,ispin) )
          END DO
       END DO
165

Daniel Wortmann's avatar
Daniel Wortmann committed
166
167
168
169
170
171
172
173
174
175
176
177
178
       !----------------------------------------------------------------------+
       !   dc       ee      U           J  --   s   s       1                 |
       !  E      = E  (n) - - n (n-1) + -  >   n  (n -1)  - - (U-J) n         |
       !   LDA+U            2           2  --               2                 |
       !                                    s                                 |
       !----------------------------------------------------------------------+

       ns_sum = 0.0
       DO ispin = 1,jspins
          ns_sum = ns_sum + rho_sig(ispin) * (rho_sig(ispin) - eta(ispin))
       END DO
       e_dc = u_htr * rho_tot * ( rho_tot - eta(0) ) - j_htr * ns_sum
       e_dcc = (u_htr - j_htr) * rho_tot
179

Daniel Wortmann's avatar
Daniel Wortmann committed
180
181
182
183
184
185
       ns_sum = ns_sum / spin_deg
       !       e_ldau = e_ldau + (e_ee -  u_htr * rho_tot * ( rho_tot - 1. ) 
       !    +    + j_htr * ns_sum  - (u_htr - j_htr) * rho_tot) * neq(itype)
       !       write(*,*) e_ldau
       results%e_ldau = results%e_ldau + ( e_ee - e_dc - e_dcc) * atoms%neq(itype)
       !       write(*,*) e_ldau
186

Daniel Wortmann's avatar
Daniel Wortmann committed
187
    END DO ! loop over U parameters
188
189
190
191
192

    results%e_ldau = results%e_ldau / 2

  END SUBROUTINE v_mmp
END MODULE m_vmmp