
       subroutine optcheck(zfill,yfill,eta_alpha)
c*********************************************************
c
c purpose:  to check the choice of operator equation and
c           the model for validity.
c*********************************************************

       include 'ctparm.inc'
       include 'dspparam.inc'
       include 'wirechar.inc'

       common /ieoper/ operator
       character*1 operator
       common /geomopt/ wires,loads
       logical wires,loads

       logical zfill, yfill, ok
       character*1 e,h,c,a
       data e/'E'/, h/'H'/, c/'C'/, a/'A'/

       zfill = .false.
       yfill = .false.
       eta_alpha = 0.

       if(operator.eq.e  .or.  operator.eq.a) then	!efie
           zfill = .true.
           if(operator.eq.a) then
             if(numwires .lt. 1) then
               write(6,*) 'error in choice of options: an antenna'
               write(6,*) ' problem was specified but no wires were'
               write(6,*) ' found in the data file.  specify a new'
               write(6,*) ' data file, add wires to the current data'
               write(6,*) ' file, or select a non-antenna problem.'
               write(6,*) ' exiting...'
               stop
             else
               ok = .false.
               do i=1,numwires
                 if(wamp(i) .ne. 0.) ok=.true.
               end do
               if( .not. ok) then
                 write(6,*) 'error in choice of options: an antenna'
                 write(6,*) ' problem was specified but all wires '
                 write(6,*) ' have zero feed amplitude.  specify a new'
                 write(6,*) ' data file, change the feed amplitude'
                 write(6,*) ' of at least one wire, or'
                 write(6,*) ' select a non-antenna problem.'
                 write(6,*) ' exiting...'
                 stop
               endif
             endif
           endif
       else
           if(wires) then
              write(6,1000)
              stop
           endif
           if(loads) then
              write(6,2000) 
              stop
           endif
           if(operator.eq.h) then	  !hfie
               yfill = .true.
               eta_alpha = 1.
            elseif(operator.eq.c) then	  !cfie
               zfill = .true.
               yfill = .true.
               alpha_cfie = 2.
               eta_alpha = 377./alpha_cfie
            endif
       endif

 1000  format(//,x,'error in choice of options: the model contains ',
     %        'wires ',/,x,
     %         ' -- only the efie is valid for open surfaces.',
     %         /,x,'...exiting; reselect input parameters.')


 2000  format(//,x,'error in choice of options: the model contains ',
     %        'material loads ',/,x,
     %         ' -- only the efie is valid for loaded surfaces.',
     %         /,x,'...exiting; reselect input parameters.')

       return
       end
