2021-03-22 16:40:45 +01:00
|
|
|
program test_trexio
|
2021-06-04 18:14:45 +02:00
|
|
|
use trexio
|
2021-11-02 11:06:03 +01:00
|
|
|
use, intrinsic :: iso_c_binding
|
2021-06-04 18:14:45 +02:00
|
|
|
implicit none
|
2021-12-01 13:35:42 +01:00
|
|
|
|
2021-11-02 11:06:03 +01:00
|
|
|
logical :: have_hdf5
|
2021-03-22 16:40:45 +01:00
|
|
|
|
2021-12-01 13:35:42 +01:00
|
|
|
print * , "============================================"
|
|
|
|
print'(a,a)' , " TREXIO VERSION STRING : ", TREXIO_PACKAGE_VERSION
|
2021-10-08 13:55:56 +02:00
|
|
|
print'(a,i3)', " TREXIO MAJOR VERSION : ", TREXIO_VERSION_MAJOR
|
|
|
|
print'(a,i3)', " TREXIO MINOR VERSION : ", TREXIO_VERSION_MINOR
|
2021-12-01 13:35:42 +01:00
|
|
|
print * , "============================================"
|
2021-10-08 13:55:56 +02:00
|
|
|
|
2021-12-02 17:35:06 +01:00
|
|
|
call system('rm -rf -- test_write_f.dir')
|
2021-06-08 14:39:04 +02:00
|
|
|
print *, 'call test_write(''test_write_f.dir'', TREXIO_TEXT)'
|
|
|
|
call test_write('test_write_f.dir', TREXIO_TEXT)
|
|
|
|
print *, 'call test_read(''test_write_f.dir'', TREXIO_TEXT)'
|
|
|
|
call test_read('test_write_f.dir', TREXIO_TEXT)
|
2021-12-02 17:35:06 +01:00
|
|
|
call system('rm -rf -- test_write_f.dir')
|
2021-06-04 18:14:45 +02:00
|
|
|
|
2021-09-22 14:50:22 +02:00
|
|
|
call test_read_void('test_write_f.dir', TREXIO_TEXT)
|
|
|
|
|
2021-12-01 13:35:42 +01:00
|
|
|
! No way to conditionally check whether compilation was done with HDF5
|
2021-11-01 11:57:03 +01:00
|
|
|
! So temporarily disable the test for HDF5 back end at the moment
|
2021-11-02 11:06:03 +01:00
|
|
|
have_hdf5 = trexio_has_backend(TREXIO_HDF5)
|
|
|
|
if (have_hdf5) then
|
|
|
|
call system('rm -f -- test_write_f.h5')
|
|
|
|
print *, 'call test_write(''test_write_f.h5'', TREXIO_HDF5)'
|
|
|
|
call test_write('test_write_f.h5', TREXIO_HDF5)
|
|
|
|
print *, 'call test_read(''test_write_f.h5'', TREXIO_HDF5)'
|
|
|
|
call test_read('test_write_f.h5', TREXIO_HDF5)
|
|
|
|
call system('rm -f -- test_write_f.h5')
|
2021-12-01 13:35:42 +01:00
|
|
|
|
2021-11-02 11:06:03 +01:00
|
|
|
call test_read_void('test_write_f.h5', TREXIO_HDF5)
|
|
|
|
endif
|
2021-03-24 11:14:47 +01:00
|
|
|
|
|
|
|
end program test_trexio
|
2021-03-22 16:40:45 +01:00
|
|
|
|
2021-06-04 18:14:45 +02:00
|
|
|
subroutine test_write(file_name, back_end)
|
2021-03-30 14:20:46 +02:00
|
|
|
|
|
|
|
! ============ Test write functionality =============== !
|
2021-04-01 22:48:04 +02:00
|
|
|
|
2021-03-24 11:14:47 +01:00
|
|
|
use trexio
|
2021-06-03 13:42:56 +02:00
|
|
|
use, intrinsic :: iso_c_binding
|
2021-06-01 14:59:08 +02:00
|
|
|
|
2021-03-22 16:40:45 +01:00
|
|
|
implicit none
|
|
|
|
|
2021-06-04 18:14:45 +02:00
|
|
|
character*(*), intent(in) :: file_name
|
2021-06-07 11:17:02 +02:00
|
|
|
integer, intent(in) :: back_end
|
2021-06-04 18:14:45 +02:00
|
|
|
|
2021-03-24 16:06:04 +01:00
|
|
|
integer(8) :: trex_file
|
2021-03-22 16:40:45 +01:00
|
|
|
|
2021-03-24 17:22:58 +01:00
|
|
|
integer :: rc = 1
|
2021-06-07 11:01:37 +02:00
|
|
|
|
2021-10-21 15:52:12 +02:00
|
|
|
integer :: num, basis_shell_num
|
2021-03-23 16:34:13 +01:00
|
|
|
|
2021-10-19 10:22:08 +02:00
|
|
|
integer :: basis_nucleus_index(24)
|
2021-03-24 16:06:04 +01:00
|
|
|
double precision :: charge(12)
|
2021-04-20 01:34:11 +02:00
|
|
|
double precision :: coord(3,12)
|
2021-03-24 11:14:47 +01:00
|
|
|
|
2021-06-04 15:36:56 +02:00
|
|
|
character(len=:), allocatable :: sym_str
|
2021-06-15 10:20:01 +02:00
|
|
|
character(len=:), allocatable :: label(:)
|
2021-06-01 14:59:08 +02:00
|
|
|
|
2021-12-01 13:35:42 +01:00
|
|
|
! sparse data
|
2021-12-07 14:43:42 +01:00
|
|
|
integer(4) :: index_sparse_mo_2e_int_eri(4,100)
|
2021-12-01 13:35:42 +01:00
|
|
|
double precision :: value_sparse_mo_2e_int_eri(100)
|
|
|
|
|
|
|
|
integer :: i, n_buffers = 5
|
2021-12-09 16:13:28 +01:00
|
|
|
integer(8) :: buf_size, offset
|
2021-12-01 13:35:42 +01:00
|
|
|
buf_size = 100/n_buffers
|
|
|
|
|
|
|
|
do i = 1, 100
|
2021-12-07 14:43:42 +01:00
|
|
|
index_sparse_mo_2e_int_eri(1,i) = 4*i - 3
|
|
|
|
index_sparse_mo_2e_int_eri(2,i) = 4*i+1 - 3
|
|
|
|
index_sparse_mo_2e_int_eri(3,i) = 4*i+2 - 3
|
|
|
|
index_sparse_mo_2e_int_eri(4,i) = 4*i+3 - 3
|
2021-12-01 13:35:42 +01:00
|
|
|
value_sparse_mo_2e_int_eri(i) = 3.14 + float(i)
|
|
|
|
enddo
|
|
|
|
|
2021-03-30 14:20:46 +02:00
|
|
|
! parameters to be written
|
2021-03-23 18:12:53 +01:00
|
|
|
num = 12
|
2021-04-20 01:34:11 +02:00
|
|
|
charge = (/ 6., 6., 6., 6., 6., 6., 1., 1., 1., 1., 1., 1. /)
|
|
|
|
coord = reshape( (/ 0.00000000d0, 1.39250319d0 , 0.00000000d0 , &
|
|
|
|
-1.20594314d0, 0.69625160d0 , 0.00000000d0 , &
|
|
|
|
-1.20594314d0, -0.69625160d0 , 0.00000000d0 , &
|
|
|
|
0.00000000d0, -1.39250319d0 , 0.00000000d0 , &
|
|
|
|
1.20594314d0, -0.69625160d0 , 0.00000000d0 , &
|
|
|
|
1.20594314d0, 0.69625160d0 , 0.00000000d0 , &
|
|
|
|
-2.14171677d0, 1.23652075d0 , 0.00000000d0 , &
|
|
|
|
-2.14171677d0, -1.23652075d0 , 0.00000000d0 , &
|
|
|
|
0.00000000d0, -2.47304151d0 , 0.00000000d0 , &
|
|
|
|
2.14171677d0, -1.23652075d0 , 0.00000000d0 , &
|
|
|
|
2.14171677d0, 1.23652075d0 , 0.00000000d0 , &
|
|
|
|
0.00000000d0, 2.47304151d0 , 0.00000000d0 /), &
|
|
|
|
shape(coord) )
|
2021-03-30 14:20:46 +02:00
|
|
|
|
2021-10-21 15:52:12 +02:00
|
|
|
basis_shell_num = 24
|
2021-10-19 10:22:08 +02:00
|
|
|
basis_nucleus_index = (/ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 /)
|
2021-06-10 01:49:43 +02:00
|
|
|
|
2021-06-08 16:13:11 +02:00
|
|
|
label = [character(len=8) :: 'C', 'Na','C', 'C 66', 'C','C', 'H 99', 'Ru', 'H', 'H', 'H', 'H' ]
|
2021-06-01 14:59:08 +02:00
|
|
|
|
2021-06-15 11:26:03 +02:00
|
|
|
sym_str = 'B3U with some comments'
|
2021-06-01 14:59:08 +02:00
|
|
|
|
2021-03-30 14:20:46 +02:00
|
|
|
! ================= START OF TEST ===================== !
|
2021-03-23 18:12:53 +01:00
|
|
|
|
2021-09-22 14:50:22 +02:00
|
|
|
trex_file = trexio_open(file_name, 'w', back_end, rc)
|
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS)
|
2021-03-30 11:56:04 +02:00
|
|
|
|
|
|
|
rc = trexio_has_nucleus_num(trex_file)
|
2021-06-14 11:54:10 +02:00
|
|
|
call trexio_assert(rc, TREXIO_HAS_NOT, 'SUCCESS HAS NOT 1')
|
2021-06-04 18:14:45 +02:00
|
|
|
|
2021-03-30 11:56:04 +02:00
|
|
|
rc = trexio_has_nucleus_charge(trex_file)
|
2021-06-14 11:54:10 +02:00
|
|
|
call trexio_assert(rc, TREXIO_HAS_NOT, 'SUCCESS HAS NOT 2')
|
2021-03-22 16:40:45 +01:00
|
|
|
|
2021-12-01 13:35:42 +01:00
|
|
|
rc = trexio_has_mo_2e_int_eri(trex_file)
|
|
|
|
call trexio_assert(rc, TREXIO_HAS_NOT, 'SUCCESS HAS NOT 3')
|
|
|
|
|
2021-03-24 11:14:47 +01:00
|
|
|
rc = trexio_write_nucleus_num(trex_file, num)
|
2021-06-14 11:54:10 +02:00
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE NUM')
|
2021-04-01 22:48:04 +02:00
|
|
|
|
2021-03-24 16:06:04 +01:00
|
|
|
rc = trexio_write_nucleus_charge(trex_file, charge)
|
2021-06-14 11:54:10 +02:00
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE CHARGE')
|
2021-03-23 16:34:13 +01:00
|
|
|
|
2021-03-24 16:06:04 +01:00
|
|
|
rc = trexio_write_nucleus_coord(trex_file, coord)
|
2021-06-14 11:54:10 +02:00
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE COORD')
|
2021-03-23 16:34:13 +01:00
|
|
|
|
2021-06-15 10:20:01 +02:00
|
|
|
rc = trexio_write_nucleus_label(trex_file, label, 5)
|
2021-06-15 11:26:03 +02:00
|
|
|
deallocate(label)
|
2021-12-10 11:34:37 +01:00
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE LABEL')
|
2021-06-01 14:59:08 +02:00
|
|
|
|
2021-06-14 11:54:10 +02:00
|
|
|
rc = trexio_write_nucleus_point_group(trex_file, sym_str, 32)
|
2021-06-04 15:36:56 +02:00
|
|
|
deallocate(sym_str)
|
2021-06-14 11:54:10 +02:00
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE POINT GROUP')
|
2021-06-04 15:36:56 +02:00
|
|
|
|
2021-10-21 15:52:12 +02:00
|
|
|
rc = trexio_write_basis_shell_num(trex_file, basis_shell_num)
|
2021-10-19 10:22:08 +02:00
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE BASIS NUM')
|
2021-03-30 11:56:04 +02:00
|
|
|
|
2021-06-15 11:49:42 +02:00
|
|
|
rc = trexio_write_basis_nucleus_index(trex_file, basis_nucleus_index)
|
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE INDEX')
|
2021-03-24 11:14:47 +01:00
|
|
|
|
2021-12-09 16:13:28 +01:00
|
|
|
offset = 0
|
2021-12-10 11:34:37 +01:00
|
|
|
do i = 1,n_buffers
|
2021-12-01 13:35:42 +01:00
|
|
|
rc = trexio_write_mo_2e_int_eri(trex_file, offset, buf_size, &
|
2021-12-07 14:43:42 +01:00
|
|
|
index_sparse_mo_2e_int_eri(1,offset+1), &
|
2021-12-01 13:35:42 +01:00
|
|
|
value_sparse_mo_2e_int_eri(offset+1))
|
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE SPARSE')
|
|
|
|
offset = offset + buf_size
|
|
|
|
enddo
|
2021-04-01 22:48:04 +02:00
|
|
|
|
2021-03-30 11:56:04 +02:00
|
|
|
rc = trexio_has_nucleus_num(trex_file)
|
2021-06-14 11:54:10 +02:00
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS HAS 1')
|
2021-06-04 18:14:45 +02:00
|
|
|
|
2021-03-30 11:56:04 +02:00
|
|
|
rc = trexio_has_nucleus_coord(trex_file)
|
2021-06-14 11:54:10 +02:00
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS HAS 2')
|
2021-03-30 11:56:04 +02:00
|
|
|
|
2021-12-02 17:35:06 +01:00
|
|
|
rc = trexio_has_mo_2e_int_eri(trex_file)
|
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS HAS 3')
|
|
|
|
|
2021-03-24 11:14:47 +01:00
|
|
|
rc = trexio_close(trex_file)
|
2021-06-14 11:54:10 +02:00
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS CLOSE')
|
2021-03-24 11:14:47 +01:00
|
|
|
|
2021-03-30 14:20:46 +02:00
|
|
|
! ================= END OF TEST ===================== !
|
|
|
|
|
2021-03-24 11:14:47 +01:00
|
|
|
end subroutine test_write
|
|
|
|
|
2021-06-04 18:14:45 +02:00
|
|
|
|
|
|
|
subroutine test_read(file_name, back_end)
|
2021-03-24 11:14:47 +01:00
|
|
|
|
2021-03-30 14:20:46 +02:00
|
|
|
! ============ Test read functionality =============== !
|
|
|
|
|
2021-03-24 11:14:47 +01:00
|
|
|
use trexio
|
|
|
|
implicit none
|
|
|
|
|
2021-06-04 18:14:45 +02:00
|
|
|
character*(*), intent(in) :: file_name
|
2021-06-07 11:17:02 +02:00
|
|
|
integer, intent(in) :: back_end
|
2021-06-04 18:14:45 +02:00
|
|
|
|
2021-03-24 16:06:04 +01:00
|
|
|
integer(8) :: trex_file
|
2021-03-24 11:14:47 +01:00
|
|
|
|
2021-06-01 14:59:08 +02:00
|
|
|
integer :: i, j, k, ind, offset, flag
|
2021-03-24 17:22:58 +01:00
|
|
|
integer :: rc = 1
|
2021-10-21 15:52:12 +02:00
|
|
|
integer :: num, num_read, basis_shell_num
|
2021-03-24 11:14:47 +01:00
|
|
|
|
2021-10-19 10:22:08 +02:00
|
|
|
integer :: basis_nucleus_index(24)
|
2021-04-01 22:48:04 +02:00
|
|
|
double precision :: charge(12)
|
|
|
|
double precision :: coord(3,12)
|
2021-06-04 15:36:56 +02:00
|
|
|
|
2021-06-08 16:13:11 +02:00
|
|
|
character :: label_str(128)
|
2021-06-01 14:59:08 +02:00
|
|
|
character(len=4) :: tmp_str
|
2021-06-15 10:20:01 +02:00
|
|
|
character(len=4) :: label(12) ! also works with allocatable arrays
|
2021-04-01 22:48:04 +02:00
|
|
|
|
2021-06-04 15:36:56 +02:00
|
|
|
character(len=32) :: sym_str
|
|
|
|
|
2021-12-01 13:35:42 +01:00
|
|
|
! sparse data
|
2021-12-07 14:43:42 +01:00
|
|
|
integer(4) :: index_sparse_mo_2e_int_eri(4,20)
|
2021-12-01 13:35:42 +01:00
|
|
|
double precision :: value_sparse_mo_2e_int_eri(20)
|
|
|
|
integer(8) :: read_buf_size = 10
|
|
|
|
integer(8) :: offset_read = 40
|
2021-12-02 17:35:06 +01:00
|
|
|
integer(8) :: size_toread = 0
|
2021-12-01 13:35:42 +01:00
|
|
|
|
2021-04-01 22:48:04 +02:00
|
|
|
character*(128) :: str
|
2021-03-24 11:14:47 +01:00
|
|
|
|
|
|
|
num = 12
|
2021-10-21 15:52:12 +02:00
|
|
|
basis_shell_num = 24
|
2021-03-24 11:14:47 +01:00
|
|
|
|
2021-12-01 13:35:42 +01:00
|
|
|
index_sparse_mo_2e_int_eri = 0
|
|
|
|
value_sparse_mo_2e_int_eri = 0.0d0
|
|
|
|
|
2021-03-30 14:20:46 +02:00
|
|
|
! ================= START OF TEST ===================== !
|
|
|
|
|
2021-09-22 14:50:22 +02:00
|
|
|
trex_file = trexio_open(file_name, 'r', back_end, rc)
|
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS)
|
2021-03-23 16:34:13 +01:00
|
|
|
|
2021-06-14 11:54:10 +02:00
|
|
|
rc = trexio_read_nucleus_num(trex_file, num_read)
|
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS)
|
|
|
|
if (num_read == num) then
|
2021-06-04 18:14:45 +02:00
|
|
|
write(*,*) 'SUCCESS READ NUM'
|
|
|
|
else
|
2021-06-14 11:54:10 +02:00
|
|
|
print *, 'FAILURE NUM CHECK'
|
|
|
|
call exit(-1)
|
2021-06-04 18:14:45 +02:00
|
|
|
endif
|
|
|
|
|
2021-03-24 11:14:47 +01:00
|
|
|
|
2021-03-24 16:06:04 +01:00
|
|
|
rc = trexio_read_nucleus_charge(trex_file, charge)
|
2021-06-14 11:54:10 +02:00
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS)
|
|
|
|
if (dabs(charge(11) - 1.d0) < 1.0D-8) then
|
2021-06-04 18:14:45 +02:00
|
|
|
write(*,*) 'SUCCESS READ CHARGE'
|
|
|
|
else
|
2021-06-14 11:54:10 +02:00
|
|
|
print *, 'FAILURE CHARGE CHECK'
|
2021-06-04 18:14:45 +02:00
|
|
|
call exit(-1)
|
|
|
|
endif
|
2021-03-22 16:40:45 +01:00
|
|
|
|
2021-03-30 14:20:46 +02:00
|
|
|
|
2021-06-14 11:54:10 +02:00
|
|
|
rc = trexio_read_nucleus_coord(trex_file, coord)
|
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS)
|
|
|
|
if (dabs(coord(2,1) - 1.39250319d0) < 1.0D-8) then
|
2021-06-04 18:14:45 +02:00
|
|
|
write(*,*) 'SUCCESS READ COORD'
|
|
|
|
else
|
2021-06-14 11:54:10 +02:00
|
|
|
print *, 'FAILURE COORD CHECK'
|
2021-06-04 18:14:45 +02:00
|
|
|
call exit(-1)
|
|
|
|
endif
|
2021-03-24 17:22:58 +01:00
|
|
|
|
2021-12-01 13:35:42 +01:00
|
|
|
|
2021-06-15 10:20:01 +02:00
|
|
|
rc = trexio_read_nucleus_label(trex_file, label, 2)
|
2021-06-14 11:54:10 +02:00
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS)
|
|
|
|
if (trim(label(2)) == 'Na') then
|
2021-06-07 11:01:37 +02:00
|
|
|
write(*,*) 'SUCCESS READ LABEL'
|
|
|
|
else
|
2021-06-14 11:54:10 +02:00
|
|
|
print *, 'FAILURE LABEL CHECK'
|
2021-06-07 11:01:37 +02:00
|
|
|
call exit(-1)
|
|
|
|
endif
|
2021-06-04 15:36:56 +02:00
|
|
|
|
2021-06-08 16:13:11 +02:00
|
|
|
|
2021-06-10 01:49:43 +02:00
|
|
|
rc = trexio_read_basis_nucleus_index(trex_file, basis_nucleus_index)
|
2021-06-15 11:49:42 +02:00
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS)
|
|
|
|
if (basis_nucleus_index(12) == 12) then
|
2021-06-10 01:49:43 +02:00
|
|
|
write(*,*) 'SUCCESS READ INDEX'
|
|
|
|
else
|
2021-06-15 11:49:42 +02:00
|
|
|
print *, 'FAILURE INDEX CHECK'
|
2021-06-10 01:49:43 +02:00
|
|
|
call exit(-1)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2021-06-15 11:26:03 +02:00
|
|
|
rc = trexio_read_nucleus_point_group(trex_file, sym_str, 10)
|
2021-06-14 11:54:10 +02:00
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS)
|
|
|
|
if (sym_str(1:3) == 'B3U') then
|
2021-06-07 11:01:37 +02:00
|
|
|
write(*,*) 'SUCCESS READ POINT GROUP'
|
|
|
|
else
|
2021-06-14 11:54:10 +02:00
|
|
|
print *, 'FAILURE POINT GROUP CHECK'
|
2021-06-07 11:01:37 +02:00
|
|
|
call exit(-1)
|
|
|
|
endif
|
2021-06-01 14:59:08 +02:00
|
|
|
|
2021-03-22 16:40:45 +01:00
|
|
|
|
2021-12-01 13:35:42 +01:00
|
|
|
rc = trexio_read_mo_2e_int_eri(trex_file, offset_read, read_buf_size, &
|
2021-12-07 14:43:42 +01:00
|
|
|
index_sparse_mo_2e_int_eri(1,5+1), &
|
2021-12-01 13:35:42 +01:00
|
|
|
value_sparse_mo_2e_int_eri(5+1))
|
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS)
|
2021-12-07 14:43:42 +01:00
|
|
|
if (index_sparse_mo_2e_int_eri(1,1) == 0 .and. index_sparse_mo_2e_int_eri(1,5+1) == offset_read*4+1) then
|
2021-12-01 13:35:42 +01:00
|
|
|
write(*,*) 'SUCCESS READ SPARSE DATA'
|
|
|
|
else
|
|
|
|
print *, 'FAILURE SPARSE DATA CHECK'
|
|
|
|
call exit(-1)
|
|
|
|
endif
|
|
|
|
|
2021-12-02 17:35:06 +01:00
|
|
|
|
|
|
|
rc = trexio_read_mo_2e_int_eri_size(trex_file, size_toread)
|
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS)
|
|
|
|
if (size_toread == 100) then
|
|
|
|
write(*,*) 'SUCCESS READ SPARSE SIZE'
|
|
|
|
else
|
2021-12-10 11:34:37 +01:00
|
|
|
print *, 'FAILURE SPARSE SIZE CHECK'
|
2021-12-02 17:35:06 +01:00
|
|
|
call exit(-1)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2021-03-24 11:14:47 +01:00
|
|
|
rc = trexio_close(trex_file)
|
2021-06-14 11:54:10 +02:00
|
|
|
call trexio_assert(rc, TREXIO_SUCCESS)
|
2021-03-22 16:40:45 +01:00
|
|
|
|
2021-03-30 14:20:46 +02:00
|
|
|
! ================= END OF TEST ===================== !
|
|
|
|
|
2021-03-24 11:14:47 +01:00
|
|
|
end subroutine test_read
|
2021-03-23 18:12:53 +01:00
|
|
|
|
2021-09-22 14:50:22 +02:00
|
|
|
subroutine test_read_void(file_name, back_end)
|
|
|
|
|
|
|
|
! ============ Test read of non-existing file =============== !
|
|
|
|
|
|
|
|
use trexio
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
character*(*), intent(in) :: file_name
|
|
|
|
integer, intent(in) :: back_end
|
|
|
|
|
|
|
|
integer(8) :: trex_file
|
|
|
|
integer :: rc = 1
|
|
|
|
character(128) :: str
|
|
|
|
|
|
|
|
! ================= START OF TEST ===================== !
|
|
|
|
|
|
|
|
trex_file = trexio_open(file_name, 'r', back_end, rc)
|
|
|
|
call trexio_assert(rc, TREXIO_OPEN_ERROR)
|
|
|
|
|
|
|
|
call trexio_string_of_error(rc, str)
|
|
|
|
print *, trim(str)
|
|
|
|
|
|
|
|
! ================= END OF TEST ===================== !
|
|
|
|
|
|
|
|
end subroutine test_read_void
|