ESPUTR
calculation of sputtering yields
esputr_test.f90
Go to the documentation of this file.
1 
6 
7 ! Copyright (c) 2016 Forschungszentrum Juelich GmbH
8 ! Markus Brenneis, Vladislav Kotov
9 !
10 ! This file is part of ESPUTR.
11 !
12 ! ESPUTR is free software: you can redistribute it and/or modify
13 ! it under the terms of the GNU General Public License as published by
14 ! the Free Software Foundation, either version 3 of the License, or
15 ! (at your option) any later version.
16 !
17 ! ESPUTR is distributed in the hope that it will be useful,
18 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ! GNU General Public License for more details.
21 !
22 ! You should have received a copy of the GNU General Public License
23 ! along with ESPUTR. If not, see <http://www.gnu.org/licenses/>.
24 !
25 
27  use esputr
28  implicit none
29  public ispassed, printfailed
30 
32  real(kind=ESPUTR_DP), parameter, public :: esputr_tol = 2e-7
33 
34  contains
35 
38  logical elemental function ispassed(expected, calculated)
39  real(kind=ESPUTR_DP), intent(in) :: expected, calculated
40  intrinsic tiny
41  real(kind=ESPUTR_DP) :: eps
42  eps=10.*tiny(expected)
43  ispassed = abs(calculated - expected) < esputr_tol*expected + eps
44  end function ispassed
45 
50  subroutine printfailed(expected, calculated, passed)
51  real(kind=ESPUTR_DP), dimension(:), intent(in) :: expected, calculated
52  logical, dimension(size(expected)), intent(in) :: passed
53  integer :: i
54  do i = 1, size(expected)
55  if(.not. passed(i)) then
56  print *, " Expected", expected(i), ", got", calculated(i)
57  print *, " Relative Error", abs(calculated(i) - expected(i))*100/expected(i), "%"
58  end if
59  end do
60  end subroutine printfailed
61 
62 end module esputr_test
subroutine, public printfailed(expected, calculated, passed)
Print pairs of values (expected(i),calculated(i)) for which passed(i)=.false.
Definition: esputr_test.f90:51
logical elemental function, public ispassed(expected, calculated)
Definition: esputr_test.f90:39
real(kind=esputr_dp), parameter, public esputr_tol
Maximum relative error, parameter which is used to compare two values.
Definition: esputr_test.f90:32