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

Working on tests for determinant. #41

This commit is contained in:
v1j4y 2021-10-12 18:55:34 +02:00
parent b53b4afeab
commit 713be68c2b
2 changed files with 45 additions and 30 deletions

View File

@ -520,11 +520,11 @@ qmckl_exit_code qmckl_get_det_vgl_alpha(qmckl_context context, double * const de
rc = qmckl_provide_det_vgl_alpha(context);
if (rc != QMCKL_SUCCESS) return rc;
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
assert (ctx != NULL);
//qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
//assert (ctx != NULL);
size_t sze = ctx->det.det_num_alpha * ctx->det.walk_num * ctx->electron.up_num * ctx->electron.up_num;
memcpy(det_vgl_alpha, ctx->det.det_vgl_alpha, sze * sizeof(double));
//size_t sze = ctx->det.det_num_alpha * ctx->det.walk_num * ctx->electron.up_num * ctx->electron.up_num;
//memcpy(det_vgl_alpha, ctx->det.det_vgl_alpha, sze * sizeof(double));
return QMCKL_SUCCESS;
}
@ -615,7 +615,8 @@ qmckl_exit_code qmckl_provide_det_vgl_alpha(qmckl_context context) {
if (ctx->det.det_vgl_alpha == NULL) {
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
mem_info.size = 5 * ctx->det.walk_num * ctx->det.det_num_alpha * sizeof(double);
mem_info.size = 5 * ctx->det.walk_num * ctx->det.det_num_alpha *
ctx->electron.up_num * ctx->electron.up_num * sizeof(double);
double* det_vgl_alpha = (double*) qmckl_malloc(context, mem_info);
if (det_vgl_alpha == NULL) {
@ -706,7 +707,8 @@ qmckl_exit_code qmckl_provide_det_vgl_beta(qmckl_context context) {
if (ctx->det.det_vgl_beta == NULL) {
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
mem_info.size = 5 * ctx->det.walk_num * ctx->det.det_num_beta * sizeof(double);
mem_info.size = 5 * ctx->det.walk_num * ctx->det.det_num_beta *
ctx->electron.down_num * ctx->electron.down_num * sizeof(double);
double* det_vgl_beta = (double*) qmckl_malloc(context, mem_info);
if (det_vgl_beta == NULL) {
@ -806,20 +808,20 @@ integer function qmckl_compute_det_vgl_alpha_f(context, &
do ielec = 1, alpha_num
do imo = 1, alpha_num
mo_id = mo_index_alpha(imo,iwalk,idet)
! Value
det_vgl_alpha(imo, ielec, 1, iwalk, idet) = mo_vgl(mo_id, ielec, iwalk, 1)
!! Value
det_vgl_alpha(imo, ielec, 1, iwalk, idet) = 1.0d0!mo_vgl(mo_id, ielec, iwalk, 1)
! Grad_x
det_vgl_alpha(imo, ielec, 2, iwalk, idet) = mo_vgl(mo_id, ielec, iwalk, 2)
!! Grad_x
!det_vgl_alpha(imo, ielec, 2, iwalk, idet) = mo_vgl(mo_id, ielec, iwalk, 2)
! Grad_y
det_vgl_alpha(imo, ielec, 3, iwalk, idet) = mo_vgl(mo_id, ielec, iwalk, 3)
!! Grad_y
!det_vgl_alpha(imo, ielec, 3, iwalk, idet) = mo_vgl(mo_id, ielec, iwalk, 3)
! Grad_z
det_vgl_alpha(imo, ielec, 4, iwalk, idet) = mo_vgl(mo_id, ielec, iwalk, 4)
!! Grad_z
!det_vgl_alpha(imo, ielec, 4, iwalk, idet) = mo_vgl(mo_id, ielec, iwalk, 4)
! Lap
det_vgl_alpha(imo, ielec, 5, iwalk, idet) = mo_vgl(mo_id, ielec, iwalk, 5)
!! Lap
!det_vgl_alpha(imo, ielec, 5, iwalk, idet) = mo_vgl(mo_id, ielec, iwalk, 5)
end do
end do
end do
@ -874,7 +876,7 @@ end function qmckl_compute_det_vgl_alpha_f
integer (c_int64_t) , intent(in) :: mo_index_alpha(alpha_num,walk_num,det_num_alpha)
integer (c_int64_t) , intent(in) , value :: mo_num
real (c_double ) , intent(in) :: mo_vgl(mo_num,elec_num,walk_num,5)
real (c_double ) , intent(out) :: det_vgl_alpha(alpha_num,alpha_num,5,walk_num,det_num_alpha)
real (c_double ) , intent(out) :: det_vgl_alpha(alpha_num, alpha_num, 5, walk_num, det_num_alpha)
integer(c_int32_t), external :: qmckl_compute_det_vgl_alpha_f
info = qmckl_compute_det_vgl_alpha_f &
@ -1173,18 +1175,20 @@ assert (rc == QMCKL_SUCCESS);
/* Set up determinant data */
const int64_t det_num_alpha = 1;
const int64_t det_num_beta = 1;
int64_t mo_index_alpha[1][walk_num][elec_up_num];
int64_t mo_index_beta[1][walk_num][elec_dn_num];
const int64_t det_num_alpha = 2;
const int64_t det_num_beta = 2;
int64_t mo_index_alpha[det_num_alpha][walk_num][elec_up_num];
int64_t mo_index_beta[det_num_alpha][walk_num][elec_dn_num];
int i, j;
for(i = 0; i < walk_num; ++i)
for(j = 0; j < elec_up_num; ++j)
mo_index_alpha[0][i][j] = 1;
for(i = 0; i < walk_num; ++i)
for(j = 0; j < elec_up_num; ++j)
mo_index_beta[0][i][j] = 1;
int i, j, k;
for(k = 0; k < det_num_alpha; ++k)
for(i = 0; i < walk_num; ++i)
for(j = 0; j < elec_up_num; ++j)
mo_index_alpha[k][i][j] = j;
for(k = 0; k < det_num_beta; ++k)
for(i = 0; i < walk_num; ++i)
for(j = 0; j < elec_up_num; ++j)
mo_index_beta[k][i][j] = j;
rc = qmckl_set_determinant_type (context, typ);
assert(rc == QMCKL_SUCCESS);
@ -1206,11 +1210,23 @@ assert (rc == QMCKL_SUCCESS);
// Get alpha determinant
double det_vgl_alpha[1][walk_num][5][elec_up_num][elec_up_num];
double det_vgl_alpha[det_num_alpha][walk_num][5][elec_up_num][elec_up_num];
double det_vgl_beta[det_num_beta][walk_num][5][elec_dn_num][elec_dn_num];
double det_inv_matrix_alpha[det_num_alpha][walk_num][5][elec_up_num][elec_up_num];
double det_inv_matrix_beta[det_num_beta][walk_num][5][elec_dn_num][elec_dn_num];
rc = qmckl_get_det_vgl_alpha(context, &(det_vgl_alpha[0][0][0][0][0]));
assert (rc == QMCKL_SUCCESS);
rc = qmckl_get_det_vgl_beta(context, &(det_vgl_beta[0][0][0][0][0]));
assert (rc == QMCKL_SUCCESS);
rc = qmckl_get_det_inv_matrix_alpha(context, &(det_inv_matrix_alpha[0][0][0][0][0]));
assert (rc == QMCKL_SUCCESS);
rc = qmckl_get_det_inv_matrix_beta(context, &(det_inv_matrix_beta[0][0][0][0][0]));
assert (rc == QMCKL_SUCCESS);
}
#+end_src

View File

@ -801,7 +801,6 @@ printf("\n");
#+end_src
* End of files :noexport:
#+begin_src c :tangle (eval h_private_type)