1module m_test_io
2
3  implicit none
4
5contains
6
7  ! Module to test various IO-routines
8
9  subroutine time_io(nspin,nsc,D_2D)
10
11    use precision, only : dp
12    use parallel, only : Node
13    use class_Sparsity
14    use class_dSpData2D
15    use m_matio
16    use m_iodm
17
18    integer, intent(in) :: nspin
19    integer, intent(in) :: nsc(3)
20    type(dSpData2D), intent(inout) :: D_2D
21
22    type(Sparsity), pointer :: sp
23    integer :: n_nzs, no_l, i
24    integer, parameter :: N_WRITES = 50
25    real(dp), pointer :: a_2D(:,:)
26    integer, pointer :: ncol(:), l_ptr(:), l_col(:)
27
28    sp => spar(D_2D)
29    call attach(sp, nrows=no_l, nnzs=n_nzs, &
30         n_col=ncol,list_ptr=l_ptr,list_col=l_col)
31
32    a_2d => val(D_2D)
33
34    if ( Node == 0 ) then
35       write(*,*)' Starting the mat-io non-compatible'
36    end if
37
38    call timer('MATIO-F',1)
39    do i = 1 , N_WRITES
40       call write_mat(n_nzs,no_l,nspin,ncol,l_ptr,l_col,a_2d, &
41            userfile='TESTIO.DM',compatible=.false.)
42    end do
43    call timer('MATIO-F',2)
44
45    if ( Node == 0 ) then
46       write(*,*)' Starting the mat-io compatible'
47    end if
48
49    call timer('MATIO-T',1)
50    do i = 1 , N_WRITES
51       call write_mat(n_nzs,no_l,nspin,ncol,l_ptr,l_col,a_2d, &
52            userfile='TESTIO.DM',compatible=.true.)
53    end do
54    call timer('MATIO-T',2)
55
56    if ( Node == 0 ) then
57       write(*,*)' Starting the Nick-io'
58    end if
59
60    call timer('NICK-io',1)
61    do i = 1 , N_WRITES
62       call write_dm('TESTIO.DM',nsc,D_2D)
63    end do
64    call timer('NICK-io',2)
65
66    call timer('MATIO-F',3)
67    call timer('MATIO-T',3)
68    call timer('NICK-io',3)
69
70    call die('Stopping...')
71
72  end subroutine time_io
73
74end module m_test_io
75