mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-11-19 20:42:50 +01:00
Added size_max for set determinant.
This commit is contained in:
parent
0035feb989
commit
86a92f2494
@ -331,8 +331,8 @@ int64_t* qmckl_get_determinant_mo_index_beta (const qmckl_context context) {
|
|||||||
qmckl_exit_code qmckl_set_determinant_type (const qmckl_context context, const char t);
|
qmckl_exit_code qmckl_set_determinant_type (const qmckl_context context, const char t);
|
||||||
qmckl_exit_code qmckl_set_determinant_det_num_alpha (const qmckl_context context, const int64_t det_num_alpha);
|
qmckl_exit_code qmckl_set_determinant_det_num_alpha (const qmckl_context context, const int64_t det_num_alpha);
|
||||||
qmckl_exit_code qmckl_set_determinant_det_num_beta (const qmckl_context context, const int64_t det_num_beta);
|
qmckl_exit_code qmckl_set_determinant_det_num_beta (const qmckl_context context, const int64_t det_num_beta);
|
||||||
qmckl_exit_code qmckl_set_determinant_mo_index_alpha (const qmckl_context context, const int64_t* mo_index_alpha);
|
qmckl_exit_code qmckl_set_determinant_mo_index_alpha (const qmckl_context context, const int64_t* mo_index_alpha, const int64_t size_max);
|
||||||
qmckl_exit_code qmckl_set_determinant_mo_index_beta (const qmckl_context context, const int64_t* mo_index_beta);
|
qmckl_exit_code qmckl_set_determinant_mo_index_beta (const qmckl_context context, const int64_t* mo_index_beta, const int64_t size_max);
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+NAME:pre2
|
#+NAME:pre2
|
||||||
@ -405,7 +405,7 @@ qmckl_exit_code qmckl_set_determinant_det_num_beta(qmckl_context context, const
|
|||||||
<<post2>>
|
<<post2>>
|
||||||
}
|
}
|
||||||
|
|
||||||
qmckl_exit_code qmckl_set_determinant_mo_index_alpha(qmckl_context context, const int64_t* mo_index_alpha) {
|
qmckl_exit_code qmckl_set_determinant_mo_index_alpha(qmckl_context context, const int64_t* mo_index_alpha, const int64_t size_max) {
|
||||||
<<pre2>>
|
<<pre2>>
|
||||||
|
|
||||||
int32_t mask = 1 << 3;
|
int32_t mask = 1 << 3;
|
||||||
@ -430,6 +430,13 @@ qmckl_exit_code qmckl_set_determinant_mo_index_alpha(qmckl_context context, con
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (size_max * sizeof(int64_t) < mem_info.size) {
|
||||||
|
return qmckl_failwith( context,
|
||||||
|
QMCKL_INVALID_ARG_3,
|
||||||
|
"qmckl_set_determinant_mo_index_alpha",
|
||||||
|
"input array too small");
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(new_array, mo_index_alpha, mem_info.size);
|
memcpy(new_array, mo_index_alpha, mem_info.size);
|
||||||
|
|
||||||
ctx->det.mo_index_alpha = new_array;
|
ctx->det.mo_index_alpha = new_array;
|
||||||
@ -437,7 +444,7 @@ qmckl_exit_code qmckl_set_determinant_mo_index_alpha(qmckl_context context, con
|
|||||||
<<post2>>
|
<<post2>>
|
||||||
}
|
}
|
||||||
|
|
||||||
qmckl_exit_code qmckl_set_determinant_mo_index_beta(qmckl_context context, const int64_t* mo_index_beta) {
|
qmckl_exit_code qmckl_set_determinant_mo_index_beta(qmckl_context context, const int64_t* mo_index_beta, const int64_t size_max) {
|
||||||
<<pre2>>
|
<<pre2>>
|
||||||
|
|
||||||
int32_t mask = 1 << 4;
|
int32_t mask = 1 << 4;
|
||||||
@ -462,6 +469,13 @@ qmckl_exit_code qmckl_set_determinant_mo_index_beta(qmckl_context context, cons
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (size_max * sizeof(int64_t) < mem_info.size) {
|
||||||
|
return qmckl_failwith( context,
|
||||||
|
QMCKL_INVALID_ARG_3,
|
||||||
|
"qmckl_set_determinant_mo_index_beta",
|
||||||
|
"input array too small");
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(new_array, mo_index_beta, mem_info.size);
|
memcpy(new_array, mo_index_beta, mem_info.size);
|
||||||
|
|
||||||
ctx->det.mo_index_beta = new_array;
|
ctx->det.mo_index_beta = new_array;
|
||||||
|
Loading…
Reference in New Issue
Block a user