1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-12-22 20:36:01 +01:00

Fixed initialization of det_adj and det_value matrices. #41

This commit is contained in:
v1j4y 2021-10-13 16:55:12 +02:00
parent 578bc43268
commit ca5c332d85

View File

@ -1372,6 +1372,37 @@ qmckl_exit_code qmckl_provide_det_inv_matrix_alpha(qmckl_context context) {
ctx->det.det_inv_matrix_alpha = det_inv_matrix_alpha;
}
if (ctx->det.det_adj_matrix_alpha == NULL) {
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
mem_info.size = ctx->det.walk_num * ctx->det.det_num_alpha *
ctx->electron.up_num * ctx->electron.up_num * sizeof(double);
double* det_adj_matrix_alpha = (double*) qmckl_malloc(context, mem_info);
if (det_adj_matrix_alpha == NULL) {
return qmckl_failwith( context,
QMCKL_ALLOCATION_FAILED,
"qmckl_det_adj_matrix_alpha",
NULL);
}
ctx->det.det_adj_matrix_alpha = det_adj_matrix_alpha;
}
if (ctx->det.det_value_alpha == NULL) {
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
mem_info.size = ctx->det.walk_num * ctx->det.det_num_alpha * sizeof(double);
double* det_value_alpha = (double*) qmckl_malloc(context, mem_info);
if (det_value_alpha == NULL) {
return qmckl_failwith( context,
QMCKL_ALLOCATION_FAILED,
"qmckl_det_value_alpha",
NULL);
}
ctx->det.det_value_alpha = det_value_alpha;
}
qmckl_exit_code rc;
if (ctx->det.type == 'G') {
rc = qmckl_compute_det_inv_matrix_alpha(context,
@ -1464,6 +1495,37 @@ qmckl_exit_code qmckl_provide_det_inv_matrix_beta(qmckl_context context) {
ctx->det.det_inv_matrix_beta = det_inv_matrix_beta;
}
if (ctx->det.det_adj_matrix_beta == NULL) {
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
mem_info.size = ctx->det.walk_num * ctx->det.det_num_beta *
ctx->electron.up_num * ctx->electron.up_num * sizeof(double);
double* det_adj_matrix_beta = (double*) qmckl_malloc(context, mem_info);
if (det_adj_matrix_beta == NULL) {
return qmckl_failwith( context,
QMCKL_ALLOCATION_FAILED,
"qmckl_det_adj_matrix_beta",
NULL);
}
ctx->det.det_adj_matrix_beta = det_adj_matrix_beta;
}
if (ctx->det.det_value_beta == NULL) {
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
mem_info.size = ctx->det.walk_num * ctx->det.det_num_beta * sizeof(double);
double* det_value_beta = (double*) qmckl_malloc(context, mem_info);
if (det_value_beta == NULL) {
return qmckl_failwith( context,
QMCKL_ALLOCATION_FAILED,
"qmckl_det_value_beta",
NULL);
}
ctx->det.det_value_beta = det_value_beta;
}
qmckl_exit_code rc;
if (ctx->det.type == 'G') {
rc = qmckl_compute_det_inv_matrix_beta(context,