1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-12-23 04:44:03 +01:00

Added size in setters.

This commit is contained in:
v1j4y 2022-02-11 15:09:18 +01:00
parent 04624171f0
commit 757d81324a

View File

@ -412,10 +412,10 @@ qmckl_exit_code qmckl_get_jastrow_aord_num (qmckl_context context, int
qmckl_exit_code qmckl_get_jastrow_bord_num (qmckl_context context, int64_t* const bord_num); qmckl_exit_code qmckl_get_jastrow_bord_num (qmckl_context context, int64_t* const bord_num);
qmckl_exit_code qmckl_get_jastrow_cord_num (qmckl_context context, int64_t* const bord_num); qmckl_exit_code qmckl_get_jastrow_cord_num (qmckl_context context, int64_t* const bord_num);
qmckl_exit_code qmckl_get_jastrow_type_nucl_num (qmckl_context context, int64_t* const type_nucl_num); qmckl_exit_code qmckl_get_jastrow_type_nucl_num (qmckl_context context, int64_t* const type_nucl_num);
qmckl_exit_code qmckl_get_jastrow_type_nucl_vector (qmckl_context context, int64_t* const type_nucl_num); qmckl_exit_code qmckl_get_jastrow_type_nucl_vector (qmckl_context context, int64_t* const type_nucl_num, int64_t* size_max);
qmckl_exit_code qmckl_get_jastrow_aord_vector (qmckl_context context, double * const aord_vector); qmckl_exit_code qmckl_get_jastrow_aord_vector (qmckl_context context, double * const aord_vector, int64_t* size_max);
qmckl_exit_code qmckl_get_jastrow_bord_vector (qmckl_context context, double * const bord_vector); qmckl_exit_code qmckl_get_jastrow_bord_vector (qmckl_context context, double * const bord_vector, int64_t* size_max);
qmckl_exit_code qmckl_get_jastrow_cord_vector (qmckl_context context, double * const cord_vector); qmckl_exit_code qmckl_get_jastrow_cord_vector (qmckl_context context, double * const cord_vector, int64_t* size_max);
#+end_src #+end_src
Along with these core functions, calculation of the jastrow factor Along with these core functions, calculation of the jastrow factor
@ -559,7 +559,7 @@ qmckl_exit_code qmckl_get_jastrow_type_nucl_num (const qmckl_context context, in
return QMCKL_SUCCESS; return QMCKL_SUCCESS;
} }
qmckl_exit_code qmckl_get_jastrow_type_nucl_vector (const qmckl_context context, int64_t * const type_nucl_vector) { qmckl_exit_code qmckl_get_jastrow_type_nucl_vector (const qmckl_context context, int64_t * const type_nucl_vector, int64_t* size_max) {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return (char) 0; return (char) 0;
@ -583,10 +583,11 @@ qmckl_exit_code qmckl_get_jastrow_type_nucl_vector (const qmckl_context context,
assert (ctx->jastrow.type_nucl_vector != NULL); assert (ctx->jastrow.type_nucl_vector != NULL);
memcpy(type_nucl_vector, ctx->jastrow.type_nucl_vector, ctx->jastrow.type_nucl_num*sizeof(int64_t)); memcpy(type_nucl_vector, ctx->jastrow.type_nucl_vector, ctx->jastrow.type_nucl_num*sizeof(int64_t));
(*size_max) = ctx->jastrow.type_nucl_num;
return QMCKL_SUCCESS; return QMCKL_SUCCESS;
} }
qmckl_exit_code qmckl_get_jastrow_aord_vector (const qmckl_context context, double * const aord_vector) { qmckl_exit_code qmckl_get_jastrow_aord_vector (const qmckl_context context, double * const aord_vector, int64_t* size_max) {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return (char) 0; return (char) 0;
@ -609,11 +610,13 @@ qmckl_exit_code qmckl_get_jastrow_aord_vector (const qmckl_context context, doub
} }
assert (ctx->jastrow.aord_vector != NULL); assert (ctx->jastrow.aord_vector != NULL);
memcpy(aord_vector, ctx->jastrow.aord_vector, ctx->jastrow.aord_num*sizeof(double)); int64_t sze = (ctx->jastrow.aord_num + 1)*ctx->jastrow.type_nucl_num;
memcpy(aord_vector, ctx->jastrow.aord_vector, sze*sizeof(double));
(*size_max) = sze;
return QMCKL_SUCCESS; return QMCKL_SUCCESS;
} }
qmckl_exit_code qmckl_get_jastrow_bord_vector (const qmckl_context context, double * const bord_vector) { qmckl_exit_code qmckl_get_jastrow_bord_vector (const qmckl_context context, double * const bord_vector, int64_t* size_max) {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return (char) 0; return (char) 0;
@ -636,11 +639,13 @@ qmckl_exit_code qmckl_get_jastrow_bord_vector (const qmckl_context context, doub
} }
assert (ctx->jastrow.bord_vector != NULL); assert (ctx->jastrow.bord_vector != NULL);
memcpy(bord_vector, ctx->jastrow.bord_vector, ctx->jastrow.bord_num*sizeof(double)); int64_t sze=ctx->jastrow.bord_num +1;
memcpy(bord_vector, ctx->jastrow.bord_vector, sze*sizeof(double));
(*size_max) = sze;
return QMCKL_SUCCESS; return QMCKL_SUCCESS;
} }
qmckl_exit_code qmckl_get_jastrow_cord_vector (const qmckl_context context, double * const cord_vector) { qmckl_exit_code qmckl_get_jastrow_cord_vector (const qmckl_context context, double * const cord_vector, int64_t* size_max) {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return (char) 0; return (char) 0;
@ -663,7 +668,14 @@ qmckl_exit_code qmckl_get_jastrow_cord_vector (const qmckl_context context, doub
} }
assert (ctx->jastrow.cord_vector != NULL); assert (ctx->jastrow.cord_vector != NULL);
memcpy(cord_vector, ctx->jastrow.cord_vector, ctx->jastrow.dim_cord_vect*sizeof(double));
int64_t dim_cord_vect;
qmckl_exit_code rc = qmckl_get_jastrow_dim_cord_vect(context, &dim_cord_vect);
if (rc != QMCKL_SUCCESS) return rc;
int64_t sze=dim_cord_vect * ctx->jastrow.type_nucl_num;
memcpy(cord_vector, ctx->jastrow.cord_vector, sze*sizeof(double));
(*size_max) = sze;
return QMCKL_SUCCESS; return QMCKL_SUCCESS;
} }