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

Update qmckl_determinant

This commit is contained in:
Anthony Scemama 2022-01-06 01:04:20 +01:00
parent bd36ed0b48
commit d248a53ffa

View File

@ -841,16 +841,18 @@ qmckl_exit_code qmckl_provide_det_vgl_beta(qmckl_context context) {
:END:
#+NAME: qmckl_compute_det_vgl_alpha_args
| ~qmckl_context~ | ~context~ | in | Global state |
| ~int64_t~ | ~det_num_alpha~ | in | Number of determinants |
| ~int64_t~ | ~walk_num~ | in | Number of walkers |
| ~int64_t~ | ~alpha_num~ | in | Number of electrons |
| ~int64_t~ | ~beta_num~ | in | Number of electrons |
| ~int64_t~ | ~elec_num~ | in | Number of electrons |
| ~int64_t~ | ~mo_index_alpha[det_num_alpha][walk_num][alpha_num]~ | in | MO indices for electrons |
| ~int64_t~ | ~mo_num~ | in | Number of MOs |
| ~double~ | ~mo_vgl[5][elec_num][mo_num]~ | in | Value, gradients and Laplacian of the MOs |
| ~double~ | ~det_vgl_alpha[det_num_alpha][walk_num][5][alpha_num][alpha_num]~ | out | Value, gradients and Laplacian of the Det |
| Variable | Type | In/Out | Description |
|------------------+------------------------------------------------------------+--------+-------------------------------------------|
| ~context~ | ~qmckl_context~ | in | Global state |
| ~det_num_alpha~ | ~int64_t~ | in | Number of determinants |
| ~walk_num~ | ~int64_t~ | in | Number of walkers |
| ~alpha_num~ | ~int64_t~ | in | Number of electrons |
| ~beta_num~ | ~int64_t~ | in | Number of electrons |
| ~elec_num~ | ~int64_t~ | in | Number of electrons |
| ~mo_index_alpha~ | ~int64_t[det_num_alpha][walk_num][alpha_num]~ | in | MO indices for electrons |
| ~mo_num~ | ~int64_t~ | in | Number of MOs |
| ~mo_vgl~ | ~double[5][elec_num][mo_num]~ | in | Value, gradients and Laplacian of the MOs |
| ~det_vgl_alpha~ | ~double[det_num_alpha][walk_num][5][alpha_num][alpha_num]~ | out | Value, gradients and Laplacian of the Det |
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
integer function qmckl_compute_det_vgl_alpha_f(context, &
@ -987,16 +989,18 @@ end function qmckl_compute_det_vgl_alpha_f
:END:
#+NAME: qmckl_compute_det_vgl_beta_args
| ~qmckl_context~ | ~context~ | in | Global state |
| ~int64_t~ | ~det_num_beta~ | in | Number of determinants |
| ~int64_t~ | ~walk_num~ | in | Number of walkers |
| ~int64_t~ | ~alpha_num~ | in | Number of electrons |
| ~int64_t~ | ~beta_num~ | in | Number of electrons |
| ~int64_t~ | ~elec_num~ | in | Number of electrons |
| ~int64_t~ | ~mo_index_beta[det_num_beta][walk_num][beta_num]~ | in | Number of electrons |
| ~int64_t~ | ~mo_num~ | in | Number of MOs |
| ~double~ | ~mo_vgl[5][elec_num][mo_num]~ | in | Value, gradients and Laplacian of the MOs |
| ~double~ | ~det_vgl_beta[det_num_beta][walk_num][5][beta_num][beta_num]~ | out | Value, gradients and Laplacian of the Det |
| Variable | Type | In/Out | Description |
|-----------------+---------------------------------------------------------+--------+-------------------------------------------|
| ~context~ | ~qmckl_context~ | in | Global state |
| ~det_num_beta~ | ~int64_t~ | in | Number of determinants |
| ~walk_num~ | ~int64_t~ | in | Number of walkers |
| ~alpha_num~ | ~int64_t~ | in | Number of electrons |
| ~beta_num~ | ~int64_t~ | in | Number of electrons |
| ~elec_num~ | ~int64_t~ | in | Number of electrons |
| ~mo_index_beta~ | ~int64_t[det_num_beta][walk_num][beta_num]~ | in | Number of electrons |
| ~mo_num~ | ~int64_t~ | in | Number of MOs |
| ~mo_vgl~ | ~double[5][elec_num][mo_num]~ | in | Value, gradients and Laplacian of the MOs |
| ~det_vgl_beta~ | ~double[det_num_beta][walk_num][5][beta_num][beta_num]~ | out | Value, gradients and Laplacian of the Det |
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
integer function qmckl_compute_det_vgl_beta_f(context, &
@ -1761,14 +1765,16 @@ qmckl_exit_code qmckl_provide_det_inv_matrix_beta(qmckl_context context) {
:END:
#+NAME: qmckl_det_inv_matrix_alpha_args
| ~qmckl_context~ | ~context~ | in | Global state |
| ~int64_t~ | ~det_num_alpha~ | in | Number of determinants |
| ~int64_t~ | ~walk_num~ | in | Number of walkers |
| ~int64_t~ | ~alpha_num~ | in | Number of electrons |
| ~double~ | ~det_vgl_alpha[det_num_alpha][walk_num][5][alpha_num][alpha_num]~ | in | determinant matrix Value, gradients and Laplacian of the MOs |
| ~double~ | ~det_value_alpha[det_num_alpha][walk_num]~ | out | value of determinant matrix |
| ~double~ | ~det_adj_matrix_alpha[det_num_alpha][walk_num][alpha_num][alpha_num]~ | out | adjoint of determinant matrix |
| ~double~ | ~det_inv_matrix_alpha[det_num_alpha][walk_num][alpha_num][alpha_num]~ | out | inverse of determinant matrix |
| Variable | Type | In/Out | Description |
|------------------------+------------------------------------------------------------+--------+--------------------------------------------------------------|
| ~context~ | ~qmckl_context~ | in | Global state |
| ~det_num_alpha~ | ~int64_t~ | in | Number of determinants |
| ~walk_num~ | ~int64_t~ | in | Number of walkers |
| ~alpha_num~ | ~int64_t~ | in | Number of electrons |
| ~det_vgl_alpha~ | ~double[det_num_alpha][walk_num][5][alpha_num][alpha_num]~ | in | determinant matrix Value, gradients and Laplacian of the MOs |
| ~det_value_alpha~ | ~double[det_num_alpha][walk_num]~ | out | value of determinant matrix |
| ~det_adj_matrix_alpha~ | ~double[det_num_alpha][walk_num][alpha_num][alpha_num]~ | out | adjoint of determinant matrix |
| ~det_inv_matrix_alpha~ | ~double[det_num_alpha][walk_num][alpha_num][alpha_num]~ | out | inverse of determinant matrix |
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
integer function qmckl_compute_det_inv_matrix_alpha_f(context, &
@ -1816,10 +1822,19 @@ integer function qmckl_compute_det_inv_matrix_alpha_f(context, &
do idet = 1, det_num_alpha
do iwalk = 1, walk_num
! Value
matA(1:alpha_num,1:alpha_num) = det_vgl_alpha(1:alpha_num, 1:alpha_num, 1, iwalk, idet)
res = qmckl_adjugate(context, alpha_num, LDA, matA, det_l)
det_adj_matrix_alpha(1:alpha_num, 1:alpha_num, iwalk, idet) = matA
det_inv_matrix_alpha(1:alpha_num, 1:alpha_num, iwalk, idet) = matA/det_l
matA(1:alpha_num,1:alpha_num) = &
det_vgl_alpha(1:alpha_num, 1:alpha_num, 1, iwalk, idet)
res = qmckl_adjugate(context, &
alpha_num, matA, LDA, &
det_adj_matrix_alpha(1, 1, iwalk, idet), &
int(size(det_adj_matrix_alpha,1),8), &
det_l)
det_inv_matrix_alpha(1:alpha_num, 1:alpha_num, iwalk, idet) = &
(1.d0/det_l) * &
det_adj_matrix_alpha(1:alpha_num, 1:alpha_num, iwalk, idet)
det_value_alpha(iwalk, idet) = det_l
end do
end do
@ -1892,14 +1907,16 @@ end function qmckl_compute_det_inv_matrix_alpha_f
:END:
#+NAME: qmckl_det_inv_matrix_beta_args
| ~qmckl_context~ | ~context~ | in | Global state |
| ~int64_t~ | ~det_num_beta~ | in | Number of determinants |
| ~int64_t~ | ~walk_num~ | in | Number of walkers |
| ~int64_t~ | ~beta_num~ | in | Number of electrons |
| ~double~ | ~det_vgl_beta[det_num_beta][walk_num][5][beta_num][beta_num]~ | in | determinant matrix Value, gradients and Laplacian of the MOs |
| ~double~ | ~det_value_beta[det_num_beta][walk_num]~ | out | value of determinant matrix |
| ~double~ | ~det_adj_matrix_beta[det_num_beta][walk_num][beta_num][beta_num]~ | out | adjoint of determinant matrix |
| ~double~ | ~det_inv_matrix_beta[det_num_beta][walk_num][beta_num][beta_num]~ | out | inverse of determinant matrix |
| Variable | Type | In/Out | Description |
|-----------------------+---------------------------------------------------------+--------+--------------------------------------------------------------|
| ~context~ | ~qmckl_context~ | in | Global state |
| ~det_num_beta~ | ~int64_t~ | in | Number of determinants |
| ~walk_num~ | ~int64_t~ | in | Number of walkers |
| ~beta_num~ | ~int64_t~ | in | Number of electrons |
| ~det_vgl_beta~ | ~double[det_num_beta][walk_num][5][beta_num][beta_num]~ | in | determinant matrix Value, gradients and Laplacian of the MOs |
| ~det_value_beta~ | ~double[det_num_beta][walk_num]~ | out | value of determinant matrix |
| ~det_adj_matrix_beta~ | ~double[det_num_beta][walk_num][beta_num][beta_num]~ | out | adjoint of determinant matrix |
| ~det_inv_matrix_beta~ | ~double[det_num_beta][walk_num][beta_num][beta_num]~ | out | inverse of determinant matrix |
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
integer function qmckl_compute_det_inv_matrix_beta_f(context, &
@ -1947,14 +1964,24 @@ integer function qmckl_compute_det_inv_matrix_beta_f(context, &
do idet = 1, det_num_beta
do iwalk = 1, walk_num
! Value
matA(1:beta_num,1:beta_num) = det_vgl_beta(1:beta_num, 1:beta_num, 1, iwalk, idet)
res = qmckl_adjugate(context, beta_num, LDA, matA, det_l)
det_adj_matrix_beta(1:beta_num, 1:beta_num, iwalk, idet) = matA
det_inv_matrix_beta(1:beta_num, 1:beta_num, iwalk, idet) = matA/det_l
matA(1:beta_num,1:beta_num) = &
det_vgl_beta(1:beta_num, 1:beta_num, 1, iwalk, idet)
res = qmckl_adjugate(context, &
beta_num, matA, LDA, &
det_adj_matrix_beta(1, 1, iwalk, idet), &
int(size(det_adj_matrix_beta,1),8), &
det_l)
det_inv_matrix_beta(1:beta_num, 1:beta_num, iwalk, idet) = &
(1.d0/det_l) * &
det_adj_matrix_beta(1:beta_num, 1:beta_num, iwalk, idet)
det_value_beta(iwalk, idet) = det_l
end do
end do
deallocate(matA)
end function qmckl_compute_det_inv_matrix_beta_f
#+end_src
@ -2015,8 +2042,7 @@ end function qmckl_compute_det_inv_matrix_beta_f
end function qmckl_compute_det_inv_matrix_beta
#+end_src
*** Test
*** Test :noexport:
#+begin_src c :tangle (eval c_test) :exports none
// Get adjoint of the slater-determinant