diff --git a/org/qmckl_jastrow_champ.org b/org/qmckl_jastrow_champ.org index 4d2d335..9c0a9f5 100644 --- a/org/qmckl_jastrow_champ.org +++ b/org/qmckl_jastrow_champ.org @@ -156,10 +156,8 @@ int main() { | ~factor_en_deriv_e_date~ | ~uint64_t~ | out | Keep track of the date for the en derivative | | ~factor_een_deriv_e~ | ~double[4][nelec][walker.num]~ | out | Derivative of the Jastrow factor: electron-electron-nucleus part | | ~factor_een_deriv_e_date~ | ~uint64_t~ | out | Keep track of the date for the een derivative | - | ~vgl~ | ~double[walk_num][5]~ | out | Value, gradient and Laplacian of the Jastrow factor | - | ~vgl_date~ | ~uint64_t~ | out | Keep track of the date | - computed data: + Computed data: | Variable | Type | In/Out | |-------------------------------------+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------| @@ -189,6 +187,10 @@ int main() { | ~een_rescaled_e_deriv_e_date~ | ~uint64_t~ | Keep track of the date of creation | | ~een_rescaled_n_deriv_e~ | ~double[walker.num][cord_num+1][nucl_num][4][elec_num]~ | The electron-electron rescaled distances raised to the powers defined by cord derivatives wrt electrons | | ~een_rescaled_n_deriv_e_date~ | ~uint64_t~ | Keep track of the date of creation | + | ~value~ | ~double[walk_num]~ | out | Value of the Jastrow factor | + | ~value_date~ | ~uint64_t~ | out | Keep track of the date | + | ~gl~ | ~double[walk_num][4][elec_num]~ | out | Gradient and Laplacian of the Jastrow factor | + | ~value_date~ | ~uint64_t~ | out | Keep track of the date | #+NAME: jastrow_data #+BEGIN_SRC python :results none :exports none @@ -371,7 +373,8 @@ typedef struct qmckl_jastrow_champ_struct{ double * restrict factor_en_deriv_e; double * restrict rescale_factor_en; double * restrict tmp_c; - double * restrict vgl; + double * restrict value; + double * restrict gl; int64_t aord_num; int64_t bord_num; int64_t cord_num; @@ -398,7 +401,8 @@ typedef struct qmckl_jastrow_champ_struct{ uint64_t factor_en_deriv_e_date; uint64_t lkpm_combined_index_date; uint64_t tmp_c_date; - uint64_t vgl_date; + uint64_t value_date; + uint64_t gl_date; double rescale_factor_ee; int32_t uninitialized; bool provided; @@ -2250,17 +2254,17 @@ qmckl_exit_code qmckl_provide_jastrow_champ_factor_ee(qmckl_context context) :END: #+NAME: qmckl_factor_ee_args - | Variable | Type | In/Out | Description | - |------------------------+----------------------------------------+--------+-----------------------------| - | ~context~ | ~qmckl_context~ | in | Global state | - | ~walk_num~ | ~int64_t~ | in | Number of walkers | - | ~elec_num~ | ~int64_t~ | in | Number of electrons | - | ~up_num~ | ~int64_t~ | in | Number of alpha electrons | - | ~bord_num~ | ~int64_t~ | in | Number of coefficients | - | ~b_vector~ | ~double[bord_num+1]~ | in | List of coefficients | - | ~ee_distance_rescaled~ | ~double[walk_num][elec_num][elec_num]~ | in | Electron-electron distances | - | ~asymp_jasb~ | ~double[2]~ | in | Electron-electron distances | - | ~factor_ee~ | ~double[walk_num]~ | out | Electron-electron distances | + | Variable | Type | In/Out | Description | + |------------------------+----------------------------------------+--------+---------------------------------| + | ~context~ | ~qmckl_context~ | in | Global state | + | ~walk_num~ | ~int64_t~ | in | Number of walkers | + | ~elec_num~ | ~int64_t~ | in | Number of electrons | + | ~up_num~ | ~int64_t~ | in | Number of alpha electrons | + | ~bord_num~ | ~int64_t~ | in | Number of coefficients | + | ~b_vector~ | ~double[bord_num+1]~ | in | List of coefficients | + | ~ee_distance_rescaled~ | ~double[walk_num][elec_num][elec_num]~ | in | Electron-electron distances | + | ~asymp_jasb~ | ~double[2]~ | in | Asymptotic value of the Jastrow | + | ~factor_ee~ | ~double[walk_num]~ | out | $f_{ee}$ | # #+CALL: generate_c_interface(table=qmckl_factor_ee_args,rettyp=get_value("CRetType"),fname=get_value("Name")) @@ -2373,7 +2377,6 @@ qmckl_exit_code qmckl_compute_factor_ee_doc ( double* const factor_ee ); #+end_src - #+begin_src c :comments org :tangle (eval h_private_func) :noweb yes :exports none qmckl_exit_code qmckl_compute_factor_ee_hpc ( const qmckl_context context, @@ -3029,7 +3032,6 @@ integer(c_int32_t) function qmckl_compute_factor_ee_deriv_e_doc & - **** Test #+begin_src python :results output :exports none :noweb yes import numpy as np @@ -4109,7 +4111,7 @@ qmckl_exit_code qmckl_provide_jastrow_champ_factor_en(qmckl_context context) **** Compute :PROPERTIES: - :Name: qmckl_compute_factor_en + :Name: qmckl_compute_factor_en_doc :CRetType: qmckl_exit_code :FRetType: qmckl_exit_code :END: @@ -4120,9 +4122,9 @@ qmckl_exit_code qmckl_provide_jastrow_champ_factor_en(qmckl_context context) | ~context~ | ~qmckl_context~ | in | Global state | | ~walk_num~ | ~int64_t~ | in | Number of walkers | | ~elec_num~ | ~int64_t~ | in | Number of electrons | - | ~nucl_num~ | ~int64_t~ | in | Number of nucleii | + | ~nucl_num~ | ~int64_t~ | in | Number of nuclei | | ~type_nucl_num~ | ~int64_t~ | in | Number of unique nuclei | - | ~type_nucl_vector~ | ~int64_t[nucl_num]~ | in | IDs of unique nucleii | + | ~type_nucl_vector~ | ~int64_t[nucl_num]~ | in | IDs of unique nuclei | | ~aord_num~ | ~int64_t~ | in | Number of coefficients | | ~a_vector~ | ~double[aord_num+1][type_nucl_num]~ | in | List of coefficients | | ~en_distance_rescaled~ | ~double[walk_num][nucl_num][elec_num]~ | in | Electron-nucleus distances | @@ -4130,7 +4132,7 @@ qmckl_exit_code qmckl_provide_jastrow_champ_factor_en(qmckl_context context) | ~factor_en~ | ~double[walk_num]~ | out | Electron-nucleus jastrow | #+begin_src f90 :comments org :tangle (eval f) :noweb yes -integer function qmckl_compute_factor_en_f( & +integer function qmckl_compute_factor_en_doc_f( & context, walk_num, elec_num, nucl_num, type_nucl_num, & type_nucl_vector, aord_num, a_vector, & en_distance_rescaled, asymp_jasa, factor_en) & @@ -4194,15 +4196,14 @@ integer function qmckl_compute_factor_en_f( & end do end do -end function qmckl_compute_factor_en_f +end function qmckl_compute_factor_en_doc_f #+end_src - #+CALL: generate_c_interface(table=qmckl_factor_en_args,rettyp=get_value("CRetType"),fname=get_value("Name")) #+RESULTS: #+begin_src f90 :tangle (eval f) :comments org :exports none - integer(c_int32_t) function qmckl_compute_factor_en & + integer(c_int32_t) function qmckl_compute_factor_en_doc & (context, & walk_num, & elec_num, & @@ -4231,8 +4232,8 @@ end function qmckl_compute_factor_en_f real (c_double ) , intent(in) :: asymp_jasa(type_nucl_num) real (c_double ) , intent(out) :: factor_en(walk_num) - integer(c_int32_t), external :: qmckl_compute_factor_en_f - info = qmckl_compute_factor_en_f & + integer(c_int32_t), external :: qmckl_compute_factor_en_doc_f + info = qmckl_compute_factor_en_doc_f & (context, & walk_num, & elec_num, & @@ -4245,7 +4246,7 @@ end function qmckl_compute_factor_en_f asymp_jasa, & factor_en) - end function qmckl_compute_factor_en + end function qmckl_compute_factor_en_doc #+end_src #+begin_src c :comments org :tangle (eval c) :noweb yes @@ -4340,7 +4341,20 @@ qmckl_exit_code qmckl_compute_factor_en ( #+RESULTS: #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code qmckl_compute_factor_en ( +qmckl_exit_code qmckl_compute_factor_en ( + const qmckl_context context, + const int64_t walk_num, + const int64_t elec_num, + const int64_t nucl_num, + const int64_t type_nucl_num, + const int64_t* type_nucl_vector, + const int64_t aord_num, + const double* a_vector, + const double* en_distance_rescaled, + const double* asymp_jasa, + double* const factor_en ); + +qmckl_exit_code qmckl_compute_factor_en_doc ( const qmckl_context context, const int64_t walk_num, const int64_t elec_num, @@ -4354,6 +4368,31 @@ qmckl_exit_code qmckl_compute_factor_en ( double* const factor_en ); #+end_src + #+begin_src c :tangle (eval c) :comments org +qmckl_exit_code qmckl_compute_factor_en ( + const qmckl_context context, + const int64_t walk_num, + const int64_t elec_num, + const int64_t nucl_num, + const int64_t type_nucl_num, + const int64_t* type_nucl_vector, + const int64_t aord_num, + const double* a_vector, + const double* en_distance_rescaled, + const double* asymp_jasa, + double* const factor_en ) +{ +#ifdef HAVE_HPC + return qmckl_compute_factor_en_doc (context, walk_num, elec_num, nucl_num, type_nucl_num, + type_nucl_vector, aord_num, a_vector, en_distance_rescaled, + asymp_jasa, factor_en ); +#else + return qmckl_compute_factor_en_doc (context, walk_num, elec_num, nucl_num, type_nucl_num, + type_nucl_vector, aord_num, a_vector, en_distance_rescaled, + asymp_jasa, factor_en ); +#endif +} + #+end_src **** Test #+begin_src python :results output :exports none :noweb yes import numpy as np @@ -4544,9 +4583,9 @@ qmckl_exit_code qmckl_provide_jastrow_champ_factor_en_deriv_e(qmckl_context cont | ~context~ | ~qmckl_context~ | in | Global state | | ~walk_num~ | ~int64_t~ | in | Number of walkers | | ~elec_num~ | ~int64_t~ | in | Number of electrons | - | ~nucl_num~ | ~int64_t~ | in | Number of nucleii | + | ~nucl_num~ | ~int64_t~ | in | Number of nuclei | | ~type_nucl_num~ | ~int64_t~ | in | Number of unique nuclei | - | ~type_nucl_vector~ | ~int64_t[nucl_num]~ | in | IDs of unique nucleii | + | ~type_nucl_vector~ | ~int64_t[nucl_num]~ | in | IDs of unique nuclei | | ~aord_num~ | ~int64_t~ | in | Number of coefficients | | ~a_vector~ | ~double[aord_num+1][type_nucl_num]~ | in | List of coefficients | | ~en_distance_rescaled~ | ~double[walk_num][nucl_num][elec_num]~ | in | Electron-nucleus distances | @@ -7900,7 +7939,7 @@ qmckl_exit_code qmckl_compute_lkpm_combined_index ( | ~context~ | ~qmckl_context~ | in | Global state | | ~cord_num~ | ~int64_t~ | in | Order of polynomials | | ~elec_num~ | ~int64_t~ | in | Number of electrons | - | ~nucl_num~ | ~int64_t~ | in | Number of nucleii | + | ~nucl_num~ | ~int64_t~ | in | Number of nuclei | | ~walk_num~ | ~int64_t~ | in | Number of walkers | | ~een_rescaled_e~ | ~double[walk_num][0:cord_num][elec_num][elec_num]~ | in | Electron-electron rescaled factor | | ~een_rescaled_n~ | ~double[walk_num][0:cord_num][nucl_num][elec_num]~ | in | Electron-nucleus rescaled factor | @@ -8173,7 +8212,7 @@ qmckl_exit_code qmckl_compute_tmp_c_hpc (const qmckl_context context, | ~context~ | ~qmckl_context~ | in | Global state | | ~cord_num~ | ~int64_t~ | in | Order of polynomials | | ~elec_num~ | ~int64_t~ | in | Number of electrons | - | ~nucl_num~ | ~int64_t~ | in | Number of nucleii | + | ~nucl_num~ | ~int64_t~ | in | Number of nuclei | | ~walk_num~ | ~int64_t~ | in | Number of walkers | | ~een_rescaled_e_deriv_e~ | ~double[walk_num][0:cord_num][elec_num][4][elec_num]~ | in | Electron-electron rescaled factor derivatives | | ~een_rescaled_n~ | ~double[walk_num][0:cord_num][nucl_num][elec_num]~ | in | Electron-nucleus rescaled factor | @@ -8653,11 +8692,11 @@ qmckl_exit_code qmckl_provide_factor_een(qmckl_context context) | ~context~ | ~qmckl_context~ | in | Global state | | ~walk_num~ | ~int64_t~ | in | Number of walkers | | ~elec_num~ | ~int64_t~ | in | Number of electrons | - | ~nucl_num~ | ~int64_t~ | in | Number of nucleii | + | ~nucl_num~ | ~int64_t~ | in | Number of nuclei | | ~cord_num~ | ~int64_t~ | in | order of polynomials | - | ~dim_c_vector~ | ~int64_t~ | in | dimension of full coefficient vector | - | ~c_vector_full~ | ~double[dim_c_vector][nucl_num]~ | in | full coefficient vector | - | ~lkpm_combined_index~ | ~int64_t[4][dim_c_vector]~ | in | combined indices | + | ~dim_c_vector~ | ~int64_t~ | in | dimension of full coefficient vector | + | ~c_vector_full~ | ~double[dim_c_vector][nucl_num]~ | in | full coefficient vector | + | ~lkpm_combined_index~ | ~int64_t[4][dim_c_vector]~ | in | combined indices | | ~een_rescaled_e~ | ~double[walk_num][elec_num][elec_num][0:cord_num]~ | in | Electron-nucleus rescaled | | ~een_rescaled_n~ | ~double[walk_num][elec_num][nucl_num][0:cord_num]~ | in | Electron-nucleus rescaled factor | | ~factor_een~ | ~double[walk_num]~ | out | Electron-nucleus jastrow | @@ -8809,28 +8848,28 @@ end function qmckl_compute_factor_een_naive_f **** Compute :PROPERTIES: - :Name: qmckl_compute_factor_een + :Name: qmckl_compute_factor_een_doc :CRetType: qmckl_exit_code :FRetType: qmckl_exit_code :END: #+NAME: qmckl_factor_een_args - | Variable | Type | In/Out | Description | - |-----------------------+------------------------------------------------------------------+---------------------------------+--------------------------------------| - | ~context~ | ~qmckl_context~ | in | Global state | - | ~walk_num~ | ~int64_t~ | in | Number of walkers | - | ~elec_num~ | ~int64_t~ | in | Number of electrons | - | ~nucl_num~ | ~int64_t~ | in | Number of nucleii | - | ~cord_num~ | ~int64_t~ | in | order of polynomials | - | ~dim_c_vector~ | ~int64_t~ | in | dimension of full coefficient vector | - | ~c_vector_full~ | ~double[dim_c_vector][nucl_num]~ | in | full coefficient vector | - | ~lkpm_combined_index~ | ~int64_t[4][dim_c_vector]~ | in | combined indices | - | ~tmp_c~ | ~double[walk_num][0:cord_num-1][0:cord_num][nucl_num][elec_num]~ | vector of non-zero coefficients | | - | ~een_rescaled_n~ | ~double[walk_num][0:cord_num][nucl_num][elec_num]~ | in | Electron-nucleus rescaled factor | - | ~factor_een~ | ~double[walk_num]~ | out | Electron-nucleus jastrow | + | Variable | Type | In/Out | Description | + |-----------------------+------------------------------------------------------------------+--------+--------------------------------------| + | ~context~ | ~qmckl_context~ | in | Global state | + | ~walk_num~ | ~int64_t~ | in | Number of walkers | + | ~elec_num~ | ~int64_t~ | in | Number of electrons | + | ~nucl_num~ | ~int64_t~ | in | Number of nuclei | + | ~cord_num~ | ~int64_t~ | in | order of polynomials | + | ~dim_c_vector~ | ~int64_t~ | in | dimension of full coefficient vector | + | ~c_vector_full~ | ~double[dim_c_vector][nucl_num]~ | in | full coefficient vector | + | ~lkpm_combined_index~ | ~int64_t[4][dim_c_vector]~ | in | combined indices | + | ~tmp_c~ | ~double[walk_num][0:cord_num-1][0:cord_num][nucl_num][elec_num]~ | in | vector of non-zero coefficients | + | ~een_rescaled_n~ | ~double[walk_num][0:cord_num][nucl_num][elec_num]~ | in | Electron-nucleus rescaled distances | + | ~factor_een~ | ~double[walk_num]~ | out | Electron-nucleus jastrow | #+begin_src f90 :comments org :tangle (eval f) :noweb yes -integer function qmckl_compute_factor_een_f( & +integer function qmckl_compute_factor_een_doc_f( & context, walk_num, elec_num, nucl_num, cord_num, & dim_c_vector, c_vector_full, lkpm_combined_index, & tmp_c, een_rescaled_n, factor_een) & @@ -8878,94 +8917,133 @@ integer function qmckl_compute_factor_een_f( & factor_een = 0.0d0 do nw =1, walk_num - do n = 1, dim_c_vector - l = lkpm_combined_index(n, 1) - k = lkpm_combined_index(n, 2) - p = lkpm_combined_index(n, 3) - m = lkpm_combined_index(n, 4) + do n = 1, dim_c_vector + l = lkpm_combined_index(n, 1) + k = lkpm_combined_index(n, 2) + p = lkpm_combined_index(n, 3) + m = lkpm_combined_index(n, 4) - do a = 1, nucl_num - cn = c_vector_full(a, n) - if(cn == 0.d0) cycle + do a = 1, nucl_num + cn = c_vector_full(a, n) + if(cn == 0.d0) cycle - accu = 0.0d0 - do j = 1, elec_num - accu = accu + een_rescaled_n(j,a,m,nw) * tmp_c(j,a,m+l,k,nw) - end do - factor_een(nw) = factor_een(nw) + accu * cn - end do - end do + accu = 0.0d0 + do j = 1, elec_num + accu = accu + een_rescaled_n(j,a,m,nw) * tmp_c(j,a,m+l,k,nw) + end do + factor_een(nw) = factor_een(nw) + accu * cn + end do + end do end do -end function qmckl_compute_factor_een_f +end function qmckl_compute_factor_een_doc_f #+end_src - # #+CALL: generate_c_header(table=qmckl_factor_een_args,rettyp=get_value("CRetType"),fname=get_value("Name")) +# #+CALL: generate_c_header(table=qmckl_factor_een_args,rettyp=qmckl_exit_code),fname=get_value("Name")) - #+begin_src c :comments org :tangle (eval h_private_func) :noweb yes :exports none - qmckl_exit_code qmckl_compute_factor_een ( - const qmckl_context context, - const int64_t walk_num, - const int64_t elec_num, - const int64_t nucl_num, - const int64_t cord_num, - const int64_t dim_c_vector, - const double* c_vector_full, - const int64_t* lkpm_combined_index, - const double* een_rescaled_e, - const double* een_rescaled_n, - double* const factor_een ); - #+end_src + #+begin_src c :comments org :tangle (eval h_private_func) :noweb yes :exports none +qmckl_exit_code +qmckl_compute_factor_een_doc (const qmckl_context context, + const int64_t walk_num, + const int64_t elec_num, + const int64_t nucl_num, + const int64_t cord_num, + const int64_t dim_c_vector, + const double* c_vector_full, + const int64_t* lkpm_combined_index, + const double* een_rescaled_e, + const double* een_rescaled_n, + double* const factor_een ); - #+CALL: generate_c_interface(table=qmckl_factor_een_args,rettyp=get_value("CRetType"),fname=get_value("Name")) +qmckl_exit_code +qmckl_compute_factor_een (const qmckl_context context, + const int64_t walk_num, + const int64_t elec_num, + const int64_t nucl_num, + const int64_t cord_num, + const int64_t dim_c_vector, + const double* c_vector_full, + const int64_t* lkpm_combined_index, + const double* een_rescaled_e, + const double* een_rescaled_n, + double* const factor_een ); + #+end_src - #+RESULTS: - #+begin_src f90 :tangle (eval f) :comments org :exports none - integer(c_int32_t) function qmckl_compute_factor_een & - (context, & - walk_num, & - elec_num, & - nucl_num, & - cord_num, & - dim_c_vector, & - c_vector_full, & - lkpm_combined_index, & - een_rescaled_e, & - een_rescaled_n, & - factor_een) & - bind(C) result(info) + #+begin_src c :comments org :tangle (eval c) :noweb yes :exports none +qmckl_exit_code +qmckl_compute_factor_een (const qmckl_context context, + const int64_t walk_num, + const int64_t elec_num, + const int64_t nucl_num, + const int64_t cord_num, + const int64_t dim_c_vector, + const double* c_vector_full, + const int64_t* lkpm_combined_index, + const double* een_rescaled_e, + const double* een_rescaled_n, + double* const factor_een ) +{ +#ifdef HAVE_HPC + return qmckl_compute_factor_een_doc (context, walk_num, elec_num, nucl_num, cord_num, dim_c_vector, + c_vector_full, lkpm_combined_index, een_rescaled_e, een_rescaled_n, + factor_een ); +#else + return qmckl_compute_factor_een_doc (context, walk_num, elec_num, nucl_num, cord_num, dim_c_vector, + c_vector_full, lkpm_combined_index, een_rescaled_e, een_rescaled_n, + factor_een ); +#endif +} + #+end_src + #+CALL: generate_c_interface(table=qmckl_factor_een_args,rettyp=get_value("CRetType"),fname="qmckl_compute_factor_een_doc")) - use, intrinsic :: iso_c_binding - implicit none + #+RESULTS: + #+begin_src f90 :tangle (eval f) :comments org :exports none + integer(c_int32_t) function qmckl_compute_factor_een_doc & + (context, & + walk_num, & + elec_num, & + nucl_num, & + cord_num, & + dim_c_vector, & + c_vector_full, & + lkpm_combined_index, & + tmp_c, & + een_rescaled_n, & + factor_een) & + bind(C) result(info) - integer (c_int64_t) , intent(in) , value :: context - integer (c_int64_t) , intent(in) , value :: walk_num - integer (c_int64_t) , intent(in) , value :: elec_num - integer (c_int64_t) , intent(in) , value :: nucl_num - integer (c_int64_t) , intent(in) , value :: cord_num - integer (c_int64_t) , intent(in) , value :: dim_c_vector - real (c_double ) , intent(in) :: c_vector_full(nucl_num,dim_c_vector) - integer (c_int64_t) , intent(in) :: lkpm_combined_index(dim_c_vector,4) - real (c_double ) , intent(in) :: een_rescaled_e(0:cord_num,elec_num,elec_num,walk_num) - real (c_double ) , intent(in) :: een_rescaled_n(elec_num,nucl_num,0:cord_num,walk_num) - real (c_double ) , intent(out) :: factor_een(walk_num) + use, intrinsic :: iso_c_binding + implicit none - integer(c_int32_t), external :: qmckl_compute_factor_een_f - info = qmckl_compute_factor_een_f & - (context, & - walk_num, & - elec_num, & - nucl_num, & - cord_num, & - dim_c_vector, & - c_vector_full, & - lkpm_combined_index, & - een_rescaled_e, & - een_rescaled_n, & - factor_een) + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: walk_num + integer (c_int64_t) , intent(in) , value :: elec_num + integer (c_int64_t) , intent(in) , value :: nucl_num + integer (c_int64_t) , intent(in) , value :: cord_num + integer (c_int64_t) , intent(in) , value :: dim_c_vector + real (c_double ) , intent(in) :: c_vector_full(nucl_num,dim_c_vector) + integer (c_int64_t) , intent(in) :: lkpm_combined_index(dim_c_vector,4) + real (c_double ) , intent(in) :: tmp_c(elec_num,nucl_num,0:cord_num,0:cord_num-1,walk_num) + real (c_double ) , intent(in) :: een_rescaled_n(elec_num,nucl_num,0:cord_num,walk_num) + real (c_double ) , intent(out) :: factor_een(walk_num) + + integer(c_int32_t), external :: qmckl_compute_factor_een_doc_f + info = qmckl_compute_factor_een_doc_f & + (context, & + walk_num, & + elec_num, & + nucl_num, & + cord_num, & + dim_c_vector, & + c_vector_full, & + lkpm_combined_index, & + tmp_c, & + een_rescaled_n, & + factor_een) + + end function qmckl_compute_factor_een_doc + #+end_src - end function qmckl_compute_factor_een - #+end_src **** Test #+begin_src python :results output :exports none :noweb yes @@ -9177,11 +9255,11 @@ qmckl_exit_code qmckl_provide_factor_een_deriv_e(qmckl_context context) | ~context~ | ~qmckl_context~ | in | Global state | | ~walk_num~ | ~int64_t~ | in | Number of walkers | | ~elec_num~ | ~int64_t~ | in | Number of electrons | - | ~nucl_num~ | ~int64_t~ | in | Number of nucleii | + | ~nucl_num~ | ~int64_t~ | in | Number of nuclei | | ~cord_num~ | ~int64_t~ | in | order of polynomials | - | ~dim_c_vector~ | ~int64_t~ | in | dimension of full coefficient vector | - | ~c_vector_full~ | ~double[dim_c_vector][nucl_num]~ | in | full coefficient vector | - | ~lkpm_combined_index~ | ~int64_t[4][dim_c_vector]~ | in | combined indices | + | ~dim_c_vector~ | ~int64_t~ | in | dimension of full coefficient vector | + | ~c_vector_full~ | ~double[dim_c_vector][nucl_num]~ | in | full coefficient vector | + | ~lkpm_combined_index~ | ~int64_t[4][dim_c_vector]~ | in | combined indices | | ~een_rescaled_e~ | ~double[walk_num][elec_num][elec_num][0:cord_num]~ | in | Electron-nucleus rescaled | | ~een_rescaled_n~ | ~double[walk_num][elec_num][nucl_num][0:cord_num]~ | in | Electron-nucleus rescaled factor | | ~een_rescaled_e_deriv_e~ | ~double[walk_num][elec_num][4][elec_num][0:cord_num]~ | in | Electron-nucleus rescaled | @@ -9374,11 +9452,11 @@ end function qmckl_compute_factor_een_deriv_e_naive_f | ~context~ | ~qmckl_context~ | in | Global state | | ~walk_num~ | ~int64_t~ | in | Number of walkers | | ~elec_num~ | ~int64_t~ | in | Number of electrons | - | ~nucl_num~ | ~int64_t~ | in | Number of nucleii | + | ~nucl_num~ | ~int64_t~ | in | Number of nuclei | | ~cord_num~ | ~int64_t~ | in | order of polynomials | - | ~dim_c_vector~ | ~int64_t~ | in | dimension of full coefficient vector | - | ~c_vector_full~ | ~double[dim_c_vector][nucl_num]~ | in | full coefficient vector | - | ~lkpm_combined_index~ | ~int64_t[4][dim_c_vector]~ | in | combined indices | + | ~dim_c_vector~ | ~int64_t~ | in | dimension of full coefficient vector | + | ~c_vector_full~ | ~double[dim_c_vector][nucl_num]~ | in | full coefficient vector | + | ~lkpm_combined_index~ | ~int64_t[4][dim_c_vector]~ | in | combined indices | | ~tmp_c~ | ~double[walk_num][0:cord_num-1][0:cord_num][nucl_num][elec_num]~ | in | Temporary intermediate tensor | | ~dtmp_c~ | ~double[walk_num][0:cord_num-1][0:cord_num][nucl_num][4][elec_num]~ | in | vector of non-zero coefficients | | ~een_rescaled_n~ | ~double[walk_num][0:cord_num][nucl_num][elec_num]~ | in | Electron-nucleus rescaled factor | @@ -9614,10 +9692,280 @@ rc = qmckl_get_jastrow_champ_factor_een_deriv_e(context, &(factor_een_deriv_e[0] assert(fabs(factor_een_deriv_e[0][0][0] + 0.0005481671107226865) < 1e-12); #+end_src -** Jastrow VGL functions - - Values, gradient and Laplacian of the total Jastrow factor. - +** Total Jastrow value + :PROPERTIES: + :Name: qmckl_compute_jastrow_champ_value_doc + :CRetType: qmckl_exit_code + :FRetType: qmckl_exit_code + :END: + + Value of the total Jastrow factor. + +*** Reference version + + #+NAME: qmckl_jastrow_champ_value_args + | Variable | Type | In/Out | Description | + |------------------------+------------------------------------------------------------------+--------+-----------------------------------------| + | ~context~ | ~qmckl_context~ | in | Global state | + | ~walk_num~ | ~int64_t~ | in | Number of walkers | + | ~elec_num~ | ~int64_t~ | in | Number of electrons | + | ~up_num~ | ~int64_t~ | in | Number of $\alpha$ electrons | + | ~nucl_num~ | ~int64_t~ | in | Number of nuclei | + | ~type_nucl_num~ | ~int64_t~ | in | Number of unique nuclei | + | ~type_nucl_vector~ | ~int64_t[nucl_num]~ | in | IDs of unique nuclei | + | ~dim_c_vector~ | ~int64_t~ | in | Dimension of full coefficient vector | + | ~aord_num~ | ~int64_t~ | in | Number of $a$ coefficients | + | ~bord_num~ | ~int64_t~ | in | Number of $b$ coefficients | + | ~cord_num~ | ~int64_t~ | in | Order of polynomials | + | ~a_vector~ | ~double[aord_num+1][type_nucl_num]~ | in | List of coefficients for $a$ parameters | + | ~b_vector~ | ~double[bord_num+1]~ | in | List of coefficients for $b$ parameters | + | ~c_vector_full~ | ~double[dim_c_vector][nucl_num]~ | in | Full coefficient vector | + | ~lkpm_combined_index~ | ~int64_t[4][dim_c_vector]~ | in | Combined indices | + | ~tmp_c~ | ~double[walk_num][0:cord_num-1][0:cord_num][nucl_num][elec_num]~ | in | Vector of non-zero coefficients | + | ~ee_distance_rescaled~ | ~double[walk_num][elec_num][elec_num]~ | in | Electron-electron distances | + | ~en_distance_rescaled~ | ~double[walk_num][nucl_num][elec_num]~ | in | Electron-nucleus distances | + | ~een_rescaled_n~ | ~double[walk_num][0:cord_num][nucl_num][elec_num]~ | in | Electron-nucleus rescaled distances | + | ~asymp_jasa~ | ~double[type_nucl_num]~ | in | Type of nuclei | + | ~asymp_jasb~ | ~double[2]~ | in | Asymptotic value of the Jastrow | + | ~factor_ee~ | ~double[walk_num]~ | out | $f_{ee}$ | + + #+begin_src f90 :comments org :tangle (eval f) :noweb yes +integer function qmckl_compute_jastrow_champ_value_doc_f(context, & + walk_num, elec_num, up_num, nucl_num, type_nucl_num, type_nucl_vector, & + dim_c_vector, aord_num, bord_num, cord_num, a_vector, b_vector, & + c_vector_full, lkpm_combined_index, tmp_c, ee_distance_rescaled, & + en_distance_rescaled, een_rescaled_n, asymp_jasa, asymp_jasb, & + val) & + result(info) + use qmckl + implicit none + + integer(qmckl_context), intent(in) :: context + integer*8 , intent(in) :: walk_num, elec_num, up_num, nucl_num + integer*8 , intent(in) :: type_nucl_num, dim_c_vector + integer*8 , intent(in) :: type_nucl_vector(nucl_num) + integer*8 , intent(in) :: aord_num, bord_num, cord_num + double precision , intent(in) :: a_vector(type_nucl_num, aord_num + 1) + double precision , intent(in) :: b_vector(bord_num + 1) + double precision , intent(in) :: c_vector_full(nucl_num, dim_c_vector) + integer*8 , intent(in) :: lkpm_combined_index(dim_c_vector,4) + double precision , intent(in) :: tmp_c(elec_num, nucl_num,0:cord_num, 0:cord_num-1, walk_num) + double precision , intent(in) :: ee_distance_rescaled(elec_num, elec_num, walk_num) + double precision , intent(in) :: en_distance_rescaled(elec_num, nucl_num, walk_num) + double precision , intent(in) :: een_rescaled_n(elec_num, nucl_num, 0:cord_num, walk_num) + double precision , intent(in) :: asymp_jasa(type_nucl_num), asymp_jasb(2) + double precision , intent(out) :: val(walk_num) + + integer :: iwalk + double precision, allocatable :: v(:), gl(:,:,:) + + integer, external :: qmckl_compute_factor_ee_doc_f + integer, external :: qmckl_compute_factor_en_doc_f + integer, external :: qmckl_compute_factor_een_doc_f + + allocate(v(walk_num)) + + info = qmckl_compute_factor_ee_doc_f(context, walk_num, elec_num, up_num, bord_num, & + b_vector, ee_distance_rescaled, asymp_jasb, val) + if (info /= QMCKL_SUCCESS) return + + info = qmckl_compute_factor_en_doc_f(context, walk_num, elec_num, nucl_num, type_nucl_num, & + type_nucl_vector, aord_num, a_vector, en_distance_rescaled, asymp_jasa, v) + if (info /= QMCKL_SUCCESS) return + + val(1:walk_num) = val(1:walk_num) + v(1:walk_num) + + info = qmckl_compute_factor_een_doc_f(context, walk_num, elec_num, nucl_num, cord_num, & + dim_c_vector, c_vector_full, lkpm_combined_index, tmp_c, een_rescaled_n, v) + if (info /= QMCKL_SUCCESS) return + + val(1:walk_num) = val(1:walk_num) + v(1:walk_num) + + deallocate(v,gl) +end function qmckl_compute_jastrow_champ_value_doc_f + #+end_src + + #+CALL: generate_private_c_header(table=qmckl_jastrow_champ_value_args,rettyp="qmckl_exit_code",fname="qmckl_compute_jastrow_champ_value_doc") + + #+RESULTS: + #+begin_src c :tangle (eval h_private_func) :comments org + qmckl_exit_code qmckl_compute_jastrow_champ_value_doc ( + const qmckl_context context, + const int64_t walk_num, + const int64_t elec_num, + const int64_t up_num, + const int64_t nucl_num, + const int64_t type_nucl_num, + const int64_t* type_nucl_vector, + const int64_t dim_c_vector, + const int64_t aord_num, + const int64_t bord_num, + const int64_t cord_num, + const double* a_vector, + const double* b_vector, + const double* c_vector_full, + const int64_t* lkpm_combined_index, + const double* tmp_c, + const double* ee_distance_rescaled, + const double* en_distance_rescaled, + const double* een_rescaled_n, + const double* asymp_jasa, + const double* asymp_jasb, + double* const factor_ee ); + #+end_src + + #+CALL: generate_private_c_header(table=qmckl_jastrow_champ_value_args,rettyp="qmckl_exit_code",fname="qmckl_compute_jastrow_champ_value") + + #+RESULTS: + #+begin_src c :tangle (eval h_private_func) :comments org + qmckl_exit_code qmckl_compute_jastrow_champ_value ( + const qmckl_context context, + const int64_t walk_num, + const int64_t elec_num, + const int64_t up_num, + const int64_t nucl_num, + const int64_t type_nucl_num, + const int64_t* type_nucl_vector, + const int64_t dim_c_vector, + const int64_t aord_num, + const int64_t bord_num, + const int64_t cord_num, + const double* a_vector, + const double* b_vector, + const double* c_vector_full, + const int64_t* lkpm_combined_index, + const double* tmp_c, + const double* ee_distance_rescaled, + const double* en_distance_rescaled, + const double* een_rescaled_n, + const double* asymp_jasa, + const double* asymp_jasb, + double* const factor_ee ); + #+end_src + + #+CALL: generate_c_interface(table=qmckl_jastrow_champ_value_args,rettyp=get_value("CRetType"),fname=get_value("Name")) + + #+RESULTS: + #+begin_src f90 :tangle (eval f) :comments org :exports none + integer(c_int32_t) function qmckl_compute_jastrow_champ_value_doc & + (context, & + walk_num, & + elec_num, & + up_num, & + nucl_num, & + type_nucl_num, & + type_nucl_vector, & + dim_c_vector, & + aord_num, & + bord_num, & + cord_num, & + a_vector, & + b_vector, & + c_vector_full, & + lkpm_combined_index, & + tmp_c, & + ee_distance_rescaled, & + en_distance_rescaled, & + een_rescaled_n, & + asymp_jasa, & + asymp_jasb, & + factor_ee) & + bind(C) result(info) + + use, intrinsic :: iso_c_binding + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: walk_num + integer (c_int64_t) , intent(in) , value :: elec_num + integer (c_int64_t) , intent(in) , value :: up_num + integer (c_int64_t) , intent(in) , value :: nucl_num + integer (c_int64_t) , intent(in) , value :: type_nucl_num + integer (c_int64_t) , intent(in) :: type_nucl_vector(nucl_num) + integer (c_int64_t) , intent(in) , value :: dim_c_vector + integer (c_int64_t) , intent(in) , value :: aord_num + integer (c_int64_t) , intent(in) , value :: bord_num + integer (c_int64_t) , intent(in) , value :: cord_num + real (c_double ) , intent(in) :: a_vector(type_nucl_num,aord_num+1) + real (c_double ) , intent(in) :: b_vector(bord_num+1) + real (c_double ) , intent(in) :: c_vector_full(nucl_num,dim_c_vector) + integer (c_int64_t) , intent(in) :: lkpm_combined_index(dim_c_vector,4) + real (c_double ) , intent(in) :: tmp_c(elec_num,nucl_num,0:cord_num,0:cord_num-1,walk_num) + real (c_double ) , intent(in) :: ee_distance_rescaled(elec_num,elec_num,walk_num) + real (c_double ) , intent(in) :: en_distance_rescaled(elec_num,nucl_num,walk_num) + real (c_double ) , intent(in) :: een_rescaled_n(elec_num,nucl_num,0:cord_num,walk_num) + real (c_double ) , intent(in) :: asymp_jasa(type_nucl_num) + real (c_double ) , intent(in) :: asymp_jasb(2) + real (c_double ) , intent(out) :: factor_ee(walk_num) + + integer(c_int32_t), external :: qmckl_compute_jastrow_champ_value_doc_f + info = qmckl_compute_jastrow_champ_value_doc_f & + (context, & + walk_num, & + elec_num, & + up_num, & + nucl_num, & + type_nucl_num, & + type_nucl_vector, & + dim_c_vector, & + aord_num, & + bord_num, & + cord_num, & + a_vector, & + b_vector, & + c_vector_full, & + lkpm_combined_index, & + tmp_c, & + ee_distance_rescaled, & + en_distance_rescaled, & + een_rescaled_n, & + asymp_jasa, & + asymp_jasb, & + factor_ee) + + end function qmckl_compute_jastrow_champ_value_doc + #+end_src + + #+begin_src c :tangle (eval c) :comments org +qmckl_exit_code qmckl_compute_jastrow_champ_value ( + const qmckl_context context, + const int64_t walk_num, + const int64_t elec_num, + const int64_t up_num, + const int64_t nucl_num, + const int64_t type_nucl_num, + const int64_t* type_nucl_vector, + const int64_t dim_c_vector, + const int64_t aord_num, + const int64_t bord_num, + const int64_t cord_num, + const double* a_vector, + const double* b_vector, + const double* c_vector_full, + const int64_t* lkpm_combined_index, + const double* tmp_c, + const double* ee_distance_rescaled, + const double* en_distance_rescaled, + const double* een_rescaled_n, + const double* asymp_jasa, + const double* asymp_jasb, + double* const val) +{ +#ifdef HAVE_HPC + return qmckl_compute_jastrow_champ_value_doc (context, walk_num, elec_num, up_num, nucl_num, + type_nucl_num, type_nucl_vector, dim_c_vector, aord_num, bord_num, + cord_num, a_vector, b_vector, c_vector_full, lkpm_combined_index, + tmp_c, ee_distance_rescaled, en_distance_rescaled, een_rescaled_n, + asymp_jasa, asymp_jasb, val); +#else + return qmckl_compute_jastrow_champ_value_doc (context, walk_num, elec_num, up_num, nucl_num, + type_nucl_num, type_nucl_vector, dim_c_vector, aord_num, bord_num, + cord_num, a_vector, b_vector, c_vector_full, lkpm_combined_index, + tmp_c, ee_distance_rescaled, en_distance_rescaled, een_rescaled_n, + asymp_jasa, asymp_jasb, val); +#endif +} + #+end_src * End of files :noexport: #+begin_src c :tangle (eval h_private_type)