diff --git a/src/beams.f90 b/src/beams.f90 index f91a212..3f29812 100644 --- a/src/beams.f90 +++ b/src/beams.f90 @@ -204,7 +204,7 @@ contains end subroutine read_beam1 - subroutine read_beam2(params, beamid, err) + subroutine read_beam2(params, beamid, err, set_pol) ! Reads the wave launcher parameters for the general case ! where w(z, α, β) and 1/R(z, α, β) depend on the launcher angles α, β. ! @@ -231,14 +231,16 @@ contains use logger, only : log_error ! subroutine arguments - type(antenna_parameters), intent(inout) :: params - integer, intent(in) :: beamid - integer, intent(out), optional :: err + type(antenna_parameters), intent(inout) :: params ! beam parameters + integer, intent(in) :: beamid ! which beam to load + integer, intent(out), optional :: err + logical, intent(in), optional :: set_pol ! whether to set params%iox ! local variables character(len=20) :: beamname + logical :: set_pol_ integer :: u - integer :: i, ier, nisteer, fdeg, jumprow, nbeam, nalpha, nbeta + integer :: i, ier, nisteer, fdeg, jumprow, nbeam, nalpha, nbeta, iox integer :: iopt, incheck, nxcoord, nycoord, nxest, nyest, lwrk, kwrk integer :: nxwaist1, nywaist1, nxwaist2, nywaist2, nxrci1, nyrci1, nxrci2 integer :: nyrci2, nxphi1, nyphi1, nxphi2, nyphi2, nxx0, nyx0, nxy0, nyy0 @@ -259,6 +261,9 @@ contains integer, parameter :: kspl=1 real(wp_), parameter :: sspl=0.01_wp_ + set_pol_ = .true. + if (present(set_pol)) set_pol_ = set_pol + open(newunit=u, file=params%filenm, status='old', action='read', iostat=err) if (err /= 0) then call log_error('opening beams file ('//trim(params%filenm)//') failed!', & @@ -274,13 +279,14 @@ contains jumprow=0 ! c==================================================================================== do i=1,beamid-1 - read(u,*) beamname, params%iox, params%fghz, nalpha, nbeta + read(u,*) beamname, iox, params%fghz, nalpha, nbeta jumprow = jumprow+nalpha*nbeta end do ! c==================================================================================== ! ! beam of interest - read(u,*) beamname, params%iox, params%fghz, nalpha, nbeta + read(u,*) beamname, iox, params%fghz, nalpha, nbeta + if (set_pol_) params%iox = iox ! ! c==================================================================================== ! unused beams' data grids diff --git a/src/main.f90 b/src/main.f90 index aa7029c..96bfc25 100644 --- a/src/main.f90 +++ b/src/main.f90 @@ -174,7 +174,7 @@ contains ! 2 degrees of freedom ! w(z, α, β), 1/R(z, α, β) ! FIXME: 1st beam is always selected, iox read from table - call read_beam2(params, beamid=1, err=err) + call read_beam2(params, beamid=1, err=err, set_pol=.false.) case (BEAM_1D) ! 1 degree of freedom ! w(z, α), 1/R(z, α)