-
Notifications
You must be signed in to change notification settings - Fork 0
/
perturb.f90
137 lines (110 loc) · 4.79 KB
/
perturb.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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
131
132
133
134
135
136
137
module perturbations
complex*16, public, allocatable, save :: dn(:,:,:,:,:), dvp(:,:,:,:,:), dv(:,:,:,:,:)
public :: calc_dvp
public :: calc_dn
public :: calc_dv
contains
subroutine calc_dvp(pt)
use param, only : norb, nsite
use constants, only : nspin, cmplx_0
use responsefunc, only : invur
implicit none
integer :: iorb, iorb1, iorb2, iorb3, ispin, ispin1, isite, isite1, counter, i4, j4
complex*16 :: pt4(norb,norb,nsite,nspin*2), dvp4(norb,norb,nsite,nspin*2)
complex*16, intent(in) :: pt(norb,norb,nsite,nspin,nspin)
allocate(dvp(norb,norb,nsite,nspin,nspin))
counter = 0
do ispin = 1, nspin
do ispin1 = 1, nspin
counter = counter + 1
pt4(:,:,:,counter) = pt(:,:,:,ispin1,ispin)
end do
end do
dvp4 = cmplx_0
do i4 = 1, 4
do j4 = 1, 4
do isite = 1, nsite
do iorb = 1, norb
do iorb1 = 1, norb
do isite1 = 1, nsite
do iorb2 = 1, norb
do iorb3 = 1, norb
dvp4(iorb,iorb1,isite,i4) = dvp4(iorb,iorb1,isite,i4) + &
invur(iorb,iorb1,isite,iorb2,iorb3,isite1,i4,j4)*pt4(iorb2,iorb3,isite1,j4)
end do
end do
end do
end do
end do
end do
end do
end do
dvp = cmplx_0
counter = 0
do ispin = 1, nspin
do ispin1 = 1, nspin
counter = counter + 1
dvp(:,:,:,ispin1,ispin) = dvp4(:,:,:,counter)
end do
end do
end subroutine calc_dvp
subroutine calc_dn()
use param, only : norb, nsite
use constants, only : nspin, cmplx_0
use responsefunc, only : r
implicit none
integer :: iorb, iorb1, iorb2, iorb3, ispin, ispin1, isite, isite1
allocate(dn(norb,norb,nsite,nspin,nspin))
dn = cmplx_0
do isite = 1, nsite
do iorb = 1, norb
do iorb1 = 1, norb
do isite1 = 1, nsite
do iorb2 = 1, norb
do iorb3 = 1, norb
dn(iorb,iorb1,isite,1,1) = dn(iorb,iorb1,isite,1,1) + &
r(iorb,iorb1,isite,iorb2,iorb3,isite1,1)*dvp(iorb2,iorb3,isite1,1,1)
dn(iorb,iorb1,isite,2,1) = dn(iorb,iorb1,isite,2,1) + &
r(iorb,iorb1,isite,iorb2,iorb3,isite1,2)*dvp(iorb2,iorb3,isite1,1,2)
dn(iorb,iorb1,isite,1,2) = dn(iorb,iorb1,isite,1,2) + &
r(iorb,iorb1,isite,iorb2,iorb3,isite1,3)*dvp(iorb2,iorb3,isite1,2,1)
dn(iorb,iorb1,isite,2,2) = dn(iorb,iorb1,isite,2,2) + &
r(iorb,iorb1,isite,iorb2,iorb3,isite1,4)*dvp(iorb2,iorb3,isite1,2,2)
end do
end do
end do
end do
end do
end do
end subroutine calc_dn
subroutine calc_dv()
use param, only : norb, nsite
use constants, only : nspin, cmplx_0
use responsefunc, only : ur
implicit none
integer :: iorb, iorb1, iorb2, iorb3, ispin, ispin1, isite, isite1, counter, i4, j4
allocate(dv(norb,norb,nsite,nspin,nspin))
do isite = 1, nsite
do iorb = 1, norb
do iorb1 = 1, norb
do isite1 = 1, nsite
do iorb2 = 1, norb
do iorb3 = 1, norb
dv(iorb,iorb1,isite,1,1) = dv(iorb,iorb1,isite,1,1) + &
ur(iorb,iorb1,isite,iorb2,iorb3,isite1,1,1)*dvp(iorb2,iorb3,isite1,1,1) + &
ur(iorb,iorb1,isite,iorb2,iorb3,isite1,1,4)*dvp(iorb2,iorb3,isite1,2,2)
dv(iorb,iorb1,isite,2,1) = dv(iorb,iorb1,isite,2,1) + &
ur(iorb,iorb1,isite,iorb2,iorb3,isite1,2,2)*dvp(iorb2,iorb3,isite1,2,1)
dv(iorb,iorb1,isite,1,2) = dv(iorb,iorb1,isite,1,2) + &
ur(iorb,iorb1,isite,iorb2,iorb3,isite1,3,3)*dvp(iorb2,iorb3,isite1,1,2)
dv(iorb,iorb1,isite,2,2) = dv(iorb,iorb1,isite,2,2) + &
ur(iorb,iorb1,isite,iorb2,iorb3,isite1,4,1)*dvp(iorb2,iorb3,isite1,1,1) + &
ur(iorb,iorb1,isite,iorb2,iorb3,isite1,4,4)*dvp(iorb2,iorb3,isite1,1,1)
end do
end do
end do
end do
end do
end do
end subroutine calc_dv
end module perturbations