c
c     Copyright (c) 1999,2000, Compaq Computer Corporation
c
c     See the file "license.terms" for information on usage and redistribution
c     of this file, and for a DISCLAIMER OF ALL WARRANTIES.
c
      subroutine e_jmag(el, et, ez, mag_e,
     1           e_lat_cur, e_trans_cur, e_z_cur, e_cur_mag,
     2           h_lat_cur, h_trans_cur, h_z_cur, h_cur_mag,
     3           in_binary_file)
      implicit none
c
c     Computes magnitude of electric field, and majority/minority current
c
      include 'const.h'
      include 'sysdep.cmn'
      include 'mesh.cmn'
CC      include 'data.cmn'
      include 'io.cmn'
      include 'bincodes.cmn'
c
      real el(ni,nj), et(ni,nj), ez(ni,nj), mag_e(ni,nj)
      real e_lat_cur(ni,nj), e_trans_cur(ni,nj), e_z_cur(ni,nj),
     1     e_cur_mag(ni,nj)
      real h_lat_cur(ni,nj), h_trans_cur(ni,nj), h_z_cur(ni,nj),
     1     h_cur_mag(ni,nj)
      logical in_binary_file(MENUSIZE)
c
c     locals
c
      integer i,j
c
c     Electric field
c
      do 10 j=1,nj
         do 20 i=1,ni
20          mag_e(i,j) = sqrt(el(i,j)**2 + et(i,j)**2 + ez(i,j)**2)
10       continue
c
c     Electron current
c
      do 30 j=1,nj
         do 40 i= 1,ni
40          e_cur_mag(i,j)=sqrt(e_lat_cur(i,j)**2 + e_trans_cur(i,j)**2
     1                          + e_z_cur(i,j)**2)
30       continue
c									 
c     Hole current
c
      do 50 j=1,nj
         do 60 i=1,ni
60          h_cur_mag(i,j)=sqrt(h_lat_cur(i,j)**2 + h_trans_cur(i,j)**2
     1                          + h_z_cur(i,j)**2)
50       continue
c
      in_binary_file(MAG_E_CODE)   = .TRUE.

c
      end
