1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-12-23 04:44:03 +01:00

Fix factor_en_deriv_e.

This commit is contained in:
v1j4y 2022-02-11 16:06:19 +01:00
parent 82c5f54573
commit 2c7a1eb2c6

View File

@ -2534,11 +2534,11 @@ assert(fabs(factor_en[0]+5.865822569188727) < 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_factor_en_deriv_e(qmckl_context context, double* const factor_en_deriv_e); qmckl_exit_code qmckl_get_jastrow_factor_en_deriv_e(qmckl_context context, double* const factor_en_deriv_e, 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_factor_en_deriv_e(qmckl_context context, double* const factor_en_deriv_e) qmckl_exit_code qmckl_get_jastrow_factor_en_deriv_e(qmckl_context context, double* const factor_en_deriv_e, 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;
@ -2554,6 +2554,7 @@ qmckl_exit_code qmckl_get_jastrow_factor_en_deriv_e(qmckl_context context, doubl
int64_t sze = ctx->electron.walk_num * 4 * ctx->electron.num; int64_t sze = ctx->electron.walk_num * 4 * ctx->electron.num;
memcpy(factor_en_deriv_e, ctx->jastrow.factor_en_deriv_e, sze*sizeof(double)); memcpy(factor_en_deriv_e, ctx->jastrow.factor_en_deriv_e, sze*sizeof(double));
(*size_max) = sze;
return QMCKL_SUCCESS; return QMCKL_SUCCESS;
} }
@ -2703,7 +2704,7 @@ integer function qmckl_compute_factor_en_deriv_e_f(context, walk_num, elec_num,
do nw =1, walk_num do nw =1, walk_num
do a = 1, nucl_num do a = 1, nucl_num
do i = 1, elec_num do i = 1, elec_num
x = en_distance_rescaled(nw, i, a) x = en_distance_rescaled(i,a,nw)
if(abs(x) < 1.0d-18) continue if(abs(x) < 1.0d-18) continue
power_ser_g = 0.0d0 power_ser_g = 0.0d0
den = 1.0d0 + aord_vector(2, type_nucl_vector(a)) * x den = 1.0d0 + aord_vector(2, type_nucl_vector(a)) * x
@ -2713,20 +2714,20 @@ integer function qmckl_compute_factor_en_deriv_e_f(context, walk_num, elec_num,
xinv = 1.0d0 / x xinv = 1.0d0 / x
do ii = 1, 4 do ii = 1, 4
dx(ii) = en_distance_rescaled_deriv_e(nw, ii, i, a) dx(ii) = en_distance_rescaled_deriv_e(ii,i,a,nw)
end do end do
lap1 = 0.0d0 lap1 = 0.0d0
lap2 = 0.0d0 lap2 = 0.0d0
lap3 = 0.0d0 lap3 = 0.0d0
do ii = 1, 3 do ii = 1, 3
x = en_distance_rescaled(nw, i, a) x = en_distance_rescaled(i, a, nw)
do p = 2, aord_num do p = 2, aord_num
y = p * aord_vector(p + 1, type_nucl_vector(a)) * x y = p * aord_vector(p + 1, type_nucl_vector(a)) * x
power_ser_g(ii) = power_ser_g(ii) + y * dx(ii) power_ser_g(ii) = power_ser_g(ii) + y * dx(ii)
lap1 = lap1 + (p - 1) * y * xinv * dx(ii) * dx(ii) lap1 = lap1 + (p - 1) * y * xinv * dx(ii) * dx(ii)
lap2 = lap2 + y lap2 = lap2 + y
x = x * en_distance_rescaled(nw, i, a) x = x * en_distance_rescaled(i, a, nw)
end do end do
lap3 = lap3 - 2.0d0 * aord_vector(2, type_nucl_vector(a)) * dx(ii) * dx(ii) lap3 = lap3 - 2.0d0 * aord_vector(2, type_nucl_vector(a)) * dx(ii) * dx(ii)
@ -2920,7 +2921,8 @@ assert(qmckl_jastrow_provided(context));
// calculate factor_en_deriv_e // calculate factor_en_deriv_e
double factor_en_deriv_e[walk_num][4][elec_num]; double factor_en_deriv_e[walk_num][4][elec_num];
rc = qmckl_get_jastrow_factor_en_deriv_e(context, &(factor_en_deriv_e[0][0][0])); size_max=0;
rc = qmckl_get_jastrow_factor_en_deriv_e(context, &(factor_en_deriv_e[0][0][0]),&size_max);
// check factor_en_deriv_e // check factor_en_deriv_e
assert(fabs(factor_en_deriv_e[0][0][0]-0.11609919541763383) < 1.e-12); assert(fabs(factor_en_deriv_e[0][0][0]-0.11609919541763383) < 1.e-12);