Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program propagate
- integer, parameter :: dp=kind(0.d0)
- ! general
- real(dp), parameter :: dt = 1
- integer, parameter :: pade_deg = 6
- integer :: iexph, ns, f = 0
- character(len=12) :: Narg
- ! fixed size
- integer, parameter :: fN = 100
- integer, parameter :: flwsp = 4*fN**2+pade_deg+1
- real(dp), dimension(fN, fN) :: fH
- complex(dp), dimension(fN, fN) :: fP
- complex(dp), dimension(flwsp) :: fwsp
- integer, dimension(fN) :: fipiv
- ! dynamic size
- integer :: dN
- integer :: dlwsp
- real(dp), allocatable, dimension(:, :) :: dH
- complex(dp), allocatable, dimension(:, :) :: dPP
- complex(dp), allocatable, dimension(:) :: dwsp
- integer, allocatable, dimension(:) :: dipiv
- ! command args
- if (command_argument_count() < 1) then
- stop 'provide integer command arg for grid size N'
- else
- call get_command_argument(1, Narg)
- read (Narg, '(i12)') dN
- end if
- dlwsp = 4*dN**2+pade_deg+1
- ! allocation
- allocate(dH(dN, dN))
- allocate(dPP(dN, dN))
- allocate(dwsp(dlwsp))
- allocate(dipiv(dN))
- write (*, *) sizeof(fN), sizeof(dN)
- write (*, *) sizeof(fH), sizeof(dH)
- write (*, *) sizeof(fwsp), sizeof(dwsp)
- write (*, *) sizeof(flwsp), sizeof(dlwsp)
- write (*, *) sizeof(fipiv), sizeof(dipiv)
- write (*, *) '+++'
- write (*, *) size(fH), size(dH)
- write (*, *) 'dH allocated:', allocated(dH)
- ! fixed: Hermitian matrix H & 'unitary' propagator P
- fH = 0
- do i = 1, fN
- fH(i, i) = 1
- end do
- call ZHPADM(pade_deg, fN, dt, fH, fN, fwsp, flwsp, fipiv, iexph, ns, f)
- fP = reshape(fwsp(iexph:iexph+fN**2-1), [fN, fN])
- ! dynamic: Hermitian matrix H & 'unitary' propagator P
- dH = 0
- do i = 1, dN
- dH(i, i) = 1
- end do
- !call ZHPADM(pade_deg, dN, dt, fH, dN, dwsp, dlwsp, dipiv, iexph, ns, f)
- call ZHPADM(pade_deg, fN, dt, dH, fN, fwsp, flwsp, fipiv, iexph, ns, f)
- dPP = reshape(dwsp(iexph:iexph+dN**2-1), [dN, dN])
- write (*, *) 'end of program'
- end program propagate
Advertisement
Add Comment
Please, Sign In to add comment