~ubuntu-branches/ubuntu/utopic/nwchem/utopic

« back to all changes in this revision

Viewing changes to src/nwxc/nwxc_c_lsda.F

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Daniel Leidert, Andreas Tille, Michael Banck
  • Date: 2013-07-04 12:14:55 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130704121455-5tvsx2qabor3nrui
Tags: 6.3-1
* New upstream release.
* Fixes anisotropic properties (Closes: #696361).
* New features include:
  + Multi-reference coupled cluster (MRCC) approaches
  + Hybrid DFT calculations with short-range HF 
  + New density-functionals including Minnesota (M08, M11) and HSE hybrid
    functionals
  + X-ray absorption spectroscopy (XAS) with TDDFT
  + Analytical gradients for the COSMO solvation model
  + Transition densities from TDDFT 
  + DFT+U and Electron-Transfer (ET) methods for plane wave calculations
  + Exploitation of space group symmetry in plane wave geometry optimizations
  + Local density of states (LDOS) collective variable added to Metadynamics
  + Various new XC functionals added for plane wave calculations, including
    hybrid and range-corrected ones
  + Electric field gradients with relativistic corrections 
  + Nudged Elastic Band optimization method
  + Updated basis sets and ECPs 

[ Daniel Leidert ]
* debian/watch: Fixed.

[ Andreas Tille ]
* debian/upstream: References

[ Michael Banck ]
* debian/upstream (Name): New field.
* debian/patches/02_makefile_flags.patch: Refreshed.
* debian/patches/06_statfs_kfreebsd.patch: Likewise.
* debian/patches/07_ga_target_force_linux.patch: Likewise.
* debian/patches/05_avoid_inline_assembler.patch: Removed, no longer needed.
* debian/patches/09_backported_6.1.1_fixes.patch: Likewise.
* debian/control (Build-Depends): Added gfortran-4.7 and gcc-4.7.
* debian/patches/10_force_gcc-4.7.patch: New patch, explicitly sets
  gfortran-4.7 and gcc-4.7, fixes test suite hang with gcc-4.8 (Closes:
  #701328, #713262).
* debian/testsuite: Added tests for COSMO analytical gradients and MRCC.
* debian/rules (MRCC_METHODS): New variable, required to enable MRCC methods.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
C> \ingroup nwxc
 
2
C> @{
 
3
C> 
 
4
C> \file nwxc_c_lsda.F
 
5
C> Another implementation of the PW91 LDA correlation functional
 
6
C>
 
7
C> @}
 
8
C>
 
9
C> \ingroup nwxc_priv
 
10
C> @{
 
11
C>
 
12
C> \brief An alternative implementation of the functional 
 
13
C> `nwxc_c_pw91lda`
 
14
C>
 
15
C> This stems from the original authors of the functional and hence
 
16
C> it follows different calling conventions from the other routines
 
17
C> in the library. For this reason it is also only meant to be used
 
18
C> as an internal component of PW91 related functionals.
 
19
C>
 
20
c
 
21
c Perdew 91 local correlation functional at one grid point 
 
22
c
 
23
 
 
24
      Subroutine nwxc_c_lsda(tol_rho,
 
25
     R     rs,zeta,PotLC,dLdS,dLdZ,d2LdSS,d2LdSZ,d2LdZZ)
 
26
 
 
27
C     Evaluate the Perdew 91 local correlation functional and its
 
28
C     derivatives at one point. 
 
29
      implicit none
 
30
      double precision tol_rho
 
31
      double precision rs
 
32
      double precision PotLC,dLdS, dLdZ, d2dSS, d2dSZ, d2dZZ
 
33
      double precision eps0c(6), eps1c(6), epsc(6)
 
34
      double precision F1, F2, F3, F4, F6, F8, F9, F12, F24, F36
 
35
      double precision GammaI,Zeta,FZeta,dfZdz,d2fZdz 
 
36
      double precision EU,dEUdRS,d2UdRS
 
37
      double precision EP,dEPdRS,d2PdRS
 
38
      double precision AlphaM,dAMdRS,d2AdRS
 
39
      double precision GZ, HZ, dGZ, dHZ, d2GZ, d2HZ
 
40
      double precision d2LdSS,d2LdSZ,d2LdZZ,fzzi,
 
41
     Z     z2,z3,z4,third,pi
 
42
 
 
43
      data eps0c/0.03109070D0,0.21370D0, 7.5957D0,3.5876D0,1.6382D0,
 
44
     &         0.49294D0/
 
45
      data eps1c/0.01554535D0,0.20548D0,14.1189D0,6.1977D0,3.3662D0,
 
46
     &         0.62517D0/
 
47
      data epsc/0.01688690D0,0.11125D0,10.3570D0,3.6231D0,0.88026D0,
 
48
     &         0.49671D0/
 
49
      data F1/1.0d0/, F2/2.0d0/, F3/3.0d0/, F4/4.0d0/, F6/6.0d0/,
 
50
     &  F8/8.0d0/, F9/9.0d0/, F12/12.0d0/, F24/24.0d0/, F36/36.0d0/
 
51
 
 
52
      Pi = F4*ATan(F1)
 
53
      Third = F1 / F3
 
54
 
 
55
 
 
56
      epsc(1) = F1 / (F6*Pi*Pi)
 
57
      FZZI = F9*(F2**Third-F1) / F4
 
58
      GammaI = F1 / (F2*F2**Third-F2)
 
59
      
 
60
      Call nwxc_EvFZet(tol_rho,GammaI,Zeta,FZeta,dfZdz,d2fZdz)
 
61
      Call nwxc_EvPWLC(eps0c(1),eps0c(2),eps0c(3),eps0c(4),eps0c(5),
 
62
     &    eps0c(6), RS,EU,dEUdRS,d2UdRS)
 
63
      Call nwxc_EvPWLC(eps1c(1),eps1c(2),eps1c(3),eps1c(4),eps1c(5),
 
64
     &    eps1c(6),RS,EP,dEPdRS,d2PdRS)
 
65
      Call nwxc_EvPWLC(epsc(1),epsc(2),epsc(3),epsc(4),epsc(5),
 
66
     &    epsc(6),RS,AlphaM,dAMdRS,d2AdRS)
 
67
      Z2 = Zeta*Zeta
 
68
      Z3 = Zeta*Z2
 
69
      Z4 = Zeta*Z3
 
70
      GZ = FZeta*Z4
 
71
      HZ = FZZI*(FZeta-GZ)
 
72
      PotLC = EU*(F1-GZ) + EP*GZ - AlphaM*HZ
 
73
      dLdS = dEUdRS*(F1-GZ) + dEPdRS*GZ - dAMdRS*HZ
 
74
      dGZ = dfZdz*Z4 + F4*FZeta*Z3
 
75
      dHZ = FZZI*(dFZdz-dGZ)
 
76
      dLdz = (EP-EU)*dGZ - AlphaM*dHZ
 
77
      d2GZ = d2fZdz*Z4 + F8*Z3*dfZdz + F12*FZeta*Z2
 
78
      d2HZ = FZZI*(d2FZdz-d2GZ)
 
79
      d2LdSS = d2UdRS*(F1-GZ) + d2PdRS*GZ - d2AdRS*HZ
 
80
      d2LdSZ = (dEPdRS-dEUdRS)*dGZ - dAMdRS*dHZ
 
81
      d2LdZZ = (EP-EU)*d2GZ - AlphaM*d2HZ
 
82
      Return
 
83
      End
 
84
 
 
85
c
 
86
c   f(zeta)
 
87
c
 
88
      Subroutine nwxc_EvFZet(tol_rho,S,Zeta,FZeta,dfZdz,d2fZdz)
 
89
      Implicit none
 
90
c
 
91
c     evaluate f(Zeta) and its derivatives for lsdac.
 
92
c
 
93
      double precision tol_rho
 
94
      double precision Small
 
95
      double precision S, Zeta, FZeta,dfZdz,d2fZdz
 
96
      double precision Zero, One, Two, Three, Four, Nine, F8, F27
 
97
      double precision OMZ, OPZ, OMZ2, OPZ2, OMZ3, OPZ3
 
98
      double precision F13, F43, F49, F827
 
99
      data Zero/0.0d0/, One/1.0d0/, Two/2.0d0/, Three/3.0d0/,
 
100
     $  Four/4.0d0/, Nine/9.0d0/, F8/8.0D0/, F27/27.0D0/
 
101
C
 
102
c      Small = 1.0d-14
 
103
      small=tol_rho
 
104
      FZeta = -Two
 
105
      dfZdz = Zero
 
106
      d2fZdz = Zero
 
107
      OMZ = One - Zeta
 
108
      OPZ = One + Zeta
 
109
      OMZ2 = OMZ**2
 
110
      OPZ2 = OPZ**2
 
111
      F13 = One / Three
 
112
      F43 = Four / Three
 
113
      F49 = Four / Nine
 
114
      F827 = F8 / F27
 
115
      If(OMZ.gt.Small) then
 
116
        OMZ3 = OMZ ** F13
 
117
        fZeta = fZeta + OMZ*OMZ3
 
118
        dfZdz = dfZdz - OMZ3
 
119
        d2fZdz = d2fZdz + OMZ3/OMZ
 
120
        endIf
 
121
      If(OPZ.gt.Small) then
 
122
        OPZ3 = OPZ ** F13
 
123
        fZeta = fZeta + OPZ*OPZ3
 
124
        dfZdz = dfZdz + OPZ3
 
125
        d2fZdz = d2fZdz + OPZ3/OPZ
 
126
        endIf
 
127
      fZeta = fZeta * S
 
128
      dfZdz = dfZdz * F43 * S
 
129
      d2fZdz = d2fZdz * F49 * S
 
130
      Return
 
131
      End
 
132
 
 
133
c
 
134
c  pw91 local correlation
 
135
 
136
      Subroutine nwxc_EvPWLC(A,A1,B1,B2,B3,B4,RS,V,dVdRS,d2VdRS)
 
137
      Implicit none
 
138
C
 
139
C     Evaluate the interpolation function for PW91 local correlation.
 
140
C
 
141
      double precision A,A1,B1,B2,B3,B4,RS,V,dVdRS,d2VdRS
 
142
      double precision F1,F2, F3, F4
 
143
      double precision Q0, RS12, RS32,Q1,Q2
 
144
      double precision dQ0dRS,dQ1dRS,dQ2dRS
 
145
      double precision d2Q1dS, d2Q2dS
 
146
      data F1/1.0d0/, F2/2.0d0/, F3/3.0d0/, F4/4.0d0/
 
147
C
 
148
      Q0 = -F2*A*(F1+A1*RS)
 
149
      RS12 = Sqrt(RS)
 
150
      RS32 = RS*RS12
 
151
      Q1 = F2*A*(B1*RS12+B2*RS+B3*RS32+B4*RS*RS)
 
152
      Q2 = Log(F1+F1/Q1)
 
153
      V = Q0*Q2
 
154
C
 
155
      dQ0dRS = -F2*A*A1
 
156
      dQ1dRS = A*(B1/RS12+F2*B2+F3*B3*RS12+F4*B4*RS)
 
157
      dQ2dRS = -dQ1dRS/(Q1+Q1**2)
 
158
      dVdRS = dQ0dRS*Q2 + Q0*dQ2dRS
 
159
C
 
160
      d2Q1dS = A*(F3*B3/(RS12*F2)-B1/(RS32*F2)+F4*B4)
 
161
      d2Q2dS = (F2*Q1+F1)*(dQ1dRS/(Q1+Q1**2))**2 - d2Q1dS/(Q1+Q1**2)
 
162
      d2VdRS = F2*dQ0dRS*dQ2dRS + Q0*d2Q2dS
 
163
      Return
 
164
      End
 
165
C> @}