mirror of
https://github.com/TREX-CoE/trexio.git
synced 2025-03-04 14:20:19 +01:00
Merge branch 'det-checks' into debug_flags
This commit is contained in:
commit
4bd147415c
10
configure.ac
10
configure.ac
@ -42,7 +42,11 @@ AC_SUBST([UNAME])
|
||||
## -------------------
|
||||
|
||||
# Fortran API [default: --with-fortran], do not disable in the dev mode
|
||||
FCFLAGS_SAVE="$FCFLAGS"
|
||||
AC_PROG_FC
|
||||
# Removing -O2 from FCFLAGS
|
||||
FCFLAGS="$FCFLAGS_SAVE -g"
|
||||
|
||||
AC_ARG_WITH(fortran, [AS_HELP_STRING([--without-fortran],[do not test and install the Fortran API])], ok=$withval, ok=yes)
|
||||
AS_IF([test "$ok" = "yes"],[
|
||||
AC_FC_FREEFORM
|
||||
@ -79,9 +83,9 @@ AC_PROG_LN_S
|
||||
AC_PROG_GREP
|
||||
|
||||
AS_CASE([$CC],
|
||||
[*gcc*], [CFLAGS="$CFLAGS -g -fPIC"],
|
||||
[*clang*], [CFLAGS="$CFLAGS -g -fPIC"],
|
||||
[*icc*], [CFLAGS="$CFLAGS -g -fPIC"],
|
||||
[*gcc*], [CFLAGS="$CFLAGS -fPIC"],
|
||||
[*clang*], [CFLAGS="$CFLAGS -fPIC"],
|
||||
[*icc*], [CFLAGS="$CFLAGS -fPIC"],
|
||||
[])
|
||||
|
||||
# Check if `cp -r -n` works, otherwise use `cp -r`
|
||||
|
@ -5241,11 +5241,7 @@ end interface
|
||||
integer(c_int32_t), intent(in), value :: max_str_len
|
||||
character(len=*), intent(in) :: str
|
||||
|
||||
character(len=len_trim(str)+1) :: str_c
|
||||
|
||||
str_c = trim(str) // c_null_char
|
||||
|
||||
trexio_write_$group_str$ = trexio_write_$group_str$_c(trex_file, str_c, max_str_len)
|
||||
trexio_write_$group_str$ = trexio_write_$group_str$_c(trex_file, trim(str) // c_null_char, max_str_len)
|
||||
|
||||
end function trexio_write_$group_str$
|
||||
#+end_src
|
||||
@ -6786,11 +6782,9 @@ contains
|
||||
character, intent(in), value :: mode
|
||||
integer(trexio_back_end_t), intent(in), value :: back_end
|
||||
integer(trexio_exit_code), intent(out) :: rc_open
|
||||
character(len=len_trim(filename)+1) :: filename_c
|
||||
integer(trexio_exit_code) :: rc
|
||||
|
||||
filename_c = trim(filename) // c_null_char
|
||||
trexio_open = trexio_open_c(filename_c, mode, back_end, rc_open)
|
||||
trexio_open = trexio_open_c(trim(filename) // c_null_char, mode, back_end, rc_open)
|
||||
if (trexio_open == 0_8 .or. rc_open /= TREXIO_SUCCESS) then
|
||||
return
|
||||
endif
|
||||
@ -6810,10 +6804,8 @@ contains
|
||||
integer(trexio_exit_code) function trexio_inquire (filename)
|
||||
implicit none
|
||||
character(len=*), intent(in) :: filename
|
||||
character(len=len_trim(filename)+1) :: filename_c
|
||||
|
||||
filename_c = trim(filename) // c_null_char
|
||||
trexio_inquire = trexio_inquire_c(filename_c)
|
||||
trexio_inquire = trexio_inquire_c(trim(filename) // c_null_char)
|
||||
end function trexio_inquire
|
||||
#+end_src
|
||||
|
||||
@ -6824,12 +6816,8 @@ contains
|
||||
implicit none
|
||||
character(len=*), intent(in) :: source
|
||||
character(len=*), intent(in) :: destination
|
||||
character(len=len_trim(source)+1) :: source_c
|
||||
character(len=len_trim(destination)+1) :: destination_c
|
||||
|
||||
source_c = trim(source) // c_null_char
|
||||
destination_c = trim(destination) // c_null_char
|
||||
trexio_cp = trexio_cp_c(source_c, destination_c)
|
||||
trexio_cp = trexio_cp_c(trim(source) // c_null_char, trim(destination) // c_null_char)
|
||||
end function trexio_cp
|
||||
#+end_src
|
||||
|
||||
|
@ -5,6 +5,7 @@ program test_trexio
|
||||
|
||||
integer :: rc
|
||||
logical :: have_hdf5
|
||||
character*(64) :: trexio_file1, trexio_file2
|
||||
|
||||
print'(a)' , "============================================"
|
||||
print'(a,a)' , " TREXIO VERSION STRING : ", TREXIO_PACKAGE_VERSION
|
||||
@ -14,20 +15,40 @@ program test_trexio
|
||||
|
||||
rc = trexio_info()
|
||||
|
||||
call system('rm -f -- test_write_f.dir/*.txt test_write_f.dir/*.txt.size test_write_f.dir/.lock ' &
|
||||
// 'test_write_f2.dir/*.txt test_write_f2.dir/*.txt.size test_write_f2.dir/.lock && ' &
|
||||
// 'rm -fd -- test_write_f.dir test_write_f2.dir')
|
||||
print *, 'call test_write(''test_write_f.dir'', TREXIO_TEXT)'
|
||||
call test_write('test_write_f.dir', TREXIO_TEXT)
|
||||
rc = trexio_cp('test_write_f.dir', 'test_write_f2.dir')
|
||||
call trexio_assert(rc, TREXIO_SUCCESS)
|
||||
print *, 'call test_read(''test_write_f2.dir'', TREXIO_TEXT)'
|
||||
call test_read('test_write_f2.dir', TREXIO_TEXT)
|
||||
call system('rm -f -- test_write_f.dir/*.txt test_write_f.dir/*.txt.size test_write_f.dir/.lock ' &
|
||||
// 'test_write_f2.dir/*.txt test_write_f2.dir/*.txt.size test_write_f2.dir/.lock && ' &
|
||||
// 'rm -fd -- test_write_f.dir test_write_f2.dir')
|
||||
trexio_file1 = 'test_write_f.dir'
|
||||
trexio_file2 = 'test_write_f2.dir'
|
||||
|
||||
call test_read_void('test_write_f.dir', TREXIO_TEXT)
|
||||
call system('rm -f -- '//trim(trexio_file1)//'/*.txt')
|
||||
call system('rm -f -- '//trim(trexio_file1)//'/*.txt.size')
|
||||
call system('rm -f -- '//trim(trexio_file1)//'/.lock ')
|
||||
call system('rm -rf -- '//trim(trexio_file1))
|
||||
|
||||
call system('rm -f -- '//trim(trexio_file2)//'/*.txt')
|
||||
call system('rm -f -- '//trim(trexio_file2)//'/*.txt.size')
|
||||
call system('rm -f -- '//trim(trexio_file2)//'/.lock ')
|
||||
call system('rm -rf -- '//trim(trexio_file2))
|
||||
|
||||
print *, 'call test_write'
|
||||
call test_write('test_write_f.dir', TREXIO_TEXT)
|
||||
|
||||
rc = trexio_cp(trexio_file1, trexio_file2)
|
||||
call trexio_assert(rc, TREXIO_SUCCESS)
|
||||
|
||||
print *, 'call test_read'
|
||||
call test_read(trexio_file2, TREXIO_TEXT)
|
||||
|
||||
call system('rm -f -- '//trim(trexio_file1)//'/*.txt')
|
||||
call system('rm -f -- '//trim(trexio_file1)//'/*.txt.size')
|
||||
call system('rm -f -- '//trim(trexio_file1)//'/.lock ')
|
||||
call system('rm -rf -- '//trim(trexio_file1))
|
||||
|
||||
call system('rm -f -- '//trim(trexio_file2)//'/*.txt')
|
||||
call system('rm -f -- '//trim(trexio_file2)//'/*.txt.size')
|
||||
call system('rm -f -- '//trim(trexio_file2)//'/.lock ')
|
||||
call system('rm -rf -- '//trim(trexio_file2))
|
||||
|
||||
print *, 'call test_read_void'
|
||||
call test_read_void(trexio_file1, TREXIO_TEXT)
|
||||
|
||||
! No way to conditionally check whether compilation was done with HDF5
|
||||
! So temporarily disable the test for HDF5 back end at the moment
|
||||
@ -69,14 +90,14 @@ subroutine test_write(file_name, back_end)
|
||||
double precision :: charge(12)
|
||||
double precision :: coord(3,12)
|
||||
|
||||
character(len=32), allocatable :: sym_str
|
||||
character(len=32) :: sym_str
|
||||
character(len=8), allocatable :: label(:)
|
||||
double precision, allocatable :: energy(:)
|
||||
integer , allocatable :: spin(:)
|
||||
|
||||
! sparse data
|
||||
integer(4) :: index_sparse_ao_2e_int_eri(4,100)
|
||||
double precision :: value_sparse_ao_2e_int_eri(100)
|
||||
integer(4), allocatable :: index_sparse_ao_2e_int_eri(:,:)
|
||||
double precision, allocatable :: value_sparse_ao_2e_int_eri(:)
|
||||
|
||||
! determinants
|
||||
integer :: nup, ndn
|
||||
@ -90,9 +111,11 @@ subroutine test_write(file_name, back_end)
|
||||
integer :: state_id
|
||||
|
||||
|
||||
|
||||
buf_size_sparse = 100/n_buffers
|
||||
buf_size_det = 50/n_buffers
|
||||
|
||||
allocate(index_sparse_ao_2e_int_eri(4,100), value_sparse_ao_2e_int_eri(100))
|
||||
! fill sparse indices and values
|
||||
do i = 1, 100
|
||||
index_sparse_ao_2e_int_eri(1,i) = 4*i - 3
|
||||
@ -105,8 +128,9 @@ subroutine test_write(file_name, back_end)
|
||||
! fill determinant list
|
||||
nup = 8
|
||||
ndn = 6
|
||||
det_occ(1:8,1) = (/ 1, 2, 3, 4, 76, 128, 129, 143 /)
|
||||
det_occ(1:6,2) = (/ 1, 3, 4, 80, 81, 139 /)
|
||||
det_occ = 0
|
||||
det_occ(1:nup,1) = (/ 1, 2, 3, 4, 76, 128, 129, 143 /)
|
||||
det_occ(1:ndn,2) = (/ 1, 3, 4, 80, 81, 139 /)
|
||||
do i = 1, 50
|
||||
rc = trexio_to_bitfield_list(det_occ(1:8,1), nup, det_list(1:,i), 8)
|
||||
call trexio_assert(rc, TREXIO_SUCCESS)
|
||||
@ -207,7 +231,6 @@ subroutine test_write(file_name, back_end)
|
||||
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE LABEL')
|
||||
|
||||
rc = trexio_write_nucleus_point_group(trex_file, sym_str, 32)
|
||||
deallocate(sym_str)
|
||||
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE POINT GROUP')
|
||||
|
||||
rc = trexio_write_basis_shell_num(trex_file, basis_shell_num)
|
||||
@ -264,6 +287,7 @@ subroutine test_write(file_name, back_end)
|
||||
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE DET LIST')
|
||||
offset = offset + buf_size_det
|
||||
enddo
|
||||
deallocate(index_sparse_ao_2e_int_eri, value_sparse_ao_2e_int_eri)
|
||||
|
||||
rc = trexio_has_nucleus_num(trex_file)
|
||||
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS HAS 1')
|
||||
|
Loading…
x
Reference in New Issue
Block a user