#include "trexio.h" #include #include #include #include #define TEST_BACKEND TREXIO_HDF5 #define TREXIO_FILE "test_determinant.h5" #define RM_COMMAND "rm -f " TREXIO_FILE #define SIZE 100 #define N_CHUNKS 5 #define STATE_TEST 2 #define MO_NUM 150 static int test_write_determinant (const char* file_name, const back_end_t backend, const int64_t offset) { /* Try to write an array of sparse data into the TREXIO file */ trexio_t* file = NULL; trexio_exit_code rc; /*================= START OF TEST ==================*/ // open file in 'write' mode file = trexio_open(file_name, 'w', backend, &rc); assert (file != NULL); assert (rc == TREXIO_SUCCESS); // parameters to be written int64_t* det_list; double* det_coef; int mo_num = MO_NUM; det_list = (int64_t*) calloc(2*3*SIZE, sizeof(int64_t)); det_coef = (double*) calloc(SIZE, sizeof(double)); for(int i=0; i size_max) offset_file_read = 97L; offset_data_read = 1; int64_t eof_read_size_check = SIZE - offset_file_read; // if offset_file_read=97 => only 3 integrals will be read out of total of 100 if (offset != 0L) offset_file_read += offset; chunk_read = read_size_check; // read one chunk that will reach EOF and return TREXIO_END code rc = trexio_read_determinant_list(file, offset_file_read, &chunk_read, &det_list_read[2*int_num*offset_data_read]); /* printf("%s\n", trexio_string_of_error(rc)); for (int i=0; i