-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlagrange_mesh.f
executable file
·228 lines (182 loc) · 7.92 KB
/
lagrange_mesh.f
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
module lagrange_mesh_single_channel
use mesh
implicit none
! note the delta function structure fi(xj) = \lambda_i^{-1/2} \delta_{ij}
real*8,dimension(:),allocatable :: lagrange_func
real*8,dimension(:,:), allocatable :: kinetic_matrix
real*8,dimension(:,:),allocatable :: l_barrier_matrix
complex*16,dimension(:,:),allocatable :: V_matrix
real*8,dimension(:),allocatable :: mesh_rr, mesh_rw
real*8 :: rmax_rmatrix
contains
c***********************************************************************
subroutine initial_lagrange_func (rmatch_rmatrix)
!
! before calling this subroutine please initial rmax_rmatrix and nr
!
! this subroutine is used to initial the Lagrange function
! for the purpose to reconstruct the scattering wave function
!!!!!! please gives the matching radius
c***********************************************************************
use gauss
use mesh
use precision
implicit none
integer :: ir
real*8 :: rmatch_rmatrix
rmax_rmatrix=rmatch_rmatrix
if(allocated(lagrange_func)) deallocate(lagrange_func)
if(allocated(mesh_rr)) deallocate(mesh_rr)
if(allocated(mesh_rw)) deallocate(mesh_rw)
allocate(lagrange_func(1:nr))
allocate(mesh_rr(1:nr))
allocate(mesh_rw(1:nr))
call gauleg(nr,0.0_dpreal,1.0_dpreal,mesh_rr,mesh_rw)
do ir=1, nr
lagrange_func(ir) = 1/ sqrt(rmax_rmatrix * mesh_rw(ir))
end do
end subroutine
c-----------------------------------------------------------------------
c***********************************************************************
subroutine T_and_Bloch(mu)
! this subroutine is used to compute the kinetic and Bloch operator
! in the matrix form
c***********************************************************************
use precision
use constants
implicit none
integer :: ir, irp
real*8 :: f1,f2,f3
real*8 :: xi, xj
real*8 :: mu
if(allocated(kinetic_matrix)) deallocate(kinetic_matrix)
allocate(kinetic_matrix(1:nr, 1:nr))
do ir=1 , nr
do irp=1, nr
f1=0.0_dpreal
f2=0.0_dpreal
f3=0.0_dpreal
xi= mesh_rr(ir)
xj= mesh_rr(irp)
if(ir==irp) then
f1= hbarc**2 / (6.0_dpreal * rmax_rmatrix**2 * xi * (1-xi) * mu)
f2= 4.0_dpreal * nr * (nr+1) + 3.0
f3= (1.0_dpreal - 6.0_dpreal *xi )/( xi * (1-xi) )
kinetic_matrix(ir,irp)= f1 * ( f2 + f3 )
else
f1= (-1.0_dpreal)**(ir+irp) * hbarc**2 /2.0_dpreal/rmax_rmatrix/rmax_rmatrix/
+ sqrt( xi * xj * (1-xi) * (1-xj) ) / mu
f2= nr * (nr+1) + 1.0 + ( xi + xj - 2.0_dpreal * xi * xj )/( (xi-xj)**2 )
f3= 1.0_dpreal/(1.0_dpreal-xi) + 1.0_dpreal/(1.0_dpreal -xj)
kinetic_matrix(ir,irp)= f1* (f2-f3)
end if
end do
end do
end subroutine
c-----------------------------------------------------------------------
c***********************************************************************
subroutine centrifugal_barrier (l,mu)
! this subroutine is used to compute centrifugal_barrier in
! lagrange mesh basis
! V_l = \frac{\hbarc^2 l (l+1)}{2 * mu * r}
! input : mu in MeV
! l
c***********************************************************************
use constants
use precision
implicit none
integer :: l , ir
real*8 :: mu ,xi
if(allocated(l_barrier_matrix)) deallocate(l_barrier_matrix)
allocate(l_barrier_matrix(1:nr, 1:nr))
l_barrier_matrix=0.0_dpreal
do ir=1 , nr
xi = mesh_rr(ir)
l_barrier_matrix(ir,ir) = ( hbarc**2 * l * (l+1) )/ ( 2.0_dpreal * mu * rmax_rmatrix * rmax_rmatrix * xi * xi )
end do
end subroutine
c-----------------------------------------------------------------------
c***********************************************************************
subroutine lagrange_V(Vpot)
! this subroutine is used to compute the V-matrix in the Lagrange
! mesh basis
! input V is given in the mesh point in the step of hcm
! this subroutine interpolate the Vpot to give the correct mesh sets
c***********************************************************************
use interpolation
use precision
implicit none
complex*16,dimension(0:irmatch),intent(in) :: vpot
integer :: ir
real*8 :: r
if(allocated(V_matrix)) deallocate(V_matrix)
allocate(V_matrix(1:nr,1:nr))
V_matrix=0.0_dpreal
do ir = 1, nr
r = rmax_rmatrix* mesh_rr(ir)
V_matrix(ir,ir) = FFC(r/hcm, vpot, 1+irmatch)
end do
end subroutine
c-----------------------------------------------------------------------
c***********************************************************************
subroutine R_matrix(l,mu,ecm,vpot,cph,gc,gcp,fc,fcp)
! this subroutine is used to compute the single channel R-matrix
c***********************************************************************
use precision
use constants
implicit none
integer :: l
real*8 :: mu, ecm ,k
real*8 :: gc,gcp,fc,fcp
complex*16,dimension(0:irmatch) :: vpot
complex*16,dimension(1:nr,1:nr) :: C_minus_E
complex*16,dimension(1:nr) :: B_vector , X_vector
integer :: ir,INFO,NRHS
integer,dimension(1:nr) :: IPIV
real*8 :: N
complex*16 :: Rmatrix , Zmatrix_O, Zmatrix_I, Smatrix
complex*16 :: hc ,hc1 !H(+), H(-)
complex*16 :: hcp,hcp1 ! derivatives of H(+),H(-)
complex*16,dimension(1:nr) :: scattwf
complex*16 :: wf_bound
real*8 :: cph
k=sqrt(2.*mu*ecm/(hbarc**2))
hc=cmplx(gc,fc,kind=8)
hc1=cmplx(gc,-fc,kind=8)
hcp=cmplx(gcp,fcp,kind=8)
hcp1=cmplx(gcp,-fcp,kind=8)
call lagrange_V(Vpot)
call centrifugal_barrier (l,mu)
C_minus_E=0.0_dpreal
B_vector=0.0_dpreal
C_minus_E = kinetic_matrix + l_barrier_matrix + V_matrix
do ir=1, nr
C_minus_E(ir,ir) = C_minus_E(ir,ir) - ecm
B_vector(ir) = (-1.0_dpreal)**ir / sqrt( rmax_rmatrix* mesh_rr(ir) * ( 1.0-mesh_rr(ir) ) )
end do
NRHS=1
X_vector= B_vector
call ZGESV( nr, NRHS, C_minus_E, nr, IPIV, X_vector, nr, INFO )
If(INFO/=0) stop "error in calling ZGESV"
! normalize factor
N = hbarc**2 / (2.0_dpreal * mu * rmax_rmatrix)
Rmatrix=0.0_dpreal
do ir=1,nr
Rmatrix = Rmatrix + B_vector(ir) * X_vector(ir)
end do
Rmatrix=Rmatrix * N
Zmatrix_O= (hc-k*rmax_rmatrix*Rmatrix*hcp) / (k*rmax_rmatrix)
Zmatrix_I= (hc1-k*rmax_rmatrix*Rmatrix*hcp1) / (k*rmax_rmatrix)
Smatrix= Zmatrix_I / Zmatrix_O
write(*,*) "Smatrix=", Smatrix, 0.5_dpreal*log(Smatrix)/iu
C write(*,*) "phase=",real(0.5_dpreal*log(Smatrix)/iu) * 180.0_dpreal /pi
! compute the scattering wave function ! still testing
wf_bound = 0.5* iu * (hc1-hc*Smatrix) * exp(iu*cph)
do ir=1,nr
scattwf(ir)=lagrange_func(ir)*X_vector(ir)*wf_bound *N / Rmatrix
write(98,*) mesh_rr(ir)* rmax_rmatrix , real(scattwf(ir)), aimag(scattwf(ir))
end do
C stop
end subroutine
c-----------------------------------------------------------------------
end module