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

Merge branch 'master' into master

This commit is contained in:
vijay 2021-10-11 23:31:51 +02:00 committed by GitHub
commit f13d45f82f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,7 +87,7 @@ int main() {
|---------------+-----------------------------------+----------------------------------------------------------------------------------------| |---------------+-----------------------------------+----------------------------------------------------------------------------------------|
|---------------+-----------------------------------+----------------------------------------------------------------------------------------| |---------------+-----------------------------------+----------------------------------------------------------------------------------------|
| ~mo_vgl~ | ~[5][walk_num][elec_num][mo_num]~ | Value, gradients, Laplacian of the MOs at electron positions | | ~mo_vgl~ | ~[5][elec_num][mo_num]~ | Value, gradients, Laplacian of the MOs at electron positions |
| ~mo_vgl_date~ | ~uint64_t~ | Late modification date of Value, gradients, Laplacian of the MOs at electron positions | | ~mo_vgl_date~ | ~uint64_t~ | Late modification date of Value, gradients, Laplacian of the MOs at electron positions |
|---------------+-----------------------------------+----------------------------------------------------------------------------------------| |---------------+-----------------------------------+----------------------------------------------------------------------------------------|
@ -319,7 +319,7 @@ qmckl_exit_code qmckl_get_mo_basis_vgl(qmckl_context context, double* const mo_v
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 = 5 * ctx->electron.num * ctx->mo_basis.mo_num * ctx->electron.walk_num; size_t sze = 5 * ctx->electron.num * ctx->mo_basis.mo_num;
memcpy(mo_vgl, ctx->mo_basis.mo_vgl, sze * sizeof(double)); memcpy(mo_vgl, ctx->mo_basis.mo_vgl, sze * sizeof(double));
return QMCKL_SUCCESS; return QMCKL_SUCCESS;
@ -385,8 +385,7 @@ qmckl_exit_code qmckl_provide_mo_vgl(qmckl_context context)
if (ctx->mo_basis.mo_vgl == NULL) { if (ctx->mo_basis.mo_vgl == NULL) {
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 = 5 * ctx->electron.num * ctx->mo_basis.mo_num * mem_info.size = 5 * ctx->electron.num * ctx->mo_basis.mo_num * sizeof(double);
ctx->electron.walk_num * sizeof(double);
double* mo_vgl = (double*) qmckl_malloc(context, mem_info); double* mo_vgl = (double*) qmckl_malloc(context, mem_info);
if (mo_vgl == NULL) { if (mo_vgl == NULL) {
@ -404,7 +403,6 @@ qmckl_exit_code qmckl_provide_mo_vgl(qmckl_context context)
ctx->ao_basis.ao_num, ctx->ao_basis.ao_num,
ctx->mo_basis.mo_num, ctx->mo_basis.mo_num,
ctx->electron.num, ctx->electron.num,
ctx->electron.walk_num,
ctx->mo_basis.coefficient, ctx->mo_basis.coefficient,
ctx->ao_basis.ao_vgl, ctx->ao_basis.ao_vgl,
ctx->mo_basis.mo_vgl); ctx->mo_basis.mo_vgl);
@ -437,14 +435,13 @@ qmckl_exit_code qmckl_provide_mo_vgl(qmckl_context context)
| ~int64_t~ | ~ao_num~ | in | Number of AOs | | ~int64_t~ | ~ao_num~ | in | Number of AOs |
| ~int64_t~ | ~mo_num~ | in | Number of MOs | | ~int64_t~ | ~mo_num~ | in | Number of MOs |
| ~int64_t~ | ~elec_num~ | in | Number of electrons | | ~int64_t~ | ~elec_num~ | in | Number of electrons |
| ~int64_t~ | ~walk_num~ | in | Number of walkers |
| ~double~ | ~coef_normalized[mo_num][ao_num]~ | in | AO to MO transformation matrix | | ~double~ | ~coef_normalized[mo_num][ao_num]~ | in | AO to MO transformation matrix |
| ~double~ | ~ao_vgl[5][walk_num][elec_num][ao_num]~ | in | Value, gradients and Laplacian of the AOs | | ~double~ | ~ao_vgl[5][elec_num][ao_num]~ | in | Value, gradients and Laplacian of the AOs |
| ~double~ | ~mo_vgl[5][walk_num][elec_num][mo_num]~ | out | Value, gradients and Laplacian of the MOs | | ~double~ | ~mo_vgl[5][elec_num][mo_num]~ | out | Value, gradients and Laplacian of the MOs |
#+begin_src f90 :comments org :tangle (eval f) :noweb yes #+begin_src f90 :comments org :tangle (eval f) :noweb yes
integer function qmckl_compute_mo_basis_gaussian_vgl_f(context, & integer function qmckl_compute_mo_basis_gaussian_vgl_f(context, &
ao_num, mo_num, elec_num, walk_num, & ao_num, mo_num, elec_num, &
coef_normalized, ao_vgl, mo_vgl) & coef_normalized, ao_vgl, mo_vgl) &
result(info) result(info)
use qmckl use qmckl
@ -452,10 +449,9 @@ integer function qmckl_compute_mo_basis_gaussian_vgl_f(context, &
integer(qmckl_context), intent(in) :: context integer(qmckl_context), intent(in) :: context
integer*8 , intent(in) :: ao_num, mo_num integer*8 , intent(in) :: ao_num, mo_num
integer*8 , intent(in) :: elec_num integer*8 , intent(in) :: elec_num
integer*8 , intent(in) :: walk_num double precision , intent(in) :: ao_vgl(ao_num,elec_num,5)
double precision , intent(in) :: ao_vgl(ao_num,elec_num,walk_num,5)
double precision , intent(in) :: coef_normalized(ao_num,mo_num) double precision , intent(in) :: coef_normalized(ao_num,mo_num)
double precision , intent(out) :: mo_vgl(mo_num,elec_num,walk_num,5) double precision , intent(out) :: mo_vgl(mo_num,elec_num,5)
logical*8 :: TransA, TransB logical*8 :: TransA, TransB
double precision :: alpha, beta double precision :: alpha, beta
integer :: info_qmckl_dgemm_value integer :: info_qmckl_dgemm_value
@ -489,39 +485,37 @@ integer function qmckl_compute_mo_basis_gaussian_vgl_f(context, &
LDB = K LDB = K
LDC = M LDC = M
do iwalk = 1, walk_num do ielec = 1, elec_num
do ielec = 1, elec_num ! Value
! Value info_qmckl_dgemm_value = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, &
info_qmckl_dgemm_value = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, & ao_vgl(:, ielec, 1), LDA, &
ao_vgl(:, ielec, iwalk, 1), LDA, & coef_normalized(1:ao_num,1:mo_num),size(coef_normalized,1) * 1_8, &
coef_normalized(1:ao_num,1:mo_num),size(coef_normalized,1) * 1_8, & beta, &
beta, & mo_vgl(:,ielec,1),LDC)
mo_vgl(:,ielec,iwalk,1),LDC) ! Grad_x
! Grad_x info_qmckl_dgemm_Gx = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, &
info_qmckl_dgemm_Gx = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, & ao_vgl(:, ielec, 2), LDA, &
ao_vgl(:, ielec, iwalk, 2), LDA, & coef_normalized(1:ao_num,1:mo_num),size(coef_normalized,1) * 1_8, &
coef_normalized(1:ao_num,1:mo_num),size(coef_normalized,1) * 1_8, & beta, &
beta, & mo_vgl(:,ielec,2),LDC)
mo_vgl(:,ielec,iwalk,2),LDC) ! Grad_y
! Grad_y info_qmckl_dgemm_Gy = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, &
info_qmckl_dgemm_Gy = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, & ao_vgl(:, ielec, 3), LDA, &
ao_vgl(:, ielec, iwalk, 3), LDA, & coef_normalized(1:ao_num,1:mo_num),size(coef_normalized,1) * 1_8, &
coef_normalized(1:ao_num,1:mo_num),size(coef_normalized,1) * 1_8, & beta, &
beta, & mo_vgl(:,ielec,3),LDC)
mo_vgl(:,ielec,iwalk,3),LDC) ! Grad_z
! Grad_z info_qmckl_dgemm_Gz = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, &
info_qmckl_dgemm_Gz = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, & ao_vgl(:, ielec, 4), LDA, &
ao_vgl(:, ielec, iwalk, 4), LDA, & coef_normalized(1:ao_num,1:mo_num),size(coef_normalized,1) * 1_8, &
coef_normalized(1:ao_num,1:mo_num),size(coef_normalized,1) * 1_8, & beta, &
beta, & mo_vgl(:,ielec,4),LDC)
mo_vgl(:,ielec,iwalk,4),LDC) ! Lapl_z
! Lapl_z info_qmckl_dgemm_lap = qmckl_dgemm(context, TransA, TransB, M, N, K, alpha, &
info_qmckl_dgemm_lap = qmckl_dgemm(context, TransA, TransB, M, N, K, alpha, & ao_vgl(:, ielec, 5), LDA, &
ao_vgl(:, ielec, iwalk, 5), LDA, & coef_normalized(1:ao_num,1:mo_num),size(coef_normalized,1) * 1_8, &
coef_normalized(1:ao_num,1:mo_num),size(coef_normalized,1) * 1_8, & beta, &
beta, & mo_vgl(:,ielec,5),LDC)
mo_vgl(:,ielec,iwalk,5),LDC)
end do
end do end do
if(info_qmckl_dgemm_value .eq. QMCKL_SUCCESS .and. & if(info_qmckl_dgemm_value .eq. QMCKL_SUCCESS .and. &
@ -546,7 +540,6 @@ end function qmckl_compute_mo_basis_gaussian_vgl_f
const int64_t ao_num, const int64_t ao_num,
const int64_t mo_num, const int64_t mo_num,
const int64_t elec_num, const int64_t elec_num,
const int64_t walk_num,
const double* coef_normalized, const double* coef_normalized,
const double* ao_vgl, const double* ao_vgl,
double* const mo_vgl ); double* const mo_vgl );
@ -558,7 +551,7 @@ end function qmckl_compute_mo_basis_gaussian_vgl_f
#+RESULTS: #+RESULTS:
#+begin_src f90 :tangle (eval f) :comments org :exports none #+begin_src f90 :tangle (eval f) :comments org :exports none
integer(c_int32_t) function qmckl_compute_mo_basis_gaussian_vgl & integer(c_int32_t) function qmckl_compute_mo_basis_gaussian_vgl &
(context, ao_num, mo_num, elec_num, walk_num, coef_normalized, ao_vgl, mo_vgl) & (context, ao_num, mo_num, elec_num, coef_normalized, ao_vgl, mo_vgl) &
bind(C) result(info) bind(C) result(info)
use, intrinsic :: iso_c_binding use, intrinsic :: iso_c_binding
@ -568,14 +561,13 @@ end function qmckl_compute_mo_basis_gaussian_vgl_f
integer (c_int64_t) , intent(in) , value :: ao_num integer (c_int64_t) , intent(in) , value :: ao_num
integer (c_int64_t) , intent(in) , value :: mo_num integer (c_int64_t) , intent(in) , value :: mo_num
integer (c_int64_t) , intent(in) , value :: elec_num integer (c_int64_t) , intent(in) , value :: elec_num
integer (c_int64_t) , intent(in) , value :: walk_num
real (c_double ) , intent(in) :: coef_normalized(ao_num,mo_num) real (c_double ) , intent(in) :: coef_normalized(ao_num,mo_num)
real (c_double ) , intent(in) :: ao_vgl(ao_num,elec_num,walk_num,5) real (c_double ) , intent(in) :: ao_vgl(ao_num,elec_num,5)
real (c_double ) , intent(out) :: mo_vgl(mo_num,elec_num,walk_num,5) real (c_double ) , intent(out) :: mo_vgl(mo_num,elec_num,5)
integer(c_int32_t), external :: qmckl_compute_mo_basis_gaussian_vgl_f integer(c_int32_t), external :: qmckl_compute_mo_basis_gaussian_vgl_f
info = qmckl_compute_mo_basis_gaussian_vgl_f & info = qmckl_compute_mo_basis_gaussian_vgl_f &
(context, ao_num, mo_num, elec_num, walk_num, coef_normalized, ao_vgl, mo_vgl) (context, ao_num, mo_num, elec_num, coef_normalized, ao_vgl, mo_vgl)
end function qmckl_compute_mo_basis_gaussian_vgl end function qmckl_compute_mo_basis_gaussian_vgl
#+end_src #+end_src
@ -773,8 +765,8 @@ assert (rc == QMCKL_SUCCESS);
assert(qmckl_mo_basis_provided(context)); assert(qmckl_mo_basis_provided(context));
double mo_vgl[5][walk_num][elec_num][chbrclf_mo_num]; double mo_vgl[5][elec_num][chbrclf_mo_num];
rc = qmckl_get_mo_basis_vgl(context, &(mo_vgl[0][0][0][0])); rc = qmckl_get_mo_basis_vgl(context, &(mo_vgl[0][0][0]));
assert (rc == QMCKL_SUCCESS); assert (rc == QMCKL_SUCCESS);
// Test overlap of MO // Test overlap of MO
@ -818,18 +810,18 @@ assert (rc == QMCKL_SUCCESS);
printf("\n"); printf("\n");
printf(" mo_vgl mo_vgl[0][0][26][219] %25.15e\n", mo_vgl[0][0][2][3]); printf(" mo_vgl mo_vgl[0][26][219] %25.15e\n", mo_vgl[0][2][3]);
printf(" mo_vgl mo_vgl[1][0][26][219] %25.15e\n", mo_vgl[1][0][2][3]); printf(" mo_vgl mo_vgl[1][26][219] %25.15e\n", mo_vgl[1][2][3]);
printf(" mo_vgl mo_vgl[0][0][26][220] %25.15e\n", mo_vgl[0][0][2][3]); printf(" mo_vgl mo_vgl[0][26][220] %25.15e\n", mo_vgl[0][2][3]);
printf(" mo_vgl mo_vgl[1][0][26][220] %25.15e\n", mo_vgl[1][0][2][3]); printf(" mo_vgl mo_vgl[1][26][220] %25.15e\n", mo_vgl[1][2][3]);
printf(" mo_vgl mo_vgl[0][0][26][221] %25.15e\n", mo_vgl[0][0][2][3]); printf(" mo_vgl mo_vgl[0][26][221] %25.15e\n", mo_vgl[0][2][3]);
printf(" mo_vgl mo_vgl[1][0][26][221] %25.15e\n", mo_vgl[1][0][2][3]); printf(" mo_vgl mo_vgl[1][26][221] %25.15e\n", mo_vgl[1][2][3]);
printf(" mo_vgl mo_vgl[0][0][26][222] %25.15e\n", mo_vgl[0][0][2][3]); printf(" mo_vgl mo_vgl[0][26][222] %25.15e\n", mo_vgl[0][2][3]);
printf(" mo_vgl mo_vgl[1][0][26][222] %25.15e\n", mo_vgl[1][0][2][3]); printf(" mo_vgl mo_vgl[1][26][222] %25.15e\n", mo_vgl[1][2][3]);
printf(" mo_vgl mo_vgl[0][0][26][223] %25.15e\n", mo_vgl[0][0][2][3]); printf(" mo_vgl mo_vgl[0][26][223] %25.15e\n", mo_vgl[0][2][3]);
printf(" mo_vgl mo_vgl[1][0][26][223] %25.15e\n", mo_vgl[1][0][2][3]); printf(" mo_vgl mo_vgl[1][26][223] %25.15e\n", mo_vgl[1][2][3]);
printf(" mo_vgl mo_vgl[0][0][26][224] %25.15e\n", mo_vgl[0][0][2][3]); printf(" mo_vgl mo_vgl[0][26][224] %25.15e\n", mo_vgl[0][2][3]);
printf(" mo_vgl mo_vgl[1][0][26][224] %25.15e\n", mo_vgl[1][0][2][3]); printf(" mo_vgl mo_vgl[1][26][224] %25.15e\n", mo_vgl[1][2][3]);
printf("\n"); printf("\n");
} }