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

Check values of type_nucl in Jastrow

This commit is contained in:
Anthony Scemama 2023-08-23 13:40:32 +02:00
parent 5b64b44b1f
commit 71d271572e

View File

@ -143,7 +143,7 @@ int main() {
| ~bord_num~ | ~int64_t~ | The number of b coeffecients | | ~bord_num~ | ~int64_t~ | The number of b coeffecients |
| ~cord_num~ | ~int64_t~ | The number of c coeffecients | | ~cord_num~ | ~int64_t~ | The number of c coeffecients |
| ~type_nucl_num~ | ~int64_t~ | Number of Nuclei types | | ~type_nucl_num~ | ~int64_t~ | Number of Nuclei types |
| ~type_nucl_vector~ | ~int64_t[nucl_num]~ | IDs of types of Nuclei | | ~type_nucl_vector~ | ~int64_t[nucl_num]~ | IDs of types of Nuclei. These use 0-based indexing as in C. |
| ~a_vector~ | ~double[aord_num + 1][type_nucl_num]~ | a polynomial coefficients | | ~a_vector~ | ~double[aord_num + 1][type_nucl_num]~ | a polynomial coefficients |
| ~b_vector~ | ~double[bord_num + 1]~ | b polynomial coefficients | | ~b_vector~ | ~double[bord_num + 1]~ | b polynomial coefficients |
| ~c_vector~ | ~double[dim_c_vector][type_nucl_num]~ | c polynomial coefficients | | ~c_vector~ | ~double[dim_c_vector][type_nucl_num]~ | c polynomial coefficients |
@ -578,6 +578,19 @@ qmckl_set_jastrow_champ_type_nucl_vector(qmckl_context context,
"type_nucl_vector = NULL"); "type_nucl_vector = NULL");
} }
for (int i=0 ; i<nucl_num ; ++i) {
if (type_nucl_vector[i] < 0) {
return qmckl_failwith( context, QMCKL_INVALID_ARG_2,
"qmckl_set_type_nucl_vector",
"Inconsistent values of type_nucl_vector (<0)" );
}
if (type_nucl_vector[i] >= type_nucl_num) {
return qmckl_failwith( context, QMCKL_INVALID_ARG_2,
"qmckl_set_type_nucl_vector",
"Inconsistent values of type_nucl_vector (>=nucl_num). Values should use 0-based indexing as in C." );
}
}
if (ctx->jastrow_champ.type_nucl_vector != NULL) { if (ctx->jastrow_champ.type_nucl_vector != NULL) {
qmckl_exit_code rc = qmckl_free(context, ctx->jastrow_champ.type_nucl_vector); qmckl_exit_code rc = qmckl_free(context, ctx->jastrow_champ.type_nucl_vector);
if (rc != QMCKL_SUCCESS) { if (rc != QMCKL_SUCCESS) {