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

check mask in jastrow

This commit is contained in:
Anthony Scemama 2022-07-09 11:34:38 +02:00
parent 21a9d6c51e
commit 8ee9e9dcca
3 changed files with 25 additions and 13 deletions

View File

@ -367,7 +367,7 @@ if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
qmckl_context_struct* const ctx = (qmckl_context_struct*) context; qmckl_context_struct* const ctx = (qmckl_context_struct*) context;
if (!(ctx->ao_basis.uninitialized & mask)) { if (mask != 0 && !(ctx->ao_basis.uninitialized & mask)) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_ALREADY_SET, QMCKL_ALREADY_SET,
"qmckl_set_ao_*", "qmckl_set_ao_*",

View File

@ -407,7 +407,7 @@ qmckl_exit_code qmckl_init_jastrow(qmckl_context context) {
qmckl_context_struct* const ctx = (qmckl_context_struct*) context; qmckl_context_struct* const ctx = (qmckl_context_struct*) context;
assert (ctx != NULL); assert (ctx != NULL);
ctx->jastrow.uninitialized = (1 << 5) - 1; ctx->jastrow.uninitialized = (1 << 6) - 1;
/* Default values */ /* Default values */
@ -746,6 +746,14 @@ if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
} }
qmckl_context_struct* const ctx = (qmckl_context_struct*) context; qmckl_context_struct* const ctx = (qmckl_context_struct*) context;
if (mask != 0 && !(ctx->jastrow.uninitialized & mask)) {
printf("%d %d\n", mask, ctx->jastrow.uninitialized );
return qmckl_failwith( context,
QMCKL_ALREADY_SET,
"qmckl_set_jastrow_*",
NULL);
}
#+end_src #+end_src
#+NAME:post2 #+NAME:post2
@ -768,6 +776,9 @@ qmckl_set_jastrow_ord_num(qmckl_context context,
const int64_t bord_num, const int64_t bord_num,
const int64_t cord_num) const int64_t cord_num)
{ {
int32_t mask = 1 << 0;
<<pre2>> <<pre2>>
if (aord_num <= 0) { if (aord_num <= 0) {
@ -791,7 +802,6 @@ qmckl_set_jastrow_ord_num(qmckl_context context,
"cord_num <= 0"); "cord_num <= 0");
} }
int32_t mask = 1 << 0;
ctx->jastrow.aord_num = aord_num; ctx->jastrow.aord_num = aord_num;
ctx->jastrow.bord_num = bord_num; ctx->jastrow.bord_num = bord_num;
ctx->jastrow.cord_num = cord_num; ctx->jastrow.cord_num = cord_num;
@ -803,6 +813,8 @@ qmckl_set_jastrow_ord_num(qmckl_context context,
qmckl_exit_code qmckl_exit_code
qmckl_set_jastrow_type_nucl_num(qmckl_context context, const int64_t type_nucl_num) qmckl_set_jastrow_type_nucl_num(qmckl_context context, const int64_t type_nucl_num)
{ {
int32_t mask = 1 << 1;
<<pre2>> <<pre2>>
if (type_nucl_num <= 0) { if (type_nucl_num <= 0) {
@ -812,7 +824,6 @@ qmckl_set_jastrow_type_nucl_num(qmckl_context context, const int64_t type_nucl_n
"type_nucl_num < 0"); "type_nucl_num < 0");
} }
int32_t mask = 1 << 1;
ctx->jastrow.type_nucl_num = type_nucl_num; ctx->jastrow.type_nucl_num = type_nucl_num;
<<post2>> <<post2>>
@ -824,10 +835,11 @@ qmckl_set_jastrow_type_nucl_vector(qmckl_context context,
int64_t const * type_nucl_vector, int64_t const * type_nucl_vector,
const int64_t nucl_num) const int64_t nucl_num)
{ {
<<pre2>>
int32_t mask = 1 << 2; int32_t mask = 1 << 2;
<<pre2>>
int64_t type_nucl_num; int64_t type_nucl_num;
qmckl_exit_code rc = qmckl_get_jastrow_type_nucl_num(context, &type_nucl_num); qmckl_exit_code rc = qmckl_get_jastrow_type_nucl_num(context, &type_nucl_num);
if (rc != QMCKL_SUCCESS) return rc; if (rc != QMCKL_SUCCESS) return rc;
@ -879,10 +891,10 @@ qmckl_set_jastrow_aord_vector(qmckl_context context,
double const * aord_vector, double const * aord_vector,
const int64_t size_max) const int64_t size_max)
{ {
<<pre2>>
int32_t mask = 1 << 3; int32_t mask = 1 << 3;
<<pre2>>
int64_t aord_num; int64_t aord_num;
qmckl_exit_code rc = qmckl_get_jastrow_aord_num(context, &aord_num); qmckl_exit_code rc = qmckl_get_jastrow_aord_num(context, &aord_num);
if (rc != QMCKL_SUCCESS) return rc; if (rc != QMCKL_SUCCESS) return rc;
@ -946,10 +958,10 @@ qmckl_set_jastrow_bord_vector(qmckl_context context,
double const * bord_vector, double const * bord_vector,
const int64_t size_max) const int64_t size_max)
{ {
<<pre2>>
int32_t mask = 1 << 4; int32_t mask = 1 << 4;
<<pre2>>
int64_t bord_num; int64_t bord_num;
qmckl_exit_code rc = qmckl_get_jastrow_bord_num(context, &bord_num); qmckl_exit_code rc = qmckl_get_jastrow_bord_num(context, &bord_num);
if (rc != QMCKL_SUCCESS) return rc; if (rc != QMCKL_SUCCESS) return rc;
@ -1009,10 +1021,10 @@ qmckl_set_jastrow_cord_vector(qmckl_context context,
double const * cord_vector, double const * cord_vector,
const int64_t size_max) const int64_t size_max)
{ {
<<pre2>>
int32_t mask = 1 << 5; int32_t mask = 1 << 5;
<<pre2>>
qmckl_exit_code rc = qmckl_provide_dim_cord_vect(context); qmckl_exit_code rc = qmckl_provide_dim_cord_vect(context);
if (rc != QMCKL_SUCCESS) return rc; if (rc != QMCKL_SUCCESS) return rc;
@ -1042,7 +1054,7 @@ qmckl_set_jastrow_cord_vector(qmckl_context context,
rc = qmckl_free(context, ctx->jastrow.cord_vector); rc = qmckl_free(context, ctx->jastrow.cord_vector);
if (rc != QMCKL_SUCCESS) { if (rc != QMCKL_SUCCESS) {
return qmckl_failwith( context, rc, return qmckl_failwith( context, rc,
"qmckl_set_ord_vector", "qmckl_set_cord_vector",
NULL); NULL);
} }
} }

View File

@ -306,7 +306,7 @@ if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
qmckl_context_struct* const ctx = (qmckl_context_struct*) context; qmckl_context_struct* const ctx = (qmckl_context_struct*) context;
if (!(ctx->mo_basis.uninitialized & mask)) { if (mask != 0 && !(ctx->mo_basis.uninitialized & mask)) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_ALREADY_SET, QMCKL_ALREADY_SET,
"qmckl_set_mo_*", "qmckl_set_mo_*",