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

reorder indices for een_rescaled_e.

This commit is contained in:
v1j4y 2022-02-11 16:19:31 +01:00
parent 6e4b7f6722
commit a7ec3585a7

View File

@ -2946,11 +2946,11 @@ assert(fabs(factor_en_deriv_e[0][3][0]+0.9667363412285741 ) < 1.e-12);
*** Get *** Get
#+begin_src c :comments org :tangle (eval h_func) :noweb yes #+begin_src c :comments org :tangle (eval h_func) :noweb yes
qmckl_exit_code qmckl_get_jastrow_een_rescaled_e(qmckl_context context, double* const distance_rescaled); qmckl_exit_code qmckl_get_jastrow_een_rescaled_e(qmckl_context context, double* const distance_rescaled, int64_t* size_max);
#+end_src #+end_src
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none #+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
qmckl_exit_code qmckl_get_jastrow_een_rescaled_e(qmckl_context context, double* const distance_rescaled) qmckl_exit_code qmckl_get_jastrow_een_rescaled_e(qmckl_context context, double* const distance_rescaled, int64_t* size_max)
{ {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return QMCKL_NULL_CONTEXT; return QMCKL_NULL_CONTEXT;
@ -2966,6 +2966,7 @@ qmckl_exit_code qmckl_get_jastrow_een_rescaled_e(qmckl_context context, double*
size_t sze = ctx->electron.num * ctx->electron.num * ctx->electron.walk_num * (ctx->jastrow.cord_num + 1); size_t sze = ctx->electron.num * ctx->electron.num * ctx->electron.walk_num * (ctx->jastrow.cord_num + 1);
memcpy(distance_rescaled, ctx->jastrow.een_rescaled_e, sze * sizeof(double)); memcpy(distance_rescaled, ctx->jastrow.een_rescaled_e, sze * sizeof(double));
(*size_max) = sze;
return QMCKL_SUCCESS; return QMCKL_SUCCESS;
} }
@ -3047,7 +3048,7 @@ qmckl_exit_code qmckl_provide_een_rescaled_e(qmckl_context context)
| ~cord_num~ | ~int64_t~ | in | Order of polynomials | | ~cord_num~ | ~int64_t~ | in | Order of polynomials |
| ~rescale_factor_kappa_ee~ | ~double~ | in | Factor to rescale ee distances | | ~rescale_factor_kappa_ee~ | ~double~ | in | Factor to rescale ee distances |
| ~ee_distance~ | ~double[walk_num][elec_num][elec_num]~ | in | Electron-electron distances | | ~ee_distance~ | ~double[walk_num][elec_num][elec_num]~ | in | Electron-electron distances |
| ~een_rescaled_e~ | ~double[walk_num][elec_num][elec_num][0:cord_num]~ | out | Electron-electron rescaled distances | | ~een_rescaled_e~ | ~double[walk_num][0:cord_num][elec_num][elec_num]~ | out | Electron-electron rescaled distances |
#+begin_src f90 :comments org :tangle (eval f) :noweb yes #+begin_src f90 :comments org :tangle (eval f) :noweb yes
integer function qmckl_compute_een_rescaled_e_f(context, walk_num, elec_num, cord_num, rescale_factor_kappa_ee, & integer function qmckl_compute_een_rescaled_e_f(context, walk_num, elec_num, cord_num, rescale_factor_kappa_ee, &
@ -3061,7 +3062,7 @@ integer function qmckl_compute_een_rescaled_e_f(context, walk_num, elec_num, cor
integer*8 , intent(in) :: cord_num integer*8 , intent(in) :: cord_num
double precision , intent(in) :: rescale_factor_kappa_ee double precision , intent(in) :: rescale_factor_kappa_ee
double precision , intent(in) :: ee_distance(elec_num,elec_num,walk_num) double precision , intent(in) :: ee_distance(elec_num,elec_num,walk_num)
double precision , intent(out) :: een_rescaled_e(0:cord_num,elec_num,elec_num,walk_num) double precision , intent(out) :: een_rescaled_e(elec_num,elec_num,0:cord_num,walk_num)
double precision,dimension(:,:),allocatable :: een_rescaled_e_ij double precision,dimension(:,:),allocatable :: een_rescaled_e_ij
double precision :: x double precision :: x
integer*8 :: i, j, k, l, nw integer*8 :: i, j, k, l, nw
@ -3112,22 +3113,22 @@ integer function qmckl_compute_een_rescaled_e_f(context, walk_num, elec_num, cor
end do end do
! prepare the actual een table ! prepare the actual een table
een_rescaled_e(0, :, :, nw) = 1.0d0 een_rescaled_e(:, :, 0, nw) = 1.0d0
do l = 1, cord_num do l = 1, cord_num
k = 0 k = 0
do j = 1, elec_num do j = 1, elec_num
do i = 1, j - 1 do i = 1, j - 1
k = k + 1 k = k + 1
x = een_rescaled_e_ij(k, l + 1) x = een_rescaled_e_ij(k, l + 1)
een_rescaled_e(l, i, j, nw) = x een_rescaled_e(i, j, l, nw) = x
een_rescaled_e(l, j, i, nw) = x een_rescaled_e(j, i, l, nw) = x
end do end do
end do end do
end do end do
do l = 0, cord_num do l = 0, cord_num
do j = 1, elec_num do j = 1, elec_num
een_rescaled_e(l, j, j, nw) = 0.0d0 een_rescaled_e(j, j, l, nw) = 0.0d0
end do end do
end do end do
@ -3167,7 +3168,7 @@ end function qmckl_compute_een_rescaled_e_f
integer (c_int64_t) , intent(in) , value :: cord_num integer (c_int64_t) , intent(in) , value :: cord_num
real (c_double ) , intent(in) , value :: rescale_factor_kappa_ee real (c_double ) , intent(in) , value :: rescale_factor_kappa_ee
real (c_double ) , intent(in) :: ee_distance(elec_num,elec_num,walk_num) real (c_double ) , intent(in) :: ee_distance(elec_num,elec_num,walk_num)
real (c_double ) , intent(out) :: een_rescaled_e(0:cord_num,elec_num,elec_num,walk_num) real (c_double ) , intent(out) :: een_rescaled_e(elec_num,elec_num,0:cord_num,walk_num)
integer(c_int32_t), external :: qmckl_compute_een_rescaled_e_f integer(c_int32_t), external :: qmckl_compute_een_rescaled_e_f
info = qmckl_compute_een_rescaled_e_f & info = qmckl_compute_een_rescaled_e_f &
@ -3240,16 +3241,17 @@ print(" een_rescaled_e[1, 5, 2] = ",een_rescaled_e[1, 5, 2])
assert(qmckl_electron_provided(context)); assert(qmckl_electron_provided(context));
double een_rescaled_e[walk_num][elec_num][elec_num][(cord_num + 1)]; double een_rescaled_e[walk_num][(cord_num + 1)][elec_num][elec_num];
rc = qmckl_get_jastrow_een_rescaled_e(context, &(een_rescaled_e[0][0][0][0])); size_max=0;
rc = qmckl_get_jastrow_een_rescaled_e(context, &(een_rescaled_e[0][0][0][0]),&size_max);
// value of (0,2,1) // value of (0,2,1)
assert(fabs(een_rescaled_e[0][0][2][1]-0.08084493981483197) < 1.e-12); assert(fabs(een_rescaled_e[0][1][0][2]-0.08084493981483197) < 1.e-12);
assert(fabs(een_rescaled_e[0][0][3][1]-0.1066745707571846) < 1.e-12); assert(fabs(een_rescaled_e[0][1][0][3]-0.1066745707571846) < 1.e-12);
assert(fabs(een_rescaled_e[0][0][4][1]-0.01754273169464735) < 1.e-12); assert(fabs(een_rescaled_e[0][1][0][4]-0.01754273169464735) < 1.e-12);
assert(fabs(een_rescaled_e[0][1][3][2]-0.02214680362033448) < 1.e-12); assert(fabs(een_rescaled_e[0][2][1][3]-0.02214680362033448) < 1.e-12);
assert(fabs(een_rescaled_e[0][1][4][2]-0.0005700154999202759) < 1.e-12); assert(fabs(een_rescaled_e[0][2][1][4]-0.0005700154999202759) < 1.e-12);
assert(fabs(een_rescaled_e[0][1][5][2]-0.3424402276009091) < 1.e-12); assert(fabs(een_rescaled_e[0][2][1][5]-0.3424402276009091) < 1.e-12);
#+end_src #+end_src
@ -3370,7 +3372,7 @@ qmckl_exit_code qmckl_provide_een_rescaled_e_deriv_e(qmckl_context context)
| ~rescale_factor_kappa_ee~ | ~double~ | in | Factor to rescale ee distances | | ~rescale_factor_kappa_ee~ | ~double~ | in | Factor to rescale ee distances |
| ~coord_new~ | ~double[walk_num][3][elec_num]~ | in | Electron coordinates | | ~coord_new~ | ~double[walk_num][3][elec_num]~ | in | Electron coordinates |
| ~ee_distance~ | ~double[walk_num][elec_num][elec_num]~ | in | Electron-electron distances | | ~ee_distance~ | ~double[walk_num][elec_num][elec_num]~ | in | Electron-electron distances |
| ~een_rescaled_e~ | ~double[walk_num][elec_num][elec_num][0:cord_num]~ | in | Electron-electron distances | | ~een_rescaled_e~ | ~double[walk_num][0:cord_num][elec_num][elec_num]~ | in | Electron-electron distances |
| ~een_rescaled_e_deriv_e~ | ~double[walk_num][elec_num][4][elec_num][0:cord_num]~ | out | Electron-electron rescaled distances | | ~een_rescaled_e_deriv_e~ | ~double[walk_num][elec_num][4][elec_num][0:cord_num]~ | out | Electron-electron rescaled distances |
#+begin_src f90 :comments org :tangle (eval f) :noweb yes #+begin_src f90 :comments org :tangle (eval f) :noweb yes
@ -3386,7 +3388,7 @@ integer function qmckl_compute_factor_een_rescaled_e_deriv_e_f(context, walk_num
double precision , intent(in) :: rescale_factor_kappa_ee double precision , intent(in) :: rescale_factor_kappa_ee
double precision , intent(in) :: coord_new(elec_num,3,walk_num) double precision , intent(in) :: coord_new(elec_num,3,walk_num)
double precision , intent(in) :: ee_distance(elec_num,elec_num,walk_num) double precision , intent(in) :: ee_distance(elec_num,elec_num,walk_num)
double precision , intent(in) :: een_rescaled_e(0:cord_num,elec_num,elec_num,walk_num) double precision , intent(in) :: een_rescaled_e(elec_num,elec_num,0:cord_num,walk_num)
double precision , intent(out) :: een_rescaled_e_deriv_e(0:cord_num,elec_num,4,elec_num,walk_num) double precision , intent(out) :: een_rescaled_e_deriv_e(0:cord_num,elec_num,4,elec_num,walk_num)
double precision,dimension(:,:,:),allocatable :: elec_dist_deriv_e double precision,dimension(:,:,:),allocatable :: elec_dist_deriv_e
double precision :: x, rij_inv, kappa_l double precision :: x, rij_inv, kappa_l
@ -3446,7 +3448,7 @@ integer function qmckl_compute_factor_een_rescaled_e_deriv_e_f(context, walk_num
do ii = 1, 4 do ii = 1, 4
een_rescaled_e_deriv_e(l, i, ii, j, nw) = een_rescaled_e_deriv_e(l, i, ii, j, nw) * & een_rescaled_e_deriv_e(l, i, ii, j, nw) = een_rescaled_e_deriv_e(l, i, ii, j, nw) * &
een_rescaled_e(l, i, j, nw) een_rescaled_e(i, j, l, nw)
end do end do
end do end do
end do end do
@ -3499,7 +3501,7 @@ end function qmckl_compute_factor_een_rescaled_e_deriv_e_f
real (c_double ) , intent(in) , value :: rescale_factor_kappa_ee real (c_double ) , intent(in) , value :: rescale_factor_kappa_ee
real (c_double ) , intent(in) :: coord_new(elec_num,3,walk_num) real (c_double ) , intent(in) :: coord_new(elec_num,3,walk_num)
real (c_double ) , intent(in) :: ee_distance(elec_num,elec_num,walk_num) real (c_double ) , intent(in) :: ee_distance(elec_num,elec_num,walk_num)
real (c_double ) , intent(in) :: een_rescaled_e(0:cord_num,elec_num,elec_num,walk_num) real (c_double ) , intent(in) :: een_rescaled_e(elec_num,elec_num,0:cord_num,walk_num)
real (c_double ) , intent(out) :: een_rescaled_e_deriv_e(0:cord_num,elec_num,4,elec_num,walk_num) real (c_double ) , intent(out) :: een_rescaled_e_deriv_e(0:cord_num,elec_num,4,elec_num,walk_num)
integer(c_int32_t), external :: qmckl_compute_factor_een_rescaled_e_deriv_e_f integer(c_int32_t), external :: qmckl_compute_factor_een_rescaled_e_deriv_e_f
@ -4976,7 +4978,7 @@ end function qmckl_compute_lkpm_combined_index_f
| ~elec_num~ | ~int64_t~ | in | Number of electrons | | ~elec_num~ | ~int64_t~ | in | Number of electrons |
| ~nucl_num~ | ~int64_t~ | in | Number of nucleii | | ~nucl_num~ | ~int64_t~ | in | Number of nucleii |
| ~walk_num~ | ~int64_t~ | in | Number of walkers | | ~walk_num~ | ~int64_t~ | in | Number of walkers |
| ~een_rescaled_e~ | ~double[walk_num][elec_num][elec_num][0:cord_num]~ | in | Electron-electron rescaled factor | | ~een_rescaled_e~ | ~double[walk_num][0:cord_num][elec_num][elec_num]~ | in | Electron-electron rescaled factor |
| ~een_rescaled_n~ | ~double[walk_num][elec_num][nucl_num][0:cord_num]~ | in | Electron-nucleus rescaled factor | | ~een_rescaled_n~ | ~double[walk_num][elec_num][nucl_num][0:cord_num]~ | in | Electron-nucleus rescaled factor |
| ~tmp_c~ | ~double[walk_num][0:cord_num-1][0:cord_num][nucl_num][elec_num]~ | out | vector of non-zero coefficients | | ~tmp_c~ | ~double[walk_num][0:cord_num-1][0:cord_num][nucl_num][elec_num]~ | out | vector of non-zero coefficients |
@ -4991,7 +4993,7 @@ integer function qmckl_compute_tmp_c_f(context, cord_num, elec_num, nucl_num, &
integer*8 , intent(in) :: elec_num integer*8 , intent(in) :: elec_num
integer*8 , intent(in) :: nucl_num integer*8 , intent(in) :: nucl_num
integer*8 , intent(in) :: walk_num integer*8 , intent(in) :: walk_num
double precision , intent(in) :: een_rescaled_e(0:cord_num, elec_num, elec_num, walk_num) double precision , intent(in) :: een_rescaled_e(elec_num, elec_num, 0:cord_num, walk_num)
double precision , intent(in) :: een_rescaled_n(0:cord_num, nucl_num, elec_num, walk_num) double precision , intent(in) :: een_rescaled_n(0:cord_num, nucl_num, elec_num, walk_num)
double precision , intent(out) :: tmp_c(elec_num, nucl_num,0:cord_num, 0:cord_num-1, walk_num) double precision , intent(out) :: tmp_c(elec_num, nucl_num,0:cord_num, 0:cord_num-1, walk_num)
double precision :: x double precision :: x
@ -5007,17 +5009,17 @@ integer function qmckl_compute_tmp_c_f(context, cord_num, elec_num, nucl_num, &
alpha = 1.0d0 alpha = 1.0d0
beta = 0.0d0 beta = 0.0d0
allocate(een_rescaled_e_T(elec_num,elec_num,0:cord_num,walk_num)) !allocate(een_rescaled_e_T(elec_num,elec_num,0:cord_num,walk_num))
allocate(een_rescaled_n_T(elec_num,nucl_num,0:cord_num,walk_num)) allocate(een_rescaled_n_T(elec_num,nucl_num,0:cord_num,walk_num))
do nw = 1,walk_num !do nw = 1,walk_num
do i = 1, elec_num !do i = 1, elec_num
do j = 1, elec_num ! do j = 1, elec_num
do l = 0,cord_num ! do l = 0,cord_num
een_rescaled_e_T(i,j,l,nw) = een_rescaled_e(l,j,i,nw) ! een_rescaled_e_T(i,j,l,nw) = een_rescaled_e(l,j,i,nw)
end do ! end do
end do ! end do
end do !end do
end do !end do
do nw = 1,walk_num do nw = 1,walk_num
do i = 1, elec_num do i = 1, elec_num
do j = 1, nucl_num do j = 1, nucl_num
@ -5053,14 +5055,14 @@ integer function qmckl_compute_tmp_c_f(context, cord_num, elec_num, nucl_num, &
M = elec_num M = elec_num
N = nucl_num*(cord_num + 1) N = nucl_num*(cord_num + 1)
K = elec_num K = elec_num
LDA = size(een_rescaled_e_T,1) LDA = size(een_rescaled_e,1)
LDB = size(een_rescaled_n_T,1) LDB = size(een_rescaled_n_T,1)
LDC = size(tmp_c,1) LDC = size(tmp_c,1)
do nw=1, walk_num do nw=1, walk_num
do i=0, cord_num-1 do i=0, cord_num-1
info = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, & info = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, &
een_rescaled_e_T(1,1,i,nw),LDA*1_8, & een_rescaled_e(1,1,i,nw),LDA*1_8, &
een_rescaled_n_T(1,1,0,nw),LDB*1_8, & een_rescaled_n_T(1,1,0,nw),LDB*1_8, &
beta, & beta, &
tmp_c(1,1,0,i,nw),LDC) tmp_c(1,1,0,i,nw),LDC)
@ -5074,7 +5076,7 @@ integer function qmckl_compute_tmp_c_f(context, cord_num, elec_num, nucl_num, &
!end do !end do
!end do !end do
deallocate(een_rescaled_e_T) !deallocate(een_rescaled_e_T)
deallocate(een_rescaled_n_T) deallocate(een_rescaled_n_T)
end function qmckl_compute_tmp_c_f end function qmckl_compute_tmp_c_f
#+end_src #+end_src
@ -5111,7 +5113,7 @@ end function qmckl_compute_tmp_c_f
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 :: nucl_num integer (c_int64_t) , intent(in) , value :: nucl_num
integer (c_int64_t) , intent(in) , value :: walk_num integer (c_int64_t) , intent(in) , value :: walk_num
real (c_double ) , intent(in) :: een_rescaled_e(0:cord_num,elec_num,elec_num,walk_num) real (c_double ) , intent(in) :: een_rescaled_e(elec_num,elec_num,0:cord_num,walk_num)
real (c_double ) , intent(in) :: een_rescaled_n(0:cord_num,nucl_num,elec_num,walk_num) real (c_double ) , intent(in) :: een_rescaled_n(0:cord_num,nucl_num,elec_num,walk_num)
real (c_double ) , intent(out) :: tmp_c(elec_num,nucl_num,0:cord_num,0:cord_num-1,walk_num) real (c_double ) , intent(out) :: tmp_c(elec_num,nucl_num,0:cord_num,0:cord_num-1,walk_num)