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

Checking ao -> mo.

This commit is contained in:
v1j4y 2021-09-27 22:06:49 +02:00
parent d3311ec2d9
commit 5220df5185

View File

@ -405,24 +405,24 @@ qmckl_exit_code qmckl_provide_mo_vgl(qmckl_context context)
}
qmckl_exit_code rc;
//if (ctx->mo_basis.type == 'G') {
// rc = qmckl_compute_mo_basis_gaussian_vgl(context,
// ctx->ao_basis.ao_num,
// ctx->mo_basis.mo_num,
// ctx->electron.num,
// ctx->electron.walk_num,
// ctx->mo_basis.coefficient,
// ctx->ao_basis.ao_vgl,
// ctx->mo_basis.mo_vgl);
//} else {
// return qmckl_failwith( context,
// QMCKL_FAILURE,
// "compute_mo_basis_vgl",
// "Not yet implemented");
//}
//if (rc != QMCKL_SUCCESS) {
// return rc;
//}
if (ctx->mo_basis.type == 'G') {
rc = qmckl_compute_mo_basis_gaussian_vgl(context,
ctx->ao_basis.ao_num,
ctx->mo_basis.mo_num,
ctx->electron.num,
ctx->electron.walk_num,
ctx->mo_basis.coefficient,
ctx->ao_basis.ao_vgl,
ctx->mo_basis.mo_vgl);
} else {
return qmckl_failwith( context,
QMCKL_FAILURE,
"compute_mo_basis_vgl",
"Not yet implemented");
}
if (rc != QMCKL_SUCCESS) {
return rc;
}
ctx->mo_basis.mo_vgl_date = ctx->date;
}
@ -445,7 +445,7 @@ qmckl_exit_code qmckl_provide_mo_vgl(qmckl_context context)
| ~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~ | ~ao_vgl[5][walk_num][elec_num][mo_num]~ | in | Value, gradients and Laplacian of the AOs |
| ~double~ | ~ao_vgl[5][walk_num][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 |
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
@ -460,7 +460,7 @@ integer function qmckl_compute_mo_basis_gaussian_vgl_f(context, &
integer*8 , intent(in) :: elec_num
integer*8 , intent(in) :: walk_num
double precision , intent(in) :: ao_vgl(ao_num,elec_num,walk_num,5)
double precision , intent(in) :: coef_normalized(mo_num,ao_num)
double precision , intent(in) :: coef_normalized(ao_num,mo_num)
double precision , intent(out) :: mo_vgl(mo_num,elec_num,walk_num,5)
logical*8 :: TransA, TransB
double precision :: alpha, beta
@ -492,50 +492,50 @@ integer function qmckl_compute_mo_basis_gaussian_vgl_f(context, &
N = 1_8
K = mo_num * 1_8
do iwalk = 1, walk_num
do ielec = 1, elec_num
! Value
TransA = .True.
TransB = .True.
info_qmckl_dgemm_value = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, &
ao_vgl(:, ielec, iwalk, 1), size(ao_vgl,1) * 1_8, &
coef_normalized,size(coef_normalized,1) * 1_8, &
beta, &
mo_vgl(:,ielec,iwalk,1),1_8)
! Grad_x
TransA = .True.
TransB = .True.
info_qmckl_dgemm_Gx = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, &
ao_vgl(:, ielec, iwalk, 2), size(ao_vgl,1) * 1_8, &
coef_normalized,size(coef_normalized,1) * 1_8, &
beta, &
mo_vgl(:,ielec,iwalk,2),1_8)
! Grad_y
TransA = .True.
TransB = .True.
info_qmckl_dgemm_Gy = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, &
ao_vgl(:, ielec, iwalk, 3), size(ao_vgl,1) * 1_8, &
coef_normalized,size(coef_normalized,1) * 1_8, &
beta, &
mo_vgl(:,ielec,iwalk,3),1_8)
! Grad_z
TransA = .True.
TransB = .True.
info_qmckl_dgemm_Gz = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, &
ao_vgl(:, ielec, iwalk, 4), size(ao_vgl,1) * 1_8, &
coef_normalized,size(coef_normalized,1) * 1_8, &
beta, &
mo_vgl(:,ielec,iwalk,4),1_8)
! Lapl_z
TransA = .True.
TransB = .True.
info_qmckl_dgemm_lap = qmckl_dgemm(context, TransA, TransB, M, N, K, alpha, &
ao_vgl(:, ielec, iwalk, 5), size(ao_vgl,1) * 1_8, &
coef_normalized,size(coef_normalized,1) * 1_8, &
beta, &
mo_vgl(:,ielec,iwalk,5),1_8)
end do
end do
!do iwalk = 1, walk_num
! do ielec = 1, elec_num
! ! Value
! TransA = .True.
! TransB = .True.
! info_qmckl_dgemm_value = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, &
! ao_vgl(:, ielec, iwalk, 1), size(ao_vgl,1) * 1_8, &
! coef_normalized,size(coef_normalized,1) * 1_8, &
! beta, &
! mo_vgl(:,ielec,iwalk,1),1_8)
! ! Grad_x
! TransA = .True.
! TransB = .True.
! info_qmckl_dgemm_Gx = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, &
! ao_vgl(:, ielec, iwalk, 2), size(ao_vgl,1) * 1_8, &
! coef_normalized,size(coef_normalized,1) * 1_8, &
! beta, &
! mo_vgl(:,ielec,iwalk,2),1_8)
! ! Grad_y
! TransA = .True.
! TransB = .True.
! info_qmckl_dgemm_Gy = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, &
! ao_vgl(:, ielec, iwalk, 3), size(ao_vgl,1) * 1_8, &
! coef_normalized,size(coef_normalized,1) * 1_8, &
! beta, &
! mo_vgl(:,ielec,iwalk,3),1_8)
! ! Grad_z
! TransA = .True.
! TransB = .True.
! info_qmckl_dgemm_Gz = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, &
! ao_vgl(:, ielec, iwalk, 4), size(ao_vgl,1) * 1_8, &
! coef_normalized,size(coef_normalized,1) * 1_8, &
! beta, &
! mo_vgl(:,ielec,iwalk,4),1_8)
! ! Lapl_z
! TransA = .True.
! TransB = .True.
! info_qmckl_dgemm_lap = qmckl_dgemm(context, TransA, TransB, M, N, K, alpha, &
! ao_vgl(:, ielec, iwalk, 5), size(ao_vgl,1) * 1_8, &
! coef_normalized,size(coef_normalized,1) * 1_8, &
! beta, &
! mo_vgl(:,ielec,iwalk,5),1_8)
! end do
!end do
if(info_qmckl_dgemm_value .eq. QMCKL_SUCCESS .and. &
info_qmckl_dgemm_Gx .eq. QMCKL_SUCCESS .and. &
@ -553,7 +553,7 @@ end function qmckl_compute_mo_basis_gaussian_vgl_f
#+CALL: generate_c_header(table=qmckl_mo_basis_gaussian_vgl_args,rettyp=get_value("CRetType"),fname="qmckl_compute_mo_basis_gaussian_vgl"))
#+RESULTS:
#+BEGIN_src c :tangle (eval h_func) :comments org
#+begin_src c :tangle (eval h_func) :comments org
qmckl_exit_code qmckl_compute_mo_basis_gaussian_vgl (
const qmckl_context context,
const int64_t ao_num,
@ -563,13 +563,13 @@ end function qmckl_compute_mo_basis_gaussian_vgl_f
const double* coef_normalized,
const double* ao_vgl,
double* const mo_vgl );
#+END_src
#+end_src
#+CALL: generate_c_interface(table=qmckl_mo_basis_gaussian_vgl_args,rettyp=get_value("CRetType"),fname="qmckl_compute_mo_basis_gaussian_vgl"))
#+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 &
(context, ao_num, mo_num, elec_num, walk_num, coef_normalized, ao_vgl, mo_vgl) &
bind(C) result(info)
@ -583,7 +583,7 @@ end function qmckl_compute_mo_basis_gaussian_vgl_f
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) :: ao_vgl(mo_num,elec_num,walk_num,5)
real (c_double ) , intent(in) :: ao_vgl(ao_num,elec_num,walk_num,5)
real (c_double ) , intent(out) :: mo_vgl(mo_num,elec_num,walk_num,5)
integer(c_int32_t), external :: qmckl_compute_mo_basis_gaussian_vgl_f
@ -591,9 +591,12 @@ end function qmckl_compute_mo_basis_gaussian_vgl_f
(context, ao_num, mo_num, elec_num, walk_num, coef_normalized, ao_vgl, mo_vgl)
end function qmckl_compute_mo_basis_gaussian_vgl
#+END_src
#+end_src
*** Test
#+begin_src python :results output :exports none
import numpy as np
@ -656,9 +659,6 @@ print ( "[4][1][15][14] : %25.15e"% lf(a,x,y))
#+end_src
*** Test
#+begin_src c :tangle (eval c_test) :exports none
{
#define walk_num chbrclf_walk_num