program main
implicit none
integer counter
real N
real ne,z,a,n0
real dz
N=400
n0=1e17
dz=2*a/N
a=0.04
do counter=0,N
z=-a+real(counter)*dz
call get_ne1(ne,z,n0)
write(*,*)ne
end do
stop
end
subroutine get_ne1(ne,z,n0)
implicit none
real n0,ne
real z
real z0
real a
a=0.04
z0=4E-3
if((z>=-a).and.(z<=0)) then
ne=n0*exp(z/z0)
else if((z>0).and.(z<=a)) then
ne=n0*exp(-z/z0)
end if
return
end subroutine