dcdfort
Modern Fortran library for analyzing DCD trajectories
Data Types | Functions/Subroutines | Variables
dcdfort_tests Module Reference

Data Types

interface  check
 

Functions/Subroutines

subroutine do_output (total, passed, test_result)
 
subroutine check_int (x, y, passed, total)
 
subroutine check_real (x, y, passed, total)
 
subroutine check_array (x, y, passed, total)
 
subroutine check_array_2d (x, y, passed, total)
 
subroutine finished_tests (passed, total)
 

Variables

type(trajectorytrj
 
real(8), parameter pi = 2.0d0*acos(0.0d0)
 
character(len=8), parameter dcdfile = "test.dcd"
 
character(len=8), parameter ndxfile = "test.ndx"
 
real, dimension(3) x
 
real, dimension(3) y
 
real, dimension(3) z
 
real, dimension(3) w
 
real, dimension(3) ans
 
real, dimension(6) box
 
real, dimension(6) ans_box
 
real b
 
real c
 
integer passed = 0
 
integer total = 0
 
integer a
 
integer ans_val
 
integer n
 

Function/Subroutine Documentation

◆ check_array()

subroutine dcdfort_tests::check_array ( real, dimension(:), intent(in)  x,
real, dimension(:), intent(in)  y,
integer, intent(inout)  passed,
integer, intent(inout)  total 
)
81 
82  implicit none
83 
84  integer, intent(inout) :: total, passed
85  real, intent(in) :: x(:), y(:)
86  real :: tol = 1e-4
87 
88  call do_output(total, passed, all(abs(x - y) .le. tol))
89 

◆ check_array_2d()

subroutine dcdfort_tests::check_array_2d ( real, dimension(:,:), intent(in)  x,
real, dimension(:,:), intent(in)  y,
integer, intent(inout)  passed,
integer, intent(inout)  total 
)
93 
94  implicit none
95 
96  integer, intent(inout) :: total, passed
97  real, intent(in) :: x(:,:), y(:,:)
98  real :: tol = 1e-6
99 
100  call do_output(total, passed, all(abs(x - y) .le. tol))
101 

◆ check_int()

subroutine dcdfort_tests::check_int ( integer, intent(in)  x,
integer, intent(in)  y,
integer, intent(inout)  passed,
integer, intent(inout)  total 
)
58 
59  implicit none
60 
61  integer, intent(inout) :: total, passed
62  integer, intent(in) :: x, y
63 
64  call do_output(total, passed, x .eq. y)
65 

◆ check_real()

subroutine dcdfort_tests::check_real ( real, intent(in)  x,
real, intent(in)  y,
integer, intent(inout)  passed,
integer, intent(inout)  total 
)
69 
70  implicit none
71 
72  integer, intent(inout) :: total, passed
73  real, intent(in) :: x, y
74  real :: tol = 1e-4
75 
76  call do_output(total, passed, abs(x-y) .le. tol)
77 

◆ do_output()

subroutine dcdfort_tests::do_output ( integer, intent(inout)  total,
integer, intent(inout)  passed,
logical, intent(in)  test_result 
)
42 
43  implicit none
44  integer, intent(inout) :: total, passed
45  logical, intent(in) :: test_result
46  integer :: i
47  character (len=6) :: passfail(0:1) = ["FAILED", "PASSED"]
48 
49  i = merge(1, 0, test_result)
50  total = total + 1
51  passed = passed + i
52 
53  write(output_unit, '(a,i2,a,a)') "TEST ", total, ": ", passfail(i)
54 

◆ finished_tests()

subroutine dcdfort_tests::finished_tests ( integer, intent(inout)  passed,
integer, intent(inout)  total 
)
105 
106  implicit none
107 
108  integer, intent(inout) :: total, passed
109 
110  write(output_unit,*)
111  write(output_unit,'(a,i0,a,i0,a)') "Passed ", passed, " out of ", total, " tests"
112  write(output_unit,*)
113 
114  if (passed .ne. total) then
115  write(output_unit, '(a)') "WARNING: Some tests failed!"
116  stop 1
117  end if
118 

Variable Documentation

◆ a

integer dcdfort_tests::a

◆ ans

real, dimension(3) dcdfort_tests::ans

◆ ans_box

real, dimension(6) dcdfort_tests::ans_box

◆ ans_val

integer dcdfort_tests::ans_val

◆ b

real dcdfort_tests::b

◆ box

real, dimension(6) dcdfort_tests::box

◆ c

real dcdfort_tests::c

◆ dcdfile

character (len=8), parameter dcdfort_tests::dcdfile = "test.dcd"
30  character (len=8), parameter :: dcdfile = "test.dcd"

◆ n

integer dcdfort_tests::n

◆ ndxfile

character (len=8), parameter dcdfort_tests::ndxfile = "test.ndx"
31  character (len=8), parameter :: ndxfile = "test.ndx"

◆ passed

integer dcdfort_tests::passed = 0
33  integer :: passed = 0, total = 0, a, ans_val, n

◆ pi

real(8), parameter dcdfort_tests::pi = 2.0d0*acos(0.0d0)
29  real(8), parameter :: pi = 2.0d0*acos(0.0d0)

◆ total

integer dcdfort_tests::total = 0

◆ trj

type(trajectory) dcdfort_tests::trj
28  type(trajectory) :: trj

◆ w

real, dimension(3) dcdfort_tests::w

◆ x

real, dimension(3) dcdfort_tests::x
32  real :: x(3), y(3), z(3), w(3), ans(3), box(6), ans_box(6), b, c

◆ y

real, dimension(3) dcdfort_tests::y

◆ z

real, dimension(3) dcdfort_tests::z