1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2025-04-25 09:54:44 +02:00

Fix bug with broken data offset upon writing

This commit is contained in:
q-posev 2022-04-12 11:47:07 +02:00
parent 81c4283353
commit 4904de5674
2 changed files with 3 additions and 3 deletions

View File

@ -1437,7 +1437,7 @@ trexio_exit_code trexio_text_write_determinant_list(trexio_t* const file,
/* The loop below is needed to write a line with int bit fields for alpha and beta electrons */
for (uint32_t j=0; j < (uint32_t) dims[1]; ++j) {
rc = fprintf(f, "%10" PRId64 " ", *(list + i + j));
rc = fprintf(f, "%10" PRId64 " ", *(list + i*dims[1] + j));
if(rc <= 0) {
fclose(f);
return TREXIO_FAILURE;

View File

@ -154,7 +154,7 @@ static int test_read_determinant (const char* file_name, const back_end_t backen
assert(rc == TREXIO_END);
assert(chunk_read == eof_read_size_check);
assert(det_list_read[6*size_r-1] == 0);
assert(det_list_read[6*offset_data_read] == 497);
assert(det_list_read[6*offset_data_read] == 6 * (int64_t) (offset_file_read-offset));
// check the value of determinant_num
int32_t det_num = 0;
@ -195,7 +195,7 @@ int main(){
test_write_determinant (TREXIO_FILE, TEST_BACKEND, SIZE);
test_read_determinant (TREXIO_FILE, TEST_BACKEND, SIZE);
// rc = system(RM_COMMAND);
rc = system(RM_COMMAND);
assert (rc == 0);
return 0;