File: acpole.f90

package info (click to toggle)
elkcode 5.4.24-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 12,840 kB
  • sloc: f90: 48,415; fortran: 22,457; perl: 965; makefile: 384; sh: 369; python: 105; ansic: 67
file content (70 lines) | stat: -rw-r--r-- 1,442 bytes parent folder | download
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

! Copyright (C) 2017 J. K. Dewhurst, S. Sharma and E. K. U. Gross.
! This file is distributed under the terms of the GNU General Public License.
! See the file COPYING for license details.

subroutine acpole(zm,zwr,zr)
use modmain
use modgw
implicit none
! arguments
complex(8), intent(in) :: zm(0:nwfm),zwr(nwplot)
complex(8), intent(out) :: zr(nwplot)
! local variables
integer, parameter :: maxit=1000
integer iter,iw
integer n,n2,i,j
real(8), parameter :: eps=1.d-5
! allocatable arrays
real(8), allocatable :: x(:,:)
! external functions
complex(8) zfpole
external zfpole
n=2*npole+1
n2=2*n
allocate(x(n2,n2+1))
! intialise simplex
x(:,:)=0.d0
! fit the constant
x(1,2)=0.5d0
x(2,3)=0.5d0
call minf_nm(1,zm,n2,x,maxit,iter,eps)
! fit the constant and the first pole
x(3,1)=1.d0
do i=1,6
  x(i,i+1)=x(i,1)+0.1d0
end do
call minf_nm(1,zm,n2,x,maxit,iter,eps)
! fit the remaining poles one-by-one
i=7
do j=2,npole
  x(i,1)=1.d0
  x(i,i+1)=x(i,1)+0.1d0
  i=i+1
  x(i,i+1)=0.1d0
  i=i+1
  x(i,i+1)=0.1d0
  i=i+1
  x(i,i+1)=0.1d0
  i=i+1
  call minf_nm(1,zm,n2,x,maxit,iter,eps)
end do
! fit the constant and the first pole again
do i=1,6
  x(i,i+1)=x(i,1)+0.1d0
end do
call minf_nm(1,zm,n2,x,maxit,iter,eps)
! fit everything together
if (npole.gt.1) then
  do i=1,n2
    x(i,i+1)=x(i,1)+0.1d0
  end do
  call minf_nm(1,zm,n2,x,maxit,iter,eps)
end if
do iw=1,nwplot
  zr(iw)=zfpole(x(:,1),zwr(iw))
end do
deallocate(x)
return
end subroutine