module physconst_mod

  use iso_c_binding, only: fp => c_double

  implicit none

  real(fp), parameter :: PI   = atan2(0.0_fp,-1.0_fp)
  real(fp), parameter :: TWOPI= PI+PI
  real(fp), parameter :: kb_K = 1.38064852e-23_fp    !  J/K
  real(fp), parameter :: kb_eV = 1.60217653e-19_fp   !  J/eV
  real(fp), parameter :: kb_keV = 1.60217653e-16_fp  !  J/keV
  real(fp), parameter :: e = 2.7182818285_fp

  !-----------------------------------------
  real(fp), parameter :: ZERO = 0.0_fp
  real(fp), parameter :: HALF = 0.5_fp
  real(fp), parameter :: ONE  = 1.0_fp
  real(fp), parameter :: TWO  = 2.0_fp

  !-----------------------------------------
  ! Physics constants, based on CODATA 2006
  real(fp), parameter :: AEE  = 1.602176487e-19_fp ! elementary charge
  real(fp), parameter :: AME  = 9.10938215e-31_fp  ! electron mass (kg)
  real(fp), parameter :: AMP  = 1.672621637e-27_fp ! proton mass (kg)
  real(fp), parameter :: VC   = 2.99792458e8_fp    ! speed of light
  real(fp), parameter :: RMU0 = (4.0e-7_fp)*PI     ! permeability
  real(fp), parameter :: EPS0 = ONE/(VC*VC*RMU0)   ! permittivity
  REAL(fp), parameter :: usdp = rmu0

  !Define conversion factors
  real(fp), parameter :: zcmtom = 1.0e-2_fp  !Centimeter to meter
  real(fp), parameter :: zwtomw = 1.0e-6_fp  !Watts to Mega-watts
  real(fp), parameter :: zatoma = 1.0e-6_fp  !Amperes to Mega-amperes
  real(fp), parameter :: zev2kev = 1.0e-3_fp !eV to keV

  real(fp), parameter :: rad2deg = 180.0_fp/pi
  real(fp), parameter :: deg2rad = pi/180.0_fp


  real(fp), parameter :: epslon = 1.0e-34_fp    ! small number
  real(fp), parameter :: epsinv = 1.0e+34_fp    ! large number

contains

  ! potential area for conversion utils etc

end module physconst_mod
