module eq_parameters
    implicit none
    integer ieq,lsr,lsz
    real(kind=8), dimension(:,:), ALLOCATABLE :: psirz_Eq,&
    B0Mag_Eq, B0R_Eq, B0Z_Eq, ni_Eq, ti_Eq, ne_Eq, te_Eq
    real(kind=8), DIMENSION(:), ALLOCATABLE :: r_Eq, z_Eq

    CHARACTER(LEN=99) fname
!f2py intent(in) fname
    
contains
subroutine filename(name)
    CHARACTER(*) name
    fname=trim(name)
end subroutine filename
subroutine deallocate
    deallocate(r_Eq,z_Eq,ni_Eq,ne_Eq,ti_Eq,te_Eq,&
    psirz_Eq,B0mag_Eq,B0R_Eq,B0Z_Eq)
end subroutine deallocate
subroutine eq_read
    ieq=120
    open(ieq,file=fname,status='old')
    read(ieq,101) lsr, lsz
    allocate(r_Eq(lsr),z_Eq(lsz),ni_Eq(lsr,lsz),ne_Eq(lsr,lsz),ti_Eq(lsr,lsz),te_Eq(lsr,lsz),&
             psirz_Eq(lsr,lsz),B0mag_Eq(lsr,lsz),B0R_Eq(lsr,lsz),B0Z_Eq(lsr,lsz))

    read(ieq,101) r_Eq,z_Eq,psirz_Eq,B0Mag_Eq,B0R_Eq,B0Z_Eq,ni_Eq,ti_Eq,ne_Eq,te_Eq
    close(ieq)
    101 format(1x,9g16.8)
end subroutine eq_read
    
end module eq_parameters