mirror of
https://github.com/TREX-CoE/trexio.git
synced 2025-04-29 11:54:45 +02:00
Fix bug with broken data offset upon writing
This commit is contained in:
parent
81c4283353
commit
4904de5674
@ -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 */
|
/* 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) {
|
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) {
|
if(rc <= 0) {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return TREXIO_FAILURE;
|
return TREXIO_FAILURE;
|
||||||
|
@ -154,7 +154,7 @@ static int test_read_determinant (const char* file_name, const back_end_t backen
|
|||||||
assert(rc == TREXIO_END);
|
assert(rc == TREXIO_END);
|
||||||
assert(chunk_read == eof_read_size_check);
|
assert(chunk_read == eof_read_size_check);
|
||||||
assert(det_list_read[6*size_r-1] == 0);
|
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
|
// check the value of determinant_num
|
||||||
int32_t det_num = 0;
|
int32_t det_num = 0;
|
||||||
@ -195,7 +195,7 @@ int main(){
|
|||||||
test_write_determinant (TREXIO_FILE, TEST_BACKEND, SIZE);
|
test_write_determinant (TREXIO_FILE, TEST_BACKEND, SIZE);
|
||||||
test_read_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);
|
assert (rc == 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user