mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-08-25 06:31:43 +02:00
better test [fortran]
This commit is contained in:
parent
81810669ab
commit
91fdbf20df
19
src/test.f90
19
src/test.f90
@ -13,18 +13,14 @@ subroutine test_write()
|
||||
|
||||
integer(8) :: trex_file
|
||||
|
||||
integer :: rc
|
||||
integer :: rc = 1
|
||||
integer(8) :: num
|
||||
|
||||
double precision :: charge(12)
|
||||
double precision :: coord(36)
|
||||
|
||||
rc = 0
|
||||
|
||||
num = 12
|
||||
|
||||
charge = (/6., 6., 6., 6., 6., 6., 1., 1., 1., 1., 1., 1. /)
|
||||
|
||||
coord = (/ 0.00000000 , 1.39250319 , 0.00000000 , &
|
||||
-1.20594314 , 0.69625160 , 0.00000000 , &
|
||||
-1.20594314 , -0.69625160 , 0.00000000 , &
|
||||
@ -59,8 +55,8 @@ subroutine test_write()
|
||||
! hdf5 backend -> open with 'a'
|
||||
! ---------------------------------- !
|
||||
|
||||
! trex_file = trexio_open('test_text_fort' // c_null_char, 'w', TREXIO_TEXT);
|
||||
! trex_file = trexio_open('test_hdf5_fort.h5' // c_null_char, 'a', TREXIO_HDF5)
|
||||
!! trex_file = trexio_open('test_text_fort', 'w', TREXIO_TEXT);
|
||||
!! trex_file = trexio_open('test_hdf5_fort.h5', 'a', TREXIO_HDF5)
|
||||
|
||||
! coord(1) = 666.666
|
||||
|
||||
@ -80,15 +76,14 @@ subroutine test_read()
|
||||
|
||||
integer(8) :: trex_file
|
||||
|
||||
integer :: rc
|
||||
integer :: rc = 1
|
||||
integer(8) :: num, num_read
|
||||
|
||||
double precision :: charge(12)
|
||||
double precision :: coord(36)
|
||||
|
||||
num = 12
|
||||
|
||||
rc = 0
|
||||
|
||||
! trex_file = trexio_open('test_text_fort', 'r', TREXIO_TEXT)
|
||||
trex_file = trexio_open('test_hdf5_fort.h5', 'r', TREXIO_HDF5)
|
||||
|
||||
@ -100,6 +95,10 @@ subroutine test_read()
|
||||
|
||||
if (rc == 0 .and. (abs (charge(11) - 1.0) < 1.0D-8) ) write(*,*) 'SUCCESS READ CHARGE'
|
||||
|
||||
rc = trexio_read_nucleus_coord(trex_file, coord)
|
||||
|
||||
if (rc == 0 .and. (abs (coord(2) - 1.39250319) < 1.0D-8) ) write(*,*) 'SUCCESS READ COORD'
|
||||
|
||||
rc = trexio_close(trex_file)
|
||||
if (rc == 0) write(*,*) 'SUCCESS CLOSE'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user