title: Type mismatch in argument: passed COMPLEX(8) to REAL(8)
body: <p>I'm trying to compile and run a relatively old code from a PhD thesis, you can find whole code in Appendices C and D of <a href="http://drmaiaprogram.com/wp-content/uploads/2017/05/MaiaMagrakvelidze2013.pdf" rel="nofollow noreferrer">this</a> document.
  Here is necessary parts from the code:</p>
  
  <p>from wfMath.f90 :</p>
  
  <pre><code>subroutine wfmath_gaussian(widthz,pz)
   use progvars
   implicit none
   real*8, intent(in) :: widthz ! the width of the wavepacket
   real*8, intent(in) :: pz ! momentum
   integer :: nR
   real*8 :: rvalue
   complex*16 :: cvalue
   ! complex*16 :: psi !!!ORIGINAL CODE LINE 23/02/2018. Saba
   complex*16, dimension(1) :: psi !!! psi is originally defined as a scalar. But wfmath_normalize(wf) takes a rank-1 tensor as
   !argument. So here I change the declaration of psi from a scalar to a rank-1 tensor contains only one element. 23/02/2018. Saba
   real*8 :: z2
   z2 = minz + deltaz
   do nR=1, nz
   rvalue = exp( -((z2-centerz)/widthz)**2 /2 )/ (2*pi*widthz) !!!ORIGINAL CODE LINE
   !rvalue = exp( -((z2-centerz)/1.0d0)**2 /2 )/ (2*pi*1.0d0)
   cvalue = cdexp( cmplx(0.0,1.0)*(pz*z2))
   psi(nR) = rvalue * cvalue
   z2 = z2 + deltaz ! next grid position in x-direction
   enddo
   call wfmath_normalize(psi)
  end subroutine wfmath_gaussian
  </code></pre>
  
  <p>from tdse.f90 - main part :</p>
  
  <pre><code>subroutine init
   use progvars
   use strings;
   use wfMath;
   use wfPot;
   !use tdseMethods;
   implicit none
   integer :: nloop
   real*8 :: widthz,pz
  
   select case (trim(molecule))
   case("H2")
   mass = 917.66d0; nz = 2048; deltaz = 0.05d0;
   case("D2")
   mass = 1835.241507d0; nz = 1024; deltaz = 0.05d0;
   case("N2")
   mass = 12846.69099d0; nz = 512; deltaz = 0.01d0;
   case("O2")
   mass = 14681.93206d0; nz =8192 ; deltaz = 0.005d0;
   case("Ar2")
   mass = 36447.94123d0; nz = 65536; deltaz = 0.002d0;
   end select
  
   maxt = 33072.80d0 !800fs ! maximum time
   deltat = 1.0d0 ! delta time
   widthz = 1.0d0 ! width of the gaussian
   minz = 0.05d0 ! minimum z in a.u.
   maxz = nz * deltaz ! maximum z in a.u.
   centerz = 2.1d0 ! center of the gaussian
   nt = NINT(maxt/deltat) ! time steps
   pz = 0.d0 ! not used currently
  
  !_____________________________FFT Section____________________________________________
   deltafft = 20.d0* deltat !1.0d0*deltat ! time step for FFT
   nfft = NINT(maxt/deltafft) ! no of steps for FFT
  
  !_________________________absorber parameters_______________________________________
   fadewidth = 10.d0 ! the width of the absorber in a.u.
   fadestrength = 0.01d0 ! the maximum heigth of the negative imaginary potential
  
  !_________________________E FIELD section_____________________________________________
   Ewidth = 1446.2d0 !35fs ! width of the envelope
   Eo = 0.053 !E14 ! field amplitude
   Eomega = 0.057d0 !800nm ! laser frequency
  ! Eomega = 0.033d0 !1400nm ! laser frequency
   Ephi = 0.d0 ! carrier envelope phase
   Eto = 1000.d0 ! ecenter of the Gaussian envelope
   EoPed = 0.0755 !2E14
   EwidthPed = 826.638 !20fs
   EomegaPed = Eomega
   EphiPed = 0.d0
   EtoPed = 1000.d0
   EoPump = 0.053 !1E14 0.00285d0
   EwidthPump = Ewidth
   EomegaPump = 0.057d0
   EphiPump = 0.0d0
   EtoPump = 0.d0
   includeAbsorber = .true. ! switch for absorber
   includeField = .true. ! .false. ! switch for efield
   includePedestal = .false. ! switch for pedestal
  
   includeConstantPump = .true. ! .false. ! switch for efield
   useADK = .false. ! ADK switch
   calculatePowerSpectra = .true.
   calculateKERPowerSpectra = .true. !.false.
  
  !_____________________________Printing &amp; Plotting Filters__________________________________
   printFilter = nz
   maxFrequencyFilter = 500
   printInterval =100 !200
   ! print filter upper boundary check
   if(printFilter &gt; nz) then
   printFilter = nz
   end if
   call allocateArrays();
  
   do nloop = 1,nz
   Z(nloop) = minz+ (nloop)* deltaz;
  
   P(nloop) = 2*pi*(nloop-(nz/2)-1)/(maxz-minz);
  
   E(nloop) = 27.2*(P(nloop)**2)/(4.d0*mass);
   end do
  
   ! call wfmath_gaussian(psiground,widthz,pz) !!! ORIGINAL CODE LINE
   call wfmath_gaussian(psiground,real(widthz),pz) ! Attempt to solve mismatch error. Does not work. Saba 24/02/2018
   ! call wfmath_gaussian(psiground,1.0d0,pz) ! Attempt to solve mismatch error. Does not work. Saba 23/02/2018
   ! call wfmath_gaussian(pz) ! Attempt to solve mismatch error. Does not work. Saba 23/02/2018
  
   call setabsorber_right(fadewidth, fadestrength)
   call printpsi(psiground,trim(concat(outputFolder,"psi_gausssian.dat")))
  
   call potentials_init(nz) !initialize potential arrays
  
   call read_potential();
  
  end subroutine init
  </code></pre>
  
  <p>As far as I understand, there is no mismatch at all. widthz is declared as real*8 in main part of the code (subroutine init), and subroutine wfmath_gaussian(...) expects widthz to be a real*8. I can't see where this mismatch error occurs?</p>
  
  <p>used compiler: GNU Fortran 6.3.0</p>
  
  <p>used compile line: $gfortran tdse.f90</p>
  
  <p>error message:</p>
  
  <pre><code>tdse.f90:159:118:
  
  call wfmath_gaussian(psiground,real(widthz),pz) ! Attempt to solve mismatch error. Does not work. Saba 24/02/2018
                                                                                                                   (1)
  
  Error: Type mismatch in argument 'widthz' at (1); passed COMPLEX(8) to REAL(8)
  </code></pre>
  
  <p>Thanks in advance...</p>