-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpseudopot.f90
87 lines (67 loc) · 2.15 KB
/
pseudopot.f90
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
module pseudopot
use types
use constants
implicit none
private
public GthPotParams, gth_pp_t
type :: GthPotParams
real(dp) :: chi
real(dp) :: c1
real(dp) :: c2
real(dp) :: omega
integer(dp) :: Zeff
real(dp) :: rloc
real(dp) :: box_length
end type GthPotParams
type :: gth_pp_t
type(GthPotParams) :: params
contains
procedure :: local => pseudo_pot_local ! short range + core terms
procedure :: short => pseudo_pot_short
procedure :: core => pseudo_pot_core
! procedure :: total => pseudo_pot_gth ! local + non-local
end type gth_pp_t
contains
elemental real(dp) function pseudo_pot_local(this, k) result(retval)
! local part of the pseudopotential
! composed of a core and a short range term
class(gth_pp_t),intent(in) :: this
real(dp),intent(in) :: k
if (k /= 0) then
retval = this%core(k)
retval = retval + this%short(k)
else
retval = 0
endif
end function pseudo_pot_local
elemental real(dp) function pseudo_pot_core(this, k) result(retval)
class(gth_pp_t),intent(in) :: this
real(dp),intent(in) :: k
real(dp) :: chi
chi = this%params%chi
retval = 0.0
if(abs(k) > tiny(1.0_dp)) then
retval = - 4 *pi * this%params%Zeff / this%params%omega
retval = retval * exp(- 0.5_dp * (k * chi)**2)
retval = retval /(k**2)
endif
end function pseudo_pot_core
elemental real(dp) function pseudo_pot_short(this, k) result(retval)
class(gth_pp_t),intent(in) :: this
real(dp),intent(in) :: k
type(GthPotParams) :: params
real(dp) :: chi
params = this%params
chi = params%chi
! when computing it as part of the local
! part of the pseudopot then it should be zero
! but for the energy it should not be zero
! if(k /= 0) then
retval = (2*pi)**(1.5_dp)* chi**3 /params%omega
retval = retval * exp(-0.5_dp * (k * chi)**2)
retval = retval * (params%c1 + params%c2 * (3 - (k*chi)**2))
! else
! retval = 0
! endif
end function pseudo_pot_short
end module pseudopot