mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2025-01-03 18:16:28 +01:00
Working on calculation of inverse. #41
This commit is contained in:
parent
bb21cbed69
commit
d416c5dd77
@ -287,7 +287,7 @@ ctx->det.uninitialized &= ~mask;
|
|||||||
ctx->det.provided = (ctx->det.uninitialized == 0);
|
ctx->det.provided = (ctx->det.uninitialized == 0);
|
||||||
if (ctx->det.provided) {
|
if (ctx->det.provided) {
|
||||||
//qmckl_exit_code rc_ = qmckl_finalize_determinant(context);
|
//qmckl_exit_code rc_ = qmckl_finalize_determinant(context);
|
||||||
if (rc_ != QMCKL_SUCCESS) return rc_;
|
//if (rc_ != QMCKL_SUCCESS) return rc_;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QMCKL_SUCCESS;
|
return QMCKL_SUCCESS;
|
||||||
@ -441,13 +441,13 @@ qmckl_exit_code qmckl_get_determinant_det_inv_list(qmckl_context context, double
|
|||||||
rc = qmckl_provide_det_vgl(context);
|
rc = qmckl_provide_det_vgl(context);
|
||||||
if (rc != QMCKL_SUCCESS) return rc;
|
if (rc != QMCKL_SUCCESS) return rc;
|
||||||
|
|
||||||
rc = qmckl_provide_det_inv_list(context);
|
rc = qmckl_provide_det_inv_matrix(context);
|
||||||
if (rc != QMCKL_SUCCESS) return rc;
|
if (rc != QMCKL_SUCCESS) return rc;
|
||||||
|
|
||||||
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
|
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
|
||||||
assert (ctx != NULL);
|
assert (ctx != NULL);
|
||||||
|
|
||||||
size_t sze = ctx->det.det_num * ctx->det.walk_num * ctx->det.fermi_num * ctx->fermi_num;
|
size_t sze = ctx->det.det_num * ctx->det.walk_num * ctx->det.fermi_num * ctx->det.fermi_num;
|
||||||
memcpy(det_inv_list, ctx->det.det_vgl, sze * sizeof(double));
|
memcpy(det_inv_list, ctx->det.det_vgl, sze * sizeof(double));
|
||||||
|
|
||||||
return QMCKL_SUCCESS;
|
return QMCKL_SUCCESS;
|
||||||
@ -466,11 +466,11 @@ qmckl_exit_code qmckl_get_determinant_det_inv_list(qmckl_context context, double
|
|||||||
*** Provide
|
*** Provide
|
||||||
|
|
||||||
#+begin_src c :comments org :tangle (eval h_private_func) :noweb yes :exports none
|
#+begin_src c :comments org :tangle (eval h_private_func) :noweb yes :exports none
|
||||||
qmckl_exit_code qmckl_provide_det(qmckl_context context);
|
qmckl_exit_code qmckl_provide_det_vgl(qmckl_context context);
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
|
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
|
||||||
qmckl_exit_code qmckl_provide_det(qmckl_context context) {
|
qmckl_exit_code qmckl_provide_det_vgl(qmckl_context context) {
|
||||||
|
|
||||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||||
return QMCKL_NULL_CONTEXT;
|
return QMCKL_NULL_CONTEXT;
|
||||||
@ -515,7 +515,7 @@ qmckl_exit_code qmckl_provide_det(qmckl_context context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Compute if necessary */
|
/* Compute if necessary */
|
||||||
if (ctx->electron.coord_new_date > ctx->det.det_date) {
|
if (ctx->electron.coord_new_date > ctx->det.det_vgl_date) {
|
||||||
|
|
||||||
/* Allocate array */
|
/* Allocate array */
|
||||||
if (ctx->det.det_vgl == NULL) {
|
if (ctx->det.det_vgl == NULL) {
|
||||||
@ -714,7 +714,7 @@ qmckl_exit_code qmckl_get_det_inv_matrix(qmckl_context context, double * const d
|
|||||||
assert (ctx != NULL);
|
assert (ctx != NULL);
|
||||||
|
|
||||||
size_t sze = ctx->det.det_num * ctx->det.walk_num * ctx->det.fermi_num * ctx->det.fermi_num;
|
size_t sze = ctx->det.det_num * ctx->det.walk_num * ctx->det.fermi_num * ctx->det.fermi_num;
|
||||||
memcpy(det_inv_matrix, ctx->det.det_inv_matrix, sze * sizeof(double));
|
memcpy(det_inv_matrix, ctx->det.det_inv_matrix_list, sze * sizeof(double));
|
||||||
|
|
||||||
return QMCKL_SUCCESS;
|
return QMCKL_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -726,7 +726,7 @@ qmckl_exit_code qmckl_get_det_inv_matrix(qmckl_context context, double * const d
|
|||||||
#+begin_src c :tangle (eval h_func) :comments org
|
#+begin_src c :tangle (eval h_func) :comments org
|
||||||
qmckl_exit_code qmckl_compute_get_det_inv_matrix (
|
qmckl_exit_code qmckl_compute_get_det_inv_matrix (
|
||||||
const qmckl_context context,
|
const qmckl_context context,
|
||||||
double* const det_vgl );
|
double* const det_inv_matrix_list );
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** Provide
|
*** Provide
|
||||||
@ -789,12 +789,12 @@ qmckl_exit_code qmckl_provide_det_inv_matrix(qmckl_context context) {
|
|||||||
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
|
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
|
||||||
mem_info.size = ctx->det.walk_num * ctx->det.det_num *
|
mem_info.size = ctx->det.walk_num * ctx->det.det_num *
|
||||||
ctx->det.fermi_num * ctx->det.fermi_num * sizeof(double);
|
ctx->det.fermi_num * ctx->det.fermi_num * sizeof(double);
|
||||||
double* det_vgl = (double*) qmckl_malloc(context, mem_info);
|
double* det_inv_matrix_list = (double*) qmckl_malloc(context, mem_info);
|
||||||
|
|
||||||
if (det_vgl == NULL) {
|
if (det_inv_matrix_list == NULL) {
|
||||||
return qmckl_failwith( context,
|
return qmckl_failwith( context,
|
||||||
QMCKL_ALLOCATION_FAILED,
|
QMCKL_ALLOCATION_FAILED,
|
||||||
"qmckl_det_vgl",
|
"qmckl_det_inv_matrix_list",
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
ctx->det.det_inv_matrix_list = det_inv_matrix_list;
|
ctx->det.det_inv_matrix_list = det_inv_matrix_list;
|
||||||
@ -812,7 +812,7 @@ qmckl_exit_code qmckl_provide_det_inv_matrix(qmckl_context context) {
|
|||||||
} else {
|
} else {
|
||||||
return qmckl_failwith( context,
|
return qmckl_failwith( context,
|
||||||
QMCKL_FAILURE,
|
QMCKL_FAILURE,
|
||||||
"compute_det_vgl",
|
"compute_det_inv_matrix_list",
|
||||||
"Not yet implemented");
|
"Not yet implemented");
|
||||||
}
|
}
|
||||||
if (rc != QMCKL_SUCCESS) {
|
if (rc != QMCKL_SUCCESS) {
|
||||||
@ -878,7 +878,7 @@ integer function qmckl_compute_det_inv_matrix_f(context, &
|
|||||||
do imo = 1, fermi_num
|
do imo = 1, fermi_num
|
||||||
mo_id = mo_index_list(imo)
|
mo_id = mo_index_list(imo)
|
||||||
! Value
|
! Value
|
||||||
det_vgl(imo, ielec, iwalk, 1) = mo_vgl(mo_id, ielec, iwalk, 1)
|
det_inv_matrix_list(imo, ielec, iwalk, 1) = mo_vgl(mo_id, ielec, iwalk, 1)
|
||||||
end do
|
end do
|
||||||
end do
|
end do
|
||||||
end do
|
end do
|
||||||
|
Loading…
Reference in New Issue
Block a user