[go: up one dir, main page]

Menu

[9a5978]: / src / f_psi.f90  Maximize  Restore  History

Download this file

68 lines (63 with data), 3.0 kB

 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
!*******************************************************************************
! Copyright (C) 1996-2022 Alan W. Irwin
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation; either version 2 of the License, or
! (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program; if not, write to the Free Software
! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
!*******************************************************************************
! Note:
! The original version of this routine is in the public domain. It was
! written in the late 60's or early 70's by Darwin Harwood for the US
! government, and it was brought to the attention of AWI by Forrest J.
! Rogers and Fritz J. Swenson. AWI relicensed the routine under the GPL
! and put in many changes to convert to structured programming and
! real(fp_kind), evaluate partial derivatives, and insert commentary.
! forrest's electron exchange integral subroutine.
! fpsi and its first through third derivatives wrt psi, where
! psi is the Cox and Giuli degeneracy parameter eta.
!
! definition is derived from definitions of fp12 and exct (see their
! commentary):
! fpsi(psi) =
! integral from -inf to psi of square of derivative of fp12(psi') d psi'
! fp12(psi) is C&G F(1/2, psi)/Gamma(3/2).
!
!> This f_psi subroutine calculates an approximation for fpsi(psi) =
!> integral from -inf to psi of square of derivative of fp12(psi') d
!> psi' where fp12(psi) is C&G F(1/2, psi)/Gamma(3/2). The grand
!> canonical partition function of the exchange effect in the
!> non-relativistic limit can be calculated from this integral. See <a
!> href="http://freeeos.sourceforge.net/exchange.pdf">"The Exchange
!> Paper"</a> for further details.
!>
!> \param[in] psi PARAMETERS NEED DOCUMENTATION
!>
subroutine f_psi(psi, fpsi, dfpsi, d2fpsi, d3fpsi)
! Arguments
real(fp_kind), intent(in) :: psi
real(fp_kind), intent(out) :: fpsi, dfpsi, d2fpsi, d3fpsi
! Local variables
real(fp_kind) f1, df1, d2f1, d3f1, f2, df2, d2f2, d3f2
call fp12_calc(psi, f1, df1, d2f1, d3f1)
! df2, etc., are derivatives of f2 wrt f1
call exct_calc(f1, f2, df2, d2f2, d3f2)
fpsi = f1*f1*f2
dfpsi = 2._fp_kind*f1*df1*f2 + f1*f1*df2*df1
d2fpsi = 2._fp_kind*(df1*df1 + f1*d2f1)*f2 +&
4._fp_kind*f1*df1*df2*df1 +&
f1*f1*(d2f2*df1*df1 + df2*d2f1)
d3fpsi = 2._fp_kind*(3._fp_kind*df1*d2f1 + f1*d3f1)*f2 +&
6._fp_kind*(df1*df1 + f1*d2f1)*df2*df1 +&
6._fp_kind*f1*df1*(d2f2*df1*df1 + df2*d2f1) +&
f1*f1*(d3f2*df1*df1*df1 + 3._fp_kind*d2f2*df1*d2f1 + df2*d3f1)
end subroutine f_psi