From 71d271572e1c69f1b7f9588a88476c537e88d2da Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 23 Aug 2023 13:40:32 +0200 Subject: [PATCH] Check values of type_nucl in Jastrow --- org/qmckl_jastrow_champ.org | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/org/qmckl_jastrow_champ.org b/org/qmckl_jastrow_champ.org index 1f1dbad..8be1e7b 100644 --- a/org/qmckl_jastrow_champ.org +++ b/org/qmckl_jastrow_champ.org @@ -143,7 +143,7 @@ int main() { | ~bord_num~ | ~int64_t~ | The number of b coeffecients | | ~cord_num~ | ~int64_t~ | The number of c coeffecients | | ~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 | | ~b_vector~ | ~double[bord_num + 1]~ | b 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"); } + for (int i=0 ; 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) { qmckl_exit_code rc = qmckl_free(context, ctx->jastrow_champ.type_nucl_vector); if (rc != QMCKL_SUCCESS) {