mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-08-16 18:38:28 +02:00
Fixed een_rescaled_e_deriv_d.
This commit is contained in:
parent
a7ec3585a7
commit
cf005084f1
@ -3178,7 +3178,7 @@ end function qmckl_compute_een_rescaled_e_f
|
||||
#+end_src
|
||||
|
||||
*** Test
|
||||
|
||||
|
||||
#+begin_src python :results output :exports none :noweb yes
|
||||
import numpy as np
|
||||
|
||||
@ -3268,11 +3268,11 @@ assert(fabs(een_rescaled_e[0][2][1][5]-0.3424402276009091) < 1.e-12);
|
||||
*** Get
|
||||
|
||||
#+begin_src c :comments org :tangle (eval h_func) :noweb yes
|
||||
qmckl_exit_code qmckl_get_jastrow_een_rescaled_e_deriv_e(qmckl_context context, double* const distance_rescaled);
|
||||
qmckl_exit_code qmckl_get_jastrow_een_rescaled_e_deriv_e(qmckl_context context, double* const distance_rescaled, int64_t* size_max);
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
|
||||
qmckl_exit_code qmckl_get_jastrow_een_rescaled_e_deriv_e(qmckl_context context, double* const distance_rescaled)
|
||||
qmckl_exit_code qmckl_get_jastrow_een_rescaled_e_deriv_e(qmckl_context context, double* const distance_rescaled, int64_t* size_max)
|
||||
{
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return QMCKL_NULL_CONTEXT;
|
||||
@ -3288,6 +3288,7 @@ qmckl_exit_code qmckl_get_jastrow_een_rescaled_e_deriv_e(qmckl_context context,
|
||||
|
||||
size_t sze = ctx->electron.num * 4 * ctx->electron.num * ctx->electron.walk_num * (ctx->jastrow.cord_num + 1);
|
||||
memcpy(distance_rescaled, ctx->jastrow.een_rescaled_e_deriv_e, sze * sizeof(double));
|
||||
(*size_max) = sze;
|
||||
|
||||
return QMCKL_SUCCESS;
|
||||
}
|
||||
@ -3373,7 +3374,7 @@ qmckl_exit_code qmckl_provide_een_rescaled_e_deriv_e(qmckl_context context)
|
||||
| ~coord_new~ | ~double[walk_num][3][elec_num]~ | in | Electron coordinates |
|
||||
| ~ee_distance~ | ~double[walk_num][elec_num][elec_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][0:cord_num][elec_num][4][elec_num]~ | out | Electron-electron rescaled distances |
|
||||
|
||||
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
|
||||
integer function qmckl_compute_factor_een_rescaled_e_deriv_e_f(context, walk_num, elec_num, cord_num, rescale_factor_kappa_ee, &
|
||||
@ -3389,7 +3390,7 @@ integer function qmckl_compute_factor_een_rescaled_e_deriv_e_f(context, 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) :: 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(elec_num,4,elec_num,0:cord_num,walk_num)
|
||||
double precision,dimension(:,:,:),allocatable :: elec_dist_deriv_e
|
||||
double precision :: x, rij_inv, kappa_l
|
||||
integer*8 :: i, j, k, l, nw, ii
|
||||
@ -3437,19 +3438,24 @@ integer function qmckl_compute_factor_een_rescaled_e_deriv_e_f(context, walk_num
|
||||
kappa_l = - dble(l) * rescale_factor_kappa_ee
|
||||
do j = 1, elec_num
|
||||
do i = 1, elec_num
|
||||
do ii = 1, 4
|
||||
een_rescaled_e_deriv_e(l, i, ii, j, nw) = kappa_l * elec_dist_deriv_e(ii, i, j)
|
||||
end do
|
||||
een_rescaled_e_deriv_e(i, 1, j, l, nw) = kappa_l * elec_dist_deriv_e(1, i, j)
|
||||
een_rescaled_e_deriv_e(i, 2, j, l, nw) = kappa_l * elec_dist_deriv_e(2, i, j)
|
||||
een_rescaled_e_deriv_e(i, 3, j, l, nw) = kappa_l * elec_dist_deriv_e(3, i, j)
|
||||
een_rescaled_e_deriv_e(i, 4, j, l, nw) = kappa_l * elec_dist_deriv_e(4, i, j)
|
||||
|
||||
een_rescaled_e_deriv_e(l, i, 4, j, nw) = een_rescaled_e_deriv_e(l, i, 4, j, nw) &
|
||||
+ een_rescaled_e_deriv_e(l, i, 1, j, nw) * een_rescaled_e_deriv_e(l, i, 1, j, nw) &
|
||||
+ een_rescaled_e_deriv_e(l, i, 2, j, nw) * een_rescaled_e_deriv_e(l, i, 2, j, nw) &
|
||||
+ een_rescaled_e_deriv_e(l, i, 3, j, nw) * een_rescaled_e_deriv_e(l, i, 3, j, nw)
|
||||
een_rescaled_e_deriv_e(i, 4, j, l, nw) = een_rescaled_e_deriv_e(i, 4, j, l, nw) &
|
||||
+ een_rescaled_e_deriv_e(i, 1, j, l, nw) * een_rescaled_e_deriv_e(i, 1, j, l, nw) &
|
||||
+ een_rescaled_e_deriv_e(i, 2, j, l, nw) * een_rescaled_e_deriv_e(i, 2, j, l, nw) &
|
||||
+ een_rescaled_e_deriv_e(i, 3, j, l, nw) * een_rescaled_e_deriv_e(i, 3, j, l, nw)
|
||||
|
||||
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(i, j, l, nw)
|
||||
end do
|
||||
een_rescaled_e_deriv_e(i, 1, j, l, nw) = een_rescaled_e_deriv_e(i, 1, j, l, nw) * &
|
||||
een_rescaled_e(i, j, l, nw)
|
||||
een_rescaled_e_deriv_e(i, 3, j, l, nw) = een_rescaled_e_deriv_e(i, 2, j, l, nw) * &
|
||||
een_rescaled_e(i, j, l, nw)
|
||||
een_rescaled_e_deriv_e(i, 3, j, l, nw) = een_rescaled_e_deriv_e(i, 3, j, l, nw) * &
|
||||
een_rescaled_e(i, j, l, nw)
|
||||
een_rescaled_e_deriv_e(i, 4, j, l, nw) = een_rescaled_e_deriv_e(i, 4, j, l, nw) * &
|
||||
een_rescaled_e(i, j, l, nw)
|
||||
end do
|
||||
end do
|
||||
end do
|
||||
@ -3502,7 +3508,7 @@ end function qmckl_compute_factor_een_rescaled_e_deriv_e_f
|
||||
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) :: 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(elec_num,4,elec_num,0:cord_num,walk_num)
|
||||
|
||||
integer(c_int32_t), external :: qmckl_compute_factor_een_rescaled_e_deriv_e_f
|
||||
info = qmckl_compute_factor_een_rescaled_e_deriv_e_f &
|
||||
@ -3602,16 +3608,17 @@ for l in range(0,cord_num+1):
|
||||
|
||||
#+begin_src c :tangle (eval c_test)
|
||||
//assert(qmckl_electron_provided(context));
|
||||
double een_rescaled_e_deriv_e[walk_num][elec_num][4][elec_num][(cord_num + 1)];
|
||||
rc = qmckl_get_jastrow_een_rescaled_e_deriv_e(context, &(een_rescaled_e_deriv_e[0][0][0][0][0]));
|
||||
double een_rescaled_e_deriv_e[walk_num][(cord_num + 1)][elec_num][4][elec_num];
|
||||
size_max=0;
|
||||
rc = qmckl_get_jastrow_een_rescaled_e_deriv_e(context, &(een_rescaled_e_deriv_e[0][0][0][0][0]),&size_max);
|
||||
|
||||
// value of (0,0,0,2,1)
|
||||
assert(fabs(een_rescaled_e_deriv_e[0][0][0][2][1] + 0.05991352796887283 ) < 1.e-12);
|
||||
assert(fabs(een_rescaled_e_deriv_e[0][0][0][3][1] + 0.011714035071545248 ) < 1.e-12);
|
||||
assert(fabs(een_rescaled_e_deriv_e[0][0][0][4][1] + 0.00441398875758468 ) < 1.e-12);
|
||||
assert(fabs(een_rescaled_e_deriv_e[0][1][0][3][2] + 0.013553180060167595 ) < 1.e-12);
|
||||
assert(fabs(een_rescaled_e_deriv_e[0][1][0][4][2] + 0.00041342909359870457) < 1.e-12);
|
||||
assert(fabs(een_rescaled_e_deriv_e[0][1][0][5][2] + 0.5880599146214673 ) < 1.e-12);
|
||||
assert(fabs(een_rescaled_e_deriv_e[0][1][0][0][2] + 0.05991352796887283 ) < 1.e-12);
|
||||
assert(fabs(een_rescaled_e_deriv_e[0][1][0][0][3] + 0.011714035071545248 ) < 1.e-12);
|
||||
assert(fabs(een_rescaled_e_deriv_e[0][1][0][0][4] + 0.00441398875758468 ) < 1.e-12);
|
||||
assert(fabs(een_rescaled_e_deriv_e[0][2][1][0][3] + 0.013553180060167595 ) < 1.e-12);
|
||||
assert(fabs(een_rescaled_e_deriv_e[0][2][1][0][4] + 0.00041342909359870457) < 1.e-12);
|
||||
assert(fabs(een_rescaled_e_deriv_e[0][2][1][0][5] + 0.5880599146214673 ) < 1.e-12);
|
||||
#+end_src
|
||||
|
||||
** Electron-nucleus rescaled distances for each order
|
||||
@ -5139,7 +5146,7 @@ end function qmckl_compute_tmp_c_f
|
||||
| ~elec_num~ | ~int64_t~ | in | Number of electrons |
|
||||
| ~nucl_num~ | ~int64_t~ | in | Number of nucleii |
|
||||
| ~walk_num~ | ~int64_t~ | in | Number of walkers |
|
||||
| ~een_rescaled_e_deriv_e~ | ~double[walk_num][elec_num][4][elec_num][0:cord_num]~ | in | Electron-electron rescaled factor derivatives |
|
||||
| ~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][elec_num][nucl_num][0:cord_num]~ | in | Electron-nucleus rescaled factor |
|
||||
| ~dtmp_c~ | ~double[walk_num][0:cord_num-1][0:cord_num][nucl_num][elec_num]~ | out | vector of non-zero coefficients |
|
||||
|
||||
@ -5154,7 +5161,7 @@ integer function qmckl_compute_dtmp_c_f(context, cord_num, elec_num, nucl_num, &
|
||||
integer*8 , intent(in) :: elec_num
|
||||
integer*8 , intent(in) :: nucl_num
|
||||
integer*8 , intent(in) :: walk_num
|
||||
double precision , intent(in) :: een_rescaled_e_deriv_e(0:cord_num, elec_num, 4, elec_num, walk_num)
|
||||
double precision , intent(in) :: een_rescaled_e_deriv_e(elec_num, 4, 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(out) :: dtmp_c(elec_num, 4, nucl_num,0:cord_num, 0:cord_num-1, walk_num)
|
||||
double precision :: x
|
||||
@ -5162,7 +5169,7 @@ integer function qmckl_compute_dtmp_c_f(context, cord_num, elec_num, nucl_num, &
|
||||
character :: TransA, TransB
|
||||
double precision :: alpha, beta
|
||||
integer*8 :: M, N, K, LDA, LDB, LDC
|
||||
double precision,dimension(:,:,:,:,:),allocatable :: een_rescaled_e_deriv_e_T
|
||||
!double precision,dimension(:,:,:,:,:),allocatable :: een_rescaled_e_deriv_e_T
|
||||
double precision,dimension(:,:,:,:),allocatable :: een_rescaled_n_T
|
||||
|
||||
TransA = 'N'
|
||||
@ -5172,18 +5179,18 @@ integer function qmckl_compute_dtmp_c_f(context, cord_num, elec_num, nucl_num, &
|
||||
|
||||
info = QMCKL_SUCCESS
|
||||
|
||||
allocate(een_rescaled_e_deriv_e_T(elec_num,4,elec_num,0:cord_num,walk_num))
|
||||
!allocate(een_rescaled_e_deriv_e_T(elec_num,4,elec_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 i = 1, elec_num
|
||||
do ii = 1, 4
|
||||
do j = 1, elec_num
|
||||
do l = 0,cord_num
|
||||
een_rescaled_e_deriv_e_T(i,ii,j,l,nw) = een_rescaled_e_deriv_e(l,j,ii,i,nw)
|
||||
end do
|
||||
end do
|
||||
end do
|
||||
end do
|
||||
!do i = 1, elec_num
|
||||
! do ii = 1, 4
|
||||
! do j = 1, elec_num
|
||||
! do l = 0,cord_num
|
||||
! een_rescaled_e_deriv_e_T(i,ii,j,l,nw) = een_rescaled_e_deriv_e(l,j,ii,i,nw)
|
||||
! end do
|
||||
! end do
|
||||
! end do
|
||||
!end do
|
||||
do i = 1, elec_num
|
||||
do j = 1, nucl_num
|
||||
do l = 0,cord_num
|
||||
@ -5216,21 +5223,21 @@ integer function qmckl_compute_dtmp_c_f(context, cord_num, elec_num, nucl_num, &
|
||||
M = 4*elec_num
|
||||
N = nucl_num*(cord_num + 1)
|
||||
K = elec_num
|
||||
LDA = 4*size(een_rescaled_e_deriv_e_T,1)
|
||||
LDA = 4*size(een_rescaled_e_deriv_e,1)
|
||||
LDB = size(een_rescaled_n_T,1)
|
||||
LDC = 4*size(dtmp_c,1)
|
||||
|
||||
do nw=1, walk_num
|
||||
do i=0, cord_num-1
|
||||
info = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, &
|
||||
een_rescaled_e_deriv_e_T(1,1,1,i,nw),LDA*1_8, &
|
||||
een_rescaled_e_deriv_e(1,1,1,i,nw),LDA*1_8, &
|
||||
een_rescaled_n_T(1,1,0,nw),LDB*1_8, &
|
||||
beta, &
|
||||
dtmp_c(1,1,1,0,i,nw),LDC)
|
||||
end do
|
||||
end do
|
||||
|
||||
deallocate(een_rescaled_e_deriv_e_T)
|
||||
!deallocate(een_rescaled_e_deriv_e_T)
|
||||
deallocate(een_rescaled_n_T)
|
||||
end function qmckl_compute_dtmp_c_f
|
||||
#+end_src
|
||||
@ -5267,7 +5274,7 @@ end function qmckl_compute_dtmp_c_f
|
||||
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 :: walk_num
|
||||
real (c_double ) , intent(in) :: een_rescaled_e_deriv_e(0:cord_num,elec_num,4,elec_num,walk_num)
|
||||
real (c_double ) , intent(in) :: een_rescaled_e_deriv_e(elec_num,4,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(out) :: dtmp_c(elec_num,nucl_num,0:cord_num,0:cord_num-1,walk_num)
|
||||
|
||||
@ -5359,7 +5366,7 @@ rc = qmckl_get_jastrow_dtmp_c(context, &(dtmp_c[0][0][0][0][0][0]));
|
||||
|
||||
assert(fabs(tmp_c[0][0][1][0][0] - 2.7083473948352403) < 1e-12);
|
||||
|
||||
assert(fabs(dtmp_c[0][1][0][0][0][0] + 0.237440520852232) < 1e-12);
|
||||
assert(fabs(dtmp_c[0][1][0][0][0][0] - 0.237440520852232) < 1e-12);
|
||||
#+end_src
|
||||
|
||||
** Electron-electron-nucleus Jastrow \(f_{een}\)
|
||||
@ -6264,8 +6271,8 @@ integer function qmckl_compute_factor_een_deriv_e_f(context, walk_num, elec_num,
|
||||
do j = 1, elec_num
|
||||
factor_een_deriv_e(j,ii,nw) = factor_een_deriv_e(j,ii,nw) + (&
|
||||
tmp_c(j,a,m,k,nw) * een_rescaled_n_deriv_e(m+l,a,ii,j,nw) + &
|
||||
(-1.0d0*dtmp_c(j,ii,a,m,k,nw)) * een_rescaled_n(m+l,a,j,nw) + &
|
||||
(-1.0d0*dtmp_c(j,ii,a,m+l,k,nw)) * een_rescaled_n(m,a,j,nw) + &
|
||||
(dtmp_c(j,ii,a,m,k,nw)) * een_rescaled_n(m+l,a,j,nw) + &
|
||||
(dtmp_c(j,ii,a,m+l,k,nw)) * een_rescaled_n(m,a,j,nw) + &
|
||||
tmp_c(j,a,m+l,k,nw) * een_rescaled_n_deriv_e(m,a,ii,j,nw) &
|
||||
) * cn
|
||||
end do
|
||||
@ -6274,12 +6281,12 @@ integer function qmckl_compute_factor_een_deriv_e_f(context, walk_num, elec_num,
|
||||
cn = cn + cn
|
||||
do j = 1, elec_num
|
||||
factor_een_deriv_e(j,4,nw) = factor_een_deriv_e(j,4,nw) + (&
|
||||
(-1.0d0*dtmp_c(j,1,a,m ,k,nw)) * een_rescaled_n_deriv_e(m+l,a,1,j,nw) + &
|
||||
(-1.0d0*dtmp_c(j,2,a,m ,k,nw)) * een_rescaled_n_deriv_e(m+l,a,2,j,nw) + &
|
||||
(-1.0d0*dtmp_c(j,3,a,m ,k,nw)) * een_rescaled_n_deriv_e(m+l,a,3,j,nw) + &
|
||||
(-1.0d0*dtmp_c(j,1,a,m+l,k,nw)) * een_rescaled_n_deriv_e(m ,a,1,j,nw) + &
|
||||
(-1.0d0*dtmp_c(j,2,a,m+l,k,nw)) * een_rescaled_n_deriv_e(m ,a,2,j,nw) + &
|
||||
(-1.0d0*dtmp_c(j,3,a,m+l,k,nw)) * een_rescaled_n_deriv_e(m ,a,3,j,nw) &
|
||||
(dtmp_c(j,1,a,m ,k,nw)) * een_rescaled_n_deriv_e(m+l,a,1,j,nw) + &
|
||||
(dtmp_c(j,2,a,m ,k,nw)) * een_rescaled_n_deriv_e(m+l,a,2,j,nw) + &
|
||||
(dtmp_c(j,3,a,m ,k,nw)) * een_rescaled_n_deriv_e(m+l,a,3,j,nw) + &
|
||||
(dtmp_c(j,1,a,m+l,k,nw)) * een_rescaled_n_deriv_e(m ,a,1,j,nw) + &
|
||||
(dtmp_c(j,2,a,m+l,k,nw)) * een_rescaled_n_deriv_e(m ,a,2,j,nw) + &
|
||||
(dtmp_c(j,3,a,m+l,k,nw)) * een_rescaled_n_deriv_e(m ,a,3,j,nw) &
|
||||
) * cn
|
||||
end do
|
||||
end do
|
||||
|
Loading…
Reference in New Issue
Block a user