mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2025-01-03 18:16:28 +01:00
Working on local energy. #41
This commit is contained in:
parent
2b54d2bdf6
commit
705af0b084
@ -34,11 +34,13 @@ int main() {
|
||||
#include "qmckl_mo_private_type.h"
|
||||
#include "qmckl_jastrow_private_type.h"
|
||||
#include "qmckl_determinant_private_type.h"
|
||||
#include "qmckl_local_energy_private_type.h"
|
||||
#include "qmckl_nucleus_private_func.h"
|
||||
#include "qmckl_electron_private_func.h"
|
||||
#include "qmckl_ao_private_func.h"
|
||||
#include "qmckl_mo_private_func.h"
|
||||
#include "qmckl_determinant_private_func.h"
|
||||
#include "qmckl_local_energy_private_func.h"
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c)
|
||||
@ -126,6 +128,7 @@ typedef struct qmckl_context_struct {
|
||||
qmckl_mo_basis_struct mo_basis;
|
||||
qmckl_jastrow_struct jastrow;
|
||||
qmckl_determinant_struct det;
|
||||
qmckl_local_energy_struct local_energy;
|
||||
|
||||
/* To be implemented:
|
||||
,*/
|
||||
|
@ -672,6 +672,8 @@ qmckl_exit_code qmckl_provide_det_vgl_alpha(qmckl_context context) {
|
||||
ctx->det.det_num_alpha,
|
||||
ctx->det.walk_num,
|
||||
ctx->electron.up_num,
|
||||
ctx->electron.down_num,
|
||||
ctx->electron.num,
|
||||
ctx->det.mo_index_alpha,
|
||||
ctx->mo_basis.mo_num,
|
||||
ctx->mo_basis.mo_vgl,
|
||||
@ -760,7 +762,9 @@ qmckl_exit_code qmckl_provide_det_vgl_beta(qmckl_context context) {
|
||||
rc = qmckl_compute_det_vgl_beta(context,
|
||||
ctx->det.det_num_beta,
|
||||
ctx->det.walk_num,
|
||||
ctx->electron.up_num,
|
||||
ctx->electron.down_num,
|
||||
ctx->electron.num,
|
||||
ctx->det.mo_index_beta,
|
||||
ctx->mo_basis.mo_num,
|
||||
ctx->mo_basis.mo_vgl,
|
||||
@ -790,17 +794,20 @@ qmckl_exit_code qmckl_provide_det_vgl_beta(qmckl_context context) {
|
||||
|
||||
#+NAME: qmckl_compute_det_vgl_alpha_args
|
||||
| ~qmckl_context~ | ~context~ | in | Global state |
|
||||
| ~int64_t~ | ~det_num_alpha_alpha~ | in | Number of determinants |
|
||||
| ~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~ | ~mo_index_alpha[det_num_alpha_alpha][walk_num][alpha_num]~ | in | MO indices for 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][walk_num][alpha_num][mo_num]~ | in | Value, gradients and Laplacian of the MOs |
|
||||
| ~double~ | ~det_vgl_alpha[det_num_alpha_alpha][walk_num][5][alpha_num][alpha_num]~ | out | Value, gradients and Laplacian of the Det |
|
||||
| ~double~ | ~mo_vgl[5][walk_num][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 |
|
||||
|
||||
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
|
||||
integer function qmckl_compute_det_vgl_alpha_f(context, &
|
||||
det_num_alpha, walk_num, alpha_num, mo_index_alpha, mo_num, mo_vgl, det_vgl_alpha) &
|
||||
det_num_alpha, walk_num, alpha_num, beta_num, elec_num, &
|
||||
mo_index_alpha, mo_num, mo_vgl, det_vgl_alpha) &
|
||||
result(info)
|
||||
use qmckl
|
||||
implicit none
|
||||
@ -808,9 +815,11 @@ integer function qmckl_compute_det_vgl_alpha_f(context, &
|
||||
integer*8, intent(in) :: det_num_alpha
|
||||
integer*8, intent(in) :: walk_num
|
||||
integer*8, intent(in) :: alpha_num
|
||||
integer*8, intent(in) :: beta_num
|
||||
integer*8, intent(in) :: elec_num
|
||||
integer*8, intent(in) :: mo_num
|
||||
integer*8, intent(in) :: mo_index_alpha(alpha_num, walk_num, det_num_alpha)
|
||||
double precision, intent(in) :: mo_vgl(mo_num, alpha_num, walk_num, 5)
|
||||
double precision, intent(in) :: mo_vgl(mo_num, elec_num, walk_num, 5)
|
||||
double precision, intent(inout) :: det_vgl_alpha(alpha_num, alpha_num, 5, walk_num, det_num_alpha)
|
||||
integer*8 :: idet, iwalk, ielec, mo_id, imo
|
||||
|
||||
@ -858,7 +867,7 @@ integer function qmckl_compute_det_vgl_alpha_f(context, &
|
||||
end function qmckl_compute_det_vgl_alpha_f
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_c_header(table=qmckl_compute_det_vgl_alpha_args,rettyp=get_value("CRetType"),fname="qmckl_compute_det_vgl_alpha"))
|
||||
#+CALL: generate_c_header(table=qmckl_compute_det_vgl_alpha_args,rettyp=get_value("CRetType"),fname="qmckl_compute_det_vgl_alpha"))
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src c :tangle (eval h_func) :comments org
|
||||
@ -867,18 +876,29 @@ end function qmckl_compute_det_vgl_alpha_f
|
||||
const int64_t det_num_alpha,
|
||||
const int64_t walk_num,
|
||||
const int64_t alpha_num,
|
||||
const int64_t beta_num,
|
||||
const int64_t elec_num,
|
||||
const int64_t* mo_index_alpha,
|
||||
const int64_t mo_num,
|
||||
const double* mo_vgl,
|
||||
double* const det_vgl_alpha );
|
||||
#+end_src
|
||||
|
||||
#+CALL: generate_c_interface(table=qmckl_compute_det_vgl_alpha_args,rettyp=get_value("CRetType"),fname="qmckl_compute_det_vgl_alpha"))
|
||||
#+CALL: generate_c_interface(table=qmckl_compute_det_vgl_alpha_args,rettyp=get_value("CRetType"),fname="qmckl_compute_det_vgl_alpha"))
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
||||
integer(c_int32_t) function qmckl_compute_det_vgl_alpha &
|
||||
(context, det_num_alpha, walk_num, alpha_num, mo_index_alpha, mo_num, mo_vgl, det_vgl_alpha) &
|
||||
(context, &
|
||||
det_num_alpha, &
|
||||
walk_num, &
|
||||
alpha_num, &
|
||||
beta_num, &
|
||||
elec_num, &
|
||||
mo_index_alpha, &
|
||||
mo_num, &
|
||||
mo_vgl, &
|
||||
det_vgl_alpha) &
|
||||
bind(C) result(info)
|
||||
|
||||
use, intrinsic :: iso_c_binding
|
||||
@ -888,14 +908,25 @@ end function qmckl_compute_det_vgl_alpha_f
|
||||
integer (c_int64_t) , intent(in) , value :: det_num_alpha
|
||||
integer (c_int64_t) , intent(in) , value :: walk_num
|
||||
integer (c_int64_t) , intent(in) , value :: alpha_num
|
||||
integer (c_int64_t) , intent(in) , value :: beta_num
|
||||
integer (c_int64_t) , intent(in) , value :: elec_num
|
||||
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,alpha_num,walk_num,5)
|
||||
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)
|
||||
|
||||
integer(c_int32_t), external :: qmckl_compute_det_vgl_alpha_f
|
||||
info = qmckl_compute_det_vgl_alpha_f &
|
||||
(context, det_num_alpha, walk_num, alpha_num, mo_index_alpha, mo_num, mo_vgl, det_vgl_alpha)
|
||||
(context, &
|
||||
det_num_alpha, &
|
||||
walk_num, &
|
||||
alpha_num, &
|
||||
beta_num, &
|
||||
elec_num, &
|
||||
mo_index_alpha, &
|
||||
mo_num, &
|
||||
mo_vgl, &
|
||||
det_vgl_alpha)
|
||||
|
||||
end function qmckl_compute_det_vgl_alpha
|
||||
#+end_src
|
||||
@ -908,28 +939,33 @@ end function qmckl_compute_det_vgl_alpha_f
|
||||
:END:
|
||||
|
||||
#+NAME: qmckl_compute_det_vgl_beta_args
|
||||
| ~qmckl_context~ | ~context~ | in | Global state |
|
||||
| ~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 |
|
||||
| ~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][walk_num][beta_num][mo_num]~ | in | Value, gradients and Laplacian of the MOs |
|
||||
| ~int64_t~ | ~mo_num~ | in | Number of MOs |
|
||||
| ~double~ | ~mo_vgl[5][walk_num][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 |
|
||||
|
||||
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
|
||||
integer function qmckl_compute_det_vgl_beta_f(context, &
|
||||
det_num_beta, walk_num, beta_num, mo_index_beta, mo_num, mo_vgl, det_vgl_beta) &
|
||||
det_num_beta, walk_num, alpha_num, beta_num, elec_num, &
|
||||
mo_index_beta, mo_num, mo_vgl, det_vgl_beta) &
|
||||
result(info)
|
||||
use qmckl
|
||||
implicit none
|
||||
integer(qmckl_context) , intent(in) :: context
|
||||
integer*8, intent(in) :: det_num_beta
|
||||
integer*8, intent(in) :: walk_num
|
||||
integer*8, intent(in) :: alpha_num
|
||||
integer*8, intent(in) :: beta_num
|
||||
integer*8, intent(in) :: elec_num
|
||||
integer*8, intent(in) :: mo_num
|
||||
integer*8, intent(in) :: mo_index_beta(beta_num,walk_num,det_num_beta)
|
||||
double precision, intent(in) :: mo_vgl(mo_num, beta_num, walk_num, 5)
|
||||
double precision, intent(in) :: mo_vgl(mo_num, elec_num, walk_num, 5)
|
||||
double precision, intent(inout) :: det_vgl_beta(beta_num, beta_num, 5, walk_num, det_num_beta)
|
||||
integer*8 :: idet, iwalk, ielec, mo_id, imo
|
||||
|
||||
@ -956,19 +992,19 @@ integer function qmckl_compute_det_vgl_beta_f(context, &
|
||||
do imo = 1, beta_num
|
||||
mo_id = mo_index_beta(imo, iwalk, idet)
|
||||
! Value
|
||||
det_vgl_beta(imo, ielec, 1, iwalk, idet) = mo_vgl(mo_id, ielec, iwalk, 1)
|
||||
det_vgl_beta(imo, ielec, 1, iwalk, idet) = mo_vgl(mo_id, alpha_num + ielec, iwalk, 1)
|
||||
|
||||
! Grad_x
|
||||
det_vgl_beta(imo, ielec, 2, iwalk, idet) = mo_vgl(mo_id, ielec, iwalk, 2)
|
||||
det_vgl_beta(imo, ielec, 2, iwalk, idet) = mo_vgl(mo_id, alpha_num + ielec, iwalk, 2)
|
||||
|
||||
! Grad_y
|
||||
det_vgl_beta(imo, ielec, 3, iwalk, idet) = mo_vgl(mo_id, ielec, iwalk, 3)
|
||||
det_vgl_beta(imo, ielec, 3, iwalk, idet) = mo_vgl(mo_id, alpha_num + ielec, iwalk, 3)
|
||||
|
||||
! Grad_z
|
||||
det_vgl_beta(imo, ielec, 4, iwalk, idet) = mo_vgl(mo_id, ielec, iwalk, 4)
|
||||
det_vgl_beta(imo, ielec, 4, iwalk, idet) = mo_vgl(mo_id, alpha_num + ielec, iwalk, 4)
|
||||
|
||||
! Lap
|
||||
det_vgl_beta(imo, ielec, 5, iwalk, idet) = mo_vgl(mo_id, ielec, iwalk, 5)
|
||||
det_vgl_beta(imo, ielec, 5, iwalk, idet) = mo_vgl(mo_id, alpha_num + ielec, iwalk, 5)
|
||||
end do
|
||||
end do
|
||||
end do
|
||||
@ -985,7 +1021,9 @@ end function qmckl_compute_det_vgl_beta_f
|
||||
const qmckl_context context,
|
||||
const int64_t det_num_beta,
|
||||
const int64_t walk_num,
|
||||
const int64_t alpha_num,
|
||||
const int64_t beta_num,
|
||||
const int64_t elec_num,
|
||||
const int64_t* mo_index_beta,
|
||||
const int64_t mo_num,
|
||||
const double* mo_vgl,
|
||||
@ -997,7 +1035,16 @@ end function qmckl_compute_det_vgl_beta_f
|
||||
#+RESULTS:
|
||||
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
||||
integer(c_int32_t) function qmckl_compute_det_vgl_beta &
|
||||
(context, det_num_beta, walk_num, beta_num, mo_index_beta, mo_num, mo_vgl, det_vgl_beta) &
|
||||
(context, &
|
||||
det_num_beta, &
|
||||
walk_num, &
|
||||
alpha_num, &
|
||||
beta_num, &
|
||||
elec_num, &
|
||||
mo_index_beta, &
|
||||
mo_num, &
|
||||
mo_vgl, &
|
||||
det_vgl_beta) &
|
||||
bind(C) result(info)
|
||||
|
||||
use, intrinsic :: iso_c_binding
|
||||
@ -1006,15 +1053,26 @@ end function qmckl_compute_det_vgl_beta_f
|
||||
integer (c_int64_t) , intent(in) , value :: context
|
||||
integer (c_int64_t) , intent(in) , value :: det_num_beta
|
||||
integer (c_int64_t) , intent(in) , value :: walk_num
|
||||
integer (c_int64_t) , intent(in) , value :: alpha_num
|
||||
integer (c_int64_t) , intent(in) , value :: beta_num
|
||||
integer (c_int64_t) , intent(in) , value :: elec_num
|
||||
integer (c_int64_t) , intent(in) :: mo_index_beta(beta_num,walk_num,det_num_beta)
|
||||
integer (c_int64_t) , intent(in) , value :: mo_num
|
||||
real (c_double ) , intent(in) :: mo_vgl(mo_num,beta_num,walk_num,5)
|
||||
real (c_double ) , intent(in) :: mo_vgl(mo_num,elec_num,walk_num,5)
|
||||
real (c_double ) , intent(out) :: det_vgl_beta(beta_num,beta_num,5,walk_num,det_num_beta)
|
||||
|
||||
integer(c_int32_t), external :: qmckl_compute_det_vgl_beta_f
|
||||
info = qmckl_compute_det_vgl_beta_f &
|
||||
(context, det_num_beta, walk_num, beta_num, mo_index_beta, mo_num, mo_vgl, det_vgl_beta)
|
||||
(context, &
|
||||
det_num_beta, &
|
||||
walk_num, &
|
||||
alpha_num, &
|
||||
beta_num, &
|
||||
elec_num, &
|
||||
mo_index_beta, &
|
||||
mo_num, &
|
||||
mo_vgl, &
|
||||
det_vgl_beta)
|
||||
|
||||
end function qmckl_compute_det_vgl_beta
|
||||
#+end_src
|
||||
|
@ -7,6 +7,7 @@ qmckl_distance.org
|
||||
qmckl_electron.org
|
||||
qmckl_error.org
|
||||
qmckl_jastrow.org
|
||||
qmckl_local_energy.org
|
||||
qmckl_memory.org
|
||||
qmckl_mo.org
|
||||
qmckl_numprec.org
|
||||
|
Loading…
Reference in New Issue
Block a user