1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-12-22 20:35:44 +01:00

add Fortran test for reading sparse data size

This commit is contained in:
q-posev 2021-12-02 17:35:06 +01:00
parent d2c95cd306
commit 7e83e6698d

View File

@ -11,12 +11,12 @@ program test_trexio
print'(a,i3)', " TREXIO MINOR VERSION : ", TREXIO_VERSION_MINOR print'(a,i3)', " TREXIO MINOR VERSION : ", TREXIO_VERSION_MINOR
print * , "============================================" print * , "============================================"
call system('rm -rf test_write_f.dir') call system('rm -rf -- test_write_f.dir')
print *, 'call test_write(''test_write_f.dir'', TREXIO_TEXT)' print *, 'call test_write(''test_write_f.dir'', TREXIO_TEXT)'
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)' print *, 'call test_read(''test_write_f.dir'', TREXIO_TEXT)'
call test_read('test_write_f.dir', TREXIO_TEXT) call test_read('test_write_f.dir', TREXIO_TEXT)
call system('rm -rf test_write_f.dir') call system('rm -rf -- test_write_f.dir')
call test_read_void('test_write_f.dir', TREXIO_TEXT) call test_read_void('test_write_f.dir', TREXIO_TEXT)
@ -152,6 +152,9 @@ subroutine test_write(file_name, back_end)
rc = trexio_has_nucleus_coord(trex_file) rc = trexio_has_nucleus_coord(trex_file)
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS HAS 2') call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS HAS 2')
rc = trexio_has_mo_2e_int_eri(trex_file)
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS HAS 3')
rc = trexio_close(trex_file) rc = trexio_close(trex_file)
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS CLOSE') call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS CLOSE')
@ -191,6 +194,7 @@ subroutine test_read(file_name, back_end)
double precision :: value_sparse_mo_2e_int_eri(20) double precision :: value_sparse_mo_2e_int_eri(20)
integer(8) :: read_buf_size = 10 integer(8) :: read_buf_size = 10
integer(8) :: offset_read = 40 integer(8) :: offset_read = 40
integer(8) :: size_toread = 0
character*(128) :: str character*(128) :: str
@ -276,6 +280,17 @@ subroutine test_read(file_name, back_end)
call exit(-1) call exit(-1)
endif endif
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
print *, 'FAILURE SPARSE DATA CHECK'
call exit(-1)
endif
rc = trexio_close(trex_file) rc = trexio_close(trex_file)
call trexio_assert(rc, TREXIO_SUCCESS) call trexio_assert(rc, TREXIO_SUCCESS)