| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #ifndef _OPENMP | ||
| 2 | function omp_get_thread_num() | ||
| 3 | integer :: omp_get_thread_num | ||
| 4 | omp_get_thread_num = 0 | ||
| 5 | end function omp_get_thread_num | ||
| 6 | #endif | ||
| 7 | |||
| 8 | module util | ||
| 9 | |||
| 10 | implicit none | ||
| 11 | |||
| 12 | double precision, parameter :: pi=3.14159265358979d0 | ||
| 13 | double precision, parameter :: twopi=6.28318530717958d0 | ||
| 14 | double precision, parameter :: c=2.9979d10 | ||
| 15 | double precision, parameter :: e_charge=4.8032d-10 | ||
| 16 | double precision, parameter :: e_mass=9.1094d-28 | ||
| 17 | double precision, parameter :: p_mass=1.6726d-24 | ||
| 18 | double precision, parameter :: ev=1.6022d-12 | ||
| 19 | double precision, parameter :: sqrt2=dsqrt(2.0d0) | ||
| 20 | |||
| 21 | contains | ||
| 22 | |||
| 23 | ! From: http://fortranwiki.org/fortran/show/newunit | ||
| 24 | ! This is a simple function to search for an available unit. | ||
| 25 | ! LUN_MIN and LUN_MAX define the range of possible LUNs to check. | ||
| 26 | ! The UNIT value is returned by the function, and also by the optional | ||
| 27 | ! argument. This allows the function to be used directly in an OPEN | ||
| 28 | ! statement, and optionally save the result in a local variable. | ||
| 29 | ! If no units are available, -1 is returned. | ||
| 30 | ✗ | integer function newunit(unit) | |
| 31 | integer, intent(out), optional :: unit | ||
| 32 | ! local | ||
| 33 | integer, parameter :: LUN_MIN=10, LUN_MAX=1000 | ||
| 34 | logical :: opened | ||
| 35 | integer :: lun | ||
| 36 | ! begin | ||
| 37 | ✗ | newunit=-1 | |
| 38 | ✗ | do lun=LUN_MIN,LUN_MAX | |
| 39 | ✗ | inquire(unit=lun,opened=opened) | |
| 40 | ✗ | if (.not. opened) then | |
| 41 | newunit=lun | ||
| 42 | exit | ||
| 43 | end if | ||
| 44 | end do | ||
| 45 | ✗ | if (present(unit)) unit=newunit | |
| 46 | ✗ | end function newunit | |
| 47 | |||
| 48 | end module util | ||
| 49 |