1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-11-03 20:54:09 +01:00

Better error message in trexio read

This commit is contained in:
Anthony Scemama 2023-11-15 13:03:07 +01:00
parent 5d8dfacffe
commit f1764a5717

View File

@ -601,7 +601,7 @@ qmckl_trexio_read_ao_X(qmckl_context context, trexio_t* const file)
if (shell_prim_num == NULL) { if (shell_prim_num == NULL) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_ALLOCATION_FAILED, QMCKL_ALLOCATION_FAILED,
"qmckl_trexio_read_basis_shell_prim_num_X", "qmckl_trexio_read_basis_shell_index",
NULL); NULL);
} }
@ -617,7 +617,7 @@ qmckl_trexio_read_ao_X(qmckl_context context, trexio_t* const file)
shell_prim_num = NULL; shell_prim_num = NULL;
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_ALLOCATION_FAILED, QMCKL_ALLOCATION_FAILED,
"qmckl_trexio_read_basis_shell_prim_num_X", "qmckl_trexio_read_basis_shell_index",
NULL); NULL);
} }
@ -632,7 +632,7 @@ qmckl_trexio_read_ao_X(qmckl_context context, trexio_t* const file)
tmp_array = NULL; tmp_array = NULL;
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_FAILURE, QMCKL_FAILURE,
"trexio_read_basis_shell_prim_num", "qmckl_trexio_read_basis_shell_index",
trexio_string_of_error(rcio)); trexio_string_of_error(rcio));
} }
@ -646,10 +646,12 @@ qmckl_trexio_read_ao_X(qmckl_context context, trexio_t* const file)
if (k < 0 || k >= shell_num) { if (k < 0 || k >= shell_num) {
qmckl_free(context, tmp_array); qmckl_free(context, tmp_array);
qmckl_free(context, shell_prim_num); qmckl_free(context, shell_prim_num);
char msg[128];
sprintf(&msg[0], "Irrelevant data in TREXIO file: k = %d", k);
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_FAILURE, QMCKL_FAILURE,
"trexio_read_basis_shell_prim_num", "qmckl_trexio_read_basis_shell_index",
"Irrelevant data in TREXIO file"); &msg[0]);
} }
shell_prim_num[k] += 1; shell_prim_num[k] += 1;
} }
@ -657,9 +659,6 @@ qmckl_trexio_read_ao_X(qmckl_context context, trexio_t* const file)
qmckl_free(context, tmp_array); qmckl_free(context, tmp_array);
tmp_array = NULL; tmp_array = NULL;
/* Store data */
rc = qmckl_set_ao_basis_shell_prim_num(context, shell_prim_num, shell_num);
qmckl_free(context, shell_prim_num); qmckl_free(context, shell_prim_num);
shell_prim_num = NULL; shell_prim_num = NULL;