-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstieltjes.f90
91 lines (72 loc) · 2.27 KB
/
stieltjes.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
program stieltjes
use interpolation
implicit none
integer :: npt
integer, parameter :: QR_K = selected_real_kind (32)
real (kind=QR_K), allocatable, dimension(:) :: e, g
integer :: nmax = 30 ! according to Mueller-Plathe and Diercksen Stieltjes is inaccurate for n>=15
!real (kind=QR_K), dimension(0:nmax) :: sk
!real (kind=QR_K), dimension(nmax,nmax) :: e1, g1, e2, g2
real (kind=QR_K), allocatable, dimension(:) :: sk
real (kind=QR_K), allocatable, dimension(:,:) :: e1, g1
real (kind=QR_K) :: shift1 = 0.1d0
integer :: imax1, imax2
integer :: inmax, ishift
integer :: i, j
integer :: exit_cycle
character(len=60) :: fname
! Tsveta
real (kind=QR_K) :: g_
real (kind=QR_K) :: temp, pi
pi = dacos(-1d0)
! reads and sorts energy and matrix elements
read(*,*)npt
allocate(e(npt),g(npt))
do i = 1, npt
read(*,*)e(i),g(i)
enddo
if(sum(g)==0d0) then
write(*,*)"All matrix elements are zero, I stop"
stop
endif
call sort2(npt,e,g)
print*,e(1)
ishift = 2
shift1 = ishift * 0.1d0
write(fname, '(A8,I1,A4)')"gamma.sh",ishift,".dat"
open(237,file=fname)
do inmax = 10, nmax
allocate(sk(0:inmax))
allocate(e1(inmax,inmax), g1(inmax,inmax))
! computes the nmax moments of the matrix elements
open(unit=10,file='moments.txt')
sk(:) = 0q0
do i = 0, inmax
do j = 1, npt
sk(i) = sk(i) + e(j)**i*g(j)
enddo
write(10,*)i,abs(sk(i))
enddo
close(10)
! "images" the matrix elements for two different shift values, may be used to evaluate the highest accurate order
shift1 = shift1 + abs(e(1))
e(:) = e(:) + shift1
call imaging(npt,e,g,inmax,imax1,e1,g1)
e(:) = e(:) - shift1
do i = 1, imax1
do j = 1, i-1
write(100+i,'(2(f20.16,1X))')e1(j,i)-shift1,g1(j,i)
enddo
enddo
call interp(e1(:,imax1),g1(:,imax1),imax1-1,shift1,g_)
g_ = 2.0d0*pi*g_
shift1 = shift1 - abs(e(1))
!write(*,'(1X,A9,f8.3)')"Shift 1: ",shift1-abs(e(1))
!write(*,'(I2,A3,E23.15)')inmax," ",g_
! March 03, 2016 Tsveta
write(237,'(I3,A3,E23.15)')inmax," ",g_
deallocate(sk,e1,g1)
end do
close(237)
deallocate(e,g)
end program stieltjes